public void inquiryCompleted(int discType) { if (remote == null) { mDisplay.setCurrent(vorForm); // Wait until the canvas appears... // For Nokia it is not the same? while (mDisplay.getCurrent() != vorForm) ; messages.insert("No NXT Brick found", messages.size()); } else { try { remoteName = remote.getFriendlyName(false); messages.insert("Connecting to " + remoteName + "\n", messages.size()); } catch (IOException ioe) { System.out.println("error retrieving friendly name"); } try { // int[] attrs = {0x100}; // default attribute set plus service name UUID[] uuids = new UUID[] {new UUID(SERIALID)}; // Serial port service // agent.searchServices(attrs, uuids, remote, this); agent.searchServices(null, uuids, remote, this); } catch (BluetoothStateException bse) { System.out.println("service search failed"); } } }
public void findNXT() { if (local != null) { // place the device in inquiry mode try { agent.startInquiry(DiscoveryAgent.GIAC, this); messages.insert("Searching for NXT Brick\n", messages.size()); } catch (BluetoothStateException bse) { System.out.println("inquiry couldn't be started"); } } else { messages.insert("Bluetooth is off or this device doesn't support JSR82\n", messages.size()); } }