Java Code Examples for javax.microedition.io.StreamConnectionNotifier

The following examples show how to use javax.microedition.io.StreamConnectionNotifier. These examples are extracted from open source projects. 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 Project: Ardulink-2   Source File: BluetoothLinkFactory.java    License: Apache License 2.0 5 votes vote down vote up
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 Project: pluotsorbet   Source File: BTGOEPNotifier.java    License: GNU General Public License v2.0 4 votes vote down vote up
protected BTGOEPNotifier(StreamConnectionNotifier notifier)
    throws IOException {
    this.notifier = notifier;
}
 
Example 3
Source Project: blucat   Source File: BlucatServer.java    License: GNU General Public License v2.0 4 votes vote down vote up
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);
}
 
Example 4
Source Project: blucat   Source File: BlucatServer.java    License: GNU General Public License v2.0 4 votes vote down vote up
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);

}