diff --git a/examples/chip-tool/commands/tests/TestCommand.cpp b/examples/chip-tool/commands/tests/TestCommand.cpp index 850ca27bee6a94..69b46d59778fe4 100644 --- a/examples/chip-tool/commands/tests/TestCommand.cpp +++ b/examples/chip-tool/commands/tests/TestCommand.cpp @@ -40,7 +40,7 @@ void TestCommand::OnDeviceConnectedFn(void * context, chip::Controller::Device * void TestCommand::OnDeviceConnectionFailureFn(void * context, NodeId deviceId, CHIP_ERROR error) { - ChipLogError(chipTool, "Failed in connecting to the device %" PRIu64 ". Error %d", deviceId, error); + ChipLogError(chipTool, "Failed in connecting to the device %" PRIu64 ". Error %" CHIP_ERROR_FORMAT, deviceId, error); auto * command = static_cast(context); VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "Test command context is null")); command->SetCommandExitStatus(error); diff --git a/examples/lighting-app/efr32/include/AppTask.h b/examples/lighting-app/efr32/include/AppTask.h index d069e089d165b0..ba568cebd8e127 100644 --- a/examples/lighting-app/efr32/include/AppTask.h +++ b/examples/lighting-app/efr32/include/AppTask.h @@ -30,11 +30,19 @@ #include #include +// Application-defined error codes in the CHIP_ERROR space. +#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) +#define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02) +#define APP_ERROR_UNHANDLED_EVENT CHIP_APPLICATION_ERROR(0x03) +#define APP_ERROR_CREATE_TIMER_FAILED CHIP_APPLICATION_ERROR(0x04) +#define APP_ERROR_START_TIMER_FAILED CHIP_APPLICATION_ERROR(0x05) +#define APP_ERROR_STOP_TIMER_FAILED CHIP_APPLICATION_ERROR(0x06) + class AppTask { public: - int StartAppTask(); + CHIP_ERROR StartAppTask(); static void AppTaskMain(void * pvParameter); void PostLightActionRequest(int32_t aActor, LightingManager::Action_t aAction); @@ -45,7 +53,7 @@ class AppTask private: friend AppTask & GetAppTask(void); - int Init(); + CHIP_ERROR Init(); static void ActionInitiated(LightingManager::Action_t aAction, int32_t aActor); static void ActionCompleted(LightingManager::Action_t aAction); diff --git a/examples/lighting-app/efr32/include/Rpc.h b/examples/lighting-app/efr32/include/Rpc.h index 8c857d49ba4136..dcb25862a9cd1e 100644 --- a/examples/lighting-app/efr32/include/Rpc.h +++ b/examples/lighting-app/efr32/include/Rpc.h @@ -23,7 +23,7 @@ namespace rpc { class LightingService; -int Init(); +void Init(); void RunRpcService(void *); } // namespace rpc diff --git a/examples/lighting-app/efr32/src/AppTask.cpp b/examples/lighting-app/efr32/src/AppTask.cpp index 1f3ad3c04ef989..e6de1df4494d64 100644 --- a/examples/lighting-app/efr32/src/AppTask.cpp +++ b/examples/lighting-app/efr32/src/AppTask.cpp @@ -80,27 +80,21 @@ using namespace ::chip::DeviceLayer; AppTask AppTask::sAppTask; -int AppTask::StartAppTask() +CHIP_ERROR AppTask::StartAppTask() { - int err = CHIP_CONFIG_CORE_ERROR_MAX; - sAppEventQueue = xQueueCreateStatic(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent), sAppEventQueueBuffer, &sAppEventQueueStruct); if (sAppEventQueue == NULL) { EFR32_LOG("Failed to allocate app event queue"); - appError(err); + appError(APP_ERROR_EVENT_QUEUE_FAILED); } // Start App task. sAppTaskHandle = xTaskCreateStatic(AppTaskMain, APP_TASK_NAME, ArraySize(appStack), NULL, 1, appStack, &appTaskStruct); - if (sAppTaskHandle != NULL) - { - err = CHIP_NO_ERROR; - } - return err; + return (sAppTaskHandle == nullptr) ? APP_ERROR_CREATE_TASK_FAILED : CHIP_NO_ERROR; } -int AppTask::Init() +CHIP_ERROR AppTask::Init() { CHIP_ERROR err = CHIP_NO_ERROR; @@ -254,7 +248,7 @@ void AppTask::LightActionEventHandler(AppEvent * aEvent) bool initiated = false; LightingManager::Action_t action; int32_t actor; - int err = CHIP_NO_ERROR; + CHIP_ERROR err = CHIP_NO_ERROR; if (aEvent->Type == AppEvent::kEventType_Light) { @@ -275,7 +269,7 @@ void AppTask::LightActionEventHandler(AppEvent * aEvent) } else { - err = CHIP_CONFIG_CORE_ERROR_MAX; + err = APP_ERROR_UNHANDLED_EVENT; } if (err == CHIP_NO_ERROR) @@ -419,7 +413,7 @@ void AppTask::CancelTimer() if (xTimerStop(sFunctionTimer, 0) == pdFAIL) { EFR32_LOG("app timer stop() failed"); - appError(CHIP_CONFIG_CORE_ERROR_MAX); + appError(APP_ERROR_STOP_TIMER_FAILED); } mFunctionTimerActive = false; @@ -439,7 +433,7 @@ void AppTask::StartTimer(uint32_t aTimeoutInMs) if (xTimerChangePeriod(sFunctionTimer, aTimeoutInMs / portTICK_PERIOD_MS, 100) != pdPASS) { EFR32_LOG("app timer start() failed"); - appError(CHIP_CONFIG_CORE_ERROR_MAX); + appError(APP_ERROR_START_TIMER_FAILED); } mFunctionTimerActive = true; diff --git a/examples/lighting-app/efr32/src/LightingManager.cpp b/examples/lighting-app/efr32/src/LightingManager.cpp index 4f30a0b772faf1..b0480b479e96ef 100644 --- a/examples/lighting-app/efr32/src/LightingManager.cpp +++ b/examples/lighting-app/efr32/src/LightingManager.cpp @@ -40,7 +40,7 @@ int LightingManager::Init() if (sLightTimer == NULL) { EFR32_LOG("sLightTimer timer create failed"); - appError(CHIP_CONFIG_CORE_ERROR_MAX); + appError(APP_ERROR_CREATE_TIMER_FAILED); } mState = kState_OffCompleted; @@ -135,7 +135,7 @@ void LightingManager::StartTimer(uint32_t aTimeoutMs) if (xTimerChangePeriod(sLightTimer, (aTimeoutMs / portTICK_PERIOD_MS), 100) != pdPASS) { EFR32_LOG("sLightTimer timer start() failed"); - appError(CHIP_CONFIG_CORE_ERROR_MAX); + appError(APP_ERROR_START_TIMER_FAILED); } } @@ -144,7 +144,7 @@ void LightingManager::CancelTimer(void) if (xTimerStop(sLightTimer, 0) == pdFAIL) { EFR32_LOG("sLightTimer stop() failed"); - appError(CHIP_CONFIG_CORE_ERROR_MAX); + appError(APP_ERROR_STOP_TIMER_FAILED); } } diff --git a/examples/lighting-app/efr32/src/Rpc.cpp b/examples/lighting-app/efr32/src/Rpc.cpp index 846adc8c87307a..83754870f71ff6 100644 --- a/examples/lighting-app/efr32/src/Rpc.cpp +++ b/examples/lighting-app/efr32/src/Rpc.cpp @@ -118,15 +118,13 @@ void RunRpcService(void *) Start(RegisterServices, &logger_mutex); } -int Init() +void Init() { - int err = CHIP_CONFIG_CORE_ERROR_MAX; pw_sys_io_Init(); // Start App task. sRpcTaskHandle = xTaskCreateStatic(RunRpcService, "RPC_TASK", ArraySize(sRpcTaskStack), nullptr, RPC_TASK_PRIORITY, sRpcTaskStack, &sRpcTaskBuffer); - return err; } } // namespace rpc diff --git a/examples/lighting-app/efr32/src/main.cpp b/examples/lighting-app/efr32/src/main.cpp index 00e82ca607b105..01a2c17da1cb6c 100644 --- a/examples/lighting-app/efr32/src/main.cpp +++ b/examples/lighting-app/efr32/src/main.cpp @@ -99,8 +99,6 @@ extern "C" void vApplicationIdleHook(void) // ================================================================================ int main(void) { - int ret = CHIP_CONFIG_CORE_ERROR_MAX; - init_efrPlatform(); mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree); @@ -125,7 +123,7 @@ int main(void) chip::Platform::MemoryInit(); chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init(); - ret = PlatformMgr().InitChipStack(); + CHIP_ERROR ret = PlatformMgr().InitChipStack(); if (ret != CHIP_NO_ERROR) { EFR32_LOG("PlatformMgr().InitChipStack() failed"); diff --git a/examples/lighting-app/k32w/main/AppTask.cpp b/examples/lighting-app/k32w/main/AppTask.cpp index 8f44a64263b1a2..dffbe83d7bce50 100644 --- a/examples/lighting-app/k32w/main/AppTask.cpp +++ b/examples/lighting-app/k32w/main/AppTask.cpp @@ -72,7 +72,7 @@ int AppTask::StartAppTask() sAppEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent)); if (sAppEventQueue == NULL) { - err = CHIP_CONFIG_CORE_ERROR_MAX; + err = APP_ERROR_EVENT_QUEUE_FAILED; K32W_LOG("Failed to allocate app event queue"); assert(err == CHIP_NO_ERROR); } @@ -113,6 +113,7 @@ int AppTask::Init() ); if (sFunctionTimer == NULL) { + err = APP_ERROR_CREATE_TIMER_FAILED; K32W_LOG("app_timer_create() failed"); assert(err == CHIP_NO_ERROR); } @@ -408,7 +409,7 @@ void AppTask::LightActionEventHandler(AppEvent * aEvent) } else { - err = CHIP_CONFIG_CORE_ERROR_MAX; + err = APP_ERROR_UNHANDLED_EVENT; } if (err == CHIP_NO_ERROR) diff --git a/examples/lighting-app/k32w/main/include/AppTask.h b/examples/lighting-app/k32w/main/include/AppTask.h index 6981d50e0cbece..0ed818be7ad797 100644 --- a/examples/lighting-app/k32w/main/include/AppTask.h +++ b/examples/lighting-app/k32w/main/include/AppTask.h @@ -29,6 +29,14 @@ #include "FreeRTOS.h" #include "timers.h" +// Application-defined error codes in the CHIP_ERROR space. +#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) +#define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02) +#define APP_ERROR_UNHANDLED_EVENT CHIP_APPLICATION_ERROR(0x03) +#define APP_ERROR_CREATE_TIMER_FAILED CHIP_APPLICATION_ERROR(0x04) +#define APP_ERROR_START_TIMER_FAILED CHIP_APPLICATION_ERROR(0x05) +#define APP_ERROR_STOP_TIMER_FAILED CHIP_APPLICATION_ERROR(0x06) + class AppTask { public: diff --git a/examples/lighting-app/k32w/main/main.cpp b/examples/lighting-app/k32w/main/main.cpp index 31737fc90cdf6e..33fd401423ddda 100644 --- a/examples/lighting-app/k32w/main/main.cpp +++ b/examples/lighting-app/k32w/main/main.cpp @@ -55,8 +55,6 @@ uint8_t __attribute__((section(".heap"))) ucHeap[0xF000]; extern "C" void main_task(void const * argument) { - CHIP_ERROR ret = CHIP_CONFIG_CORE_ERROR_MAX; - /* Call C++ constructors */ InitFunc * pFunc = &__init_array_start; for (; pFunc < &__init_array_end; ++pFunc) @@ -78,7 +76,7 @@ extern "C" void main_task(void const * argument) // Init Chip memory management before the stack chip::Platform::MemoryInit(); - ret = PlatformMgr().InitChipStack(); + CHIP_ERROR ret = PlatformMgr().InitChipStack(); if (ret != CHIP_NO_ERROR) { K32W_LOG("Error during PlatformMgr().InitWeaveStack()"); diff --git a/examples/lock-app/efr32/include/AppTask.h b/examples/lock-app/efr32/include/AppTask.h index 0a01b1eb09f3a0..8e238194cb0892 100644 --- a/examples/lock-app/efr32/include/AppTask.h +++ b/examples/lock-app/efr32/include/AppTask.h @@ -30,11 +30,19 @@ #include #include +// Application-defined error codes in the CHIP_ERROR space. +#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) +#define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02) +#define APP_ERROR_UNHANDLED_EVENT CHIP_APPLICATION_ERROR(0x03) +#define APP_ERROR_CREATE_TIMER_FAILED CHIP_APPLICATION_ERROR(0x04) +#define APP_ERROR_START_TIMER_FAILED CHIP_APPLICATION_ERROR(0x05) +#define APP_ERROR_STOP_TIMER_FAILED CHIP_APPLICATION_ERROR(0x06) + class AppTask { public: - int StartAppTask(); + CHIP_ERROR StartAppTask(); static void AppTaskMain(void * pvParameter); void PostLockActionRequest(int32_t aActor, BoltLockManager::Action_t aAction); @@ -45,7 +53,7 @@ class AppTask private: friend AppTask & GetAppTask(void); - int Init(); + CHIP_ERROR Init(); static void ActionInitiated(BoltLockManager::Action_t aAction, int32_t aActor); static void ActionCompleted(BoltLockManager::Action_t aAction); diff --git a/examples/lock-app/efr32/src/AppTask.cpp b/examples/lock-app/efr32/src/AppTask.cpp index 44144ca85e1bd0..9f29a604d62350 100644 --- a/examples/lock-app/efr32/src/AppTask.cpp +++ b/examples/lock-app/efr32/src/AppTask.cpp @@ -75,28 +75,21 @@ using namespace ::chip::DeviceLayer; AppTask AppTask::sAppTask; -int AppTask::StartAppTask() +CHIP_ERROR AppTask::StartAppTask() { - int err = CHIP_CONFIG_CORE_ERROR_MAX; - sAppEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent)); if (sAppEventQueue == NULL) { EFR32_LOG("Failed to allocate app event queue"); - appError(err); + appError(APP_ERROR_EVENT_QUEUE_FAILED); } // Start App task. sAppTaskHandle = xTaskCreateStatic(AppTaskMain, APP_TASK_NAME, ArraySize(appStack), NULL, 1, appStack, &appTaskStruct); - if (sAppTaskHandle != NULL) - { - err = CHIP_NO_ERROR; - } - - return err; + return (sAppTaskHandle == nullptr) ? APP_ERROR_CREATE_TASK_FAILED : CHIP_NO_ERROR; } -int AppTask::Init() +CHIP_ERROR AppTask::Init() { CHIP_ERROR err = CHIP_NO_ERROR; @@ -271,7 +264,7 @@ void AppTask::LockActionEventHandler(AppEvent * aEvent) } else { - err = CHIP_CONFIG_CORE_ERROR_MAX; + err = APP_ERROR_UNHANDLED_EVENT; } if (err == CHIP_NO_ERROR) @@ -415,7 +408,7 @@ void AppTask::CancelTimer() if (xTimerStop(sFunctionTimer, 0) == pdFAIL) { EFR32_LOG("app timer stop() failed"); - appError(CHIP_CONFIG_CORE_ERROR_MAX); + appError(APP_ERROR_STOP_TIMER_FAILED); } mFunctionTimerActive = false; @@ -435,7 +428,7 @@ void AppTask::StartTimer(uint32_t aTimeoutInMs) if (xTimerChangePeriod(sFunctionTimer, aTimeoutInMs / portTICK_PERIOD_MS, 100) != pdPASS) { EFR32_LOG("app timer start() failed"); - appError(CHIP_CONFIG_CORE_ERROR_MAX); + appError(APP_ERROR_START_TIMER_FAILED); } mFunctionTimerActive = true; diff --git a/examples/lock-app/efr32/src/BoltLockManager.cpp b/examples/lock-app/efr32/src/BoltLockManager.cpp index b5acfa5450ea29..7d3c85edba93c7 100644 --- a/examples/lock-app/efr32/src/BoltLockManager.cpp +++ b/examples/lock-app/efr32/src/BoltLockManager.cpp @@ -40,7 +40,7 @@ int BoltLockManager::Init() if (sLockTimer == NULL) { EFR32_LOG("sLockTimer timer create failed"); - appError(CHIP_CONFIG_CORE_ERROR_MAX); + appError(APP_ERROR_CREATE_TIMER_FAILED); } mState = kState_LockingCompleted; @@ -135,7 +135,7 @@ void BoltLockManager::StartTimer(uint32_t aTimeoutMs) if (xTimerChangePeriod(sLockTimer, (aTimeoutMs / portTICK_PERIOD_MS), 100) != pdPASS) { EFR32_LOG("sLockTimer timer start() failed"); - appError(CHIP_CONFIG_CORE_ERROR_MAX); + appError(APP_ERROR_START_TIMER_FAILED); } } @@ -144,7 +144,7 @@ void BoltLockManager::CancelTimer(void) if (xTimerStop(sLockTimer, 0) == pdFAIL) { EFR32_LOG("Lock timer timer stop() failed"); - appError(CHIP_CONFIG_CORE_ERROR_MAX); + appError(APP_ERROR_STOP_TIMER_FAILED); } } diff --git a/examples/lock-app/efr32/src/main.cpp b/examples/lock-app/efr32/src/main.cpp index e1ba1619766938..28164532237d2e 100644 --- a/examples/lock-app/efr32/src/main.cpp +++ b/examples/lock-app/efr32/src/main.cpp @@ -91,8 +91,6 @@ extern "C" void vApplicationIdleHook(void) // ================================================================================ int main(void) { - int ret = CHIP_CONFIG_CORE_ERROR_MAX; - init_efrPlatform(); mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree); @@ -109,7 +107,7 @@ int main(void) chip::Platform::MemoryInit(); chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init(); - ret = PlatformMgr().InitChipStack(); + CHIP_ERROR ret = PlatformMgr().InitChipStack(); if (ret != CHIP_NO_ERROR) { EFR32_LOG("PlatformMgr().InitChipStack() failed"); diff --git a/examples/lock-app/esp32/main/AppTask.cpp b/examples/lock-app/esp32/main/AppTask.cpp index fb243da55c02b4..0d49d88c78f257 100644 --- a/examples/lock-app/esp32/main/AppTask.cpp +++ b/examples/lock-app/esp32/main/AppTask.cpp @@ -63,31 +63,22 @@ using namespace ::chip::DeviceLayer; AppTask AppTask::sAppTask; -int AppTask::StartAppTask() +CHIP_ERROR AppTask::StartAppTask() { - int err = CHIP_CONFIG_CORE_ERROR_MAX; - sAppEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent)); if (sAppEventQueue == NULL) { ESP_LOGE(TAG, "Failed to allocate app event queue"); - return 0; + return APP_ERROR_EVENT_QUEUE_FAILED; } // Start App task. sAppTaskHandle = xTaskCreate(AppTaskMain, APP_TASK_NAME, ArraySize(appStack), NULL, 1, NULL); - if (sAppTaskHandle) - { - err = CHIP_NO_ERROR; - } - - return err; + return sAppTaskHandle ? CHIP_NO_ERROR : APP_ERROR_CREATE_TASK_FAILED; } -int AppTask::Init() +CHIP_ERROR AppTask::Init() { - CHIP_ERROR err = CHIP_NO_ERROR; - // Create FreeRTOS sw timer for Function Selection. sFunctionTimer = xTimerCreate("FnTmr", // Just a text name, not used by the RTOS kernel 1, // == default timer period (mS) @@ -95,7 +86,7 @@ int AppTask::Init() (void *) this, // init timer id = app task obj context TimerEventHandler // timer callback handler ); - err = BoltLockMgr().Init(); + CHIP_ERROR err = BoltLockMgr().Init(); if (err != CHIP_NO_ERROR) { ESP_LOGI(TAG, "BoltLockMgr().Init() failed"); @@ -216,7 +207,7 @@ void AppTask::LockActionEventHandler(AppEvent * aEvent) bool initiated = false; BoltLockManager::Action_t action; int32_t actor; - int err = CHIP_NO_ERROR; + CHIP_ERROR err = CHIP_NO_ERROR; if (aEvent->Type == AppEvent::kEventType_Lock) { @@ -237,7 +228,7 @@ void AppTask::LockActionEventHandler(AppEvent * aEvent) } else { - err = CHIP_CONFIG_CORE_ERROR_MAX; + err = APP_ERROR_UNHANDLED_EVENT; } if (err == CHIP_NO_ERROR) diff --git a/examples/lock-app/esp32/main/BoltLockManager.cpp b/examples/lock-app/esp32/main/BoltLockManager.cpp index 661d5767e53a55..d6cb59aaf54a3e 100644 --- a/examples/lock-app/esp32/main/BoltLockManager.cpp +++ b/examples/lock-app/esp32/main/BoltLockManager.cpp @@ -26,7 +26,7 @@ BoltLockManager BoltLockManager::sLock; TimerHandle_t sLockTimer; -int BoltLockManager::Init() +CHIP_ERROR BoltLockManager::Init() { // Create FreeRTOS sw timer for lock timer. sLockTimer = xTimerCreate("lockTmr", // Just a text name, not used by the RTOS kernel @@ -39,7 +39,7 @@ int BoltLockManager::Init() if (sLockTimer == NULL) { ESP_LOGE(TAG, "sLockTimer timer create failed"); - return CHIP_CONFIG_CORE_ERROR_MAX; + return APP_ERROR_CREATE_TIMER_FAILED; } mState = kState_LockingCompleted; diff --git a/examples/lock-app/esp32/main/include/AppTask.h b/examples/lock-app/esp32/main/include/AppTask.h index 3ba549c58cd683..8d25e15981736c 100644 --- a/examples/lock-app/esp32/main/include/AppTask.h +++ b/examples/lock-app/esp32/main/include/AppTask.h @@ -28,11 +28,19 @@ #include #include +// Application-defined error codes in the CHIP_ERROR space. +#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) +#define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02) +#define APP_ERROR_UNHANDLED_EVENT CHIP_APPLICATION_ERROR(0x03) +#define APP_ERROR_CREATE_TIMER_FAILED CHIP_APPLICATION_ERROR(0x04) +#define APP_ERROR_START_TIMER_FAILED CHIP_APPLICATION_ERROR(0x05) +#define APP_ERROR_STOP_TIMER_FAILED CHIP_APPLICATION_ERROR(0x06) + class AppTask { public: - int StartAppTask(); + CHIP_ERROR StartAppTask(); static void AppTaskMain(void * pvParameter); void PostLockActionRequest(int32_t aActor, BoltLockManager::Action_t aAction); @@ -43,7 +51,7 @@ class AppTask private: friend AppTask & GetAppTask(void); - int Init(); + CHIP_ERROR Init(); static void ActionInitiated(BoltLockManager::Action_t aAction, int32_t aActor); static void ActionCompleted(BoltLockManager::Action_t aAction); diff --git a/examples/lock-app/esp32/main/include/BoltLockManager.h b/examples/lock-app/esp32/main/include/BoltLockManager.h index baeddb22cf4c6f..1964dd66f06d6c 100644 --- a/examples/lock-app/esp32/main/include/BoltLockManager.h +++ b/examples/lock-app/esp32/main/include/BoltLockManager.h @@ -23,6 +23,8 @@ #include "AppEvent.h" +#include + #include "freertos/FreeRTOS.h" #include "freertos/timers.h" // provides FreeRTOS timer support @@ -45,7 +47,7 @@ class BoltLockManager kState_UnlockingCompleted, } State; - int Init(); + CHIP_ERROR Init(); bool IsUnlocked(); void EnableAutoRelock(bool aOn); void SetAutoLockDuration(uint32_t aDurationInSecs); diff --git a/examples/lock-app/qpg/src/BoltLockManager.cpp b/examples/lock-app/qpg/src/BoltLockManager.cpp index b60cceeba30df7..ae422e5d1892a8 100644 --- a/examples/lock-app/qpg/src/BoltLockManager.cpp +++ b/examples/lock-app/qpg/src/BoltLockManager.cpp @@ -41,7 +41,7 @@ int BoltLockManager::Init() { ChipLogProgress(NotSpecified, "sLockTimer timer create failed"); // TODO: - // appError(CHIP_CONFIG_CORE_ERROR_MAX); + // appError(APP_ERROR_CREATE_TIMER_FAILED); } mState = kState_LockingCompleted; @@ -136,7 +136,7 @@ void BoltLockManager::StartTimer(uint32_t aTimeoutMs) if (xTimerChangePeriod(sLockTimer, (aTimeoutMs / portTICK_PERIOD_MS), 100) != pdPASS) { ChipLogError(NotSpecified, "sLockTimer timer start() failed"); - // appError(CHIP_CONFIG_CORE_ERROR_MAX); + // appError(APP_ERROR_START_TIMER_FAILED); } } @@ -145,7 +145,7 @@ void BoltLockManager::CancelTimer(void) if (xTimerStop(sLockTimer, 0) == pdFAIL) { ChipLogError(NotSpecified, "Lock timer timer stop() failed"); - // appError(CHIP_CONFIG_CORE_ERROR_MAX); + // appError(APP_ERROR_STOP_TIMER_FAILED); } } diff --git a/examples/platform/esp32/shell_extension/heap_trace.cpp b/examples/platform/esp32/shell_extension/heap_trace.cpp index 2014ebf9dc62e6..adec9cfff4b1ad 100644 --- a/examples/platform/esp32/shell_extension/heap_trace.cpp +++ b/examples/platform/esp32/shell_extension/heap_trace.cpp @@ -46,31 +46,31 @@ heap_trace_record_t sTraceRecords[kNumHeapTraceRecords]; Engine sShellHeapSubCommands; -int HeapTraceHelpHandler(int argc, char ** argv) +CHIP_ERROR HeapTraceHelpHandler(int argc, char ** argv) { sShellHeapSubCommands.ForEachCommand(PrintCommandHelp, nullptr); - return 0; + return CHIP_NO_ERROR; } #if CONFIG_HEAP_TRACING_STANDALONE -int HeapTraceResetHandler(int argc, char ** argv) +CHIP_ERROR HeapTraceResetHandler(int argc, char ** argv) { ESP_ERROR_CHECK(heap_trace_stop()); ESP_ERROR_CHECK(heap_trace_start(HEAP_TRACE_LEAKS)); - return 0; + return CHIP_NO_ERROR; } -int HeapTraceDumpHandler(int argc, char ** argv) +CHIP_ERROR HeapTraceDumpHandler(int argc, char ** argv) { heap_trace_dump(); streamer_printf(streamer_get(), "Free heap %d/%d\n", heap_caps_get_free_size(MALLOC_CAP_8BIT), heap_caps_get_total_size(MALLOC_CAP_8BIT)); - return 0; + return CHIP_NO_ERROR; } #endif // CONFIG_HEAP_TRACING_STANDALONE #if CONFIG_HEAP_TASK_TRACKING -int HeapTraceTaskHandler(int argc, char ** argv) +CHIP_ERROR HeapTraceTaskHandler(int argc, char ** argv) { // static storage is required for task memory info; static size_t numTotals = 0; @@ -103,11 +103,11 @@ int HeapTraceTaskHandler(int argc, char ** argv) streamer_printf(streamer_get(), "Free heap %d/%d\n", heap_caps_get_free_size(MALLOC_CAP_8BIT), heap_caps_get_total_size(MALLOC_CAP_8BIT)); - return 0; + return CHIP_NO_ERROR; } #endif -int HeapTraceDispatch(int argc, char ** argv) +CHIP_ERROR HeapTraceDispatch(int argc, char ** argv) { if (argc == 0) { diff --git a/examples/platform/qpg/app/main.cpp b/examples/platform/qpg/app/main.cpp index 6c05305b9e4113..551c8ff17ab766 100644 --- a/examples/platform/qpg/app/main.cpp +++ b/examples/platform/qpg/app/main.cpp @@ -60,14 +60,12 @@ using namespace ::chip::DeviceLayer::Internal; int Application_Init(void) { - int ret = CHIP_CONFIG_CORE_ERROR_MAX; - /* Launch application task */ ChipLogProgress(NotSpecified, "============================"); ChipLogProgress(NotSpecified, "Qorvo " APP_NAME " Launching"); ChipLogProgress(NotSpecified, "============================"); - ret = GetAppTask().StartAppTask(); + CHIP_ERROR ret = GetAppTask().StartAppTask(); if (ret != CHIP_NO_ERROR) { ChipLogError(NotSpecified, "GetAppTask().Init() failed"); @@ -79,9 +77,7 @@ int Application_Init(void) int CHIP_Init(void) { - int ret = CHIP_CONFIG_CORE_ERROR_MAX; - - ret = chip::Platform::MemoryInit(); + CHIP_ERROR ret = chip::Platform::MemoryInit(); if (ret != CHIP_NO_ERROR) { ChipLogError(NotSpecified, "Platform::MemoryInit() failed"); diff --git a/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp index 01efb5829033a4..07d1a49ef21d84 100644 --- a/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -79,7 +79,6 @@ int AppTask::StartAppTask() int AppTask::Init() { - int ret = CHIP_CONFIG_CORE_ERROR_MAX; LED_Params ledParams; Button_Params buttionParams; ConnectivityManager::ThreadPollingConfig pollingConfig; @@ -89,7 +88,7 @@ int AppTask::Init() // Init Chip memory management before the stack chip::Platform::MemoryInit(); - ret = PlatformMgr().InitChipStack(); + CHIP_ERROR ret = PlatformMgr().InitChipStack(); if (ret != CHIP_NO_ERROR) { PLAT_LOG("PlatformMgr().InitChipStack() failed"); diff --git a/examples/pump-app/cc13x2x7_26x2x7/main/main.cpp b/examples/pump-app/cc13x2x7_26x2x7/main/main.cpp index 091681d4a68f0f..1ed5409a721cce 100644 --- a/examples/pump-app/cc13x2x7_26x2x7/main/main.cpp +++ b/examples/pump-app/cc13x2x7_26x2x7/main/main.cpp @@ -62,8 +62,6 @@ extern "C" void vApplicationStackOverflowHook(void) // ================================================================================ int main(void) { - int ret = CHIP_CONFIG_CORE_ERROR_MAX; - Board_init(); bpool((void *) GlobalHeapZoneBuffer, TOTAL_ICALL_HEAP_SIZE); @@ -79,7 +77,7 @@ int main(void) SHA2_init(); - ret = GetAppTask().StartAppTask(); + CHIP_ERROR ret = GetAppTask().StartAppTask(); if (ret != CHIP_NO_ERROR) { // can't log until the kernel is started diff --git a/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp index 01efb5829033a4..07d1a49ef21d84 100644 --- a/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -79,7 +79,6 @@ int AppTask::StartAppTask() int AppTask::Init() { - int ret = CHIP_CONFIG_CORE_ERROR_MAX; LED_Params ledParams; Button_Params buttionParams; ConnectivityManager::ThreadPollingConfig pollingConfig; @@ -89,7 +88,7 @@ int AppTask::Init() // Init Chip memory management before the stack chip::Platform::MemoryInit(); - ret = PlatformMgr().InitChipStack(); + CHIP_ERROR ret = PlatformMgr().InitChipStack(); if (ret != CHIP_NO_ERROR) { PLAT_LOG("PlatformMgr().InitChipStack() failed"); diff --git a/examples/pump-controller-app/cc13x2x7_26x2x7/main/main.cpp b/examples/pump-controller-app/cc13x2x7_26x2x7/main/main.cpp index 091681d4a68f0f..1ed5409a721cce 100644 --- a/examples/pump-controller-app/cc13x2x7_26x2x7/main/main.cpp +++ b/examples/pump-controller-app/cc13x2x7_26x2x7/main/main.cpp @@ -62,8 +62,6 @@ extern "C" void vApplicationStackOverflowHook(void) // ================================================================================ int main(void) { - int ret = CHIP_CONFIG_CORE_ERROR_MAX; - Board_init(); bpool((void *) GlobalHeapZoneBuffer, TOTAL_ICALL_HEAP_SIZE); @@ -79,7 +77,7 @@ int main(void) SHA2_init(); - ret = GetAppTask().StartAppTask(); + CHIP_ERROR ret = GetAppTask().StartAppTask(); if (ret != CHIP_NO_ERROR) { // can't log until the kernel is started diff --git a/examples/shell/efr32/src/main.cpp b/examples/shell/efr32/src/main.cpp index bb6ee910edcec1..4d5295daf85721 100644 --- a/examples/shell/efr32/src/main.cpp +++ b/examples/shell/efr32/src/main.cpp @@ -107,8 +107,6 @@ static void shell_task(void * args) int main(void) { - int ret = CHIP_CONFIG_CORE_ERROR_MAX; - init_efrPlatform(); mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree); @@ -129,7 +127,7 @@ int main(void) chip::Platform::MemoryInit(); chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init(); - ret = PlatformMgr().InitChipStack(); + CHIP_ERROR ret = PlatformMgr().InitChipStack(); if (ret != CHIP_NO_ERROR) { EFR32_LOG("PlatformMgr().InitChipStack() failed"); diff --git a/examples/shell/k32w/main/main.cpp b/examples/shell/k32w/main/main.cpp index cf5850e329b3b1..83ab4b42d80461 100644 --- a/examples/shell/k32w/main/main.cpp +++ b/examples/shell/k32w/main/main.cpp @@ -64,8 +64,6 @@ unsigned int sleep(unsigned int seconds) extern "C" void main_task(void const * argument) { - CHIP_ERROR ret = CHIP_CONFIG_CORE_ERROR_MAX; - /* Call C++ constructors */ InitFunc * pFunc = &__init_array_start; for (; pFunc < &__init_array_end; ++pFunc) @@ -87,7 +85,7 @@ extern "C" void main_task(void const * argument) // Init Chip memory management before the stack chip::Platform::MemoryInit(); - ret = PlatformMgr().InitChipStack(); + CHIP_ERROR ret = PlatformMgr().InitChipStack(); if (ret != CHIP_NO_ERROR) { K32W_LOG("Error during PlatformMgr().InitWeaveStack()"); diff --git a/examples/window-app/efr32/include/AppTask.h b/examples/window-app/efr32/include/AppTask.h index f5cb890bf74002..6f636e1e4b3637 100644 --- a/examples/window-app/efr32/include/AppTask.h +++ b/examples/window-app/efr32/include/AppTask.h @@ -34,6 +34,14 @@ using namespace ::chip::DeviceLayer; +// Application-defined error codes in the CHIP_ERROR space. +#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) +#define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02) +#define APP_ERROR_UNHANDLED_EVENT CHIP_APPLICATION_ERROR(0x03) +#define APP_ERROR_CREATE_TIMER_FAILED CHIP_APPLICATION_ERROR(0x04) +#define APP_ERROR_START_TIMER_FAILED CHIP_APPLICATION_ERROR(0x05) +#define APP_ERROR_STOP_TIMER_FAILED CHIP_APPLICATION_ERROR(0x06) + class AppTask { public: @@ -47,7 +55,7 @@ class AppTask static AppTask & Instance(); - int Start(void); + CHIP_ERROR Start(void); WindowCover & Cover(); void PostEvent(const AppEvent & event); diff --git a/examples/window-app/efr32/src/AppTask.cpp b/examples/window-app/efr32/src/AppTask.cpp index c7a2ebdc1791f6..7a2a4b80f74c5c 100644 --- a/examples/window-app/efr32/src/AppTask.cpp +++ b/examples/window-app/efr32/src/AppTask.cpp @@ -76,24 +76,18 @@ WindowCover & AppTask::Cover() return mCover; } -int AppTask::Start() +CHIP_ERROR AppTask::Start() { - int err = CHIP_CONFIG_CORE_ERROR_MAX; - mQueue = xQueueCreateStatic(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent), sAppEventQueueBuffer, &sAppEventQueueStruct); if (mQueue == NULL) { EFR32_LOG("Failed to allocate app event queue"); - appError(err); + appError(APP_ERROR_EVENT_QUEUE_FAILED); } // Start App task. mHandle = xTaskCreateStatic(Main, APP_TASK_NAME, ArraySize(sAppStack), NULL, 1, sAppStack, &sAppTaskStruct); - if (mHandle != NULL) - { - err = CHIP_NO_ERROR; - } - return err; + return mHandle ? CHIP_NO_ERROR : APP_ERROR_CREATE_TASK_FAILED; } void AppTask::Main(void * pvParameter) diff --git a/examples/window-app/efr32/src/AppTimer.cpp b/examples/window-app/efr32/src/AppTimer.cpp index 397c63c61a55ce..43bea99642c65b 100644 --- a/examples/window-app/efr32/src/AppTimer.cpp +++ b/examples/window-app/efr32/src/AppTimer.cpp @@ -59,7 +59,7 @@ void AppTimer::Start() if (xTimerStart(mHandler, 100) != pdPASS) { EFR32_LOG("AppTimer start() failed"); - appError(CHIP_CONFIG_CORE_ERROR_MAX); + appError(APP_ERROR_START_TIMER_FAILED); } mIsActive = true; @@ -79,7 +79,7 @@ void AppTimer::Start(uint32_t timeoutInMs) if (xTimerChangePeriod(mHandler, timeoutInMs / portTICK_PERIOD_MS, 100) != pdPASS) { EFR32_LOG("AppTimer start() failed"); - appError(CHIP_CONFIG_CORE_ERROR_MAX); + appError(APP_ERROR_START_TIMER_FAILED); } mIsActive = true; @@ -104,7 +104,7 @@ void AppTimer::Stop() if (xTimerStop(mHandler, 0) == pdFAIL) { EFR32_LOG("AppTimer stop() failed"); - appError(CHIP_CONFIG_CORE_ERROR_MAX); + appError(APP_ERROR_STOP_TIMER_FAILED); } } diff --git a/examples/window-app/efr32/src/main.cpp b/examples/window-app/efr32/src/main.cpp index 2831cfcceffc65..7965443e4d5e0d 100644 --- a/examples/window-app/efr32/src/main.cpp +++ b/examples/window-app/efr32/src/main.cpp @@ -95,8 +95,6 @@ extern "C" void vApplicationIdleHook(void) // ================================================================================ int main(void) { - int ret = CHIP_CONFIG_CORE_ERROR_MAX; - init_efrPlatform(); #if PW_RPC_ENABLED @@ -118,7 +116,7 @@ int main(void) chip::Platform::MemoryInit(); chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init(); - ret = PlatformMgr().InitChipStack(); + CHIP_ERROR ret = PlatformMgr().InitChipStack(); if (ret != CHIP_NO_ERROR) { EFR32_LOG("PlatformMgr().InitChipStack() failed"); diff --git a/src/app/common/gen/attributes/Accessors.cpp b/src/app/common/gen/attributes/Accessors.cpp index 3378ea7c58a6d6..9494c4d514ba44 100644 --- a/src/app/common/gen/attributes/Accessors.cpp +++ b/src/app/common/gen/attributes/Accessors.cpp @@ -4751,15 +4751,15 @@ EmberAfStatus SetMaxScaledValue(chip::EndpointId endpoint, int16_t maxScaledValu return emberAfWriteServerAttribute(endpoint, PressureMeasurement::Id, Ids::MaxScaledValue, (uint8_t *) &maxScaledValue, ZCL_INT16S_ATTRIBUTE_TYPE); } -EmberAfStatus GetScaledTolerance(chip::EndpointId endpoint, int16_t * scaledTolerance) +EmberAfStatus GetScaledTolerance(chip::EndpointId endpoint, uint16_t * scaledTolerance) { return emberAfReadServerAttribute(endpoint, PressureMeasurement::Id, Ids::ScaledTolerance, (uint8_t *) scaledTolerance, sizeof(*scaledTolerance)); } -EmberAfStatus SetScaledTolerance(chip::EndpointId endpoint, int16_t scaledTolerance) +EmberAfStatus SetScaledTolerance(chip::EndpointId endpoint, uint16_t scaledTolerance) { return emberAfWriteServerAttribute(endpoint, PressureMeasurement::Id, Ids::ScaledTolerance, (uint8_t *) &scaledTolerance, - ZCL_INT16S_ATTRIBUTE_TYPE); + ZCL_INT16U_ATTRIBUTE_TYPE); } EmberAfStatus GetScale(chip::EndpointId endpoint, int8_t * scale) { diff --git a/src/app/common/gen/attributes/Accessors.h b/src/app/common/gen/attributes/Accessors.h index b2b876e61d1fcd..d9bd7fe4f7c9c0 100644 --- a/src/app/common/gen/attributes/Accessors.h +++ b/src/app/common/gen/attributes/Accessors.h @@ -1169,8 +1169,8 @@ EmberAfStatus GetMinScaledValue(chip::EndpointId endpoint, int16_t * minScaledVa EmberAfStatus SetMinScaledValue(chip::EndpointId endpoint, int16_t minScaledValue); EmberAfStatus GetMaxScaledValue(chip::EndpointId endpoint, int16_t * maxScaledValue); // int16s EmberAfStatus SetMaxScaledValue(chip::EndpointId endpoint, int16_t maxScaledValue); -EmberAfStatus GetScaledTolerance(chip::EndpointId endpoint, int16_t * scaledTolerance); // int16s -EmberAfStatus SetScaledTolerance(chip::EndpointId endpoint, int16_t scaledTolerance); +EmberAfStatus GetScaledTolerance(chip::EndpointId endpoint, uint16_t * scaledTolerance); // int16u +EmberAfStatus SetScaledTolerance(chip::EndpointId endpoint, uint16_t scaledTolerance); EmberAfStatus GetScale(chip::EndpointId endpoint, int8_t * scale); // int8s EmberAfStatus SetScale(chip::EndpointId endpoint, int8_t scale); } // namespace Attributes diff --git a/src/ble/BleError.cpp b/src/ble/BleError.cpp index 9940dcbb1da548..86168ace6be07c 100644 --- a/src/ble/BleError.cpp +++ b/src/ble/BleError.cpp @@ -49,7 +49,7 @@ bool FormatLayerError(char * buf, uint16_t bufSize, CHIP_ERROR err) { const char * desc = nullptr; - if (err < BLE_CONFIG_ERROR_MIN || err > BLE_CONFIG_ERROR_MAX) + if (!ChipError::IsPart(ChipError::SdkPart::kBLE, err)) { return false; } diff --git a/src/ble/BleError.h b/src/ble/BleError.h index 6526db95c0b954..706dd339e94245 100644 --- a/src/ble/BleError.h +++ b/src/ble/BleError.h @@ -34,23 +34,9 @@ #include -// clang-format off +#define CHIP_BLE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kBLE, (e)) -/** - * @def CHIP_BLE_ERROR(e) - * - * @brief - * This defines a mapping function for BleLayer errors that allows - * mapping such errors into a platform- or system-specific - * range. This function may be configured via - * #BLE_CONFIG_ERROR. - * - * @param[in] e The BleLayer error to map. - * - * @return The mapped BleLayer error. - * - */ -#define CHIP_BLE_ERROR(e) BLE_CONFIG_ERROR(e) +// clang-format off /** * @name Error Definitions @@ -58,9 +44,8 @@ * @{ */ -// unused CHIP_BLE_ERROR(0) -// unused CHIP_BLE_ERROR(1) -// unused CHIP_BLE_ERROR(2) +// unused CHIP_BLE_ERROR(0x01) +// unused CHIP_BLE_ERROR(0x02) /** * @def BLE_ERROR_NO_CONNECTION_RECEIVED_CALLBACK @@ -70,7 +55,7 @@ * connection. * */ -#define BLE_ERROR_NO_CONNECTION_RECEIVED_CALLBACK CHIP_BLE_ERROR(3) +#define BLE_ERROR_NO_CONNECTION_RECEIVED_CALLBACK CHIP_BLE_ERROR(0x03) /** * @def BLE_ERROR_CENTRAL_UNSUBSCRIBED @@ -80,7 +65,7 @@ * Transport Protocol (BTP) transmit characteristic. * */ -#define BLE_ERROR_CENTRAL_UNSUBSCRIBED CHIP_BLE_ERROR(4) +#define BLE_ERROR_CENTRAL_UNSUBSCRIBED CHIP_BLE_ERROR(0x04) /** * @def BLE_ERROR_GATT_SUBSCRIBE_FAILED @@ -90,7 +75,7 @@ * Transport Protocol (BTP) transmit characteristic. * */ -#define BLE_ERROR_GATT_SUBSCRIBE_FAILED CHIP_BLE_ERROR(5) +#define BLE_ERROR_GATT_SUBSCRIBE_FAILED CHIP_BLE_ERROR(0x05) /** * @def BLE_ERROR_GATT_UNSUBSCRIBE_FAILED @@ -100,7 +85,7 @@ * BLE Transport Protocol (BTP) transmit characteristic. * */ -#define BLE_ERROR_GATT_UNSUBSCRIBE_FAILED CHIP_BLE_ERROR(6) +#define BLE_ERROR_GATT_UNSUBSCRIBE_FAILED CHIP_BLE_ERROR(0x06) /** * @def BLE_ERROR_GATT_WRITE_FAILED @@ -109,7 +94,7 @@ * A General Attribute Profile (GATT) write operation failed. * */ -#define BLE_ERROR_GATT_WRITE_FAILED CHIP_BLE_ERROR(7) +#define BLE_ERROR_GATT_WRITE_FAILED CHIP_BLE_ERROR(0x07) /** * @def BLE_ERROR_GATT_INDICATE_FAILED @@ -118,10 +103,10 @@ * A General Attribute Profile (GATT) indicate operation failed. * */ -#define BLE_ERROR_GATT_INDICATE_FAILED CHIP_BLE_ERROR(8) +#define BLE_ERROR_GATT_INDICATE_FAILED CHIP_BLE_ERROR(0x08) -// unused CHIP_BLE_ERROR(9) -// unused CHIP_BLE_ERROR(10) +// unused CHIP_BLE_ERROR(0x09) +// unused CHIP_BLE_ERROR(0x0a) /** * @def BLE_ERROR_CHIPOBLE_PROTOCOL_ABORT @@ -130,7 +115,7 @@ * A BLE Transport Protocol (BTP) error was encountered. * */ -#define BLE_ERROR_CHIPOBLE_PROTOCOL_ABORT CHIP_BLE_ERROR(11) +#define BLE_ERROR_CHIPOBLE_PROTOCOL_ABORT CHIP_BLE_ERROR(0x0b) /** * @def BLE_ERROR_REMOTE_DEVICE_DISCONNECTED @@ -140,7 +125,7 @@ * expiration of a BLE connection supervision timeout. * */ -#define BLE_ERROR_REMOTE_DEVICE_DISCONNECTED CHIP_BLE_ERROR(12) +#define BLE_ERROR_REMOTE_DEVICE_DISCONNECTED CHIP_BLE_ERROR(0x0c) /** * @def BLE_ERROR_APP_CLOSED_CONNECTION @@ -149,9 +134,9 @@ * The local application closed a BLE connection, and has informed BleLayer. * */ -#define BLE_ERROR_APP_CLOSED_CONNECTION CHIP_BLE_ERROR(13) +#define BLE_ERROR_APP_CLOSED_CONNECTION CHIP_BLE_ERROR(0x0d) -// unused CHIP_BLE_ERROR(14) +// unused CHIP_BLE_ERROR(0x0e) /** * @def BLE_ERROR_NOT_CHIP_DEVICE @@ -161,7 +146,7 @@ * (GATT) service required by the Bluetooth Transport Protocol (BTP). * */ -#define BLE_ERROR_NOT_CHIP_DEVICE CHIP_BLE_ERROR(15) +#define BLE_ERROR_NOT_CHIP_DEVICE CHIP_BLE_ERROR(0x0f) /** * @def BLE_ERROR_INCOMPATIBLE_PROTOCOL_VERSIONS @@ -171,10 +156,10 @@ * Transport Protocol (BTP). * */ -#define BLE_ERROR_INCOMPATIBLE_PROTOCOL_VERSIONS CHIP_BLE_ERROR(16) +#define BLE_ERROR_INCOMPATIBLE_PROTOCOL_VERSIONS CHIP_BLE_ERROR(0x10) -// unused CHIP_BLE_ERROR(17) -// unused CHIP_BLE_ERROR(18) +// unused CHIP_BLE_ERROR(0x11) +// unused CHIP_BLE_ERROR(0x12) /** * @def BLE_ERROR_INVALID_FRAGMENT_SIZE @@ -184,7 +169,7 @@ * fragment size. * */ -#define BLE_ERROR_INVALID_FRAGMENT_SIZE CHIP_BLE_ERROR(19) +#define BLE_ERROR_INVALID_FRAGMENT_SIZE CHIP_BLE_ERROR(0x13) /** * @def BLE_ERROR_START_TIMER_FAILED @@ -193,7 +178,7 @@ * A timer failed to start within BleLayer. * */ -#define BLE_ERROR_START_TIMER_FAILED CHIP_BLE_ERROR(20) +#define BLE_ERROR_START_TIMER_FAILED CHIP_BLE_ERROR(0x14) /** * @def BLE_ERROR_CONNECT_TIMED_OUT @@ -203,7 +188,7 @@ * connect handshake response timed out. * */ -#define BLE_ERROR_CONNECT_TIMED_OUT CHIP_BLE_ERROR(21) +#define BLE_ERROR_CONNECT_TIMED_OUT CHIP_BLE_ERROR(0x15) /** * @def BLE_ERROR_RECEIVE_TIMED_OUT @@ -213,7 +198,7 @@ * handshake timed out. * */ -#define BLE_ERROR_RECEIVE_TIMED_OUT CHIP_BLE_ERROR(22) +#define BLE_ERROR_RECEIVE_TIMED_OUT CHIP_BLE_ERROR(0x16) /** * @def BLE_ERROR_INVALID_MESSAGE @@ -222,7 +207,7 @@ * An invalid Bluetooth Transport Protocol (BTP) message was received. * */ -#define BLE_ERROR_INVALID_MESSAGE CHIP_BLE_ERROR(23) +#define BLE_ERROR_INVALID_MESSAGE CHIP_BLE_ERROR(0x17) /** * @def BLE_ERROR_FRAGMENT_ACK_TIMED_OUT @@ -232,7 +217,7 @@ * acknowledgement timed out. * */ -#define BLE_ERROR_FRAGMENT_ACK_TIMED_OUT CHIP_BLE_ERROR(24) +#define BLE_ERROR_FRAGMENT_ACK_TIMED_OUT CHIP_BLE_ERROR(0x18) /** * @def BLE_ERROR_KEEP_ALIVE_TIMED_OUT @@ -242,7 +227,7 @@ * fragment timed out. * */ -#define BLE_ERROR_KEEP_ALIVE_TIMED_OUT CHIP_BLE_ERROR(25) +#define BLE_ERROR_KEEP_ALIVE_TIMED_OUT CHIP_BLE_ERROR(0x19) /** * @def BLE_ERROR_NO_CONNECT_COMPLETE_CALLBACK @@ -252,7 +237,7 @@ * connect completion. * */ -#define BLE_ERROR_NO_CONNECT_COMPLETE_CALLBACK CHIP_BLE_ERROR(26) +#define BLE_ERROR_NO_CONNECT_COMPLETE_CALLBACK CHIP_BLE_ERROR(0x1a) /** * @def BLE_ERROR_INVALID_ACK @@ -261,7 +246,7 @@ * A Bluetooth Transport Protcol (BTP) fragment acknowledgement was invalid. * */ -#define BLE_ERROR_INVALID_ACK CHIP_BLE_ERROR(27) +#define BLE_ERROR_INVALID_ACK CHIP_BLE_ERROR(0x1b) /** * @def BLE_ERROR_REASSEMBLER_MISSING_DATA @@ -272,7 +257,7 @@ * the indicated size of the original fragmented message. * */ -#define BLE_ERROR_REASSEMBLER_MISSING_DATA CHIP_BLE_ERROR(28) +#define BLE_ERROR_REASSEMBLER_MISSING_DATA CHIP_BLE_ERROR(0x1c) /** * @def BLE_ERROR_INVALID_BTP_HEADER_FLAGS @@ -281,7 +266,7 @@ * A set of Bluetooth Transport Protocol (BTP) header flags is invalid. * */ -#define BLE_ERROR_INVALID_BTP_HEADER_FLAGS CHIP_BLE_ERROR(29) +#define BLE_ERROR_INVALID_BTP_HEADER_FLAGS CHIP_BLE_ERROR(0x1d) /** * @def BLE_ERROR_INVALID_BTP_SEQUENCE_NUMBER @@ -290,7 +275,7 @@ * A Bluetooth Transport Protocol (BTP) fragment sequence number is invalid. * */ -#define BLE_ERROR_INVALID_BTP_SEQUENCE_NUMBER CHIP_BLE_ERROR(30) +#define BLE_ERROR_INVALID_BTP_SEQUENCE_NUMBER CHIP_BLE_ERROR(0x1e) /** * @def BLE_ERROR_REASSEMBLER_INCORRECT_STATE @@ -300,7 +285,7 @@ * encountered an unexpected state. * */ -#define BLE_ERROR_REASSEMBLER_INCORRECT_STATE CHIP_BLE_ERROR(31) +#define BLE_ERROR_REASSEMBLER_INCORRECT_STATE CHIP_BLE_ERROR(0x1f) // !!!!! IMPORTANT !!!!! If you add new Ble errors, please update the translation // of error codes to strings in BleError.cpp, and add them to unittest diff --git a/src/darwin/Framework/CHIP/CHIPError.h b/src/darwin/Framework/CHIP/CHIPError.h index 2df5e4b9eff89d..8ae4f07ba57752 100644 --- a/src/darwin/Framework/CHIP/CHIPError.h +++ b/src/darwin/Framework/CHIP/CHIPError.h @@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN FOUNDATION_EXPORT NSErrorDomain const CHIPErrorDomain; -typedef int32_t CHIP_ERROR; +typedef uint32_t CHIP_ERROR; typedef NS_ERROR_ENUM(CHIPErrorDomain, CHIPErrorCode) { CHIPSuccess = 0, diff --git a/src/include/platform/CHIPDeviceError.h b/src/include/platform/CHIPDeviceError.h index 0f25adff90f4cb..7b2fb25ec16d25 100644 --- a/src/include/platform/CHIPDeviceError.h +++ b/src/include/platform/CHIPDeviceError.h @@ -18,9 +18,9 @@ #pragma once -#define CHIP_DEVICE_ERROR_MIN 11000000 -#define CHIP_DEVICE_ERROR_MAX 11000999 -#define CHIP_DEVICE_ERROR(e) (CHIP_DEVICE_ERROR_MIN + (e)) +#include + +#define CHIP_DEVICE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kDevice, (e)) /** * @def CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND @@ -29,7 +29,7 @@ * The requested configuration value was not found. * */ -#define CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND CHIP_DEVICE_ERROR(1) +#define CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND CHIP_DEVICE_ERROR(0x01) /** * @def CHIP_DEVICE_ERROR_NOT_SERVICE_PROVISIONED @@ -38,7 +38,7 @@ * The device has not been service provisioned. * */ -#define CHIP_DEVICE_ERROR_NOT_SERVICE_PROVISIONED CHIP_DEVICE_ERROR(2) +#define CHIP_DEVICE_ERROR_NOT_SERVICE_PROVISIONED CHIP_DEVICE_ERROR(0x02) /** * @def CHIP_DEVICE_ERROR_SOFTWARE_UPDATE_ABORTED @@ -47,7 +47,7 @@ * The software update was aborted by application * */ -#define CHIP_DEVICE_ERROR_SOFTWARE_UPDATE_ABORTED CHIP_DEVICE_ERROR(3) +#define CHIP_DEVICE_ERROR_SOFTWARE_UPDATE_ABORTED CHIP_DEVICE_ERROR(0x03) /** * @def CHIP_DEVICE_ERROR_SOFTWARE_UPDATE_IGNORED @@ -56,4 +56,4 @@ * The software update was ignored by application. * */ -#define CHIP_DEVICE_ERROR_SOFTWARE_UPDATE_IGNORED CHIP_DEVICE_ERROR(4) +#define CHIP_DEVICE_ERROR_SOFTWARE_UPDATE_IGNORED CHIP_DEVICE_ERROR(0x04) diff --git a/src/inet/InetError.cpp b/src/inet/InetError.cpp index d94221e2e27391..85f16ed77b9803 100644 --- a/src/inet/InetError.cpp +++ b/src/inet/InetError.cpp @@ -59,7 +59,7 @@ bool FormatLayerError(char * buf, uint16_t bufSize, CHIP_ERROR err) { const char * desc = nullptr; - if (err < INET_CONFIG_ERROR_MIN || err > INET_CONFIG_ERROR_MAX) + if (!ChipError::IsPart(ChipError::SdkPart::kInet, err)) { return false; } diff --git a/src/inet/InetError.h b/src/inet/InetError.h index a34690699b8624..86d0335457cb26 100644 --- a/src/inet/InetError.h +++ b/src/inet/InetError.h @@ -32,25 +32,12 @@ #include +#include #include -// clang-format off +#define CHIP_INET_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kInet, (e)) -/** - * @def CHIP_INET_ERROR(e) - * - * @brief - * This defines a mapping function for InetLayer errors that allows - * mapping such errors into a platform- or system-specific - * range. This function may be configured via - * #INET_CONFIG_ERROR(e). - * - * @param[in] e The InetLayer error to map. - * - * @return The mapped InetLayer error. - * - */ -#define CHIP_INET_ERROR(e) INET_CONFIG_ERROR(e) +// clang-format off /** * @name Error Definitions @@ -66,9 +53,7 @@ * the expected type or scope. * */ -#define INET_ERROR_WRONG_ADDRESS_TYPE CHIP_INET_ERROR(0) - -// unused CHIP_INET_ERROR(1) +#define INET_ERROR_WRONG_ADDRESS_TYPE CHIP_INET_ERROR(0x01) /** * @def INET_ERROR_PEER_DISCONNECTED @@ -77,14 +62,14 @@ * A remote connection peer disconnected. * */ -#define INET_ERROR_PEER_DISCONNECTED CHIP_INET_ERROR(2) +#define INET_ERROR_PEER_DISCONNECTED CHIP_INET_ERROR(0x02) -// unused CHIP_INET_ERROR(3) -// unused CHIP_INET_ERROR(4) -// unused CHIP_INET_ERROR(5) -// unused CHIP_INET_ERROR(6) -// unused CHIP_INET_ERROR(7) -// unused CHIP_INET_ERROR(8) +// unused CHIP_INET_ERROR(0x03) +// unused CHIP_INET_ERROR(0x04) +// unused CHIP_INET_ERROR(0x05) +// unused CHIP_INET_ERROR(0x06) +// unused CHIP_INET_ERROR(0x07) +// unused CHIP_INET_ERROR(0x08) /** * @def INET_ERROR_HOST_NOT_FOUND @@ -93,7 +78,7 @@ * A requested host name could not be resolved to an address. * */ -#define INET_ERROR_HOST_NOT_FOUND CHIP_INET_ERROR(9) +#define INET_ERROR_HOST_NOT_FOUND CHIP_INET_ERROR(0x09) /** * @def INET_ERROR_DNS_TRY_AGAIN @@ -103,7 +88,7 @@ * again later. * */ -#define INET_ERROR_DNS_TRY_AGAIN CHIP_INET_ERROR(10) +#define INET_ERROR_DNS_TRY_AGAIN CHIP_INET_ERROR(0x0a) /** * @def INET_ERROR_DNS_NO_RECOVERY @@ -112,9 +97,9 @@ * A name server returned an unrecoverable error. * */ -#define INET_ERROR_DNS_NO_RECOVERY CHIP_INET_ERROR(11) +#define INET_ERROR_DNS_NO_RECOVERY CHIP_INET_ERROR(0x0b) -// unused CHIP_INET_ERROR(12) +// unused CHIP_INET_ERROR(0x0c) /** * @def INET_ERROR_WRONG_PROTOCOL_TYPE @@ -123,7 +108,7 @@ * An incorrect or unexpected protocol type was encountered. * */ -#define INET_ERROR_WRONG_PROTOCOL_TYPE CHIP_INET_ERROR(13) +#define INET_ERROR_WRONG_PROTOCOL_TYPE CHIP_INET_ERROR(0x0d) /** * @def INET_ERROR_UNKNOWN_INTERFACE @@ -132,9 +117,9 @@ * An unknown interface identifier was encountered. * */ -#define INET_ERROR_UNKNOWN_INTERFACE CHIP_INET_ERROR(14) +#define INET_ERROR_UNKNOWN_INTERFACE CHIP_INET_ERROR(0x0e) -// unused CHIP_INET_ERROR(15) +// unused CHIP_INET_ERROR(0x0f) /** * @def INET_ERROR_ADDRESS_NOT_FOUND @@ -143,7 +128,7 @@ * A requested address type, class, or scope cannot be found. * */ -#define INET_ERROR_ADDRESS_NOT_FOUND CHIP_INET_ERROR(16) +#define INET_ERROR_ADDRESS_NOT_FOUND CHIP_INET_ERROR(0x10) /** * @def INET_ERROR_HOST_NAME_TOO_LONG @@ -152,7 +137,7 @@ * A requested host name is too long. * */ -#define INET_ERROR_HOST_NAME_TOO_LONG CHIP_INET_ERROR(17) +#define INET_ERROR_HOST_NAME_TOO_LONG CHIP_INET_ERROR(0x11) /** * @def INET_ERROR_INVALID_HOST_NAME @@ -161,10 +146,10 @@ * A requested host name and port is invalid. * */ -#define INET_ERROR_INVALID_HOST_NAME CHIP_INET_ERROR(18) +#define INET_ERROR_INVALID_HOST_NAME CHIP_INET_ERROR(0x12) -// unused CHIP_INET_ERROR(19) -// unused CHIP_INET_ERROR(20) +// unused CHIP_INET_ERROR(0x13) +// unused CHIP_INET_ERROR(0x14) /** * @def INET_ERROR_IDLE_TIMEOUT @@ -173,9 +158,9 @@ * A TCP connection timed out due to inactivity. * */ -#define INET_ERROR_IDLE_TIMEOUT CHIP_INET_ERROR(21) +#define INET_ERROR_IDLE_TIMEOUT CHIP_INET_ERROR(0x15) -// unused CHIP_INET_ERROR(22) +// unused CHIP_INET_ERROR(0x16) /** * @def INET_ERROR_INVALID_IPV6_PKT @@ -184,7 +169,7 @@ * An IPv6 packet is invalid. * */ -#define INET_ERROR_INVALID_IPV6_PKT CHIP_INET_ERROR(23) +#define INET_ERROR_INVALID_IPV6_PKT CHIP_INET_ERROR(0x17) /** * @def INET_ERROR_INTERFACE_INIT_FAILURE @@ -193,7 +178,7 @@ * Failure to initialize an interface. * */ -#define INET_ERROR_INTERFACE_INIT_FAILURE CHIP_INET_ERROR(24) +#define INET_ERROR_INTERFACE_INIT_FAILURE CHIP_INET_ERROR(0x18) /** * @def INET_ERROR_TCP_USER_TIMEOUT @@ -203,7 +188,7 @@ * acknowledgment for transmitted packet. * */ -#define INET_ERROR_TCP_USER_TIMEOUT CHIP_INET_ERROR(25) +#define INET_ERROR_TCP_USER_TIMEOUT CHIP_INET_ERROR(0x19) /** * @def INET_ERROR_TCP_CONNECT_TIMEOUT @@ -214,7 +199,7 @@ * of an error. * */ -#define INET_ERROR_TCP_CONNECT_TIMEOUT CHIP_INET_ERROR(26) +#define INET_ERROR_TCP_CONNECT_TIMEOUT CHIP_INET_ERROR(0x1a) /** * @def INET_ERROR_INCOMPATIBLE_IP_ADDRESS_TYPE @@ -224,7 +209,7 @@ * IP address type. * */ -#define INET_ERROR_INCOMPATIBLE_IP_ADDRESS_TYPE CHIP_INET_ERROR(27) +#define INET_ERROR_INCOMPATIBLE_IP_ADDRESS_TYPE CHIP_INET_ERROR(0x1b) // !!!!! IMPORTANT !!!!! // diff --git a/src/inet/tests/TestInetEndPoint.cpp b/src/inet/tests/TestInetEndPoint.cpp index 4547b50a5a89ff..036d0979139d57 100644 --- a/src/inet/tests/TestInetEndPoint.cpp +++ b/src/inet/tests/TestInetEndPoint.cpp @@ -217,7 +217,7 @@ static void TestInetError(nlTestSuite * inSuite, void * inContext) err = MapErrorPOSIX(EPERM); NL_TEST_ASSERT(inSuite, DescribeErrorPOSIX(err)); - NL_TEST_ASSERT(inSuite, IsErrorPOSIX(err)); + NL_TEST_ASSERT(inSuite, ChipError::IsRange(ChipError::Range::kPOSIX, err)); } static void TestInetInterface(nlTestSuite * inSuite, void * inContext) diff --git a/src/lib/asn1/ASN1Error.cpp b/src/lib/asn1/ASN1Error.cpp index 57c8990b5ed5c4..6de815d7b48d3b 100644 --- a/src/lib/asn1/ASN1Error.cpp +++ b/src/lib/asn1/ASN1Error.cpp @@ -46,7 +46,7 @@ bool FormatASN1Error(char * buf, uint16_t bufSize, int32_t err) { const char * desc = nullptr; - if (err < ASN1_ERROR_MIN || err > ASN1_ERROR_MAX) + if (!ChipError::IsPart(ChipError::SdkPart::kASN1, err)) { return false; } diff --git a/src/lib/asn1/ASN1Error.h b/src/lib/asn1/ASN1Error.h index 4b94650b6d4b13..a6fc83ba551125 100644 --- a/src/lib/asn1/ASN1Error.h +++ b/src/lib/asn1/ASN1Error.h @@ -33,48 +33,13 @@ #include +#define CHIP_ASN1_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kASN1, (e)) + namespace chip { namespace ASN1 { // clang-format off -/** - * @def ASN1_ERROR_MIN - * - * @brief - * This defines the base or minimum ASN1 error number range. - * This value may be configured via #ASN1_CONFIG_ERROR_MIN. - * - */ -#define ASN1_ERROR_MIN ASN1_CONFIG_ERROR_MIN - -/** - * @def ASN1_ERROR_MAX - * - * @brief - * This defines the top or maximum ASN1 error number range. - * This value may be configured via #ASN1_CONFIG_ERROR_MAX. - * - */ -#define ASN1_ERROR_MAX ASN1_CONFIG_ERROR_MAX - -/** - * @def CHIP_ASN1_ERROR(e) - * - * @brief - * This defines a mapping function for ASN1 errors that allows - * mapping such errors into a platform- or system-specific - * range. This function may be configured via - * #ASN1_CONFIG_ERROR(e). - * - * @param[in] e The ASN1 error to map. - * - * @return The mapped ASN1 error. - * - */ -#define CHIP_ASN1_ERROR(e) ASN1_CONFIG_ERROR(e) - - /** * @name Error Definitions * @@ -88,7 +53,7 @@ namespace ASN1 { * An end of ASN1 container or stream condition occurred. * */ -#define ASN1_END CHIP_ASN1_ERROR(0) +#define ASN1_END CHIP_ASN1_ERROR(0x00) /** * @def ASN1_ERROR_UNDERRUN @@ -97,7 +62,7 @@ namespace ASN1 { * The ASN.1 encoding ended prematurely. * */ -#define ASN1_ERROR_UNDERRUN CHIP_ASN1_ERROR(1) +#define ASN1_ERROR_UNDERRUN CHIP_ASN1_ERROR(0x01) /** * @def ASN1_ERROR_OVERFLOW @@ -106,7 +71,7 @@ namespace ASN1 { * The encoding exceeds the available space required to write it. * */ -#define ASN1_ERROR_OVERFLOW CHIP_ASN1_ERROR(2) +#define ASN1_ERROR_OVERFLOW CHIP_ASN1_ERROR(0x02) /** * @def ASN1_ERROR_INVALID_STATE @@ -115,7 +80,7 @@ namespace ASN1 { * An unexpected or invalid state was encountered. * */ -#define ASN1_ERROR_INVALID_STATE CHIP_ASN1_ERROR(3) +#define ASN1_ERROR_INVALID_STATE CHIP_ASN1_ERROR(0x03) /** * @def ASN1_ERROR_MAX_DEPTH_EXCEEDED @@ -124,7 +89,7 @@ namespace ASN1 { * The maximum number of container reading contexts was exceeded. * */ -#define ASN1_ERROR_MAX_DEPTH_EXCEEDED CHIP_ASN1_ERROR(4) +#define ASN1_ERROR_MAX_DEPTH_EXCEEDED CHIP_ASN1_ERROR(0x04) /** * @def ASN1_ERROR_INVALID_ENCODING @@ -133,7 +98,7 @@ namespace ASN1 { * The ASN.1 encoding is invalid. * */ -#define ASN1_ERROR_INVALID_ENCODING CHIP_ASN1_ERROR(5) +#define ASN1_ERROR_INVALID_ENCODING CHIP_ASN1_ERROR(0x05) /** * @def ASN1_ERROR_UNSUPPORTED_ENCODING @@ -142,7 +107,7 @@ namespace ASN1 { * An unsupported encoding was requested or encountered. * */ -#define ASN1_ERROR_UNSUPPORTED_ENCODING CHIP_ASN1_ERROR(6) +#define ASN1_ERROR_UNSUPPORTED_ENCODING CHIP_ASN1_ERROR(0x06) /** * @def ASN1_ERROR_TAG_OVERFLOW @@ -152,7 +117,7 @@ namespace ASN1 { * for it. * */ -#define ASN1_ERROR_TAG_OVERFLOW CHIP_ASN1_ERROR(7) +#define ASN1_ERROR_TAG_OVERFLOW CHIP_ASN1_ERROR(0x07) /** * @def ASN1_ERROR_LENGTH_OVERFLOW @@ -162,7 +127,7 @@ namespace ASN1 { * required for it. * */ -#define ASN1_ERROR_LENGTH_OVERFLOW CHIP_ASN1_ERROR(8) +#define ASN1_ERROR_LENGTH_OVERFLOW CHIP_ASN1_ERROR(0x08) /** * @def ASN1_ERROR_VALUE_OVERFLOW @@ -172,7 +137,7 @@ namespace ASN1 { * required for it. * */ -#define ASN1_ERROR_VALUE_OVERFLOW CHIP_ASN1_ERROR(9) +#define ASN1_ERROR_VALUE_OVERFLOW CHIP_ASN1_ERROR(0x09) /** * @def ASN1_ERROR_UNKNOWN_OBJECT_ID @@ -182,7 +147,7 @@ namespace ASN1 { * supported object identifiers. * */ -#define ASN1_ERROR_UNKNOWN_OBJECT_ID CHIP_ASN1_ERROR(10) +#define ASN1_ERROR_UNKNOWN_OBJECT_ID CHIP_ASN1_ERROR(0x0a) // !!!!! IMPORTANT !!!!! // diff --git a/src/lib/core/CHIPConfig.h b/src/lib/core/CHIPConfig.h index 2c166d41e0ee77..2d40edb3a53683 100644 --- a/src/lib/core/CHIPConfig.h +++ b/src/lib/core/CHIPConfig.h @@ -74,55 +74,6 @@ // Profile-specific Configuration Headers -/** - * @def CHIP_CONFIG_ERROR_TYPE - * - * @brief - * This defines the data type used to represent errors for chip. - * - */ -#ifndef CHIP_CONFIG_ERROR_TYPE -#include -#include - -#define CHIP_CONFIG_ERROR_TYPE int32_t -#define CHIP_CONFIG_ERROR_FORMAT PRId32 -#endif // CHIP_CONFIG_ERROR_TYPE - -/** - * @def CHIP_CONFIG_CORE_ERROR_MIN - * - * @brief - * This defines the base or minimum chip error number range. - * - */ -#ifndef CHIP_CONFIG_CORE_ERROR_MIN -#define CHIP_CONFIG_CORE_ERROR_MIN 4000 -#endif // CHIP_CONFIG_CORE_ERROR_MIN - -/** - * @def CHIP_CONFIG_CORE_ERROR_MAX - * - * @brief - * This defines the top or maximum chip error number range. - * - */ -#ifndef CHIP_CONFIG_CORE_ERROR_MAX -#define CHIP_CONFIG_CORE_ERROR_MAX 4999 -#endif // CHIP_CONFIG_CORE_ERROR_MAX - -/** - * @def CHIP_CONFIG_CORE_ERROR - * - * @brief - * This defines a mapping function for chip errors that allows - * mapping such errors into a platform- or system-specific manner. - * - */ -#ifndef CHIP_CONFIG_CORE_ERROR -#define CHIP_CONFIG_CORE_ERROR(e) (CHIP_CONFIG_CORE_ERROR_MIN + (e)) -#endif // CHIP_CONFIG_CORE_ERROR - /** * @def CHIP_CONFIG_USE_OPENSSL_ECC * diff --git a/src/lib/core/CHIPError.cpp b/src/lib/core/CHIPError.cpp index cad220af252cc9..ae7bf6e534dd18 100644 --- a/src/lib/core/CHIPError.cpp +++ b/src/lib/core/CHIPError.cpp @@ -54,7 +54,7 @@ bool FormatCHIPError(char * buf, uint16_t bufSize, CHIP_ERROR err) { const char * desc = nullptr; - if (err < CHIP_CONFIG_CORE_ERROR_MIN || err > CHIP_CONFIG_CORE_ERROR_MAX) + if (!ChipError::IsPart(ChipError::SdkPart::kCore, err)) { return false; } diff --git a/src/lib/core/CHIPError.h b/src/lib/core/CHIPError.h index 6f50a7e1e2da6d..50c4ba994e71b0 100644 --- a/src/lib/core/CHIPError.h +++ b/src/lib/core/CHIPError.h @@ -24,52 +24,154 @@ * Error types, ranges, and mappings overrides may be made by * defining the appropriate CHIP_CONFIG_* or _CHIP_CONFIG_* * macros. - * - * NOTE WELL: On some platforms, this header is included by C-language programs. - * */ #pragma once #include +#include +#include #include +#include -// clang-format off +namespace chip { /** - * The basic type for all CHIP errors. - * - * @brief - * This is defined to a platform- or system-specific type. - * - */ -typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; + * This is a helper class for managing `CHIP_ERROR` numbers. + * + * At the top level, an error belongs to a `Range` and has an integral Value whose meaning depends on the `Range`. + * One, `Range::kSDK`, is used for the CHIP SDK's own errors; others encapsulate error codes from external sources + * (e.g. libraries, OS) into a `CHIP_ERROR`. + * + * CHIP SDK errors inside `Range::kSDK` consist of a component identifier given by `SdkPart` and an arbitrary small + * integer Code. + */ +class ChipError +{ +public: + using BaseType = uint32_t; + + /// `printf` format for error numbers. This is a C macro in order to allow for string literal concatenation. +#define CHIP_ERROR_FORMAT PRIx32 + + /// Top-level error classification. + enum class Range : uint8_t + { + kSDK = 0x0, ///< CHIP SDK errors. + kOS = 0x1, ///< Encapsulated OS errors, other than POSIX errno. + kPOSIX = 0x2, ///< Encapsulated POSIX errno values. + kLwIP = 0x3, ///< Encapsulated LwIP errors. + kOpenThread = 0x4, ///< Encapsulated OpenThread errors. + kPlatform = 0x5, ///< Platform-defined encapsulation. + }; + + /// Secondary classification of errors in `Range::kSDK`. + enum class SdkPart : uint8_t + { + kCore = 0, ///< SDK core errors. + kInet = 1, ///< Inet layer errors; see . + kDevice = 2, ///< Device layer errors; see . + kASN1 = 3, ///< ASN1 errors; see . + kBLE = 4, ///< BLE layer errors; see . + kApplication = 7, ///< Application-defined errors. + }; + + /// Test whether @a error belongs to @a range. + static constexpr bool IsRange(Range range, BaseType error) + { + return (error & MakeMask(kRangeStart, kRangeLength)) == MakeField(kRangeStart, static_cast(range)); + } + + static constexpr Range GetRange(BaseType error) { return static_cast(GetField(kRangeStart, kRangeLength, error)); } + static BaseType GetValue(BaseType error) { return GetField(kValueStart, kValueLength, error); } + + /// Test whether if @a value can be losslessly encapsulated in a `CHIP_ERROR`. + static constexpr bool CanEncapsulate(BaseType value) { return FitsInField(kValueLength, value); } + + /// Construct a `CHIP_ERROR` encapsulating @a value inside the @a range. + static BaseType Encapsulate(Range range, BaseType value) { return MakeInteger(range, (value & MakeMask(0, kValueLength))); } + + /// Test whether @a error is an SDK error belonging to @a part. + static constexpr bool IsPart(SdkPart part, BaseType error) + { + return (error & (MakeMask(kRangeStart, kRangeLength) | MakeMask(kSdkPartStart, kSdkPartLength))) == + (MakeField(kRangeStart, static_cast(Range::kSDK)) | MakeField(kSdkPartStart, static_cast(part))); + } + +private: + /* + * The representation of a CHIP_ERROR is structured so that SDK error code constants are small, in order to improve code + * density on embedded builds. Arm 32, Xtensa, and RISC-V can all handle 11-bit values in a move-immediate instruction. + * Further, `SdkPart::kCore` is 0 so that the most common errors fit in 8 bits for additional density on some processors. + * + * 31 28 24 20 16 12 8 4 0 Bit + * | | | | | | | | | + * | range | value | + * | kSdk==0 | 0 |0| part| code | SDK error + * | 01 - FF | encapsulated error code | Encapsulated error + */ + static constexpr int kRangeStart = 24; + static constexpr int kRangeLength = 8; + static constexpr int kValueStart = 0; + static constexpr int kValueLength = 24; + + static constexpr int kSdkPartStart = 8; + static constexpr int kSdkPartLength = 3; + static constexpr int kSdkCodeStart = 0; + static constexpr int kSdkCodeLength = 8; + + static constexpr BaseType GetField(unsigned int start, unsigned int length, BaseType value) + { + return (value >> start) & ((1u << length) - 1); + } + static constexpr BaseType MakeMask(unsigned int start, unsigned int length) { return ((1u << length) - 1) << start; } + static constexpr BaseType MakeField(unsigned int start, BaseType value) { return value << start; } + static constexpr bool FitsInField(unsigned int length, BaseType value) { return value < (1u << length); } + + static constexpr BaseType MakeInteger(Range range, BaseType value) + { + return MakeField(kRangeStart, to_underlying(range)) | MakeField(kValueStart, value); + } + static constexpr BaseType MakeInteger(SdkPart part, BaseType code) + { + return MakeInteger(Range::kSDK, MakeField(kSdkPartStart, to_underlying(part)) | MakeField(kSdkCodeStart, code)); + } + +public: + /* + * Wrapper for constructing error constants. This is a C macro so that it can easily be augmented to track + * error source line information on large platforms without touching users. + * + * The underlying template ensures that the numeric value is constant and well-formed. + * (In C++20 this could be replaced by a consteval function.) + */ +#define CHIP_SDK_ERROR(part, code) (::chip::ChipError::MakeSdkErrorConstant<(part), (code)>::value) + template + struct MakeSdkErrorConstant + { + static_assert(FitsInField(kSdkPartLength, to_underlying(part)), "part is too large"); + static_assert(FitsInField(kSdkCodeLength, code), "code is too large"); + static_assert(MakeInteger(part, code) != 0, "value is zero"); + static constexpr BaseType value = MakeInteger(part, code); + }; +}; -#define CHIP_ERROR_FORMAT CHIP_CONFIG_ERROR_FORMAT +} // namespace chip /** - * @def CHIP_NO_ERROR - * - * @brief - * This defines the CHIP error code for success or no error. - * + * The basic type for all CHIP errors. */ -#define CHIP_NO_ERROR 0 +using CHIP_ERROR = ::chip::ChipError::BaseType; /** - * @def CHIP_CORE_ERROR(e) - * - * @brief - * This defines a mapping function for CHIP errors that allows - * mapping such errors into a platform- or system-specific range. - * This function may be configured via #CHIP_CONFIG_CORE_ERROR(e). - * - * @param[in] e The CHIP error to map. - * - * @return The mapped CHIP error. + * Applications using the CHIP SDK can use this to define error codes in the `CHIP_ERROR` space for their own purposes. */ -#define CHIP_CORE_ERROR(e) CHIP_CONFIG_CORE_ERROR(e) +#define CHIP_APPLICATION_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kApplication, (e)) + +#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e)) + +// clang-format off /** * @name Error Definitions @@ -78,14 +180,13 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; */ /** - * @def CHIP_ERROR_TOO_MANY_CONNECTIONS + * @def CHIP_NO_ERROR * * @brief - * The attempt to allocate a connection object failed because too many - * connections exist. + * This defines the CHIP error code for success or no error. * */ -#define CHIP_ERROR_TOO_MANY_CONNECTIONS CHIP_CORE_ERROR(0) +#define CHIP_NO_ERROR (0) /** * @def CHIP_ERROR_SENDING_BLOCKED @@ -94,7 +195,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A message exceeds the sent limit. * */ -#define CHIP_ERROR_SENDING_BLOCKED CHIP_CORE_ERROR(1) +#define CHIP_ERROR_SENDING_BLOCKED CHIP_CORE_ERROR(0x01) /** * @def CHIP_ERROR_CONNECTION_ABORTED @@ -103,7 +204,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A connection has been aborted. * */ -#define CHIP_ERROR_CONNECTION_ABORTED CHIP_CORE_ERROR(2) +#define CHIP_ERROR_CONNECTION_ABORTED CHIP_CORE_ERROR(0x02) /** * @def CHIP_ERROR_INCORRECT_STATE @@ -112,7 +213,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * An unexpected state was encountered. * */ -#define CHIP_ERROR_INCORRECT_STATE CHIP_CORE_ERROR(3) +#define CHIP_ERROR_INCORRECT_STATE CHIP_CORE_ERROR(0x03) /** * @def CHIP_ERROR_MESSAGE_TOO_LONG @@ -121,7 +222,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A message is too long. * */ -#define CHIP_ERROR_MESSAGE_TOO_LONG CHIP_CORE_ERROR(4) +#define CHIP_ERROR_MESSAGE_TOO_LONG CHIP_CORE_ERROR(0x04) /** * @def CHIP_ERROR_UNSUPPORTED_EXCHANGE_VERSION @@ -130,7 +231,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * An exchange version is not supported. * */ -#define CHIP_ERROR_UNSUPPORTED_EXCHANGE_VERSION CHIP_CORE_ERROR(5) +#define CHIP_ERROR_UNSUPPORTED_EXCHANGE_VERSION CHIP_CORE_ERROR(0x05) /** * @def CHIP_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS @@ -140,7 +241,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * unsolicited message handler pool is full. * */ -#define CHIP_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS CHIP_CORE_ERROR(6) +#define CHIP_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS CHIP_CORE_ERROR(0x06) /** * @def CHIP_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER @@ -150,7 +251,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * the target handler was not found in the unsolicited message handler pool. * */ -#define CHIP_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER CHIP_CORE_ERROR(7) +#define CHIP_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER CHIP_CORE_ERROR(0x07) /** * @def CHIP_ERROR_NO_CONNECTION_HANDLER @@ -159,7 +260,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * No callback has been registered for handling a connection. * */ -#define CHIP_ERROR_NO_CONNECTION_HANDLER CHIP_CORE_ERROR(8) +#define CHIP_ERROR_NO_CONNECTION_HANDLER CHIP_CORE_ERROR(0x08) /** * @def CHIP_ERROR_TOO_MANY_PEER_NODES @@ -168,7 +269,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The number of peer nodes exceeds the maximum limit of a local node. * */ -#define CHIP_ERROR_TOO_MANY_PEER_NODES CHIP_CORE_ERROR(9) +#define CHIP_ERROR_TOO_MANY_PEER_NODES CHIP_CORE_ERROR(0x09) /** * @def CHIP_ERROR_SENTINEL @@ -177,7 +278,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * For use locally to mark conditions such as value found or end of iteration. * */ -#define CHIP_ERROR_SENTINEL CHIP_CORE_ERROR(10) +#define CHIP_ERROR_SENTINEL CHIP_CORE_ERROR(0x0a) /** * @def CHIP_ERROR_NO_MEMORY @@ -186,7 +287,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The attempt to allocate a buffer or object failed due to a lack of memory. * */ -#define CHIP_ERROR_NO_MEMORY CHIP_CORE_ERROR(11) +#define CHIP_ERROR_NO_MEMORY CHIP_CORE_ERROR(0x0b) /** * @def CHIP_ERROR_NO_MESSAGE_HANDLER @@ -195,7 +296,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * No callback has been registered for handling a message. * */ -#define CHIP_ERROR_NO_MESSAGE_HANDLER CHIP_CORE_ERROR(12) +#define CHIP_ERROR_NO_MESSAGE_HANDLER CHIP_CORE_ERROR(0x0c) /** * @def CHIP_ERROR_MESSAGE_INCOMPLETE @@ -204,7 +305,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A message is incomplete. * */ -#define CHIP_ERROR_MESSAGE_INCOMPLETE CHIP_CORE_ERROR(13) +#define CHIP_ERROR_MESSAGE_INCOMPLETE CHIP_CORE_ERROR(0x0d) /** * @def CHIP_ERROR_DATA_NOT_ALIGNED @@ -213,7 +314,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The data is not aligned. * */ -#define CHIP_ERROR_DATA_NOT_ALIGNED CHIP_CORE_ERROR(14) +#define CHIP_ERROR_DATA_NOT_ALIGNED CHIP_CORE_ERROR(0x0e) /** * @def CHIP_ERROR_UNKNOWN_KEY_TYPE @@ -222,7 +323,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The encryption key type is unknown. * */ -#define CHIP_ERROR_UNKNOWN_KEY_TYPE CHIP_CORE_ERROR(15) +#define CHIP_ERROR_UNKNOWN_KEY_TYPE CHIP_CORE_ERROR(0x0f) /** * @def CHIP_ERROR_KEY_NOT_FOUND @@ -231,7 +332,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The encryption key is not found. * */ -#define CHIP_ERROR_KEY_NOT_FOUND CHIP_CORE_ERROR(16) +#define CHIP_ERROR_KEY_NOT_FOUND CHIP_CORE_ERROR(0x10) /** * @def CHIP_ERROR_WRONG_ENCRYPTION_TYPE @@ -240,7 +341,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The encryption type is incorrect for the specified key. * */ -#define CHIP_ERROR_WRONG_ENCRYPTION_TYPE CHIP_CORE_ERROR(17) +#define CHIP_ERROR_WRONG_ENCRYPTION_TYPE CHIP_CORE_ERROR(0x11) /** * @def CHIP_ERROR_TOO_MANY_KEYS @@ -250,7 +351,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * exceeds the maximum limit. * */ -#define CHIP_ERROR_TOO_MANY_KEYS CHIP_CORE_ERROR(18) +#define CHIP_ERROR_TOO_MANY_KEYS CHIP_CORE_ERROR(0x12) /** * @def CHIP_ERROR_INTEGRITY_CHECK_FAILED @@ -260,7 +361,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * check. * */ -#define CHIP_ERROR_INTEGRITY_CHECK_FAILED CHIP_CORE_ERROR(19) +#define CHIP_ERROR_INTEGRITY_CHECK_FAILED CHIP_CORE_ERROR(0x13) /** * @def CHIP_ERROR_INVALID_SIGNATURE @@ -269,7 +370,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * Invalid signature. * */ -#define CHIP_ERROR_INVALID_SIGNATURE CHIP_CORE_ERROR(20) +#define CHIP_ERROR_INVALID_SIGNATURE CHIP_CORE_ERROR(0x14) /** * @def CHIP_ERROR_UNSUPPORTED_MESSAGE_VERSION @@ -278,7 +379,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A message version is unsupported. * */ -#define CHIP_ERROR_UNSUPPORTED_MESSAGE_VERSION CHIP_CORE_ERROR(21) +#define CHIP_ERROR_UNSUPPORTED_MESSAGE_VERSION CHIP_CORE_ERROR(0x15) /** * @def CHIP_ERROR_UNSUPPORTED_ENCRYPTION_TYPE @@ -287,7 +388,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * An encryption type is unsupported. * */ -#define CHIP_ERROR_UNSUPPORTED_ENCRYPTION_TYPE CHIP_CORE_ERROR(22) +#define CHIP_ERROR_UNSUPPORTED_ENCRYPTION_TYPE CHIP_CORE_ERROR(0x16) /** * @def CHIP_ERROR_UNSUPPORTED_SIGNATURE_TYPE @@ -296,7 +397,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A signature type is unsupported. * */ -#define CHIP_ERROR_UNSUPPORTED_SIGNATURE_TYPE CHIP_CORE_ERROR(23) +#define CHIP_ERROR_UNSUPPORTED_SIGNATURE_TYPE CHIP_CORE_ERROR(0x17) /** * @def CHIP_ERROR_INVALID_MESSAGE_LENGTH @@ -305,7 +406,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A message length is invalid. * */ -#define CHIP_ERROR_INVALID_MESSAGE_LENGTH CHIP_CORE_ERROR(24) +#define CHIP_ERROR_INVALID_MESSAGE_LENGTH CHIP_CORE_ERROR(0x18) /** * @def CHIP_ERROR_BUFFER_TOO_SMALL @@ -314,7 +415,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A buffer is too small. * */ -#define CHIP_ERROR_BUFFER_TOO_SMALL CHIP_CORE_ERROR(25) +#define CHIP_ERROR_BUFFER_TOO_SMALL CHIP_CORE_ERROR(0x19) /** * @def CHIP_ERROR_DUPLICATE_KEY_ID @@ -323,7 +424,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A key id is duplicate. * */ -#define CHIP_ERROR_DUPLICATE_KEY_ID CHIP_CORE_ERROR(26) +#define CHIP_ERROR_DUPLICATE_KEY_ID CHIP_CORE_ERROR(0x1a) /** * @def CHIP_ERROR_WRONG_KEY_TYPE @@ -332,7 +433,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A key type does not match the expected key type. * */ -#define CHIP_ERROR_WRONG_KEY_TYPE CHIP_CORE_ERROR(27) +#define CHIP_ERROR_WRONG_KEY_TYPE CHIP_CORE_ERROR(0x1b) /** * @def CHIP_ERROR_WELL_UNINITIALIZED @@ -341,7 +442,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A requested object is uninitialized. * */ -#define CHIP_ERROR_WELL_UNINITIALIZED CHIP_CORE_ERROR(28) +#define CHIP_ERROR_WELL_UNINITIALIZED CHIP_CORE_ERROR(0x1c) /** * @def CHIP_ERROR_WELL_EMPTY @@ -350,7 +451,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A requested object is empty. * */ -#define CHIP_ERROR_WELL_EMPTY CHIP_CORE_ERROR(29) +#define CHIP_ERROR_WELL_EMPTY CHIP_CORE_ERROR(0x1d) /** * @def CHIP_ERROR_INVALID_STRING_LENGTH @@ -359,7 +460,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A string length is invalid. * */ -#define CHIP_ERROR_INVALID_STRING_LENGTH CHIP_CORE_ERROR(30) +#define CHIP_ERROR_INVALID_STRING_LENGTH CHIP_CORE_ERROR(0x1e) /** * @def CHIP_ERROR_INVALID_LIST_LENGTH @@ -368,7 +469,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A list length is invalid. * */ -#define CHIP_ERROR_INVALID_LIST_LENGTH CHIP_CORE_ERROR(31) +#define CHIP_ERROR_INVALID_LIST_LENGTH CHIP_CORE_ERROR(0x1f) /** * @def CHIP_ERROR_INVALID_INTEGRITY_TYPE @@ -377,7 +478,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * An integrity type is invalid. * */ -#define CHIP_ERROR_INVALID_INTEGRITY_TYPE CHIP_CORE_ERROR(32) +#define CHIP_ERROR_INVALID_INTEGRITY_TYPE CHIP_CORE_ERROR(0x20) /** * @def CHIP_END_OF_TLV @@ -387,7 +488,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * or the end of a TLV container element has been reached. * */ -#define CHIP_ERROR_END_OF_TLV CHIP_CORE_ERROR(33) +#define CHIP_ERROR_END_OF_TLV CHIP_CORE_ERROR(0x21) #define CHIP_END_OF_TLV CHIP_ERROR_END_OF_TLV /** @@ -397,7 +498,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The TLV encoding ended prematurely. * */ -#define CHIP_ERROR_TLV_UNDERRUN CHIP_CORE_ERROR(34) +#define CHIP_ERROR_TLV_UNDERRUN CHIP_CORE_ERROR(0x22) /** * @def CHIP_ERROR_INVALID_TLV_ELEMENT @@ -406,7 +507,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A TLV element is invalid. * */ -#define CHIP_ERROR_INVALID_TLV_ELEMENT CHIP_CORE_ERROR(35) +#define CHIP_ERROR_INVALID_TLV_ELEMENT CHIP_CORE_ERROR(0x23) /** * @def CHIP_ERROR_INVALID_TLV_TAG @@ -415,7 +516,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A TLV tag is invalid. * */ -#define CHIP_ERROR_INVALID_TLV_TAG CHIP_CORE_ERROR(36) +#define CHIP_ERROR_INVALID_TLV_TAG CHIP_CORE_ERROR(0x24) /** * @def CHIP_ERROR_UNKNOWN_IMPLICIT_TLV_TAG @@ -425,7 +526,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * but an implicit profile id has not been defined. * */ -#define CHIP_ERROR_UNKNOWN_IMPLICIT_TLV_TAG CHIP_CORE_ERROR(37) +#define CHIP_ERROR_UNKNOWN_IMPLICIT_TLV_TAG CHIP_CORE_ERROR(0x25) /** * @def CHIP_ERROR_WRONG_TLV_TYPE @@ -434,7 +535,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A TLV type is wrong. * */ -#define CHIP_ERROR_WRONG_TLV_TYPE CHIP_CORE_ERROR(38) +#define CHIP_ERROR_WRONG_TLV_TYPE CHIP_CORE_ERROR(0x26) /** * @def CHIP_ERROR_TLV_CONTAINER_OPEN @@ -443,7 +544,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A TLV container is unexpectedly open. * */ -#define CHIP_ERROR_TLV_CONTAINER_OPEN CHIP_CORE_ERROR(39) +#define CHIP_ERROR_TLV_CONTAINER_OPEN CHIP_CORE_ERROR(0x27) /** * @def CHIP_ERROR_INVALID_TRANSFER_MODE @@ -452,7 +553,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A transfer mode is invalid. * */ -#define CHIP_ERROR_INVALID_TRANSFER_MODE CHIP_CORE_ERROR(40) +#define CHIP_ERROR_INVALID_TRANSFER_MODE CHIP_CORE_ERROR(0x28) /** * @def CHIP_ERROR_INVALID_PROFILE_ID @@ -461,7 +562,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A profile id is invalid. * */ -#define CHIP_ERROR_INVALID_PROFILE_ID CHIP_CORE_ERROR(41) +#define CHIP_ERROR_INVALID_PROFILE_ID CHIP_CORE_ERROR(0x29) /** * @def CHIP_ERROR_INVALID_MESSAGE_TYPE @@ -470,7 +571,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A message type is invalid. * */ -#define CHIP_ERROR_INVALID_MESSAGE_TYPE CHIP_CORE_ERROR(42) +#define CHIP_ERROR_INVALID_MESSAGE_TYPE CHIP_CORE_ERROR(0x2a) /** * @def CHIP_ERROR_UNEXPECTED_TLV_ELEMENT @@ -479,7 +580,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * An unexpected TLV element was encountered. * */ -#define CHIP_ERROR_UNEXPECTED_TLV_ELEMENT CHIP_CORE_ERROR(43) +#define CHIP_ERROR_UNEXPECTED_TLV_ELEMENT CHIP_CORE_ERROR(0x2b) /** * @def CHIP_ERROR_STATUS_REPORT_RECEIVED @@ -488,7 +589,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A status report is received from a peer node. * */ -#define CHIP_ERROR_STATUS_REPORT_RECEIVED CHIP_CORE_ERROR(44) +#define CHIP_ERROR_STATUS_REPORT_RECEIVED CHIP_CORE_ERROR(0x2c) /** * @def CHIP_ERROR_NOT_IMPLEMENTED @@ -497,7 +598,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A requested function or feature is not implemented. * */ -#define CHIP_ERROR_NOT_IMPLEMENTED CHIP_CORE_ERROR(45) +#define CHIP_ERROR_NOT_IMPLEMENTED CHIP_CORE_ERROR(0x2d) /** * @def CHIP_ERROR_INVALID_ADDRESS @@ -506,7 +607,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * An address is invalid. * */ -#define CHIP_ERROR_INVALID_ADDRESS CHIP_CORE_ERROR(46) +#define CHIP_ERROR_INVALID_ADDRESS CHIP_CORE_ERROR(0x2e) /** * @def CHIP_ERROR_INVALID_ARGUMENT @@ -515,7 +616,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * An argument is invalid. * */ -#define CHIP_ERROR_INVALID_ARGUMENT CHIP_CORE_ERROR(47) +#define CHIP_ERROR_INVALID_ARGUMENT CHIP_CORE_ERROR(0x2f) /** * @def CHIP_ERROR_INVALID_PATH_LIST @@ -524,7 +625,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A TLV path list is invalid. * */ -#define CHIP_ERROR_INVALID_PATH_LIST CHIP_CORE_ERROR(48) +#define CHIP_ERROR_INVALID_PATH_LIST CHIP_CORE_ERROR(0x30) /** * @def CHIP_ERROR_INVALID_DATA_LIST @@ -533,7 +634,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A TLV data list is invalid. * */ -#define CHIP_ERROR_INVALID_DATA_LIST CHIP_CORE_ERROR(49) +#define CHIP_ERROR_INVALID_DATA_LIST CHIP_CORE_ERROR(0x31) /** * @def CHIP_ERROR_TIMEOUT @@ -542,7 +643,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A request timed out. * */ -#define CHIP_ERROR_TIMEOUT CHIP_CORE_ERROR(50) +#define CHIP_ERROR_TIMEOUT CHIP_CORE_ERROR(0x32) /** * @def CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR @@ -551,7 +652,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A device descriptor is invalid. * */ -#define CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR CHIP_CORE_ERROR(51) +#define CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR CHIP_CORE_ERROR(0x33) /** * @def CHIP_ERROR_UNSUPPORTED_DEVICE_DESCRIPTOR_VERSION @@ -560,7 +661,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A device descriptor version is unsupported. * */ -#define CHIP_ERROR_UNSUPPORTED_DEVICE_DESCRIPTOR_VERSION CHIP_CORE_ERROR(52) +#define CHIP_ERROR_UNSUPPORTED_DEVICE_DESCRIPTOR_VERSION CHIP_CORE_ERROR(0x34) /** * @def CHIP_END_OF_INPUT @@ -569,7 +670,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * An input ended. * */ -#define CHIP_ERROR_END_OF_INPUT CHIP_CORE_ERROR(53) +#define CHIP_ERROR_END_OF_INPUT CHIP_CORE_ERROR(0x35) #define CHIP_END_OF_INPUT CHIP_ERROR_END_OF_INPUT /** @@ -579,7 +680,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A rate limit is exceeded. * */ -#define CHIP_ERROR_RATE_LIMIT_EXCEEDED CHIP_CORE_ERROR(54) +#define CHIP_ERROR_RATE_LIMIT_EXCEEDED CHIP_CORE_ERROR(0x36) /** * @def CHIP_ERROR_SECURITY_MANAGER_BUSY @@ -588,7 +689,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A security manager is busy. * */ -#define CHIP_ERROR_SECURITY_MANAGER_BUSY CHIP_CORE_ERROR(55) +#define CHIP_ERROR_SECURITY_MANAGER_BUSY CHIP_CORE_ERROR(0x37) /** * @def CHIP_ERROR_INVALID_PASE_PARAMETER @@ -597,7 +698,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A PASE parameter is invalid. * */ -#define CHIP_ERROR_INVALID_PASE_PARAMETER CHIP_CORE_ERROR(56) +#define CHIP_ERROR_INVALID_PASE_PARAMETER CHIP_CORE_ERROR(0x38) /** * @def CHIP_ERROR_PASE_SUPPORTS_ONLY_CONFIG1 @@ -606,7 +707,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * PASE supports only config1. * */ -#define CHIP_ERROR_PASE_SUPPORTS_ONLY_CONFIG1 CHIP_CORE_ERROR(57) +#define CHIP_ERROR_PASE_SUPPORTS_ONLY_CONFIG1 CHIP_CORE_ERROR(0x39) /** * @def CHIP_ERROR_KEY_CONFIRMATION_FAILED @@ -615,7 +716,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A key confirmation failed. * */ -#define CHIP_ERROR_KEY_CONFIRMATION_FAILED CHIP_CORE_ERROR(58) +#define CHIP_ERROR_KEY_CONFIRMATION_FAILED CHIP_CORE_ERROR(0x3a) /** * @def CHIP_ERROR_INVALID_USE_OF_SESSION_KEY @@ -624,7 +725,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A use of session key is invalid. * */ -#define CHIP_ERROR_INVALID_USE_OF_SESSION_KEY CHIP_CORE_ERROR(59) +#define CHIP_ERROR_INVALID_USE_OF_SESSION_KEY CHIP_CORE_ERROR(0x3b) /** * @def CHIP_ERROR_CONNECTION_CLOSED_UNEXPECTEDLY @@ -633,7 +734,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A connection is closed unexpectedly. * */ -#define CHIP_ERROR_CONNECTION_CLOSED_UNEXPECTEDLY CHIP_CORE_ERROR(60) +#define CHIP_ERROR_CONNECTION_CLOSED_UNEXPECTEDLY CHIP_CORE_ERROR(0x3c) /** * @def CHIP_ERROR_MISSING_TLV_ELEMENT @@ -642,7 +743,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A TLV element is missing. * */ -#define CHIP_ERROR_MISSING_TLV_ELEMENT CHIP_CORE_ERROR(61) +#define CHIP_ERROR_MISSING_TLV_ELEMENT CHIP_CORE_ERROR(0x3d) /** * @def CHIP_ERROR_RANDOM_DATA_UNAVAILABLE @@ -651,7 +752,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * Secure random data is not available. * */ -#define CHIP_ERROR_RANDOM_DATA_UNAVAILABLE CHIP_CORE_ERROR(62) +#define CHIP_ERROR_RANDOM_DATA_UNAVAILABLE CHIP_CORE_ERROR(0x3e) /** * @def CHIP_ERROR_UNSUPPORTED_HOST_PORT_ELEMENT @@ -660,7 +761,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A type in host/port list is unsupported. * */ -#define CHIP_ERROR_UNSUPPORTED_HOST_PORT_ELEMENT CHIP_CORE_ERROR(63) +#define CHIP_ERROR_UNSUPPORTED_HOST_PORT_ELEMENT CHIP_CORE_ERROR(0x3f) /** * @def CHIP_ERROR_INVALID_HOST_SUFFIX_INDEX @@ -669,7 +770,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A suffix index in host/port list is invalid. * */ -#define CHIP_ERROR_INVALID_HOST_SUFFIX_INDEX CHIP_CORE_ERROR(64) +#define CHIP_ERROR_INVALID_HOST_SUFFIX_INDEX CHIP_CORE_ERROR(0x40) /** * @def CHIP_ERROR_HOST_PORT_LIST_EMPTY @@ -678,7 +779,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A host/port list is empty. * */ -#define CHIP_ERROR_HOST_PORT_LIST_EMPTY CHIP_CORE_ERROR(65) +#define CHIP_ERROR_HOST_PORT_LIST_EMPTY CHIP_CORE_ERROR(0x41) /** * @def CHIP_ERROR_UNSUPPORTED_AUTH_MODE @@ -687,7 +788,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * An authentication mode is unsupported. * */ -#define CHIP_ERROR_UNSUPPORTED_AUTH_MODE CHIP_CORE_ERROR(66) +#define CHIP_ERROR_UNSUPPORTED_AUTH_MODE CHIP_CORE_ERROR(0x42) /** * @def CHIP_ERROR_INVALID_SERVICE_EP @@ -696,7 +797,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A service endpoint is invalid. * */ -#define CHIP_ERROR_INVALID_SERVICE_EP CHIP_CORE_ERROR(67) +#define CHIP_ERROR_INVALID_SERVICE_EP CHIP_CORE_ERROR(0x43) /** * @def CHIP_ERROR_INVALID_DIRECTORY_ENTRY_TYPE @@ -705,7 +806,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A directory entry type is unknown. * */ -#define CHIP_ERROR_INVALID_DIRECTORY_ENTRY_TYPE CHIP_CORE_ERROR(68) +#define CHIP_ERROR_INVALID_DIRECTORY_ENTRY_TYPE CHIP_CORE_ERROR(0x44) /** * @def CHIP_ERROR_FORCED_RESET @@ -714,7 +815,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A service manager is forced to reset. * */ -#define CHIP_ERROR_FORCED_RESET CHIP_CORE_ERROR(69) +#define CHIP_ERROR_FORCED_RESET CHIP_CORE_ERROR(0x45) /** * @def CHIP_ERROR_NO_ENDPOINT @@ -723,7 +824,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * No endpoint is available. * */ -#define CHIP_ERROR_NO_ENDPOINT CHIP_CORE_ERROR(70) +#define CHIP_ERROR_NO_ENDPOINT CHIP_CORE_ERROR(0x46) /** * @def CHIP_ERROR_INVALID_DESTINATION_NODE_ID @@ -732,7 +833,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A destination node id is invalid. * */ -#define CHIP_ERROR_INVALID_DESTINATION_NODE_ID CHIP_CORE_ERROR(71) +#define CHIP_ERROR_INVALID_DESTINATION_NODE_ID CHIP_CORE_ERROR(0x47) /** * @def CHIP_ERROR_NOT_CONNECTED @@ -742,7 +843,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * connected. * */ -#define CHIP_ERROR_NOT_CONNECTED CHIP_CORE_ERROR(72) +#define CHIP_ERROR_NOT_CONNECTED CHIP_CORE_ERROR(0x48) /** * @def CHIP_ERROR_NO_SW_UPDATE_AVAILABLE @@ -751,7 +852,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * No software update is available. * */ -#define CHIP_ERROR_NO_SW_UPDATE_AVAILABLE CHIP_CORE_ERROR(73) +#define CHIP_ERROR_NO_SW_UPDATE_AVAILABLE CHIP_CORE_ERROR(0x49) /** * @def CHIP_ERROR_CA_CERT_NOT_FOUND @@ -760,7 +861,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * CA certificate is not found. * */ -#define CHIP_ERROR_CA_CERT_NOT_FOUND CHIP_CORE_ERROR(74) +#define CHIP_ERROR_CA_CERT_NOT_FOUND CHIP_CORE_ERROR(0x4a) /** * @def CHIP_ERROR_CERT_PATH_LEN_CONSTRAINT_EXCEEDED @@ -769,7 +870,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A certificate path length exceeds the constraint. * */ -#define CHIP_ERROR_CERT_PATH_LEN_CONSTRAINT_EXCEEDED CHIP_CORE_ERROR(75) +#define CHIP_ERROR_CERT_PATH_LEN_CONSTRAINT_EXCEEDED CHIP_CORE_ERROR(0x4b) /** * @def CHIP_ERROR_CERT_PATH_TOO_LONG @@ -778,7 +879,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A certificate path is too long. * */ -#define CHIP_ERROR_CERT_PATH_TOO_LONG CHIP_CORE_ERROR(76) +#define CHIP_ERROR_CERT_PATH_TOO_LONG CHIP_CORE_ERROR(0x4c) /** * @def CHIP_ERROR_CERT_USAGE_NOT_ALLOWED @@ -787,7 +888,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A requested certificate usage is not allowed. * */ -#define CHIP_ERROR_CERT_USAGE_NOT_ALLOWED CHIP_CORE_ERROR(77) +#define CHIP_ERROR_CERT_USAGE_NOT_ALLOWED CHIP_CORE_ERROR(0x4d) /** * @def CHIP_ERROR_CERT_EXPIRED @@ -796,7 +897,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A certificate expired. * */ -#define CHIP_ERROR_CERT_EXPIRED CHIP_CORE_ERROR(78) +#define CHIP_ERROR_CERT_EXPIRED CHIP_CORE_ERROR(0x4e) /** * @def CHIP_ERROR_CERT_NOT_VALID_YET @@ -805,7 +906,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A certificate is not valid yet. * */ -#define CHIP_ERROR_CERT_NOT_VALID_YET CHIP_CORE_ERROR(79) +#define CHIP_ERROR_CERT_NOT_VALID_YET CHIP_CORE_ERROR(0x4f) /** * @def CHIP_ERROR_UNSUPPORTED_CERT_FORMAT @@ -814,7 +915,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A certificate format is unsupported. * */ -#define CHIP_ERROR_UNSUPPORTED_CERT_FORMAT CHIP_CORE_ERROR(80) +#define CHIP_ERROR_UNSUPPORTED_CERT_FORMAT CHIP_CORE_ERROR(0x50) /** * @def CHIP_ERROR_UNSUPPORTED_ELLIPTIC_CURVE @@ -823,7 +924,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * An elliptic curve is unsupported. * */ -#define CHIP_ERROR_UNSUPPORTED_ELLIPTIC_CURVE CHIP_CORE_ERROR(81) +#define CHIP_ERROR_UNSUPPORTED_ELLIPTIC_CURVE CHIP_CORE_ERROR(0x51) /** * @def CHIP_CERT_NOT_USED @@ -832,7 +933,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A certificate was not used during the chain validation. * */ -#define CHIP_ERROR_CERT_NOT_USED CHIP_CORE_ERROR(82) +#define CHIP_ERROR_CERT_NOT_USED CHIP_CORE_ERROR(0x52) #define CHIP_CERT_NOT_USED CHIP_ERROR_CERT_NOT_USED /** @@ -842,7 +943,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A certificate is not found. * */ -#define CHIP_ERROR_CERT_NOT_FOUND CHIP_CORE_ERROR(83) +#define CHIP_ERROR_CERT_NOT_FOUND CHIP_CORE_ERROR(0x53) /** * @def CHIP_ERROR_INVALID_CASE_PARAMETER @@ -851,7 +952,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A CASE parameter is invalid. * */ -#define CHIP_ERROR_INVALID_CASE_PARAMETER CHIP_CORE_ERROR(84) +#define CHIP_ERROR_INVALID_CASE_PARAMETER CHIP_CORE_ERROR(0x54) /** * @def CHIP_ERROR_UNSUPPORTED_CASE_CONFIGURATION @@ -860,7 +961,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A CASE configuration is unsupported. * */ -#define CHIP_ERROR_UNSUPPORTED_CASE_CONFIGURATION CHIP_CORE_ERROR(85) +#define CHIP_ERROR_UNSUPPORTED_CASE_CONFIGURATION CHIP_CORE_ERROR(0x55) /** * @def CHIP_ERROR_CERT_LOAD_FAILED @@ -869,7 +970,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A certificate load failed. * */ -#define CHIP_ERROR_CERT_LOAD_FAILED CHIP_CORE_ERROR(86) +#define CHIP_ERROR_CERT_LOAD_FAILED CHIP_CORE_ERROR(0x56) /** * @def CHIP_ERROR_CERT_NOT_TRUSTED @@ -878,7 +979,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A certificate is not trusted. * */ -#define CHIP_ERROR_CERT_NOT_TRUSTED CHIP_CORE_ERROR(87) +#define CHIP_ERROR_CERT_NOT_TRUSTED CHIP_CORE_ERROR(0x57) /** * @def CHIP_ERROR_INVALID_ACCESS_TOKEN @@ -887,7 +988,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * An access token is invalid. * */ -#define CHIP_ERROR_INVALID_ACCESS_TOKEN CHIP_CORE_ERROR(88) +#define CHIP_ERROR_INVALID_ACCESS_TOKEN CHIP_CORE_ERROR(0x58) /** * @def CHIP_ERROR_WRONG_CERT_SUBJECT @@ -896,7 +997,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A certificate subject is wrong. * */ -#define CHIP_ERROR_WRONG_CERT_SUBJECT CHIP_CORE_ERROR(89) +#define CHIP_ERROR_WRONG_CERT_SUBJECT CHIP_CORE_ERROR(0x59) // deprecated alias #define CHIP_ERROR_WRONG_CERTIFICATE_SUBJECT CHIP_ERROR_WRONG_CERT_SUBJECT @@ -908,7 +1009,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A provisioning bundle is invalid. * */ -#define CHIP_ERROR_INVALID_PROVISIONING_BUNDLE CHIP_CORE_ERROR(90) +#define CHIP_ERROR_INVALID_PROVISIONING_BUNDLE CHIP_CORE_ERROR(0x5a) /** * @def CHIP_ERROR_PROVISIONING_BUNDLE_DECRYPTION_ERROR @@ -917,7 +1018,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A provision bundle encountered a decryption error. * */ -#define CHIP_ERROR_PROVISIONING_BUNDLE_DECRYPTION_ERROR CHIP_CORE_ERROR(91) +#define CHIP_ERROR_PROVISIONING_BUNDLE_DECRYPTION_ERROR CHIP_CORE_ERROR(0x5b) /** * @def CHIP_ERROR_WRONG_NODE_ID @@ -926,7 +1027,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A node id is wrong. * */ -#define CHIP_ERROR_WRONG_NODE_ID CHIP_CORE_ERROR(92) +#define CHIP_ERROR_WRONG_NODE_ID CHIP_CORE_ERROR(0x5c) /** * @def CHIP_ERROR_CONN_ACCEPTED_ON_WRONG_PORT @@ -935,7 +1036,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A connection is accepted on a wrong port. * */ -#define CHIP_ERROR_CONN_ACCEPTED_ON_WRONG_PORT CHIP_CORE_ERROR(93) +#define CHIP_ERROR_CONN_ACCEPTED_ON_WRONG_PORT CHIP_CORE_ERROR(0x5d) /** * @def CHIP_ERROR_CALLBACK_REPLACED @@ -944,7 +1045,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * An application callback has been replaced. * */ -#define CHIP_ERROR_CALLBACK_REPLACED CHIP_CORE_ERROR(94) +#define CHIP_ERROR_CALLBACK_REPLACED CHIP_CORE_ERROR(0x5e) /** * @def CHIP_ERROR_NO_CASE_AUTH_DELEGATE @@ -953,7 +1054,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * No CASE authentication delegate is set. * */ -#define CHIP_ERROR_NO_CASE_AUTH_DELEGATE CHIP_CORE_ERROR(95) +#define CHIP_ERROR_NO_CASE_AUTH_DELEGATE CHIP_CORE_ERROR(0x5f) /** * @def CHIP_ERROR_DEVICE_LOCATE_TIMEOUT @@ -962,7 +1063,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The attempt to locate device timed out. * */ -#define CHIP_ERROR_DEVICE_LOCATE_TIMEOUT CHIP_CORE_ERROR(96) +#define CHIP_ERROR_DEVICE_LOCATE_TIMEOUT CHIP_CORE_ERROR(0x60) /** * @def CHIP_ERROR_DEVICE_CONNECT_TIMEOUT @@ -971,7 +1072,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The attempt to connect device timed out. * */ -#define CHIP_ERROR_DEVICE_CONNECT_TIMEOUT CHIP_CORE_ERROR(97) +#define CHIP_ERROR_DEVICE_CONNECT_TIMEOUT CHIP_CORE_ERROR(0x61) /** * @def CHIP_ERROR_DEVICE_AUTH_TIMEOUT @@ -980,7 +1081,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The attempt to authenticate device timed out. * */ -#define CHIP_ERROR_DEVICE_AUTH_TIMEOUT CHIP_CORE_ERROR(98) +#define CHIP_ERROR_DEVICE_AUTH_TIMEOUT CHIP_CORE_ERROR(0x62) /** * @def CHIP_ERROR_MESSAGE_NOT_ACKNOWLEDGED @@ -989,7 +1090,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A message is not acknowledged after max retries. * */ -#define CHIP_ERROR_MESSAGE_NOT_ACKNOWLEDGED CHIP_CORE_ERROR(99) +#define CHIP_ERROR_MESSAGE_NOT_ACKNOWLEDGED CHIP_CORE_ERROR(0x63) /** * @def CHIP_ERROR_RETRANS_TABLE_FULL @@ -998,7 +1099,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A retransmission table is already full. * */ -#define CHIP_ERROR_RETRANS_TABLE_FULL CHIP_CORE_ERROR(100) +#define CHIP_ERROR_RETRANS_TABLE_FULL CHIP_CORE_ERROR(0x64) /** * @def CHIP_ERROR_INVALID_ACK_ID @@ -1007,7 +1108,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * An acknowledgment id is invalid. * */ -#define CHIP_ERROR_INVALID_ACK_ID CHIP_CORE_ERROR(101) +#define CHIP_ERROR_INVALID_ACK_ID CHIP_CORE_ERROR(0x65) /** * @def CHIP_ERROR_SEND_THROTTLED @@ -1016,7 +1117,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A send is throttled. * */ -#define CHIP_ERROR_SEND_THROTTLED CHIP_CORE_ERROR(102) +#define CHIP_ERROR_SEND_THROTTLED CHIP_CORE_ERROR(0x66) /** * @def CHIP_ERROR_WRONG_MSG_VERSION_FOR_EXCHANGE @@ -1025,7 +1126,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A message version is not supported by the current exchange context. * */ -#define CHIP_ERROR_WRONG_MSG_VERSION_FOR_EXCHANGE CHIP_CORE_ERROR(103) +#define CHIP_ERROR_WRONG_MSG_VERSION_FOR_EXCHANGE CHIP_CORE_ERROR(0x67) /** * @def CHIP_ERROR_TRANSACTION_CANCELED @@ -1034,7 +1135,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A transaction is cancelled. * */ -#define CHIP_ERROR_TRANSACTION_CANCELED CHIP_CORE_ERROR(104) +#define CHIP_ERROR_TRANSACTION_CANCELED CHIP_CORE_ERROR(0x68) /** * @def CHIP_ERROR_LISTENER_ALREADY_STARTED @@ -1043,7 +1144,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A listener has already started. * */ -#define CHIP_ERROR_LISTENER_ALREADY_STARTED CHIP_CORE_ERROR(105) +#define CHIP_ERROR_LISTENER_ALREADY_STARTED CHIP_CORE_ERROR(0x69) /** * @def CHIP_ERROR_LISTENER_ALREADY_STOPPED @@ -1052,7 +1153,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A listener has already stopped. * */ -#define CHIP_ERROR_LISTENER_ALREADY_STOPPED CHIP_CORE_ERROR(106) +#define CHIP_ERROR_LISTENER_ALREADY_STOPPED CHIP_CORE_ERROR(0x6a) /** * @def CHIP_ERROR_UNKNOWN_TOPIC @@ -1061,7 +1162,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A topic ID was unknown to the recipient. * */ -#define CHIP_ERROR_UNKNOWN_TOPIC CHIP_CORE_ERROR(107) +#define CHIP_ERROR_UNKNOWN_TOPIC CHIP_CORE_ERROR(0x6b) /** * @def CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE @@ -1070,7 +1171,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A CHIP feature is unsupported. * */ -#define CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE CHIP_CORE_ERROR(108) +#define CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE CHIP_CORE_ERROR(0x6c) /** * @def CHIP_ERROR_PASE_RECONFIGURE_REQUIRED @@ -1079,7 +1180,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * PASE is required to reconfigure. * */ -#define CHIP_ERROR_PASE_RECONFIGURE_REQUIRED CHIP_CORE_ERROR(109) +#define CHIP_ERROR_PASE_RECONFIGURE_REQUIRED CHIP_CORE_ERROR(0x6d) /** * @def CHIP_ERROR_INVALID_PASE_CONFIGURATION @@ -1088,7 +1189,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A PASE configuration is invalid. * */ -#define CHIP_ERROR_INVALID_PASE_CONFIGURATION CHIP_CORE_ERROR(110) +#define CHIP_ERROR_INVALID_PASE_CONFIGURATION CHIP_CORE_ERROR(0x6e) /** * @def CHIP_ERROR_NO_COMMON_PASE_CONFIGURATIONS @@ -1097,7 +1198,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * No PASE configuration is in common. * */ -#define CHIP_ERROR_NO_COMMON_PASE_CONFIGURATIONS CHIP_CORE_ERROR(111) +#define CHIP_ERROR_NO_COMMON_PASE_CONFIGURATIONS CHIP_CORE_ERROR(0x6f) /** * @def CHIP_ERROR_UNSOLICITED_MSG_NO_ORIGINATOR @@ -1106,7 +1207,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * An unsolicited message with the originator bit clear. * */ -#define CHIP_ERROR_UNSOLICITED_MSG_NO_ORIGINATOR CHIP_CORE_ERROR(112) +#define CHIP_ERROR_UNSOLICITED_MSG_NO_ORIGINATOR CHIP_CORE_ERROR(0x70) /** * @def CHIP_ERROR_INVALID_FABRIC_ID @@ -1115,11 +1216,20 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A fabric id is invalid. * */ -#define CHIP_ERROR_INVALID_FABRIC_ID CHIP_CORE_ERROR(113) +#define CHIP_ERROR_INVALID_FABRIC_ID CHIP_CORE_ERROR(0x71) + +/** + * @def CHIP_ERROR_TOO_MANY_CONNECTIONS + * + * @brief + * The attempt to allocate a connection object failed because too many + * connections exist. + * + */ +#define CHIP_ERROR_TOO_MANY_CONNECTIONS CHIP_CORE_ERROR(0x72) -// unused CHIP_CORE_ERROR(114) -// unused CHIP_CORE_ERROR(115) -// unused CHIP_CORE_ERROR(116) +// unused CHIP_CORE_ERROR(0x73) +// unused CHIP_CORE_ERROR(0x74) /** * @def CHIP_ERROR_DRBG_ENTROPY_SOURCE_FAILED @@ -1128,7 +1238,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * DRBG entropy source failed to generate entropy data. * */ -#define CHIP_ERROR_DRBG_ENTROPY_SOURCE_FAILED CHIP_CORE_ERROR(117) +#define CHIP_ERROR_DRBG_ENTROPY_SOURCE_FAILED CHIP_CORE_ERROR(0x75) /** * @def CHIP_ERROR_TLV_TAG_NOT_FOUND @@ -1137,7 +1247,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A specified TLV tag was not found. * */ -#define CHIP_ERROR_TLV_TAG_NOT_FOUND CHIP_CORE_ERROR(118) +#define CHIP_ERROR_TLV_TAG_NOT_FOUND CHIP_CORE_ERROR(0x76) /** * @def CHIP_ERROR_INVALID_TOKENPAIRINGBUNDLE @@ -1146,7 +1256,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A token pairing bundle is invalid. * */ -#define CHIP_ERROR_INVALID_TOKENPAIRINGBUNDLE CHIP_CORE_ERROR(119) +#define CHIP_ERROR_INVALID_TOKENPAIRINGBUNDLE CHIP_CORE_ERROR(0x77) /** * @def CHIP_ERROR_UNSUPPORTED_TOKENPAIRINGBUNDLE_VERSION @@ -1155,7 +1265,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A token pairing bundle is invalid. * */ -#define CHIP_ERROR_UNSUPPORTED_TOKENPAIRINGBUNDLE_VERSION CHIP_CORE_ERROR(120) +#define CHIP_ERROR_UNSUPPORTED_TOKENPAIRINGBUNDLE_VERSION CHIP_CORE_ERROR(0x78) /** * @def CHIP_ERROR_NO_TAKE_AUTH_DELEGATE @@ -1164,7 +1274,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * No TAKE authentication delegate is set. * */ -#define CHIP_ERROR_NO_TAKE_AUTH_DELEGATE CHIP_CORE_ERROR(121) +#define CHIP_ERROR_NO_TAKE_AUTH_DELEGATE CHIP_CORE_ERROR(0x79) /** * @def CHIP_ERROR_TAKE_RECONFIGURE_REQUIRED @@ -1173,7 +1283,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * TAKE requires a reconfigure. * */ -#define CHIP_ERROR_TAKE_RECONFIGURE_REQUIRED CHIP_CORE_ERROR(122) +#define CHIP_ERROR_TAKE_RECONFIGURE_REQUIRED CHIP_CORE_ERROR(0x7a) /** * @def CHIP_ERROR_TAKE_REAUTH_POSSIBLE @@ -1182,7 +1292,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * TAKE can do a reauthentication. * */ -#define CHIP_ERROR_TAKE_REAUTH_POSSIBLE CHIP_CORE_ERROR(123) +#define CHIP_ERROR_TAKE_REAUTH_POSSIBLE CHIP_CORE_ERROR(0x7b) /** * @def CHIP_ERROR_INVALID_TAKE_PARAMETER @@ -1191,7 +1301,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * Received an invalid TAKE paramter. * */ -#define CHIP_ERROR_INVALID_TAKE_PARAMETER CHIP_CORE_ERROR(124) +#define CHIP_ERROR_INVALID_TAKE_PARAMETER CHIP_CORE_ERROR(0x7c) /** * @def CHIP_ERROR_UNSUPPORTED_TAKE_CONFIGURATION @@ -1200,7 +1310,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * This configuration is not supported by TAKE. * */ -#define CHIP_ERROR_UNSUPPORTED_TAKE_CONFIGURATION CHIP_CORE_ERROR(125) +#define CHIP_ERROR_UNSUPPORTED_TAKE_CONFIGURATION CHIP_CORE_ERROR(0x7d) /** * @def CHIP_ERROR_TAKE_TOKEN_IDENTIFICATION_FAILED @@ -1209,7 +1319,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The TAKE Token Identification failed. * */ -#define CHIP_ERROR_TAKE_TOKEN_IDENTIFICATION_FAILED CHIP_CORE_ERROR(126) +#define CHIP_ERROR_TAKE_TOKEN_IDENTIFICATION_FAILED CHIP_CORE_ERROR(0x7e) /** * @def CHIP_ERROR_KEY_NOT_FOUND_FROM_PEER @@ -1218,7 +1328,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The encryption key is not found error received from a peer node. * */ -#define CHIP_ERROR_KEY_NOT_FOUND_FROM_PEER CHIP_CORE_ERROR(127) +#define CHIP_ERROR_KEY_NOT_FOUND_FROM_PEER CHIP_CORE_ERROR(0x7f) /** * @def CHIP_ERROR_WRONG_ENCRYPTION_TYPE_FROM_PEER @@ -1227,7 +1337,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The wrong encryption type error received from a peer node. * */ -#define CHIP_ERROR_WRONG_ENCRYPTION_TYPE_FROM_PEER CHIP_CORE_ERROR(128) +#define CHIP_ERROR_WRONG_ENCRYPTION_TYPE_FROM_PEER CHIP_CORE_ERROR(0x80) /** * @def CHIP_ERROR_UNKNOWN_KEY_TYPE_FROM_PEER @@ -1236,7 +1346,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The unknown key type error received from a peer node. * */ -#define CHIP_ERROR_UNKNOWN_KEY_TYPE_FROM_PEER CHIP_CORE_ERROR(129) +#define CHIP_ERROR_UNKNOWN_KEY_TYPE_FROM_PEER CHIP_CORE_ERROR(0x81) /** * @def CHIP_ERROR_INVALID_USE_OF_SESSION_KEY_FROM_PEER @@ -1245,7 +1355,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The invalid use of session key error received from a peer node. * */ -#define CHIP_ERROR_INVALID_USE_OF_SESSION_KEY_FROM_PEER CHIP_CORE_ERROR(130) +#define CHIP_ERROR_INVALID_USE_OF_SESSION_KEY_FROM_PEER CHIP_CORE_ERROR(0x82) /** * @def CHIP_ERROR_UNSUPPORTED_ENCRYPTION_TYPE_FROM_PEER @@ -1254,7 +1364,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * An unsupported encryption type error received from a peer node. * */ -#define CHIP_ERROR_UNSUPPORTED_ENCRYPTION_TYPE_FROM_PEER CHIP_CORE_ERROR(131) +#define CHIP_ERROR_UNSUPPORTED_ENCRYPTION_TYPE_FROM_PEER CHIP_CORE_ERROR(0x83) /** * @def CHIP_ERROR_INTERNAL_KEY_ERROR_FROM_PEER @@ -1263,7 +1373,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The internal key error received from a peer node. * */ -#define CHIP_ERROR_INTERNAL_KEY_ERROR_FROM_PEER CHIP_CORE_ERROR(132) +#define CHIP_ERROR_INTERNAL_KEY_ERROR_FROM_PEER CHIP_CORE_ERROR(0x84) /** * @def CHIP_ERROR_INVALID_KEY_ID @@ -1272,7 +1382,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A key id is invalid. * */ -#define CHIP_ERROR_INVALID_KEY_ID CHIP_CORE_ERROR(133) +#define CHIP_ERROR_INVALID_KEY_ID CHIP_CORE_ERROR(0x85) /** * @def CHIP_ERROR_INVALID_TIME @@ -1281,7 +1391,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * Time has invalid value. * */ -#define CHIP_ERROR_INVALID_TIME CHIP_CORE_ERROR(134) +#define CHIP_ERROR_INVALID_TIME CHIP_CORE_ERROR(0x86) /** * @def CHIP_ERROR_LOCKING_FAILURE @@ -1290,7 +1400,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * Failure to acquire or release an OS provided mutex. * */ -#define CHIP_ERROR_LOCKING_FAILURE CHIP_CORE_ERROR(135) +#define CHIP_ERROR_LOCKING_FAILURE CHIP_CORE_ERROR(0x87) /** * @def CHIP_ERROR_UNSUPPORTED_PASSCODE_CONFIG @@ -1299,7 +1409,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A passcode encryption configuration is unsupported. * */ -#define CHIP_ERROR_UNSUPPORTED_PASSCODE_CONFIG CHIP_CORE_ERROR(136) +#define CHIP_ERROR_UNSUPPORTED_PASSCODE_CONFIG CHIP_CORE_ERROR(0x88) /** * @def CHIP_ERROR_PASSCODE_AUTHENTICATION_FAILED @@ -1308,7 +1418,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The CHIP passcode authentication failed. * */ -#define CHIP_ERROR_PASSCODE_AUTHENTICATION_FAILED CHIP_CORE_ERROR(137) +#define CHIP_ERROR_PASSCODE_AUTHENTICATION_FAILED CHIP_CORE_ERROR(0x89) /** * @def CHIP_ERROR_PASSCODE_FINGERPRINT_FAILED @@ -1317,7 +1427,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The CHIP passcode fingerprint failed. * */ -#define CHIP_ERROR_PASSCODE_FINGERPRINT_FAILED CHIP_CORE_ERROR(138) +#define CHIP_ERROR_PASSCODE_FINGERPRINT_FAILED CHIP_CORE_ERROR(0x8a) /** * @def CHIP_ERROR_SERIALIZATION_ELEMENT_NULL @@ -1326,7 +1436,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The element of the struct is null. * */ -#define CHIP_ERROR_SERIALIZATION_ELEMENT_NULL CHIP_CORE_ERROR(139) +#define CHIP_ERROR_SERIALIZATION_ELEMENT_NULL CHIP_CORE_ERROR(0x8b) /** * @def CHIP_ERROR_WRONG_CERT_SIGNATURE_ALGORITHM @@ -1335,7 +1445,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The certificate was not signed using the required signature algorithm. * */ -#define CHIP_ERROR_WRONG_CERT_SIGNATURE_ALGORITHM CHIP_CORE_ERROR(140) +#define CHIP_ERROR_WRONG_CERT_SIGNATURE_ALGORITHM CHIP_CORE_ERROR(0x8c) /** * @def CHIP_ERROR_WRONG_CHIP_SIGNATURE_ALGORITHM @@ -1344,7 +1454,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The CHIP signature was not signed using the required signature algorithm. * */ -#define CHIP_ERROR_WRONG_CHIP_SIGNATURE_ALGORITHM CHIP_CORE_ERROR(141) +#define CHIP_ERROR_WRONG_CHIP_SIGNATURE_ALGORITHM CHIP_CORE_ERROR(0x8d) /** * @def CHIP_ERROR_SCHEMA_MISMATCH @@ -1353,7 +1463,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A mismatch in schema was encountered. * */ -#define CHIP_ERROR_SCHEMA_MISMATCH CHIP_CORE_ERROR(142) +#define CHIP_ERROR_SCHEMA_MISMATCH CHIP_CORE_ERROR(0x8e) /** * @def CHIP_ERROR_INVALID_INTEGER_VALUE @@ -1362,7 +1472,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * An integer does not have the kind of value we expect. * */ -#define CHIP_ERROR_INVALID_INTEGER_VALUE CHIP_CORE_ERROR(143) +#define CHIP_ERROR_INVALID_INTEGER_VALUE CHIP_CORE_ERROR(0x8f) /** * @def CHIP_ERROR_CASE_RECONFIG_REQUIRED @@ -1371,7 +1481,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * CASE is required to reconfigure. * */ -#define CHIP_ERROR_CASE_RECONFIG_REQUIRED CHIP_CORE_ERROR(144) +#define CHIP_ERROR_CASE_RECONFIG_REQUIRED CHIP_CORE_ERROR(0x90) /** * @def CHIP_ERROR_TOO_MANY_CASE_RECONFIGURATIONS @@ -1380,7 +1490,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * Too many CASE reconfigurations were received. * */ -#define CHIP_ERROR_TOO_MANY_CASE_RECONFIGURATIONS CHIP_CORE_ERROR(145) +#define CHIP_ERROR_TOO_MANY_CASE_RECONFIGURATIONS CHIP_CORE_ERROR(0x91) /** * @def CHIP_ERROR_BAD_REQUEST @@ -1389,7 +1499,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The request cannot be processed or fulfilled * */ -#define CHIP_ERROR_BAD_REQUEST CHIP_CORE_ERROR(146) +#define CHIP_ERROR_BAD_REQUEST CHIP_CORE_ERROR(0x92) /** * @def CHIP_ERROR_INVALID_MESSAGE_FLAG @@ -1398,7 +1508,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * One or more message flags have invalid value. * */ -#define CHIP_ERROR_INVALID_MESSAGE_FLAG CHIP_CORE_ERROR(147) +#define CHIP_ERROR_INVALID_MESSAGE_FLAG CHIP_CORE_ERROR(0x93) /** * @def CHIP_ERROR_KEY_EXPORT_RECONFIGURE_REQUIRED @@ -1407,7 +1517,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * Key export protocol required to reconfigure. * */ -#define CHIP_ERROR_KEY_EXPORT_RECONFIGURE_REQUIRED CHIP_CORE_ERROR(148) +#define CHIP_ERROR_KEY_EXPORT_RECONFIGURE_REQUIRED CHIP_CORE_ERROR(0x94) /** * @def CHIP_ERROR_INVALID_KEY_EXPORT_CONFIGURATION @@ -1416,7 +1526,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * A key export protocol configuration is invalid. * */ -#define CHIP_ERROR_INVALID_KEY_EXPORT_CONFIGURATION CHIP_CORE_ERROR(149) +#define CHIP_ERROR_INVALID_KEY_EXPORT_CONFIGURATION CHIP_CORE_ERROR(0x95) /** * @def CHIP_ERROR_NO_COMMON_KEY_EXPORT_CONFIGURATIONS @@ -1425,7 +1535,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * No key export protocol configuration is in common. * */ -#define CHIP_ERROR_NO_COMMON_KEY_EXPORT_CONFIGURATIONS CHIP_CORE_ERROR(150) +#define CHIP_ERROR_NO_COMMON_KEY_EXPORT_CONFIGURATIONS CHIP_CORE_ERROR(0x96) /** * @def CHIP_ERROR_NO_KEY_EXPORT_DELEGATE @@ -1434,7 +1544,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * No key export delegate is set. * */ -#define CHIP_ERROR_NO_KEY_EXPORT_DELEGATE CHIP_CORE_ERROR(151) +#define CHIP_ERROR_NO_KEY_EXPORT_DELEGATE CHIP_CORE_ERROR(0x97) /** * @def CHIP_ERROR_UNAUTHORIZED_KEY_EXPORT_REQUEST @@ -1443,7 +1553,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * Unauthorized key export request. * */ -#define CHIP_ERROR_UNAUTHORIZED_KEY_EXPORT_REQUEST CHIP_CORE_ERROR(152) +#define CHIP_ERROR_UNAUTHORIZED_KEY_EXPORT_REQUEST CHIP_CORE_ERROR(0x98) /** * @def CHIP_ERROR_UNAUTHORIZED_KEY_EXPORT_RESPONSE @@ -1452,7 +1562,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * Unauthorized key export response. * */ -#define CHIP_ERROR_UNAUTHORIZED_KEY_EXPORT_RESPONSE CHIP_CORE_ERROR(153) +#define CHIP_ERROR_UNAUTHORIZED_KEY_EXPORT_RESPONSE CHIP_CORE_ERROR(0x99) /** * @def CHIP_ERROR_EXPORTED_KEY_AUTHENTICATION_FAILED @@ -1461,7 +1571,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The CHIP exported encrypted key authentication failed. * */ -#define CHIP_ERROR_EXPORTED_KEY_AUTHENTICATION_FAILED CHIP_CORE_ERROR(154) +#define CHIP_ERROR_EXPORTED_KEY_AUTHENTICATION_FAILED CHIP_CORE_ERROR(0x9a) /** * @def CHIP_ERROR_TOO_MANY_SHARED_SESSION_END_NODES @@ -1471,7 +1581,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * the maximum limit. * */ -#define CHIP_ERROR_TOO_MANY_SHARED_SESSION_END_NODES CHIP_CORE_ERROR(155) +#define CHIP_ERROR_TOO_MANY_SHARED_SESSION_END_NODES CHIP_CORE_ERROR(0x9b) /** * @def CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_DATA_ELEMENT @@ -1480,7 +1590,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The Attribute DataElement is malformed: it either does not contain * the required elements */ -#define CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_DATA_ELEMENT CHIP_CORE_ERROR(156) +#define CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_DATA_ELEMENT CHIP_CORE_ERROR(0x9c) /** * @def CHIP_ERROR_WRONG_CERT_TYPE @@ -1488,7 +1598,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * The presented certificate was of the wrong type. */ -#define CHIP_ERROR_WRONG_CERT_TYPE CHIP_CORE_ERROR(157) +#define CHIP_ERROR_WRONG_CERT_TYPE CHIP_CORE_ERROR(0x9d) /** * @def CHIP_ERROR_DEFAULT_EVENT_HANDLER_NOT_CALLED @@ -1497,7 +1607,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The application's event handler failed to call the default event handler function * when presented with an unknown event. */ -#define CHIP_ERROR_DEFAULT_EVENT_HANDLER_NOT_CALLED CHIP_CORE_ERROR(158) +#define CHIP_ERROR_DEFAULT_EVENT_HANDLER_NOT_CALLED CHIP_CORE_ERROR(0x9e) /** * @def CHIP_ERROR_PERSISTED_STORAGE_FAILED @@ -1506,7 +1616,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * Persisted storage memory read/write failure. * */ -#define CHIP_ERROR_PERSISTED_STORAGE_FAILED CHIP_CORE_ERROR(159) +#define CHIP_ERROR_PERSISTED_STORAGE_FAILED CHIP_CORE_ERROR(0x9f) /** * @def CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND @@ -1515,7 +1625,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The specific value is not found in the persisted storage. * */ -#define CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND CHIP_CORE_ERROR(160) +#define CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND CHIP_CORE_ERROR(0xa0) /** * @def CHIP_ERROR_PROFILE_STRING_CONTEXT_ALREADY_REGISTERED @@ -1524,7 +1634,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The specified profile string support context is already registered. * */ -#define CHIP_ERROR_PROFILE_STRING_CONTEXT_ALREADY_REGISTERED CHIP_CORE_ERROR(161) +#define CHIP_ERROR_PROFILE_STRING_CONTEXT_ALREADY_REGISTERED CHIP_CORE_ERROR(0xa1) /** * @def CHIP_ERROR_PROFILE_STRING_CONTEXT_NOT_REGISTERED @@ -1533,7 +1643,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The specified profile string support context is not registered. * */ -#define CHIP_ERROR_PROFILE_STRING_CONTEXT_NOT_REGISTERED CHIP_CORE_ERROR(162) +#define CHIP_ERROR_PROFILE_STRING_CONTEXT_NOT_REGISTERED CHIP_CORE_ERROR(0xa2) /** * @def CHIP_ERROR_INCOMPATIBLE_SCHEMA_VERSION @@ -1541,7 +1651,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * Encountered a mismatch in compatibility w.r.t to IDL schema version */ -#define CHIP_ERROR_INCOMPATIBLE_SCHEMA_VERSION CHIP_CORE_ERROR(163) +#define CHIP_ERROR_INCOMPATIBLE_SCHEMA_VERSION CHIP_CORE_ERROR(0xa3) /** * @def CHIP_ERROR_MISMATCH_UPDATE_REQUIRED_VERSION @@ -1549,7 +1659,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * Encountered a mismatch between update required version and current version */ -#define CHIP_ERROR_MISMATCH_UPDATE_REQUIRED_VERSION CHIP_CORE_ERROR(164) +#define CHIP_ERROR_MISMATCH_UPDATE_REQUIRED_VERSION CHIP_CORE_ERROR(0xa4) /** * @def CHIP_ERROR_ACCESS_DENIED @@ -1557,7 +1667,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * The CHIP message is not granted access for further processing. */ -#define CHIP_ERROR_ACCESS_DENIED CHIP_CORE_ERROR(165) +#define CHIP_ERROR_ACCESS_DENIED CHIP_CORE_ERROR(0xa5) /** * @def CHIP_ERROR_UNKNOWN_RESOURCE_ID @@ -1566,7 +1676,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * Unknown resource ID * */ -#define CHIP_ERROR_UNKNOWN_RESOURCE_ID CHIP_CORE_ERROR(166) +#define CHIP_ERROR_UNKNOWN_RESOURCE_ID CHIP_CORE_ERROR(0xa6) /** * @def CHIP_ERROR_VERSION_MISMATCH @@ -1576,7 +1686,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * because the local changes are based on an obsolete version of the * data. */ -#define CHIP_ERROR_VERSION_MISMATCH CHIP_CORE_ERROR(167) +#define CHIP_ERROR_VERSION_MISMATCH CHIP_CORE_ERROR(0xa7) /** * @def CHIP_ERROR_UNSUPPORTED_THREAD_NETWORK_CREATE @@ -1587,7 +1697,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * together with CHIP Fabric using CrateFabric() message. * */ -#define CHIP_ERROR_UNSUPPORTED_THREAD_NETWORK_CREATE CHIP_CORE_ERROR(168) +#define CHIP_ERROR_UNSUPPORTED_THREAD_NETWORK_CREATE CHIP_CORE_ERROR(0xa8) /** * @def CHIP_ERROR_INCONSISTENT_CONDITIONALITY @@ -1598,7 +1708,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * same Trait Instance. * */ -#define CHIP_ERROR_INCONSISTENT_CONDITIONALITY CHIP_CORE_ERROR(169) +#define CHIP_ERROR_INCONSISTENT_CONDITIONALITY CHIP_CORE_ERROR(0xa9) /** * @def CHIP_ERROR_LOCAL_DATA_INCONSISTENT @@ -1608,7 +1718,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * Trait Instance and cannot support the operation requested. * */ -#define CHIP_ERROR_LOCAL_DATA_INCONSISTENT CHIP_CORE_ERROR(170) +#define CHIP_ERROR_LOCAL_DATA_INCONSISTENT CHIP_CORE_ERROR(0xaa) /** * @def CHIP_EVENT_ID_FOUND @@ -1616,7 +1726,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * Event ID matching the criteria was found */ -#define CHIP_ERROR_EVENT_ID_FOUND CHIP_CORE_ERROR(171) +#define CHIP_ERROR_EVENT_ID_FOUND CHIP_CORE_ERROR(0xab) #define CHIP_EVENT_ID_FOUND CHIP_ERROR_EVENT_ID_FOUND /** @@ -1625,7 +1735,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * Internal error */ -#define CHIP_ERROR_INTERNAL CHIP_CORE_ERROR(172) +#define CHIP_ERROR_INTERNAL CHIP_CORE_ERROR(0xac) /** * @def CHIP_ERROR_OPEN_FAILED @@ -1633,7 +1743,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * Open file failed */ -#define CHIP_ERROR_OPEN_FAILED CHIP_CORE_ERROR(173) +#define CHIP_ERROR_OPEN_FAILED CHIP_CORE_ERROR(0xad) /** * @def CHIP_ERROR_READ_FAILED @@ -1641,7 +1751,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * Read from file failed */ -#define CHIP_ERROR_READ_FAILED CHIP_CORE_ERROR(174) +#define CHIP_ERROR_READ_FAILED CHIP_CORE_ERROR(0xae) /** * @def CHIP_ERROR_WRITE_FAILED @@ -1649,7 +1759,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * Write to file failed */ -#define CHIP_ERROR_WRITE_FAILED CHIP_CORE_ERROR(175) +#define CHIP_ERROR_WRITE_FAILED CHIP_CORE_ERROR(0xaf) /** * @def CHIP_ERROR_DECODE_FAILED @@ -1657,7 +1767,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * Decoding failed */ -#define CHIP_ERROR_DECODE_FAILED CHIP_CORE_ERROR(176) +#define CHIP_ERROR_DECODE_FAILED CHIP_CORE_ERROR(0xb0) /** * @def CHIP_ERROR_SESSION_KEY_SUSPENDED @@ -1666,7 +1776,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * Use of the identified session key is suspended. * */ -#define CHIP_ERROR_SESSION_KEY_SUSPENDED CHIP_CORE_ERROR(177) +#define CHIP_ERROR_SESSION_KEY_SUSPENDED CHIP_CORE_ERROR(0xb1) /** * @def CHIP_ERROR_UNSUPPORTED_WIRELESS_REGULATORY_DOMAIN @@ -1675,7 +1785,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The specified wireless regulatory domain is unsupported. * */ -#define CHIP_ERROR_UNSUPPORTED_WIRELESS_REGULATORY_DOMAIN CHIP_CORE_ERROR(178) +#define CHIP_ERROR_UNSUPPORTED_WIRELESS_REGULATORY_DOMAIN CHIP_CORE_ERROR(0xb2) /** * @def CHIP_ERROR_UNSUPPORTED_WIRELESS_OPERATING_LOCATION @@ -1684,7 +1794,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The specified wireless operating location is unsupported. * */ -#define CHIP_ERROR_UNSUPPORTED_WIRELESS_OPERATING_LOCATION CHIP_CORE_ERROR(179) +#define CHIP_ERROR_UNSUPPORTED_WIRELESS_OPERATING_LOCATION CHIP_CORE_ERROR(0xb3) /** * @def CHIP_ERROR_MDNS_COLLISSION @@ -1693,7 +1803,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The registered service name has collision on the LAN. * */ -#define CHIP_ERROR_MDNS_COLLISSION CHIP_CORE_ERROR(180) +#define CHIP_ERROR_MDNS_COLLISSION CHIP_CORE_ERROR(0xb4) /** * @def CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH @@ -1702,7 +1812,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The Attribute path is malformed: it either does not contain * the required path */ -#define CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH CHIP_CORE_ERROR(181) +#define CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH CHIP_CORE_ERROR(0xb5) /** * @def CHIP_ERROR_IM_MALFORMED_EVENT_PATH @@ -1711,7 +1821,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The Attribute Path is malformed: it either does not contain * the required elements */ -#define CHIP_ERROR_IM_MALFORMED_EVENT_PATH CHIP_CORE_ERROR(182) +#define CHIP_ERROR_IM_MALFORMED_EVENT_PATH CHIP_CORE_ERROR(0xb6) /** * @def CHIP_ERROR_IM_MALFORMED_COMMAND_PATH @@ -1720,7 +1830,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The Attribute DataElement is malformed: it either does not contain * the required elements */ -#define CHIP_ERROR_IM_MALFORMED_COMMAND_PATH CHIP_CORE_ERROR(183) +#define CHIP_ERROR_IM_MALFORMED_COMMAND_PATH CHIP_CORE_ERROR(0xb7) /** * @def CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_STATUS_ELEMENT @@ -1729,7 +1839,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The Attribute DataElement is malformed: it either does not contain * the required elements */ -#define CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_STATUS_ELEMENT CHIP_CORE_ERROR(184) +#define CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_STATUS_ELEMENT CHIP_CORE_ERROR(0xb8) /** * @def CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT @@ -1738,7 +1848,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The Attribute DataElement is malformed: it either does not contain * the required elements */ -#define CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT CHIP_CORE_ERROR(185) +#define CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT CHIP_CORE_ERROR(0xb9) /** * @def CHIP_ERROR_IM_MALFORMED_EVENT_DATA_ELEMENT @@ -1747,7 +1857,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The Event DataElement is malformed: it either does not contain * the required elements */ -#define CHIP_ERROR_IM_MALFORMED_EVENT_DATA_ELEMENT CHIP_CORE_ERROR(186) +#define CHIP_ERROR_IM_MALFORMED_EVENT_DATA_ELEMENT CHIP_CORE_ERROR(0xba) /** * @def CHIP_ERROR_IM_MALFORMED_STATUS_CODE @@ -1756,7 +1866,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * The Attribute DataElement is malformed: it either does not contain * the required elements */ -#define CHIP_ERROR_IM_MALFORMED_STATUS_CODE CHIP_CORE_ERROR(187) +#define CHIP_ERROR_IM_MALFORMED_STATUS_CODE CHIP_CORE_ERROR(0xbb) /** * @def CHIP_ERROR_PEER_NODE_NOT_FOUND @@ -1764,7 +1874,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * Unable to find the peer node */ -#define CHIP_ERROR_PEER_NODE_NOT_FOUND CHIP_CORE_ERROR(188) +#define CHIP_ERROR_PEER_NODE_NOT_FOUND CHIP_CORE_ERROR(0xbc) /** * @def CHIP_ERROR_HSM @@ -1772,7 +1882,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * Error in Hardware security module. Used for software fallback option. */ -#define CHIP_ERROR_HSM CHIP_CORE_ERROR(189) +#define CHIP_ERROR_HSM CHIP_CORE_ERROR(0xbd) /** * @def CHIP_ERROR_INTERMEDIATE_CA_NOT_REQUIRED @@ -1780,7 +1890,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * The commissioner doesn't require an intermediate CA to sign the operational certificates. */ -#define CHIP_ERROR_INTERMEDIATE_CA_NOT_REQUIRED CHIP_CORE_ERROR(190) +#define CHIP_ERROR_INTERMEDIATE_CA_NOT_REQUIRED CHIP_CORE_ERROR(0xbe) /** * @def CHIP_ERROR_REAL_TIME_NOT_SYNCED @@ -1788,7 +1898,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * The system's real time clock is not synchronized to an accurate time source. */ -#define CHIP_ERROR_REAL_TIME_NOT_SYNCED CHIP_CORE_ERROR(191) +#define CHIP_ERROR_REAL_TIME_NOT_SYNCED CHIP_CORE_ERROR(0xbf) /** * @def CHIP_ERROR_UNEXPECTED_EVENT @@ -1796,7 +1906,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * An unexpected event was encountered. */ -#define CHIP_ERROR_UNEXPECTED_EVENT CHIP_CORE_ERROR(192) +#define CHIP_ERROR_UNEXPECTED_EVENT CHIP_CORE_ERROR(0xc0) /** * @def CHIP_ERROR_ENDPOINT_POOL_FULL @@ -1805,7 +1915,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * No endpoint pool entry is available. * */ -#define CHIP_ERROR_ENDPOINT_POOL_FULL CHIP_CORE_ERROR(193) +#define CHIP_ERROR_ENDPOINT_POOL_FULL CHIP_CORE_ERROR(0xc1) /** * @def CHIP_ERROR_INBOUND_MESSAGE_TOO_BIG @@ -1814,7 +1924,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * More inbound message data is pending than available buffer space available to copy it. * */ -#define CHIP_ERROR_INBOUND_MESSAGE_TOO_BIG CHIP_CORE_ERROR(194) +#define CHIP_ERROR_INBOUND_MESSAGE_TOO_BIG CHIP_CORE_ERROR(0xc2) /** * @def CHIP_ERROR_OUTBOUND_MESSAGE_TOO_BIG @@ -1823,7 +1933,7 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * More outbound message data is pending than available buffer space available to copy it. * */ -#define CHIP_ERROR_OUTBOUND_MESSAGE_TOO_BIG CHIP_CORE_ERROR(195) +#define CHIP_ERROR_OUTBOUND_MESSAGE_TOO_BIG CHIP_CORE_ERROR(0xc3) /** * @def CHIP_ERROR_DUPLICATE_MESSAGE_RECEIVED @@ -1831,18 +1941,18 @@ typedef CHIP_CONFIG_ERROR_TYPE CHIP_ERROR; * @brief * The received message is a duplicate of a previously received message. */ -#define CHIP_ERROR_DUPLICATE_MESSAGE_RECEIVED CHIP_CORE_ERROR(196) +#define CHIP_ERROR_DUPLICATE_MESSAGE_RECEIVED CHIP_CORE_ERROR(0xc4) /** * @} */ +// clang-format on + // !!!!! IMPORTANT !!!!! If you add new CHIP errors, please update the translation // of error codes to strings in CHIPError.cpp, and add them to unittest // in test-apps/TestErrorStr.cpp -// clang-format on - namespace chip { extern void RegisterCHIPLayerErrorFormatter(); diff --git a/src/lib/support/tests/TestErrorStr.cpp b/src/lib/support/tests/TestErrorStr.cpp index c04b7c679cb158..d8857140d6edfb 100644 --- a/src/lib/support/tests/TestErrorStr.cpp +++ b/src/lib/support/tests/TestErrorStr.cpp @@ -152,10 +152,6 @@ static bool testFormatErr() // skip both FormatError(buf, kBufSize, nullptr, 1, nullptr); ret &= CHECK_EQ_STR(buf, "Error 1 (0x00000001)"); - - // negative - FormatError(buf, kBufSize, nullptr, static_cast(-1), nullptr); - ret &= CHECK_EQ_STR(buf, "Error -1 (0xFFFFFFFF)"); #endif return ret; diff --git a/src/platform/Darwin/CHIPPlatformConfig.h b/src/platform/Darwin/CHIPPlatformConfig.h index 0c00b753c405f4..b803bedf1a5fee 100644 --- a/src/platform/Darwin/CHIPPlatformConfig.h +++ b/src/platform/Darwin/CHIPPlatformConfig.h @@ -25,9 +25,6 @@ // ==================== General Platform Adaptations ==================== -#define CHIP_CONFIG_ERROR_TYPE int32_t -#define CHIP_CONFIG_ERROR_FORMAT PRId32 - #define ChipDie() abort() // TODO:(#756) Add FabricState support diff --git a/src/platform/EFR32/BLEManagerImpl.cpp b/src/platform/EFR32/BLEManagerImpl.cpp index 02418822bde20c..1d057b3bbe758c 100644 --- a/src/platform/EFR32/BLEManagerImpl.cpp +++ b/src/platform/EFR32/BLEManagerImpl.cpp @@ -550,7 +550,7 @@ CHIP_ERROR BLEManagerImpl::MapBLEError(int bleErr) case SL_STATUS_INVALID_PARAMETER: return CHIP_ERROR_INVALID_ARGUMENT; default: - return static_cast(bleErr + CHIP_DEVICE_CONFIG_EFR32_BLE_ERROR_MIN); + return ChipError::Encapsulate(ChipError::Range::kPlatform, bleErr + CHIP_DEVICE_CONFIG_EFR32_BLE_ERROR_MIN); } } diff --git a/src/platform/EFR32/CHIPDevicePlatformConfig.h b/src/platform/EFR32/CHIPDevicePlatformConfig.h index 72d03b5f2aae43..173d66b0f07f56 100644 --- a/src/platform/EFR32/CHIPDevicePlatformConfig.h +++ b/src/platform/EFR32/CHIPDevicePlatformConfig.h @@ -26,8 +26,8 @@ // ==================== Platform Adaptations ==================== -#define CHIP_DEVICE_CONFIG_EFR32_NVM3_ERROR_MIN 12000000 -#define CHIP_DEVICE_CONFIG_EFR32_BLE_ERROR_MIN 13000000 +#define CHIP_DEVICE_CONFIG_EFR32_NVM3_ERROR_MIN 0xB00000 +#define CHIP_DEVICE_CONFIG_EFR32_BLE_ERROR_MIN 0xC00000 #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 0 #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0 diff --git a/src/platform/EFR32/CHIPPlatformConfig.h b/src/platform/EFR32/CHIPPlatformConfig.h index 5304e919104db2..6d6f7375272007 100644 --- a/src/platform/EFR32/CHIPPlatformConfig.h +++ b/src/platform/EFR32/CHIPPlatformConfig.h @@ -28,14 +28,6 @@ // ==================== General Platform Adaptations ==================== -#define CHIP_CONFIG_ERROR_TYPE int32_t -#define CHIP_CONFIG_ERROR_FORMAT PRId32 -#define CHIP_CONFIG_CORE_ERROR_MIN 4000000 -#define CHIP_CONFIG_CORE_ERROR_MAX 4000999 - -#define ASN1_CONFIG_ERROR_MIN 5000000 -#define ASN1_CONFIG_ERROR_MAX 5000999 - #define ChipDie() abort() #define CHIP_CONFIG_PERSISTED_STORAGE_KEY_TYPE uint8_t diff --git a/src/platform/EFR32/EFR32Config.cpp b/src/platform/EFR32/EFR32Config.cpp index 27f5b9d0e9e6f9..80a3b60cb4b7ed 100644 --- a/src/platform/EFR32/EFR32Config.cpp +++ b/src/platform/EFR32/EFR32Config.cpp @@ -566,7 +566,7 @@ CHIP_ERROR EFR32Config::MapNvm3Error(Ecode_t nvm3Res) err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND; break; default: - err = static_cast((nvm3Res & 0xFF) + CHIP_DEVICE_CONFIG_EFR32_NVM3_ERROR_MIN); + err = ChipError::Encapsulate(ChipError::Range::kPlatform, (nvm3Res & 0xFF) + CHIP_DEVICE_CONFIG_EFR32_NVM3_ERROR_MIN); break; } diff --git a/src/platform/EFR32/SystemPlatformConfig.h b/src/platform/EFR32/SystemPlatformConfig.h index 19958242218282..e9dc5baf10558a 100644 --- a/src/platform/EFR32/SystemPlatformConfig.h +++ b/src/platform/EFR32/SystemPlatformConfig.h @@ -39,9 +39,6 @@ struct ChipDeviceEvent; #define CHIP_SYSTEM_CONFIG_LWIP_EVENT_TYPE int #define CHIP_SYSTEM_CONFIG_LWIP_EVENT_OBJECT_TYPE const struct ::chip::DeviceLayer::ChipDeviceEvent * -#define CHIP_SYSTEM_LWIP_ERROR_MIN 3000000 -#define CHIP_SYSTEM_LWIP_ERROR_MAX 3000128 - // ========== Platform-specific Configuration Overrides ========= #ifndef CHIP_SYSTEM_CONFIG_NUM_TIMERS diff --git a/src/platform/ESP32/CHIPDevicePlatformConfig.h b/src/platform/ESP32/CHIPDevicePlatformConfig.h index c3040b7ad334e6..e79a922b46b39b 100644 --- a/src/platform/ESP32/CHIPDevicePlatformConfig.h +++ b/src/platform/ESP32/CHIPDevicePlatformConfig.h @@ -29,7 +29,7 @@ #define CHIP_DEVICE_CONFIG_LWIP_WIFI_STATION_IF_NAME "st" -#define CHIP_DEVICE_CONFIG_ESP32_BLE_ERROR_MIN 11000000 +#define CHIP_DEVICE_CONFIG_ESP32_BLE_ERROR_MIN 0xB00000 // ==================== Kconfig Overrides ==================== // The following values are configured via the ESP-IDF Kconfig mechanism. diff --git a/src/platform/ESP32/CHIPPlatformConfig.h b/src/platform/ESP32/CHIPPlatformConfig.h index ef27857aae2a29..899aae8cd57be0 100644 --- a/src/platform/ESP32/CHIPPlatformConfig.h +++ b/src/platform/ESP32/CHIPPlatformConfig.h @@ -41,14 +41,6 @@ // The ESP NVS implementation limits key names to 15 characters. #define CHIP_CONFIG_PERSISTED_STORAGE_MAX_KEY_LENGTH 15 -#define CHIP_CONFIG_ERROR_TYPE esp_err_t -#define CHIP_CONFIG_ERROR_FORMAT PRId32 -#define CHIP_CONFIG_CORE_ERROR_MIN 4000000 -#define CHIP_CONFIG_CORE_ERROR_MAX 4000999 - -#define ASN1_CONFIG_ERROR_MIN 5000000 -#define ASN1_CONFIG_ERROR_MAX 5000999 - #define CHIP_LOG_FILTERING 0 #define CHIP_CONFIG_TIME_ENABLE_CLIENT 1 #define CHIP_CONFIG_TIME_ENABLE_SERVER 0 diff --git a/src/platform/ESP32/SystemPlatformConfig.h b/src/platform/ESP32/SystemPlatformConfig.h index 93e957ee688413..60d73ac9e6c08e 100644 --- a/src/platform/ESP32/SystemPlatformConfig.h +++ b/src/platform/ESP32/SystemPlatformConfig.h @@ -42,9 +42,6 @@ struct ChipDeviceEvent; #define CHIP_SYSTEM_CONFIG_LWIP_EVENT_TYPE int #define CHIP_SYSTEM_CONFIG_LWIP_EVENT_OBJECT_TYPE const struct ::chip::DeviceLayer::ChipDeviceEvent * -#define CHIP_SYSTEM_LWIP_ERROR_MIN 3000000 -#define CHIP_SYSTEM_LWIP_ERROR_MAX 3000128 - // ==================== General Configuration Overrides ==================== // NOTE: Values that are mapped to CONFIG_ #defines are settable via the ESP-IDF Kconfig mechanism. diff --git a/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp b/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp index 316c045a30d8ee..9d94b2ee5ee2e6 100644 --- a/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp +++ b/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp @@ -443,7 +443,7 @@ CHIP_ERROR BLEManagerImpl::MapBLEError(int bleErr) case ESP_ERR_NO_MEM: return CHIP_ERROR_NO_MEMORY; default: - return CHIP_DEVICE_CONFIG_ESP32_BLE_ERROR_MIN + static_cast(bleErr); + return ChipError::Encapsulate(ChipError::Range::kPlatform, CHIP_DEVICE_CONFIG_ESP32_BLE_ERROR_MIN + bleErr); } } diff --git a/src/platform/ESP32/nimble/BLEManagerImpl.cpp b/src/platform/ESP32/nimble/BLEManagerImpl.cpp index 3d473afede8735..3d8c8177d3ca6e 100644 --- a/src/platform/ESP32/nimble/BLEManagerImpl.cpp +++ b/src/platform/ESP32/nimble/BLEManagerImpl.cpp @@ -452,7 +452,7 @@ CHIP_ERROR BLEManagerImpl::MapBLEError(int bleErr) case ESP_ERR_INVALID_ARG: return CHIP_ERROR_INVALID_ARGUMENT; default: - return CHIP_DEVICE_CONFIG_ESP32_BLE_ERROR_MIN + static_cast(bleErr); + return ChipError::Encapsulate(ChipError::Range::kPlatform, CHIP_DEVICE_CONFIG_ESP32_BLE_ERROR_MIN + bleErr); } } void BLEManagerImpl::DriveBLEState(void) diff --git a/src/platform/GeneralUtils.cpp b/src/platform/GeneralUtils.cpp index 140a32992abf54..ef09347a6ed2c2 100644 --- a/src/platform/GeneralUtils.cpp +++ b/src/platform/GeneralUtils.cpp @@ -115,7 +115,7 @@ bool FormatDeviceLayerError(char * buf, uint16_t bufSize, CHIP_ERROR err) { const char * desc = nullptr; - if (err < CHIP_DEVICE_ERROR_MIN || err > CHIP_DEVICE_ERROR_MAX) + if (!ChipError::IsPart(ChipError::SdkPart::kDevice, err)) { return false; } diff --git a/src/platform/K32W/CHIPPlatformConfig.h b/src/platform/K32W/CHIPPlatformConfig.h index 1305a7ed6599e0..1ca4f84a858d4d 100644 --- a/src/platform/K32W/CHIPPlatformConfig.h +++ b/src/platform/K32W/CHIPPlatformConfig.h @@ -29,14 +29,6 @@ // ==================== General Platform Adaptations ==================== -#define CHIP_CONFIG_ERROR_TYPE int32_t -#define CHIP_CONFIG_ERROR_FORMAT PRId32 -#define CHIP_CONFIG_CORE_ERROR_MIN 4000000 -#define CHIP_CONFIG_CORE_ERROR_MAX 4000999 - -#define ASN1_CONFIG_ERROR_MIN 5000000 -#define ASN1_CONFIG_ERROR_MAX 5000999 - #define ChipDie() abort() #define CHIP_CONFIG_PERSISTED_STORAGE_KEY_TYPE uint16_t diff --git a/src/platform/K32W/K32WConfig.cpp b/src/platform/K32W/K32WConfig.cpp index cba0a20f11dd51..c37c856f34a539 100644 --- a/src/platform/K32W/K32WConfig.cpp +++ b/src/platform/K32W/K32WConfig.cpp @@ -411,7 +411,7 @@ CHIP_ERROR K32WConfig::MapPdmStatus(PDM_teStatus pdmStatus) err = CHIP_NO_ERROR; break; default: - err = CHIP_CONFIG_CORE_ERROR_MIN + pdmStatus; + err = ChipError::Encapsulate(ChipError::Range::kPlatform, pdmStatus); break; } @@ -420,7 +420,7 @@ CHIP_ERROR K32WConfig::MapPdmStatus(PDM_teStatus pdmStatus) CHIP_ERROR K32WConfig::MapPdmInitStatus(int pdmStatus) { - return (pdmStatus == 0) ? CHIP_NO_ERROR : CHIP_CONFIG_CORE_ERROR_MIN + pdmStatus; + return (pdmStatus == 0) ? CHIP_NO_ERROR : ChipError::Encapsulate(ChipError::Range::kPlatform, pdmStatus); } bool K32WConfig::ValidConfigKey(Key key) diff --git a/src/platform/K32W/SystemPlatformConfig.h b/src/platform/K32W/SystemPlatformConfig.h index 44138dde4fc5ff..d38e23ff7ac6af 100644 --- a/src/platform/K32W/SystemPlatformConfig.h +++ b/src/platform/K32W/SystemPlatformConfig.h @@ -40,9 +40,6 @@ struct ChipDeviceEvent; #define CHIP_SYSTEM_CONFIG_LWIP_EVENT_TYPE int #define CHIP_SYSTEM_CONFIG_LWIP_EVENT_OBJECT_TYPE const struct ::chip::DeviceLayer::ChipDeviceEvent * -#define CHIP_SYSTEM_LWIP_ERROR_MIN 3000000 -#define CHIP_SYSTEM_LWIP_ERROR_MAX 3000128 - // ========== Platform-specific Configuration Overrides ========= #ifndef CHIP_SYSTEM_CONFIG_NUM_TIMERS diff --git a/src/platform/OpenThread/OpenThreadUtils.cpp b/src/platform/OpenThread/OpenThreadUtils.cpp index 43632428f8fa51..07a8b538b914f7 100644 --- a/src/platform/OpenThread/OpenThreadUtils.cpp +++ b/src/platform/OpenThread/OpenThreadUtils.cpp @@ -42,7 +42,8 @@ namespace Internal { */ CHIP_ERROR MapOpenThreadError(otError otErr) { - return (otErr == OT_ERROR_NONE) ? CHIP_NO_ERROR : CHIP_CONFIG_OPENTHREAD_ERROR_MIN + static_cast(otErr); + return (otErr == OT_ERROR_NONE) ? CHIP_NO_ERROR + : ChipError::Encapsulate(ChipError::Range::kOpenThread, static_cast(otErr)); } /** @@ -59,7 +60,7 @@ CHIP_ERROR MapOpenThreadError(otError otErr) */ bool FormatOpenThreadError(char * buf, uint16_t bufSize, CHIP_ERROR err) { - if (err < CHIP_CONFIG_OPENTHREAD_ERROR_MIN || err > CHIP_CONFIG_OPENTHREAD_ERROR_MAX) + if (!ChipError::IsRange(ChipError::Range::kOpenThread, err)) { return false; } @@ -67,7 +68,7 @@ bool FormatOpenThreadError(char * buf, uint16_t bufSize, CHIP_ERROR err) #if CHIP_CONFIG_SHORT_ERROR_STR const char * desc = NULL; #else // CHIP_CONFIG_SHORT_ERROR_STR - otError otErr = (otError)(err - CHIP_CONFIG_OPENTHREAD_ERROR_MIN); + otError otErr = (otError) ChipError::GetValue(err); const char * desc = otThreadErrorToString(otErr); #endif // CHIP_CONFIG_SHORT_ERROR_STR diff --git a/src/platform/cc13x2_26x2/CHIPPlatformConfig.h b/src/platform/cc13x2_26x2/CHIPPlatformConfig.h index f9abcb8190a694..c561e1fe3c7582 100644 --- a/src/platform/cc13x2_26x2/CHIPPlatformConfig.h +++ b/src/platform/cc13x2_26x2/CHIPPlatformConfig.h @@ -30,9 +30,6 @@ // ==================== General Platform Adaptations ==================== -#define CHIP_CONFIG_ERROR_TYPE uint32_t -#define CHIP_CONFIG_ERROR_FORMAT PRIu32 - #define ChipDie() assert() #define CHIP_CONFIG_PERSISTED_STORAGE_KEY_TYPE uint16_t diff --git a/src/platform/mbed/CHIPPlatformConfig.h b/src/platform/mbed/CHIPPlatformConfig.h index 5083cd3305c3ba..2818ee14aab3c6 100644 --- a/src/platform/mbed/CHIPPlatformConfig.h +++ b/src/platform/mbed/CHIPPlatformConfig.h @@ -28,12 +28,6 @@ // ==================== General Platform Adaptations ==================== -#define CHIP_CONFIG_ERROR_TYPE int32_t -#define CHIP_CONFIG_ERROR_FORMAT PRId32 - -#define CHIP_CONFIG_ERROR_MIN 4000000 -#define CHIP_CONFIG_ERROR_MAX 4000999 - #define ChipDie() abort() #define CHIP_CONFIG_PERSISTED_STORAGE_KEY_TYPE const char * diff --git a/src/platform/mbed/SystemPlatformConfig.h b/src/platform/mbed/SystemPlatformConfig.h index 2d273fe4da0d0d..0d8918d4256bfb 100644 --- a/src/platform/mbed/SystemPlatformConfig.h +++ b/src/platform/mbed/SystemPlatformConfig.h @@ -44,14 +44,6 @@ struct ChipDeviceEvent; #define CHIP_SYSTEM_CONFIG_LWIP_EVENT_TYPE int #define CHIP_SYSTEM_CONFIG_LWIP_EVENT_OBJECT_TYPE const struct ::chip::DeviceLayer::ChipDeviceEvent * -#define CHIP_SYSTEM_CONFIG_ERROR_TYPE int32_t -#define CHIP_SYSTEM_CONFIG_NO_ERROR 0 -#define CHIP_SYSTEM_CONFIG_ERROR_MIN 7000000 -#define CHIP_SYSTEM_CONFIG_ERROR_MAX 7000999 -#define _CHIP_SYSTEM_CONFIG_ERROR(e) (CHIP_SYSTEM_CONFIG_ERROR_MIN + (e)) -#define CHIP_SYSTEM_LWIP_ERROR_MIN 3000000 -#define CHIP_SYSTEM_LWIP_ERROR_MAX 3000128 - // ========== Platform-specific Configuration Overrides ========= #ifndef CHIP_SYSTEM_CONFIG_NUM_TIMERS diff --git a/src/platform/qpg/CHIPPlatformConfig.h b/src/platform/qpg/CHIPPlatformConfig.h index 70644382ea9513..5d483e24eadff8 100644 --- a/src/platform/qpg/CHIPPlatformConfig.h +++ b/src/platform/qpg/CHIPPlatformConfig.h @@ -25,14 +25,6 @@ // ==================== General Platform Adaptations ==================== -#define CHIP_CONFIG_ERROR_TYPE int32_t -#define CHIP_CONFIG_ERROR_FORMAT PRId32 -#define CHIP_CONFIG_CORE_ERROR_MIN 4000000 -#define CHIP_CONFIG_CORE_ERROR_MAX 4000999 - -#define ASN1_CONFIG_ERROR_MIN 5000000 -#define ASN1_CONFIG_ERROR_MAX 5000999 - #define ChipDie() abort() #define CHIP_CONFIG_ENABLE_TUNNELING 0 diff --git a/src/platform/qpg/SystemPlatformConfig.h b/src/platform/qpg/SystemPlatformConfig.h index 2b6114ff5fc56a..3ab8a4e698f724 100644 --- a/src/platform/qpg/SystemPlatformConfig.h +++ b/src/platform/qpg/SystemPlatformConfig.h @@ -38,9 +38,6 @@ struct ChipDeviceEvent; #define CHIP_SYSTEM_CONFIG_LWIP_EVENT_TYPE int #define CHIP_SYSTEM_CONFIG_LWIP_EVENT_OBJECT_TYPE const struct ::chip::DeviceLayer::ChipDeviceEvent * -#define CHIP_SYSTEM_LWIP_ERROR_MIN 3000000 -#define CHIP_SYSTEM_LWIP_ERROR_MAX 3000128 - // ========== Platform-specific Configuration Overrides ========= #ifndef CHIP_SYSTEM_CONFIG_NUM_TIMERS diff --git a/src/system/SystemConfig.h b/src/system/SystemConfig.h index 5487148b14fbab..36f8545a1d8eb0 100644 --- a/src/system/SystemConfig.h +++ b/src/system/SystemConfig.h @@ -418,32 +418,6 @@ struct LwIPEvent; #endif /* CHIP_SYSTEM_CONFIG_USE_LWIP */ -/** - * @def CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_POSIX_ERROR_FUNCTIONS - * - * @brief - * This defines whether (1) or not (0) your platform will provide the following platform- and system-specific functions: - * - chip::System::MapErrorPOSIX - * - chip::System::DescribeErrorPOSIX - * - chip::System::IsErrorPOSIX - */ -#ifndef CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_POSIX_ERROR_FUNCTIONS -#define CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_POSIX_ERROR_FUNCTIONS 0 -#endif /* CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_POSIX_ERROR_FUNCTIONS */ - -/** - * @def CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_LWIP_ERROR_FUNCTIONS - * - * @brief - * This defines whether (1) or not (0) your platform will provide the following system-specific functions: - * - chip::System::MapErrorLwIP - * - chip::System::DescribeErrorLwIP - * - chip::System::IsErrorLwIP - */ -#ifndef CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_LWIP_ERROR_FUNCTIONS -#define CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_LWIP_ERROR_FUNCTIONS 0 -#endif /* CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_LWIP_ERROR_FUNCTIONS */ - /** * @def CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_XTOR_FUNCTIONS * diff --git a/src/system/SystemError.cpp b/src/system/SystemError.cpp index 112be5749c70cc..82760b6cb7454b 100644 --- a/src/system/SystemError.cpp +++ b/src/system/SystemError.cpp @@ -40,68 +40,13 @@ #include #endif // CHIP_SYSTEM_CONFIG_USE_LWIP -#if !CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_POSIX_ERROR_FUNCTIONS -#include -#endif // !CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_POSIX_ERROR_FUNCTIONS - -#include - #include - -#if !CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_POSIX_ERROR_FUNCTIONS - -/** - * @def CHIP_SYSTEM_POSIX_ERROR_MIN - * - * @brief - * This defines the base or minimum CHIP System Layer error number range, when passing through errors from an underlying - * POSIX layer. - */ -#define CHIP_SYSTEM_POSIX_ERROR_MIN 2000 - -/** - * @def CHIP_SYSTEM_POSIX_ERROR_MAX - * - * @brief - * This defines the base or maximum CHIP System Layer error number range, when passing through errors from an underlying - * POSIX layer. - */ -#define CHIP_SYSTEM_POSIX_ERROR_MAX 2999 - -#endif // !CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_POSIX_ERROR_FUNCTIONS - -#if CHIP_SYSTEM_CONFIG_USE_LWIP -#if !CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_LWIP_ERROR_FUNCTIONS - -/** - * @def CHIP_SYSTEM_LWIP_ERROR_MIN - * - * @brief - * This defines the base or minimum CHIP System Layer error number range, when passing through errors from an underlying LWIP - * stack. - */ -#ifndef CHIP_SYSTEM_LWIP_ERROR_MIN -#define CHIP_SYSTEM_LWIP_ERROR_MIN 3000 -#endif // CHIP_SYSTEM_LWIP_ERROR_MIN - -/** - * @def CHIP_SYSTEM_LWIP_ERROR_MAX - * - * @brief - * This defines the base or maximum CHIP System Layer error number range, when passing through errors from an underlying LWIP - * layer. - */ -#ifndef CHIP_SYSTEM_LWIP_ERROR_MAX -#define CHIP_SYSTEM_LWIP_ERROR_MAX 3128 -#endif // CHIP_SYSTEM_LWIP_ERROR_MAX - -#endif // !CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_LWIP_ERROR_FUNCTIONS -#endif // CHIP_SYSTEM_CONFIG_USE_LWIP +#include +#include namespace chip { namespace System { -#if !CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_POSIX_ERROR_FUNCTIONS /** * This implements a mapping function for CHIP System Layer errors that allows mapping integers in the number space of the * underlying POSIX network and OS stack errors into a platform- or system-specific range. Error codes beyond those currently @@ -113,7 +58,8 @@ namespace System { */ DLL_EXPORT CHIP_ERROR MapErrorPOSIX(int aError) { - return (aError == 0 ? CHIP_NO_ERROR : static_cast(CHIP_SYSTEM_POSIX_ERROR_MIN + aError)); + return (aError == 0 ? CHIP_NO_ERROR + : ChipError::Encapsulate(ChipError::Range::kPOSIX, static_cast(aError))); } /** @@ -126,25 +72,10 @@ DLL_EXPORT CHIP_ERROR MapErrorPOSIX(int aError) */ DLL_EXPORT const char * DescribeErrorPOSIX(CHIP_ERROR aError) { - const int lError = (static_cast(aError) - CHIP_SYSTEM_POSIX_ERROR_MIN); + const int lError = static_cast(ChipError::GetValue(aError)); return strerror(lError); } -/** - * This implements an introspection function for CHIP System Layer errors that allows the caller to determine whether the - * specified error is an internal, underlying OS error. - * - * @param[in] aError The mapped error to determine whether it is an OS error. - * - * @return True if the specified error is an OS error; otherwise, false. - */ -DLL_EXPORT bool IsErrorPOSIX(CHIP_ERROR aError) -{ - return (aError >= CHIP_SYSTEM_POSIX_ERROR_MIN && aError <= CHIP_SYSTEM_POSIX_ERROR_MAX); -} - -#endif // !CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_POSIX_ERROR_FUNCTIONS - /** * Register a text error formatter for POSIX errors. */ @@ -169,15 +100,13 @@ void RegisterPOSIXErrorFormatter() */ bool FormatPOSIXError(char * buf, uint16_t bufSize, CHIP_ERROR err) { - const CHIP_ERROR sysErr = static_cast(err); - - if (IsErrorPOSIX(sysErr)) + if (ChipError::IsRange(ChipError::Range::kPOSIX, err)) { const char * desc = #if CHIP_CONFIG_SHORT_ERROR_STR NULL; #else - DescribeErrorPOSIX(sysErr); + DescribeErrorPOSIX(err); #endif FormatError(buf, bufSize, "OS", err, desc); return true; @@ -200,7 +129,6 @@ DLL_EXPORT CHIP_ERROR MapErrorZephyr(int aError) } #if CHIP_SYSTEM_CONFIG_USE_LWIP -#if !CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_LWIP_ERROR_FUNCTIONS /** * This implements a mapping function for CHIP System Layer errors that allows mapping underlying LwIP network stack errors into a @@ -213,9 +141,8 @@ DLL_EXPORT CHIP_ERROR MapErrorZephyr(int aError) */ DLL_EXPORT CHIP_ERROR MapErrorLwIP(err_t aError) { - static_assert(std::numeric_limits::min() == CHIP_SYSTEM_LWIP_ERROR_MIN - CHIP_SYSTEM_LWIP_ERROR_MAX, - "Can't represent all LWIP errors"); - return (aError == ERR_OK ? CHIP_NO_ERROR : CHIP_SYSTEM_LWIP_ERROR_MIN - aError); + static_assert(ChipError::CanEncapsulate(-std::numeric_limits::min()), "Can't represent all LWIP errors"); + return (aError == ERR_OK ? CHIP_NO_ERROR : ChipError::Encapsulate(ChipError::Range::kLwIP, static_cast(-aError))); } /** @@ -229,20 +156,12 @@ DLL_EXPORT CHIP_ERROR MapErrorLwIP(err_t aError) */ DLL_EXPORT const char * DescribeErrorLwIP(CHIP_ERROR aError) { - if (!IsErrorLwIP(aError)) + if (!ChipError::IsRange(ChipError::Range::kLwIP, aError)) { return nullptr; } - // Error might be a signed or unsigned type. But we know the value is no - // larger than CHIP_SYSTEM_LWIP_ERROR_MAX and that this means it's safe to - // store in int. - static_assert(INT_MAX > CHIP_SYSTEM_LWIP_ERROR_MAX, "Our subtraction will fail"); - const int lErrorWithoutOffset = aError - CHIP_SYSTEM_LWIP_ERROR_MIN; - // Cast is safe because the range from CHIP_SYSTEM_LWIP_ERROR_MIN to - // CHIP_SYSTEM_LWIP_ERROR_MAX all fits inside err_t. See static_assert in - // MapErrorLwIP. - const err_t lError = static_cast(-lErrorWithoutOffset); + const err_t lError = static_cast(-static_cast(ChipError::GetValue(aError))); // If we are not compiling with LWIP_DEBUG asserted, the unmapped // local value may go unused. @@ -252,23 +171,6 @@ DLL_EXPORT const char * DescribeErrorLwIP(CHIP_ERROR aError) return lwip_strerr(lError); } -/** - * This implements an introspection function for CHIP System Layer errors that - * allows the caller to determine whether the specified error is an - * internal, underlying LwIP error. - * - * @param[in] aError The mapped error to determine whether it is a LwIP error. - * - * @return True if the specified error is a LwIP error; otherwise, false. - * - */ -DLL_EXPORT bool IsErrorLwIP(CHIP_ERROR aError) -{ - return (aError >= CHIP_SYSTEM_LWIP_ERROR_MIN && aError <= CHIP_SYSTEM_LWIP_ERROR_MAX); -} - -#endif // !CHIP_SYSTEM_CONFIG_PLATFORM_PROVIDES_LWIP_ERROR_FUNCTIONS - /** * Register a text error formatter for LwIP errors. */ @@ -293,15 +195,13 @@ void RegisterLwIPErrorFormatter(void) */ bool FormatLwIPError(char * buf, uint16_t bufSize, CHIP_ERROR err) { - const CHIP_ERROR sysErr = static_cast(err); - - if (IsErrorLwIP(sysErr)) + if (ChipError::IsRange(ChipError::Range::kLwIP, err)) { const char * desc = #if CHIP_CONFIG_SHORT_ERROR_STR NULL; #else - DescribeErrorLwIP(sysErr); + DescribeErrorLwIP(err); #endif chip::FormatError(buf, bufSize, "LwIP", err, desc); return true; diff --git a/src/system/SystemError.h b/src/system/SystemError.h index d2fb84645eb2f9..9c2046891cac30 100644 --- a/src/system/SystemError.h +++ b/src/system/SystemError.h @@ -44,21 +44,19 @@ namespace chip { namespace System { -extern void RegisterLayerErrorFormatter(); -extern bool FormatLayerError(char * buf, uint16_t bufSize, CHIP_ERROR err); - extern CHIP_ERROR MapErrorPOSIX(int code); extern const char * DescribeErrorPOSIX(CHIP_ERROR code); -extern bool IsErrorPOSIX(CHIP_ERROR code); extern void RegisterPOSIXErrorFormatter(); extern bool FormatPOSIXError(char * buf, uint16_t bufSize, CHIP_ERROR err); + +#if __ZEPHYR__ extern CHIP_ERROR MapErrorZephyr(int code); +#endif // __ZEPHYR__ #if CHIP_SYSTEM_CONFIG_USE_LWIP extern CHIP_ERROR MapErrorLwIP(err_t code); extern const char * DescribeErrorLwIP(CHIP_ERROR code); -extern bool IsErrorLwIP(CHIP_ERROR code); extern void RegisterLwIPErrorFormatter(void); extern bool FormatLwIPError(char * buf, uint16_t bufSize, CHIP_ERROR err);