javax.microedition.io.StreamConnectionNotifier Java Examples
The following examples show how to use
javax.microedition.io.StreamConnectionNotifier.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BluetoothLinkFactory.java From Ardulink-2 with Apache License 2.0 | 5 votes |
public javax.microedition.io.StreamConnection getStreamConnection( javax.microedition.io.Connection connection) throws IOException { if (connection instanceof StreamConnectionNotifier) { return ((StreamConnectionNotifier) connection).acceptAndOpen(); } else if (connection instanceof StreamConnection) { return (javax.microedition.io.StreamConnection) connection; } else { throw new IllegalStateException("Connection class not known. " + connection.getClass().getName()); } }
Example #2
Source File: BlucatServer.java From blucat with GNU General Public License v2.0 | 5 votes |
public static void startServerUuid(String uuidValue) throws IOException{ uuidValue = uuidValue.replace("-", ""); UUID uuid = new UUID(uuidValue, false); String url = "btspp://localhost:" + uuid.toString() + ";name=BlueCatPipe"; //;authenticate=false;authorize=false;encrypt=false;master=false"; PrintUtil.verbose("Creating server with UUID " + uuid); StreamConnectionNotifier service = (StreamConnectionNotifier) Connector.open(url); ServiceRecord rec = LocalDevice.getLocalDevice().getRecord(service); //PrintUtil.out.println(rec.toString()); String remoteUrl = rec.getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false); remoteUrl = remoteUrl.substring(0, remoteUrl.indexOf(";")); PrintUtil.verbose("#" + new Date() + " - Listening at " + remoteUrl); BlucatConnection.handle(service); }
Example #3
Source File: BTGOEPNotifier.java From pluotsorbet with GNU General Public License v2.0 | 4 votes |
protected BTGOEPNotifier(StreamConnectionNotifier notifier) throws IOException { this.notifier = notifier; }
Example #4
Source File: BlucatServer.java From blucat with GNU General Public License v2.0 | 4 votes |
public static void startServerRFCOMM() throws IOException{ String url = "btspp://localhost:" + BluetoothConsts.RFCOMM_PROTOCOL_UUID + ";name=BlueCatPipe;authenticate=false;encrypt=false;master=true"; PrintUtil.verbose("#" + "Creating RFCOMM server"); StreamConnectionNotifier service = (StreamConnectionNotifier) Connector.open(url); ServiceRecord rec = LocalDevice.getLocalDevice().getRecord(service); //PrintUtil.out.println(rec.toString()); String remoteUrl = rec.getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false); remoteUrl = remoteUrl.substring(0, remoteUrl.indexOf(";")); PrintUtil.verbose("#" + new Date() + " - Listening at " + remoteUrl); BlucatConnection.handle(service); }