Fitbit / golden-gate

Framework to connect wearables and other IoT devices to mobile phones, tablets and PCs with an IP-based protocol stack over Bluetooth Low Energy
Other
299 stars 31 forks source link

iOS: Improvements and bug fixes #51

Closed emixb closed 2 years ago

emixb commented 2 years ago

Dont-emit-unknown-bluetooth-state

The new API doesn't emit unknown bluetooth states. Per Apple's docs, 'unknown' is a transient state,
update being imminent. By filtering out a transient state, we avoid a large number of failures.

Bluetooth connection device discoverer

- Add a brand new, fully fledged Bluetooth peer discoverer, flexible enough to be used in all our iOS apps.
- Updated the code to use the new peer discoverer.
- Read device info characteristics from Bluetooth peers and display that information in the UI components.
- Add comprehensive unit tests for the new discoverer.
- Update Hub related tests.
- Other minor fixes and improvements.

Use retry strategy for connection

- Drop duplicate reconnect strategy protocol
- Conform to the improved retry strategy in reconnect strategy
- Make the name of the reconnect strategy a bit more general, to allow it to be used in other contexts,
like scanning.

Import missing frameworks. Specialise OpaquePointers where needed. Add (considerably bigger) waitUntil delay on flaky test.

Identify half bond errors better

Fix CoAP race condition

Use-non-failing-API-for-string-to-data-conversion

There is a new API that converts from string to data, without returning an optional value.
E.g. let data: Data = "hello".data(using: .utf8)! becomes let data: Data = Data("hello".utf8)
This makes the codebase slightly easier to read and safer by removing the force unwrapping.

Replay connection errors in connection controller

Add the ability to replay the last connection error in connection controller. This also requires making
the error optional to allow the subscribers know when an error condition is no longer true.
This change allows adding half bonded handling at endpoint level, using the transport readiness feature.

Xcode 13.2 Support

Update RxSwift to 6.2.0

Make link configuration service optional in UI

Make link configuration service optional in UI (not all connections support link configuration)
Bring the latest RxBluetoothkit where a custom description has been added to some CB wrappers

Improve link connection testability

Add protocols for ReadRequest and WriteRequest to allow testing logic that uses these types
Add handy type aliases for LinkConfiguration structs

Emit tls session state change event together with the tls state

In rare occasions, reading the dtls state from GGStack would result in a crash. While I was unable
to reproduce the crash, it seems the issue occurs at BLE connect or disconnect and may be caused
by accessing deallocated C pointers. This is likely to happen due to the delay that exists between
the time when the tlsStateChange stack event is received and the time when the dtls status is read
(pointers might be freed in the time between the two steps).
This solution proposes combining the two steps into a single, synchronous one. Since the dtls
protocol element of the stack emits the tlsStateChange stack event, it's guaranteed the element
exists when synchronously reading the dtls state from it.

Connection controller type erasure

- Create and use a type erased connection controller instead of the concrete connection controller
implementation. This allows stubbing the controller in unit tests.
- Unit tests for the type erased connection controller
- Add auto-connect back in GGHost