Examples of BluetoothStack


Examples of org.javabluetooth.stack.BluetoothStack

        return returnArray;
    }

    /** @see javax.bluetooth.ServiceRecord#populateRecord(int[]) */
    public boolean populateRecord(int[] attrIDs) throws IOException {
        BluetoothStack bluetooth;
        try {
            bluetooth = BluetoothStack.getBluetoothStack();
            SDPClientChannel sdpChannel = new SDPClientChannel(remoteDevice, null);
            bluetooth.connectL2CAPChannel(sdpChannel, remoteDevice, (short)0x0001);
            //TODO fill propper attrIDs this ignores the parameter and gets all available
            byte[] attributeList = { 0x35, 0x05, 0x0a, 0x00, 0x00, (byte)0xff, (byte)0xff };
            DataElement attributeListElement = new DataElement(attributeList);
            isPopulated = false;
            sdpChannel.send_SDP_ServiceAttributeRequest((short)0x00, (short)0xff, serviceRecordHandle, attributeListElement);
View Full Code Here

Examples of org.javabluetooth.stack.BluetoothStack

    /** @see javax.bluetooth.L2CAPConnectionNotifier#acceptAndOpen() */
    public L2CAPConnection acceptAndOpen() throws IOException {
        JSR82Channel jsr82Channel = new JSR82Channel();
        try {
            BluetoothStack bluetooth = BluetoothStack.getBluetoothStack();
            bluetooth.registerL2CAPService(jsr82Channel, psm, (short)0x1002, serviceRecord.toByteArray());
        }
        catch (HCIException e) { throw new IOException(e.toString()); }
        while (jsr82Channel.channelState != L2CAPChannel.OPEN) {
            try { Thread.sleep(1000); }
            catch (InterruptedException e1) { }
View Full Code Here

Examples of org.javabluetooth.stack.BluetoothStack

        DataElement reparsed = new DataElement(attrBytes);
        System.out.println("Reparsed Attributes="+reparsed);
        */

        BluetoothStack.init(new BluetoothTCPClient("192.168.10.2", 2600));
        BluetoothStack bluetooth = BluetoothStack.getBluetoothStack();
        bluetooth.send_HCI_HC_Change_Local_Name("TINI BLUE");
        bluetooth.send_HCI_HC_Write_Event_Filter_Connection_Setup((byte)0x02);
        bluetooth.send_HCI_HC_Write_Event_Filter_Inquiry_Result();
        bluetooth.send_HCI_HC_Write_Scan_Enable((byte)0x03);
        BluetoothClient blue = new BluetoothClient();
        while (remoteDevice == null) { Thread.sleep(1000); }
        if (remoteDevice != null) { //System.out.println("bdAddr:"+remoteDevice.getBluetoothAddress());
            //System.out.println("Name:"+remoteDevice.getFriendlyName(false));
            //System.out.println("major dev class :"+remoteDevice.deviceClass.getMajorDeviceClass());
            //System.out.println("minor dev class :"+remoteDevice.deviceClass.getMinorDeviceClass());
            //System.out.println("service classes :"+remoteDevice.deviceClass.getServiceClasses());
            SDPClientChannel sdpChannel = new SDPClientChannel(remoteDevice, blue);
            bluetooth.connectL2CAPChannel(sdpChannel, remoteDevice, (short)0x0001);
            byte[] uuidList = { 0x35, 0x03, 0x19, 0x10, 0x02 };
            DataElement uuidListElement = new DataElement(uuidList);
            sdpChannel.send_SDP_ServiceSearchRequest((short)1, (short)14, uuidListElement);
        }
        while (serviceRecords == null) { Thread.sleep(1000); }
View Full Code Here

Examples of org.javabluetooth.stack.BluetoothStack

     * @exception IOException if the remote device can not be contacted or the remote device could not provide its name
     */
    public synchronized String getFriendlyName(boolean alwaysAsk) throws IOException {
        if ((friendlyName == null) || alwaysAsk) {
            try {
                BluetoothStack bluetoothStack = BluetoothStack.getBluetoothStack();
                friendlyName = null; //for askAlways
                bluetoothStack.send_HCI_LC_Remote_Name_Request(bdAddrLong, pageScanRepMode, pageScanMode, clockOffset);
                int timeOutCounter = 0;
                while (friendlyName == null) {
                    try {
                        wait(1000);
                        timeOutCounter++;
View Full Code Here

Examples of org.javabluetooth.stack.BluetoothStack

                long remoteAddrLong       = bdAddrLong.longValue();
                int endIndex              = url.indexOf(';', 22);
                String psmString          = url.substring(23, endIndex);
                Short psmShort            = Short.decode(psmString);
                short psm                 = psmShort.shortValue();
                BluetoothStack bluetooth  = BluetoothStack.getBluetoothStack();
                LocalDevice localDev      = LocalDevice.getLocalDevice();
                DiscoveryAgent discovery  = localDev.getDiscoveryAgent();
                RemoteDevice remoteDevice = discovery.getRemoteDevice(remoteAddrLong);
                if (remoteDevice != null) {
                    JSR82Channel channel = new JSR82Channel();
                    bluetooth.connectL2CAPChannel(channel, remoteDevice, psm);
                    return channel;
                }
                else throw new IllegalArgumentException("Unable to locate Bluetooth Device.");
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.