From 11017948309b169d75efa51cefe06c08a0bada75 Mon Sep 17 00:00:00 2001 From: Anjan Chanda <anjan.chanda@iopsys.eu> Date: Tue, 2 Jul 2024 12:25:19 +0200 Subject: [PATCH] update event attribute datatypes from string -> uint32 --- src/ubus.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/ubus.c b/src/ubus.c index 0b3d056..c01ee23 100644 --- a/src/ubus.c +++ b/src/ubus.c @@ -523,9 +523,9 @@ static void csmngr_wifi_radio_event_handler(struct csmngr_private *priv, } else if (!strcmp(event, "cac-start")) { static const struct blobmsg_policy data_attr[] = { - [0] = { .name = "channel", .type = BLOBMSG_TYPE_STRING }, - [1] = { .name = "bandwidth", .type = BLOBMSG_TYPE_STRING }, - [2] = { .name = "cac_time", .type = BLOBMSG_TYPE_STRING }, + [0] = { .name = "channel", .type = BLOBMSG_TYPE_INT32 }, + [1] = { .name = "bandwidth", .type = BLOBMSG_TYPE_INT32 }, + [2] = { .name = "cac_time", .type = BLOBMSG_TYPE_INT32 }, }; struct blob_attr *data[ARRAY_SIZE(data_attr)]; uint32_t channel = 0; @@ -540,18 +540,18 @@ static void csmngr_wifi_radio_event_handler(struct csmngr_private *priv, return; } - channel = atoi(blobmsg_data(data[0])); - bandwidth = atoi(blobmsg_data(data[1])); - cac_time = atoi(blobmsg_data(data[2])); + channel = blobmsg_get_u32(data[0]); + bandwidth = blobmsg_get_u32(data[1]); + cac_time = blobmsg_get_u32(data[2]); csmngr_process_event_radio_cac_start(priv, r, channel, bandwidth, cac_time); } else if (!strcmp(event, "cac-end")) { static const struct blobmsg_policy data_attr[] = { - [0] = { .name = "channel", .type = BLOBMSG_TYPE_STRING }, - [1] = { .name = "bandwidth", .type = BLOBMSG_TYPE_STRING }, - [2] = { .name = "success", .type = BLOBMSG_TYPE_STRING }, + [0] = { .name = "channel", .type = BLOBMSG_TYPE_INT32 }, + [1] = { .name = "bandwidth", .type = BLOBMSG_TYPE_INT32 }, + [2] = { .name = "success", .type = BLOBMSG_TYPE_INT32 }, }; struct blob_attr *data[ARRAY_SIZE(data_attr)]; uint32_t channel = 0; @@ -566,9 +566,9 @@ static void csmngr_wifi_radio_event_handler(struct csmngr_private *priv, return; } - channel = atoi(blobmsg_data(data[0])); - bandwidth = atoi(blobmsg_data(data[1])); - status = atoi(blobmsg_data(data[2])); + channel = blobmsg_get_u32(data[0]); + bandwidth = blobmsg_get_u32(data[1]); + status = blobmsg_get_u32(data[2]); csmngr_process_event_radio_cac_end(priv, r, channel, bandwidth, status); @@ -577,9 +577,9 @@ static void csmngr_wifi_radio_event_handler(struct csmngr_private *priv, !strcmp(event, "nop-end") || !strcmp(event, "pre-cac-end")) { static const struct blobmsg_policy data_attr[] = { - [0] = { .name = "freq", .type = BLOBMSG_TYPE_STRING }, - [1] = { .name = "channel", .type = BLOBMSG_TYPE_STRING }, - [2] = { .name = "bandwidth", .type = BLOBMSG_TYPE_STRING }, + [0] = { .name = "freq", .type = BLOBMSG_TYPE_INT32 }, + [1] = { .name = "channel", .type = BLOBMSG_TYPE_INT32 }, + [2] = { .name = "bandwidth", .type = BLOBMSG_TYPE_INT32 }, }; struct blob_attr *data[ARRAY_SIZE(data_attr)]; //uint32_t freq = 0; @@ -595,8 +595,8 @@ static void csmngr_wifi_radio_event_handler(struct csmngr_private *priv, } //freq = atoi(blobmsg_data(data[0])); - channel = atoi(blobmsg_data(data[1])); - bandwidth = atoi(blobmsg_data(data[2])); + channel = blobmsg_get_u32(data[1]); + bandwidth = blobmsg_get_u32(data[2]); csmngr_process_event_radio_radar(priv, r, channel, bandwidth); -- GitLab