Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

Feature/ble gap device name set #189

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

dangu
Copy link
Contributor

@dangu dangu commented Feb 19, 2021

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:

ble_driver.ble_gap_device_name_set(name="Joh")

Setting a writable device name:

ble_driver.ble_gap_device_name_set(name="Joh2", device_name_read_only=False)

@dangu
Copy link
Contributor Author

dangu commented Feb 23, 2021

Please note that this pull request is using commits also in #188

Copy link
Contributor

@kenr kenr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Contributor

@jornbh jornbh left a 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

Comment on lines 2288 to 2289
write_perm.sm = 0
write_perm.lv = 0
Copy link
Contributor

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()

Comment on lines 2291 to 2292
write_perm.sm = 1
write_perm.lv = 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

write_perm.set_open()

Copy link
Contributor Author

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()

Comment on lines +181 to +184
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)
Copy link
Contributor

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.

Copy link
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants