Package org.javabluetooth.stack.l2cap

Examples of org.javabluetooth.stack.l2cap.L2CAPChannel


    private void receive_L2CAP_Create_Connection_Response(byte[] packet) {
        short channelHandel  = (short)((((short)packet[3]) & 0xff) | (((short)packet[4]) & 0xff) << 8);
        byte channelState    = packet[5];
        short localCID       = (short)((((short)packet[6]) & 0xff) | (((short)packet[7]) & 0xff) << 8);
        short remoteCID      = (short)((((short)packet[8]) & 0xff) | (((short)packet[9]) & 0xff) << 8);
        L2CAPChannel channel = channels[channelHandel];
        if (channel != null) {
            channel.channelState = channelState;
            channel.localChannelID = localCID;
            channel.remoteChannelID = remoteCID;
        }
View Full Code Here


        }
    }

    private void receive_L2CAP_Disconnect_Channel_Request(byte[] packet) {
        short channelHandel = (short)((((short)packet[3]) & 0xff) | (((short)packet[4]) & 0xff) << 8);
        L2CAPChannel channel = channels[channelHandel];
        channels[channelHandel] = null;
        if (channel != null) {
            channel.channelState = L2CAPChannel.CLOSED;
            channel.wasDisconnected();
        }
    }
View Full Code Here

    }

    private void receive_L2CAP_Packet(byte[] packet) {
        short channelHandel  = (short)((((short)packet[3]) & 0xff) | (((short)packet[4]) & 0xff) << 8);
        int length           = ((packet[1] & 0xff) | (packet[2] & 0xff) << 8) - 2;
        L2CAPChannel channel = channels[channelHandel];
        if (channel != null) {
            byte[] l2capPacket = new byte[length];
            System.arraycopy(packet, 5, l2capPacket, 0, l2capPacket.length);
            channel.receiveL2CAPPacket(l2capPacket);
        }
    }
View Full Code Here

    /** @param packet */
    private void processL2CAP_Packet(byte[] packet) {
        Debug.println(7, "BluetoothTCPServer: Received L2CAP Packet from BluetoothTCPClient.");
        short channelHandel  = (short)((((short)packet[3]) & 0xff) | (((short)packet[4]) & 0xff) << 8);
        int length           = ((packet[1] & 0xff) | (packet[2] & 0xff) << 8) - 2;
        L2CAPChannel channel = channels[channelHandel];
        if (channel != null) {
            byte[] l2capPacket = new byte[length];
            System.arraycopy(packet, 5, l2capPacket, 0, l2capPacket.length);
            try { channel.sendL2CAPPacket(l2capPacket); }
            catch (IOException e) { System.err.println("BluetoothTCPServerThread: Error while sending L2CAP Packet: " + e); }
        }
    }
View Full Code Here

    }

    private void processL2CAP_Disconnect_Channel_Request(byte[] packet) {
        Debug.println(7, "BluetoothTCPServer: Received L2CAP Disconnection Request from BluetoothTCPClient.");
        short channelHandel = (short)((((short)packet[3]) & 0xff) | (((short)packet[4]) & 0xff) << 8);
        L2CAPChannel channel = channels[channelHandel];
        channels[channelHandel] = null;
        if (channel != null) { channel.close(); }
    }
View Full Code Here

TOP

Related Classes of org.javabluetooth.stack.l2cap.L2CAPChannel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.