-
Notifications
You must be signed in to change notification settings - Fork 493
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
build/error handling improvements, and pair/unpair support #311
Open
agordon
wants to merge
8
commits into
IanHarvey:master
Choose a base branch
from
agordon:dev-pair
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
Convert the field delimiter to a variable, in preparation to making it user-configurable. The current value (ASCII \x1E, RECORD SEPARATOR) stays the same.
Makes rebuilding the 'bluepy-helper' binary quicker during development.
Support minimal command-line processing: -h = help screen -v = version -s = use SPACE as field delimiters
Extract version string from the python package's setup.py and git revision when rebuilding the executable.
In function 'parse_line', the function 'g_shell_parse_argv' can fail if the input is invalid (according to its limited parsing features). In such cases, argvp would be NULL and argvp[0] would segfault. Example of unparsable input: any string starting with '#'.
When building with debug information (make DEBUGGING=1), use -O0 for easier debugging. Without debugging, use the default -Os.
Both commands (in bluepy-helper) do not take an address parameter, but reuse the device address from the previous 'connect' command.
In previus commit c1d8c3e bluepy-helper binary gained ability to report detailed error codes and messages in the 'emsg' and 'estat' response fields. Propagate these optional fields to the BTLEException class, and display them (when the exception is converted to a string). The updated exception string looks like: bluepy.btle.BTLEException: Disconnect Error: Failed to execute mgmt cmd \ 'unpair' (estat: 6 emsg: Not Paired)
IanHarvey
pushed a commit
that referenced
this pull request
Nov 12, 2018
----- btle: report error details from bluepy-helper In previus commit c1d8c3e bluepy-helper binary gained ability to report detailed error codes and messages in the 'emsg' and 'estat' response fields. Propagate these optional fields to the BTLEException class, and display them (when the exception is converted to a string). The updated exception string looks like: bluepy.btle.BTLEException: Disconnect Error: Failed to execute mgmt cmd \ 'unpair' (estat: 6 emsg: Not Paired)
Thanks for all the patches. This PR didn't merge cleanly because of conflicts with #302, which I had merged earlier. I'll need to do a bit of cherry-picking to get it all fixed up. |
IanHarvey
pushed a commit
that referenced
this pull request
Nov 19, 2018
IanHarvey
pushed a commit
that referenced
this pull request
Nov 19, 2018
Hi @agordon, do you plan to rebase your branch to resolve the conflicts? |
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.
Hello @IanHarvey ,
Thanks for writing this awesome python module.
I've been using it to communicate with a Mcirobit Board ( https://microbit.org ) with excellent results.
One thing that did present some problems is pairing/unpairing. The microbit turned out to be a bit finicky,
and bluepy did not have a 'pair' method that worked for me.
As I was debugging and exploring the bluepy-helper module, I've encountered some minor things that could be improved - they are included in this pull-request. There shouldn't be any major changes here, and no changes at all for the default behaviour.
I hope this is useful and will be accepted. If so, I will follow up with my Microbit Module ( agordon@3f2b0c7 ) that adds a new Microbit module+command line program (modelled after the 'thingy52' module) - including pairing support.
Comments very welcomed,
-gordon