RDK Documentation (Open Sourced RDK Components)
wifiSrvMgr.cpp
1 /*
2 
3  * If not stated otherwise in this file or this component's Licenses.txt file the
4  * following copyright and licenses apply:
5  *
6  * Copyright 2016 RDK Management
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19 */
20 
21 #include "wifiSrvMgr.h"
22 #include "NetworkMgrMain.h"
23 #include "wifiSrvMgrIarmIf.h"
24 #include "NetworkMedium.h"
25 #include "wifiHalUtiles.h"
26 #include "netsrvmgrUtiles.h"
27 
28 #ifdef USE_HOSTIF_WIFI_HAL
29 #ifdef ENABLE_IARM
30 #include "hostIf_tr69ReqHandler.h"
31 #endif
32 #endif
33 
34 #ifndef ENABLE_XCAM_SUPPORT
35 // added for create_wpa_supplicant_conf_from_netapp_db
36 #include <string.h>
37 #include <unistd.h>
38 #include "sqlite3.h"
39 #include "cJSON.h"
40 #include <stdio.h>
41 #endif // ENABLE_XCAM_SUPPORT
42 
43 #define SAVE_SSID 1
44 #define DELAY_LNF_TIMER_COUNT 5 //Each time wait will be 60 seconds
45 #ifdef SAFEC_RDKV
46 #include "safec_lib.h"
47 #else
48 #define STRCPY_S(dest,size,source) \
49  strcpy(dest, source);
50 #endif
51 
52 #ifdef USE_RDK_WIFI_HAL
53 #ifdef ENABLE_IARM
54 static void _irEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);
55 #endif
56 #endif /* USE_RDK_WIFI_HAL */
57 
58 #ifdef ENABLE_LOST_FOUND
59 extern bool bDeviceActivated;
60 extern WiFiLNFStatusCode_t gWifiLNFStatus;
61 #ifdef ENABLE_IARM
62 static void _eventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len);
63 #endif
64 extern bool bStopLNFWhileDisconnected;
65 extern bool bIsStopLNFWhileDisconnected;
66 extern bool bAutoSwitchToPrivateEnabled;
67 extern bool bSwitch2Private;
68 #endif
69 extern WiFiStatusCode_t getWpaStatus();
70 extern void getWpaSsid(WiFiConnectionStatus *curSSIDConnInfo);
71 bool bStopProgressiveScanning;
72 ssidList gSsidList;
73 extern netMgrConfigProps confProp;
74 WiFiConnectionStatus savedWiFiConnList;
75 char gWifiMacAddress[MAC_ADDR_BUFF_LEN] = {'\0'};
76 
77 #ifdef ENABLE_IARM
78 IARM_Bus_Daemon_SysMode_t sysModeParam;
79 #endif
80 
81 #ifdef ENABLE_RTMESSAGE
82 #include <pthread.h>
83 pthread_t wifiMsgThread;
84 #endif
85 
86 WiFiNetworkMgr* WiFiNetworkMgr::instance = NULL;
87 bool WiFiNetworkMgr::instanceIsReady = false;
88 pthread_mutex_t wpsConnLock = PTHREAD_MUTEX_INITIALIZER;
89 pthread_mutex_t wifiScanLock = PTHREAD_MUTEX_INITIALIZER;
90 
91 #ifdef USE_TELEMETRY_2_0
92 wifi_telemetry_ops_t wifi_telemetry_ops;
93 #endif // #ifdef USE_TELEMETRY_2_0
94 
95 WiFiNetworkMgr::WiFiNetworkMgr() {}
96 WiFiNetworkMgr::~WiFiNetworkMgr() { }
97 
98 WiFiNetworkMgr* WiFiNetworkMgr::getInstance()
99 {
100  if (instance == NULL)
101  {
102  instance = new WiFiNetworkMgr();
103  instanceIsReady = true;
104  }
105  return instance;
106 }
107 
108 #ifndef ENABLE_XCAM_SUPPORT
109 /**
110  * 1. Extract "SSID", "BSSID", "Password", "Security" from specified netapp_db_file.
111  * 2. Write into specified wpa_supplicant_conf_file in following format:
112  * network={
113  * ssid="<SSID>"
114  * scan_ssid=1
115  * bssid=<BSSID>
116  * psk="<Password"
117  * key_mgmt=<Security>
118  * auth_alg=OPEN
119  * }
120  * example:
121  * network={
122  * ssid="tukken-axb3-5GHz"
123  * scan_ssid=1
124  * bssid=5C:B0:66:00:4D:10
125  * psk="Comcast2015"
126  * key_mgmt=Wpa2PskAes
127  * auth_alg=OPEN
128  * }
129  */
130 int WiFiNetworkMgr::create_wpa_supplicant_conf_from_netapp_db (const char* wpa_supplicant_conf_file, const char* netapp_db_file)
131 {
132  int ret = 1;
133  sqlite3 *db = NULL;
134 
135  if (-1 != access (wpa_supplicant_conf_file, F_OK))
136  {
137  LOG_ERR("wpa_supplicant_conf_file [%s] already exists. Will not overwrite.",
138  wpa_supplicant_conf_file);
139  }
140  else if (SQLITE_OK != sqlite3_open_v2 (netapp_db_file, &db, SQLITE_OPEN_READONLY, NULL))
141  {
142  LOG_ERR("Failed to open netapp_db_file [%s]. Error = [%s]",
143  netapp_db_file, sqlite3_errmsg(db));
144  }
145  else
146  {
147  char zSql[256];
148  sprintf (zSql, "SELECT value FROM EAV where entity = 'NETAPP_DB_IFACE_WIRELESS' and attribute = 'NETAPP_DB_A_CURRENT_APINFO'");
149  LOG_INFO("NetApp DB query = [%s]", zSql);
150 
151  sqlite3_stmt *res = NULL;
152  char *value = NULL;
153  cJSON *root_json = NULL;
154  FILE *f = NULL;
155 
156  if (SQLITE_OK != sqlite3_prepare_v2 (db, zSql, -1, &res, 0))
157  {
158  LOG_ERR("NetApp DB query prepare statement error = [%s]", sqlite3_errmsg(db));
159  }
160  else if (SQLITE_ROW != sqlite3_step (res))
161  {
162  LOG_ERR("NetApp DB query returned no rows.");
163  }
164  else if (NULL == (value = (char *) sqlite3_column_text (res, 0)))
165  {
166  LOG_ERR("NetApp DB query returned NULL value.");
167  }
168  else if (NULL == (root_json = cJSON_Parse (value)))
169  {
170  LOG_ERR("NetApp DB query returned non-JSON value = [%s]. Error = [%s]",
171  value, cJSON_GetErrorPtr());
172  }
173  else if (NULL == (f = fopen (wpa_supplicant_conf_file, "w")))
174  {
175  LOG_ERR("Error opening wpa_supplicant_conf_file [%s] for write",wpa_supplicant_conf_file);
176  }
177  else
178  {
179  LOG_TRACE("NetApp DB query returned value = [%s]",value);
180 
181  cJSON *json = NULL;
182  const char *ssid = (json = cJSON_GetObjectItem (root_json, "SSID")) ? json->valuestring : "";
183  const char *bssid = (json = cJSON_GetObjectItem (root_json, "BSSID")) ? json->valuestring : "";
184  const char *password = (json = cJSON_GetObjectItem (root_json, "Password")) ? json->valuestring : "";
185  const char *security = (json = cJSON_GetObjectItem (root_json, "Security")) ? json->valuestring : "";
186 
187  LOG_TRACE("NetApp DB parameters: ssid = [%s], bssid = [%s], password = [%s], security = [%s]",
188  ssid, bssid, password, security);
189 
190  if (!*ssid) LOG_ERR("TELEMETRY_WIFI_CONF_FROM_DB_SSID_EMPTY");
191  if (!*bssid) LOG_ERR("TELEMETRY_WIFI_CONF_FROM_DB_BSSID_EMPTY");
192  if (!*password) LOG_ERR("TELEMETRY_WIFI_CONF_FROM_DB_PASSWORD_EMPTY");
193  if (!*security) LOG_ERR("TELEMETRY_WIFI_CONF_FROM_DB_MODE_EMPTY");
194 
195  const char *security_mode_map[][2] = {
196  {"Open", "NONE"},
197  {"Wep", "NONE"},
198  {"WpaPskAes", "WPA-PSK"},
199  {"WpaPskTkip", "WPA-PSK"},
200  {"Wpa2PskAes", "WPA-PSK"},
201  {"Wpa2PskTkip", "WPA-PSK"},
202  {"WpaEnterprise", "WPA-EAP"},
203  {"Wpa2Enterprise", "WPA-EAP"},
204  {"SAE", "SAE"},
205  };
206 
207  const char *wpa_security_mode = ""; // default to empty string
208  int n = sizeof (security_mode_map) / sizeof (security_mode_map[0]);
209  int i = 0;
210  for (; i < n; i++)
211  {
212  if (0 == strcasecmp (security, security_mode_map[i][0]))
213  {
214  wpa_security_mode = security_mode_map[i][1];
215  break;
216  }
217  }
218  if (i == n) // security mode mapping not found
219  {
220  LOG_ERR("TELEMETRY_WIFI_CONF_FROM_DB_MODE_UNMAPPABLE");
221  }
222 
223  fprintf (f, "ctrl_interface=/var/run/wpa_supplicant\n");
224  fprintf (f, "update_config=1\n");
225  fprintf (f, "\n");
226  fprintf (f, "network={\n");
227  fprintf (f, " ssid=\"%s\"\n", ssid);
228  fprintf (f, " scan_ssid=1\n");
229  fprintf (f, " bssid=%s\n", bssid);
230  fprintf (f, " psk=\"%s\"\n", password);
231  fprintf (f, " key_mgmt=%s\n", wpa_security_mode);
232  fprintf (f, " auth_alg=OPEN\n");
233  fprintf (f, " }\n");
234 
235  fclose(f);
236 
237  ret = 0;
238 
239  LOG_INFO("Successfully created wpa_supplicant_conf_file [%s].", wpa_supplicant_conf_file);
240  LOG_INFO("TELEMETRY_WIFI_CREATED_CONF_FROM_DB");
241  }
242 
243  if (root_json)
244  {
245  cJSON_Delete (root_json);
246  }
247 
248  if (res)
249  {
250  sqlite3_finalize (res);
251  }
252  }
253 
254  if (db)
255  {
256  sqlite3_close (db);
257  }
258 
259  remove(netapp_db_file);
260 
261  return ret;
262 }
263 #endif // #ifndef ENABLE_XCAM_SUPPORT
264 
265 int WiFiNetworkMgr::removeWifiCredsFromNonSecuredPartition(void)
266 {
267  const char *wpaSupplicantConfFile = "/opt/wifi/wpa_supplicant.conf";
268  const char *wifiRoamingFile = "/opt/wifi/wifi_roamingControl.json";
269  int retValue = 0;
270 
271  if(!access(wpaSupplicantConfFile, F_OK))
272  {
273  if((retValue = remove(wpaSupplicantConfFile)) == -1)
274  {
275  LOG_ERR("Failed to remove wpa_supplicant.conf [%s]", wpaSupplicantConfFile);
276  }
277  }
278 
279  if(!access(wifiRoamingFile, F_OK))
280  {
281  if((retValue = remove(wifiRoamingFile)) == -1)
282  {
283  LOG_ERR("Failed to remove wifi_roamingControl.json [%s]",
284  wifiRoamingFile);
285  }
286  }
287 
288  return retValue;
289 }
290 
291 int WiFiNetworkMgr::Init()
292 {
293  LOG_ENTRY_EXIT;
294 
295 #ifdef ENABLE_IARM
315 #ifdef WIFI_CLIENT_ROAMING
316  IARM_Bus_RegisterCall(IARM_BUS_WIFI_MGR_API_getRoamingCtrls, getRoamingCtrls);
317  IARM_Bus_RegisterCall(IARM_BUS_WIFI_MGR_API_setRoamingCtrls, setRoamingCtrls);
318 #endif
319 #ifdef ENABLE_LOST_FOUND
321  IARM_Bus_RegisterEventHandler(IARM_BUS_AUTHSERVICE_NAME, IARM_BUS_AUTHSERVICE_EVENT_SWITCH_TO_PRIVATE, _eventHandler);
322  IARM_Bus_RegisterEventHandler(IARM_BUS_NM_SRV_MGR_NAME, IARM_BUS_NETWORK_MANAGER_EVENT_SWITCH_TO_PRIVATE, _eventHandler);
323  IARM_Bus_RegisterEventHandler(IARM_BUS_NM_SRV_MGR_NAME, IARM_BUS_NETWORK_MANAGER_EVENT_STOP_LNF_WHILE_DISCONNECTED, _eventHandler);
324  IARM_Bus_RegisterEventHandler(IARM_BUS_NM_SRV_MGR_NAME, IARM_BUS_NETWORK_MANAGER_EVENT_AUTO_SWITCH_TO_PRIVATE_ENABLED, _eventHandler);
328 #endif
329  /* Diagnostic Api's*/
334  IARM_Bus_RegisterCall(IARM_BUS_COMMON_API_SysModeChange,sysModeChange);
336 #ifdef USE_RDK_WIFI_HAL
337  /* Front Panel Event Listner */
339 #endif
340  /* Notification RPC:*/
342 #endif // #ifdef ENABLE_IARM
343 
344  memset(&gSsidList, '\0', sizeof(ssidList));
345  /*Check for WiFi Capability */
346  isWiFiCapable();
347 
348  /*Get WiFi interface Mac*/
349  {
350  // get wifi mac address
351  char *ifName = getenv("WIFI_INTERFACE");
352  LOG_INFO("The interface use is '%s'", ifName);
353  if (netSrvMgrUtiles::getMacAddress_IfName(ifName, gWifiMacAddress)) {
354  LOG_INFO("The '%s' Mac Addr :%s", ifName, gWifiMacAddress);
355  }
356  else {
357  LOG_WARN("Failed to get wifi mac address.");
358  }
359  }
360 
361 #ifndef ENABLE_XCAM_SUPPORT
362  create_wpa_supplicant_conf_from_netapp_db ("/opt/secure/wifi/wpa_supplicant.conf", "/opt/secure/wifi/NetApp.db");
363 #endif // ENABLE_XCAM_SUPPORT
364 
365  /* Remove the WiFi credentials from the non-secured partition */
366  removeWifiCredsFromNonSecuredPartition();
367 
368 #ifdef USE_TELEMETRY_2_0
369  wifi_telemetry_ops.init = telemetry_init;
370  wifi_telemetry_ops.event_s = telemetry_event_s;
371  wifi_telemetry_ops.event_d = telemetry_event_d;
372  wifi_telemetry_callback_register (&wifi_telemetry_ops);
373  telemetry_init("wifihal");
374 #endif // #ifdef USE_TELEMETRY_2_0
375 
376  return 0;
377 }
378 
379 #ifdef USE_RDK_WIFI_HAL
380 bool WiFiNetworkMgr::setWifiEnabled (bool newState)
381 {
382  static bool bWiFiEnabled = false; // TODO: assumes WiFi is disabled when netsrvmgr starts. correct assumption?
383 
384  LOG_ENTRY_EXIT;
385 
386  LOG_INFO("WiFi state: current [%d] requested [%d]", bWiFiEnabled, newState);
387 
388  if (!bWiFiEnabled == !newState)
389  {
390  LOG_INFO("Already in requested state. Nothing to do.");
391  return true;
392  }
393 
394  bWiFiEnabled = newState; // change WiFi state
395  if (bWiFiEnabled)
396  {
397  WiFiNetworkMgr::getInstance()->Start();
398  LOG_INFO("TELEMETRY_NETWORK_MANAGER_ENABLE_WIFI.");
399  }
400  else
401  {
402  WiFiNetworkMgr::getInstance()->Stop();
403  LOG_INFO("TELEMETRY_NETWORK_MANAGER_DISABLE_WIFI.");
404  }
405  return true;
406 }
407 #endif // USE_RDK_WIFI_HAL
408 
409 int WiFiNetworkMgr::Start()
410 {
411  LOG_ENTRY_EXIT;
412 
413  bool retVal=false;
414 
415 #ifdef ENABLE_RTMESSAGE
416  rtConnection_init();
417 #if defined(XHB1) || defined(XHC3)
418  if( 0 != pthread_create(&wifiMsgThread, NULL, &rtMessage_Receive, NULL))
419  {
420  LOG_ERR("Can't create thread.");
421  }
422  else
423  LOG_INFO("Thread created successfully and waiting for message.");
424 #endif
425 #endif
426 
427 #ifdef USE_RDK_WIFI_HAL
428  monitor_WiFiStatus();
429 
430  if(wifi_init() == RETURN_OK) {
431  LOG_INFO("[%s] Successfully wifi_init() done", MODULE_NAME);
432  } else {
433  LOG_ERR("[%s] Failed in wifi_init(). ", MODULE_NAME);
434  }
435 
436  getHALVersion();
437  /*Register connect and disconnect call back */
438  wifi_connectEndpoint_callback_register(wifi_connect_callback);
439  wifi_disconnectEndpoint_callback_register(wifi_disconnect_callback);
440 #endif
441 
442 #if !defined(ENABLE_XCAM_SUPPORT) && !defined(XHB1) && !defined(XHC3)
443  WiFiConnectionStatus tmpWiFiConnList;
444  memset(&tmpWiFiConnList, '\0', sizeof(tmpWiFiConnList));
445 #ifdef USE_RDK_WIFI_HAL
446  retVal = lastConnectedSSID(&tmpWiFiConnList);
447 #endif
448  if(false == retVal) {
449 #ifdef ENABLE_IARM
450  retVal = connectToMfrWifiCredentials();
451  if(true == retVal) {
452  LOG_INFO("[%s] Successfully connected to the SSID in the MFR", MODULE_NAME);
453  }
454  else {
455  LOG_INFO("[%s] Failed to connect to the SSID in the MFR", MODULE_NAME);
456  }
457 #endif
458  }
459 #endif // ENABLE_XCAM_SUPPORT
460 
461 #ifdef ENABLE_LOST_FOUND
462  if(confProp.wifiProps.bEnableLostFound)
463  {
464  if(getLAFssid())
465  {
466  lafConnectToPrivate();
467 
468  if(false == isWifiConnected())
469  {
470 #ifdef ENABLE_XCAM_SUPPORT
471  int retry = 0;
472  while (false == isWifiConnected() && retry < DELAY_LNF_TIMER_COUNT)
473  {
474  sleep(60);
475  retry++;
476  }
477  if (false == isWifiConnected())
478  {
479  connectToLAF();
480  }
481 #else
482  connectToLAF();
483 #endif
484  }
485  }
486  else
487  {
488  LOG_ERR("[%s] lfssid fetch failure !!!!!!! ", MODULE_NAME);
489  }
490  }
491 #endif
492 
493  return 0;
494 }
495 
496 int WiFiNetworkMgr::Stop()
497 {
498  LOG_ENTRY_EXIT;
499 
500  wpsConnLock = PTHREAD_MUTEX_INITIALIZER;
501  shutdownWifi();
502  #ifdef ENABLE_RTMESSAGE
503  #if defined(XHB1) || defined(XHC3)
504  pthread_kill(wifiMsgThread, 0);
505  #endif
506  rtConnection_destroy();
507  #endif
508  return 0;
509  }
510 
511 #ifdef ENABLE_IARM
512 IARM_Result_t WiFiNetworkMgr::getAvailableSSIDsWithName(void *arg)
513 {
514  IARM_Result_t ret = IARM_RESULT_IPCCORE_FAIL;
515  bool status = true;
516  char SSID[64] = {'\0'};
517  double frequency;
518  LOG_TRACE("[%s] Enter", MODULE_NAME);
519 
521 
522  char jbuff[MAX_SSIDLIST_BUF] = {'\0'};
523  int jBuffLen = 0;
524 
525 #ifdef USE_RDK_WIFI_HAL
526  if(param != NULL && param->SSID != NULL)
527  strncpy(SSID,param->SSID,63);
528  if(param != NULL)
529  frequency = param->frequency;
530  status = scan_SpecificSSID_WifiAP(jbuff,(const char*)SSID,frequency);
531  jBuffLen = strlen(jbuff);
532  LOG_DBG("[%s] Scan AP's SSID list buffer size : \"%d\"", MODULE_NAME, jBuffLen);
533 #endif
534  if(status == false)
535  {
536  param->status = false;
537  LOG_ERR("[%s] No SSID available.", MODULE_NAME);
538  return ret;
539  }
540  LOG_DBG("[%s] json Message length : [%d].", MODULE_NAME, jBuffLen);
541 
542  if(jBuffLen)
543  {
544  strncpy(param->curSsids.jdata, jbuff, sizeof(param->curSsids.jdata));
545  param->curSsids.jdataLen = jBuffLen;
546  param->status = true;
547  ret = IARM_RESULT_SUCCESS;
548  }
549  else
550  {
551  param->status = false;
552  }
553  LOG_TRACE("[%s] Exit", MODULE_NAME);
554  return ret;
555 }
556 
557 IARM_Result_t WiFiNetworkMgr::getAvailableSSIDs(void *arg)
558 {
559  IARM_Result_t ret = IARM_RESULT_IPCCORE_FAIL;
560  bool status = true;
561  LOG_TRACE("[%s] Enter", MODULE_NAME);
562 
564 
565  char jbuff[MAX_SSIDLIST_BUF] = {'\0'};
566  int jBuffLen = 0;
567 
568 #ifdef USE_RDK_WIFI_HAL
569  status = scan_Neighboring_WifiAP(jbuff);
570  jBuffLen = strlen(jbuff);
571  LOG_DBG("[%s] Scan AP's SSID list buffer size : \n\"%d\"", MODULE_NAME, jBuffLen);
572 #endif
573  if(status == false)
574  {
575  param->status = false;
576  LOG_ERR("[%s] No SSID connected or SSID available.", MODULE_NAME);
577  return ret;
578  }
579 
580 
581  LOG_DBG("[%s] json Message length : [%d].", MODULE_NAME, jBuffLen);
582 
583  if(jBuffLen) {
584  strncpy(param->curSsids.jdata, jbuff, sizeof(param->curSsids.jdata));
585  param->curSsids.jdataLen = jBuffLen;
586  param->status = true;
587  ret = IARM_RESULT_SUCCESS;
588  }
589  else {
590  param->status = false;
591  }
592 
593 // LOG_DBG("[%s] SSID List : [%s].", MODULE_NAME, param->curSsids.jdata);
594 
595  LOG_TRACE("[%s] Exit", MODULE_NAME);
596  return ret;
597 }
598 
599 void *getAvailableSSIDsThread(void* arg)
600 {
601  LOG_TRACE("[%s] Enter", MODULE_NAME);
602 
604 
605  IARM_Result_t ret = WiFiNetworkMgr::getAvailableSSIDs(&param);
606 
607  if(ret == IARM_RESULT_SUCCESS)
608  {
609  LOG_DBG("[%s] SSID List : [%s]", MODULE_NAME, param.curSsids.jdata);
610 
611 
613 
614  strncpy( eventData.data.wifiSSIDList.ssid_list, param.curSsids.jdata, MAX_SSIDLIST_BUF );
615  eventData.data.wifiSSIDList.ssid_list[MAX_SSIDLIST_BUF-1] = 0;
616 
617  IARM_Bus_BroadcastEvent(IARM_BUS_NM_SRV_MGR_NAME,
618  IARM_BUS_WIFI_MGR_EVENT_onAvailableSSIDs,
619  (void *)&eventData, sizeof(eventData));
620  }
621  else
622  LOG_ERR("[%s] Failed to get Available SSID", MODULE_NAME);
623 
624  LOG_TRACE("[%s] Exit", MODULE_NAME);
625  return NULL;
626 }
627 
628 IARM_Result_t WiFiNetworkMgr::getAvailableSSIDsAsync(void *arg)
629 {
630  LOG_TRACE("[%s] Enter", MODULE_NAME);
631 
632  pthread_t getAvailableSSIDsPThread;
633  pthread_attr_t attr;
634  int rc;
635  pthread_attr_init(&attr);
636  pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
637  rc = pthread_create(&getAvailableSSIDsPThread, &attr, getAvailableSSIDsThread, NULL);
638  if (rc) {
639  LOG_ERR("Thread creation failed with rc = %d", rc);
640  }
641  LOG_TRACE("[%s] Exit", MODULE_NAME);
642  return IARM_RESULT_SUCCESS;
643 }
644 /**
645  * @brief Get Current time
646  *
647  * @param[in] Time spec timer
648  */
649 void getCurrentTime(struct timespec *timer)
650 {
651  clock_gettime(CLOCK_REALTIME, timer);
652 }
653 
654 void getTimeValDiff(struct timespec *start, struct timespec *stop,
655  struct timespec *timeDiff)
656 {
657  if ((stop->tv_nsec - start->tv_nsec) < 0) {
658  timeDiff->tv_sec = stop->tv_sec - start->tv_sec - 1;
659  timeDiff->tv_nsec = stop->tv_nsec - start->tv_nsec + 1000000000;
660  } else {
661  timeDiff->tv_sec = stop->tv_sec - start->tv_sec;
662  timeDiff->tv_nsec = stop->tv_nsec - start->tv_nsec;
663  }
664  return;
665 }
666 static IARM_Result_t scanAndBroadcastResults(bool moreData)
667 {
669  IARM_Result_t ret = WiFiNetworkMgr::getAvailableSSIDs(&param);
670  if(ret == IARM_RESULT_SUCCESS)
671  {
672  LOG_DBG("[%s] SSID List : [%s]", MODULE_NAME, param.curSsids.jdata);
674 
675  strncpy( eventData.data.wifiSSIDList.ssid_list, param.curSsids.jdata, MAX_SSIDLIST_BUF );
676  eventData.data.wifiSSIDList.ssid_list[MAX_SSIDLIST_BUF-1] = 0;
677  eventData.data.wifiSSIDList.more_data = moreData;
678 
679  IARM_Bus_BroadcastEvent(IARM_BUS_NM_SRV_MGR_NAME,
680  IARM_BUS_WIFI_MGR_EVENT_onAvailableSSIDsIncr,
681  (void *)&eventData, sizeof(eventData));
682  }
683  else
684  LOG_ERR("[%s] Failed to broadcast SSID list", MODULE_NAME);
685  return ret;
686 }
687 
688 void *getAvailableSSIDsIncrThread(void* arg)
689 {
690  LOG_TRACE("[%s] Enter", MODULE_NAME );
691  int radioIndex = 0;
692  bool more_data = true;
693  struct timespec start, end,timeDiff;
694  bStopProgressiveScanning = false;
695  const char* freq_list = "5785 5180 5220 5240 5805 5745 5200 5500 5825";
696 
697  // Scan for High priority 5GHz channels
698  LOG_INFO("Starting scan for 5GHz preferred channels...");
699  getCurrentTime(&start);
700  wifi_setRadioScanningFreqList(radioIndex, freq_list);
701  IARM_Result_t ret = scanAndBroadcastResults(more_data);
702  if(ret == IARM_RESULT_SUCCESS)
703  {
704  getCurrentTime(&end);
705  getTimeValDiff(&start,&end,&timeDiff);
706  LOG_INFO("Successfully broadcasted scan results of 5GHz preferred channels in %ld.%09ld seconds.",(long)timeDiff.tv_sec,timeDiff.tv_nsec);
707  }
708  else
709  {
710  LOG_ERR("Failed to broadcast 5GHz preferred scan results");
711  }
712  pthread_mutex_lock(&wifiScanLock);
713  if(bStopProgressiveScanning == true)
714  {
715  LOG_INFO("Progressive scanning stopped, Skipping further scanning...");
716  pthread_mutex_unlock(&wifiScanLock);
717  goto exit_scan;
718  }
719  pthread_mutex_unlock(&wifiScanLock);
720 
721  // Scan for 2.4GHz channels based on the dual-band capability
722  if(wifi_getDualBandSupport() == true)
723  {
724  LOG_INFO("Starting scan for 2.4GHz channels...");
725  getCurrentTime(&start);
726  freq_list = "2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462";
727  wifi_setRadioScanningFreqList(radioIndex, freq_list);
728  ret = scanAndBroadcastResults(more_data);
729  if(ret == IARM_RESULT_SUCCESS)
730  {
731  getCurrentTime(&end);
732  getTimeValDiff(&start,&end,&timeDiff);
733  LOG_INFO("Successfully broadcasted scan results of 2.4GHz channels in %ld.%09ld seconds.",(long)timeDiff.tv_sec,timeDiff.tv_nsec);
734  }
735  else
736  {
737  LOG_ERR("Failed to broadcast 2.4GHz scan results");
738  }
739  }
740 
741  pthread_mutex_lock(&wifiScanLock);
742  if(bStopProgressiveScanning == true)
743  {
744  LOG_INFO("Progressive scanning stopped, Skipping further scanning..");
745  pthread_mutex_unlock(&wifiScanLock);
746  goto exit_scan;
747  }
748  pthread_mutex_unlock(&wifiScanLock);
749 
750  // Scan for Low priority 5GHz channels
751  LOG_INFO("Starting scan for 5GHz low priority channels...\n");
752  getCurrentTime(&start);
753  freq_list = "5260 5280 5300 5320 5520 5540 5560 5580 5600 5620 5640 5660 5680 5700 5720 5765";
754  wifi_setRadioScanningFreqList(radioIndex, freq_list);
755  more_data = false;
756  ret = scanAndBroadcastResults(more_data);
757  if(ret == IARM_RESULT_SUCCESS)
758  {
759  getCurrentTime(&end);
760  getTimeValDiff(&start,&end,&timeDiff);
761  LOG_INFO("Successfully broadcasted scan results of 5GHz Non-preferred channels in %ld.%09ld seconds.",(long)timeDiff.tv_sec,timeDiff.tv_nsec);
762  }
763  else
764  {
765  LOG_ERR("Failed to broadcast 5GHz Non-preferred scan results");
766  }
767 
768 exit_scan:
769  // reset all scan frequency selection
770  wifi_setRadioScanningFreqList(radioIndex, (const char*)"0");
771  return NULL;
772 }
773 
774 IARM_Result_t WiFiNetworkMgr::stopProgressiveWifiScanning(void *arg)
775 {
776  IARM_Result_t ret = IARM_RESULT_SUCCESS;
777  pthread_mutex_lock(&wifiScanLock);
778  bStopProgressiveScanning = true;
779  pthread_mutex_unlock(&wifiScanLock);
780  return ret;
781 }
782 
783 IARM_Result_t WiFiNetworkMgr::getAvailableSSIDsAsyncIncr(void *arg)
784 {
785  LOG_TRACE("[%s] Enter", MODULE_NAME );
786 
787  pthread_t getAvailableSSIDsIncrPThread;
788  pthread_attr_t attr;
789  pthread_attr_init(&attr);
790  pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
791  pthread_create(&getAvailableSSIDsIncrPThread, &attr, getAvailableSSIDsIncrThread, NULL);
792 
793  LOG_TRACE("[%s] Exit", MODULE_NAME );
794  return IARM_RESULT_SUCCESS;
795 }
796 
797 IARM_Result_t WiFiNetworkMgr::getCurrentState(void *arg)
798 {
799  LOG_ENTRY_EXIT;
800 
802  param->status = true;
803 
804  bool enabled;
805  if (false == isInterfaceEnabled("WIFI", enabled)) // WIFI interface does not exist
806  param->data.wifiStatus = WIFI_UNINSTALLED;
807  else if (!enabled)
808  param->data.wifiStatus = WIFI_DISABLED;
809  else
810  param->data.wifiStatus = getWpaStatus();
811 
812  return IARM_RESULT_SUCCESS;
813 }
814 
815 IARM_Result_t WiFiNetworkMgr::getCurrentConnectionType(void *arg)
816 {
817  IARM_Result_t ret = IARM_RESULT_SUCCESS;
818  LOG_TRACE("[%s] Enter", MODULE_NAME );
819 
821  param->status = true;
822 
823  //if the ethernet is plugged in then report disabled
824  if( !ethernet_on() )
825  param->data.connectionType = get_WifiConnectionType();
826  else
827  param->data.connectionType = WIFI_CON_UNKNOWN;
828 
829  LOG_TRACE("[%s] Exit", MODULE_NAME );
830  return ret;
831 }
832 
833 #ifdef ENABLE_LOST_FOUND
834 IARM_Result_t WiFiNetworkMgr::isAutoSwitchToPrivateEnabled(void *arg)
835 {
836  IARM_Result_t ret = IARM_RESULT_SUCCESS;
837  LOG_TRACE("[%s] Enter", MODULE_NAME );
838 
839  bool *param = (bool *)arg;
840  *param=bAutoSwitchToPrivateEnabled;
841  LOG_TRACE("[%s] Exit", MODULE_NAME );
842  return ret;
843 }
844 
845 IARM_Result_t WiFiNetworkMgr::getSwitchToPrivateResults(void *arg)
846 {
847  IARM_Result_t ret = IARM_RESULT_IPCCORE_FAIL;
848  bool status = true;
849  LOG_TRACE("[%s] Enter", MODULE_NAME );
850 
852 
853  char jbuff[MAX_SSIDLIST_BUF] = {'\0'};
854  int jBuffLen = 0;
855 
856  status = convertSwitchToPrivateResultsToJson(jbuff);
857  jBuffLen = strlen(jbuff);
858  LOG_DBG("[%s] Switch Private Results list buffer size : \n\"%d\"", MODULE_NAME,jBuffLen);
859  if(status == false)
860  {
861  param->status = false;
862  LOG_ERR("[%s] No Switch private Results.", MODULE_NAME);
863  return ret;
864  }
865 
866 
867  LOG_DBG("[%s] json Message length : [%d].", MODULE_NAME, jBuffLen);
868 
869  if(jBuffLen) {
870  strncpy(param->switchPvtResults.jdata, jbuff, MAX_SSIDLIST_BUF);
871  param->switchPvtResults.jdataLen = jBuffLen;
872  param->status = true;
873  ret = IARM_RESULT_SUCCESS;
874  }
875  else {
876  param->status = false;
877  }
878  LOG_DBG("[%s] json Data : %s", MODULE_NAME,param->switchPvtResults.jdata);
879 
880 // LOG_DBG("[%s] SSID List : [%s].\n", MODULE_NAME, param->curSsids.jdata);
881 
882  LOG_TRACE("[%s] Exit", MODULE_NAME );
883  return ret;
884 }
885 IARM_Result_t WiFiNetworkMgr::isStopLNFWhileDisconnected(void *arg)
886 {
887  IARM_Result_t ret = IARM_RESULT_SUCCESS;
888  LOG_TRACE("[%s] Enter", MODULE_NAME );
889  bool *param = (bool *)arg;
890  *param=bIsStopLNFWhileDisconnected;
891  LOG_TRACE("[%s] Exit", MODULE_NAME );
892  return ret;
893 }
894 IARM_Result_t WiFiNetworkMgr::getLNFState(void *arg)
895 {
896  IARM_Result_t ret = IARM_RESULT_SUCCESS;
897  LOG_TRACE("[%s] Enter", MODULE_NAME );
899  param->status = true;
900  param->data.wifiLNFStatus = get_WiFiLNFStatusCode();
901  LOG_TRACE("[%s] Exit", MODULE_NAME );
902  return ret;
903 }
904 #endif // ENABLE_LOST_FOUND
905 IARM_Result_t WiFiNetworkMgr::setEnabled(void *arg)
906 {
907  LOG_ENTRY_EXIT;
908 
910  bool wifiadapterEnableState = param->data.setwifiadapter.enable;
911 
912  LOG_INFO("IARM_BUS_WIFI_MGR_API_setEnabled %d", wifiadapterEnableState);
913 
914 #ifdef USE_RDK_WIFI_HAL
915  WiFiNetworkMgr::getInstance()->setWifiEnabled(wifiadapterEnableState);
916 #endif // USE_RDK_WIFI_HAL
917 
918  return IARM_RESULT_SUCCESS;
919 }
920 
921 IARM_Result_t WiFiNetworkMgr::connect(void *arg)
922 {
923  IARM_Result_t ret = IARM_RESULT_SUCCESS;
924  LOG_TRACE("[%s] Enter", MODULE_NAME );
925 
927 
928  param->status = false;
929  int ssidIndex = 1;
930  SsidSecurity securityMode;
931  securityMode = param->data.connect.security_mode;
932  char *ssid = param->data.connect.ssid;
933  short ssid_len = strlen(param->data.connect.ssid);
934  char *pass = param->data.connect.passphrase;
935  short pass_len = strlen (param->data.connect.passphrase);
936  char *eapIden = param->data.connect.eapIdentity;
937  char * carootcert = param->data.connect.carootcert;
938  char * clientcert = param->data.connect.clientcert;
939  char * privatekey = param->data.connect.privatekey;
940 
941  LOG_DBG("[%s] Connect with SSID (%s) & Passphrase (%s) security mode (%d)", MODULE_NAME, ssid, pass,securityMode);
942  /* If param data receives as Empty, then use the saved SSIDConnection */
943  if (!ssid_len)
944  {
945  if((savedWiFiConnList.ssidSession.ssid[0] != '\0') && (savedWiFiConnList.ssidSession.passphrase[0] != '\0'))
946  {
947  /*Now try to connect using saved SSID & PSK */
948 #ifdef USE_RDK_WIFI_HAL
949  connect_withSSID(ssidIndex, savedWiFiConnList.ssidSession.ssid, savedWiFiConnList.ssidSession.security_mode, NULL,savedWiFiConnList.ssidSession.passphrase, savedWiFiConnList.ssidSession.passphrase,SAVE_SSID,eapIden,carootcert,clientcert,privatekey,WIFI_CON_MANUAL);
950 #endif
951  param->status = true;
952  }
953  else
954  {
955  LOG_ERR("[%s] Failed, Empty saved SSID & Passphrase.", MODULE_NAME);
956  param->status = false;
957  }
958  }
959  /* If param data receives with SSID and Pass, then use these to compare with saved SSIDConnection & connect*/
960  else
961  {
962  if(ssid_len && pass_len)
963  {
964  /*Connect with Saved SSID */
965  LOG_DBG("[%s] Received valid SSID (%s) & Passphrase (%s).", MODULE_NAME, ssid, pass);
966 #ifdef USE_RDK_WIFI_HAL
967  connect_withSSID(ssidIndex, ssid, securityMode, NULL, pass, pass,SAVE_SSID,eapIden,carootcert,clientcert,privatekey,WIFI_CON_MANUAL);
968 #endif
969  param->status = true;
970  }
971  /* Passphrase can be null when the network security is NONE. */
972  else if (ssid_len && (0 == pass_len) && securityMode == NET_WIFI_SECURITY_NONE)
973  {
974  LOG_DBG("[%s] Received valid SSID (%s) with Empty Passphrase.", MODULE_NAME, ssid);
975 #ifdef USE_RDK_WIFI_HAL
976  connect_withSSID(ssidIndex, ssid, securityMode, NULL,savedWiFiConnList.ssidSession.passphrase , savedWiFiConnList.ssidSession.passphrase,SAVE_SSID,eapIden,carootcert,clientcert,privatekey,WIFI_CON_MANUAL);
977 #endif
978  param->status = true;
979  }
980  else {
981  LOG_ERR("[%s] Invalid SSID & Passphrase.", MODULE_NAME);
982  }
983  }
984  LOG_TRACE("[%s] Exit", MODULE_NAME );
985  return ret;
986 }
987 
988 IARM_Result_t WiFiNetworkMgr::initiateWPSPairing(void *arg)
989 {
990  LOG_ENTRY_EXIT;
992  param->status = false;
993 #ifdef USE_RDK_WIFI_HAL
994  pthread_mutex_lock(&wpsConnLock);
995  param->status = connect_WpsPush();
996  pthread_mutex_unlock(&wpsConnLock);
997 #endif
998  return IARM_RESULT_SUCCESS;
999 }
1000 
1001 IARM_Result_t WiFiNetworkMgr::initiateWPSPairing2(void *arg)
1002 {
1003  LOG_ENTRY_EXIT;
1005  params->status = false;
1006 #ifdef USE_RDK_WIFI_HAL
1007  pthread_mutex_lock(&wpsConnLock);
1008  params->status = params->pbc ? connect_WpsPush() : connect_WpsPin(params->pin);
1009  pthread_mutex_unlock(&wpsConnLock);
1010 #endif
1011  return IARM_RESULT_SUCCESS;
1012 }
1013 
1014 IARM_Result_t WiFiNetworkMgr::saveSSID(void* arg)
1015 {
1016  IARM_Result_t ret = IARM_RESULT_SUCCESS;
1017  LOG_TRACE("[%s] Enter", MODULE_NAME );
1018 
1020  bool retval = false;
1021  param->status = false;
1022  SsidSecurity securityMode;
1023  securityMode = param->data.connect.security_mode;
1024  char *ssid = param->data.connect.ssid;
1025  short ssid_len = strlen(param->data.connect.ssid);
1026  char *psk = param->data.connect.passphrase;
1027  short psk_len = strlen (param->data.connect.passphrase);
1028 
1029  /* Saves the ssid and passphrase for future sessions.
1030  * If an SSID was previously saved, the new SSID and passphrase will overwrite the existing one.
1031  * Returns false if the passphrase was not able to be saved, and true if the save was successful.*/
1032 
1033  if(ssid_len && psk_len)
1034  {
1035  memset(&savedWiFiConnList, 0 ,sizeof(savedWiFiConnList));
1036  strncpy(savedWiFiConnList.ssidSession.ssid, ssid, ssid_len+1);
1037  strncpy(savedWiFiConnList.ssidSession.passphrase, psk, psk_len+1);
1038  savedWiFiConnList.conn_type = SSID_SECLECTION_CONNECT;
1039  savedWiFiConnList.ssidSession.security_mode = (SsidSecurity)securityMode;
1040  retval = true;
1041  LOG_INFO("[%s] %s to file, SSID (%s) & Passphrase (%s) SecurityMode (%d).", MODULE_NAME, retval? "Successfully Saved": "Failed to Save",
1042  savedWiFiConnList.ssidSession.ssid, savedWiFiConnList.ssidSession.passphrase, savedWiFiConnList.ssidSession.security_mode);
1043  param->status = retval;
1044  }
1045  else
1046  {
1047  LOG_ERR("[%s] Empty data for SaveSSID", MODULE_NAME);
1048  ret = IARM_RESULT_INVALID_PARAM;
1049  }
1050 
1051  LOG_TRACE("[%s] Exit", MODULE_NAME );
1052  return ret;
1053 }
1054 
1055 IARM_Result_t WiFiNetworkMgr::disconnectSSID(void* arg)
1056 {
1057  IARM_Result_t ret = IARM_RESULT_SUCCESS;
1058 
1060  param->status = false;
1061 #ifdef USE_RDK_WIFI_HAL
1062  param->status = disconnectFromCurrentSSID();
1063 #endif
1064  LOG_TRACE("[%s] Exit", MODULE_NAME );
1065  return ret;
1066 }
1067 
1068 IARM_Result_t WiFiNetworkMgr::clearSSID(void* arg)
1069 {
1070  IARM_Result_t ret = IARM_RESULT_SUCCESS;
1071 
1073  param->status = false;
1074 
1075 #ifdef USE_RDK_WIFI_HAL
1076  param->status = clearSSID_On_Disconnect_AP();
1077 #endif
1078 
1079  LOG_TRACE("[%s] Exit", MODULE_NAME );
1080  return ret;
1081 }
1082 /* returns the SSID if one was previously saved through saveSSID,
1083  * otherwise returns NULL.*/
1084 IARM_Result_t WiFiNetworkMgr::getPairedSSID(void *arg)
1085 {
1086  IARM_Result_t ret = IARM_RESULT_SUCCESS;
1087  bool retVal = false;
1088 // WiFiConnectionStatus currSsidInfo;
1089  WiFiConnectionStatus tmpSavedWiFiConnList;
1090  memset(&tmpSavedWiFiConnList, '\0', sizeof(tmpSavedWiFiConnList));
1091 
1092  LOG_TRACE("[%s] Enter", MODULE_NAME );
1093 
1094 // memset(&currSsidInfo, '\0', sizeof(currSsidInfo));
1096 
1097 // get_CurrentSsidInfo(&currSsidInfo);
1098 
1099 // if (currSsidInfo.ssidSession.ssid[0] != '\0')
1100 #ifdef USE_RDK_WIFI_HAL
1101  retVal=lastConnectedSSID(&tmpSavedWiFiConnList);
1102 #endif
1103  if( retVal == true )
1104  {
1105  char *ssid = tmpSavedWiFiConnList.ssidSession.ssid;
1106  STRCPY_S(param->data.getPairedSSID.ssid, sizeof(param->data.getPairedSSID.ssid), ssid);
1107  LOG_INFO("[%s] getPairedSSID SSID (%s).", MODULE_NAME, ssid);
1108  param->status = true;
1109  }
1110  else
1111  {
1112  LOG_ERR("[%s] Error in getting last ssid ", MODULE_NAME);
1113  }
1114 
1115  LOG_TRACE("[%s] Exit", MODULE_NAME);
1116  return ret;
1117 }
1118 
1119 /**
1120  * Convert Security mode to String based on the Broadband specification
1121  * Supported Security modes are
1122  * None
1123  * WEP-64
1124  * WEP-128
1125  * WPA-Personal
1126  * WPA2-Personal
1127  * WPA-WPA2-Personal
1128  * WPA-Enterprise
1129  * WPA2-Enterprise
1130  * WPA-WPA2-Enterprise
1131  */
1132 bool convertSecurityModeToString(char* securityModeStr,SsidSecurity sec_mode)
1133 {
1134  bool ret = true;
1135 
1136  if(!securityModeStr)
1137  {
1138  LOG_ERR("securityModeStr is NULL, Failed to get Security mode string.");
1139  ret = false;
1140  }
1141  else
1142  {
1143  switch(sec_mode)
1144  {
1145  case NET_WIFI_SECURITY_WPA2_PSK_AES:
1146  strncpy(securityModeStr,"WPA2-Personal",BUFF_LENGTH_32-1);
1147  break;
1148  case NET_WIFI_SECURITY_WPA2_PSK_TKIP:
1149  strncpy(securityModeStr,"WPA2-Personal",BUFF_LENGTH_32-1);
1150  break;
1151  case NET_WIFI_SECURITY_WPA_PSK_AES:
1152  strncpy(securityModeStr,"WPA-Personal",BUFF_LENGTH_32-1);
1153  break;
1154  case NET_WIFI_SECURITY_WPA_PSK_TKIP:
1155  strncpy(securityModeStr,"WPA-Personal",BUFF_LENGTH_32-1);
1156  break;
1157  case NET_WIFI_SECURITY_WPA2_ENTERPRISE_AES:
1158  strncpy(securityModeStr,"WPA2-Enterprise",BUFF_LENGTH_32-1);
1159  break;
1160  case NET_WIFI_SECURITY_WPA2_ENTERPRISE_TKIP:
1161  strncpy(securityModeStr,"WPA2-Enterprise",BUFF_LENGTH_32-1);
1162  break;
1163  case NET_WIFI_SECURITY_WPA_ENTERPRISE_AES:
1164  strncpy(securityModeStr,"WPA-Enterprise",BUFF_LENGTH_32-1);
1165  break;
1166  case NET_WIFI_SECURITY_WPA_ENTERPRISE_TKIP:
1167  strncpy(securityModeStr,"WPA-Enterprise",BUFF_LENGTH_32-1);
1168  break;
1169  case NET_WIFI_SECURITY_WEP_64:
1170  strncpy(securityModeStr,"WEP-64",BUFF_LENGTH_32-1);
1171  break;
1172  case NET_WIFI_SECURITY_WEP_128:
1173  strncpy(securityModeStr,"WEP-128",BUFF_LENGTH_32-1);
1174  break;
1175  case NET_WIFI_SECURITY_WPA3_PSK_AES:
1176  strncpy(securityModeStr,"WPA2-WPA3",BUFF_LENGTH_32-1);
1177  break;
1178  case NET_WIFI_SECURITY_WPA3_SAE:
1179  strncpy(securityModeStr,"WPA3",BUFF_LENGTH_32-1);
1180  break;
1181  case NET_WIFI_SECURITY_WPA_WPA2_PSK:
1182  strncpy(securityModeStr,"WPA-WPA2-Personal",BUFF_LENGTH_32-1);
1183  break;
1184  case NET_WIFI_SECURITY_WPA_WPA2_ENTERPRISE:
1185  strncpy(securityModeStr,"WPA-WPA2-Enterprise",BUFF_LENGTH_32-1);
1186  break;
1187  case NET_WIFI_SECURITY_NONE:
1188  strncpy(securityModeStr,"None",BUFF_LENGTH_32-1);
1189  break;
1190  default:
1191  strncpy(securityModeStr,"None",BUFF_LENGTH_32-1);
1192  break;
1193  }
1194  }
1195  return ret;
1196 }
1197 
1198 IARM_Result_t WiFiNetworkMgr::getPairedSSIDInfo(void *arg)
1199 {
1200  IARM_Result_t ret = IARM_RESULT_IPCCORE_FAIL;
1201  bool retVal = false;
1202  char securityModeString[BUFF_LENGTH_32];
1203  WiFiConnectionStatus tmpSavedWiFiConnList;
1204  memset(&tmpSavedWiFiConnList, '\0', sizeof(tmpSavedWiFiConnList));
1205  LOG_TRACE("[%s] Enter", MODULE_NAME );
1207  memset(&param->data.getPairedSSIDInfo, '\0', sizeof(WiFiPairedSSIDInfo_t));
1208 #ifdef USE_RDK_WIFI_HAL
1209  retVal=lastConnectedSSID(&tmpSavedWiFiConnList);
1210 #endif
1211  if( retVal == true )
1212  {
1213  char *ssid = tmpSavedWiFiConnList.ssidSession.ssid;
1214  STRCPY_S(param->data.getPairedSSIDInfo.ssid, sizeof(param->data.getPairedSSIDInfo.ssid), ssid);
1215  char *bssid = tmpSavedWiFiConnList.ssidSession.bssid;
1216  STRCPY_S(param->data.getPairedSSIDInfo.bssid, sizeof(param->data.getPairedSSIDInfo.bssid), bssid);
1217  memset(securityModeString,0,BUFF_LENGTH_32);
1218  convertSecurityModeToString(securityModeString,tmpSavedWiFiConnList.ssidSession.security_mode);
1219  strncpy(param->data.getPairedSSIDInfo.security,securityModeString,BUFF_LENGTH_32-1);
1220  LOG_INFO("[%s] getPairedSSIDInfo SSID (%s) : BSSID (%s).", MODULE_NAME, ssid, bssid);
1221  param->status = true;
1222  ret = IARM_RESULT_SUCCESS;
1223  }
1224  else
1225  {
1226  LOG_ERR("[%s] Error in getting last ssid .", MODULE_NAME);
1227  }
1228  LOG_TRACE("[%s] Exit", MODULE_NAME);
1229  return ret;
1230 }
1231 
1232 /*returns true if this device has been previously paired
1233  * ( calling saveSSID marks this device as paired )*/
1234 IARM_Result_t WiFiNetworkMgr::isPaired(void *arg)
1235 {
1236  IARM_Result_t ret = IARM_RESULT_SUCCESS;
1237 #ifdef USE_RDK_WIFI_HAL
1238  bool retVal=false;
1239 #endif
1240  WiFiConnectionStatus tmpSavedWiFiConnList;
1241  memset(&tmpSavedWiFiConnList, '\0', sizeof(tmpSavedWiFiConnList));
1242 // WiFiConnectionStatus currSsidInfo;
1243 // memset(&currSsidInfo, '\0', sizeof(currSsidInfo));
1244  LOG_TRACE("[%s] Enter", MODULE_NAME);
1245 
1247 
1248 // get_CurrentSsidInfo(&currSsidInfo);
1249 #ifdef USE_RDK_WIFI_HAL
1250  retVal=lastConnectedSSID(&tmpSavedWiFiConnList);
1251 #endif
1252 
1253  int ssid_len = strlen(tmpSavedWiFiConnList.ssidSession.ssid);
1254 
1255  param->data.isPaired = (ssid_len) ? true : false; /*currSsidInfo.isConnected*/;
1256 
1257  if(param->data.isPaired) {
1258  LOG_TRACE("[%s] This is Paired with \"%s\".", MODULE_NAME, tmpSavedWiFiConnList.ssidSession.ssid);
1259  }
1260  else {
1261  LOG_ERR("[%s] This is Not Paired with \"%s\".", MODULE_NAME, tmpSavedWiFiConnList.ssidSession.ssid);
1262  }
1263  param->status = true;
1264 
1265  LOG_TRACE("[%s] Exit", MODULE_NAME );
1266  return ret;
1267 }
1268 
1269 /*
1270  * The properties of the currently connected SSID
1271  */
1272 IARM_Result_t WiFiNetworkMgr::getConnectedSSID(void *arg)
1273 {
1274  IARM_Result_t ret = IARM_RESULT_SUCCESS;
1275  bool retVal=false;
1276  LOG_TRACE("[%s] Enter", MODULE_NAME);
1277 
1279 
1280  param->status = true;
1281  memset(&param->data.getConnectedSSID, '\0', sizeof(WiFiConnectedSSIDInfo_t));
1282 
1283 #ifdef USE_RDK_WIFI_HAL
1284  getConnectedSSIDInfo(&param->data.getConnectedSSID);
1285 #endif
1286 
1287  LOG_TRACE("[%s] Exit", MODULE_NAME);
1288  return ret;
1289 }
1290 
1291 /*
1292  * Cancel WPS pairing operation
1293  */
1294 IARM_Result_t WiFiNetworkMgr::cancelWPSPairing (void *arg)
1295 {
1296  IARM_Result_t ret = IARM_RESULT_SUCCESS;
1297  bool retVal=false;
1298  LOG_TRACE("[%s] Enter", MODULE_NAME );
1299 
1301 
1302 #ifdef USE_RDK_WIFI_HAL
1303  retVal = cancelWPSPairingOperation();
1304 #endif
1305  param->status = retVal;
1306 
1307  LOG_TRACE("[%s] Exit", MODULE_NAME );
1308  return ret;
1309 }
1310 
1311 #ifdef USE_RDK_WIFI_HAL
1312 static void _irEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
1313 {
1314  /* By default, the WPS shall be handled through XRE,
1315  * if "DISABLE_WPS_XRE" flag is set to '1' in /etc/netsrvmgr.conf, then
1316  * it will enable through netsrvmgr, else handled by xre */
1317  if(confProp.wifiProps.disableWpsXRE)
1318  {
1320 
1321  LOG_DBG("[%s] Enter", MODULE_NAME);
1322  int keyCode = irEventData->data.irkey.keyCode;
1323  int keyType = irEventData->data.irkey.keyType;
1324  int isFP = irEventData->data.irkey.isFP;
1325 
1326  {
1327  if (keyType == KET_KEYDOWN && keyCode == KED_WPS)
1328  {
1329  pthread_mutex_lock(&wpsConnLock);
1330  LOG_INFO("[%s] Received Key info [Type : %d; Code : %d; isFP : %d ]", MODULE_NAME, keyType, keyCode, isFP );
1331  connect_WpsPush();
1332  pthread_mutex_unlock(&wpsConnLock);
1333  }
1334  }
1335 
1336  }
1337  else {
1338  LOG_DBG("[%s] Disabled WPS event by default. Now, WPS key functionality handled by XRE and disabled in netsrvmgr.", MODULE_NAME );
1339  }
1340  LOG_TRACE("[%s] Exit", MODULE_NAME );
1341 }
1342 #endif
1343 
1344 
1345 IARM_Result_t WiFiNetworkMgr::getRadioProps(void *arg)
1346 {
1347  IARM_Result_t ret = IARM_RESULT_SUCCESS;
1348 #ifdef USE_RDK_WIFI_HAL
1349  unsigned char output_bool[BUFF_MIN] = {'\0'};
1350  char output_string[BUFF_MAX] = {'\0'};
1351  int output_INT = 0;
1352  unsigned long output_ulong = 0;
1353  int radioIndex=0;
1354  char freqBand[BUFF_MIN] = {'\0'};
1355 
1356  LOG_TRACE("[%s] Enter", MODULE_NAME );
1357 
1359 
1360  memset(output_bool,0,BUFF_MIN);
1361  if (wifi_getRadioEnable(radioIndex, output_bool) == RETURN_OK) {
1362  LOG_DBG("[%s] radio enable is %s .", MODULE_NAME, output_bool);
1363 // param->data.radio.params.enable= (output_bool == (unsigned char*)"true" ? true : false);
1364  param->data.radio.params.enable=*output_bool;
1365  LOG_DBG("[%s] radio enable is %s .", MODULE_NAME, param->data.radio.params.enable ? "true" : "false");
1366  }
1367  else
1368  {
1369  LOG_ERR("[%s] HAL wifi_getRadioEnable FAILURE ", MODULE_NAME);
1370  }
1371  memset(output_string,0,BUFF_MAX);
1372  if (wifi_getRadioStatus( radioIndex, output_string) == RETURN_OK) {
1373  LOG_DBG("[%s] radio status is %s ", MODULE_NAME, output_string);
1374  snprintf(param->data.radio.params.status,BUFF_MIN,output_string);
1375  }
1376  else
1377  {
1378  LOG_ERR("[%s] HAL wifi_getRadioStatus FAILURE ", MODULE_NAME);
1379  }
1380  memset(output_string,0,BUFF_MAX);
1381  if (wifi_getRadioIfName( radioIndex, output_string) == RETURN_OK) {
1382  LOG_DBG("[%s] radio ifname is %s .", MODULE_NAME, output_string);
1383  snprintf(param->data.radio.params.name,BUFF_LENGTH_24,output_string);
1384  }
1385  else
1386  {
1387  LOG_ERR("[%s] HAL wifi_getRadioIfName FAILURE ", MODULE_NAME);
1388  }
1389  memset(output_string,0,BUFF_MAX);
1390  if (wifi_getRadioMaxBitRate( radioIndex, output_string) == RETURN_OK) {
1391  LOG_DBG("[%s] max bit rate is %s ", MODULE_NAME, output_string);
1392  param->data.radio.params.maxBitRate=atoi(output_string);
1393 
1394  }
1395  else
1396  {
1397  LOG_ERR("[%s] HAL wifi_getRadioMaxBitRate FAILURE ", MODULE_NAME);
1398  }
1399  memset(output_bool,0,BUFF_MIN);
1400  if (wifi_getRadioAutoChannelSupported( radioIndex, output_bool) == RETURN_OK) {
1401  LOG_DBG("[%s] auto channel supported is %s .", MODULE_NAME, output_bool);
1402  param->data.radio.params.autoChannelSupported=output_bool == (unsigned char*)"true";
1403  }
1404  else
1405  {
1406  LOG_ERR("[%s] HAL wifi_getRadioAutoChannelSupported FAILURE ", MODULE_NAME);
1407  }
1408  memset(output_bool,0,BUFF_MIN);
1409  if (wifi_getRadioAutoChannelEnable( radioIndex, output_bool) == RETURN_OK) {
1410  LOG_DBG("[%s] auto channel enable is %s ", MODULE_NAME, output_bool);
1411  param->data.radio.params.autoChannelEnable=output_bool == (unsigned char*)"true";
1412  }
1413  else
1414  {
1415  LOG_ERR("[%s] HAL wifi_getRadioAutoChannelEnable FAILURE ", MODULE_NAME);
1416  }
1417  if (wifi_getRadioAutoChannelRefreshPeriod( radioIndex, &output_ulong) == RETURN_OK) {
1418  LOG_DBG("[%s] auto channel refresh period is %lu ", MODULE_NAME, output_ulong);
1419  param->data.radio.params.autoChannelRefreshPeriod=output_ulong;
1420  }
1421  else
1422  {
1423  LOG_ERR("[%s] HAL wifi_getRadioAutoChannelRefreshPeriod FAILURE ", MODULE_NAME);
1424  }
1425  memset(output_string,0,BUFF_MAX);
1426  if (wifi_getRadioExtChannel( radioIndex, output_string) == RETURN_OK) {
1427  LOG_DBG("[%s] radio ext channel is %s .", MODULE_NAME, output_string);
1428  snprintf(param->data.radio.params.extensionChannel,BUFF_LENGTH_24,output_string);
1429  }
1430  else
1431  {
1432  LOG_ERR("[%s] HAL wifi_getRadioExtChannel FAILURE ", MODULE_NAME);
1433  }
1434  memset(output_string,0,BUFF_MAX);
1435  if (wifi_getRadioGuardInterval( radioIndex, output_string) == RETURN_OK) {
1436  LOG_DBG("[%s] radio guard is %s ", MODULE_NAME, output_string);
1437  snprintf(param->data.radio.params.guardInterval,BUFF_LENGTH_24,output_string);
1438  }
1439  else
1440  {
1441  LOG_ERR("[%s] HAL wifi_getRadioGuarderval FAILURE ", MODULE_NAME);
1442  }
1443  output_INT = 0;
1444  if (wifi_getRadioMCS( radioIndex, &output_INT) == RETURN_OK) {
1445  LOG_DBG("[%s] radio ext channel is %d ", MODULE_NAME, output_INT);
1446  param->data.radio.params.mcs=output_INT;
1447  }
1448  else
1449  {
1450  LOG_ERR("[%s] HAL wifi_getRadioMCS FAILURE ", MODULE_NAME);
1451  }
1452  memset(output_string,0,BUFF_MAX);
1453  if (wifi_getRadioTransmitPowerSupported( radioIndex, output_string) == RETURN_OK) {
1454  LOG_DBG("[%s] radio transmit power support is %s .", MODULE_NAME, output_string);
1455  snprintf(param->data.radio.params.transmitPowerSupported,BUFF_LENGTH_64,output_string);
1456  }
1457  else
1458  {
1459  LOG_ERR("[%s] HAL wifi_getRadioTransmitPowerSupported FAILURE", MODULE_NAME);
1460  }
1461  output_INT = 0;
1462  if (wifi_getRadioTransmitPower( radioIndex, &output_INT) == RETURN_OK) {
1463  LOG_DBG("[%s] radio transmit power is %lu .", MODULE_NAME, output_ulong);
1464  }
1465  else
1466  {
1467  LOG_ERR("[%s] HAL wifi_getRadioTransmitPower FAILURE", MODULE_NAME);
1468  }
1469  memset(output_bool,0,BUFF_MIN);
1470  if (wifi_getRadioIEEE80211hSupported( radioIndex, output_bool) == RETURN_OK) {
1471  LOG_DBG("[%s] IEEE80211h Supp is %s ", MODULE_NAME, output_bool);
1472  //param->data.radio.params.IEEE80211hSupported=*output_bool;
1473  }
1474  else
1475  {
1476  LOG_ERR("[%s] HAL wifi_getRadioIEEE80211hSupported FAILURE", MODULE_NAME);
1477  }
1478  memset(output_bool,0,BUFF_MIN);
1479  if (wifi_getRadioIEEE80211hEnabled( radioIndex, output_bool) == RETURN_OK) {
1480  LOG_DBG("[%s] IEEE80211hEnabled is %s ", MODULE_NAME, output_bool);
1481  //param->data.radio.params.IEEE80211hEnabled=*output_bool;
1482  }
1483  else
1484  {
1485  LOG_ERR("[%s] HAL wifi_getRadioIEEE80211hEnabled FAILURE", MODULE_NAME);
1486  }
1487 
1488  if (wifi_getRadioChannel(radioIndex, &output_ulong) == RETURN_OK) {
1489  LOG_DBG("[%s] radio channel is %lu .", MODULE_NAME, output_ulong);
1490  param->data.radio.params.channel=output_ulong;
1491  }
1492  else
1493  {
1494  LOG_ERR("[%s] HAL wifi_getRadioChannel FAILURE", MODULE_NAME);
1495  }
1496  memset(output_string,0,BUFF_MAX);
1497  if ( wifi_getRadioChannelsInUse(radioIndex, output_string) == RETURN_OK) {
1498  LOG_DBG("[%s] radio channels in use is %s .", MODULE_NAME, output_string);
1499  snprintf(param->data.radio.params.channelsInUse,BUFF_LENGTH_24,output_string);
1500  }
1501  else
1502  {
1503  LOG_ERR("[%s] HAL wifi_getRadioChannelsInUse FAILURE ", MODULE_NAME);
1504  }
1505  memset(output_string,0,BUFF_MAX);
1506  if ( wifi_getRadioOperatingChannelBandwidth(radioIndex, output_string) == RETURN_OK) {
1507  LOG_DBG("[%s] operating channel bandwith is %s .", MODULE_NAME, output_string);
1508  snprintf(param->data.radio.params.operatingChannelBandwidth,BUFF_LENGTH_24,output_string);
1509  }
1510  else
1511  {
1512  LOG_ERR("[%s] HAL wifi_getRadioOperatingChannelBandwidth FAILURE ", MODULE_NAME);
1513  }
1514  memset(output_string,0,BUFF_MAX);
1515  if(wifi_getRadioSupportedFrequencyBands(radioIndex, output_string) == RETURN_OK) {
1516  LOG_DBG("[%s] Supported frequency band is %s .", MODULE_NAME, output_string);
1517  snprintf(param->data.radio.params.supportedFrequencyBands,BUFF_LENGTH_24,output_string);
1518  }
1519  else
1520  {
1521  LOG_ERR("[%s] HAL wifi_getRadioSupportedFrequencyBands FAILURE ", MODULE_NAME);
1522  }
1523  memset(output_string,0,BUFF_MAX);
1524  memset(freqBand,0,BUFF_MIN);
1525  if ( wifi_getRadioOperatingFrequencyBand(radioIndex, output_string) == RETURN_OK) {
1526  LOG_DBG("[%s] operating frequency band is %s .", MODULE_NAME, output_string);
1527  snprintf(param->data.radio.params.operatingFrequencyBand,BUFF_LENGTH_24,output_string);
1528  strncpy(freqBand,output_string,BUFF_MIN-1);
1529  }
1530  else
1531  {
1532  LOG_ERR("[%s] HAL wifi_getRadioOperatingFrequencyBand FAILURE", MODULE_NAME);
1533  }
1534  memset(output_string,0,BUFF_MAX);
1535  // Make sure that we are passing the correct Radio Index to wifi_hal
1536  int actualRadioIndex = 0;
1537  if(strncmp(freqBand,"5GHz",BUFF_MIN-1) == 0)
1538  actualRadioIndex = 1;
1539 
1540  if ( wifi_getRadioSupportedStandards(actualRadioIndex, output_string) == RETURN_OK) {
1541  LOG_DBG("[%s] radio Supported standards are %s .", MODULE_NAME, output_string);
1542  snprintf(param->data.radio.params.supportedStandards,BUFF_LENGTH_24,output_string);
1543  }
1544  else {
1545  LOG_ERR("[%s] HAL wifi_getRadioSupportedStandards FAILURE ", MODULE_NAME);
1546  }
1547 
1548  memset(output_string,0,BUFF_MAX);
1549  if ( wifi_getRadioStandard(actualRadioIndex, output_string,NULL,NULL,NULL) == RETURN_OK) {
1550  LOG_DBG("[%s] radio standards is %s .", MODULE_NAME, output_string);
1551  snprintf(param->data.radio.params.operatingStandards,BUFF_MIN,output_string);
1552  }
1553  else
1554  {
1555  LOG_ERR("[%s] HAL wifi_getRadioStandard FAILURE ", MODULE_NAME);
1556  }
1557  memset(output_string,0,BUFF_MAX);
1558  if ( wifi_getRadioPossibleChannels(actualRadioIndex, output_string) == RETURN_OK) {
1559  LOG_DBG("[%s] radio possible channels is %s ", MODULE_NAME, output_string);
1560  snprintf(param->data.radio.params.possibleChannels,BUFF_LENGTH_256,output_string);
1561  }
1562  else
1563  {
1564  LOG_ERR("[%s] HAL wifi_getRadioPossibleChannels FAILURE", MODULE_NAME);
1565  }
1566  output_INT = 0;
1567  if (wifi_getRadioTransmitPower( radioIndex, &output_INT) == RETURN_OK) {
1568  LOG_DBG("[%s] Radio TransmitPower %d .", MODULE_NAME, output_INT);
1569  param->data.radio.params.transmitPower = output_INT;
1570  }
1571  else
1572  {
1573  LOG_ERR("[%s] Failed to get HAL wifi_getRadioTransmitPower.", MODULE_NAME);
1574  }
1575  memset(output_string,0,BUFF_MAX);
1576  if ( wifi_getRegulatoryDomain(radioIndex, output_string) == RETURN_OK) {
1577  LOG_DBG("[%s] Radio wifi_getRegulatoryDomain is %s .", MODULE_NAME, output_string);
1578  snprintf(param->data.radio.params.regulatoryDomain,BUFF_LENGTH_4,output_string);
1579  }
1580  else
1581  {
1582  LOG_ERR("[%s] Failed to get wifi_getRegulatoryDomain.", MODULE_NAME);
1583  }
1584  LOG_TRACE("[%s] Exit", MODULE_NAME );
1585 #endif
1586  param->status = true;
1587  return ret;
1588 }
1589 
1590 
1591 IARM_Result_t WiFiNetworkMgr::setRadioProps(void *arg)
1592 {
1593  IARM_Result_t ret = IARM_RESULT_SUCCESS;
1594  LOG_TRACE("[%s] Enter", MODULE_NAME );
1595 
1596  LOG_TRACE("[%s] Exit", MODULE_NAME );
1597  return ret;
1598 }
1599 
1600 IARM_Result_t WiFiNetworkMgr::getRadioStatsProps(void *arg)
1601 {
1602  IARM_Result_t ret = IARM_RESULT_SUCCESS;
1603 #ifdef USE_RDK_WIFI_HAL
1605  param->status = getRadioStats(&param->data.radio_stats.params);
1606 #endif
1607  return ret;
1608 }
1609 
1610 IARM_Result_t WiFiNetworkMgr::getSSIDProps(void *arg)
1611 {
1612  IARM_Result_t ret = IARM_RESULT_SUCCESS;
1613 #ifdef USE_RDK_WIFI_HAL
1614  unsigned long output_ulong;
1615  LOG_TRACE("[%s] Enter", MODULE_NAME );
1616 
1619  WiFiConnectionStatus currSsidInfo;
1620  char output_string[BUFF_MAX];
1621  int ssidIndex=0;
1622  memset(output_string,0, BUFF_MAX);
1623 
1624  if(param->numEntry == IARM_BUS_WIFI_MGR_SSIDEntry)
1625  {
1626  if(wifi_getSSIDNumberOfEntries(&output_ulong) == RETURN_OK) {
1627  LOG_DBG("[%s] SSID Entries is %lu ", MODULE_NAME, output_ulong);
1628  param->data.ssidNumberOfEntries=(unsigned int)output_ulong;
1629  LOG_DBG("[%s] SSID Entries param->data.ssidNumberOfEntries is %d .", MODULE_NAME, param->data.ssidNumberOfEntries);
1630 
1631  }
1632  else
1633  {
1634  LOG_ERR("[%s] HAL wifi_getSSIDEntries FAILURE ", MODULE_NAME);
1635  }
1636  }
1637  else if(param->numEntry == IARM_BUS_WIFI_MGR_RadioEntry)
1638  {
1639  if(wifi_getRadioNumberOfEntries(&output_ulong) == RETURN_OK) {
1640  LOG_DBG("[%s] Radio Entries is %lu .", MODULE_NAME, output_ulong);
1641  param->data.radioNumberOfEntries=(unsigned int)output_ulong;
1642  LOG_DBG("[%s] Radio Entries param->data.radioNumberOfEntries is %d .", MODULE_NAME, param->data.ssidNumberOfEntries);
1643 
1644  }
1645  else
1646  {
1647  LOG_ERR("[%s] HAL wifi_getRadioNumberOfEntries FAILURE", MODULE_NAME);
1648  }
1649  }
1650  else
1651  {
1652  if(wifi_getSSIDName(ssidIndex,output_string) == RETURN_OK) {
1653  LOG_DBG("[%s] SSID Name is %s .", MODULE_NAME, output_string);
1654  snprintf(param->data.ssid.params.name,BUFF_LENGTH_32,output_string);
1655  LOG_DBG("[%s] SSID Name is %s .", MODULE_NAME, param->data.ssid.params.name);
1656 
1657  }
1658  else
1659  {
1660  LOG_ERR("[%s] HAL wifi_getSSIDName FAILURE", MODULE_NAME);
1661  }
1662 
1663  memset(output_string,0, BUFF_MAX);
1664  if (wifi_getBaseBSSID(ssidIndex, output_string) == RETURN_OK) {
1665  LOG_DBG("[%s] BSSID is %s .", MODULE_NAME, output_string);
1666  snprintf(param->data.ssid.params.bssid,BUFF_MAC,output_string);
1667  LOG_DBG("[%s] BSSID is %s .", MODULE_NAME, param->data.ssid.params.bssid);
1668  }
1669  else
1670  {
1671  LOG_ERR("[%s] HAL wifi_getBaseBSSID FAILURE ", MODULE_NAME);
1672  }
1673  memset(output_string,0, BUFF_MAX);
1674  if (gWifiMacAddress[0] != '\0') {
1675  LOG_DBG("[%s] SSID MAC address is %s ",MODULE_NAME, gWifiMacAddress);
1676  snprintf(param->data.ssid.params.macaddr,BUFF_MAC, gWifiMacAddress);
1677  LOG_DBG("[%s] SSID MAC address is %s .",MODULE_NAME, param->data.ssid.params.macaddr);
1678  }
1679  else
1680  {
1681  LOG_ERR("[%s] HAL wifi_getSSIDMACAddress FAILURE", MODULE_NAME);
1682  }
1683  memset(&currSsidInfo, '\0', sizeof(currSsidInfo));
1684  get_CurrentSsidInfo(&currSsidInfo);
1685  STRCPY_S(param->data.ssid.params.ssid, sizeof(param->data.ssid.params.ssid), currSsidInfo.ssidSession.ssid);
1686  if(currSsidInfo.ssidSession.ssid[0] != '\0')
1687  {
1688  LOG_DBG("[%s] get current SSID (%s).", MODULE_NAME, currSsidInfo.ssidSession.ssid);
1689  }
1690  else
1691  {
1692  memset(&currSsidInfo, '\0', sizeof(currSsidInfo));
1693  getWpaSsid(&currSsidInfo);
1694  STRCPY_S(param->data.ssid.params.ssid, sizeof(param->data.ssid.params.ssid), currSsidInfo.ssidSession.ssid);
1695 
1696  if(currSsidInfo.ssidSession.ssid[0] != '\0')
1697  {
1698  LOG_DBG("[%s] get current SSID (%s).", MODULE_NAME, currSsidInfo.ssidSession.ssid);
1699  }
1700  else
1701  {
1702  LOG_ERR("[%s] Empty SSID", MODULE_NAME);
1703  }
1704  }
1705 
1706  status = get_WifiRadioStatus();
1707  LOG_DBG("[%s] getPairedSSID SSID (%s).", MODULE_NAME, currSsidInfo.ssidSession.ssid);
1708  if(WIFI_CONNECTED == status )
1709  {
1710  param->data.ssid.params.enable = true;
1711  snprintf(param->data.ssid.params.status,BUFF_MIN,"UP");
1712  }
1713  else
1714  {
1715  status = getWpaStatus();
1716  if(WIFI_CONNECTED == status )
1717  {
1718  param->data.ssid.params.enable = true;
1719  snprintf(param->data.ssid.params.status,BUFF_MIN,"UP");
1720  }
1721  else
1722  {
1723  param->data.ssid.params.enable = false;
1724  snprintf(param->data.ssid.params.status,BUFF_MIN,"DOWN");
1725  }
1726  }
1727  }
1728 
1729  LOG_TRACE("[%s] Exit", MODULE_NAME );
1730 #endif
1731  return ret;
1732 }
1733 
1734 #ifdef ENABLE_LOST_FOUND
1735 #ifdef ENABLE_IARM
1736 static void _eventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len)
1737 {
1738  LOG_TRACE("[%s] Enter", MODULE_NAME );
1739  if (strcmp(owner, IARM_BUS_AUTHSERVICE_NAME) == 0) {
1740  switch (eventId) {
1741  case IARM_BUS_AUTHSERVICE_EVENT_SWITCH_TO_PRIVATE:
1742  {
1743  IARM_BUS_AuthService_EventData_t *param = (IARM_BUS_AuthService_EventData_t *)data;
1744  if (param->value == DEVICE_ACTIVATED)
1745  {
1746  LOG_INFO("[%s] Auth service msg Box Activated ", MODULE_NAME);
1747  bDeviceActivated = true;
1748  }
1749  }
1750  break;
1751  default:
1752  break;
1753  }
1754  }
1755  else if (strcmp(owner, IARM_BUS_NM_SRV_MGR_NAME) == 0) {
1756  switch (eventId) {
1757  case IARM_BUS_NETWORK_MANAGER_EVENT_SWITCH_TO_PRIVATE:
1758  {
1760  if ((!bDeviceActivated)&&(param->value == DEVICE_ACTIVATED))
1761  {
1762  LOG_INFO("[%s] Service Manager msg Box Activated ", MODULE_NAME);
1763  bDeviceActivated = true;
1764  }
1765  if(!bAutoSwitchToPrivateEnabled)
1766  {
1767  LOG_INFO("[%s] explicit call to switch to private", MODULE_NAME);
1768  bSwitch2Private=true;
1769  lnfConnectPrivCredentials();
1770  }
1771  }
1772  break;
1773  case IARM_BUS_NETWORK_MANAGER_EVENT_STOP_LNF_WHILE_DISCONNECTED:
1774  {
1775  bool *param = (bool *)data;
1776  if(*param == bStopLNFWhileDisconnected)
1777  {
1778  LOG_INFO("[%s] Discarding stopLNFWhileDisconnected event since there is no change in value existing %d new %d ", MODULE_NAME,bStopLNFWhileDisconnected,*param);
1779  break;
1780  }
1781  LOG_INFO("[%s] event handler of stopLNFWhileDisconnected old value %d current value %d", MODULE_NAME, bStopLNFWhileDisconnected,*param);
1782  bStopLNFWhileDisconnected=*param;
1783  if((!bStopLNFWhileDisconnected) && (confProp.wifiProps.bEnableLostFound) && (gWifiLNFStatus != CONNECTED_PRIVATE))
1784  {
1785  lnfConnectPrivCredentials();
1786  LOG_INFO("[%s] starting LnF since stopLNFWhileDisconnected value is %d.",MODULE_NAME,bStopLNFWhileDisconnected);
1787  }
1788  }
1789  break;
1790  case IARM_BUS_NETWORK_MANAGER_EVENT_AUTO_SWITCH_TO_PRIVATE_ENABLED:
1791  {
1792  bool *param = (bool *)data;
1793  if(*param == bAutoSwitchToPrivateEnabled)
1794  {
1795  LOG_INFO("[%s] Discarding event bAutoSwitchToPrivateEnabled since there is no change in value existing %d new %d", MODULE_NAME,bAutoSwitchToPrivateEnabled,*param);
1796  break;
1797  }
1798  LOG_INFO("[%s] event handler of bAutoSwitchToPrivateEnabled old value %d current value %d ", MODULE_NAME,bAutoSwitchToPrivateEnabled,*param);
1799  bAutoSwitchToPrivateEnabled=*param;
1800  if((gWifiLNFStatus != CONNECTED_PRIVATE) && bAutoSwitchToPrivateEnabled)
1801  {
1802  lnfConnectPrivCredentials();
1803  LOG_INFO("[%s] starting LnF since AutoSwitchToPrivateEnabled value is %d.", MODULE_NAME,bAutoSwitchToPrivateEnabled);
1804 
1805  }
1806  }
1807  break;
1808  default:
1809  break;
1810  }
1811  }
1812  LOG_TRACE("[%s] Exit", MODULE_NAME );
1813 }
1814 #endif
1815 #endif
1816 
1817 /**
1818  * @brief This function is used to get the system modes (EAS, NORMAL and WAREHOUSE)
1819  *
1820  * @param[in] arg Pointer variable of void.
1821  *
1822  * @retval IARM_RESULT_SUCCESS By default it return success.
1823  *
1824  */
1825 IARM_Result_t WiFiNetworkMgr::sysModeChange(void *arg)
1826 {
1827  LOG_TRACE("[%s] Enter", MODULE_NAME );
1828  IARM_Bus_CommonAPI_SysModeChange_Param_t *param = (IARM_Bus_CommonAPI_SysModeChange_Param_t *)arg;
1829  LOG_INFO("[%s] Sys Mode Change::New mode --> %d, Old mode --> %d", MODULE_NAME, param->newMode,param->oldMode);
1830  sysModeParam=param->newMode;
1831  if(IARM_BUS_SYS_MODE_WAREHOUSE == sysModeParam)
1832  {
1833  LOG_INFO("[%s] Trigger Dhcp lease since we are in warehouse mode",MODULE_NAME );
1834  netSrvMgrUtiles::triggerDhcpRenew();
1835  }
1836  LOG_TRACE("[%s] Exit", MODULE_NAME );
1837  return IARM_RESULT_SUCCESS;
1838 }
1839 
1840 /**
1841  * @brief This function is used to get the EndPoint Details
1842  *
1843  * @param[in] arg Pointer variable of void.
1844  *
1845  * @retval IARM_RESULT_SUCCESS By default it return success.
1846  *
1847  */
1848 IARM_Result_t WiFiNetworkMgr::getEndPointProps(void *arg)
1849 {
1850  LOG_TRACE("[%s] Enter", MODULE_NAME);
1851  bool retVal=false;
1852  //LOG_TRACE("[%s] Enter", MODULE_NAME );
1853 
1855 
1856  param->status = true;
1857  memset(&param->data.endPointInfo, '\0', sizeof(param->data.endPointInfo));
1858 
1859 #ifdef USE_RDK_WIFI_HAL
1860  getEndPointInfo(&param->data.endPointInfo);
1861 #endif
1862 
1863  LOG_TRACE("[%s] Exit", MODULE_NAME);
1864  return IARM_RESULT_SUCCESS;
1865 }
1866 
1867 
1868 #ifdef WIFI_CLIENT_ROAMING
1869 IARM_Result_t WiFiNetworkMgr::getRoamingCtrls(void *arg)
1870 {
1871  IARM_Result_t ret = IARM_RESULT_SUCCESS;
1872  bool retVal=false;
1873  LOG_TRACE("[%s] Enter", MODULE_NAME);
1874  WiFi_RoamingCtrl_t *param = (WiFi_RoamingCtrl_t *)arg;
1875  memset(param,0,sizeof(WiFi_RoamingCtrl_t));
1876  retVal = getRoamingConfigInfo(param);
1877  ret = (retVal==true?IARM_RESULT_SUCCESS:IARM_RESULT_IPCCORE_FAIL);
1878  LOG_TRACE("[%s] Exit", MODULE_NAME);
1879  return ret;
1880 }
1881 
1882 
1883 IARM_Result_t WiFiNetworkMgr::setRoamingCtrls(void *arg)
1884 {
1885  IARM_Result_t ret = IARM_RESULT_SUCCESS;
1886  bool retVal=0;
1887  LOG_TRACE("[%s] Enter", MODULE_NAME );
1888  WiFi_RoamingCtrl_t *param = (WiFi_RoamingCtrl_t *)arg;
1889  retVal = setRoamingConfigInfo(param);
1890  ret = (retVal==true?IARM_RESULT_SUCCESS:IARM_RESULT_IPCCORE_FAIL);
1891  LOG_TRACE("[%s] Exit", MODULE_NAME );
1892  return ret;
1893 }
1894 #endif
1895 #endif
IARM_BUS_WIFI_MGR_API_initiateWPSPairing
#define IARM_BUS_WIFI_MGR_API_initiateWPSPairing
Definition: wifiSrvMgrIarmIf.h:66
getCurrentTime
void getCurrentTime(struct timespec *timer)
Get Current time.
Definition: hostIf_utils.cpp:466
wifi_getRadioIfName
int wifi_getRadioIfName(int radioIndex, char *output_string)
Get the Radio Interface name from platform.
wifi_getRadioGuardInterval
int wifi_getRadioGuardInterval(int radioIndex, char *output_string)
Get the guard interval value. eg "400nsec" or "800nsec".
_IARM_Bus_WiFiSrvMgr_SwitchPrivateResults_Param
Definition: wifiSrvMgrIarmIf.h:245
IARM_BUS_WIFI_MGR_API_isStopLNFWhileDisconnected
#define IARM_BUS_WIFI_MGR_API_isStopLNFWhileDisconnected
Definition: wifiSrvMgrIarmIf.h:74
shutdownWifi
bool shutdownWifi()
This function is used to cancel all the WIFI related threads and un initialize the WIFI module.
Definition: wifiHalUtiles.cpp:3955
WiFiStatusCode_t
enum _WiFiStatusCode_t WiFiStatusCode_t
isWiFiCapable
bool isWiFiCapable()
This function is used to check whether the device supports wireless communication or not.
Definition: wifiHalUtiles.cpp:1922
IARM_BUS_IRMGR_EVENT_IRKEY
@ IARM_BUS_IRMGR_EVENT_IRKEY
Definition: irMgr.h:220
wifi_getRadioIEEE80211hEnabled
int wifi_getRadioIEEE80211hEnabled(int radioIndex, unsigned char *enable)
Get the 80211h feature enable.
wifi_getRadioChannelsInUse
int wifi_getRadioChannelsInUse(int radioIndex, char *output_string)
Gets the list of channels currently in use.
_WiFiConnectedSSIDInfo
Definition: wifiSrvMgrIarmIf.h:211
_ssidList
Definition: wifiSrvMgrIarmIf.h:164
IARM_BUS_WIFI_MGR_API_cancelWPSPairing
#define IARM_BUS_WIFI_MGR_API_cancelWPSPairing
Definition: wifiSrvMgrIarmIf.h:62
RETURN_OK
#define RETURN_OK
Defines for function returns.
Definition: wifi_common_hal.h:218
getEndPointInfo
void getEndPointInfo(WiFi_EndPoint_Diag_Params *)
This function checks for WIFI connection enable status, If connection enabled, then it provide WIFI s...
Definition: wifiHalUtiles.cpp:3364
IARM_BUS_WIFI_MGR_API_initiateWPSPairing2
#define IARM_BUS_WIFI_MGR_API_initiateWPSPairing2
Definition: wifiSrvMgrIarmIf.h:67
WiFiNetworkMgr
Definition: wifiSrvMgr.h:29
wifi_getRadioExtChannel
int wifi_getRadioExtChannel(int radioIndex, char *output_string)
Get the secondary extension channel position.
IARM_BUS_WIFI_MGR_API_disconnectSSID
#define IARM_BUS_WIFI_MGR_API_disconnectSSID
Definition: wifiSrvMgrIarmIf.h:70
_WiFiPairedSSIDInfo
Definition: wifiSrvMgrIarmIf.h:224
wifi_getRadioIEEE80211hSupported
int wifi_getRadioIEEE80211hSupported(int radioIndex, unsigned char *Supported)
Function to check 80211h is supported or not.
get_WifiConnectionType
WiFiConnectionTypeCode_t get_WifiConnectionType()
This function is used to get WIFI connection type.
Definition: wifiHalUtiles.cpp:541
wifi_getRadioOperatingFrequencyBand
int wifi_getRadioOperatingFrequencyBand(int radioIndex, char *output_string)
Get the frequency band at which the radio is operating.
WIFI_CONNECTED
@ WIFI_CONNECTED
Definition: wifiSrvMgrIarmIf.h:99
WIFI_DISCONNECTED
@ WIFI_DISCONNECTED
Definition: wifiSrvMgrIarmIf.h:96
_netMgrConfigProps
Definition: NetworkMgrMain.h:141
wifi_getRadioSupportedFrequencyBands
int wifi_getRadioSupportedFrequencyBands(int radioIndex, char *output_string)
Get Supported frequency bands at which the radio can operate.
IARM_BUS_WIFI_MGR_API_isPaired
#define IARM_BUS_WIFI_MGR_API_isPaired
Definition: wifiSrvMgrIarmIf.h:72
IARM_BUS_WIFI_MGR_API_isAutoSwitchToPrivateEnabled
#define IARM_BUS_WIFI_MGR_API_isAutoSwitchToPrivateEnabled
Definition: wifiSrvMgrIarmIf.h:77
wifi_getRadioAutoChannelRefreshPeriod
int wifi_getRadioAutoChannelRefreshPeriod(int radioIndex, unsigned long *output_ulong)
Get the Auto Channel Selection / Dynamic channel selection refresh period in seconds.
IARM_Bus_RegisterEvent
IARM_Result_t IARM_Bus_RegisterEvent(IARM_EventId_t maxEventId)
This API is used to register all the events that are published by the application.
IARM_BUS_WIFI_MGR_API_getEndPointProps
#define IARM_BUS_WIFI_MGR_API_getEndPointProps
Definition: wifiSrvMgrIarmIf.h:86
_wifiLnfPrivateResults::jdata
char jdata[(48 *1024)]
Definition: wifiSrvMgrIarmIf.h:180
IARM_Bus_RegisterEventHandler
IARM_Result_t IARM_Bus_RegisterEventHandler(const char *ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler)
This API register to listen to event and provide the callback function for event notification....
Definition: iarmMgrMocks.cpp:43
IARM_BUS_WIFI_MGR_API_setEnabled
#define IARM_BUS_WIFI_MGR_API_setEnabled
Definition: wifiSrvMgrIarmIf.h:64
getConnectedSSIDInfo
void getConnectedSSIDInfo(WiFiConnectedSSIDInfo_t *)
This function is used to get the connected SSID informations such as SSID, BSSID, signal strength etc...
IARM_Bus_RegisterCall
IARM_Result_t IARM_Bus_RegisterCall(const char *methodName, IARM_BusCall_t handler)
This API is used to register an RPC method that can be invoked by other applications.
netsrvmgrUtiles.h
The header file provides components netSrvMgrUtiles information APIs.
IARM_BUS_WIFI_MGR_API_getLNFState
#define IARM_BUS_WIFI_MGR_API_getLNFState
Definition: wifiSrvMgrIarmIf.h:73
IARM_BUS_WIFI_MGR_API_connect
#define IARM_BUS_WIFI_MGR_API_connect
Definition: wifiSrvMgrIarmIf.h:65
getRadioStats
bool getRadioStats(WiFi_Radio_Stats_Diag_Params *params)
This function is used to get detail radio traffic statistics information.
IARM_BUS_WIFI_MGR_EVENT_MAX
@ IARM_BUS_WIFI_MGR_EVENT_MAX
Definition: wifiSrvMgrIarmIf.h:307
_wifi_telemetry_ops_t
Telemetry callback functions.
Definition: wifi_client_hal.h:378
wifi_getRadioAutoChannelSupported
int wifi_getRadioAutoChannelSupported(int radioIndex, unsigned char *output_bool)
Check if the driver support the Auto Channel Selection / Dynamic channel selection.
_IARM_BUS_WiFi_DiagsPropParam_t
Definition: wifiSrvMgrIarmIf.h:396
netSrvMgrUtiles::getMacAddress_IfName
bool getMacAddress_IfName(const char *ifName_in, char macAddress_out[18])
This function is used to get the MAC address for the provided interface.
wifi_getBaseBSSID
int wifi_getBaseBSSID(int ssidIndex, char *output_string)
Get the BSSID. Basic Service Set Identifier (BSSID) is the mac addresss of the wireless access point.
ethernet_on
bool ethernet_on()
This function is used to get the ethernet connection ON/OFF status in order to proceed with IARM bus ...
Definition: wifiHalUtiles.cpp:387
wifi_getRadioTransmitPower
int wifi_getRadioTransmitPower(int radioIndex, int *output_INT)
Get the current transmit Power.
wifi_telemetry_callback_register
void wifi_telemetry_callback_register(wifi_telemetry_ops_t *telemetry_ops)
Definition: wifi_client_hal.c:250
wifi_getSSIDName
int wifi_getSSIDName(int apIndex, char *output_string)
Get SSID name.
IARM_BUS_WIFI_MGR_API_getCurrentState
#define IARM_BUS_WIFI_MGR_API_getCurrentState
Definition: wifiSrvMgrIarmIf.h:60
_WiFiConnectionStatus
Definition: wifiSrvMgrIarmIf.h:204
WIFI_DISABLED
@ WIFI_DISABLED
Definition: wifiSrvMgrIarmIf.h:95
wifi_getRadioMCS
int wifi_getRadioMCS(int radioIndex, int *output_INT)
Get the Modulation Coding Scheme index.
IARM_BUS_WIFI_MGR_API_getAvailableSSIDsAsync
#define IARM_BUS_WIFI_MGR_API_getAvailableSSIDsAsync
Definition: wifiSrvMgrIarmIf.h:57
IARM_BUS_WIFI_MGR_API_getRadioStatsProps
#define IARM_BUS_WIFI_MGR_API_getRadioStatsProps
Definition: wifiSrvMgrIarmIf.h:83
IARM_Bus_BroadcastEvent
IARM_Result_t IARM_Bus_BroadcastEvent(const char *ownerName, IARM_EventId_t eventId, void *data, size_t len)
This API is used to publish an Asynchronous event to all IARM client registered for this perticular e...
wifi_getRadioNumberOfEntries
int wifi_getRadioNumberOfEntries(unsigned long *output)
Get total number of radios in the wifi subsystem.
wifi_getRadioEnable
int wifi_getRadioEnable(int radioIndex, unsigned char *output_bool)
Get the Radio enable config parameter.
SsidSecurity
enum _SsidSecurity SsidSecurity
IARM_BUS_IRMGR_NAME
#define IARM_BUS_IRMGR_NAME
Definition: irMgr.h:216
_wifiSsidData_t::jdata
char jdata[(48 *1024)]
Definition: wifiSrvMgrIarmIf.h:175
IARM_BUS_WIFI_MGR_API_setRadioProps
#define IARM_BUS_WIFI_MGR_API_setRadioProps
Definition: wifiSrvMgrIarmIf.h:84
IARM_BUS_WIFI_MGR_API_saveSSID
#define IARM_BUS_WIFI_MGR_API_saveSSID
Definition: wifiSrvMgrIarmIf.h:68
WiFiNetworkMgr::create_wpa_supplicant_conf_from_netapp_db
int create_wpa_supplicant_conf_from_netapp_db(const char *wpa_supplicant_conf_file, const char *netapp_db_file)
This function 1. Extract "SSID", "BSSID", "Password", "Security" from specified netapp_db_file.
Definition: wifiSrvMgr.cpp:130
IARM_BUS_WIFI_MGR_API_getAvailableSSIDsAsyncIncr
#define IARM_BUS_WIFI_MGR_API_getAvailableSSIDsAsyncIncr
Definition: wifiSrvMgrIarmIf.h:58
wifi_getRadioMaxBitRate
int wifi_getRadioMaxBitRate(int radioIndex, char *output_string)
Get the maximum PHY bit rate supported by the interface.
_wifiLnfPrivateResults::jdataLen
size_t jdataLen
Definition: wifiSrvMgrIarmIf.h:181
IARM_BUS_WIFI_MGR_API_getConnectedSSID
#define IARM_BUS_WIFI_MGR_API_getConnectedSSID
Definition: wifiSrvMgrIarmIf.h:61
wifi_getRadioTransmitPowerSupported
int wifi_getRadioTransmitPowerSupported(int radioIndex, char *output_list)
Get supported Transmit Power list.
IARM_BUS_WIFI_MGR_API_clearSSID
#define IARM_BUS_WIFI_MGR_API_clearSSID
Definition: wifiSrvMgrIarmIf.h:69
wifi_getRadioStandard
int wifi_getRadioStandard(int radioIndex, char *output_string, unsigned char *gOnly, unsigned char *nOnly, unsigned char *acOnly)
Get the radio operating mode and pure mode flag. Mode flags are the IEEE 802.11 standards to indicate...
IARM_BUS_WIFI_MGR_API_getConnectionType
#define IARM_BUS_WIFI_MGR_API_getConnectionType
Definition: wifiSrvMgrIarmIf.h:75
wifi_getSSIDNumberOfEntries
int wifi_getSSIDNumberOfEntries(unsigned long *output)
Get the total number of SSID entries in the wifi subsystem.
wifi_getRegulatoryDomain
int wifi_getRegulatoryDomain(int radioIndex, char *output_string)
Gets the Access Point regulatory domain.
IARM_BUS_WIFI_MGR_API_getSwitchToPrivateResults
#define IARM_BUS_WIFI_MGR_API_getSwitchToPrivateResults
Definition: wifiSrvMgrIarmIf.h:76
IARM_BUS_WIFI_MGR_API_getPairedSSID
#define IARM_BUS_WIFI_MGR_API_getPairedSSID
Definition: wifiSrvMgrIarmIf.h:71
wifi_getRadioChannel
int wifi_getRadioChannel(int radioIndex, unsigned long *output_ulong)
Get the running channel number.
IARM_BUS_WIFI_MGR_API_getRadioProps
#define IARM_BUS_WIFI_MGR_API_getRadioProps
Definition: wifiSrvMgrIarmIf.h:82
_IARM_Bus_WiFiSrvMgr_SpecificSsidList_Param_t
Definition: wifiSrvMgrIarmIf.h:250
keyType
Definition: reset.c:85
IARM_BUS_WIFI_MGR_API_stopProgressiveWifiScanning
#define IARM_BUS_WIFI_MGR_API_stopProgressiveWifiScanning
Definition: wifiSrvMgrIarmIf.h:59
IARM_BUS_WIFI_MGR_API_getAvailableSSIDs
#define IARM_BUS_WIFI_MGR_API_getAvailableSSIDs
Definition: wifiSrvMgrIarmIf.h:55
wifi_getRadioOperatingChannelBandwidth
int wifi_getRadioOperatingChannelBandwidth(int radioIndex, char *output_string)
Get the Operating Channel Bandwidth.
_IARM_Bus_WiFiSrvMgr_WPS_Parameters_t
Definition: wifiSrvMgrIarmIf.h:277
_IARM_BUS_WiFiSrvMgr_EventData_t
Definition: wifiSrvMgrIarmIf.h:285
wifi_init
int wifi_init()
Initializes the wifi subsystem.
Definition: wifi_common_hal.c:383
wifi_getRadioStatus
int wifi_getRadioStatus(int radioIndex, char *output_string)
Get the Radio enable status.
_wifiSsidData_t::jdataLen
size_t jdataLen
Definition: wifiSrvMgrIarmIf.h:176
wifi_connectEndpoint_callback_register
void wifi_connectEndpoint_callback_register(wifi_connectEndpoint_callback callback_proc)
Callback registration function.
Definition: wifi_client_hal.c:238
LOG_INFO
#define LOG_INFO(AAMP_JS_OBJECT, FORMAT,...)
Definition: jsutils.h:39
wifi_getRadioSupportedStandards
int wifi_getRadioSupportedStandards(int radioIndex, char *output_string)
Get Supported frequency bands at which the radio can operate.
_IRMgr_EventData_t
Definition: irMgr.h:235
_IARM_Bus_WiFiSrvMgr_SsidList_Param_t
Definition: wifiSrvMgrIarmIf.h:240
get_WifiRadioStatus
WiFiStatusCode_t get_WifiRadioStatus()
This function is used to get WIFI connectivity status.
Definition: wifiHalUtiles.cpp:518
wifi_getRadioPossibleChannels
int wifi_getRadioPossibleChannels(int radioIndex, char *output_string)
Gets the supported channel list.
IARM_BUS_WIFI_MGR_API_getSSIDProps
#define IARM_BUS_WIFI_MGR_API_getSSIDProps
Definition: wifiSrvMgrIarmIf.h:85
IARM_BUS_WIFI_MGR_API_getAvailableSSIDsWithName
#define IARM_BUS_WIFI_MGR_API_getAvailableSSIDsWithName
Definition: wifiSrvMgrIarmIf.h:56
_IARM_BUS_NetworkManager_EventData_t
Definition: wifiSrvMgrIarmIf.h:425
wifi_disconnectEndpoint_callback_register
void wifi_disconnectEndpoint_callback_register(wifi_disconnectEndpoint_callback callback_proc)
Callback registration function.
Definition: wifi_client_hal.c:244
IARM_BUS_WIFI_MGR_API_getPairedSSIDInfo
#define IARM_BUS_WIFI_MGR_API_getPairedSSIDInfo
Definition: wifiSrvMgrIarmIf.h:78
_IARM_Bus_WiFiSrvMgr_Param_t
Definition: wifiSrvMgrIarmIf.h:258
get_CurrentSsidInfo
void get_CurrentSsidInfo(WiFiConnectionStatus *currSsidConnInfo)
This function is used to get current SSID and connection status from persistent memory.
Definition: wifiHalUtiles.cpp:512
wifi_getRadioAutoChannelEnable
int wifi_getRadioAutoChannelEnable(int radioIndex, unsigned char *output_bool)
Get the Auto Channel Selection / Dynamic channel selection enable status.
LOG_TRACE
#define LOG_TRACE
Definition: rdk_debug_priv.c:83
WiFiLNFStatusCode_t
enum _WiFiLNFStatusCode_t WiFiLNFStatusCode_t
WIFI_UNINSTALLED
@ WIFI_UNINSTALLED
Definition: wifiSrvMgrIarmIf.h:94