measurement: generalize measurement handling
Generalize measurement handling in a way that RCPi and RSNI are stored regardless of the specific measurement type. This allows us to handle link-measurement reports the same way as we already handle beacon-reports. Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
10
local_node.c
10
local_node.c
@@ -205,8 +205,6 @@ usteer_local_node_handle_beacon_report(struct usteer_local_node *ln, struct blob
|
||||
[BR_RSNI] = { .name = "rsni", .type = BLOBMSG_TYPE_INT16 },
|
||||
};
|
||||
struct blob_attr *tb[__BR_MAX];
|
||||
|
||||
struct usteer_beacon_report br;
|
||||
struct usteer_node *node;
|
||||
uint8_t *addr;
|
||||
struct sta *sta;
|
||||
@@ -231,10 +229,10 @@ usteer_local_node_handle_beacon_report(struct usteer_local_node *ln, struct blob
|
||||
if (!node)
|
||||
return 0;
|
||||
|
||||
br.rcpi = (uint8_t)blobmsg_get_u16(tb[BR_RCPI]);
|
||||
br.rsni = (uint8_t)blobmsg_get_u16(tb[BR_RSNI]);
|
||||
|
||||
usteer_measurement_report_add_beacon_report(sta, node, &br, current_time);
|
||||
usteer_measurement_report_add(sta, node,
|
||||
(uint8_t)blobmsg_get_u16(tb[BR_RCPI]),
|
||||
(uint8_t)blobmsg_get_u16(tb[BR_RSNI]),
|
||||
current_time);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -73,8 +73,8 @@ usteer_measurement_report_get(struct sta *sta, struct usteer_node *node, bool cr
|
||||
}
|
||||
|
||||
struct usteer_measurement_report *
|
||||
usteer_measurement_report_add_beacon_report(struct sta *sta, struct usteer_node *node,
|
||||
struct usteer_beacon_report *br, uint64_t timestamp)
|
||||
usteer_measurement_report_add(struct sta *sta, struct usteer_node *node,
|
||||
uint8_t rcpi, uint8_t rsni, uint64_t timestamp)
|
||||
{
|
||||
struct usteer_measurement_report *mr = usteer_measurement_report_get(sta, node, true);
|
||||
|
||||
@@ -82,7 +82,8 @@ usteer_measurement_report_add_beacon_report(struct sta *sta, struct usteer_node
|
||||
return NULL;
|
||||
|
||||
mr->timestamp = timestamp;
|
||||
memcpy(&mr->beacon_report, br, sizeof(*br));
|
||||
mr->rsni = rsni;
|
||||
mr->rcpi = rcpi;
|
||||
|
||||
return mr;
|
||||
}
|
||||
|
4
ubus.c
4
ubus.c
@@ -446,8 +446,8 @@ usteer_ubus_get_connected_clients(struct ubus_context *ctx, struct ubus_object *
|
||||
list_for_each_entry(mr, &si->sta->measurements, sta_list) {
|
||||
t = blobmsg_open_table(&b, "");
|
||||
blobmsg_add_string(&b, "node", usteer_node_name(mr->node));
|
||||
blobmsg_add_u32(&b, "rcpi", mr->beacon_report.rcpi);
|
||||
blobmsg_add_u32(&b, "rsni", mr->beacon_report.rsni);
|
||||
blobmsg_add_u32(&b, "rcpi", mr->rcpi);
|
||||
blobmsg_add_u32(&b, "rsni", mr->rsni);
|
||||
blobmsg_add_u64(&b, "timestamp", mr->timestamp);
|
||||
blobmsg_close_table(&b, t);
|
||||
}
|
||||
|
10
usteer.h
10
usteer.h
@@ -281,11 +281,6 @@ struct sta {
|
||||
uint8_t addr[6];
|
||||
};
|
||||
|
||||
struct usteer_beacon_report {
|
||||
uint8_t rcpi;
|
||||
uint8_t rsni;
|
||||
};
|
||||
|
||||
struct usteer_measurement_report {
|
||||
struct usteer_timeout timeout;
|
||||
|
||||
@@ -299,7 +294,8 @@ struct usteer_measurement_report {
|
||||
|
||||
uint64_t timestamp;
|
||||
|
||||
struct usteer_beacon_report beacon_report;
|
||||
uint8_t rcpi;
|
||||
uint8_t rsni;
|
||||
};
|
||||
|
||||
extern struct ubus_context *ubus_ctx;
|
||||
@@ -390,6 +386,6 @@ void usteer_measurement_report_sta_cleanup(struct sta *sta);
|
||||
void usteer_measurement_report_del(struct usteer_measurement_report *mr);
|
||||
|
||||
struct usteer_measurement_report *
|
||||
usteer_measurement_report_add_beacon_report(struct sta *sta, struct usteer_node *node, struct usteer_beacon_report *br, uint64_t timestamp);
|
||||
usteer_measurement_report_add(struct sta *sta, struct usteer_node *node, uint8_t rcpi, uint8_t rsni, uint64_t timestamp);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user