Search in sources :

Example 1 with BluetoothSerialConnection

use of com.neuronrobotics.sdk.wireless.bluetooth.BluetoothSerialConnection in project java-bowler by NeuronRobotics.

the class BluetoothConector method main.

/**
 * @param args
 */
public static void main(String[] args) {
    DyIO dyio;
    BlueCoveManager manager = new BlueCoveManager();
    String[] devices = manager.getAvailableSerialDevices(true);
    System.out.println("Devices: ");
    for (String d : devices) {
        System.out.println(d);
    }
    if (devices.length > 0) {
        System.out.println("Connecting to : " + devices[0]);
        dyio = new DyIO(new BluetoothSerialConnection(manager, devices[0]));
        dyio.connect();
        if (dyio.ping())
            System.out.println("All OK!");
    }
    System.exit(0);
}
Also used : BluetoothSerialConnection(com.neuronrobotics.sdk.wireless.bluetooth.BluetoothSerialConnection) BlueCoveManager(com.neuronrobotics.sdk.wireless.bluetooth.BlueCoveManager) DyIO(com.neuronrobotics.sdk.dyio.DyIO)

Example 2 with BluetoothSerialConnection

use of com.neuronrobotics.sdk.wireless.bluetooth.BluetoothSerialConnection in project java-bowler by NeuronRobotics.

the class BluetoothConnectionPanel method getConnection.

public BluetoothSerialConnection getConnection() {
    try {
        String port = connectionCbo.getSelectedItem().toString();
        RemoteDevice dev = blue.getDevice(port);
        connection = new BluetoothSerialConnection(blue, dev.getBluetoothAddress());
        Log.info("Using device:" + port + "\n");
    } catch (Exception e) {
        Log.warning("Unable to connect with bluetooth connection");
    }
    return connection;
}
Also used : BluetoothSerialConnection(com.neuronrobotics.sdk.wireless.bluetooth.BluetoothSerialConnection) RemoteDevice(javax.bluetooth.RemoteDevice)

Aggregations

BluetoothSerialConnection (com.neuronrobotics.sdk.wireless.bluetooth.BluetoothSerialConnection)2 DyIO (com.neuronrobotics.sdk.dyio.DyIO)1 BlueCoveManager (com.neuronrobotics.sdk.wireless.bluetooth.BlueCoveManager)1 RemoteDevice (javax.bluetooth.RemoteDevice)1