本文整理汇总了Java中com.codeminders.hidapi.ClassPathLibraryLoader类的典型用法代码示例。如果您正苦于以下问题:Java ClassPathLibraryLoader类的具体用法?Java ClassPathLibraryLoader怎么用?Java ClassPathLibraryLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClassPathLibraryLoader类属于com.codeminders.hidapi包,在下文中一共展示了ClassPathLibraryLoader类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: UsbTrezor
点赞 3
import com.codeminders.hidapi.ClassPathLibraryLoader; //导入依赖的package包/类
/**
* <p>Create a new instance of a USB-based Trezor device (standard)</p>
*
* @param vendorIdOptional The vendor ID (default is 0x10c4)
* @param productIdOptional The product ID (default is 0xea80)
* @param serialNumberOptional The device serial number (default is to accept any)
*/
public UsbTrezor(Optional<Integer> vendorIdOptional,
Optional<Integer> productIdOptional,
Optional<String> serialNumberOptional) {
// Initialise the HID library
if (!ClassPathLibraryLoader.loadNativeHIDLibrary()) {
throw new IllegalStateException(
"Unable to load native USB library. Check class loader permissions/JAR integrity.");
}
this.vendorIdOptional = vendorIdOptional;
this.productIdOptional = productIdOptional;
this.serialNumberOptional = serialNumberOptional;
}
开发者ID:Multibit-Legacy,
项目名称:trezorj,
代码行数:23,
代码来源:UsbTrezor.java
示例2: main
点赞 2
import com.codeminders.hidapi.ClassPathLibraryLoader; //导入依赖的package包/类
public static void main(String[] args) {
ClassPathLibraryLoader.loadNativeHIDLibrary();
InputDevice device = new PS3InputDevice();
PS3uDrawTest test = new PS3uDrawTest(device);
device.addButtonStateListener(test);
device.addDPadStateListener(test);
Thread thread = new Thread(test);
thread.start();
}
开发者ID:baalhiverne,
项目名称:judraw,
代码行数:10,
代码来源:PS3uDrawTest.java
示例3: initializeJoystick
点赞 2
import com.codeminders.hidapi.ClassPathLibraryLoader; //导入依赖的package包/类
public boolean initializeJoystick(){
//See if any joysticks are connected
ClassPathLibraryLoader.loadNativeHIDLibrary();
try {
HIDDeviceInfo[] devices = HIDManager.getInstance().listDevices();
for (HIDDeviceInfo hIDDeviceInfo : devices) {
int usage = hIDDeviceInfo.getUsage();
if ((usage == 4 ) || (usage == 5)){
if (connectedJoysticks !=0){
System.out.println("Joystick found with productID " + hIDDeviceInfo.getProduct_id());
boolean alreadyUsed = false;
for (int i = 0; i < connectedJoysticks; i++) {
if (connectedDeviceProductIDs[i] == hIDDeviceInfo.getProduct_id()){
if (connectedDevicePaths[i].equalsIgnoreCase(hIDDeviceInfo.getPath())){
alreadyUsed = true;
}
break;
}
}
if (alreadyUsed){
//Use a different device
hIDJoystickInfo = hIDDeviceInfo;
// System.out.println("Joystick found with usage " + usage);
// System.out.println("Joystick found with device info " + hIDJoystickInfo);
continue;
}
}
hIDJoystickInfo = hIDDeviceInfo;
// System.out.println("Joystick found with usage " + usage);
// System.out.println("Joystick found with device info " + hIDJoystickInfo);
hIDJoystick = hIDJoystickInfo.open();
hIDJoystick.disableBlocking();
connectedDeviceProductIDs[connectedJoysticks] = hIDDeviceInfo.getProduct_id();
connectedDevicePaths[connectedJoysticks]= hIDDeviceInfo.getPath();
connectedJoysticks++;
switch (hIDJoystickInfo.getUsage()) {
case 4:
startOfAxisDataIndex= 0;
halfByteButtonIndex = 4;
wholeByteButtonIndex = 5;
break;
case 5:
startOfAxisDataIndex= 2;
halfByteButtonIndex = 1;
wholeByteButtonIndex = 0;
break;
default:
throw new AssertionError();
}
break;
}
}
} catch (Exception e) {
hIDJoystickInfo = null;
hIDJoystick = null;
}
if (hIDJoystick == null){
return false;
}else {
return true;
}
}
开发者ID:wildstang111,
项目名称:2013_drivebase_proto,
代码行数:69,
代码来源:WsHardwareJoystick.java