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

[5.0] Cleanup of library from the old architecture #162

Closed
Kacper20 opened this issue Oct 22, 2017 · 1 comment
Closed

[5.0] Cleanup of library from the old architecture #162

Kacper20 opened this issue Oct 22, 2017 · 1 comment
Assignees
Labels
Milestone

Comments

@Kacper20
Copy link
Contributor

Kacper20 commented Oct 22, 2017

As part of 5.0 release we want to simplify the library by changing it’s architecture. This will allow us to remove any code duplication that is part of the current release of the library

Change design

Current hierarchy for every CoreBluetooth object looks as follows:

  • Main object that user of the library is interacting with ie. Peripheral
  • Protocol that exposes delegate method callbacks & methods that perform Bluetooth related operations (scan, connection) ie. RxPeripheralType.
  • Concrete implementation of the protocol that is using CoreBluetooth objects: RxCBPeripheral. These are injected to the main objects and allow for the normal use of the library
  • Fakes that are implementing the protocols ie. FakePeripheral. We’re injecting them into main objects for the purpose of unit tests.

We would like to get rid of the last 3 layers when implementing the cleanup. After the currently described issue will be implemented tests will not be a part of the library and will come back a bit later. We believe that the new approach to testing the library will be much easier and allow to make changes and API additions faster. It should also make tests way more concise than today.
As a result of this task:

  • All protocols, concrete implementations and fakes should be removed
  • Tests related to the Bluetooth stack hierarchy should be removed

Then, all main, user facing objects will directly use it’s CB counterparts and call the methods on them. To receive delegate callbacks, BluetoothManager and Peripheral will contain delegate wrappers object. First one will conform to the CBCentralManagerDelegate protocol and the second one to the CBPeripheralDelegate protocol. Both will expose delegate callbacks via observables to the main objects.

How it affects the current users

External API of the BluetoothManager, Peripheral, Service, Characteristic, Descriptor and any of the dependent objects will not be changed. Therefore it is not considered a breaking change.

@Kacper20 Kacper20 added the todo label Oct 22, 2017
@Kacper20 Kacper20 added this to the 5.0.0 milestone Oct 22, 2017
@Kacper20 Kacper20 self-assigned this Oct 22, 2017
Kacper20 added a commit that referenced this issue Oct 25, 2017
* Removed test files

* Removed architecture overload for service, characteristic and descriptor

* Removed references to BluetoothManager related overhead objects

* Final fixes

* Fixed identifier variable on UUID

* Removed comments related to RxCB layer

* Fixed the unnecessary comments and fixed variables namings

* Review fixes
@Kacper20
Copy link
Contributor Author

Completed in #171

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant