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, physicalPortdistanceOutOfRange| 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, onModuleStateChangepublic 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()
LegacyModulePortDeviceImplmoduleNowArmedOrPretending in class LegacyModulePortDeviceImplpublic java.lang.String toString()
toString in class java.lang.Objectprotected byte rawUltrasonic()
public double getUltrasonicLevel()
UltrasonicSensorgetUltrasonicLevel in interface UltrasonicSensorpublic double getDistance(DistanceUnit unit)
DistanceSensorgetDistance in interface DistanceSensorunit - the unit of distance in which the result should be returnedDistanceSensor.distanceOutOfRange is
returned;public void portIsReady(int port)
portIsReady in interface I2cController.I2cPortReadyCallbackpublic java.lang.String status()
UltrasonicSensorstatus in interface UltrasonicSensorpublic HardwareDevice.Manufacturer getManufacturer()
HardwareDevicegetManufacturer in interface HardwareDevicepublic java.lang.String getDeviceName()
HardwareDevicegetDeviceName in interface HardwareDevicepublic java.lang.String getConnectionInfo()
HardwareDevicegetConnectionInfo in interface HardwareDevicepublic int getVersion()
HardwareDevicegetVersion in interface HardwareDevicepublic void resetDeviceConfigurationForOpMode()
HardwareDeviceresetDeviceConfigurationForOpMode in interface HardwareDevicepublic void close()
HardwareDeviceclose in interface HardwareDevice