Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Android implementation #44

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Conversation

smoy
Copy link

@smoy smoy commented May 16, 2015

commit 4518d95
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 babab5f
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 c538bb5
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 8ccc702
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 d34e05c
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 4f3f153
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.

smoy added 11 commits May 15, 2015 07:48
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.
* Eliminte the need to create new device instance
* Wire up RSSI to the device
* Get DeviceState from the profileState given by GattCallback
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.
… in interest.

* Robustify removing delegates upon device disconnection
* 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
…evice 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.
* Minimize the number of new Device instance that is constructed
* Delay Service discovered event registation until Discover service is called
* Remove DiscoveredService handler once we receive the callback from OnDiscoveredService
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant