Package javax.bluetooth

Examples of javax.bluetooth.ServiceRecord


     * @param transID
     * @param servRecord
     */
    public void servicesDiscovered(int transID, ServiceRecord[] servRecord) {
        // Pobieramy sobie usluge. Mechanizm jak w MHP co jest ciekawe :D
        ServiceRecord serviceRecord = servRecord[0];

        // Dodajemy usluge do kolekcji. Do wykorzystania potem, potem, potem....
        discoveredServices.addElement(serviceRecord);

        try {
            // W tym miejscu nawiazuje sie polaczenie z serwerem.
            //TODO wyjebac stad i stworzyc klase agregujaca polacenie miedzy serwerem a klientem
            StreamConnection conn = (StreamConnection) Connector.open(serviceRecord.getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false));
            new MessagingForm(bTMIDlet, new BTConnection(conn));
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
View Full Code Here


     * @param transID
     * @param respCode
     */
    public void serviceSearchCompleted(int transID, int respCode) {

        ServiceRecord serviceRecord;
        DataElement dataElement;

        waitingForm.stop();

        // Jeszcze nie wiem co to robi i po co to. Mozliwe ze pozniej tego nie bedzie. Nie uzywane tutaj.
        for(int i = 0; i < discoveredServices.size(); i++) {
            serviceRecord = (ServiceRecord) discoveredServices.elementAt(i);
            dataElement = serviceRecord.getAttributeValue(SERVICE_NAME_BASE_LANGUAGE);
            discoveredList.append((String) dataElement.getValue(), null);
        }
    }
View Full Code Here

            for (int i = 0; i < serviceRecordCount; i++) {
                int serviceRecordHandle = (int)(((int)dataPacket[9 + (i * 4)] & 0xff) << 24 |
                    ((int)dataPacket[10 + (i * 4)] & 0xff) << 16 | ((int)dataPacket[11 + (i * 4)] & 0xff) << 8 |
                    ((int)dataPacket[12 + (i * 4)] & 0xff));
                Integer serviceHandle = new Integer(serviceRecordHandle);
                ServiceRecord serviceRecord = (ServiceRecord)remoteDevice.serviceRecords.get(serviceHandle);
                if (serviceRecord == null) serviceRecord = new SDPRemoteServiceRecord(remoteDevice, serviceRecordHandle);
                servicesDiscovered.addElement(serviceRecord);
                serviceMap.put(serviceHandle, serviceRecord);
            }
            remoteDevice.serviceRecords = serviceMap;
View Full Code Here

    public static final void main(String[] args) throws Exception {
        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

    public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) { devList.add(btDevice); }

    /** @see javax.bluetooth.DiscoveryListener#servicesDiscovered(int, javax.bluetooth.ServiceRecord[]) */
    public void servicesDiscovered(int transID, ServiceRecord[] servRecord) {
        for (int i = 0; i < servRecord.length; i++) {
            ServiceRecord record = servRecord[i];
            services.addElement(record);
        }
    }
View Full Code Here

    /** @see javax.bluetooth.DiscoveryListener#serviceSearchCompleted(int, int) */
    public void serviceSearchCompleted(int transID, int respCode) {
        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);
View Full Code Here

            if (servRecord == null || servRecord.length <= 0) {
                System.err.println("invalid service discovered");
                return;
            }

            ServiceRecord service = servRecord[0];
            mConnectionURL = service.getConnectionURL(ServiceRecord.AUTHENTICATE_NOENCRYPT, false);
            if (App.DEBUG) {
                System.out.println(mConnectionURL);
            }

            try {
View Full Code Here

TOP

Related Classes of javax.bluetooth.ServiceRecord

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.