2018-04-02 19:29:19

by Robert Lubaś

[permalink] [raw]
Subject: [PATCH BlueZ 1/2] Mesh: Add Config Beacon to Configuration Model

This patch adds two commands (set and get) to menu config and handles the
incomming status message.
---
mesh/config-client.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)

diff --git a/mesh/config-client.c b/mesh/config-client.c
index 95297bfee..4e5e06258 100644
--- a/mesh/config-client.c
+++ b/mesh/config-client.c
@@ -179,6 +179,13 @@ static bool client_msg_recvd(uint16_t src, uint8_t *data,
mesh_status_str(data[0]));
break;

+ case OP_CONFIG_BEACON_STATUS:
+ if (len != 1)
+ return true;
+ bt_shell_printf("Node %4.4x Config Beacon Status 0x%02x\n",
+ src, data[0]);
+ break;
+
case OP_CONFIG_RELAY_STATUS:
if (len != 2)
return true;
@@ -689,6 +696,37 @@ static void cmd_bind(int argc, char *argv[])
return bt_shell_noninteractive_quit(EXIT_SUCCESS);
}

+static void cmd_beacon_set(int argc, char *argv[])
+{
+ uint16_t n;
+ uint8_t msg[2 + 1];
+ int parm_cnt;
+
+ if (!verify_config_target(target))
+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
+
+ n = mesh_opcode_set(OP_CONFIG_BEACON_SET, msg);
+
+ parm_cnt = read_input_parameters(argc, argv);
+ if (parm_cnt != 1) {
+ bt_shell_printf("bad arguments\n");
+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
+ }
+
+ msg[n++] = parms[0];
+
+ if (!config_send(msg, n)) {
+ bt_shell_printf("Failed to send \"SET BEACON\"\n");
+ return;
+ }
+
+ return bt_shell_noninteractive_quit(EXIT_SUCCESS);}
+
+static void cmd_beacon_get(int argc, char *argv[])
+{
+ cmd_default(OP_CONFIG_BEACON_GET);
+}
+
static void cmd_ident_set(int argc, char *argv[])
{
uint16_t n;
@@ -1178,6 +1216,10 @@ static const struct bt_shell_menu cfg_menu = {
"Set node identity state"},
{"ident-get", "<net_idx>", cmd_ident_get,
"Get node identity state"},
+ {"beacon-set", "<state>", cmd_beacon_set,
+ "Set node identity state"},
+ {"beacon-get", NULL, cmd_beacon_get,
+ "Get node beacon state"},
{"relay-set", "<relay> <rexmt count> <rexmt steps>",
cmd_relay_set,
"Set relay"},
--
2.11.0



2018-04-06 06:09:47

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/2] Mesh: Add Config Beacon to Configuration Model

Hi Robert,

