Return-Path: From: "Stotland, Inga" To: "sbrown@cortland.com" , "linux-bluetooth@vger.kernel.org" Subject: Re: [PATCH] mesh: meshctl: Add set heartbeat subscription command Date: Wed, 17 Jan 2018 06:33:47 +0000 Message-ID: <1516170825.4520.12.camel@intel.com> References: <20180112145224.26587-1-sbrown@cortland.com> In-Reply-To: <20180112145224.26587-1-sbrown@cortland.com> Content-Type: multipart/signed; micalg=sha-1; protocol="application/x-pkcs7-signature"; boundary="=-MxefdKCdB6mWOEZuyO8C" MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org List-ID: --=-MxefdKCdB6mWOEZuyO8C Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Steve, On Fri, 2018-01-12 at 09:52 -0500, sbrown@cortland.com wrote: > From: Steve Brown >=20 > [config: Target =3D 0100]# hb-sub-set 0077 0100 2 >=20 > Heartbeat subscription status for node 0100 status: Success > Source: 0077 > Destination: 0100 > Period: 01 > Count: 00 > Min Hops: 7f > Max Hops: 00 > --- > mesh/config-client.c | 60 > +++++++++++++++++++++++++++++++++++++++++++++++++--- > 1 file changed, 57 insertions(+), 3 deletions(-) >=20 > diff --git a/mesh/config-client.c b/mesh/config-client.c > index f280441cc..e6a2e6e93 100644 > --- a/mesh/config-client.c > +++ b/mesh/config-client.c > @@ -318,6 +318,25 @@ static bool client_msg_recvd(uint16_t src, > uint8_t *data, > bt_shell_printf("Features:\t%4.4x\n", get_le16(data > + 6)); > bt_shell_printf("Net_Idx:\t%4.4x\n", get_le16(data + > 8)); > break; Just one minor suggestion. Since now you have support for both HB pub and sub, could you please add a change for the printf of HB publication status to make it publication specific (currently it prints "Set heartbeat for node"? > + > + /* Per Mesh Profile 4.3.2.66 */ > + case OP_CONFIG_HEARTBEAT_SUB_STATUS: > + bt_shell_printf("\nHeartbeat subscription status for > " > + "node %4.4x status: %s\n", > + src, > + data[0] =3D=3D MESH_STATUS_SUCCESS ? > "Success" : > + mesh_status_str(data > [0])); > + > + if (data[0] !=3D MESH_STATUS_SUCCESS) > + return true; > + > + bt_shell_printf("Source:\t\t%4.4x\n", get_le16(data > + 1)); > + bt_shell_printf("Destination:\t%4.4x\n", > get_le16(data + 3)); > + bt_shell_printf("Period:\t\t%2.2x\n", data[5]); > + bt_shell_printf("Count:\t\t%2.2x\n", data[6]); > + bt_shell_printf("Min Hops:\t%2.2x\n", data[7]); > + bt_shell_printf("Max Hops:\t%2.2x\n", data[8]); > + break; > } > =20 > return true; > @@ -946,7 +965,7 @@ static void cmd_get_app(int argc, char *argv[]) > bt_shell_printf("Failed to send \"GET APP GET\"\n"); > } > =20 > -static void cmd_set_hb(int argc, char *argv[]) > +static void cmd_hb_pub_set(int argc, char *argv[]) > { > uint16_t n; > uint8_t msg[32]; > @@ -983,7 +1002,40 @@ static void cmd_set_hb(int argc, char *argv[]) > n +=3D 2; > =20 > if (!config_send(msg, n)) > - bt_shell_printf("Failed to send \"SET HEARTBEAT > PUBLICATION\"\n"); > + bt_shell_printf("Failed to send \"SET HEARTBEAT > PUBLISH\"\n"); > +} > + > +static void cmd_hb_sub_set(int argc, char *argv[]) > +{ > + uint16_t n; > + uint8_t msg[32]; > + int parm_cnt; > + > + if (IS_UNASSIGNED(target)) { > + bt_shell_printf("Destination not set\n"); > + return; > + } > + > + n =3D mesh_opcode_set(OP_CONFIG_HEARTBEAT_SUB_SET, msg); > + > + parm_cnt =3D read_input_parameters(argc, argv); > + if (parm_cnt !=3D 3) { > + bt_shell_printf("Bad arguments: %s\n", argv[1]); > + return; > + } > + > + /* Per Mesh Profile 4.3.2.65 */ > + /* Source address */ > + put_le16(parms[0], msg + n); > + n +=3D 2; > + /* Destination address */ > + put_le16(parms[1], msg + n); > + n +=3D 2; > + /* Period log */ > + msg[n++] =3D parms[2]; > + > + if (!config_send(msg, n)) > + bt_shell_printf("Failed to send \"SET HEARTBEAT > SUBSCRIBE\"\n"); > } > =20 > static void cmd_get_ttl(int argc, char *argv[]) > @@ -1033,7 +1085,9 @@ static const struct bt_shell_menu cfg_menu =3D { > {"relay- > get", NULL, cmd_get_relay, > "Get relay"}, > {"hb-pub-set", " > ", > - cmd_set_hb, "Set heartbeati > publish"}, > + cmd_hb_pub_set, "Set heartbeat > publish"}, > + {"hb-sub-set", " ", > + cmd_hb_sub_set, "Set heartbeat > subscribe"}, > {"sub-add", " ", > cmd_sub_add, "Subscription add"}, > {"sub-get", " ", Regards, Inga --=-MxefdKCdB6mWOEZuyO8C Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Disposition: attachment; filename="smime.p7s" Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIKbTCCBOsw ggPToAMCAQICEDabxALowUBS+21KC0JI8fcwDQYJKoZIhvcNAQEFBQAwbzELMAkGA1UEBhMCU0Ux FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5hbCBUVFAgTmV0 d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9vdDAeFw0xMzEyMTEwMDAwMDBa Fw0yMDA1MzAxMDQ4MzhaMHkxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEUMBIGA1UEBxMLU2Fu dGEgQ2xhcmExGjAYBgNVBAoTEUludGVsIENvcnBvcmF0aW9uMSswKQYDVQQDEyJJbnRlbCBFeHRl cm5hbCBCYXNpYyBJc3N1aW5nIENBIDRCMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA yzuW/y/g0bznz8BD48M94luFzqHaqY9yGN9H/W0J7hOVBpl0rTQJ6kZ7z7hyDb9kf2UW4ZU25alC i+q5m6NwHg+z9pcN7bQ84SSBueaYF7cXlAg7z3XyZbzSEYP7raeuWRf5fYvYzq8/uI7VNR8o/43w PtDP10YDdO/0J5xrHxnC/9/aU+wTFSVsPqxsd7C58mnu7G4VRJ0n9PG4Sfm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