-
Notifications
You must be signed in to change notification settings - Fork 149
get example app working #68
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
Conversation
get { | ||
return id.id | ||
} | ||
set(newID) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a public setter to Transmitter.id isn’t the right solution, since additional state on Transmitter like activationDate need to be reset. I think it’s cleaner for clients to recreate Transmitter when the ID changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ps2, will do, much cleaner. I have changed the client code to recreate Transmitter; it just doesn't always start scanning reliably after a change to the transmitter ID. Once I've chased that down I'll push the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anything I need to do in the client to tear down the old transmitter and replace it with a new one? When I try this, and change the ID in the client, the CBCentralManager state is sometimes .poweredOn
, which is all good, but sometimes .unsupported
, in which case we can't scan. Does the central manager need to be a singleton or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we store the transmitter state (activationDate
and lastTimeMessage
in the TransmitterID object, which gets renewed on a new ID). If we write the setter like this
set(newID) {
stopScanning()
id = TransmitterID(id: newID)
resumeScanning()
}
then we scan afresh when the user changes ID.
I'd be happy to replace the entire Transmitter object, but can't find a clean way for the old Transmitter object to release all bluetooth resources in time for the new object to use them (if that makes sense).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do need to reset the bluetooth peripheral if we're changing the transmitter id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #70; I've incorporated some of the things you've been pointing out there. I think this PR should just focus on getting the example app building. I.e. Removing cocoapods, and incorporating the example app into the project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks!
This PR
pod install
is called (see here for reference)ID
inTransmitter
xDripG5.podspec
to 10.3 to keep dependencies happyNote that the compilation order for xDripG5 needs to be changed as a workaround for https://bugs.swift.org/browse/SR-631. Specifically,
PeripheralManager+G5.swift
andBluetoothServices.swift
need to be compiled afterPeripheralManager.swift
to avoid errors like "'Configuration' is not a member type of 'PeripheralManager'". Not sure how to specify compilation order in CocoaPods.