/// <summary> /// HVC_BLE finalizer<br> /// [Description]<br> /// MUST be called when ending<br> </summary> /// <exception cref="Throwable"> </exception> public new void Dispose() { Status = STATE_DISCONNECTED; if (Service != null) { Service.Close(); } Service = null; }
/// <summary> /// HVC_BLE disconnect<br> /// [Description]<br> /// Disconnect HVC_BLE device<br> /// </summary> public virtual void Disconnect() { // TODO Auto-generated method stub Status = STATE_DISCONNECTED; if (Service != null) { Debug.WriteLine(TAG, "DisConnect Device = " + BtDevice.Name + " (" + BtDevice.Address + ")"); Service.Close(); } Service = null; if (Callback != null) { Callback.OnDisconnected(); } }
/// <summary> /// HVC_BLE connect<br> /// [Description]<br> /// Connect with HVC_BLE device<br> /// </summary> public virtual void Connect(Context context, BluetoothDevice device) { // TODO Auto-generated method stub Status = STATE_DISCONNECTED; if (Service != null) { Debug.WriteLine(TAG, "DisConnect Device = " + BtDevice.Name + " (" + BtDevice.Address + ")"); Service.Close(); } BtDevice = device; if (BtDevice == null) { return; } Service = new BleDeviceService(GattCallback); Service.Connect(context, BtDevice); Debug.WriteLine(TAG, "Connect Device = " + BtDevice.Name + " (" + BtDevice.Address + ")"); }
public GattCallback(BleDeviceService parent) { this.Service = parent; }