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 serviceSearchCompleted(int transID, int respCode) { if (respCode == DiscoveryListener.SERVICE_SEARCH_COMPLETED) { // !! This code must be divorced from NXTLocator canvas = new RemoteCanvas(remoteURL); mDisplay.setCurrent(canvas); } else { mDisplay.setCurrent(vorForm); while (mDisplay.getCurrent() != vorForm) ; switch (respCode) { case DiscoveryListener.SERVICE_SEARCH_TERMINATED: messages.insert("Error: Service search terminated", messages.size()); break; case DiscoveryListener.SERVICE_SEARCH_ERROR: messages.insert("Error: Service search error", messages.size()); break; case DiscoveryListener.SERVICE_SEARCH_NO_RECORDS: messages.insert("Error: Service search no records", messages.size()); break; case DiscoveryListener.SERVICE_SEARCH_DEVICE_NOT_REACHABLE: messages.insert("Error: Service search device not reachable", messages.size()); break; } } }