Ejemplo n.º 1
0
 /// <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;
 }
Ejemplo n.º 2
0
 /// <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();
     }
 }
Ejemplo n.º 3
0
        /// <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;
 }