public class HiTechnicNxtUltrasonicSensor extends LegacyModulePortDeviceImpl implements UltrasonicSensor, DistanceSensor, I2cController.I2cPortReadyCallback
HardwareDevice.Manufacturer
Modifier and Type | Field and Description |
---|---|
static int |
ADDRESS_DISTANCE |
protected static int |
cmUltrasonicMax |
static I2cAddr |
I2C_ADDRESS |
static int |
MAX_PORT |
static int |
MIN_PORT |
module, physicalPort
distanceOutOfRange
Constructor and Description |
---|
HiTechnicNxtUltrasonicSensor(ModernRoboticsUsbLegacyModule legacyModule,
int physicalPort) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this device
|
java.lang.String |
getConnectionInfo()
Get connection information about this device in a human readable format
|
java.lang.String |
getDeviceName()
Returns a string suitable for display to the user as to the type of device.
|
double |
getDistance(DistanceUnit unit)
Returns the current distance in the indicated distance units
|
HardwareDevice.Manufacturer |
getManufacturer()
Returns an indication of the manufacturer of this device.
|
double |
getUltrasonicLevel()
Get the Ultrasonic levels from this sensor
|
int |
getVersion()
Version
|
protected void |
moduleNowArmedOrPretending()
intended as a subclass hook
|
void |
portIsReady(int port) |
protected byte |
rawUltrasonic() |
void |
resetDeviceConfigurationForOpMode()
Resets the device's configuration to that which is expected at the beginning of an OpMode.
|
java.lang.String |
status()
Status of this sensor, in string form
|
java.lang.String |
toString() |
finishConstruction, getLegacyModule, getPort, moduleNowDisarmed, onModuleStateChange
public static final I2cAddr I2C_ADDRESS
public static final int ADDRESS_DISTANCE
public static final int MAX_PORT
public static final int MIN_PORT
protected static final int cmUltrasonicMax
public HiTechnicNxtUltrasonicSensor(ModernRoboticsUsbLegacyModule legacyModule, int physicalPort)
protected void moduleNowArmedOrPretending()
LegacyModulePortDeviceImpl
moduleNowArmedOrPretending
in class LegacyModulePortDeviceImpl
public java.lang.String toString()
toString
in class java.lang.Object
protected byte rawUltrasonic()
public double getUltrasonicLevel()
UltrasonicSensor
getUltrasonicLevel
in interface UltrasonicSensor
public double getDistance(DistanceUnit unit)
DistanceSensor
getDistance
in interface DistanceSensor
unit
- the unit of distance in which the result should be returnedDistanceSensor.distanceOutOfRange
is
returned;public void portIsReady(int port)
portIsReady
in interface I2cController.I2cPortReadyCallback
public java.lang.String status()
UltrasonicSensor
status
in interface UltrasonicSensor
public HardwareDevice.Manufacturer getManufacturer()
HardwareDevice
getManufacturer
in interface HardwareDevice
public java.lang.String getDeviceName()
HardwareDevice
getDeviceName
in interface HardwareDevice
public java.lang.String getConnectionInfo()
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public int getVersion()
HardwareDevice
getVersion
in interface HardwareDevice
public void resetDeviceConfigurationForOpMode()
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
public void close()
HardwareDevice
close
in interface HardwareDevice