protected Int32 ServiceControlHandler(Int32 Control, Int32 Type, IntPtr Data, IntPtr Context) { switch (Control) { case ScpDevice.SERVICE_CONTROL_STOP: case ScpDevice.SERVICE_CONTROL_SHUTDOWN: base.Stop(); break; case ScpDevice.SERVICE_CONTROL_POWEREVENT: switch (Type) { case ScpDevice.PBT_APMSUSPEND: EventLog.WriteEntry("Scp DS3 Service Suspending", System.Diagnostics.EventLogEntryType.Information, 3); rootHub.Suspend(); break; case ScpDevice.PBT_APMRESUMEAUTOMATIC: EventLog.WriteEntry("Scp DS3 Service Resuming", System.Diagnostics.EventLogEntryType.Information, 4); m_Timer.Change(10000, Timeout.Infinite); break; } break; case ScpDevice.SERVICE_CONTROL_DEVICEEVENT: switch (Type) { case ScpDevice.DBT_DEVICEARRIVAL: case ScpDevice.DBT_DEVICEREMOVECOMPLETE: ScpDevice.DEV_BROADCAST_HDR hdr; hdr = (ScpDevice.DEV_BROADCAST_HDR)Marshal.PtrToStructure(Data, typeof(ScpDevice.DEV_BROADCAST_HDR)); if (hdr.dbch_devicetype == ScpDevice.DBT_DEVTYP_DEVICEINTERFACE) { ScpDevice.DEV_BROADCAST_DEVICEINTERFACE_M deviceInterface; deviceInterface = (ScpDevice.DEV_BROADCAST_DEVICEINTERFACE_M)Marshal.PtrToStructure(Data, typeof(ScpDevice.DEV_BROADCAST_DEVICEINTERFACE_M)); String Class = "{" + new Guid(deviceInterface.dbcc_classguid).ToString().ToUpper() + "}"; String Path = new String(deviceInterface.dbcc_name); Path = Path.Substring(0, Path.IndexOf('\0')).ToUpper(); Ds3PadId Pad = rootHub.Notify((ScpDevice.Notified)Type, Class, Path); if (Pad != Ds3PadId.None) { if (rootHub.Pairable && (rootHub.Master != rootHub.Pad[(Byte)Pad].Remote)) { Byte[] Master = new Byte[6]; String[] Parts = rootHub.Master.Split(new String[] { ":" }, StringSplitOptions.RemoveEmptyEntries); for (Int32 Part = 0; Part < Master.Length; Part++) { Master[Part] = Byte.Parse(Parts[Part], System.Globalization.NumberStyles.HexNumber); } rootHub.Pad[(Byte)Pad].Pair(Master); EventLog.WriteEntry(String.Format("Paired DS3 [{0}] To BTH Dongle [{1}]", rootHub.Pad[(Byte)Pad].Local, rootHub.Master), System.Diagnostics.EventLogEntryType.Information, 6); } } } break; } break; } return(0); // NO_ERROR }
public ReportEventArgs(Ds3PadId Pad) { m_Pad = Pad; }
public Ds3Null(Ds3PadId PadId) { m_PadId = PadId; }