...
 
Commits (2)
......@@ -4,7 +4,7 @@ WiFi Data Elements
====================
TO DO:
- Generating wifi data elements object takes sometime(approx 8s) due to the thread locking mechanism so it affects both singleAP, multiAP scenario and also integration with owsd.
- Need to update the wifi DE object when the remote object has been removed.
- Need to implement "Retrieval of event data".
- Some structures that are hardcoded for now are mentioned below. This is because the
API's to fill in these structures does not exist in the wifimngr yet.
......
......@@ -147,7 +147,7 @@ static int populate_scanres_opclass(const char *ifname, int array_index, struct
scanres_opclass[array_index].opclass = opclass.opclass;
num_channels_scanned = opclass.opchannel.num;
scanres_opclass[array_index].num_channels_scanned = num_channels_scanned;
printf("\n\n .num_channels_scanned: %d\n", num_channels_scanned);
/* Add channel list to opclass */
if (num_channels_scanned) {
int j;
......@@ -584,6 +584,7 @@ void populate_wifi_data_element_model()
return;
}
printf("\n\n587\n");
struct wifi_radio_element wifi_radio_new[num_radios] ;
memset(wifi_radio_new, 0, num_radios * sizeof(struct wifi_radio_element));
......@@ -672,7 +673,7 @@ void populate_wifi_data_element_model()
populate_wifi_scanres_element(wifs[j], j);
}
printf("\n\n676\n");
wifi_radio_new[i].num_supp_opclass = numSuppClass;
int num_supp_opclass = wifi_radio_new[i].num_supp_opclass;
......@@ -724,6 +725,8 @@ void populate_wifi_data_element_model()
}
}
}
printf("\n\n729\n");
/*
* Copy the data of wifi_radio to global wifi_radio array.
* Check whether the pointer in wifi_radio structure has memory.
......@@ -750,38 +753,52 @@ void populate_wifi_data_element_model()
free(wifi_radio[i].bsslist);
}
printf("\n\n756\n");
int k, l, m, n;
if (NULL != wifi_radio[i].scanlist) {
printf("wifi_radio[i].num_scanresult: %d\n", wifi_radio[i].num_scanresult);
for (j = 0; j < wifi_radio[i].num_scanresult; j++) {
if (NULL != wifi_radio[i].scanlist[j].opclass_scanlist){
printf("wifi_radio[i].scanlist[j].num_opclass_scanned: %d\n", wifi_radio[i].scanlist[j].num_opclass_scanned);
for (k = 0; k < wifi_radio[i].scanlist[j].num_opclass_scanned; k++) {
if (NULL != wifi_radio[i].scanlist[j].opclass_scanlist[k].channel_scanlist){
printf("wifi_radio[i].scanlist[j].opclass_scanlist[k].num_channels_scanned: %d\n", wifi_radio[i].scanlist[j].opclass_scanlist[k].num_channels_scanned);
for (l = 0; l < wifi_radio[i].scanlist[j].opclass_scanlist[k].num_channels_scanned; l++) {
if (NULL != wifi_radio[i].scanlist[j].opclass_scanlist[k].channel_scanlist[l].nbrlist)
printf("770\n");
free(wifi_radio[i].scanlist[j].opclass_scanlist[k].channel_scanlist[l].nbrlist);
printf("771\n");
}
free(wifi_radio[i].scanlist[j].opclass_scanlist[k].channel_scanlist);
printf("774\n");
}
}
printf("776\n");
free(wifi_radio[i].scanlist[j].opclass_scanlist);
}
}
printf("779\n");
free(wifi_radio[i].scanlist);
}
printf("\n\n782\n");
if (NULL != wifi_radio[i].unassoc_stalist) {
syslog(LOG_ERR,"freeing unassoc stalist");
free(wifi_radio[i].unassoc_stalist);
}
printf("\n\n783\n");
}
pthread_mutex_lock(&wfa_delm_lock);
syslog(LOG_INFO, "Locking in place in order to copy wifi data elements values\n");
printf("\n\n782\n");
memset(wifi_radio, 0, MAX_CLIENT * sizeof(struct wifi_radio_element));
memcpy(&wifi_radio, &wifi_radio_new, sizeof(wifi_radio_new));
pthread_mutex_unlock(&wfa_delm_lock);
printf("\n\n786\n");
/* TODO : Hardcoded to one network device. */
/* Populate wifi network device struct. */
/* TODO: Hardcoded value used..*/
......@@ -804,6 +821,7 @@ void populate_wifi_data_element_model()
}
strncpy(network.id, "Test-ID", 16);
network.num_devices = cinfo.num_clients;
printf("\n\n cinfo.num_clients : %d\n", cinfo.num_clients);
/* TODO: cntlr_id To be added for mutliple AP not included in single AP profile. */
/* Populate wifi data element structure. */
......@@ -1218,6 +1236,7 @@ static int add_wifi_network_device(struct blob_buf *buf)
if (cinfo.num_clients) {
printf("\n\n cinfo.num_clients : %d\n", cinfo.num_clients);
for (i = 0; i < cinfo.num_clients; i++) {
void *x = blobmsg_open_table(buf, "");
......
......@@ -96,7 +96,7 @@ static void wifi_dataelements(struct ubus_context *ctx, struct ubus_object_data
static void get_remote_data_elements() {
cinfo.num_clients = 0;
ubus_lookup(ctx, NULL, wifi_dataelements, NULL);
//ubus_lookup(ctx, NULL, wifi_dataelements, NULL);
}
......