mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
T#8240: show DE Disassoc and Assoc event in reverse order
This commit is contained in:
parent
1392c92db1
commit
eb4e1c4cf7
3 changed files with 14 additions and 2 deletions
|
|
@ -1045,7 +1045,7 @@ static int browseWiFiDataElementsAssociationEventAssociationEventDataInst(struct
|
|||
int id = 0, i = 0;
|
||||
|
||||
dmubus_call("wifi.dataelements.collector", "event", UBUS_ARGS{0}, 0, &res);
|
||||
dmjson_foreach_obj_in_array(res, notify_arr, notify_obj, i, 1, "notification") {
|
||||
dmjson_foreach_obj_in_array_reverse(res, notify_arr, notify_obj, i, 1, "notification") {
|
||||
curr_wifi_event_args.event_time = dmjson_get_value(notify_obj, 1, "eventTime");
|
||||
if (json_object_object_get_ex(notify_obj, "wfa-dataelements:AssociationEvent", &assoc_ev)) {
|
||||
if (json_object_object_get_ex(assoc_ev, "AssocData", &assoc_obj)) {
|
||||
|
|
@ -1067,7 +1067,7 @@ static int browseWiFiDataElementsDisassociationEventDisassociationEventDataInst(
|
|||
int id = 0, i = 0;
|
||||
|
||||
dmubus_call("wifi.dataelements.collector", "event", UBUS_ARGS{0}, 0, &res);
|
||||
dmjson_foreach_obj_in_array(res, notify_arr, notify_obj, i, 1, "notification") {
|
||||
dmjson_foreach_obj_in_array_reverse(res, notify_arr, notify_obj, i, 1, "notification") {
|
||||
curr_wifi_event_args.event_time = dmjson_get_value(notify_obj, 1, "eventTime");
|
||||
if (json_object_object_get_ex(notify_obj, "wfa-dataelements:DisassociationEvent", &disassoc_ev)) {
|
||||
if (json_object_object_get_ex(disassoc_ev, "DisassocData", &disassoc_obj)) {
|
||||
|
|
|
|||
|
|
@ -116,6 +116,9 @@ json_object *__dmjson_select_obj_in_array_idx(json_object *mainjobj, json_object
|
|||
if (mainjobj == NULL)
|
||||
return NULL;
|
||||
|
||||
if (index < 0)
|
||||
return NULL;
|
||||
|
||||
va_start(arg, argc);
|
||||
for (i = 0; i < argc; i++) {
|
||||
argv[i] = va_arg(arg, char *);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,15 @@ char *__dmjson_get_value_array_all(json_object *mainjobj, char *delim, int argc,
|
|||
OBJ; \
|
||||
OBJ = __dmjson_select_obj_in_array_idx(MAINJOBJ, &(ARROBJ), ++INDEX, 0))
|
||||
|
||||
#define dmjson_foreach_obj_in_array_reverse(MAINJOBJ,ARROBJ,OBJ,INDEX,ARGC,args...) \
|
||||
json_object *ARR_OBJ = __dmjson_get_obj(MAINJOBJ, ARGC, ##args); \
|
||||
if (!ARR_OBJ || json_object_get_type(ARR_OBJ) != json_type_array) \
|
||||
return 0; \
|
||||
int IDX = json_object_array_length(ARR_OBJ) - 1; \
|
||||
for (INDEX = IDX, ARROBJ = NULL, OBJ = __dmjson_select_obj_in_array_idx(MAINJOBJ, &(ARROBJ), INDEX, ARGC, ##args);\
|
||||
OBJ; \
|
||||
OBJ = __dmjson_select_obj_in_array_idx(MAINJOBJ, &(ARROBJ), --INDEX, 0))
|
||||
|
||||
#define dmjson_foreach_value_in_array(MAINJOBJ,ARROBJ,VAL,INDEX,ARGC,args...) \
|
||||
for (INDEX = 0, ARROBJ = NULL, VAL = __dmjson_get_value_in_array_idx(MAINJOBJ, &(ARROBJ), NULL, INDEX, ARGC, ##args);\
|
||||
VAL; \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue