Package javax.bluetooth

Examples of javax.bluetooth.DataElement


        attributes.put(new Integer(attrID), attrValue);
        return true;
    }

    public byte[] toByteArray() {
        DataElement resultAttributes = new DataElement(DataElement.DATSEQ);
        Enumeration keys = attributes.keys();
        while (keys.hasMoreElements()) {
            Integer key = (Integer)keys.nextElement();
            DataElement value = (DataElement)attributes.get(key);
            resultAttributes.addElement(new DataElement(DataElement.U_INT_2, key.intValue()));
            resultAttributes.addElement(value);
        }
        return resultAttributes.toByteArray();
    }
View Full Code Here


            //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); }
        for (int i = 0; i < serviceRecords.length; i++) {
            System.out.println("  " + serviceRecords[i]);
View Full Code Here

        BluetoothStack.init(new BluetoothTCPClient("192.168.10.2", 2600));
        LocalDevice localDev = LocalDevice.getLocalDevice();
        localDev.setDiscoverable(DiscoveryAgent.GIAC);
        L2CAPConnectionNotifier connNotifier = (L2CAPConnectionNotifier)Connector.open("btl2cap://localhost:3;");
        ServiceRecord serviceRecord = connNotifier.getRecord();
        serviceRecord.setAttributeValue(256, new DataElement(DataElement.STRING, "Tini Demo Service"));
        connNotifier.acceptAndOpen();
    }
View Full Code Here

        while (remoteDevice == null) { Thread.sleep(1000); }
        System.out.println("Remote Name is " + remoteDevice.getFriendlyName(false));
        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 (true) { Thread.sleep(600); }
    }
View Full Code Here

        this.record = record;
    }

    public void mouseEntered(MouseEvent e) {
        bluetoothBrowser.mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        DataElement connectionInfo = record.getAttributeValue(4);
        if (connectionInfo != null) { bluetoothBrowser.statusLabel.setText(connectionInfo.toString()); }
    }
View Full Code Here

        top.removeAll();
        for (int i = 0; i < services.size(); i++) {
            ServiceRecord record = (ServiceRecord)services.get(i);
            JLabel devLabel = new JLabel(serviceIcon);
            devLabel.addMouseListener(new ServiceRecordMouseListener(devLabel, this, record));
            DataElement nameElement = record.getAttributeValue(256);
            if (nameElement != null) {
                String serviceName = (String)nameElement.getValue();
                devLabel.setText(serviceName);
            }
            top.add(devLabel);
        }
        top.revalidate();
View Full Code Here

    /** found a service on this device */
    public void servicesDiscovered(int arg0, ServiceRecord[] servRecord) {
        for (int i = 0; i < servRecord.length; i++) {

            DataElement nameElement = servRecord[i].getAttributeValue(0x100);
            if ((nameElement != null) && (nameElement.getDataType() == DataElement.STRING)) {

                /** retrieve the name of the service */
                String name = (String) nameElement.getValue();
                name = name.trim();

                constants.info("found ------- [" + name + "]", this);
                if (name.equals("Bluetooth Serial Port")) {
                    constants.info(" ..is a port " + name, this);
View Full Code Here

      rd = requests.get(new Integer(transID));
      if (rd == null) return;

      for (int i = 0; i < servRecord.length; i++) {
       
         DataElement nameElement = (DataElement)servRecord[i].getAttributeValue(0x100);
         if ((nameElement != null) && (nameElement.getDataType() == DataElement.STRING)) {

                    /** retrieve the name of the service */
                  serviceName = (String)nameElement.getValue();
                 
                  constants.info(rd + " service name was = " + serviceName, this)
                 
                  /** add serial devices if found */
                  if (serviceName.equals("Bluetooth Serial Port"))
View Full Code Here

TOP

Related Classes of javax.bluetooth.DataElement

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.