com.serialpundit.serial.vendor.FTdeviceInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sp-tty Show documentation
Show all versions of sp-tty Show documentation
Serial port APIs of SerialPundit
The newest version!
/*
* This file is part of SerialPundit.
*
* Copyright (C) 2014-2016, Rishi Gupta. All rights reserved.
*
* The SerialPundit is DUAL LICENSED. It is made available under the terms of the GNU Affero
* General Public License (AGPL) v3.0 for non-commercial use and under the terms of a commercial
* license for commercial use of this software.
*
* The SerialPundit is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package com.serialpundit.serial.vendor;
import com.serialpundit.core.util.SerialComUtil;
/**
* Represents a device returned by calling listDevices() method in
* SerialComFTDID2XX class.
*
* @author Rishi Gupta
*/
public final class FTdeviceInfo {
private String locId = null;
private String serialNumber = null;
private String description = null;
/**
* Construct and allocates a new FTdeviceInfo object with given details.
*
* @param locId location ID of the device.
* @param serialNumber serial number of this device.
* @param description description of this device.
*/
public FTdeviceInfo(String locId, String serialNumber, String description) {
this.locId = locId;
this.serialNumber = serialNumber;
this.description = description;
}
/**
* Retrieves the locId for this FT device.
*
* @return locId for this FT device.
* @throws NumberFormatException if the locId hex string can not be converted into numerical
* representation.
*/
public long getLocId() {
return SerialComUtil.hexStrToLongNumber(locId);
}
/**
* Retrieves the serial number string for this FT device.
*
* @return serial number string for this FT device.
*/
public String getSerialNumber() {
return serialNumber;
}
/**
* Retrieves the description for this FT device.
*
* @return description string for this FT device.
*/
public String getDescription() {
return description;
}
/**
* Prints information about this FT device on console.
*/
public void dumpDeviceInfo() {
System.out.println("LocID : 0x" + locId +
"\nSerialNumber : " + serialNumber +
"\nDescription : " + description);
}
}