Ejemplo n.º 1
0
        /// <summary>
        ///     When a unit receives a Connection Request packet, it must send a Connection Response packet.
        /// </summary>
        /// <remarks>BLUETOOTH SPECIFICATION Version 1.0 A page 279</remarks>
        /// <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="scid">The Source Channel Identifier.</param>
        /// <param name="result">The result of the connection request.</param>
        /// <param name="status">Only defined for Result = Pending. Indicates the status of the connection.</param>
        /// <returns>The byte count sent to the Bluetooth host.</returns>
        private int L2CAP_Connection_Response(byte[] handle, byte id, byte[] dcid, byte[] scid,
            L2CAP.ConnectionResponseResult result,
            L2CAP.ConnectionResponseStatus status = L2CAP.ConnectionResponseStatus.NoFurtherInformationAvailable)
        {
            var buffer = new byte[12];

            buffer[0] = 0x03;
            buffer[1] = id;
            buffer[2] = 0x08;
            buffer[3] = 0x00;
            buffer[4] = scid[0];
            buffer[5] = scid[1];
            buffer[6] = dcid[0];
            buffer[7] = dcid[1];
            buffer[8] = (byte) result;
            buffer[9] = 0x00;

            if (result == L2CAP.ConnectionResponseResult.ConnectionPending)
            {
                buffer[10] = (byte) status;
                buffer[11] = 0x00;
            }
            else
            {
                buffer[10] = 0x00;
                buffer[11] = 0x00;
            }

            return L2CAP_Command(handle, buffer);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     When a unit receives a Connection Request packet, it must send a Connection Response packet.
        /// </summary>
        /// <remarks>BLUETOOTH SPECIFICATION Version 1.0 A page 279</remarks>
        /// <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="scid">The Source Channel Identifier.</param>
        /// <param name="result">The result of the connection request.</param>
        /// <returns>The byte count sent to the Bluetooth host.</returns>
        private int L2CAP_Connection_Response(byte[] handle, byte id, byte[] dcid, byte[] scid, L2CAP.ConnectionResponseResult result)
        {
            var buffer = new byte[12];

            buffer[0] = 0x03;
            buffer[1] = id;
            buffer[2] = 0x08;
            buffer[3] = 0x00;
            buffer[4] = scid[0];
            buffer[5] = scid[1];
            buffer[6] = dcid[0];
            buffer[7] = dcid[1];
            buffer[8] = (byte)result;
            buffer[9] = 0x00;
            buffer[10] = 0x00;
            buffer[11] = 0x00;

            return L2CAP_Command(handle, buffer);
        }