本文整理汇总了Java中com.qualcomm.robotcore.hardware.HardwareMap.DeviceMapping方法的典型用法代码示例。如果您正苦于以下问题:Java HardwareMap.DeviceMapping方法的具体用法?Java HardwareMap.DeviceMapping怎么用?Java HardwareMap.DeviceMapping使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.qualcomm.robotcore.hardware.HardwareMap
的用法示例。
在下文中一共展示了HardwareMap.DeviceMapping方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildFromDeviceMapping
import com.qualcomm.robotcore.hardware.HardwareMap; //导入方法依赖的package包/类
public ImmutableMap<String, T> buildFromDeviceMapping(HardwareMap.DeviceMapping<T> deviceMapping) {
ImmutableMap.Builder<String, T> mapBuilder = ImmutableMap.builder();
Set<Map.Entry<String, T>> entries = deviceMapping.entrySet();
for (Map.Entry<String, T> device : entries) {
mapBuilder.put(device.getKey(), device.getValue());
}
return mapBuilder.build();
}
示例2: deviceMappings
import com.qualcomm.robotcore.hardware.HardwareMap; //导入方法依赖的package包/类
public static List<HardwareMap.DeviceMapping<?>> deviceMappings(HardwareMap map)
// Returns all the device mappings within the map
{
List<HardwareMap.DeviceMapping<?>> result = new LinkedList<>();
result.add(map.dcMotorController);
result.add(map.servoController);
result.add(map.legacyModule);
result.add(map.deviceInterfaceModule);
result.add(map.colorSensor);
result.add(map.dcMotor);
result.add(map.gyroSensor);
result.add(map.servo);
result.add(map.analogInput);
result.add(map.digitalChannel);
result.add(map.opticalDistanceSensor);
result.add(map.touchSensor);
result.add(map.pwmOutput);
result.add(map.i2cDevice);
result.add(map.analogOutput);
result.add(map.led);
result.add(map.accelerationSensor);
result.add(map.compassSensor);
result.add(map.irSeekerSensor);
result.add(map.lightSensor);
result.add(map.ultrasonicSensor);
result.add(map.voltageSensor);
result.add(map.touchSensorMultiplexer);
return result;
}
示例3: remove
import com.qualcomm.robotcore.hardware.HardwareMap; //导入方法依赖的package包/类
public static <T extends HardwareDevice> void remove(HardwareMap.DeviceMapping<T> from, IFuncArg<Boolean, T> predicate, IAction<T> action) {
List<String> names = new LinkedList<>();
for (Map.Entry<String, T> pair : from.entrySet()) {
T t = pair.getValue();
if (predicate == null || predicate.value(t)) {
names.add(pair.getKey());
if (action != null) action.doAction(t);
}
}
for (String name : names) {
removeName(from, name);
}
}
示例4: contains
import com.qualcomm.robotcore.hardware.HardwareMap; //导入方法依赖的package包/类
public static <T extends HardwareDevice> boolean contains(HardwareMap.DeviceMapping<T> map, String name) {
for (Map.Entry<String, T> pair : map.entrySet()) {
if (pair.getKey().equals(name))
return true;
}
return false;
}
示例5: DeviceMap
import com.qualcomm.robotcore.hardware.HardwareMap; //导入方法依赖的package包/类
public DeviceMap(HardwareMap.DeviceMapping<T> deviceMapping) {
super();
delegate = buildFromDeviceMapping(deviceMapping);
}
示例6: removeName
import com.qualcomm.robotcore.hardware.HardwareMap; //导入方法依赖的package包/类
public static <T extends HardwareDevice> void removeName(HardwareMap.DeviceMapping<T> entrySet, String name) {
Util.<Map>getPrivateObjectField(entrySet, 0).remove(name);
}