@@ -62,29 +62,7 @@ int arduino::WiFiClass::beginAP(const char* ssid, const char *passphrase, uint8_
6262
6363 nsapi_error_t registrationResult;
6464 softAPInterface->unregister_event_handler ();
65- registrationResult = softAPInterface->register_event_handler ([](whd_interface_t ifp, const whd_event_header_t *event_header, const uint8_t *event_data, void *handler_user_data) -> void *{
66-
67- if (event_header->event_type == WLC_E_ASSOC_IND){
68- WiFi._currentNetworkStatus = WL_AP_CONNECTED;
69- } else if (event_header->event_type == WLC_E_DISASSOC_IND){
70- WiFi._currentNetworkStatus = WL_AP_LISTENING;
71- }
72-
73- // Default Event Handler
74- whd_driver_t whd_driver = ifp->whd_driver ;
75- WHD_IOCTL_LOG_ADD_EVENT (whd_driver, event_header->event_type , event_header->flags , event_header->reason );
76-
77- if ((event_header->event_type == (whd_event_num_t )WLC_E_LINK) || (event_header->event_type == WLC_E_IF)) {
78- if (osSemaphoreGetCount (whd_driver->ap_info .whd_wifi_sleep_flag ) < 1 ) {
79- osStatus_t result = osSemaphoreRelease (whd_driver->ap_info .whd_wifi_sleep_flag );
80- if (result != osOK) {
81- printf (" Release whd_wifi_sleep_flag ERROR: %d" , result);
82- }
83- }
84- }
85-
86- return handler_user_data;
87- });
65+ registrationResult = softAPInterface->register_event_handler (arduino::WiFiClass::handleAPEvents);
8866
8967 if (registrationResult != NSAPI_ERROR_OK) {
9068 return (_currentNetworkStatus = WL_AP_FAILED);
@@ -94,6 +72,29 @@ int arduino::WiFiClass::beginAP(const char* ssid, const char *passphrase, uint8_
9472 return _currentNetworkStatus;
9573}
9674
75+ void * arduino::WiFiClass::handleAPEvents (whd_interface_t ifp, const whd_event_header_t *event_header, const uint8_t *event_data, void *handler_user_data){
76+ if (event_header->event_type == WLC_E_ASSOC_IND){
77+ WiFi._currentNetworkStatus = WL_AP_CONNECTED;
78+ } else if (event_header->event_type == WLC_E_DISASSOC_IND){
79+ WiFi._currentNetworkStatus = WL_AP_LISTENING;
80+ }
81+
82+ // Default Event Handler
83+ whd_driver_t whd_driver = ifp->whd_driver ;
84+ WHD_IOCTL_LOG_ADD_EVENT (whd_driver, event_header->event_type , event_header->flags , event_header->reason );
85+
86+ if ((event_header->event_type == (whd_event_num_t )WLC_E_LINK) || (event_header->event_type == WLC_E_IF)) {
87+ if (osSemaphoreGetCount (whd_driver->ap_info .whd_wifi_sleep_flag ) < 1 ) {
88+ osStatus_t result = osSemaphoreRelease (whd_driver->ap_info .whd_wifi_sleep_flag );
89+ if (result != osOK) {
90+ printf (" Release whd_wifi_sleep_flag ERROR: %d" , result);
91+ }
92+ }
93+ }
94+
95+ return handler_user_data;
96+ }
97+
9798void arduino::WiFiClass::ensureDefaultAPNetworkConfiguration () {
9899 if (_ip == nullptr ){
99100 _ip = SocketAddress (DEFAULT_IP_ADDRESS);
0 commit comments