From: "Stotland, Inga" <inga.stotland@intel.com>
To: "sbrown@cortland.com" <sbrown@cortland.com>,
"linux-bluetooth@vger.kernel.org"
<linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH V2 3/8] mesh: meshctl: Add set heartbeat command
Date: Thu, 14 Dec 2017 08:20:58 +0000 [thread overview]
Message-ID: <1513239656.3023.28.camel@intel.com> (raw)
In-Reply-To: <20171212125832.13440-4-sbrown@cortland.com>
[-- Attachment #1: Type: text/plain, Size: 4955 bytes --]
Hi Steve,
On Tue, 2017-12-12 at 12:58 +0000, sbrown@cortland.com wrote:
> From: Steve Brown <sbrown@cortland.com>
>
> Sets heartbeat for node 0100
>
> [config: Target = 0100]# hb-set 0100 0 0 0 0
>
> Set heartbeat for node 0100 status: Success
> Destination: 0100
> Count: 00
> Period: 00
> TTL: ff
> Features: 0000
> Net_Idx: 0000
> ---
> mesh/config-client.c | 60
> ++++++++++++++++++++++++++++++++++++++++++++++++++++
> mesh/net.c | 20 +++++++++++++++++-
> 2 files changed, 79 insertions(+), 1 deletion(-)
>
> diff --git a/mesh/config-client.c b/mesh/config-client.c
> index aa7414cc3..18831dd4f 100644
> --- a/mesh/config-client.c
> +++ b/mesh/config-client.c
> @@ -258,6 +258,24 @@ static bool client_msg_recvd(uint16_t src,
> uint8_t *data,
> bt_shell_printf("Subscr Addr:\t%4.4x\n",
> get_le16(data + i));
> break;
> +
> + /* Per Mesh Profile 4.3.2.63 */
> + case OP_CONFIG_HEARTBEAT_PUB_STATUS:
> + bt_shell_printf("\nSet heartbeat for node %4.4x
> status: %s\n",
> + src,
> + data[0] == MESH_STATUS_SUCCESS ?
> "Success" :
> + mesh_status_str(data
> [0]));
> +
> + if (data[0] != MESH_STATUS_SUCCESS)
> + return true;
> +
> + bt_shell_printf("Destination:\t%4.4x\n",
> get_le16(data + 1));
> + bt_shell_printf("Count:\t\t%2.2x\n", data[3]);
> + bt_shell_printf("Period:\t\t%2.2x\n", data[4]);
> + bt_shell_printf("TTL:\t\t%2.2x\n", data[5]);
> + 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;
> }
>
> return true;
> @@ -712,6 +730,46 @@ static void cmd_sub_get(int argc, char *argv[])
> bt_shell_printf("Failed to send \"GET SUB GET\"\n");
> }
>
> +static void cmd_set_hb(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 = mesh_opcode_set(OP_CONFIG_HEARTBEAT_PUB_SET, msg);
> +
> + parm_cnt = read_input_parameters(argc, argv);
> + if (parm_cnt != 5) {
> + bt_shell_printf("Bad arguments: %s\n", argv[1]);
> + return;
> + }
> +
> + /* Per Mesh Profile 4.3.2.62 */
> + /* Publish address */
> + put_le16(parms[0], msg + n);
> + n += 2;
> + /* Count Log */
> + msg[n++] = parms[1];
> + /* Period Log */
> + msg[n++] = parms[2];
> + /* Heartbeat TTL */
> + msg[n++] = DEFAULT_TTL;
> + /* Features */
> + put_le16(parms[3], msg + n);
> + n += 2;
> + /* NetKey Index */
> + put_le16(parms[4], msg + n);
> + n += 2;
> +
> + if (!config_send(msg, n))
> + bt_shell_printf("Failed to send \"SET HEARTBEAT
> PUBLICATION\"\n");
> +}
> +
> static void cmd_get_ttl(int argc, char *argv[])
> {
> cmd_default(OP_CONFIG_DEFAULT_TTL_GET);
> @@ -741,6 +799,8 @@ static const struct bt_shell_menu cfg_menu = {
> {"pub-set", "<ele_addr> <pub_addr> <app_idx> "
> "<period (step|res)> <re-xmt (count|per)>
> <model>",
> cmd_set_pub, "Set
> publication"},
> + {"hb-set", "<pub_addr> <count> <period> <features>
> <net_idx>",
> + cmd_set_hb, "Set heartbeat"},
> {"sub-add", "<ele_addr> <sub_addr> <model id>",
> cmd_sub_add, "Subscription add"},
> {"sub-get", "<ele_addr> <model id>",
> diff --git a/mesh/net.c b/mesh/net.c
> index 421dc6955..20dfcb8a8 100644
> --- a/mesh/net.c
> +++ b/mesh/net.c
> @@ -1399,6 +1399,24 @@ static bool ctl_rxed(uint16_t net_idx,
> uint32_t iv_index,
> uint8_t *trans, uint16_t len)
> {
> /* TODO: Handle control messages */
> +
> + /* Per Mesh Profile 3.6.5.10 */
> + if (trans[0] == NET_OP_HEARTBEAT) {
> + uint16_t feat = get_be16(trans + 2);
> +
> + bt_shell_printf("HEARTBEAT src: %4.4x dst: %4.4x \
> + TTL: %2.2x feat: %s%s%s%s\n",
> + src, dst, trans[1],
> + (feat & MESH_FEATURE_RELAY) ? "relay
> " : "",
> + (feat & MESH_FEATURE_PROXY) ? "proxy
> " : "",
> + (feat & MESH_FEATURE_FRIEND) ?
> "friend " : "",
> + (feat & MESH_FEATURE_LPN) ? "lpn" :
> "");
> + return true;
> + }
> +
> + bt_shell_printf("unrecognized control message src:%4.4x
> dst:%4.4x len:%d\n",
> + src, dst, len);
> + print_byte_array("msg: ", trans, len);
> return false;
> }
>
> @@ -2098,7 +2116,7 @@ bool net_access_layer_send(uint8_t ttl,
> uint16_t src, uint32_t dst,
> if (!result)
> return false;
>
> - segN = SEG_MAX(len + sizeof(uint32_t));
> + segN = SEG_MAX(len + sizeof(mic32));
>
> /* Only one ACK required SAR message per destination at a
> time */
> if (segN && IS_UNICAST(dst)) {
This new command's name should reflect that it's for configuring
heartbeat publication (as opposed to heartbeat subscription). Something
like "hb-pub-set"? This way, the config for HB subscription, when
implemented, could be "hb-sub-set".
Regards,
Inga
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3266 bytes --]
next prev parent reply other threads:[~2017-12-14 8:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-12 12:58 [PATCH V2 0/8] mesh: Add configuration commands to meshctl sbrown
2017-12-12 12:58 ` [PATCH V2 1/8] mesh: meshctl: Change command names to <cmd>-<get/set> sbrown
2017-12-14 8:08 ` Stotland, Inga
2017-12-14 9:12 ` Steve Brown
2017-12-15 2:14 ` Stotland, Inga
2017-12-15 6:57 ` Steve Brown
2017-12-12 12:58 ` [PATCH V2 2/8] mesh: meshctl: Add add/get Subscribe sbrown
2017-12-12 12:58 ` [PATCH V2 3/8] mesh: meshctl: Add set heartbeat command sbrown
2017-12-14 8:20 ` Stotland, Inga [this message]
2017-12-12 12:58 ` [PATCH V2 4/8] mesh: meshctl: Add get app keys command sbrown
2017-12-12 12:58 ` [PATCH V2 5/8] mesh: meshctl: Add get publish command sbrown
2017-12-12 12:58 ` [PATCH V2 6/8] mesh: meshctl: Add set/get proxy command sbrown
2017-12-12 12:58 ` [PATCH V2 7/8] mesh: meshctl: Add get/set identity sbrown
2017-12-12 12:58 ` [PATCH V2 8/8] mesh: meshctl: Add get/set relay command sbrown
2017-12-13 12:27 ` [PATCH V2 0/8] mesh: Add configuration commands to meshctl Luiz Augusto von Dentz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1513239656.3023.28.camel@intel.com \
--to=inga.stotland@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=sbrown@cortland.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.