use of com.qualcomm.robotcore.hardware.configuration.DeviceInterfaceModuleConfiguration in project robotcode by OutoftheBoxFTC.
the class HardwareFactory method createHardwareMap.
// ------------------------------------------------------------------------------------------------
// Hardware management
// ------------------------------------------------------------------------------------------------
/**
* Create a hardware map
*
* @return HardwareMap
*/
public HardwareMap createHardwareMap(EventLoopManager manager) throws RobotCoreException, InterruptedException {
// We synchronize with scanning so that there's only one thread trying to open *new* FTDI devices at a time
synchronized (HardwareDeviceManager.scanDevicesLock) {
RobotLog.vv(TAG, "createHardwareMap()");
// Clear notion of embedded lynx module that we currently have. We'll discovery a new one,
// if he's there, when we go through the below.
WifiDirectInviteDialogMonitor.clearUILynxModule();
HardwareMap map = new HardwareMap(context);
if (xmlPullParser != null) {
DeviceManager deviceMgr = new HardwareDeviceManager(context, manager);
ReadXMLFileHandler readXmlFileHandler = new ReadXMLFileHandler();
List<ControllerConfiguration> ctrlConfList = readXmlFileHandler.parse(xmlPullParser);
for (ControllerConfiguration ctrlConf : ctrlConfList) {
ConfigurationType type = ctrlConf.getConfigurationType();
if (type == BuiltInConfigurationType.MOTOR_CONTROLLER) {
mapUsbMotorController(map, deviceMgr, (MotorControllerConfiguration) ctrlConf);
} else if (type == BuiltInConfigurationType.SERVO_CONTROLLER) {
mapUsbServoController(map, deviceMgr, (ServoControllerConfiguration) ctrlConf);
} else if (type == BuiltInConfigurationType.LEGACY_MODULE_CONTROLLER) {
mapUsbLegacyModule(map, deviceMgr, (LegacyModuleControllerConfiguration) ctrlConf);
} else if (type == BuiltInConfigurationType.DEVICE_INTERFACE_MODULE) {
mapCoreInterfaceDeviceModule(map, deviceMgr, (DeviceInterfaceModuleConfiguration) ctrlConf);
} else if (type == BuiltInConfigurationType.LYNX_USB_DEVICE) {
mapLynxUsbDevice(map, deviceMgr, (LynxUsbDeviceConfiguration) ctrlConf);
} else {
RobotLog.ee(TAG, "Unexpected controller type while parsing XML: " + type.toString());
}
}
} else {
// no XML to parse, just return empty map
RobotLog.vv(TAG, "no xml to parse: using empty map");
}
return map;
}
}
Aggregations