public virtual Byte[] Set(L2CAP.PSM ConnectionType, Byte Lsb, Byte Msb, UInt16 Dcid = 0) { switch (ConnectionType) { case L2CAP.PSM.HID_Command: m_L2CAP_Cmd_Handle[0] = new BthHandle(Lsb, Msb); m_L2CAP_Cmd_Handle[1] = new BthHandle(DCID++); return(m_L2CAP_Cmd_Handle[1].Bytes); case L2CAP.PSM.HID_Interrupt: CanStartSvc = true; m_L2CAP_Int_Handle[0] = new BthHandle(Lsb, Msb); m_L2CAP_Int_Handle[1] = new BthHandle(DCID++); return(m_L2CAP_Int_Handle[1].Bytes); case L2CAP.PSM.HID_Service: SvcStarted = true; CanStartSvc = false; m_L2CAP_Svc_Handle[0] = new BthHandle(Lsb, Msb); m_L2CAP_Svc_Handle[1] = new BthHandle(Dcid); return(m_L2CAP_Svc_Handle[1].Bytes); } throw new Exception("Invalid L2CAP Connection Type"); }
public byte[] SetConnectionType(L2CAP.PSM connectionType, byte lsb, byte msb, ushort dcid = 0) { switch (connectionType) { case L2CAP.PSM.HID_Command: _l2CapCommandHandle[0] = new BthHandle(lsb, msb); _l2CapCommandHandle[1] = new BthHandle(Dcid++); return(_l2CapCommandHandle[1].Bytes); case L2CAP.PSM.HID_Interrupt: CanStartService = true; _l2CapInterruptHandle[0] = new BthHandle(lsb, msb); _l2CapInterruptHandle[1] = new BthHandle(Dcid++); return(_l2CapInterruptHandle[1].Bytes); case L2CAP.PSM.HID_Service: IsServiceStarted = true; CanStartService = false; _l2CapServiceHandle[0] = new BthHandle(lsb, msb); _l2CapServiceHandle[1] = new BthHandle(dcid); return(_l2CapServiceHandle[1].Bytes); } throw new ArgumentException("Invalid L2CAP Connection Type"); }
private int L2CAP_Connection_Request(byte[] Handle, byte Id, byte[] DCID, L2CAP.PSM Psm) { var Buffer = new byte[8]; Buffer[0] = 0x02; Buffer[1] = Id; Buffer[2] = 0x04; Buffer[3] = 0x00; Buffer[4] = (byte)Psm; Buffer[5] = 0x00; Buffer[6] = DCID[0]; Buffer[7] = DCID[1]; return(L2CAP_Command(Handle, Buffer)); }
/// <summary> /// Connection request packets are sent to create a channel between two devices. /// </summary> /// <remarks>BLUETOOTH SPECIFICATION Version 1.0 A page 278</remarks> /// <param name="handle">The HCI handle.</param> /// <param name="id">The packet id.</param> /// <param name="dcid">The Destination Channel Identifier.</param> /// <param name="psm">The Protocol and Service Multiplexer to request.</param> /// <returns>The byte count sent to the Bluetooth host.</returns> private int L2CAP_Connection_Request(byte[] handle, byte id, byte[] dcid, L2CAP.PSM psm) { var buffer = new byte[8]; buffer[0] = 0x02; buffer[1] = id; buffer[2] = 0x04; buffer[3] = 0x00; buffer[4] = (byte)psm; buffer[5] = 0x00; buffer[6] = dcid[0]; buffer[7] = dcid[1]; return(L2CAP_Command(handle, buffer)); }
/// <summary> /// Source Channel Identifier. /// </summary> /// <remarks> /// Used in the L2CAP layer to indicate the channel endpoint on the device sending the L2CAP message. It is a /// device local name only. /// </remarks> /// <param name="connectionType"></param> /// <returns>Source Channel Identifier.</returns> public byte[] Get_SCID(L2CAP.PSM connectionType) { switch (connectionType) { case L2CAP.PSM.HID_Command: return(_l2CapCommandHandle[0].Bytes); case L2CAP.PSM.HID_Interrupt: return(_l2CapInterruptHandle[0].Bytes); case L2CAP.PSM.HID_Service: return(_l2CapServiceHandle[0].Bytes); } throw new Exception("Invalid L2CAP Connection Type"); }
public virtual Byte[] Get_SCID(L2CAP.PSM ConnectionType) { switch (ConnectionType) { case L2CAP.PSM.HID_Command: return(m_L2CAP_Cmd_Handle[0].Bytes); case L2CAP.PSM.HID_Interrupt: return(m_L2CAP_Int_Handle[0].Bytes); case L2CAP.PSM.HID_Service: return(m_L2CAP_Svc_Handle[0].Bytes); } throw new Exception("Invalid L2CAP Connection Type"); }
public byte[] SetConnectionType(L2CAP.PSM connectionType, byte[] handle) { return(SetConnectionType(connectionType, handle[0], handle[1])); }
public virtual Byte[] Set(L2CAP.PSM ConnectionType, Byte[] Handle) { return(Set(ConnectionType, Handle[0], Handle[1])); }
protected virtual Int32 L2CAP_Connection_Request(Byte[] Handle, Byte Id, Byte[] DCID, L2CAP.PSM Psm) { Byte[] Buffer = new Byte[8]; Buffer[0] = 0x02; Buffer[1] = Id; Buffer[2] = 0x04; Buffer[3] = 0x00; Buffer[4] = (Byte)Psm; Buffer[5] = 0x00; Buffer[6] = DCID[0]; Buffer[7] = DCID[1]; return(L2CAP_Command(Handle, Buffer)); }
public virtual byte[] Set(L2CAP.PSM connectionType, byte[] handle) { return(Set(connectionType, handle[0], handle[1])); }