public static DeviceHandler Create(ISynDevice device) { var waitHandle = new AutoResetEvent(false); device.SetEventNotification(waitHandle.SafeWaitHandle); return(new DeviceHandler(device, waitHandle)); }
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; }
public static int GetProperty(this ISynDevice device, DeviceProperty property) { device.GetProperty((int)property, out int value); return(value); }