-
Notifications
You must be signed in to change notification settings - Fork 375
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
Support for CBPeripheralManager #166
Comments
Hi, is there any news about the shipping date of this feature (PeripheralManager)? I'd like to use it in the near future and really loved the CentralManager, so would be a clean approach to use this new feature as well. |
@danielbotka hey, we are on the final steps before releasing RC version with |
@paweljaneczek hey, yes, I'd be happy to play around a little, probably next week. Is it on a specific branch? |
@danielbotka great to hear! In next week we will have probably RC library version so we will give a sign to you in this thread |
@paweljaneczek We also have a project that we could integrate this into. Should I try and integrate from the |
@jodm great! For now the newest changes are on |
@jodm @danielbotka We've just release version 5.1.0 with support for |
Our library currently only supports
CoreBluetooth
central mode.New object would be named
PeripheralManager
(with consistent naming toCentralManager
)Design
Since
CBCentralManager
andCBPeripheralManager
both inherit fromCBManager
which consiststate
property it would be appropriate to map the same relationship in our hierarchy in order to avoid code duplication. It could be namedBaseManager
and should takeCBManager
instance in initializer. This class would expose functions that operate on state, that currently belong to theBluetoothManager
, like continuous access toBluetoothState
.Then, both new
CentralManager
andPeripheralManager
would inherit fromBaseManager
.Design of
PeripheralManager
should be analogous to the currentCentralManager
(After changes from #162 . One that implements it should perform pairing of methods fromCBPeripheralManager
and the delegates callbacks. Then, every method should be wrapped in an reactive way. Delegate proxy for theCBPeripheralManagerDelegate
should also be created.In What’s New in CoreBluetooth, 712, WWDC 2017 session Apple has announced couple of new APIs as a part of iOS 11 & macOS 13. We would like to support it in our reactive wrappers.
L2CAPChannels
There were 2 main API changes introduced: L2CAPChannels capabilities in
Central
modes of the CoreBluetooth and enhancements in write without response. L2CAPChannels change should be also a part of #166 task.CBPeripheralManager
instance contains two methods for publishing and unpublishing channels:publishL2CAPChannel(withEncryption: Bool)
unpublishL2CAPChannel(CBL2CAPPSM)
These two have delegate methods that inform about the success of each operation. Exposed interface should be as follows:
func publishL2CAPChannel(withEncryption: Bool) -> Observable<CBL2CAPPSM>
func unpublishL2CAPChannel(CBL2CAPPSM) -> Observable<CBL2CAPPSM>
Implementation is pretty standard —> connection to the delegate methods and performing function call on
CBPeripheralManager
instance. Proper errors should be introduced as a part ofBluetoothError
structure.We should also allow user to monitor openings of
L2CAPChannel
. To do this we should expose function likefunc monitorL2CAPChannelOpenings -> Observable<CBL2CAPChannel
. It would connect to this delegate method. We should probably provide function likepublishAndMonitorOpeningsOfL2CAPChannel
. Basically the design should be analogous to the setting notification as enabled and monitoring notifications onCBCharacteristic
.L2CAPChannel
It’s a wrapper around
CBL2CAPChannel
CoreBluetooth object. It should only be created if we would decide to wrapInputStream
andOutputStream
properties ofCBL2CAPChannel
into reactive wrappers. If it’ll not be the case (and it probably shouldn’t be) — all of the interface methods should simply return directlyCBL2CAPChannel
objects.Affection to current users
Additive changes
The text was updated successfully, but these errors were encountered: