public static DeviceHandler Create(ISynDevice device)
        {
            var waitHandle = new AutoResetEvent(false);

            device.SetEventNotification(waitHandle.SafeWaitHandle);
            return(new DeviceHandler(device, waitHandle));
        }
Esempio n. 2
0
        public static string GetStringProperty(
            this ISynDevice device,
            DeviceStringProperty property)
        {
            int len = 256;
            var buf = Marshal.AllocHGlobal(len);

            try {
                unsafe {
                    device.GetStringProperty((int)property, ref *(byte *)buf.ToPointer(), len);
                }
                return(Marshal.PtrToStringAnsi(buf));
            } finally {
                Marshal.FreeHGlobal(buf);
            }
        }
 private DeviceHandler(ISynDevice device, AutoResetEvent waitHandle)
 {
     this.device = device;
     Event       = waitHandle;
 }
Esempio n. 4
0
 public static int GetProperty(this ISynDevice device, DeviceProperty property)
 {
     device.GetProperty((int)property, out int value);
     return(value);
 }