public class HardwareDeviceManager extends java.lang.Object implements DeviceManager
DeviceManager.UsbDeviceType
Modifier and Type | Field and Description |
---|---|
static java.lang.Object |
scanDevicesLock |
static java.lang.String |
TAG |
static java.lang.String |
TAG_USB_SCAN |
Constructor and Description |
---|
HardwareDeviceManager(Context context,
SyncdDevice.Manager manager)
ModernRoboticsUsbDeviceManager constructor
|
Modifier and Type | Method and Description |
---|---|
ColorSensor |
createAdafruitI2cColorSensor(I2cController controller,
DeviceConfiguration.I2cChannel channel,
java.lang.String name)
Create an instance of a ColorSensor
|
ColorSensor |
createAdafruitI2cColorSensor(RobotCoreLynxModule lynxModule,
DeviceConfiguration.I2cChannel channel,
java.lang.String name) |
AnalogOutput |
createAnalogOutputDevice(AnalogOutputController controller,
int channel,
java.lang.String name) |
HardwareDevice |
createAnalogSensor(AnalogInputController controller,
int channel,
AnalogSensorConfigurationType type) |
CRServo |
createCRServo(ServoController controller,
int portNumber,
java.lang.String name) |
CRServo |
createCRServoEx(ServoControllerEx controller,
int portNumber,
java.lang.String name,
ServoConfigurationType servoType) |
HardwareDevice |
createCustomServoDevice(ServoController controller,
int portNumber,
ServoConfigurationType servoConfigurationType) |
DcMotor |
createDcMotor(DcMotorController controller,
int portNumber,
MotorConfigurationType motorType,
java.lang.String name)
Create an instance of a DcMotor
|
DcMotor |
createDcMotorEx(DcMotorController controller,
int portNumber,
MotorConfigurationType motorType,
java.lang.String name) |
DeviceInterfaceModule |
createDeviceInterfaceModule(SerialNumber serialNumber,
java.lang.String name) |
HardwareDevice |
createDigitalDevice(DigitalChannelController controller,
int channel,
DigitalIoDeviceConfigurationType type) |
AccelerationSensor |
createHTAccelerationSensor(LegacyModule legacyModule,
int physicalPort,
java.lang.String name)
Create an instance of a AccelerationSensor
|
ColorSensor |
createHTColorSensor(LegacyModule controller,
int channel,
java.lang.String name)
Create an instance of a ColorSensor
|
CompassSensor |
createHTCompassSensor(LegacyModule legacyModule,
int physicalPort,
java.lang.String name)
Create an instance of a NxtCompassSensor
|
DcMotorController |
createHTDcMotorController(LegacyModule legacyModule,
int physicalPort,
java.lang.String name)
Create an instance of an NXT DcMotorController
|
GyroSensor |
createHTGyroSensor(LegacyModule legacyModule,
int physicalPort,
java.lang.String name)
Create an instance of a GyroSensor
|
IrSeekerSensor |
createHTIrSeekerSensor(LegacyModule legacyModule,
int physicalPort,
java.lang.String name)
Create an instance of a IrSeekerSensor
|
LightSensor |
createHTLightSensor(LegacyModule legacyModule,
int physicalPort,
java.lang.String name)
Create an instance of a LightSensor
|
ServoController |
createHTServoController(LegacyModule legacyModule,
int physicalPort,
java.lang.String name)
Create an instance of an NXT ServoController
|
TouchSensorMultiplexer |
createHTTouchSensorMultiplexer(LegacyModule legacyModule,
int port,
java.lang.String name) |
I2cDevice |
createI2cDevice(I2cController controller,
DeviceConfiguration.I2cChannel channel,
java.lang.String name) |
protected I2cDeviceSynch |
createI2cDeviceSynch(I2cController controller,
int channel,
java.lang.String name) |
I2cDeviceSynch |
createI2cDeviceSynch(RobotCoreLynxModule lynxModule,
DeviceConfiguration.I2cChannel channel,
java.lang.String name) |
protected I2cDeviceSynchSimple |
createI2cDeviceSynchSimple(I2cController controller,
int channel,
java.lang.String name) |
protected I2cDeviceSynchSimple |
createI2cDeviceSynchSimple(RobotCoreLynxModule lynxModule,
DeviceConfiguration.I2cChannel channel,
java.lang.String name) |
LED |
createLED(DigitalChannelController controller,
int channel,
java.lang.String name)
Create an instance of an LED
|
ColorSensor |
createLynxColorRangeSensor(RobotCoreLynxModule lynxModule,
DeviceConfiguration.I2cChannel channel,
java.lang.String name) |
HardwareDevice |
createLynxCustomServoDevice(ServoControllerEx controller,
int portNumber,
ServoConfigurationType servoConfigurationType) |
RobotCoreLynxModule |
createLynxModule(RobotCoreLynxUsbDevice lynxUsbDevice,
int moduleAddress,
boolean isParent,
java.lang.String name)
Creates an instance of a LynxModule
|
RobotCoreLynxUsbDevice |
createLynxUsbDevice(SerialNumber serialNumber,
java.lang.String name)
Note: unlike other creation methods, creating a Lynx USB device will succeed even if
the device is already open (in which case it will return a new delegate to the existing
instance).
|
ColorSensor |
createModernRoboticsI2cColorSensor(I2cController controller,
DeviceConfiguration.I2cChannel channel,
java.lang.String name)
Create an instance of a ColorSensor
|
ColorSensor |
createModernRoboticsI2cColorSensor(RobotCoreLynxModule lynxModule,
DeviceConfiguration.I2cChannel channel,
java.lang.String name) |
GyroSensor |
createModernRoboticsI2cGyroSensor(I2cController controller,
DeviceConfiguration.I2cChannel channel,
java.lang.String name)
Create an instance of a GyroSensor
|
GyroSensor |
createModernRoboticsI2cGyroSensor(RobotCoreLynxModule lynxModule,
DeviceConfiguration.I2cChannel channel,
java.lang.String name) |
TouchSensor |
createMRDigitalTouchSensor(DigitalChannelController digitalChannelController,
int physicalPort,
java.lang.String name)
Create an instance of a Modern Robotics TouchSensor on a digital controller
|
IrSeekerSensor |
createMRI2cIrSeekerSensorV3(I2cController i2cController,
DeviceConfiguration.I2cChannel channel,
java.lang.String name)
Create an instance of a IrSeekerSensorV3
|
IrSeekerSensor |
createMRI2cIrSeekerSensorV3(RobotCoreLynxModule lynxModule,
DeviceConfiguration.I2cChannel channel,
java.lang.String name) |
TouchSensor |
createNxtTouchSensor(LegacyModule legacyModule,
int physicalPort,
java.lang.String name) |
UltrasonicSensor |
createNxtUltrasonicSensor(LegacyModule legacyModule,
int physicalPort,
java.lang.String name)
Create an instance of an UltrasonicSensor
|
PWMOutput |
createPwmOutputDevice(PWMOutputController controller,
int channel,
java.lang.String name) |
Servo |
createServo(ServoController controller,
int portNumber,
java.lang.String name)
Create an instance of a Servo
|
Servo |
createServoEx(ServoControllerEx controller,
int portNumber,
java.lang.String name,
ServoConfigurationType servoType) |
DcMotorController |
createUsbDcMotorController(SerialNumber serialNumber,
java.lang.String name)
Create an instance of a DcMotorController
|
LegacyModule |
createUsbLegacyModule(SerialNumber serialNumber,
java.lang.String name)
Create an instance of a LegacyModule
|
static RobotUsbManager |
createUsbManager() |
ServoController |
createUsbServoController(SerialNumber serialNumber,
java.lang.String name)
Create an instance of a ServoController
|
HardwareDevice |
createUserI2cDevice(I2cController controller,
DeviceConfiguration.I2cChannel channel,
I2cDeviceConfigurationType type,
java.lang.String name)
Returns a new instance of a user-defined sensor type.
|
HardwareDevice |
createUserI2cDevice(RobotCoreLynxModule lynxModule,
DeviceConfiguration.I2cChannel bus,
I2cDeviceConfigurationType type,
java.lang.String name) |
WebcamName |
createWebcamName(SerialNumber serialNumber,
java.lang.String name)
Creates a
WebcamName from the indicated serialized contents |
ScannedDevices |
scanForUsbDevices()
Returns a map from serial number to UsbDeviceType
|
protected void |
scanForWebcams(ScannedDevices scannedDevices) |
public static final java.lang.String TAG
public static final java.lang.String TAG_USB_SCAN
public static final java.lang.Object scanDevicesLock
public HardwareDeviceManager(Context context, SyncdDevice.Manager manager)
context
- Context of current Android appmanager
- event loop managerRobotCoreException
- if unable to open FTDI D2XX managerpublic static RobotUsbManager createUsbManager()
public ScannedDevices scanForUsbDevices() throws RobotCoreException
scanForUsbDevices
in interface DeviceManager
RobotCoreException
- if unable to open a deviceprotected void scanForWebcams(ScannedDevices scannedDevices)
public RobotCoreLynxUsbDevice createLynxUsbDevice(SerialNumber serialNumber, java.lang.String name) throws RobotCoreException, java.lang.InterruptedException
createLynxUsbDevice
in interface DeviceManager
RobotCoreException
java.lang.InterruptedException
public DcMotorController createUsbDcMotorController(SerialNumber serialNumber, java.lang.String name) throws RobotCoreException, java.lang.InterruptedException
DeviceManager
createUsbDcMotorController
in interface DeviceManager
serialNumber
- serial number of controllerRobotCoreException
- if unable to create instancejava.lang.InterruptedException
public DcMotor createDcMotor(DcMotorController controller, int portNumber, MotorConfigurationType motorType, java.lang.String name)
DeviceManager
createDcMotor
in interface DeviceManager
controller
- DC Motor controller this motor is attached toportNumber
- physical port number on the controllermotorType
- the optional type we know of for this motorpublic DcMotor createDcMotorEx(DcMotorController controller, int portNumber, MotorConfigurationType motorType, java.lang.String name)
createDcMotorEx
in interface DeviceManager
public ServoController createUsbServoController(SerialNumber serialNumber, java.lang.String name) throws RobotCoreException, java.lang.InterruptedException
DeviceManager
createUsbServoController
in interface DeviceManager
serialNumber
- serial number of controllerRobotCoreException
- if unable to create instancejava.lang.InterruptedException
public Servo createServo(ServoController controller, int portNumber, java.lang.String name)
DeviceManager
createServo
in interface DeviceManager
controller
- Servo controller this servo is attached toportNumber
- physical port number on the controllerpublic CRServo createCRServo(ServoController controller, int portNumber, java.lang.String name)
createCRServo
in interface DeviceManager
public Servo createServoEx(ServoControllerEx controller, int portNumber, java.lang.String name, ServoConfigurationType servoType)
createServoEx
in interface DeviceManager
public CRServo createCRServoEx(ServoControllerEx controller, int portNumber, java.lang.String name, ServoConfigurationType servoType)
createCRServoEx
in interface DeviceManager
public HardwareDevice createCustomServoDevice(ServoController controller, int portNumber, ServoConfigurationType servoConfigurationType)
createCustomServoDevice
in interface DeviceManager
public HardwareDevice createLynxCustomServoDevice(ServoControllerEx controller, int portNumber, ServoConfigurationType servoConfigurationType)
createLynxCustomServoDevice
in interface DeviceManager
public DeviceInterfaceModule createDeviceInterfaceModule(SerialNumber serialNumber, java.lang.String name) throws RobotCoreException, java.lang.InterruptedException
createDeviceInterfaceModule
in interface DeviceManager
serialNumber
- serial number of Core Device Interface moduleRobotCoreException
- if unable to create instancejava.lang.InterruptedException
public LegacyModule createUsbLegacyModule(SerialNumber serialNumber, java.lang.String name) throws RobotCoreException, java.lang.InterruptedException
DeviceManager
createUsbLegacyModule
in interface DeviceManager
serialNumber
- serial number of legacy moduleRobotCoreException
- if unable to create instancejava.lang.InterruptedException
public DcMotorController createHTDcMotorController(LegacyModule legacyModule, int physicalPort, java.lang.String name)
DeviceManager
createHTDcMotorController
in interface DeviceManager
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected topublic RobotCoreLynxModule createLynxModule(RobotCoreLynxUsbDevice lynxUsbDevice, int moduleAddress, boolean isParent, java.lang.String name)
DeviceManager
createLynxModule
in interface DeviceManager
public WebcamName createWebcamName(SerialNumber serialNumber, java.lang.String name) throws RobotCoreException, java.lang.InterruptedException
DeviceManager
WebcamName
from the indicated serialized contentscreateWebcamName
in interface DeviceManager
RobotCoreException
java.lang.InterruptedException
public ServoController createHTServoController(LegacyModule legacyModule, int physicalPort, java.lang.String name)
DeviceManager
createHTServoController
in interface DeviceManager
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected topublic CompassSensor createHTCompassSensor(LegacyModule legacyModule, int physicalPort, java.lang.String name)
DeviceManager
createHTCompassSensor
in interface DeviceManager
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected topublic TouchSensor createMRDigitalTouchSensor(DigitalChannelController digitalChannelController, int physicalPort, java.lang.String name)
DeviceManager
createMRDigitalTouchSensor
in interface DeviceManager
digitalChannelController
- controller this device is connected tophysicalPort
- the port number of the device on that controllername
- the name of this device in the hardware mappublic AccelerationSensor createHTAccelerationSensor(LegacyModule legacyModule, int physicalPort, java.lang.String name)
DeviceManager
createHTAccelerationSensor
in interface DeviceManager
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected topublic LightSensor createHTLightSensor(LegacyModule legacyModule, int physicalPort, java.lang.String name)
DeviceManager
createHTLightSensor
in interface DeviceManager
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected topublic GyroSensor createHTGyroSensor(LegacyModule legacyModule, int physicalPort, java.lang.String name)
DeviceManager
createHTGyroSensor
in interface DeviceManager
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected topublic IrSeekerSensor createHTIrSeekerSensor(LegacyModule legacyModule, int physicalPort, java.lang.String name)
DeviceManager
createHTIrSeekerSensor
in interface DeviceManager
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected topublic IrSeekerSensor createMRI2cIrSeekerSensorV3(I2cController i2cController, DeviceConfiguration.I2cChannel channel, java.lang.String name)
DeviceManager
createMRI2cIrSeekerSensorV3
in interface DeviceManager
i2cController
- the I2cController
this device is connected tochannel
- port number on the Device Interface Module this device is connected topublic IrSeekerSensor createMRI2cIrSeekerSensorV3(RobotCoreLynxModule lynxModule, DeviceConfiguration.I2cChannel channel, java.lang.String name)
createMRI2cIrSeekerSensorV3
in interface DeviceManager
public UltrasonicSensor createNxtUltrasonicSensor(LegacyModule legacyModule, int physicalPort, java.lang.String name)
DeviceManager
createNxtUltrasonicSensor
in interface DeviceManager
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected topublic TouchSensor createNxtTouchSensor(LegacyModule legacyModule, int physicalPort, java.lang.String name)
createNxtTouchSensor
in interface DeviceManager
legacyModule
- the Legacy Module this sensor is attached tophysicalPort
- port number on Legacy Module it's connected topublic TouchSensorMultiplexer createHTTouchSensorMultiplexer(LegacyModule legacyModule, int port, java.lang.String name)
createHTTouchSensorMultiplexer
in interface DeviceManager
legacyModule
- the Legacy Module this sensor is attached toport
- port number on Legacy Module this sensor is connected to.public HardwareDevice createAnalogSensor(AnalogInputController controller, int channel, AnalogSensorConfigurationType type)
createAnalogSensor
in interface DeviceManager
controller
- Analog Input Controller Module this device is connected topublic AnalogOutput createAnalogOutputDevice(AnalogOutputController controller, int channel, java.lang.String name)
createAnalogOutputDevice
in interface DeviceManager
controller
- Analog Output Controller Module this device is connected topublic HardwareDevice createDigitalDevice(DigitalChannelController controller, int channel, DigitalIoDeviceConfigurationType type)
createDigitalDevice
in interface DeviceManager
controller
- Device Interface Module this device is connected topublic PWMOutput createPwmOutputDevice(PWMOutputController controller, int channel, java.lang.String name)
createPwmOutputDevice
in interface DeviceManager
controller
- PWM Output Controller Module this device is connected topublic I2cDevice createI2cDevice(I2cController controller, DeviceConfiguration.I2cChannel channel, java.lang.String name)
createI2cDevice
in interface DeviceManager
controller
- I2c Controller Module this device is conneced tochannel
- the channel it's connected to on the Controllerpublic HardwareDevice createUserI2cDevice(I2cController controller, DeviceConfiguration.I2cChannel channel, I2cDeviceConfigurationType type, java.lang.String name)
DeviceManager
createUserI2cDevice
in interface DeviceManager
public HardwareDevice createUserI2cDevice(RobotCoreLynxModule lynxModule, DeviceConfiguration.I2cChannel bus, I2cDeviceConfigurationType type, java.lang.String name)
createUserI2cDevice
in interface DeviceManager
public ColorSensor createAdafruitI2cColorSensor(I2cController controller, DeviceConfiguration.I2cChannel channel, java.lang.String name)
DeviceManager
createAdafruitI2cColorSensor
in interface DeviceManager
controller
- Device Interface Module this sensor is connected tochannel
- the I2C port on the Device Interface this module is connected topublic ColorSensor createAdafruitI2cColorSensor(RobotCoreLynxModule lynxModule, DeviceConfiguration.I2cChannel channel, java.lang.String name)
createAdafruitI2cColorSensor
in interface DeviceManager
public ColorSensor createLynxColorRangeSensor(RobotCoreLynxModule lynxModule, DeviceConfiguration.I2cChannel channel, java.lang.String name)
createLynxColorRangeSensor
in interface DeviceManager
public ColorSensor createHTColorSensor(LegacyModule controller, int channel, java.lang.String name)
DeviceManager
createHTColorSensor
in interface DeviceManager
controller
- Legacy Module this sensor is attached tochannel
- the I2C port it's connected topublic ColorSensor createModernRoboticsI2cColorSensor(I2cController controller, DeviceConfiguration.I2cChannel channel, java.lang.String name)
DeviceManager
createModernRoboticsI2cColorSensor
in interface DeviceManager
controller
- Device Interface Module this sensor is attached tochannel
- the I2C port it's connected topublic ColorSensor createModernRoboticsI2cColorSensor(RobotCoreLynxModule lynxModule, DeviceConfiguration.I2cChannel channel, java.lang.String name)
createModernRoboticsI2cColorSensor
in interface DeviceManager
public GyroSensor createModernRoboticsI2cGyroSensor(I2cController controller, DeviceConfiguration.I2cChannel channel, java.lang.String name)
DeviceManager
createModernRoboticsI2cGyroSensor
in interface DeviceManager
controller
- module this device is connected tochannel
- i2c connection channelpublic GyroSensor createModernRoboticsI2cGyroSensor(RobotCoreLynxModule lynxModule, DeviceConfiguration.I2cChannel channel, java.lang.String name)
createModernRoboticsI2cGyroSensor
in interface DeviceManager
public LED createLED(DigitalChannelController controller, int channel, java.lang.String name)
DeviceManager
createLED
in interface DeviceManager
controller
- Digital Channel Controller this LED is connected tochannel
- the digital port it's connected topublic I2cDeviceSynch createI2cDeviceSynch(RobotCoreLynxModule lynxModule, DeviceConfiguration.I2cChannel channel, java.lang.String name)
createI2cDeviceSynch
in interface DeviceManager
protected I2cDeviceSynchSimple createI2cDeviceSynchSimple(I2cController controller, int channel, java.lang.String name)
protected I2cDeviceSynchSimple createI2cDeviceSynchSimple(RobotCoreLynxModule lynxModule, DeviceConfiguration.I2cChannel channel, java.lang.String name)
protected I2cDeviceSynch createI2cDeviceSynch(I2cController controller, int channel, java.lang.String name)