On Thu, Apr 5, 2018 at 10:42 AM, Robert Lubas <[email protected]> wr=
ote:
> Hi Inga, Luiz,
>
>
> On 04/03/2018 06:27 PM, Stotland, Inga wrote:
>>
>> Hi Robert, Luiz,
>>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of Robert Lubas
>> Sent: Tuesday, April 3, 2018 5:09 AM
>> To: Luiz Augusto von Dentz <[email protected]>
>> Cc: [email protected]
>> Subject: Re: [PATCH BlueZ 1/2] Mesh: Add Config Beacon to Configuration
>> Model
>>
>> Hi Luiz,
>>
>> On 04/03/2018 10:18 AM, Luiz Augusto von Dentz wrote:
>>>
>>> Hi Robert,
>>>
>>> On Mon, Apr 2, 2018 at 10:29 PM, Robert Luba=C5=9B <robert.lubas@silvai=
r.com>
>>> wrote:
>>>>
>>>> This patch adds two commands (set and get) to menu config and handles
>>>> the incomming status message.
>>>> ---
>>>> mesh/config-client.c | 42 +++++++++++++++++++++++++++++++++++++++++=
+
>>>> 1 file changed, 42 insertions(+)
>>>>
>>>> diff --git a/mesh/config-client.c b/mesh/config-client.c index
>>>> 95297bfee..4e5e06258 100644
>>>> --- a/mesh/config-client.c
>>>> +++ b/mesh/config-client.c
>>>> @@ -179,6 +179,13 @@ static bool client_msg_recvd(uint16_t src, uint8_=
t
>>>> *data,
>>>> mesh_status_str(data[0]));
>>>> break;
>>>>
>>>> + case OP_CONFIG_BEACON_STATUS:
>>>> + if (len !=3D 1)
>>>> + return true;
>>>> + bt_shell_printf("Node %4.4x Config Beacon Status
>>>> 0x%02x\n",
>>>> + src, data[0]);
>>>> + break;
>>>> +
>>>> case OP_CONFIG_RELAY_STATUS:
>>>> if (len !=3D 2)
>>>> return true; @@ -689,6 +696,37 @@ static
>>>> void cmd_bind(int argc, char *argv[])
>>>> return bt_shell_noninteractive_quit(EXIT_SUCCESS);
>>>> }
>>>>
>>>> +static void cmd_beacon_set(int argc, char *argv[]) {
>>>> + uint16_t n;
>>>> + uint8_t msg[2 + 1];
>>>> + int parm_cnt;
>>>> +
>>>> + if (!verify_config_target(target))
>>>> + return bt_shell_noninteractive_quit(EXIT_FAILURE);
>>>> +
>>>> + n =3D mesh_opcode_set(OP_CONFIG_BEACON_SET, msg);
>>>> +
>>>> + parm_cnt =3D read_input_parameters(argc, argv);
>>>> + if (parm_cnt !=3D 1) {
>>>> + bt_shell_printf("bad arguments\n");
>>>> + return bt_shell_noninteractive_quit(EXIT_FAILURE);
>>>> + }
>>>> +
>>>> + msg[n++] =3D parms[0];
>>>> +
>>>> + if (!config_send(msg, n)) {
>>>> + bt_shell_printf("Failed to send \"SET BEACON\"\n");
>>>> + return;
>>>> + }
>>>> +
>>>> + return bt_shell_noninteractive_quit(EXIT_SUCCESS);}
>>>
>>>
>>> You should have a like break before }
>>>
>>>> +
>>>> +static void cmd_beacon_get(int argc, char *argv[]) {
>>>> + cmd_default(OP_CONFIG_BEACON_GET);
>>>> +}
>>>> +
>>>> static void cmd_ident_set(int argc, char *argv[])
>>>> {
>>>> uint16_t n;
>>>> @@ -1178,6 +1216,10 @@ static const struct bt_shell_menu cfg_menu =3D =
{
>>>> "Set node identity
>>>> state"},
>>>> {"ident-get", "<net_idx>", cmd_ident_ge=
t,
>>>> "Get node identity
>>>> state"},
>>>> + {"beacon-set", "<state>", cmd_beacon_set=
,
>>>> + "Set node identity
>>>> state"},
>>>> + {"beacon-get", NULL, cmd_beacon_get=
,
>>>> + "Get node beacon
>>>> + state"},
>>>> {"relay-set", "<relay> <rexmt count> <rexmt steps>=
",
>>>> cmd_relay_set,
>>>> "Set relay"},
>>>> --
>>>> 2.11.0
>>>
>>>
>>> Other than this looks good, lets see if Inga has anything to comment.
>>>
>> The broken line goes to V2.
>>
>> Thanks
>> --
>>
>> The patches look fine.
>> Thanks,
>> Inga
>>
>>
>
> I include small fix (broken line) after Luiz review. There is a separate
> dangling e-mail with patch.

Applied, thanks.

--=20
Luiz Augusto von Dentz

2018-04-05 07:42:11

by Robert Lubaś

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/2] Mesh: Add Config Beacon to Configuration Model

Hi Inga, Luiz,

On 04/03/2018 06:27 PM, Stotland, Inga wrote:
> Hi Robert, Luiz,
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Robert Lubas
> Sent: Tuesday, April 3, 2018 5:09 AM
> To: Luiz Augusto von Dentz <[email protected]>
> Cc: [email protected]
> Subject: Re: [PATCH BlueZ 1/2] Mesh: Add Config Beacon to Configuration Model
>
> Hi Luiz,
>
> On 04/03/2018 10:18 AM, Luiz Augusto von Dentz wrote:
>> Hi Robert,
>>
>> On Mon, Apr 2, 2018 at 10:29 PM, Robert Lubaś <[email protected]> wrote:
>>> This patch adds two commands (set and get) to menu config and handles
>>> the incomming status message.
>>> ---
>>> mesh/config-client.c | 42 ++++++++++++++++++++++++++++++++++++++++++
>>> 1 file changed, 42 insertions(+)
>>>
>>> diff --git a/mesh/config-client.c b/mesh/config-client.c index
>>> 95297bfee..4e5e06258 100644
>>> --- a/mesh/config-client.c
>>> +++ b/mesh/config-client.c
>>> @@ -179,6 +179,13 @@ static bool client_msg_recvd(uint16_t src, uint8_t *data,
>>> mesh_status_str(data[0]));
>>> break;
>>>
>>> + case OP_CONFIG_BEACON_STATUS:
>>> + if (len != 1)
>>> + return true;
>>> + bt_shell_printf("Node %4.4x Config Beacon Status 0x%02x\n",
>>> + src, data[0]);
>>> + break;
>>> +
>>> case OP_CONFIG_RELAY_STATUS:
>>> if (len != 2)
>>> return true; @@ -689,6 +696,37 @@ static
>>> void cmd_bind(int argc, char *argv[])
>>> return bt_shell_noninteractive_quit(EXIT_SUCCESS);
>>> }
>>>
>>> +static void cmd_beacon_set(int argc, char *argv[]) {
>>> + uint16_t n;
>>> + uint8_t msg[2 + 1];
>>> + int parm_cnt;
>>> +
>>> + if (!verify_config_target(target))
>>> + return bt_shell_noninteractive_quit(EXIT_FAILURE);
>>> +
>>> + n = mesh_opcode_set(OP_CONFIG_BEACON_SET, msg);
>>> +
>>> + parm_cnt = read_input_parameters(argc, argv);
>>> + if (parm_cnt != 1) {
>>> + bt_shell_printf("bad arguments\n");
>>> + return bt_shell_noninteractive_quit(EXIT_FAILURE);
>>> + }
>>> +
>>> + msg[n++] = parms[0];
>>> +
>>> + if (!config_send(msg, n)) {
>>> + bt_shell_printf("Failed to send \"SET BEACON\"\n");
>>> + return;
>>> + }
>>> +
>>> + return bt_shell_noninteractive_quit(EXIT_SUCCESS);}
>>
>> You should have a like break before }
>>
>>> +
>>> +static void cmd_beacon_get(int argc, char *argv[]) {
>>> + cmd_default(OP_CONFIG_BEACON_GET);
>>> +}
>>> +
>>> static void cmd_ident_set(int argc, char *argv[])
>>> {
>>> uint16_t n;
>>> @@ -1178,6 +1216,10 @@ static const struct bt_shell_menu cfg_menu = {
>>> "Set node identity state"},
>>> {"ident-get", "<net_idx>", cmd_ident_get,
>>> "Get node identity
>>> state"},
>>> + {"beacon-set", "<state>", cmd_beacon_set,
>>> + "Set node identity state"},
>>> + {"beacon-get", NULL, cmd_beacon_get,
>>> + "Get node beacon
>>> + state"},
>>> {"relay-set", "<relay> <rexmt count> <rexmt steps>",
>>> cmd_relay_set,
>>> "Set relay"},
>>> --
>>> 2.11.0
>>
>> Other than this looks good, lets see if Inga has anything to comment.
>>
> The broken line goes to V2.
>
> Thanks
> --
>
> The patches look fine.
> Thanks,
> Inga
>
>

I include small fix (broken line) after Luiz review. There is a separate
dangling e-mail with patch.
Robert


2018-04-03 16:27:40

by Stotland, Inga

[permalink] [raw]
Subject: RE: [PATCH BlueZ 1/2] Mesh: Add Config Beacon to Configuration Model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ICAgICAgICAgICAgICAgICBjbWRfYmVhY29u
X2dldCwNCj4+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICJHZXQgbm9kZSBiZWFjb24gDQo+PiArIHN0YXRlIn0sDQo+PiAgICAgICAgICB7InJlbGF5LXNl
dCIsICAgICAgICAgICAiPHJlbGF5PiA8cmV4bXQgY291bnQ+IDxyZXhtdCBzdGVwcz4iLA0KPj4g
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtZF9yZWxh
eV9zZXQsDQo+PiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgIlNldCByZWxheSJ9LA0KPj4gLS0NCj4+IDIuMTEuMA0KPiANCj4gT3RoZXIgdGhhbiB0aGlz
IGxvb2tzIGdvb2QsIGxldHMgc2VlIGlmIEluZ2EgaGFzIGFueXRoaW5nIHRvIGNvbW1lbnQuDQo+
IA0KVGhlIGJyb2tlbiBsaW5lIGdvZXMgdG8gVjIuDQoNClRoYW5rcw0KLS0NCg0KVGhlIHBhdGNo
ZXMgbG9vayBmaW5lLg0KVGhhbmtzLA0KSW5nYQ0KDQo=

2018-04-03 12:09:12

by Robert Lubaś

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/2] Mesh: Add Config Beacon to Configuration Model

Hi Luiz,

On 04/03/2018 10:18 AM, Luiz Augusto von Dentz wrote:
> Hi Robert,
>
> On Mon, Apr 2, 2018 at 10:29 PM, Robert Lubaś <[email protected]> wrote:
>> This patch adds two commands (set and get) to menu config and handles the
>> incomming status message.
>> ---
>> mesh/config-client.c | 42 ++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 42 insertions(+)
>>
>> diff --git a/mesh/config-client.c b/mesh/config-client.c
>> index 95297bfee..4e5e06258 100644
>> --- a/mesh/config-client.c
>> +++ b/mesh/config-client.c
>> @@ -179,6 +179,13 @@ static bool client_msg_recvd(uint16_t src, uint8_t *data,
>> mesh_status_str(data[0]));
>> break;
>>
>> + case OP_CONFIG_BEACON_STATUS:
>> + if (len != 1)
>> + return true;
>> + bt_shell_printf("Node %4.4x Config Beacon Status 0x%02x\n",
>> + src, data[0]);
>> + break;
>> +
>> case OP_CONFIG_RELAY_STATUS:
>> if (len != 2)
>> return true;
>> @@ -689,6 +696,37 @@ static void cmd_bind(int argc, char *argv[])
>> return bt_shell_noninteractive_quit(EXIT_SUCCESS);
>> }
>>
>> +static void cmd_beacon_set(int argc, char *argv[])
>> +{
>> + uint16_t n;
>> + uint8_t msg[2 + 1];
>> + int parm_cnt;
>> +
>> + if (!verify_config_target(target))
>> + return bt_shell_noninteractive_quit(EXIT_FAILURE);
>> +
>> + n = mesh_opcode_set(OP_CONFIG_BEACON_SET, msg);
>> +
>> + parm_cnt = read_input_parameters(argc, argv);
>> + if (parm_cnt != 1) {
>> + bt_shell_printf("bad arguments\n");
>> + return bt_shell_noninteractive_quit(EXIT_FAILURE);
>> + }
>> +
>> + msg[n++] = parms[0];
>> +
>> + if (!config_send(msg, n)) {
>> + bt_shell_printf("Failed to send \"SET BEACON\"\n");
>> + return;
>> + }
>> +
>> + return bt_shell_noninteractive_quit(EXIT_SUCCESS);}
>
> You should have a like break before }
>
>> +
>> +static void cmd_beacon_get(int argc, char *argv[])
>> +{
>> + cmd_default(OP_CONFIG_BEACON_GET);
>> +}
>> +
>> static void cmd_ident_set(int argc, char *argv[])
>> {
>> uint16_t n;
>> @@ -1178,6 +1216,10 @@ static const struct bt_shell_menu cfg_menu = {
>> "Set node identity state"},
>> {"ident-get", "<net_idx>", cmd_ident_get,
>> "Get node identity state"},
>> + {"beacon-set", "<state>", cmd_beacon_set,
>> + "Set node identity state"},
>> + {"beacon-get", NULL, cmd_beacon_get,
>> + "Get node beacon state"},
>> {"relay-set", "<relay> <rexmt count> <rexmt steps>",
>> cmd_relay_set,
>> "Set relay"},
>> --
>> 2.11.0
>
> Other than this looks good, lets see if Inga has anything to comment.
>
The broken line goes to V2.

Thanks

2018-04-03 08:18:39

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/2] Mesh: Add Config Beacon to Configuration Model

Hi Robert,

On Mon, Apr 2, 2018 at 10:29 PM, Robert Luba=C5=9B <[email protected]=
m> wrote:
> This patch adds two commands (set and get) to menu config and handles the
> incomming status message.
> ---
> mesh/config-client.c | 42 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 42 insertions(+)
>
> diff --git a/mesh/config-client.c b/mesh/config-client.c
> index 95297bfee..4e5e06258 100644
> --- a/mesh/config-client.c
> +++ b/mesh/config-client.c
> @@ -179,6 +179,13 @@ static bool client_msg_recvd(uint16_t src, uint8_t *=
data,
> mesh_status_str(data[0]));
> break;
>
> + case OP_CONFIG_BEACON_STATUS:
> + if (len !=3D 1)
> + return true;
> + bt_shell_printf("Node %4.4x Config Beacon Status 0x%02x\n=
",
> + src, data[0]);
> + break;
> +
> case OP_CONFIG_RELAY_STATUS:
> if (len !=3D 2)
> return true;
> @@ -689,6 +696,37 @@ static void cmd_bind(int argc, char *argv[])
> return bt_shell_noninteractive_quit(EXIT_SUCCESS);
> }
>
> +static void cmd_beacon_set(int argc, char *argv[])
> +{
> + uint16_t n;
> + uint8_t msg[2 + 1];
> + int parm_cnt;
> +
> + if (!verify_config_target(target))
> + return bt_shell_noninteractive_quit(EXIT_FAILURE);
> +
> + n =3D mesh_opcode_set(OP_CONFIG_BEACON_SET, msg);
> +
> + parm_cnt =3D read_input_parameters(argc, argv);
> + if (parm_cnt !=3D 1) {
> + bt_shell_printf("bad arguments\n");
> + return bt_shell_noninteractive_quit(EXIT_FAILURE);
> + }
> +
> + msg[n++] =3D parms[0];
> +
> + if (!config_send(msg, n)) {
> + bt_shell_printf("Failed to send \"SET BEACON\"\n");
> + return;
> + }
> +
> + return bt_shell_noninteractive_quit(EXIT_SUCCESS);}

You should have a like break before }

