Ejemplo n.º 1
0
        public BluetoothConnection(Bluegiga.BLE.Events.Connection.DisconnectedEventHandler callback)
        {
            port      = null;        //if a new SerialPort is instantiated here for some reason the portName is always "COM1" even if that's not a valid port on the PC so we make this nullable instead.
            bluetooth = new Bluegiga.BGLib();

            discoveredDevices = new List <BluetoothDevice>();
            tappyBuffer       = new List <byte>();
            isConnected       = false;

            bufferLock = new object();

            // Bluegiga Events

            bluetooth.BLEEventATTClientAttributeValue += DataReceivedFromTappy;
            bluetooth.BLEEventConnectionDisconnected  += Bluetooth_BLEEventConnectionDisconnected;
            bluetooth.BLEEventConnectionDisconnected  += callback;
            disconnectCallback += callback;
        }
Ejemplo n.º 2
0
 public override void setDisconnectCallback(Bluegiga.BLE.Events.Connection.DisconnectedEventHandler callback)
 {
     disconnectCallback += callback;
 }