Conversation
- Added a MakeEmitter func that will create an Emitter and initialized its properties.
- Added Close func to clean chans of Emitter
- Added chan for subscribe and for clean
- Subscribe: The On function of Emitter now write on chan Subscribe
- Clean: The Close func (just added) write on the clean chan
- Updated Init func
- There is a Select statement inside the loop. The cases of the select are
- event: in order to propagte event received from xpc to user handlers
- subscribe(just added): in order to add an handler to the map of handlers
- clean(just added): in order to clean up all channels an quit the loop
- comment the close at the end of the lopp that maked it panic
- removed each break based on result. The bool returned by the handlers are not used anymore (keep for retrocompatibility issues)
goble.go
- Call ble.Emitter.Init() inside func (ble *BLE) Init() instead of New
- sendCBMsg: use the message constructed instead of rebuilted it
- HandleXpcEvent: In the read case, use `Get` instead of `Must` because when connected to a peripheral after a connect. Automatically received a read event that does not contained
- kCBMsgArgCharacteristicHandle
- kCBMsgArgData
Owner
|
Can you explain why you added the emitter callbacks ? Also, this PR contains some unrelated fixes (sendCBMsg and HandleXpcEvent) that should be sent separately (maybe with an associated issue ?) Thanks! |
Author
|
Hi, I made some changes since then. I can commit them if you want. Best |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
emitter.go
goble.go
Getinstead ofMustbecause when connected to a peripheral after a connect. Automatically received a read event that does not contained