xamarin / Monkey.BluetoothLE

BluetoothLE abstraction for use with Xamarin projects, including Xamarin.Forms.
Apache License 2.0
348 stars 223 forks source link

Refactor Android implementation #44

Open smoy opened 9 years ago

smoy commented 9 years ago

commit 4518d95ab835df786af266655cf0cf8def029377 Author: Steven Moy github@stevenmoy.com Date: Fri May 15 14:37:10 2015 -0700

Refactor out references to gatt and gattCallback. Instead reference device instance instead.

* This is in preparation to allow read/write of characteristic to check
if a device is disconnected before attempting those read/write actions.

commit babab5fa952c0afcb78b372b54af23af060a62f7 Author: Steven Moy github@stevenmoy.com Date: Fri May 15 14:02:51 2015 -0700

Robustify Connect/Disconnet

* During attempt to connect, if an device already has a Gatt instance, tear it down before
trying to connect.
* During attempt to disconnect, tear down the gatt instance to free all the android resources

commit c538bb548244b3284513e3e512d7fd54e5a6e524 Author: Steven Moy github@stevenmoy.com Date: Fri May 15 14:01:20 2015 -0700

Check to see if Connection/Disconnect event corresponds to the device in interest.

* Robustify removing delegates upon device disconnection

commit 8ccc7021bcf210ca09c1aa533f60f65214d3e166 Author: Steven Moy github@stevenmoy.com Date: Fri May 15 11:09:09 2015 -0700

Refactor anonymous delegate into named method, such that
we can remove them when the method finishes its work.

Prior to the change, upon re-entry of ServiceList, the
services entry are added more once because we did not
remove previous added delegate.

commit d34e05ccdb6211c3c0eb943142a5cbe3a308d1cc Author: Steven Moy github@stevenmoy.com Date: Fri May 15 08:31:41 2015 -0700

Add reference to Device instance inside an GattCallback instance.

* Eliminte the need to create new device instance
* Wire up RSSI to the device
* Get DeviceState from the profileState given by GattCallback

commit 4f3f15394362f55ac37c07900e8a6449d3872da7 Author: Steven Moy github@stevenmoy.com Date: Fri May 15 07:48:46 2015 -0700

Change GattCallback to be per device instead of a singleton.

When one wants to connect multiple BLE devices, the singleton approach
doesn't work well. In addition, the adapter class member inside GattCallback
is not being used, it is deleted as well.

The access modifier of _gatt and _gattcallback inside Device is changed from
protected to internal. Such that, the Adapter instance can update those fields
upon connection attempt.