-
Notifications
You must be signed in to change notification settings - Fork 115
Feature/ble gap device name set #189
base: master
Are you sure you want to change the base?
Feature/ble gap device name set #189
Conversation
Add SEC_MODE_SET methods to BLEGapConnSecMode
Please note that this pull request is using commits also in #188 |
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!
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.
This functionality is missing tests. If you want to add it, you can find it in the tests/ folder
pc_ble_driver_py/ble_driver.py
Outdated
write_perm.sm = 0 | ||
write_perm.lv = 0 |
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.
This should probably be .set_no_access()
pc_ble_driver_py/ble_driver.py
Outdated
write_perm.sm = 1 | ||
write_perm.lv = 1 |
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.
write_perm.set_open()
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.
Ok! Now using the BLEGapConnSecMode methods for setting write permissions for the name.
Also trying to write a test for ble_gap_device_name_set()
Also, start writing a test for ble_gap_device_name_set()
def test_ble_gap_device_name_set(): | ||
ble_tester.driver.ble_gap_device_name_set(name="Name 1") | ||
|
||
ble_tester.driver.ble_gap_device_name_set(name="Name 2", device_name_read_only=False) |
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.
This is good, but there is no way to test if the value you tried to set actually was set as well. You may need expose the corresponding get-function "ble_gap_device_name_get", as well as the set-function you already have exposed.
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.
Writing and then checking two different names to the same device should be sufficient.
This is a branch aiming to fix the issue discussed in this thread:
https://devzone.nordicsemi.com/f/nordic-q-a/71774/device-name-shows-garbage-using-pc_ble_driver_py
Example code:
Setting a read-only device name:
Setting a writable device name: