Bluetooth: Mesh: Shell: Change pub cmd period arg
Changes the implementation and documentation in config client shell command for Config Model Publication Set and Config Model Publication Virtual Address Set to accept period resolution and period steps as separate arguments to make it more user friendly. Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
This commit is contained in:
parent
d395719adc
commit
1026ec5b38
2 changed files with 32 additions and 15 deletions
|
@ -635,8 +635,8 @@ The Configuration Client uses general message parameters set by ``mesh target ds
|
|||
* ``Company ID``: If present, determines the Company ID of the model. If omitted, the model is a Bluetooth SIG defined model.
|
||||
|
||||
|
||||
``mesh models cfg model pub <addr> <mod id> [cid] [<PubAddr> <AppKeyIndex> <cred: off, on> <ttl> <period> <count> <interval>]``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
``mesh models cfg model pub <addr> <mod id> [cid] [<PubAddr> <AppKeyIndex> <cred: off, on> <ttl> <PeriodRes> <PeriodSteps> <count> <interval>]``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Get or set the publication parameters of a model. If all publication parameters are included, they become the new publication parameters of the model. If all publication parameters are omitted, print the current publication parameters of the model.
|
||||
|
||||
|
@ -650,12 +650,17 @@ The Configuration Client uses general message parameters set by ``mesh target ds
|
|||
* ``AppKeyIndex``: The application key index to publish with.
|
||||
* ``cred``: Whether to publish with Friendship credentials when acting as a Low Power Node.
|
||||
* ``ttl``: TTL value to publish with (``0x00`` to ``0x07f``).
|
||||
* ``period``: Encoded publication period, or 0 to disable periodic publication.
|
||||
* ``PeriodRes``: Resolution of the publication period steps:
|
||||
* ``0x00``: The Step Resolution is 100 milliseconds
|
||||
* ``0x01``: The Step Resolution is 1 second
|
||||
* ``0x02``: The Step Resolution is 10 seconds
|
||||
* ``0x03``: The Step Resolution is 10 minutes
|
||||
* ``PeriodSteps``: Number of publication period steps, or 0 to disable periodic publication.
|
||||
* ``count``: Number of retransmission for each published message (``0`` to ``7``).
|
||||
* ``interval`` The interval between each retransmission, in milliseconds. Must be a multiple of 50.
|
||||
|
||||
``mesh models cfg model pub-va <addr> <UUID> <AppKeyIndex> <cred: off, on> <ttl> <period> <count> <interval> <mod id> [cid]``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
``mesh models cfg model pub-va <addr> <UUID> <AppKeyIndex> <cred: off, on> <ttl> <PeriodRes> <PeriodSteps> <count> <interval> <mod id> [cid]``
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Set the publication parameters of a model.
|
||||
|
||||
|
@ -669,7 +674,12 @@ The Configuration Client uses general message parameters set by ``mesh target ds
|
|||
* ``AppKeyIndex``: The application key index to publish with.
|
||||
* ``cred``: Whether to publish with Friendship credentials when acting as a Low Power Node.
|
||||
* ``ttl``: TTL value to publish with (``0x00`` to ``0x07f``).
|
||||
* ``period``: Encoded publication period, or 0 to disable periodic publication.
|
||||
* ``PeriodRes``: Resolution of the publication period steps:
|
||||
* ``0x00``: The Step Resolution is 100 milliseconds
|
||||
* ``0x01``: The Step Resolution is 1 second
|
||||
* ``0x02``: The Step Resolution is 10 seconds
|
||||
* ``0x03``: The Step Resolution is 10 minutes
|
||||
* ``PeriodSteps``: Number of publication period steps, or 0 to disable periodic publication.
|
||||
* ``count``: Number of retransmission for each published message (``0`` to ``7``).
|
||||
* ``interval`` The interval between each retransmission, in milliseconds. Must be a multiple of 50.
|
||||
|
||||
|
|
|
@ -1484,7 +1484,7 @@ static int mod_pub_set(const struct shell *sh, uint16_t addr, bool is_va, uint16
|
|||
uint16_t cid, char *argv[])
|
||||
{
|
||||
struct bt_mesh_cfg_cli_mod_pub pub;
|
||||
uint8_t status, count;
|
||||
uint8_t status, count, res_step, steps;
|
||||
uint16_t interval;
|
||||
uint8_t uuid[16];
|
||||
uint8_t len;
|
||||
|
@ -1502,15 +1502,21 @@ static int mod_pub_set(const struct shell *sh, uint16_t addr, bool is_va, uint16
|
|||
pub.app_idx = shell_strtoul(argv[1], 0, &err);
|
||||
pub.cred_flag = shell_strtobool(argv[2], 0, &err);
|
||||
pub.ttl = shell_strtoul(argv[3], 0, &err);
|
||||
pub.period = shell_strtoul(argv[4], 0, &err);
|
||||
res_step = shell_strtoul(argv[4], 0, &err);
|
||||
steps = shell_strtoul(argv[5], 0, &err);
|
||||
if ((res_step > 3) || (steps > 0x3F)) {
|
||||
shell_print(sh, "Invalid period");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
count = shell_strtoul(argv[5], 0, &err);
|
||||
pub.period = (steps << 2) + res_step;
|
||||
count = shell_strtoul(argv[6], 0, &err);
|
||||
if (count > 7) {
|
||||
shell_print(sh, "Invalid retransmit count");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
interval = shell_strtoul(argv[6], 0, &err);
|
||||
interval = shell_strtoul(argv[7], 0, &err);
|
||||
if (err) {
|
||||
shell_warn(sh, "Unable to parse input string argument");
|
||||
return err;
|
||||
|
@ -1765,13 +1771,14 @@ SHELL_STATIC_SUBCMD_SET_CREATE(model_cmds,
|
|||
cmd_mod_app_unbind, 4, 1),
|
||||
SHELL_CMD_ARG(pub, NULL,
|
||||
"<Addr> <Model ID> [Company ID] [<PubAddr> "
|
||||
"<AppKeyIndex> <Cred: off, on> <TTL> <Period> <Count> <Interval>]",
|
||||
cmd_mod_pub, 3, 1 + 7),
|
||||
"<AppKeyIndex> <Cred: off, on> <TTL> <PeriodRes> <PeriodSteps> <Count> "
|
||||
"<Interval>]",
|
||||
cmd_mod_pub, 3, 1 + 8),
|
||||
SHELL_CMD_ARG(pub-va, NULL,
|
||||
"<Addr> <UUID: 16 hex values> "
|
||||
"<AppKeyIndex> <Cred: off, on> <TTL> <Period> <Count> <Interval> "
|
||||
"<Model ID> [Company ID]",
|
||||
cmd_mod_pub_va, 10, 1),
|
||||
"<AppKeyIndex> <Cred: off, on> <TTL> <PeriodRes> <PeriodSteps> <Count> "
|
||||
"<Interval> <Model ID> [Company ID]",
|
||||
cmd_mod_pub_va, 11, 1),
|
||||
SHELL_CMD_ARG(sub-add, NULL, "<Elem addr> <Sub addr> <Model ID> [Company ID]",
|
||||
cmd_mod_sub_add, 4, 1),
|
||||
SHELL_CMD_ARG(sub-del, NULL, "<Elem addr> <Sub addr> <Model ID> [Company ID]",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue