/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void BLEConnectionDisconnectedEvent(object sender, Bluegiga.BLE.Events.Connection.DisconnectedEventArgs e) { Application.Current.Dispatcher.Invoke(delegate { MessageWriter.LogWrite("ble_evt_connection_disconnected: ", string.Format("connection={0}, reason={1}", e.connection, e.reason)); BLEPeripheral peripheral; if (connectedDevices.TryRemoveByConnection(e.connection, out peripheral)) { peripheral.ConnectionState = BLEPeripheral.ConnState.Disconnected; } // Stop advertising cmd = bglib.BLECommandGAPEndProcedure(); MessageWriter.LogWrite("ble_cmd_gap_end_procedure", ""); bglib.SendCommand(SelectedPort, cmd); // Reset GAP Mode cmd = bglib.BLECommandGAPSetMode(0, 0); MessageWriter.LogWrite("ble_cmd_gap_set_mode: ", "discover=0, connect=0"); bglib.SendCommand(SelectedPort, cmd); BLEScan(); }); }
//ble_evt_connection_disconnected connection: 0 (0x00) reason:0x0216 ['Local device terminated the connection.'] public void DisconnectEvent(object sender, Bluegiga.BLE.Events.Connection.DisconnectedEventArgs e) { String log = string.Format("disconn Reason: {0}\r\n", e.reason); Log = log; byte[] inUint16 = new byte[2]; inUint16 = BitConverter.GetBytes(e.reason); RcvByte[0] = inUint16[0]; RcvByte[1] = inUint16[1]; RcvEventType = EventDisconnSts; RcvResponseType = -1; }
//ble_evt_connection_disconnected connection: 0 (0x00) reason:0x0216 ['Local device terminated the connection.'] public void DisconnectEvent(object sender, Bluegiga.BLE.Events.Connection.DisconnectedEventArgs e) { String log = string.Format("disconn Reason: {0}\r\n", e.reason); ThreadSafeDelegate(delegate { rtxtLog.Text = ""; rtxtLog.AppendText(log); }); }
private void DisconnectStatusEvent(object sender, Bluegiga.BLE.Events.Connection.DisconnectedEventArgs e) { Console.WriteLine("Disconnected"); AppState = STATE_DISCONNECT; }
public void EventDisconnect(object sender, Bluegiga.BLE.Events.Connection.DisconnectedEventArgs e) { }