Пример #1
0
 public Usc(DeviceListItem deviceListItem)
     : base(deviceListItem)
 {
     // Determine the number of servos from the product id.
     switch(getProductID())
     {
         case 0x89: servoCount = 6; break;
         case 0x8A: servoCount = 12; break;
         case 0x8B: servoCount = 18; break;
         case 0x8C: servoCount = 24; break;
         default: throw new Exception("Unknown product id " + getProductID().ToString("x2") + ".");
     }
 }
Пример #2
0
 public Jrk(DeviceListItem deviceListItem)
     : base(deviceListItem)
 {
     switch (getProductID())
     {
         case 0x0083:
             product = jrkProduct.umc01a;
             break;
         case 0x0085:
             product = jrkProduct.umc02a;
             break;
         default:
             product = jrkProduct.UNKNOWN;
             break;
     }
 }
Пример #3
0
 /// <summary>
 /// Create a usb device from a deviceListItem
 /// </summary>
 /// <param name="handles"></param>
 protected UsbDevice(DeviceListItem deviceListItem)
 {
     LibUsb.throwIfError(libusbOpen(deviceListItem.devicePointer,out privateDeviceHandle),
                        "Error connecting to device.");
 }
Пример #4
0
 /// <summary>
 /// true if the devices are the same
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public bool isSameDeviceAs(DeviceListItem item)
 {
     return (libusbGetDevice(deviceHandle) == item.devicePointer);
 }
Пример #5
0
 /// <summary>
 /// true if the devices are the same
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public bool isSameDeviceAs(DeviceListItem item)
 {
     return (devicePointer == item.devicePointer);
 }
Пример #6
0
 /// <summary>
 /// Creates an item that doesn't actually refer to a device; just for populating the list with things like "Disconnected"
 /// </summary>
 /// <param name="text"></param>
 public static DeviceListItem CreateDummyItem(String text)
 {
     var item = new DeviceListItem(IntPtr.Zero,text,"",0);
     return item;
 }
Пример #7
0
 public Programmer(DeviceListItem deviceListItem)
     : base(deviceListItem)
 {
 }
Пример #8
0
 /// <summary>
 /// Opens (connects to) the selected device, constructing an object that
 /// we can use to communicate with the device over its native USB interface.
 /// </summary>
 public Smc(DeviceListItem deviceListItem)
     : base(deviceListItem)
 {
     this.productId = getProductID();
 }
Пример #9
0
 /// <summary>
 /// This function defines how we will display lists of these devices/bootloaders, both
 /// in SmcCmd and in the Simple Motor Control Center and in the Firmware Upgrade form.
 /// </summary>
 public static void setDeviceListItemText(DeviceListItem dli)
 {
     dli.text = productIdToShortModelString(dli.productId) + " #" + dli.serialNumber;
 }