public override void Start() { foreach (RawDevice device in RawDevice.GetRawDevices()) { if (device.RawType == RawType.Mouse) { deviceList.Add(device.Handle, new CursorData()); } } Thread t = new Thread((ThreadStart) delegate { RawDevice.RegisterRawDevices(0x01, 0x02, InputMode.BackgroundMode | InputMode.SuppressMessages); RawDevice.RawInput += RawDevice_RawInput; lowLevelMouseHook = new LowLevelMouseHook(MouseHookCallback); System.Windows.Forms.Application.Run(); }); t.IsBackground = true; t.SetApartmentState(ApartmentState.STA); t.Start(); timer = new Timer(10); timer.Elapsed += timer_Elapsed; timer.Start(); Mouse.OverrideCursor = Cursors.None; isRunning = true; }
public RawDevicesManager(InputProvider inputProvider) { virtualScreen = SystemInformation.VirtualScreen; this.inputProvider = inputProvider; mouseSpeed = SystemInformation.MouseSpeed * 0.15; devices = new DeviceCollection(); contacts = new ContactCollection(); IEnumerable <RawDevice> rawDevices = from device in RawDevice.GetRawDevices() where (device.RawType == RawType.Device && device.GetRawInfo().UsagePage == HID_USAGE_PAGE_DIGITIZER && device.GetRawInfo().Usage == HID_USAGE_DIGITIZER_PEN) || device.RawType == RawType.Mouse select device; foreach (RawDevice mouseDevice in rawDevices) { devices.Add(new DeviceStatus(mouseDevice)); } Thread inputThread = new Thread(InputWorker); inputThread.IsBackground = true; inputThread.SetApartmentState(ApartmentState.STA); inputThread.Name = "MultipleMice thread"; inputThread.Start(); this.inputProvider.IsRunning = true; }
public override void Stop() { if (timer != null) { timer.Stop(); } foreach (KeyValuePair <IntPtr, CursorData> pair in deviceList) { pair.Value.CloseCursor(); } if (lowLevelMouseHook != null) { lowLevelMouseHook.Unhook(); } WFCursor.Show(); RawDevice.UnregisterRawDevices(0x01, 0x02); RawDevice.RawInput -= RawDevice_RawInput; isRunning = false; System.Windows.Forms.Application.Exit(); deviceList.Clear(); historyList.Clear(); currentList.Clear(); }
public void Update() { if (UpdateRequired) { RawDevice.Apply(); UpdateRequired = false; } }
void InputWorker() { RawDevice.RegisterRawDevices(0x01, 0x02, InputMode.BackgroundMode); RawDevice.RegisterRawDevices(HID_USAGE_PAGE_DIGITIZER, HID_USAGE_DIGITIZER_PEN, InputMode.BackgroundMode); RawDevice.RawInput += RawDevice_RawInput; hook = new LowLevelMouseHook(OnMouseAction); Application.Run(); }
public DeviceStatus(RawDevice device) { this.device = device; debugCursor = new DebugCursor(); debugCursor.Name = "DebugCursor"; Win32.POINT position = Win32.GetCursorPosition(); Location = new Point(position.x, position.y); Thread t = new Thread(ThreadWorker); t.Name = "Cursor for device: " + device.Handle; t.SetApartmentState(ApartmentState.STA); t.IsBackground = true; t.Start(); }
public void Dispose() { if (hook != null) { try { hook.Dispose(); } catch (Win32Exception) {} } RawDevice.UnregisterRawDevices(0x01, 0x02); RawDevice.UnregisterRawDevices(HID_USAGE_PAGE_DIGITIZER, HID_USAGE_DIGITIZER_PEN); RawDevice.RawInput -= RawDevice_RawInput; Application.Exit(); inputProvider.IsRunning = false; }
public static void test() { createEngine(out var engine); engine.setConsoleLoggerSink(consoleLoggingLevel); var devices = RawDevice.list().ToArray(); using (var disp = engine.dispatcher()) { Console.WriteLine("Created a dispatcher"); using (var linuxDisp = ComLightCast.cast <iLinuxDispatcher>(disp.nativeDispatcher)) { // Console.WriteLine( "Casted to iLinuxDispatcher" ); string path = devices[0].eventInterface; linuxDisp.openInputDevice(path, new EventPrinter()); disp.run(); } } }
public Device(RawDevice device) { this.device = device; }
internal RawMouseClipped(RawDevice device, CRect clipRect, iMouseHandler handler) : base(device, handler) { this.clipRect = clipRect; position = prevPosition = clipRect.center; }
DiskDevice (RawDevice device) : base (device) { }
CdromDevice (RawDevice device) : base (device) { }
public Volume (RawDevice device) : base (device) { volume = (RawVolume) device; }
private void STVarChanged(Topic snd, TopicChanged p) { if(p.Visited(_owner, true)) { return; } for(int i=_drivers.Count-1; i>=0; i--) { if(_drivers[i].VarChanged(snd, p.Art==TopicChanged.ChangeArt.Remove)) { if(p.Art==TopicChanged.ChangeArt.Remove) { lock(_drivers) { _drivers.RemoveAt(i); } } return; } } if(p.Art==TopicChanged.ChangeArt.Remove) { return; } TWICommon drv=null; switch(snd.name) { case "LM75_T0": case "LM75_T1": case "LM75_T2": case "LM75_T3": drv=new LM75(snd); break; case "CC2D_T": case "CC2D_H": drv=new CC2D(snd); break; case "HIH61_T": case "HIH61_H": drv=new HIH61xx(snd); break; case "SI7020_T": case "SI7020_H": drv=new SI7020(snd); break; case "BMP180_T": case "BMP180_P": drv=new BMP180(snd); break; case "BME280_T": case "BME280_P": case "BME280_H": drv=new BME280(snd); break; case "BLINKM_8": case "BLINKM_9": case "BLINKM_10": drv=new Blinky(snd); break; case "BH1750_0": case "BH1750_1": drv=new BH1750(snd); break; case "EXP_0": case "EXP_1": case "EXP_2": case "EXP_3": case "EXP_4": case "EXP_5": case "EXP_6": case "EXP_7": drv=new Expander(snd); break; //case "SI1143": // drv=new SI1143(snd); // break; default: if(snd.name.Length>2 && snd.name.Length<6 && (snd.name.StartsWith("Sa") || snd.name.StartsWith("Ra"))) { drv=new RawDevice(snd); } break; } if(drv!=null) { lock(_drivers) { for(int i=_drivers.Count-1; i>=0; i--) { if(_drivers[i].VarChanged(snd, false)) { drv=null; break; } } if(drv!=null) { _drivers.Add(drv); } } } }
// TODO implement. The technique for this will be to write a private // MPI reader class that I can use to query the mpi file for `device'. // the MPI file is found using the ID_MEDIA_PLAYER udev property + .mpi // in /usr/[local/]share/. public DeviceMediaCapabilities (RawDevice device) { mpi = new GMpiFileInfo (device.IdMediaPlayer); }
UsbDevice (RawDevice device) { Device = device; }
protected BlockDevice(RawDevice device) : base(device) { }
RawDevice iKeyboardInput.getKeyboardDevice() { // I've only plugged 2 USB devices, wireless receivers for Logitech G700s and VelociFire VM02WS, however Linux says there're many keyboards. // The keyboard that actually works on my system is event4. return(RawDevice.list().FirstOrDefault(d => d.eventInterface == "/dev/input/event4")); }
DiscVolume(RawDevice device) : base(device) { }
private RawDevice getRawDevice(HmdService.TemplateDevice d) { var device = new RawDevice(); device.Id = d._ID; device.Name = d._Name; //device.NumericValue = this.getValue(d._Value); device.Value = d._Value; device.DeviceCategory = DeviceCategory.Other; device.DeviceType = DeviceType.Other; device.DisplayType = DisplayType.Text; if (d._DeviceAction != null && d._DeviceAction.Length > 0) {// Search if there is a DIM action, which means the device support DIM if (d._DeviceAction.Count(a => (a.Nom == "DIM")) > 0) { device.DeviceType = DeviceType.Dim; } else if (d._DeviceAction.Count(a => (a.Nom == "ON")) > 0 && d._DeviceAction.Count(a => (a.Nom == "OFF")) > 0) { device.DeviceType = DeviceType.OnOff; } } if (d._DeviceAction != null && d._DeviceAction.Length > 0) { foreach (var action in d._DeviceAction) { device.Actions.Add(new RawAction(action)); } } switch (d._Type) { //case HmdService.DeviceListeDevices.APPAREIL: case HmdService.DeviceListeDevices.FREEBOX: // break; case HmdService.DeviceListeDevices.AUDIO: device.DisplayType = DisplayType.Text; device.DeviceCategory = DeviceCategory.Multimedia; break; //case HmdService.DeviceListeDevices.BATTERIE: //case HmdService.DeviceListeDevices.COMPTEUR: case HmdService.DeviceListeDevices.CONTACT: device.DisplayType = DisplayType.Boolean; device.DeviceCategory = DeviceCategory.Contact; break; case HmdService.DeviceListeDevices.DETECTEUR: device.DisplayType = DisplayType.Boolean; device.DeviceCategory = DeviceCategory.Dectect; break; case HmdService.DeviceListeDevices.ENERGIEINSTANTANEE: case HmdService.DeviceListeDevices.ENERGIETOTALE: device.DisplayType = DisplayType.Numeric; device.DeviceCategory = DeviceCategory.Energy; break; case HmdService.DeviceListeDevices.GENERIQUEBOOLEEN: device.DisplayType = DisplayType.Boolean; break; //case HmdService.DeviceListeDevices.GENERIQUESTRING: // break; case HmdService.DeviceListeDevices.GENERIQUEVALUE: device.DisplayType = DisplayType.Numeric; break; case HmdService.DeviceListeDevices.HUMIDITE: device.DisplayType = DisplayType.Percentage; device.DeviceCategory = DeviceCategory.Meteo; break; //case HmdService.DeviceListeDevices.METEO: //case HmdService.DeviceListeDevices.MULTIMEDIA: // break; case HmdService.DeviceListeDevices.PLUIECOURANT: case HmdService.DeviceListeDevices.PLUIETOTAL: device.DisplayType = DisplayType.Numeric; device.DeviceCategory = DeviceCategory.Meteo; break; //case HmdService.DeviceListeDevices.TELECOMMANDE: // break; case HmdService.DeviceListeDevices.TEMPERATURE: case HmdService.DeviceListeDevices.TEMPERATURECONSIGNE: device.DisplayType = DisplayType.Temperature; device.DeviceCategory = DeviceCategory.Meteo; break; case HmdService.DeviceListeDevices.BAROMETRE: case HmdService.DeviceListeDevices.UV: case HmdService.DeviceListeDevices.VITESSEVENT: case HmdService.DeviceListeDevices.DIRECTIONVENT: device.DisplayType = DisplayType.Text; device.DeviceCategory = DeviceCategory.Meteo; break; //case HmdService.DeviceListeDevices.VOLET: // device.DisplayType = DisplayType.Boolean; // device.DeviceCategory = DeviceCategory.Other; // break; } return(device); }