Ejemplo n.º 1
0
        public static DeviceHandler Create(ISynDevice device)
        {
            var waitHandle = new AutoResetEvent(false);

            device.SetEventNotification(waitHandle.SafeWaitHandle);
            return(new DeviceHandler(device, waitHandle));
        }
Ejemplo 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);
            }
        }
Ejemplo n.º 3
0
 private DeviceHandler(ISynDevice device, AutoResetEvent waitHandle)
 {
     this.device = device;
     Event       = waitHandle;
 }
Ejemplo n.º 4
0
 public static int GetProperty(this ISynDevice device, DeviceProperty property)
 {
     device.GetProperty((int)property, out int value);
     return(value);
 }