> +
> +static void cmd_beacon_get(int argc, char *argv[])
> +{
> + cmd_default(OP_CONFIG_BEACON_GET);
> +}
> +
> static void cmd_ident_set(int argc, char *argv[])
> {
> uint16_t n;
> @@ -1178,6 +1216,10 @@ static const struct bt_shell_menu cfg_menu =3D {
> "Set node identity state"=
},
> {"ident-get", "<net_idx>", cmd_ident_get,
> "Get node identity state"=
},
> + {"beacon-set", "<state>", cmd_beacon_set,
> + "Set node identity state"=
},
> + {"beacon-get", NULL, cmd_beacon_get,
> + "Get node beacon state"},
> {"relay-set", "<relay> <rexmt count> <rexmt steps>",
> cmd_relay_set,
> "Set relay"},
> --
> 2.11.0

Other than this looks good, lets see if Inga has anything to comment.

--=20
Luiz Augusto von Dentz

2018-04-02 19:29:20

by Robert Lubaś

[permalink] [raw]
Subject: [PATCH BlueZ 2/2] Mesh: Fix in Config GATT Proxy Set

According to the 4.3.2.10 Config GATT Proxy Set, message should have only 1
byte.
---
mesh/config-client.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mesh/config-client.c b/mesh/config-client.c
index 4e5e06258..801bbf710 100644
--- a/mesh/config-client.c
+++ b/mesh/config-client.c
@@ -787,7 +787,7 @@ static void cmd_ident_get(int argc, char *argv[])
static void cmd_proxy_set(int argc, char *argv[])
{
uint16_t n;
- uint8_t msg[2 + 1 + 4];
+ uint8_t msg[2 + 1];
int parm_cnt;

if (!verify_config_target(target))
@@ -802,7 +802,6 @@ static void cmd_proxy_set(int argc, char *argv[])
}

msg[n++] = parms[0];
- msg[n++] = parms[1];

if (!config_send(msg, n)) {
bt_shell_printf("Failed to send \"SET PROXY\"\n");
--
2.11.0