protected virtual Boolean LogArrival(IDsDevice Arrived) { ArrivalEventArgs args = new ArrivalEventArgs(Arrived); On_Arrival(this, args); return(args.Handled); }
protected virtual bool LogArrival(IDsDevice Arrived) { var args = new ArrivalEventArgs(Arrived); OnDeviceArrival(this, args); return(args.Handled); }
protected virtual bool LogArrival(IDsDevice Arrived) { var args = new ArrivalEventArgs(Arrived); OnDeviceArrival(this, args); return args.Handled; }
protected override void On_Arrival(object sender, ArrivalEventArgs e) { lock (this) { Boolean bFound = false; IDsDevice Arrived = e.Device; for (Int32 Index = 0; Index < m_Pad.Length && !bFound; Index++) { if (Arrived.Local == m_Reserved[Index]) { if (m_Pad[Index].State == DsState.Connected) { if (m_Pad[Index].Connection == DsConnection.BTH) { m_Pad[Index].Disconnect(); } if (m_Pad[Index].Connection == DsConnection.USB) { Arrived.Disconnect(); e.Handled = false; return; } } bFound = true; Arrived.PadId = (DsPadId)Index; m_Pad[Index] = Arrived; } } for (Int32 Index = 0; Index < m_Pad.Length && !bFound; Index++) { if (m_Pad[Index].State == DsState.Disconnected) { bFound = true; m_Reserved[Index] = Arrived.Local; Arrived.PadId = (DsPadId)Index; m_Pad[Index] = Arrived; } } if (bFound) { scpBus.Plugin((int)Arrived.PadId + 1); LogDebug(String.Format("++ Plugin Port #{0} for [{1}]", (int)Arrived.PadId + 1, Arrived.Local)); } e.Handled = bFound; } }
private bool OnDeviceArrival(IDsDevice arrived) { var args = new ArrivalEventArgs(arrived); if (DeviceArrived != null) { DeviceArrived(this, args); } return(args.Handled); }
private bool LogArrival(IDsDevice arrived) { var args = new ArrivalEventArgs(arrived); if (Arrival != null) { Arrival(this, args); } return(args.Handled); }
public ArrivalEventArgs(IDsDevice device) { this.Device = device; }
public ArrivalEventArgs(IDsDevice Device) { m_Device = Device; }
public ArrivalEventArgs(IDsDevice device) { Device = device; }
protected virtual void UDP_Worker_Thread(object sender, DoWorkEventArgs e) { Byte Serial; StringBuilder sb = new StringBuilder(); Thread.Sleep(1); IPEndPoint Remote = new IPEndPoint(IPAddress.Loopback, 0); m_Server = new UdpClient(m_ServerEp); LogDebug("-- Controller : UDP_Worker_Thread Starting"); while (m_Started) { try { Byte[] Buffer = m_Server.Receive(ref Remote); switch (Buffer[1]) { case 0x00: // Status Request if (!Global.DisableNative) { Buffer[2] = (Byte)Pad[0].State; Buffer[3] = (Byte)Pad[1].State; Buffer[4] = (Byte)Pad[2].State; Buffer[5] = (Byte)Pad[3].State; } else { Buffer[2] = 0; Buffer[3] = 0; Buffer[4] = 0; Buffer[5] = 0; } m_Server.Send(Buffer, Buffer.Length, Remote); break; case 0x01: // Rumble Request Serial = Buffer[0]; if (Pad[Serial].State == DsState.Connected) { if (Buffer[2] != m_Native[Serial][0] || Buffer[3] != m_Native[Serial][1]) { m_Native[Serial][0] = Buffer[2]; m_Native[Serial][1] = Buffer[3]; Pad[Buffer[0]].Rumble(Buffer[2], Buffer[3]); } } break; case 0x02: // Status Data Request { sb.Clear(); sb.Append(Dongle); sb.Append('^'); sb.Append(Pad[0].ToString()); sb.Append('^'); sb.Append(Pad[1].ToString()); sb.Append('^'); sb.Append(Pad[2].ToString()); sb.Append('^'); sb.Append(Pad[3].ToString()); sb.Append('^'); Byte[] Data = Encoding.Unicode.GetBytes(sb.ToString()); m_Server.Send(Data, Data.Length, Remote); } break; case 0x03: // Config Read Request { Byte[] Data = Global.Packed; m_Server.Send(Data, Data.Length, Remote); } break; case 0x04: // Config Write Request { Global.Packed = Buffer; } break; case 0x05: // Pad Promote Request { Int32 Target = Buffer[2]; lock (this) { if (Pad[Target].State != DsState.Disconnected) { IDsDevice Swap = Pad[Target]; Pad[Target] = Pad[Target - 1]; Pad[Target - 1] = Swap; Pad[Target].PadId = (DsPadId)(Target); Pad[Target - 1].PadId = (DsPadId)(Target - 1); m_Reserved[Target] = Pad[Target].Local; m_Reserved[Target - 1] = Pad[Target - 1].Local; } } } break; case 0x06: // Profile List { sb.Clear(); sb.Append(scpMap.Active); sb.Append('^'); foreach (String Profile in scpMap.Profiles) { sb.Append(Profile); sb.Append('^'); } Byte[] Data = Encoding.Unicode.GetBytes(sb.ToString()); m_Server.Send(Data, Data.Length, Remote); } break; case 0x07: // Set Active Profile { Byte[] Data = new Byte[Buffer.Length - 2]; Array.Copy(Buffer, 2, Data, 0, Data.Length); scpMap.Active = Encoding.Unicode.GetString(Data); } break; case 0x08: // Get XML { //Byte[] Data = Encoding.UTF8.GetBytes("");//TODO: clean this up //m_Server.Send(Data, Data.Length, Remote); } break; case 0x09: // Set XML { //Byte[] Data = new Byte[Buffer.Length - 2]; //Array.Copy(Buffer, 2, Data, 0, Data.Length); //scpMap.Xml = Encoding.UTF8.GetString(Data); } break; case 0x0A: // Pad Detail { Serial = Buffer[0]; Byte[] Data = new Byte[11]; Byte[] Temp = Encoding.Unicode.GetBytes(m_Pad[Serial].Local); Data[0] = Serial; Data[1] = (Byte)m_Pad[Serial].State; Data[2] = (Byte)m_Pad[Serial].Model; Data[3] = (Byte)m_Pad[Serial].Connection; Data[4] = (Byte)m_Pad[Serial].Battery; Array.Copy(m_Pad[Serial].BD_Address, 0, Data, 5, m_Pad[Serial].BD_Address.Length); m_Server.Send(Data, Data.Length, Remote); } break; } } catch { } } LogDebug("-- Controller : UDP_Worker_Thread Exiting"); }
public ArrivalEventArgs(IDsDevice Device) { this.Device = Device; }