diff --git a/src/platform/Tizen/BLEManagerImpl.cpp b/src/platform/Tizen/BLEManagerImpl.cpp index f45e1e579d1359..dad3c6a1006ce3 100644 --- a/src/platform/Tizen/BLEManagerImpl.cpp +++ b/src/platform/Tizen/BLEManagerImpl.cpp @@ -102,13 +102,13 @@ gboolean BLEManagerImpl::_BleInitialize(void * userData) ret = bt_initialize(); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_initialize() failed. ret: %d", ret)); - ret = bt_adapter_set_state_changed_cb(__AdapterStateChangedCb, NULL); + ret = bt_adapter_set_state_changed_cb(__AdapterStateChangedCb, nullptr); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_adapter_set_state_changed_cb() failed. ret: %d", ret)); ret = bt_gatt_server_initialize(); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_initialize() failed. ret: %d", ret)); - ret = bt_gatt_set_connection_state_changed_cb(GattConnectionStateChangedCb, NULL); + ret = bt_gatt_set_connection_state_changed_cb(GattConnectionStateChangedCb, nullptr); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_adapter_set_state_changed_cb() failed. ret: %d", ret)); sInstance.InitConnectionData(); @@ -143,7 +143,7 @@ static const char * __ConvertAttTypeToStr(int type) case BT_GATT_TYPE_DESCRIPTOR: return "Descriptor"; default: - return NULL; + return nullptr; } } @@ -151,7 +151,7 @@ static void __ReadValueRequestedCb(const char * remoteAddress, int requestId, bt int offset, void * userData) { int ret, len = 0, type = 0; - char *value = NULL, *uuid = NULL; + char *value = nullptr, *uuid = nullptr; __GetAttInfo(gattHandle, &uuid, &type); ChipLogProgress(DeviceLayer, "Read Requested on %s(%s)", __ConvertAttTypeToStr(type), uuid); @@ -171,7 +171,7 @@ void BLEManagerImpl::WriteValueRequestedCb(const char * remoteAddress, int reque bool responseNeeded, int offset, const char * value, int len, void * userData) { int ret, type = 0; - char * uuid = NULL; + char * uuid = nullptr; BLEConnection * conn = nullptr; conn = static_cast(g_hash_table_lookup(sInstance.mConnectionMap, remoteAddress)); @@ -187,7 +187,7 @@ void BLEManagerImpl::WriteValueRequestedCb(const char * remoteAddress, int reque ret = bt_gatt_set_value(gattHandle, value, len); VerifyOrReturn(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_set_value() failed. ret: %d", ret)); - ret = bt_gatt_server_send_response(requestId, BT_GATT_REQUEST_TYPE_WRITE, offset, 0x00, NULL, 0); + ret = bt_gatt_server_send_response(requestId, BT_GATT_REQUEST_TYPE_WRITE, offset, 0x00, nullptr, 0); VerifyOrReturn(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_send_response() failed. ret: %d", ret)); sInstance.HandleC1CharWriteEvent(conn, (const uint8_t *) value, len); @@ -196,7 +196,7 @@ void BLEManagerImpl::WriteValueRequestedCb(const char * remoteAddress, int reque void BLEManagerImpl::NotificationStateChangedCb(bool notify, bt_gatt_server_h server, bt_gatt_h gattHandle, void * userData) { int type = 0; - char * uuid = NULL; + char * uuid = nullptr; BLEConnection * conn = nullptr; GHashTableIter iter; gpointer key, value; @@ -504,10 +504,10 @@ int BLEManagerImpl::RegisterGATTServer() { int ret = BT_ERROR_NONE; - bt_gatt_server_h server = NULL; - bt_gatt_h service = NULL; - bt_gatt_h char1 = NULL, char2 = NULL; - bt_gatt_h desc = NULL; + bt_gatt_server_h server = nullptr; + bt_gatt_h service = nullptr; + bt_gatt_h char1 = nullptr, char2 = nullptr; + bt_gatt_h desc = nullptr; char desc_value[2] = { 0, 0 }; ChipLogProgress(DeviceLayer, "Start GATT Service Registration"); @@ -529,7 +529,7 @@ int BLEManagerImpl::RegisterGATTServer() "CHIPoBLE_C1", strlen("CHIPoBLE_C1"), &char1); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_characteristic_create() failed. ret: %d", ret)); - ret = bt_gatt_server_set_write_value_requested_cb(char1, WriteValueRequestedCb, NULL); + ret = bt_gatt_server_set_write_value_requested_cb(char1, WriteValueRequestedCb, nullptr); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_set_write_value_requested_cb() failed. ret: %d", ret)); ret = bt_gatt_service_add_characteristic(service, char1); @@ -541,10 +541,10 @@ int BLEManagerImpl::RegisterGATTServer() &char2); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_characteristic_create() failed. ret: %d", ret)); - ret = bt_gatt_server_set_read_value_requested_cb(char2, __ReadValueRequestedCb, NULL); + ret = bt_gatt_server_set_read_value_requested_cb(char2, __ReadValueRequestedCb, nullptr); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_set_read_value_requested_cb() failed. ret: %d", ret)); - ret = bt_gatt_server_set_characteristic_notification_state_change_cb(char2, NotificationStateChangedCb, NULL); + ret = bt_gatt_server_set_characteristic_notification_state_change_cb(char2, NotificationStateChangedCb, nullptr); VerifyOrExit( ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_set_characteristic_notification_state_change_cb() failed. ret: %d", ret)); @@ -600,7 +600,7 @@ int BLEManagerImpl::StartAdvertising() ChipLogProgress(DeviceLayer, "Start Advertising"); - if (mAdvertiser == NULL) + if (mAdvertiser == nullptr) { ret = bt_adapter_le_create_advertiser(&mAdvertiser); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_adapter_le_create_advertiser() failed. ret: %d", ret)); @@ -641,7 +641,7 @@ int BLEManagerImpl::StartAdvertising() BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(true, nullptr); - ret = bt_adapter_le_start_advertising_new(mAdvertiser, AdvertisingStateChangedCb, NULL); + ret = bt_adapter_le_start_advertising_new(mAdvertiser, AdvertisingStateChangedCb, nullptr); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_adapter_le_start_advertising_new() failed. ret: %d", ret)); sInstance.mAdvReqInProgress = true; return ret; @@ -679,7 +679,7 @@ void BLEManagerImpl::InitConnectionData(void) static bool __GattClientForeachCharCb(int total, int index, bt_gatt_h charHandle, void * data) { int type; - char * uuid = NULL; + char * uuid = nullptr; auto conn = static_cast(data); if (__GetAttInfo(charHandle, &uuid, &type) == BT_ERROR_NONE) @@ -703,7 +703,7 @@ static bool __GattClientForeachCharCb(int total, int index, bt_gatt_h charHandle static bool __GattClientForeachServiceCb(int total, int index, bt_gatt_h svcHandle, void * data) { int type; - char * uuid = NULL; + char * uuid = nullptr; auto conn = static_cast(data); ChipLogProgress(DeviceLayer, "__GattClientForeachServiceCb"); @@ -743,7 +743,7 @@ void BLEManagerImpl::AddConnectionData(const char * remoteAddr) if (!g_hash_table_lookup(mConnectionMap, remoteAddr)) { - ChipLogProgress(DeviceLayer, "Not Found in Map"); + ChipLogProgress(DeviceLayer, "Connection not found in map [%s]", remoteAddr); conn = static_cast(g_malloc0(sizeof(BLEConnection))); conn->peerAddr = g_strdup(remoteAddr); @@ -782,10 +782,10 @@ void BLEManagerImpl::RemoveConnectionData(const char * remoteAddr) BLEConnection * conn = nullptr; ChipLogProgress(DeviceLayer, "Connection Remove Request for [%s]", remoteAddr); - VerifyOrReturn(mConnectionMap != nullptr, ChipLogError(DeviceLayer, "connection map does not exist")); + VerifyOrReturn(mConnectionMap != nullptr, ChipLogError(DeviceLayer, "Connection map does not exist")); conn = static_cast(g_hash_table_lookup(mConnectionMap, remoteAddr)); - VerifyOrReturn(conn != nullptr, ChipLogError(DeviceLayer, "connection does not exist for [%s]", remoteAddr)); + VerifyOrReturn(conn != nullptr, ChipLogError(DeviceLayer, "Connection does not exist for [%s]", remoteAddr)); g_hash_table_remove(mConnectionMap, conn->peerAddr); @@ -889,7 +889,7 @@ void BLEManagerImpl::DriveBLEState() ret = bt_adapter_le_destroy_advertiser(mAdvertiser); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_adapter_le_destroy_advertiser() failed. ret: %d", ret)); - mAdvertiser = NULL; + mAdvertiser = nullptr; } exit: @@ -970,9 +970,9 @@ CHIP_ERROR BLEManagerImpl::_GetDeviceName(char * buf, size_t bufSize) { CHIP_ERROR err = CHIP_NO_ERROR; int ret; - char * deviceName = NULL; + char * deviceName = nullptr; - VerifyOrExit(buf != NULL, err = CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrExit(buf != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); ret = bt_adapter_get_name(&deviceName); if (ret != BT_ERROR_NONE) @@ -981,7 +981,7 @@ CHIP_ERROR BLEManagerImpl::_GetDeviceName(char * buf, size_t bufSize) return CHIP_ERROR_INTERNAL; } - VerifyOrExit(deviceName != NULL, err = CHIP_ERROR_INTERNAL); + VerifyOrExit(deviceName != nullptr, err = CHIP_ERROR_INTERNAL); VerifyOrExit(strlen(deviceName) >= bufSize, err = CHIP_ERROR_BUFFER_TOO_SMALL); g_strlcpy(buf, deviceName, bufSize); @@ -996,7 +996,7 @@ CHIP_ERROR BLEManagerImpl::_SetDeviceName(const char * deviceName) CHIP_ERROR err = CHIP_NO_ERROR; int ret; - VerifyOrExit(deviceName != NULL, err = CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrExit(deviceName != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); ret = bt_adapter_set_name(deviceName); if (ret != BT_ERROR_NONE) @@ -1248,7 +1248,7 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU ChipLogProgress(DeviceLayer, "Sending indication for CHIPoBLE RX characteristic (con %s, len %u)", conn->peerAddr, pBuf->DataLength()); - ret = bt_gatt_server_notify_characteristic_changed_value(mGattCharC2Handle, IndicationConfirmationCb, conn->peerAddr, NULL); + ret = bt_gatt_server_notify_characteristic_changed_value(mGattCharC2Handle, IndicationConfirmationCb, conn->peerAddr, nullptr); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_notify_characteristic_changed_value() failed. ret: %d", ret)); return true; @@ -1318,7 +1318,7 @@ void BLEManagerImpl::InitiateScan(BleScanState scanType) { CHIP_ERROR err = CHIP_NO_ERROR; ScanFilterData data = { - 0x0, + { 0x0 }, }; ChipLogProgress(DeviceLayer, "Initiate Scan"); diff --git a/src/platform/Tizen/ChipDeviceScanner.cpp b/src/platform/Tizen/ChipDeviceScanner.cpp index 4a278438390640..09973ccdda0945 100644 --- a/src/platform/Tizen/ChipDeviceScanner.cpp +++ b/src/platform/Tizen/ChipDeviceScanner.cpp @@ -102,7 +102,7 @@ static bool __IsChipThingDevice(bt_adapter_le_device_scan_result_info_s * info, if (!info) return false; - ChipLogError(DeviceLayer, "Is [%s] ChipThingDevice ?: Check now", info->remote_address); + ChipLogProgress(DeviceLayer, "Is [%s] ChipThingDevice ?: Check now", info->remote_address); if (bt_adapter_le_get_scan_result_service_data_list(info, BT_ADAPTER_LE_PACKET_ADVERTISING, &dataList, &count) == BT_ERROR_NONE) { @@ -239,7 +239,10 @@ CHIP_ERROR ChipDeviceScanner::StopChipScan(void) ReturnErrorCodeIf(!mIsScanning, CHIP_ERROR_INCORRECT_STATE); ret = bt_adapter_le_stop_scan(); - ChipLogError(DeviceLayer, "bt_adapter_le_stop_scan() ret: %d", ret); + if (ret != BT_ERROR_NONE) + { + ChipLogError(DeviceLayer, "bt_adapter_le_stop_scan() failed. ret: %d", ret); + } g_main_loop_quit(mAsyncLoop); ChipLogProgress(DeviceLayer, "CHIP Scanner Async Thread Quit Done..Wait for Thread Windup...!"); diff --git a/src/platform/Tizen/ConnectivityManagerImpl.cpp b/src/platform/Tizen/ConnectivityManagerImpl.cpp index 23421b8598a92d..b761847efff1e7 100644 --- a/src/platform/Tizen/ConnectivityManagerImpl.cpp +++ b/src/platform/Tizen/ConnectivityManagerImpl.cpp @@ -197,12 +197,12 @@ void ConnectivityManagerImpl::_SetWiFiAPIdleTimeout(System::Clock::Timeout val) void ConnectivityManagerImpl::StartWiFiManagement(void) { - SystemLayer().ScheduleWork(ActivateWiFiManager, NULL); + SystemLayer().ScheduleWork(ActivateWiFiManager, nullptr); } void ConnectivityManagerImpl::StopWiFiManagement(void) { - SystemLayer().ScheduleWork(DeactivateWiFiManager, NULL); + SystemLayer().ScheduleWork(DeactivateWiFiManager, nullptr); } void ConnectivityManagerImpl::ActivateWiFiManager(::chip::System::Layer * aLayer, void * aAppState) diff --git a/src/platform/Tizen/DnssdImpl.cpp b/src/platform/Tizen/DnssdImpl.cpp index 8631a306287592..c7ea1bceefd843 100644 --- a/src/platform/Tizen/DnssdImpl.cpp +++ b/src/platform/Tizen/DnssdImpl.cpp @@ -122,7 +122,7 @@ void OnRegister(dnssd_error_e error, dnssd_service_h service, void * data) g_main_loop_quit(loop); - VerifyOrReturn(CheckForSuccess(rCtx, (int) error, __func__)); + VerifyOrReturn(CheckForSuccess(rCtx, static_cast(error), __func__)); rCtx->isRegistered = true; ChipLogDetail(DeviceLayer, "Dnssd: %s name: %s, type: %s, port: %u, interfaceId: %u", __func__, rCtx->name, rCtx->type, rCtx->port, rCtx->interfaceId); @@ -319,7 +319,7 @@ gboolean BrowseAsync(GMainLoop * mainLoop, gpointer userData) dnssd_browser_h browser; if (interfaceId == 0) { - ret = dnssd_browse_service(bCtx->type, NULL, &browser, OnBrowse, bCtx); + ret = dnssd_browse_service(bCtx->type, nullptr, &browser, OnBrowse, bCtx); } else { @@ -500,7 +500,7 @@ CHIP_ERROR Resolve(uint32_t interfaceId, const char * type, const char * name, D if (interfaceId == 0) { - ret = dnssd_create_remote_service(type, name, NULL, &service); + ret = dnssd_create_remote_service(type, name, nullptr, &service); } else { diff --git a/src/platform/Tizen/MainLoop.cpp b/src/platform/Tizen/MainLoop.cpp index b886bd5933e27e..1b25bcbd63dcd7 100644 --- a/src/platform/Tizen/MainLoop.cpp +++ b/src/platform/Tizen/MainLoop.cpp @@ -31,7 +31,7 @@ gboolean MainLoop::ThreadTimeout(gpointer userData) { LoopData * loopData = reinterpret_cast(userData); - VerifyOrReturnError(loopData != NULL, G_SOURCE_REMOVE); + VerifyOrReturnError(loopData != nullptr, G_SOURCE_REMOVE); if (loopData->mTimeoutFn) { @@ -50,10 +50,10 @@ gboolean MainLoop::ThreadTimeout(gpointer userData) void MainLoop::SetThreadTimeout(LoopData * loopData, guint interval) { - VerifyOrReturn(loopData != NULL); + VerifyOrReturn(loopData != nullptr); GSource * source = g_timeout_source_new_seconds(interval); - g_source_set_callback(source, ThreadTimeout, reinterpret_cast(loopData), NULL); + g_source_set_callback(source, ThreadTimeout, reinterpret_cast(loopData), nullptr); g_source_attach(source, loopData->mMainContext); g_source_unref(source); } @@ -69,14 +69,14 @@ gpointer MainLoop::ThreadMainHandler(gpointer data) g_main_loop_run(loopData->mMainLoop); ChipLogProgress(DeviceLayer, "[QUIT] main loop %p", loopData->mMainLoop); g_main_loop_unref(loopData->mMainLoop); - loopData->mMainLoop = NULL; + loopData->mMainLoop = nullptr; g_main_context_pop_thread_default(loopData->mMainContext); ChipLogProgress(DeviceLayer, "[POP] main context %p", loopData->mMainContext); g_main_context_unref(loopData->mMainContext); - loopData->mMainContext = NULL; + loopData->mMainContext = nullptr; - return NULL; + return nullptr; } gpointer MainLoop::ThreadAsyncHandler(gpointer data) @@ -90,16 +90,16 @@ gpointer MainLoop::ThreadAsyncHandler(gpointer data) g_main_loop_run(loopData->mMainLoop); ChipLogProgress(DeviceLayer, "[QUIT] async loop %p", loopData->mMainLoop); g_main_loop_unref(loopData->mMainLoop); - loopData->mMainLoop = NULL; + loopData->mMainLoop = nullptr; g_main_context_pop_thread_default(loopData->mMainContext); ChipLogProgress(DeviceLayer, "[POP] async context %p", loopData->mMainContext); g_main_context_unref(loopData->mMainContext); - loopData->mMainContext = NULL; + loopData->mMainContext = nullptr; chip::Platform::Delete(loopData); - return NULL; + return nullptr; } bool MainLoop::Init(initFn_t initFn, gpointer userData) @@ -107,7 +107,7 @@ bool MainLoop::Init(initFn_t initFn, gpointer userData) bool result; LoopData * loopData = chip::Platform::New(); - VerifyOrReturnError(loopData != NULL, false); + VerifyOrReturnError(loopData != nullptr, false); loopData->mMainContext = g_main_context_new(); loopData->mMainLoop = g_main_loop_new(loopData->mMainContext, FALSE); @@ -157,7 +157,7 @@ bool MainLoop::AsyncRequest(asyncFn_t asyncFn, gpointer asyncUserData, guint int bool result = false; LoopData * loopData = chip::Platform::New(); - VerifyOrReturnError(loopData != NULL, false); + VerifyOrReturnError(loopData != nullptr, false); loopData->mMainContext = g_main_context_new(); loopData->mMainLoop = g_main_loop_new(loopData->mMainContext, FALSE); diff --git a/src/platform/Tizen/NetworkCommissioningWiFiDriver.cpp b/src/platform/Tizen/NetworkCommissioningWiFiDriver.cpp index 584135266e378a..789d5df1b2f82c 100644 --- a/src/platform/Tizen/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/Tizen/NetworkCommissioningWiFiDriver.cpp @@ -86,7 +86,7 @@ bool TizenWiFiDriver::NetworkMatch(const WiFiNetwork & network, ByteSpan network networkId.size()); return false; } - else if (memcmp(networkId.data(), network.ssid, network.ssidLen) != 0) + if (memcmp(networkId.data(), network.ssid, network.ssidLen) != 0) { ChipLogProgress(NetworkProvisioning, "ssid is mismatched. network.ssid: %s, networkId.data(): %s", network.ssid, networkId.data()); diff --git a/src/platform/Tizen/ThreadStackManagerImpl.cpp b/src/platform/Tizen/ThreadStackManagerImpl.cpp index a5ff9f488431d9..ea156e30ac9949 100644 --- a/src/platform/Tizen/ThreadStackManagerImpl.cpp +++ b/src/platform/Tizen/ThreadStackManagerImpl.cpp @@ -123,7 +123,7 @@ CHIP_ERROR ThreadStackManagerImpl::_InitThreadStack() ThreadDeviceRoleChangedHandler(deviceRole); /* Set callback for change of device role */ - threadErr = thread_set_device_role_changed_cb(mThreadInstance, _ThreadDeviceRoleChangedCb, NULL); + threadErr = thread_set_device_role_changed_cb(mThreadInstance, _ThreadDeviceRoleChangedCb, nullptr); VerifyOrExit(threadErr == THREAD_ERROR_NONE, ChipLogError(DeviceLayer, "FAIL: set device role changed cb")); mIsInitialized = true; @@ -564,7 +564,7 @@ CHIP_ERROR ThreadStackManagerImpl::_SetupSrpHost(const char * aHostName) ChipLogError(DeviceLayer, "FAIL: thread_srp_client_set_host_name"); /* Get external ip address */ - threadErr = thread_get_ipaddr(mThreadInstance, _ThreadIpAddressCb, THREAD_IPADDR_TYPE_MLEID, NULL); + threadErr = thread_get_ipaddr(mThreadInstance, _ThreadIpAddressCb, THREAD_IPADDR_TYPE_MLEID, nullptr); VerifyOrExit(threadErr == THREAD_ERROR_NONE, error = CHIP_ERROR_INTERNAL); return CHIP_NO_ERROR; diff --git a/src/platform/Tizen/WiFiManager.cpp b/src/platform/Tizen/WiFiManager.cpp index 2f28086034e0f2..a04d9751c368c2 100644 --- a/src/platform/Tizen/WiFiManager.cpp +++ b/src/platform/Tizen/WiFiManager.cpp @@ -175,7 +175,7 @@ void WiFiManager::_ActivateCb(wifi_manager_error_e wifiErr, void * userData) } else { - ChipLogProgress(DeviceLayer, "FAIL: activate WiFi [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: activate WiFi [%s]", get_error_message(wifiErr)); } g_main_loop_quit(loop); @@ -191,7 +191,7 @@ void WiFiManager::_DeactivateCb(wifi_manager_error_e wifiErr, void * userData) } else { - ChipLogProgress(DeviceLayer, "FAIL: deactivate WiFi [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: deactivate WiFi [%s]", get_error_message(wifiErr)); } g_main_loop_quit(loop); @@ -200,21 +200,21 @@ void WiFiManager::_DeactivateCb(wifi_manager_error_e wifiErr, void * userData) void WiFiManager::_ScanFinishedCb(wifi_manager_error_e wifiErr, void * userData) { GMainLoop * loop = (GMainLoop *) userData; - wifi_manager_ap_h foundAp = NULL; + wifi_manager_ap_h foundAp = nullptr; if (wifiErr == WIFI_MANAGER_ERROR_NONE) { ChipLogProgress(DeviceLayer, "WiFi scan finished"); foundAp = sInstance._WiFiGetFoundAP(); - if (foundAp != NULL) + if (foundAp != nullptr) { MainLoop::Instance().AsyncRequest(_WiFiConnect, static_cast(foundAp)); } } else { - ChipLogProgress(DeviceLayer, "FAIL: scan WiFi [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: scan WiFi [%s]", get_error_message(wifiErr)); } g_main_loop_quit(loop); @@ -224,30 +224,29 @@ bool WiFiManager::_FoundAPCb(wifi_manager_ap_h ap, void * userData) { bool cbRet = true; int wifiErr = WIFI_MANAGER_ERROR_NONE; - char * essid = NULL; + char * essid = nullptr; bool isPassphraseRequired = false; wifi_manager_ap_h * clonedAp = (wifi_manager_ap_h *) userData; wifiErr = wifi_manager_ap_get_essid(ap, &essid); VerifyOrExit(wifiErr == WIFI_MANAGER_ERROR_NONE, - ChipLogProgress(DeviceLayer, "FAIL: get AP essid [%s]", get_error_message(wifiErr))); + ChipLogError(DeviceLayer, "FAIL: get AP essid [%s]", get_error_message(wifiErr))); VerifyOrExit(strcmp(sInstance.mWiFiSSID, essid) == 0, ); wifiErr = wifi_manager_ap_is_passphrase_required(ap, &isPassphraseRequired); VerifyOrExit(wifiErr == WIFI_MANAGER_ERROR_NONE, - ChipLogProgress(DeviceLayer, "FAIL: get AP passphrase required [%s]", get_error_message(wifiErr))); + ChipLogError(DeviceLayer, "FAIL: get AP passphrase required [%s]", get_error_message(wifiErr))); if (isPassphraseRequired) { wifiErr = wifi_manager_ap_set_passphrase(ap, sInstance.mWiFiKey); VerifyOrExit(wifiErr == WIFI_MANAGER_ERROR_NONE, - ChipLogProgress(DeviceLayer, "FAIL: set AP passphrase [%s]", get_error_message(wifiErr))); + ChipLogError(DeviceLayer, "FAIL: set AP passphrase [%s]", get_error_message(wifiErr))); } wifiErr = wifi_manager_ap_clone(clonedAp, ap); - VerifyOrExit(wifiErr == WIFI_MANAGER_ERROR_NONE, - ChipLogProgress(DeviceLayer, "FAIL: clone AP [%s]", get_error_message(wifiErr))); + VerifyOrExit(wifiErr == WIFI_MANAGER_ERROR_NONE, ChipLogError(DeviceLayer, "FAIL: clone AP [%s]", get_error_message(wifiErr))); cbRet = false; @@ -273,7 +272,7 @@ void WiFiManager::_ConnectedCb(wifi_manager_error_e wifiErr, void * userData) } else { - ChipLogProgress(DeviceLayer, "FAIL: connect WiFi [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: connect WiFi [%s]", get_error_message(wifiErr)); if (sInstance.mpConnectCallback != nullptr) { sInstance.mpConnectCallback->OnResult(NetworkCommissioning::Status::kUnknownError, CharSpan(), 0); @@ -287,7 +286,7 @@ void WiFiManager::_ConnectedCb(wifi_manager_error_e wifiErr, void * userData) bool WiFiManager::_ConfigListCb(const wifi_manager_config_h config, void * userData) { int wifiErr = WIFI_MANAGER_ERROR_NONE; - char * name = NULL; + char * name = nullptr; wifi_manager_security_type_e securityType = WIFI_MANAGER_SECURITY_TYPE_NONE; wifi_manager_config_get_name(config, &name); @@ -300,7 +299,7 @@ bool WiFiManager::_ConfigListCb(const wifi_manager_config_h config, void * userD } else { - ChipLogProgress(DeviceLayer, "FAIL: remove config [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: remove config [%s]", get_error_message(wifiErr)); } g_free(name); @@ -320,7 +319,7 @@ gboolean WiFiManager::_WiFiInitialize(gpointer userData) } else { - ChipLogProgress(DeviceLayer, "FAIL: initialize WiFi [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: initialize WiFi [%s]", get_error_message(wifiErr)); return false; } @@ -340,7 +339,7 @@ void WiFiManager::_WiFiDeinitialize(void) } else { - ChipLogProgress(DeviceLayer, "FAIL: deinitialize WiFi [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: deinitialize WiFi [%s]", get_error_message(wifiErr)); } } @@ -355,7 +354,7 @@ gboolean WiFiManager::_WiFiActivate(GMainLoop * mainLoop, gpointer userData) } else { - ChipLogProgress(DeviceLayer, "FAIL: request WiFi activation [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: request WiFi activation [%s]", get_error_message(wifiErr)); return false; } @@ -373,7 +372,7 @@ gboolean WiFiManager::_WiFiDeactivate(GMainLoop * mainLoop, gpointer userData) } else { - ChipLogProgress(DeviceLayer, "FAIL: request WiFi deactivation [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: request WiFi deactivation [%s]", get_error_message(wifiErr)); return false; } @@ -391,7 +390,7 @@ gboolean WiFiManager::_WiFiScan(GMainLoop * mainLoop, gpointer userData) } else { - ChipLogProgress(DeviceLayer, "FAIL: request WiFi scan [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: request WiFi scan [%s]", get_error_message(wifiErr)); return false; } @@ -410,7 +409,7 @@ gboolean WiFiManager::_WiFiConnect(GMainLoop * mainLoop, gpointer userData) } else { - ChipLogProgress(DeviceLayer, "FAIL: request WiFi connect [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: request WiFi connect [%s]", get_error_message(wifiErr)); wifi_manager_ap_destroy(ap); return false; } @@ -448,43 +447,43 @@ void WiFiManager::_WiFiSetCallbacks(void) { int wifiErr = WIFI_MANAGER_ERROR_NONE; - wifiErr = wifi_manager_set_device_state_changed_cb(mWiFiManagerHandle, _DeviceStateChangedCb, NULL); + wifiErr = wifi_manager_set_device_state_changed_cb(mWiFiManagerHandle, _DeviceStateChangedCb, nullptr); if (wifiErr == WIFI_MANAGER_ERROR_NONE) { ChipLogProgress(DeviceLayer, "Set WiFi device state changed callback"); } - wifiErr = wifi_manager_set_module_state_changed_cb(mWiFiManagerHandle, _ModuleStateChangedCb, NULL); + wifiErr = wifi_manager_set_module_state_changed_cb(mWiFiManagerHandle, _ModuleStateChangedCb, nullptr); if (wifiErr == WIFI_MANAGER_ERROR_NONE) { ChipLogProgress(DeviceLayer, "Set WiFi module state changed callback"); } - wifiErr = wifi_manager_set_connection_state_changed_cb(mWiFiManagerHandle, _ConnectionStateChangedCb, NULL); + wifiErr = wifi_manager_set_connection_state_changed_cb(mWiFiManagerHandle, _ConnectionStateChangedCb, nullptr); if (wifiErr == WIFI_MANAGER_ERROR_NONE) { ChipLogProgress(DeviceLayer, "Set WiFi connection state changed callback"); } - wifiErr = wifi_manager_set_scan_state_changed_cb(mWiFiManagerHandle, _ScanStateChangedCb, NULL); + wifiErr = wifi_manager_set_scan_state_changed_cb(mWiFiManagerHandle, _ScanStateChangedCb, nullptr); if (wifiErr == WIFI_MANAGER_ERROR_NONE) { ChipLogProgress(DeviceLayer, "Set WiFi scan state changed callback"); } - wifiErr = wifi_manager_set_rssi_level_changed_cb(mWiFiManagerHandle, _RssiLevelChangedCb, NULL); + wifiErr = wifi_manager_set_rssi_level_changed_cb(mWiFiManagerHandle, _RssiLevelChangedCb, nullptr); if (wifiErr == WIFI_MANAGER_ERROR_NONE) { ChipLogProgress(DeviceLayer, "Set WiFi rssi level changed callback"); } - wifiErr = wifi_manager_set_background_scan_cb(mWiFiManagerHandle, _BackgroundScanCb, NULL); + wifiErr = wifi_manager_set_background_scan_cb(mWiFiManagerHandle, _BackgroundScanCb, nullptr); if (wifiErr == WIFI_MANAGER_ERROR_NONE) { ChipLogProgress(DeviceLayer, "Set WiFi background scan callback"); } - wifiErr = wifi_manager_set_ip_conflict_cb(mWiFiManagerHandle, _IPConflictCb, NULL); + wifiErr = wifi_manager_set_ip_conflict_cb(mWiFiManagerHandle, _IPConflictCb, nullptr); if (wifiErr == WIFI_MANAGER_ERROR_NONE) { ChipLogProgress(DeviceLayer, "Set WiFi IP conflict callback"); @@ -559,7 +558,7 @@ void WiFiManager::_WiFiSetConnectionState(wifi_manager_connection_state_e connec wifi_manager_ap_h WiFiManager::_WiFiGetFoundAP(void) { int wifiErr = WIFI_MANAGER_ERROR_NONE; - wifi_manager_ap_h foundAp = NULL; + wifi_manager_ap_h foundAp = nullptr; wifiErr = wifi_manager_foreach_found_ap(mWiFiManagerHandle, _FoundAPCb, &foundAp); if (wifiErr == WIFI_MANAGER_ERROR_NONE) @@ -568,7 +567,7 @@ wifi_manager_ap_h WiFiManager::_WiFiGetFoundAP(void) } else { - ChipLogProgress(DeviceLayer, "FAIL: get found AP list [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: get found AP list [%s]", get_error_message(wifiErr)); } return foundAp; @@ -602,7 +601,7 @@ CHIP_ERROR WiFiManager::IsActivated(bool * isWiFiActivated) else { err = CHIP_ERROR_INCORRECT_STATE; - ChipLogProgress(DeviceLayer, "FAIL: check whether WiFi is activated [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: check whether WiFi is activated [%s]", get_error_message(wifiErr)); } return err; @@ -617,7 +616,7 @@ CHIP_ERROR WiFiManager::Activate(void) wifiErr = wifi_manager_is_activated(sInstance.mWiFiManagerHandle, &isWiFiActivated); VerifyOrExit(wifiErr == WIFI_MANAGER_ERROR_NONE, err = CHIP_ERROR_INCORRECT_STATE; - ChipLogProgress(DeviceLayer, "FAIL: check whether WiFi is activated [%s]", get_error_message(wifiErr))); + ChipLogError(DeviceLayer, "FAIL: check whether WiFi is activated [%s]", get_error_message(wifiErr))); VerifyOrExit(isWiFiActivated == false, ChipLogProgress(DeviceLayer, "WiFi is already activated")); @@ -640,7 +639,7 @@ CHIP_ERROR WiFiManager::Deactivate(void) wifiErr = wifi_manager_is_activated(sInstance.mWiFiManagerHandle, &isWiFiActivated); VerifyOrExit(wifiErr == WIFI_MANAGER_ERROR_NONE, err = CHIP_ERROR_INCORRECT_STATE; - ChipLogProgress(DeviceLayer, "FAIL: check whether WiFi is activated [%s]", get_error_message(wifiErr))); + ChipLogError(DeviceLayer, "FAIL: check whether WiFi is activated [%s]", get_error_message(wifiErr))); VerifyOrExit(isWiFiActivated == true, ChipLogProgress(DeviceLayer, "WiFi is already deactivated")); @@ -661,21 +660,21 @@ CHIP_ERROR WiFiManager::Connect(const char * ssid, const char * key, int wifiErr = WIFI_MANAGER_ERROR_NONE; bool isWiFiActivated = false; bool dbusAsyncErr = false; - wifi_manager_ap_h foundAp = NULL; + wifi_manager_ap_h foundAp = nullptr; g_strlcpy(sInstance.mWiFiSSID, ssid, kMaxWiFiSSIDLength + 1); g_strlcpy(sInstance.mWiFiKey, key, kMaxWiFiKeyLength + 1); wifiErr = wifi_manager_is_activated(sInstance.mWiFiManagerHandle, &isWiFiActivated); VerifyOrExit(wifiErr == WIFI_MANAGER_ERROR_NONE, err = CHIP_ERROR_INCORRECT_STATE; - ChipLogProgress(DeviceLayer, "FAIL: check whether WiFi is activated [%s]", get_error_message(wifiErr))); + ChipLogError(DeviceLayer, "FAIL: check whether WiFi is activated [%s]", get_error_message(wifiErr))); VerifyOrExit(isWiFiActivated == true, ChipLogProgress(DeviceLayer, "WiFi is deactivated")); sInstance.mpConnectCallback = apCallback; foundAp = sInstance._WiFiGetFoundAP(); - if (foundAp != NULL) + if (foundAp != nullptr) { dbusAsyncErr = MainLoop::Instance().AsyncRequest(_WiFiConnect, static_cast(foundAp)); if (dbusAsyncErr == false) @@ -701,18 +700,18 @@ CHIP_ERROR WiFiManager::Disconnect(const char * ssid) CHIP_ERROR err = CHIP_NO_ERROR; int wifiErr = WIFI_MANAGER_ERROR_NONE; bool isWiFiActivated = false; - wifi_manager_ap_h foundAp = NULL; + wifi_manager_ap_h foundAp = nullptr; g_strlcpy(sInstance.mWiFiSSID, ssid, kMaxWiFiSSIDLength + 1); wifiErr = wifi_manager_is_activated(sInstance.mWiFiManagerHandle, &isWiFiActivated); VerifyOrExit(wifiErr == WIFI_MANAGER_ERROR_NONE, err = CHIP_ERROR_INCORRECT_STATE; - ChipLogProgress(DeviceLayer, "FAIL: check whether WiFi is activated [%s]", get_error_message(wifiErr))); + ChipLogError(DeviceLayer, "FAIL: check whether WiFi is activated [%s]", get_error_message(wifiErr))); VerifyOrExit(isWiFiActivated == true, ChipLogProgress(DeviceLayer, "WiFi is deactivated")); foundAp = sInstance._WiFiGetFoundAP(); - VerifyOrExit(foundAp != NULL, ); + VerifyOrExit(foundAp != nullptr, ); wifiErr = wifi_manager_forget_ap(sInstance.mWiFiManagerHandle, foundAp); if (wifiErr == WIFI_MANAGER_ERROR_NONE) @@ -722,7 +721,7 @@ CHIP_ERROR WiFiManager::Disconnect(const char * ssid) else { err = CHIP_ERROR_INCORRECT_STATE; - ChipLogProgress(DeviceLayer, "FAIL: disconnect WiFi [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: disconnect WiFi [%s]", get_error_message(wifiErr)); } wifi_manager_ap_destroy(foundAp); @@ -736,7 +735,7 @@ CHIP_ERROR WiFiManager::RemoveAllConfigs(void) CHIP_ERROR err = CHIP_NO_ERROR; int wifiErr = WIFI_MANAGER_ERROR_NONE; - wifiErr = wifi_manager_config_foreach_configuration(sInstance.mWiFiManagerHandle, _ConfigListCb, NULL); + wifiErr = wifi_manager_config_foreach_configuration(sInstance.mWiFiManagerHandle, _ConfigListCb, nullptr); if (wifiErr == WIFI_MANAGER_ERROR_NONE) { ChipLogProgress(DeviceLayer, "Get config list finished"); @@ -744,7 +743,7 @@ CHIP_ERROR WiFiManager::RemoveAllConfigs(void) else { err = CHIP_ERROR_INCORRECT_STATE; - ChipLogProgress(DeviceLayer, "FAIL: get config list [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: get config list [%s]", get_error_message(wifiErr)); } return err; @@ -797,7 +796,7 @@ CHIP_ERROR WiFiManager::GetModuleState(wifi_manager_module_state_e * moduleState else { err = CHIP_ERROR_INCORRECT_STATE; - ChipLogProgress(DeviceLayer, "FAIL: get WiFi module state [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: get WiFi module state [%s]", get_error_message(wifiErr)); } } @@ -824,7 +823,7 @@ CHIP_ERROR WiFiManager::GetConnectionState(wifi_manager_connection_state_e * con else { err = CHIP_ERROR_INCORRECT_STATE; - ChipLogProgress(DeviceLayer, "FAIL: get WiFi connection state [%s]", get_error_message(wifiErr)); + ChipLogError(DeviceLayer, "FAIL: get WiFi connection state [%s]", get_error_message(wifiErr)); } }