Example #1
0
        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");
        }
        protected virtual void Remove(Byte Lsb, Byte Msb)
        {
            BthHandle Connection = new BthHandle(Lsb, Msb);

            m_Connected[Connection].Stop();
            m_Connected.Remove(Connection);
        }
        public virtual Int32 HCI_Disconnect(BthHandle Handle)
        {
            Byte[] Buffer = new Byte[6];

            Buffer[0] = (Byte)(((UInt32)HCI.Command.HCI_Disconnect >> 0) & 0xFF);
            Buffer[1] = (Byte)(((UInt32)HCI.Command.HCI_Disconnect >> 8) & 0xFF);
            Buffer[2] = 0x03;
            Buffer[3] = (Byte)(Handle.Bytes[0]);
            Buffer[4] = (Byte)(Handle.Bytes[1] ^ 0x20);
            Buffer[5] = 0x13;

            return(HCI_Command(Buffer));
        }
Example #4
0
        public BthConnection(BthHandle HCI_Handle)
        {
            InitializeComponent();

            m_HCI_Handle = HCI_Handle;
        }