diff --git a/examples/chip-tool/commands/clusters/Commands.h b/examples/chip-tool/commands/clusters/Commands.h index 22f0e0103cc916..b29da4a9836aff 100644 --- a/examples/chip-tool/commands/clusters/Commands.h +++ b/examples/chip-tool/commands/clusters/Commands.h @@ -31,7 +31,7 @@ static void OnDefaultSuccessResponse(void * context) ChipLogProgress(chipTool, "Default Success Response"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDefaultFailureResponse(void * context, uint8_t status) @@ -39,7 +39,7 @@ static void OnDefaultFailureResponse(void * context, uint8_t status) ChipLogProgress(chipTool, "Default Failure Response: 0x%02x", status); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(false); + command->SetCommandExitStatus(CHIP_ERROR_INTERNAL); } static void OnBooleanAttributeResponse(void * context, bool value) @@ -47,7 +47,7 @@ static void OnBooleanAttributeResponse(void * context, bool value) ChipLogProgress(chipTool, "Boolean attribute Response: %d", value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnInt8uAttributeResponse(void * context, uint8_t value) @@ -55,7 +55,7 @@ static void OnInt8uAttributeResponse(void * context, uint8_t value) ChipLogProgress(chipTool, "Int8u attribute Response: %" PRIu8, value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnInt16uAttributeResponse(void * context, uint16_t value) @@ -63,7 +63,7 @@ static void OnInt16uAttributeResponse(void * context, uint16_t value) ChipLogProgress(chipTool, "Int16u attribute Response: %" PRIu16, value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnInt32uAttributeResponse(void * context, uint32_t value) @@ -71,7 +71,7 @@ static void OnInt32uAttributeResponse(void * context, uint32_t value) ChipLogProgress(chipTool, "Int32u attribute Response: %" PRIu32, value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnInt64uAttributeResponse(void * context, uint64_t value) @@ -79,7 +79,7 @@ static void OnInt64uAttributeResponse(void * context, uint64_t value) ChipLogProgress(chipTool, "Int64u attribute Response: %" PRIu64, value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnInt8sAttributeResponse(void * context, int8_t value) @@ -87,7 +87,7 @@ static void OnInt8sAttributeResponse(void * context, int8_t value) ChipLogProgress(chipTool, "Int8s attribute Response: %" PRId8, value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnInt16sAttributeResponse(void * context, int16_t value) @@ -95,7 +95,7 @@ static void OnInt16sAttributeResponse(void * context, int16_t value) ChipLogProgress(chipTool, "Int16s attribute Response: %" PRId16, value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnInt32sAttributeResponse(void * context, int32_t value) @@ -103,7 +103,7 @@ static void OnInt32sAttributeResponse(void * context, int32_t value) ChipLogProgress(chipTool, "Int32s attribute Response: %" PRId32, value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnInt64sAttributeResponse(void * context, int64_t value) @@ -111,7 +111,7 @@ static void OnInt64sAttributeResponse(void * context, int64_t value) ChipLogProgress(chipTool, "Int64s attribute Response: %" PRId64, value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnStringAttributeResponse(void * context, const chip::ByteSpan value) @@ -119,7 +119,7 @@ static void OnStringAttributeResponse(void * context, const chip::ByteSpan value ChipLogProgress(chipTool, "String attribute Response: %zu", value.size()); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnAccountLoginClusterGetSetupPINResponse(void * context, uint8_t * setupPIN) @@ -127,7 +127,7 @@ static void OnAccountLoginClusterGetSetupPINResponse(void * context, uint8_t * s ChipLogProgress(chipTool, "AccountLoginClusterGetSetupPINResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnApplicationLauncherClusterLaunchAppResponse(void * context, uint8_t * data) @@ -135,7 +135,7 @@ static void OnApplicationLauncherClusterLaunchAppResponse(void * context, uint8_ ChipLogProgress(chipTool, "ApplicationLauncherClusterLaunchAppResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnContentLauncherClusterLaunchContentResponse(void * context, uint8_t * data, uint8_t contentLaunchStatus) @@ -143,7 +143,7 @@ static void OnContentLauncherClusterLaunchContentResponse(void * context, uint8_ ChipLogProgress(chipTool, "ContentLauncherClusterLaunchContentResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnContentLauncherClusterLaunchURLResponse(void * context, uint8_t * data, uint8_t contentLaunchStatus) @@ -151,7 +151,7 @@ static void OnContentLauncherClusterLaunchURLResponse(void * context, uint8_t * ChipLogProgress(chipTool, "ContentLauncherClusterLaunchURLResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterClearAllPinsResponse(void * context) @@ -159,7 +159,7 @@ static void OnDoorLockClusterClearAllPinsResponse(void * context) ChipLogProgress(chipTool, "DoorLockClusterClearAllPinsResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterClearAllRfidsResponse(void * context) @@ -167,7 +167,7 @@ static void OnDoorLockClusterClearAllRfidsResponse(void * context) ChipLogProgress(chipTool, "DoorLockClusterClearAllRfidsResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterClearHolidayScheduleResponse(void * context) @@ -175,7 +175,7 @@ static void OnDoorLockClusterClearHolidayScheduleResponse(void * context) ChipLogProgress(chipTool, "DoorLockClusterClearHolidayScheduleResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterClearPinResponse(void * context) @@ -183,7 +183,7 @@ static void OnDoorLockClusterClearPinResponse(void * context) ChipLogProgress(chipTool, "DoorLockClusterClearPinResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterClearRfidResponse(void * context) @@ -191,7 +191,7 @@ static void OnDoorLockClusterClearRfidResponse(void * context) ChipLogProgress(chipTool, "DoorLockClusterClearRfidResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterClearWeekdayScheduleResponse(void * context) @@ -199,7 +199,7 @@ static void OnDoorLockClusterClearWeekdayScheduleResponse(void * context) ChipLogProgress(chipTool, "DoorLockClusterClearWeekdayScheduleResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterClearYeardayScheduleResponse(void * context) @@ -207,7 +207,7 @@ static void OnDoorLockClusterClearYeardayScheduleResponse(void * context) ChipLogProgress(chipTool, "DoorLockClusterClearYeardayScheduleResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterGetHolidayScheduleResponse(void * context, uint8_t scheduleId, uint32_t localStartTime, @@ -216,7 +216,7 @@ static void OnDoorLockClusterGetHolidayScheduleResponse(void * context, uint8_t ChipLogProgress(chipTool, "DoorLockClusterGetHolidayScheduleResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterGetLogRecordResponse(void * context, uint16_t logEntryId, uint32_t timestamp, uint8_t eventType, @@ -225,7 +225,7 @@ static void OnDoorLockClusterGetLogRecordResponse(void * context, uint16_t logEn ChipLogProgress(chipTool, "DoorLockClusterGetLogRecordResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterGetPinResponse(void * context, uint16_t userId, uint8_t userStatus, uint8_t userType, uint8_t * pin) @@ -233,7 +233,7 @@ static void OnDoorLockClusterGetPinResponse(void * context, uint16_t userId, uin ChipLogProgress(chipTool, "DoorLockClusterGetPinResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterGetRfidResponse(void * context, uint16_t userId, uint8_t userStatus, uint8_t userType, uint8_t * rfid) @@ -241,7 +241,7 @@ static void OnDoorLockClusterGetRfidResponse(void * context, uint16_t userId, ui ChipLogProgress(chipTool, "DoorLockClusterGetRfidResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterGetUserTypeResponse(void * context, uint16_t userId, uint8_t userType) @@ -249,7 +249,7 @@ static void OnDoorLockClusterGetUserTypeResponse(void * context, uint16_t userId ChipLogProgress(chipTool, "DoorLockClusterGetUserTypeResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterGetWeekdayScheduleResponse(void * context, uint8_t scheduleId, uint16_t userId, uint8_t daysMask, @@ -258,7 +258,7 @@ static void OnDoorLockClusterGetWeekdayScheduleResponse(void * context, uint8_t ChipLogProgress(chipTool, "DoorLockClusterGetWeekdayScheduleResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterGetYeardayScheduleResponse(void * context, uint8_t scheduleId, uint16_t userId, @@ -267,7 +267,7 @@ static void OnDoorLockClusterGetYeardayScheduleResponse(void * context, uint8_t ChipLogProgress(chipTool, "DoorLockClusterGetYeardayScheduleResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterLockDoorResponse(void * context) @@ -275,7 +275,7 @@ static void OnDoorLockClusterLockDoorResponse(void * context) ChipLogProgress(chipTool, "DoorLockClusterLockDoorResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterSetHolidayScheduleResponse(void * context) @@ -283,7 +283,7 @@ static void OnDoorLockClusterSetHolidayScheduleResponse(void * context) ChipLogProgress(chipTool, "DoorLockClusterSetHolidayScheduleResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterSetPinResponse(void * context) @@ -291,7 +291,7 @@ static void OnDoorLockClusterSetPinResponse(void * context) ChipLogProgress(chipTool, "DoorLockClusterSetPinResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterSetRfidResponse(void * context) @@ -299,7 +299,7 @@ static void OnDoorLockClusterSetRfidResponse(void * context) ChipLogProgress(chipTool, "DoorLockClusterSetRfidResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterSetUserTypeResponse(void * context) @@ -307,7 +307,7 @@ static void OnDoorLockClusterSetUserTypeResponse(void * context) ChipLogProgress(chipTool, "DoorLockClusterSetUserTypeResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterSetWeekdayScheduleResponse(void * context) @@ -315,7 +315,7 @@ static void OnDoorLockClusterSetWeekdayScheduleResponse(void * context) ChipLogProgress(chipTool, "DoorLockClusterSetWeekdayScheduleResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterSetYeardayScheduleResponse(void * context) @@ -323,7 +323,7 @@ static void OnDoorLockClusterSetYeardayScheduleResponse(void * context) ChipLogProgress(chipTool, "DoorLockClusterSetYeardayScheduleResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterUnlockDoorResponse(void * context) @@ -331,7 +331,7 @@ static void OnDoorLockClusterUnlockDoorResponse(void * context) ChipLogProgress(chipTool, "DoorLockClusterUnlockDoorResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDoorLockClusterUnlockWithTimeoutResponse(void * context) @@ -339,7 +339,7 @@ static void OnDoorLockClusterUnlockWithTimeoutResponse(void * context) ChipLogProgress(chipTool, "DoorLockClusterUnlockWithTimeoutResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnGeneralCommissioningClusterArmFailSafeResponse(void * context, uint8_t errorCode, uint8_t * debugText) @@ -347,7 +347,7 @@ static void OnGeneralCommissioningClusterArmFailSafeResponse(void * context, uin ChipLogProgress(chipTool, "GeneralCommissioningClusterArmFailSafeResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnGeneralCommissioningClusterCommissioningCompleteResponse(void * context, uint8_t errorCode, uint8_t * debugText) @@ -355,7 +355,7 @@ static void OnGeneralCommissioningClusterCommissioningCompleteResponse(void * co ChipLogProgress(chipTool, "GeneralCommissioningClusterCommissioningCompleteResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnGeneralCommissioningClusterSetRegulatoryConfigResponse(void * context, uint8_t errorCode, uint8_t * debugText) @@ -363,7 +363,7 @@ static void OnGeneralCommissioningClusterSetRegulatoryConfigResponse(void * cont ChipLogProgress(chipTool, "GeneralCommissioningClusterSetRegulatoryConfigResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnGroupsClusterAddGroupResponse(void * context, uint16_t groupId) @@ -371,7 +371,7 @@ static void OnGroupsClusterAddGroupResponse(void * context, uint16_t groupId) ChipLogProgress(chipTool, "GroupsClusterAddGroupResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnGroupsClusterGetGroupMembershipResponse(void * context, uint8_t capacity, uint8_t groupCount, @@ -380,7 +380,7 @@ static void OnGroupsClusterGetGroupMembershipResponse(void * context, uint8_t ca ChipLogProgress(chipTool, "GroupsClusterGetGroupMembershipResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnGroupsClusterRemoveGroupResponse(void * context, uint16_t groupId) @@ -388,7 +388,7 @@ static void OnGroupsClusterRemoveGroupResponse(void * context, uint16_t groupId) ChipLogProgress(chipTool, "GroupsClusterRemoveGroupResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnGroupsClusterViewGroupResponse(void * context, uint16_t groupId, uint8_t * groupName) @@ -396,7 +396,7 @@ static void OnGroupsClusterViewGroupResponse(void * context, uint16_t groupId, u ChipLogProgress(chipTool, "GroupsClusterViewGroupResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnIdentifyClusterIdentifyQueryResponse(void * context, uint16_t timeout) @@ -404,7 +404,7 @@ static void OnIdentifyClusterIdentifyQueryResponse(void * context, uint16_t time ChipLogProgress(chipTool, "IdentifyClusterIdentifyQueryResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnKeypadInputClusterSendKeyResponse(void * context) @@ -412,7 +412,7 @@ static void OnKeypadInputClusterSendKeyResponse(void * context) ChipLogProgress(chipTool, "KeypadInputClusterSendKeyResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnMediaPlaybackClusterMediaFastForwardResponse(void * context, uint8_t mediaPlaybackStatus) @@ -420,7 +420,7 @@ static void OnMediaPlaybackClusterMediaFastForwardResponse(void * context, uint8 ChipLogProgress(chipTool, "MediaPlaybackClusterMediaFastForwardResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnMediaPlaybackClusterMediaNextResponse(void * context, uint8_t mediaPlaybackStatus) @@ -428,7 +428,7 @@ static void OnMediaPlaybackClusterMediaNextResponse(void * context, uint8_t medi ChipLogProgress(chipTool, "MediaPlaybackClusterMediaNextResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnMediaPlaybackClusterMediaPauseResponse(void * context, uint8_t mediaPlaybackStatus) @@ -436,7 +436,7 @@ static void OnMediaPlaybackClusterMediaPauseResponse(void * context, uint8_t med ChipLogProgress(chipTool, "MediaPlaybackClusterMediaPauseResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnMediaPlaybackClusterMediaPlayResponse(void * context, uint8_t mediaPlaybackStatus) @@ -444,7 +444,7 @@ static void OnMediaPlaybackClusterMediaPlayResponse(void * context, uint8_t medi ChipLogProgress(chipTool, "MediaPlaybackClusterMediaPlayResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnMediaPlaybackClusterMediaPreviousResponse(void * context, uint8_t mediaPlaybackStatus) @@ -452,7 +452,7 @@ static void OnMediaPlaybackClusterMediaPreviousResponse(void * context, uint8_t ChipLogProgress(chipTool, "MediaPlaybackClusterMediaPreviousResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnMediaPlaybackClusterMediaRewindResponse(void * context, uint8_t mediaPlaybackStatus) @@ -460,7 +460,7 @@ static void OnMediaPlaybackClusterMediaRewindResponse(void * context, uint8_t me ChipLogProgress(chipTool, "MediaPlaybackClusterMediaRewindResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnMediaPlaybackClusterMediaSkipBackwardResponse(void * context, uint8_t mediaPlaybackStatus) @@ -468,7 +468,7 @@ static void OnMediaPlaybackClusterMediaSkipBackwardResponse(void * context, uint ChipLogProgress(chipTool, "MediaPlaybackClusterMediaSkipBackwardResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnMediaPlaybackClusterMediaSkipForwardResponse(void * context, uint8_t mediaPlaybackStatus) @@ -476,7 +476,7 @@ static void OnMediaPlaybackClusterMediaSkipForwardResponse(void * context, uint8 ChipLogProgress(chipTool, "MediaPlaybackClusterMediaSkipForwardResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnMediaPlaybackClusterMediaSkipSeekResponse(void * context, uint8_t mediaPlaybackStatus) @@ -484,7 +484,7 @@ static void OnMediaPlaybackClusterMediaSkipSeekResponse(void * context, uint8_t ChipLogProgress(chipTool, "MediaPlaybackClusterMediaSkipSeekResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnMediaPlaybackClusterMediaStartOverResponse(void * context, uint8_t mediaPlaybackStatus) @@ -492,7 +492,7 @@ static void OnMediaPlaybackClusterMediaStartOverResponse(void * context, uint8_t ChipLogProgress(chipTool, "MediaPlaybackClusterMediaStartOverResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnMediaPlaybackClusterMediaStopResponse(void * context, uint8_t mediaPlaybackStatus) @@ -500,7 +500,7 @@ static void OnMediaPlaybackClusterMediaStopResponse(void * context, uint8_t medi ChipLogProgress(chipTool, "MediaPlaybackClusterMediaStopResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnNetworkCommissioningClusterAddThreadNetworkResponse(void * context, uint8_t errorCode, uint8_t * debugText) @@ -508,7 +508,7 @@ static void OnNetworkCommissioningClusterAddThreadNetworkResponse(void * context ChipLogProgress(chipTool, "NetworkCommissioningClusterAddThreadNetworkResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnNetworkCommissioningClusterAddWiFiNetworkResponse(void * context, uint8_t errorCode, uint8_t * debugText) @@ -516,7 +516,7 @@ static void OnNetworkCommissioningClusterAddWiFiNetworkResponse(void * context, ChipLogProgress(chipTool, "NetworkCommissioningClusterAddWiFiNetworkResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnNetworkCommissioningClusterDisableNetworkResponse(void * context, uint8_t errorCode, uint8_t * debugText) @@ -524,7 +524,7 @@ static void OnNetworkCommissioningClusterDisableNetworkResponse(void * context, ChipLogProgress(chipTool, "NetworkCommissioningClusterDisableNetworkResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnNetworkCommissioningClusterEnableNetworkResponse(void * context, uint8_t errorCode, uint8_t * debugText) @@ -532,7 +532,7 @@ static void OnNetworkCommissioningClusterEnableNetworkResponse(void * context, u ChipLogProgress(chipTool, "NetworkCommissioningClusterEnableNetworkResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnNetworkCommissioningClusterRemoveNetworkResponse(void * context, uint8_t errorCode, uint8_t * debugText) @@ -540,7 +540,7 @@ static void OnNetworkCommissioningClusterRemoveNetworkResponse(void * context, u ChipLogProgress(chipTool, "NetworkCommissioningClusterRemoveNetworkResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void @@ -551,7 +551,7 @@ OnNetworkCommissioningClusterScanNetworksResponse(void * context, uint8_t errorC ChipLogProgress(chipTool, "NetworkCommissioningClusterScanNetworksResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnNetworkCommissioningClusterUpdateThreadNetworkResponse(void * context, uint8_t errorCode, uint8_t * debugText) @@ -559,7 +559,7 @@ static void OnNetworkCommissioningClusterUpdateThreadNetworkResponse(void * cont ChipLogProgress(chipTool, "NetworkCommissioningClusterUpdateThreadNetworkResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnNetworkCommissioningClusterUpdateWiFiNetworkResponse(void * context, uint8_t errorCode, uint8_t * debugText) @@ -567,7 +567,7 @@ static void OnNetworkCommissioningClusterUpdateWiFiNetworkResponse(void * contex ChipLogProgress(chipTool, "NetworkCommissioningClusterUpdateWiFiNetworkResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnOtaSoftwareUpdateServerClusterApplyUpdateRequestResponse(void * context, uint8_t action, uint32_t delayedActionTime) @@ -575,7 +575,7 @@ static void OnOtaSoftwareUpdateServerClusterApplyUpdateRequestResponse(void * co ChipLogProgress(chipTool, "OtaSoftwareUpdateServerClusterApplyUpdateRequestResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnOtaSoftwareUpdateServerClusterQueryImageResponse(void * context, uint32_t delayedActionTime, uint8_t * imageURI, @@ -585,7 +585,7 @@ static void OnOtaSoftwareUpdateServerClusterQueryImageResponse(void * context, u ChipLogProgress(chipTool, "OtaSoftwareUpdateServerClusterQueryImageResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnOperationalCredentialsClusterOpCSRResponse(void * context, chip::ByteSpan CSR, chip::ByteSpan CSRNonce, @@ -595,7 +595,7 @@ static void OnOperationalCredentialsClusterOpCSRResponse(void * context, chip::B ChipLogProgress(chipTool, "OperationalCredentialsClusterOpCSRResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnOperationalCredentialsClusterOpCertResponse(void * context, uint8_t StatusCode, uint64_t FabricIndex, @@ -604,7 +604,7 @@ static void OnOperationalCredentialsClusterOpCertResponse(void * context, uint8_ ChipLogProgress(chipTool, "OperationalCredentialsClusterOpCertResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnOperationalCredentialsClusterSetFabricResponse(void * context, chip::FabricId FabricId) @@ -612,7 +612,7 @@ static void OnOperationalCredentialsClusterSetFabricResponse(void * context, chi ChipLogProgress(chipTool, "OperationalCredentialsClusterSetFabricResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnScenesClusterAddSceneResponse(void * context, uint16_t groupId, uint8_t sceneId) @@ -620,7 +620,7 @@ static void OnScenesClusterAddSceneResponse(void * context, uint16_t groupId, ui ChipLogProgress(chipTool, "ScenesClusterAddSceneResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnScenesClusterGetSceneMembershipResponse(void * context, uint8_t capacity, uint16_t groupId, uint8_t sceneCount, @@ -629,7 +629,7 @@ static void OnScenesClusterGetSceneMembershipResponse(void * context, uint8_t ca ChipLogProgress(chipTool, "ScenesClusterGetSceneMembershipResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnScenesClusterRemoveAllScenesResponse(void * context, uint16_t groupId) @@ -637,7 +637,7 @@ static void OnScenesClusterRemoveAllScenesResponse(void * context, uint16_t grou ChipLogProgress(chipTool, "ScenesClusterRemoveAllScenesResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnScenesClusterRemoveSceneResponse(void * context, uint16_t groupId, uint8_t sceneId) @@ -645,7 +645,7 @@ static void OnScenesClusterRemoveSceneResponse(void * context, uint16_t groupId, ChipLogProgress(chipTool, "ScenesClusterRemoveSceneResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnScenesClusterStoreSceneResponse(void * context, uint16_t groupId, uint8_t sceneId) @@ -653,7 +653,7 @@ static void OnScenesClusterStoreSceneResponse(void * context, uint16_t groupId, ChipLogProgress(chipTool, "ScenesClusterStoreSceneResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnScenesClusterViewSceneResponse(void * context, uint16_t groupId, uint8_t sceneId, uint16_t transitionTime, @@ -663,7 +663,7 @@ static void OnScenesClusterViewSceneResponse(void * context, uint16_t groupId, u ChipLogProgress(chipTool, "ScenesClusterViewSceneResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnTvChannelClusterChangeChannelResponse(void * context, @@ -673,7 +673,7 @@ static void OnTvChannelClusterChangeChannelResponse(void * context, ChipLogProgress(chipTool, "TvChannelClusterChangeChannelResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnTargetNavigatorClusterNavigateTargetResponse(void * context, uint8_t * data) @@ -681,7 +681,7 @@ static void OnTargetNavigatorClusterNavigateTargetResponse(void * context, uint8 ChipLogProgress(chipTool, "TargetNavigatorClusterNavigateTargetResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnTestClusterClusterTestSpecificResponse(void * context, uint8_t returnValue) @@ -689,7 +689,7 @@ static void OnTestClusterClusterTestSpecificResponse(void * context, uint8_t ret ChipLogProgress(chipTool, "TestClusterClusterTestSpecificResponse"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnApplicationLauncherApplicationLauncherListListAttributeResponse(void * context, uint16_t count, uint16_t * entries) @@ -702,7 +702,7 @@ static void OnApplicationLauncherApplicationLauncherListListAttributeResponse(vo } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnAudioOutputAudioOutputListListAttributeResponse(void * context, uint16_t count, _AudioOutputInfo * entries) @@ -718,7 +718,7 @@ static void OnAudioOutputAudioOutputListListAttributeResponse(void * context, ui } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnContentLauncherAcceptsHeaderListListAttributeResponse(void * context, uint16_t count, chip::ByteSpan * entries) @@ -731,7 +731,7 @@ static void OnContentLauncherAcceptsHeaderListListAttributeResponse(void * conte } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnContentLauncherSupportedStreamingTypesListAttributeResponse(void * context, uint16_t count, uint8_t * entries) @@ -744,7 +744,7 @@ static void OnContentLauncherSupportedStreamingTypesListAttributeResponse(void * } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDescriptorDeviceListListAttributeResponse(void * context, uint16_t count, _DeviceType * entries) @@ -759,7 +759,7 @@ static void OnDescriptorDeviceListListAttributeResponse(void * context, uint16_t } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDescriptorServerListListAttributeResponse(void * context, uint16_t count, chip::ClusterId * entries) @@ -772,7 +772,7 @@ static void OnDescriptorServerListListAttributeResponse(void * context, uint16_t } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDescriptorClientListListAttributeResponse(void * context, uint16_t count, chip::ClusterId * entries) @@ -785,7 +785,7 @@ static void OnDescriptorClientListListAttributeResponse(void * context, uint16_t } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDescriptorPartsListListAttributeResponse(void * context, uint16_t count, chip::EndpointId * entries) @@ -798,7 +798,7 @@ static void OnDescriptorPartsListListAttributeResponse(void * context, uint16_t } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnFixedLabelLabelListListAttributeResponse(void * context, uint16_t count, _LabelStruct * entries) @@ -813,7 +813,7 @@ static void OnFixedLabelLabelListListAttributeResponse(void * context, uint16_t } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnGeneralDiagnosticsNetworkInterfacesListAttributeResponse(void * context, uint16_t count, @@ -833,7 +833,7 @@ static void OnGeneralDiagnosticsNetworkInterfacesListAttributeResponse(void * co } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnGroupKeyManagementGroupsListAttributeResponse(void * context, uint16_t count, _GroupState * entries) @@ -849,7 +849,7 @@ static void OnGroupKeyManagementGroupsListAttributeResponse(void * context, uint } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnGroupKeyManagementGroupKeysListAttributeResponse(void * context, uint16_t count, _GroupKey * entries) @@ -867,7 +867,7 @@ static void OnGroupKeyManagementGroupKeysListAttributeResponse(void * context, u } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnMediaInputMediaInputListListAttributeResponse(void * context, uint16_t count, _MediaInputInfo * entries) @@ -884,7 +884,7 @@ static void OnMediaInputMediaInputListListAttributeResponse(void * context, uint } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnOperationalCredentialsFabricsListListAttributeResponse(void * context, uint16_t count, _FabricDescriptor * entries) @@ -901,7 +901,7 @@ static void OnOperationalCredentialsFabricsListListAttributeResponse(void * cont } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnTvChannelTvChannelListListAttributeResponse(void * context, uint16_t count, _TvChannelInfo * entries) @@ -919,7 +919,7 @@ static void OnTvChannelTvChannelListListAttributeResponse(void * context, uint16 } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnTargetNavigatorTargetNavigatorListListAttributeResponse(void * context, uint16_t count, @@ -935,7 +935,7 @@ static void OnTargetNavigatorTargetNavigatorListListAttributeResponse(void * con } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnTestClusterListInt8uListAttributeResponse(void * context, uint16_t count, uint8_t * entries) @@ -948,7 +948,7 @@ static void OnTestClusterListInt8uListAttributeResponse(void * context, uint16_t } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnTestClusterListOctetStringListAttributeResponse(void * context, uint16_t count, chip::ByteSpan * entries) @@ -961,7 +961,7 @@ static void OnTestClusterListOctetStringListAttributeResponse(void * context, ui } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnTestClusterListStructOctetStringListAttributeResponse(void * context, uint16_t count, _TestListStructOctet * entries) @@ -976,7 +976,7 @@ static void OnTestClusterListStructOctetStringListAttributeResponse(void * conte } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnThreadNetworkDiagnosticsNeighborTableListListAttributeResponse(void * context, uint16_t count, @@ -1004,7 +1004,7 @@ static void OnThreadNetworkDiagnosticsNeighborTableListListAttributeResponse(voi } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnThreadNetworkDiagnosticsRouteTableListListAttributeResponse(void * context, uint16_t count, _RouteTable * entries) @@ -1027,7 +1027,7 @@ static void OnThreadNetworkDiagnosticsRouteTableListListAttributeResponse(void * } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnThreadNetworkDiagnosticsSecurityPolicyListAttributeResponse(void * context, uint16_t count, _SecurityPolicy * entries) @@ -1042,7 +1042,7 @@ static void OnThreadNetworkDiagnosticsSecurityPolicyListAttributeResponse(void * } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnThreadNetworkDiagnosticsOperationalDatasetComponentsListAttributeResponse(void * context, uint16_t count, @@ -1069,7 +1069,7 @@ static void OnThreadNetworkDiagnosticsOperationalDatasetComponentsListAttributeR } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnThreadNetworkDiagnosticsActiveNetworkFaultsListListAttributeResponse(void * context, uint16_t count, @@ -1083,7 +1083,7 @@ static void OnThreadNetworkDiagnosticsActiveNetworkFaultsListListAttributeRespon } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } /*----------------------------------------------------------------------------*\ diff --git a/examples/chip-tool/commands/clusters/ModelCommand.cpp b/examples/chip-tool/commands/clusters/ModelCommand.cpp index f6ecc96811816d..0da04008b5ed57 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.cpp +++ b/examples/chip-tool/commands/clusters/ModelCommand.cpp @@ -23,10 +23,6 @@ using namespace ::chip; -namespace { -constexpr uint16_t kWaitDurationInSeconds = 10; -} // namespace - void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aCommandId, chip::EndpointId aEndPointId, chip::TLV::TLVReader & aReader, Command * apCommandObj) { @@ -37,29 +33,16 @@ void DispatchSingleClusterCommand(chip::ClusterId aClusterId, chip::CommandId aC "Default DispatchSingleClusterCommand is called, this should be replaced by actual dispatched for cluster commands"); } -CHIP_ERROR ModelCommand::Run(NodeId localId, NodeId remoteId) +CHIP_ERROR ModelCommand::Run() { CHIP_ERROR err = CHIP_NO_ERROR; - // - // Set this to true first BEFORE we send commands to ensure we don't - // end up in a situation where the response comes back faster than we can - // set the variable to true, which will cause it to block indefinitely. - // - UpdateWaitForResponse(true); - - { - chip::DeviceLayer::StackLock lock; - - err = GetExecContext()->commissioner->GetConnectedDevice(remoteId, &mOnDeviceConnectedCallback, - &mOnDeviceConnectionFailureCallback); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(chipTool, "Failed in initiating connection to the device: %" PRIu64 ", error %d", remoteId, err)); - } - - WaitForResponse(kWaitDurationInSeconds); + auto * ctx = GetExecContext(); - VerifyOrExit(GetCommandExitStatus(), err = CHIP_ERROR_INTERNAL); + err = ctx->commissioner->GetConnectedDevice(ctx->remoteId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback); + VerifyOrExit( + err == CHIP_NO_ERROR, + ChipLogError(chipTool, "Failed in initiating connection to the device: %" PRIu64 ", error %d", ctx->remoteId, err)); exit: return err; @@ -78,5 +61,5 @@ void ModelCommand::OnDeviceConnectionFailureFn(void * context, NodeId deviceId, ModelCommand * command = reinterpret_cast(context); ChipLogError(chipTool, "Failed in connecting to the device %" PRIu64 ". Error %d", deviceId, error); VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "ModelCommand context is null")); - command->SetCommandExitStatus(false); + command->SetCommandExitStatus(error); } diff --git a/examples/chip-tool/commands/clusters/ModelCommand.h b/examples/chip-tool/commands/clusters/ModelCommand.h index 3583a3fbe591e4..a44f359340f57a 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.h +++ b/examples/chip-tool/commands/clusters/ModelCommand.h @@ -39,7 +39,8 @@ class ModelCommand : public Command void AddArguments() { AddArgument("endpoint-id", CHIP_ZCL_ENDPOINT_MIN, CHIP_ZCL_ENDPOINT_MAX, &mEndPointId); } /////////// Command Interface ///////// - CHIP_ERROR Run(NodeId localId, NodeId remoteId) override; + CHIP_ERROR Run() override; + uint16_t GetWaitDurationInSeconds() const override { return 10; } virtual CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endPointId) = 0; diff --git a/examples/chip-tool/commands/common/Command.h b/examples/chip-tool/commands/common/Command.h index c08dcbbef3cd74..dc4bf9d3c5e8fa 100644 --- a/examples/chip-tool/commands/common/Command.h +++ b/examples/chip-tool/commands/common/Command.h @@ -101,6 +101,8 @@ class Command ChipDeviceCommissioner * commissioner; chip::Controller::ExampleOperationalCredentialsIssuer * opCredsIssuer; PersistentStorage * storage; + chip::NodeId localId; + chip::NodeId remoteId; }; Command(const char * commandName) : mName(commandName) {} @@ -162,10 +164,23 @@ class Command return AddArgument(name, min, max, reinterpret_cast(out), Number_uint64); } - virtual CHIP_ERROR Run(NodeId localId, NodeId remoteId) = 0; + // Will be called in a setting in which it's safe to touch the CHIP + // stack. The rules for Run() are as follows: + // + // 1) If error is returned, Run() must not call SetCommandExitStatus. + // 2) If success is returned Run() must either have called + // SetCommandExitStatus() or scheduled async work that will do that. + virtual CHIP_ERROR Run() = 0; - bool GetCommandExitStatus() const { return mCommandExitStatus; } - void SetCommandExitStatus(bool status) + // Get the wait duration, in seconds, before the command times out. + virtual uint16_t GetWaitDurationInSeconds() const = 0; + + // Shut down the command, in case any work needs to be done after the event + // loop has been stopped. + virtual void Shutdown() {} + + CHIP_ERROR GetCommandExitStatus() const { return mCommandExitStatus; } + void SetCommandExitStatus(CHIP_ERROR status) { mCommandExitStatus = status; UpdateWaitForResponse(false); @@ -183,8 +198,8 @@ class Command size_t AddArgument(const char * name, int64_t min, uint64_t max, void * out, ArgumentType type); size_t AddArgument(const char * name, int64_t min, uint64_t max, void * out); - bool mCommandExitStatus = false; - const char * mName = nullptr; + CHIP_ERROR mCommandExitStatus = CHIP_ERROR_INTERNAL; + const char * mName = nullptr; std::vector mArgs; std::condition_variable cvWaitingForResponse; diff --git a/examples/chip-tool/commands/common/Commands.cpp b/examples/chip-tool/commands/common/Commands.cpp index e53b854ecbb8a6..27ebd2400f3c23 100644 --- a/examples/chip-tool/commands/common/Commands.cpp +++ b/examples/chip-tool/commands/common/Commands.cpp @@ -42,6 +42,7 @@ int Commands::Run(NodeId localId, NodeId remoteId, int argc, char ** argv) { CHIP_ERROR err = CHIP_NO_ERROR; chip::Controller::CommissionerInitParams initParams; + Command * command = nullptr; err = chip::Platform::MemoryInit(); VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(Controller, "Init Memory failure: %s", chip::ErrorStr(err))); @@ -72,7 +73,7 @@ int Commands::Run(NodeId localId, NodeId remoteId, int argc, char ** argv) err = mController.ServiceEvents(); VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(Controller, "Init failure! Run Loop: %s", chip::ErrorStr(err))); - err = RunCommand(localId, remoteId, argc, argv); + err = RunCommand(localId, remoteId, argc, argv, &command); SuccessOrExit(err); exit: @@ -80,6 +81,11 @@ int Commands::Run(NodeId localId, NodeId remoteId, int argc, char ** argv) chip::DeviceLayer::PlatformMgr().StopEventLoopTask(); #endif + if (command) + { + command->Shutdown(); + } + // // We can call DeviceController::Shutdown() safely without grabbing the stack lock // since the CHIP thread and event queue have been stopped, preventing any thread @@ -90,7 +96,7 @@ int Commands::Run(NodeId localId, NodeId remoteId, int argc, char ** argv) return (err == CHIP_NO_ERROR) ? EXIT_SUCCESS : EXIT_FAILURE; } -CHIP_ERROR Commands::RunCommand(NodeId localId, NodeId remoteId, int argc, char ** argv) +CHIP_ERROR Commands::RunCommand(NodeId localId, NodeId remoteId, int argc, char ** argv, Command ** ranCommand) { CHIP_ERROR err = CHIP_NO_ERROR; std::map::iterator cluster; @@ -158,10 +164,21 @@ CHIP_ERROR Commands::RunCommand(NodeId localId, NodeId remoteId, int argc, char execContext.commissioner = &mController; execContext.opCredsIssuer = &mOpCredsIssuer; execContext.storage = &mStorage; + execContext.localId = localId; + execContext.remoteId = remoteId; command->SetExecutionContext(execContext); - - err = command->Run(localId, remoteId); + *ranCommand = command; + + // + // Set this to true first BEFORE we send commands to ensure we don't end + // up in a situation where the response comes back faster than we can + // set the variable to true, which will cause it to block indefinitely. + // + command->UpdateWaitForResponse(true); + chip::DeviceLayer::PlatformMgr().ScheduleWork(RunQueuedCommand, reinterpret_cast(command)); + command->WaitForResponse(command->GetWaitDurationInSeconds()); + err = command->GetCommandExitStatus(); if (err != CHIP_NO_ERROR) { ChipLogError(chipTool, "Run command failure: %s", chip::ErrorStr(err)); @@ -173,6 +190,16 @@ CHIP_ERROR Commands::RunCommand(NodeId localId, NodeId remoteId, int argc, char return err; } +void Commands::RunQueuedCommand(intptr_t commandArg) +{ + auto * command = reinterpret_cast(commandArg); + CHIP_ERROR err = command->Run(); + if (err != CHIP_NO_ERROR) + { + command->SetCommandExitStatus(err); + } +} + std::map::iterator Commands::GetCluster(std::string clusterName) { for (auto & cluster : mClusters) diff --git a/examples/chip-tool/commands/common/Commands.h b/examples/chip-tool/commands/common/Commands.h index 10f1a77891cee0..1e6d41582478ce 100644 --- a/examples/chip-tool/commands/common/Commands.h +++ b/examples/chip-tool/commands/common/Commands.h @@ -33,7 +33,11 @@ class Commands int Run(NodeId localId, NodeId remoteId, int argc, char ** argv); private: - CHIP_ERROR RunCommand(NodeId localId, NodeId remoteId, int argc, char ** argv); + // *ranCommand will be set to the command we ran if we get as far as running + // it. If it's not null, we need to call Shutdown() on the command after we + // shut down the event loop. + CHIP_ERROR RunCommand(NodeId localId, NodeId remoteId, int argc, char ** argv, Command ** ranCommand); + static void RunQueuedCommand(intptr_t commandArg); std::map::iterator GetCluster(std::string clusterName); Command * GetCommand(CommandsVector & commands, std::string commandName); Command * GetGlobalCommand(CommandsVector & commands, std::string commandName, std::string attributeName); diff --git a/examples/chip-tool/commands/discover/Commands.h b/examples/chip-tool/commands/discover/Commands.h index ed743f96a1c8b2..e83bc40d87322a 100644 --- a/examples/chip-tool/commands/discover/Commands.h +++ b/examples/chip-tool/commands/discover/Commands.h @@ -47,13 +47,13 @@ class Resolve : public DiscoverCommand, public chip::Mdns::ResolverDelegate nodeData.mAddress.ToString(addrBuffer); ChipLogProgress(chipTool, "NodeId Resolution: %" PRIu64 " Address: %s, Port: %" PRIu16, nodeData.mPeerId.GetNodeId(), addrBuffer, nodeData.mPort); - SetCommandExitStatus(true); + SetCommandExitStatus(CHIP_NO_ERROR); } void OnNodeIdResolutionFailed(const chip::PeerId & peerId, CHIP_ERROR error) override { ChipLogProgress(chipTool, "NodeId Resolution: failed!"); - SetCommandExitStatus(false); + SetCommandExitStatus(CHIP_ERROR_INTERNAL); } void OnNodeDiscoveryComplete(const chip::Mdns::DiscoveredNodeData & nodeData) override {} }; @@ -82,7 +82,7 @@ class Update : public DiscoverCommand ChipLogError(chipTool, "Failed to update the device address: %s", chip::ErrorStr(error)); } - SetCommandExitStatus(CHIP_NO_ERROR == error); + SetCommandExitStatus(error); } }; diff --git a/examples/chip-tool/commands/discover/DiscoverCommand.cpp b/examples/chip-tool/commands/discover/DiscoverCommand.cpp index e1b05acc14edb7..fc3f6449a14a7c 100644 --- a/examples/chip-tool/commands/discover/DiscoverCommand.cpp +++ b/examples/chip-tool/commands/discover/DiscoverCommand.cpp @@ -18,35 +18,8 @@ #include "DiscoverCommand.h" -constexpr uint16_t kWaitDurationInSeconds = 30; - -CHIP_ERROR DiscoverCommand::Run(NodeId localId, NodeId remoteId) +CHIP_ERROR DiscoverCommand::Run() { - CHIP_ERROR err; - - // - // Set this to true first BEFORE we send commands to ensure we don't - // end up in a situation where the response comes back faster than we can - // set the variable to true, which will cause it to block indefinitely. - // - UpdateWaitForResponse(true); - - { - chip::DeviceLayer::StackLock lock; - - GetExecContext()->commissioner->RegisterDeviceAddressUpdateDelegate(this); - err = RunCommand(mNodeId, mFabricId); - SuccessOrExit(err); - } - - WaitForResponse(kWaitDurationInSeconds); - -exit: - if (err != CHIP_NO_ERROR) - { - return err; - } - - VerifyOrReturnError(GetCommandExitStatus(), CHIP_ERROR_INTERNAL); - return CHIP_NO_ERROR; + GetExecContext()->commissioner->RegisterDeviceAddressUpdateDelegate(this); + return RunCommand(mNodeId, mFabricId); } diff --git a/examples/chip-tool/commands/discover/DiscoverCommand.h b/examples/chip-tool/commands/discover/DiscoverCommand.h index 801e43b82bb15b..f580fb2fb4cf84 100644 --- a/examples/chip-tool/commands/discover/DiscoverCommand.h +++ b/examples/chip-tool/commands/discover/DiscoverCommand.h @@ -35,7 +35,8 @@ class DiscoverCommand : public Command, public chip::Controller::DeviceAddressUp void OnAddressUpdateComplete(NodeId nodeId, CHIP_ERROR error) override{}; /////////// Command Interface ///////// - CHIP_ERROR Run(NodeId localId, NodeId remoteId) override; + CHIP_ERROR Run() override; + uint16_t GetWaitDurationInSeconds() const override { return 30; } virtual CHIP_ERROR RunCommand(NodeId remoteId, uint64_t fabricId) = 0; diff --git a/examples/chip-tool/commands/discover/DiscoverCommissionersCommand.cpp b/examples/chip-tool/commands/discover/DiscoverCommissionersCommand.cpp index f6789bd0733bdf..625a8de23a298a 100644 --- a/examples/chip-tool/commands/discover/DiscoverCommissionersCommand.cpp +++ b/examples/chip-tool/commands/discover/DiscoverCommissionersCommand.cpp @@ -21,25 +21,13 @@ using namespace ::chip; -constexpr uint16_t kWaitDurationInSeconds = 3; - -CHIP_ERROR DiscoverCommissionersCommand::Run(NodeId localId, NodeId remoteId) +CHIP_ERROR DiscoverCommissionersCommand::Run() { - // - // Set this to true first BEFORE we send commands to ensure we don't - // end up in a situation where the response comes back faster than we can - // set the variable to true, which will cause it to block indefinitely. - // - UpdateWaitForResponse(true); - - { - chip::DeviceLayer::StackLock lock; - - ReturnErrorOnFailure(mCommissionableNodeController.DiscoverCommissioners()); - } - - WaitForResponse(kWaitDurationInSeconds); + return mCommissionableNodeController.DiscoverCommissioners(); +} +void DiscoverCommissionersCommand::Shutdown() +{ int commissionerCount = 0; for (int i = 0; i < CHIP_DEVICE_CONFIG_MAX_DISCOVERED_NODES; i++) { @@ -86,6 +74,5 @@ CHIP_ERROR DiscoverCommissionersCommand::Run(NodeId localId, NodeId remoteId) } } - printf("Total of %d commissioner(s) discovered in %d sec\n", commissionerCount, kWaitDurationInSeconds); - return CHIP_NO_ERROR; + printf("Total of %d commissioner(s) discovered in %" PRIu16 " sec\n", commissionerCount, GetWaitDurationInSeconds()); } diff --git a/examples/chip-tool/commands/discover/DiscoverCommissionersCommand.h b/examples/chip-tool/commands/discover/DiscoverCommissionersCommand.h index e62d206a87c1b9..e59b1b98829075 100644 --- a/examples/chip-tool/commands/discover/DiscoverCommissionersCommand.h +++ b/examples/chip-tool/commands/discover/DiscoverCommissionersCommand.h @@ -25,7 +25,9 @@ class DiscoverCommissionersCommand : public Command { public: DiscoverCommissionersCommand() : Command("discover-commissioners") {} - CHIP_ERROR Run(NodeId localId, NodeId remoteId) override; + CHIP_ERROR Run() override; + uint16_t GetWaitDurationInSeconds() const override { return 3; } + void Shutdown() override; private: chip::Controller::CommissionableNodeController mCommissionableNodeController; diff --git a/examples/chip-tool/commands/pairing/PairingCommand.cpp b/examples/chip-tool/commands/pairing/PairingCommand.cpp index cc2c6640337422..51c6080fc678c5 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.cpp +++ b/examples/chip-tool/commands/pairing/PairingCommand.cpp @@ -22,32 +22,21 @@ using namespace ::chip; -constexpr uint16_t kWaitDurationInSeconds = 120; constexpr uint64_t kBreadcrumb = 0; constexpr uint32_t kTimeoutMs = 6000; constexpr uint8_t kTemporaryThreadNetworkId[] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }; -CHIP_ERROR PairingCommand::Run(NodeId localId, NodeId remoteId) +CHIP_ERROR PairingCommand::Run() { CHIP_ERROR err = CHIP_NO_ERROR; - { - chip::DeviceLayer::StackLock lock; - - GetExecContext()->commissioner->RegisterDeviceAddressUpdateDelegate(this); - GetExecContext()->commissioner->RegisterPairingDelegate(this); - } + GetExecContext()->commissioner->RegisterDeviceAddressUpdateDelegate(this); + GetExecContext()->commissioner->RegisterPairingDelegate(this); - err = RunInternal(remoteId); + err = RunInternal(GetExecContext()->remoteId); VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(chipTool, "Init Failure! PairDevice: %s", ErrorStr(err))); exit: - - if (err == CHIP_NO_ERROR) - { - VerifyOrReturnError(GetCommandExitStatus(), CHIP_ERROR_INTERNAL); - } - return err; } @@ -59,45 +48,26 @@ CHIP_ERROR PairingCommand::RunInternal(NodeId remoteId) InitCallbacks(); - // - // Set this to true first BEFORE we send commands to ensure we don't - // end up in a situation where the response comes back faster than we can - // set the variable to true, which will cause it to block indefinitely. - // - UpdateWaitForResponse(true); - - // - // We're about to call methods into the stack, so lock - // appropriately. None of the following calls below before the unlock are, nor should be, - // blocking. - // + switch (mPairingMode) { - chip::DeviceLayer::StackLock lock; - - switch (mPairingMode) - { - case PairingMode::None: - err = Unpair(remoteId); - break; - case PairingMode::Bypass: - err = PairWithoutSecurity(remoteId, PeerAddress::UDP(mRemoteAddr.address, mRemotePort)); - break; - case PairingMode::Ble: - err = Pair(remoteId, PeerAddress::BLE()); - break; - case PairingMode::OnNetwork: - case PairingMode::SoftAP: - err = Pair(remoteId, PeerAddress::UDP(mRemoteAddr.address, mRemotePort)); - break; - case PairingMode::Ethernet: - err = Pair(remoteId, PeerAddress::UDP(mRemoteAddr.address, mRemotePort)); - break; - } + case PairingMode::None: + err = Unpair(remoteId); + break; + case PairingMode::Bypass: + err = PairWithoutSecurity(remoteId, PeerAddress::UDP(mRemoteAddr.address, mRemotePort)); + break; + case PairingMode::Ble: + err = Pair(remoteId, PeerAddress::BLE()); + break; + case PairingMode::OnNetwork: + case PairingMode::SoftAP: + err = Pair(remoteId, PeerAddress::UDP(mRemoteAddr.address, mRemotePort)); + break; + case PairingMode::Ethernet: + err = Pair(remoteId, PeerAddress::UDP(mRemoteAddr.address, mRemotePort)); + break; } - WaitForResponse(kWaitDurationInSeconds); - ReleaseCallbacks(); - return err; } @@ -117,8 +87,9 @@ CHIP_ERROR PairingCommand::PairWithoutSecurity(NodeId remoteId, PeerAddress addr CHIP_ERROR PairingCommand::Unpair(NodeId remoteId) { - SetCommandExitStatus(true); - return GetExecContext()->commissioner->UnpairDevice(remoteId); + CHIP_ERROR err = GetExecContext()->commissioner->UnpairDevice(remoteId); + SetCommandExitStatus(err); + return err; } void PairingCommand::OnStatusUpdate(DevicePairingDelegate::Status status) @@ -144,7 +115,7 @@ void PairingCommand::OnPairingComplete(CHIP_ERROR err) else { ChipLogProgress(chipTool, "Pairing Failure: %s", ErrorStr(err)); - SetCommandExitStatus(false); + SetCommandExitStatus(err); } } @@ -159,7 +130,7 @@ void PairingCommand::OnPairingDeleted(CHIP_ERROR err) ChipLogProgress(chipTool, "Pairing Deleted Failure: %s", ErrorStr(err)); } - SetCommandExitStatus(err == CHIP_NO_ERROR); + SetCommandExitStatus(err); } void PairingCommand::OnCommissioningComplete(NodeId nodeId, CHIP_ERROR err) @@ -173,7 +144,7 @@ void PairingCommand::OnCommissioningComplete(NodeId nodeId, CHIP_ERROR err) ChipLogProgress(chipTool, "Device commissioning Failure: %s", ErrorStr(err)); } - SetCommandExitStatus(err == CHIP_NO_ERROR); + SetCommandExitStatus(err); } CHIP_ERROR PairingCommand::SetupNetwork() @@ -186,7 +157,7 @@ CHIP_ERROR PairingCommand::SetupNetwork() case PairingNetworkType::None: case PairingNetworkType::Ethernet: // Nothing to do - SetCommandExitStatus(err == CHIP_NO_ERROR); + SetCommandExitStatus(err); break; case PairingNetworkType::WiFi: case PairingNetworkType::Thread: @@ -216,7 +187,7 @@ void PairingCommand::InitCallbacks() mOnFailureCallback = new Callback::Callback(OnDefaultFailureResponse, this); } -void PairingCommand::ReleaseCallbacks() +void PairingCommand::Shutdown() { delete mOnAddThreadNetworkCallback; delete mOnAddWiFiNetworkCallback; @@ -268,7 +239,7 @@ void PairingCommand::OnDefaultFailureResponse(void * context, uint8_t status) ChipLogProgress(chipTool, "Default Failure Response: 0x%02x", status); PairingCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(false); + command->SetCommandExitStatus(CHIP_ERROR_INTERNAL); } void PairingCommand::OnAddNetworkResponse(void * context, uint8_t errorCode, uint8_t * debugText) @@ -282,7 +253,7 @@ void PairingCommand::OnAddNetworkResponse(void * context, uint8_t errorCode, uin // if (EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_SUCCESS != errorCode) // { // ChipLogError(chipTool, "Setup failure. Error calling EnableNetwork: %d", errorCode); - // command->SetCommandExitStatus(false); + // command->SetCommandExitStatus(CHIP_ERROR_INTERNAL); // return; // } @@ -290,7 +261,7 @@ void PairingCommand::OnAddNetworkResponse(void * context, uint8_t errorCode, uin if (CHIP_NO_ERROR != err) { ChipLogError(chipTool, "Setup failure. Internal error calling EnableNetwork: %s", ErrorStr(err)); - command->SetCommandExitStatus(false); + command->SetCommandExitStatus(err); return; } @@ -300,7 +271,7 @@ void PairingCommand::OnAddNetworkResponse(void * context, uint8_t errorCode, uin // and the device address will be updated once a command is issued. if (command->mPairingMode == PairingMode::SoftAP && command->mNetworkType == PairingNetworkType::WiFi) { - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } } @@ -315,7 +286,7 @@ void PairingCommand::OnEnableNetworkResponse(void * context, uint8_t errorCode, // if (EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_SUCCESS != errorCode) // { // ChipLogError(chipTool, "Setup failure. Error calling EnableNetwork: %d", errorCode); - // command->SetCommandExitStatus(false); + // command->SetCommandExitStatus(CHIP_ERROR_INTERNAL); // return; // } @@ -323,7 +294,7 @@ void PairingCommand::OnEnableNetworkResponse(void * context, uint8_t errorCode, if (CHIP_NO_ERROR != err) { ChipLogError(chipTool, "Setup failure. Internal error calling UpdateNetworkAddress: %s", ErrorStr(err)); - command->SetCommandExitStatus(false); + command->SetCommandExitStatus(err); return; } } @@ -341,6 +312,6 @@ void PairingCommand::OnAddressUpdateComplete(NodeId nodeId, CHIP_ERROR err) { // Set exit status only if the address update failed. // Otherwise wait for OnCommissioningComplete() callback. - SetCommandExitStatus(false); + SetCommandExitStatus(err); } } diff --git a/examples/chip-tool/commands/pairing/PairingCommand.h b/examples/chip-tool/commands/pairing/PairingCommand.h index abb33af9d0c4e0..092fbfd806b4de 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.h +++ b/examples/chip-tool/commands/pairing/PairingCommand.h @@ -97,7 +97,9 @@ class PairingCommand : public Command, } /////////// Command Interface ///////// - CHIP_ERROR Run(NodeId localId, NodeId remoteId) override; + CHIP_ERROR Run() override; + uint16_t GetWaitDurationInSeconds() const override { return 120; } + void Shutdown() override; /////////// DevicePairingDelegate Interface ///////// void OnStatusUpdate(chip::Controller::DevicePairingDelegate::Status status) override; @@ -120,7 +122,6 @@ class PairingCommand : public Command, CHIP_ERROR Unpair(NodeId remoteId); void InitCallbacks(); - void ReleaseCallbacks(); CHIP_ERROR SetupNetwork(); CHIP_ERROR AddNetwork(PairingNetworkType networkType); CHIP_ERROR AddThreadNetwork(); @@ -140,10 +141,10 @@ class PairingCommand : public Command, chip::ByteSpan mSSID; chip::ByteSpan mPassword; - chip::Callback::Callback * mOnAddThreadNetworkCallback; - chip::Callback::Callback * mOnAddWiFiNetworkCallback; - chip::Callback::Callback * mOnEnableNetworkCallback; - chip::Callback::Callback * mOnFailureCallback; + chip::Callback::Callback * mOnAddThreadNetworkCallback = nullptr; + chip::Callback::Callback * mOnAddWiFiNetworkCallback = nullptr; + chip::Callback::Callback * mOnEnableNetworkCallback = nullptr; + chip::Callback::Callback * mOnFailureCallback = nullptr; ChipDevice * mDevice; chip::Controller::NetworkCommissioningCluster mCluster; chip::EndpointId mEndpointId = 0; diff --git a/examples/chip-tool/commands/payload/AdditionalDataParseCommand.cpp b/examples/chip-tool/commands/payload/AdditionalDataParseCommand.cpp index 4855350b6b6d1a..16054f6dbf2eef 100644 --- a/examples/chip-tool/commands/payload/AdditionalDataParseCommand.cpp +++ b/examples/chip-tool/commands/payload/AdditionalDataParseCommand.cpp @@ -24,7 +24,7 @@ using namespace ::chip; using namespace ::chip::SetupPayloadData; -CHIP_ERROR AdditionalDataParseCommand::Run(NodeId localId, NodeId remoteId) +CHIP_ERROR AdditionalDataParseCommand::Run() { std::vector payloadData; AdditionalDataPayload resultPayload; @@ -47,5 +47,9 @@ CHIP_ERROR AdditionalDataParseCommand::Run(NodeId localId, NodeId remoteId) ChipLogProgress(chipTool, "AdditionalDataParseCommand, RotatingDeviceId=%s", resultPayload.rotatingDeviceId.c_str()); exit: + if (err == CHIP_NO_ERROR) + { + SetCommandExitStatus(CHIP_NO_ERROR); + } return err; } diff --git a/examples/chip-tool/commands/payload/AdditionalDataParseCommand.h b/examples/chip-tool/commands/payload/AdditionalDataParseCommand.h index d3b38586ccee4d..aeaa9b2b39e06a 100644 --- a/examples/chip-tool/commands/payload/AdditionalDataParseCommand.h +++ b/examples/chip-tool/commands/payload/AdditionalDataParseCommand.h @@ -24,7 +24,8 @@ class AdditionalDataParseCommand : public Command { public: AdditionalDataParseCommand() : Command("parse-additional-data-payload") { AddArgument("payload", &mPayload); } - CHIP_ERROR Run(NodeId localId, NodeId remoteId) override; + CHIP_ERROR Run() override; + uint16_t GetWaitDurationInSeconds() const override { return 5; } private: char * mPayload; diff --git a/examples/chip-tool/commands/payload/SetupPayloadParseCommand.cpp b/examples/chip-tool/commands/payload/SetupPayloadParseCommand.cpp index 2f6f4e8c8ef9bd..41d745b07515e2 100644 --- a/examples/chip-tool/commands/payload/SetupPayloadParseCommand.cpp +++ b/examples/chip-tool/commands/payload/SetupPayloadParseCommand.cpp @@ -23,7 +23,7 @@ using namespace ::chip; -CHIP_ERROR SetupPayloadParseCommand::Run(NodeId localId, NodeId remoteId) +CHIP_ERROR SetupPayloadParseCommand::Run() { std::string codeString(mCode); SetupPayload payload; @@ -35,6 +35,10 @@ CHIP_ERROR SetupPayloadParseCommand::Run(NodeId localId, NodeId remoteId) err = Print(payload); SuccessOrExit(err); exit: + if (err == CHIP_NO_ERROR) + { + SetCommandExitStatus(CHIP_NO_ERROR); + } return err; } diff --git a/examples/chip-tool/commands/payload/SetupPayloadParseCommand.h b/examples/chip-tool/commands/payload/SetupPayloadParseCommand.h index cf7af18e65e75a..620151f6d06409 100644 --- a/examples/chip-tool/commands/payload/SetupPayloadParseCommand.h +++ b/examples/chip-tool/commands/payload/SetupPayloadParseCommand.h @@ -25,7 +25,8 @@ class SetupPayloadParseCommand : public Command { public: SetupPayloadParseCommand() : Command("parse-setup-payload") { AddArgument("payload", &mCode); } - CHIP_ERROR Run(NodeId localId, NodeId remoteId) override; + CHIP_ERROR Run() override; + uint16_t GetWaitDurationInSeconds() const override { return 5; } private: char * mCode; diff --git a/examples/chip-tool/commands/reporting/ReportingCommand.cpp b/examples/chip-tool/commands/reporting/ReportingCommand.cpp index 263d10730c2db1..4e7fb3f148f487 100644 --- a/examples/chip-tool/commands/reporting/ReportingCommand.cpp +++ b/examples/chip-tool/commands/reporting/ReportingCommand.cpp @@ -24,36 +24,20 @@ using namespace ::chip; -namespace { -constexpr uint16_t kWaitDurationInSeconds = UINT16_MAX; -} // namespace - -CHIP_ERROR ReportingCommand::Run(NodeId localId, NodeId remoteId) +CHIP_ERROR ReportingCommand::Run() { CHIP_ERROR err = CHIP_NO_ERROR; chip::Controller::BasicCluster cluster; - // - // Set this to true first BEFORE we send commands to ensure we don't - // end up in a situation where the response comes back faster than we can - // set the variable to true, which will cause it to block indefinitely. - // - UpdateWaitForResponse(true); - - { - chip::DeviceLayer::StackLock lock; - - err = GetExecContext()->commissioner->GetDevice(remoteId, &mDevice); - VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(chipTool, "Init failure! No pairing for device: %" PRIu64, localId)); - - AddReportCallbacks(mEndPointId); - cluster.Associate(mDevice, mEndPointId); + auto * ctx = GetExecContext(); + err = ctx->commissioner->GetDevice(ctx->remoteId, &mDevice); + VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(chipTool, "Init failure! No pairing for device: %" PRIu64, ctx->localId)); - err = cluster.MfgSpecificPing(nullptr, nullptr); - VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(Controller, "Init failure! Ping failure: %s", ErrorStr(err))); - } + AddReportCallbacks(mEndPointId); + cluster.Associate(mDevice, mEndPointId); - WaitForResponse(kWaitDurationInSeconds); + err = cluster.MfgSpecificPing(nullptr, nullptr); + VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(Controller, "Init failure! Ping failure: %s", ErrorStr(err))); exit: return err; diff --git a/examples/chip-tool/commands/reporting/ReportingCommand.h b/examples/chip-tool/commands/reporting/ReportingCommand.h index 59fd902b823fd3..0f2bbfc0c6038b 100644 --- a/examples/chip-tool/commands/reporting/ReportingCommand.h +++ b/examples/chip-tool/commands/reporting/ReportingCommand.h @@ -36,7 +36,8 @@ class ReportingCommand : public Command } /////////// Command Interface ///////// - CHIP_ERROR Run(NodeId localId, NodeId remoteId) override; + CHIP_ERROR Run() override; + uint16_t GetWaitDurationInSeconds() const override { return UINT16_MAX; } virtual void AddReportCallbacks(uint8_t endPointId) = 0; diff --git a/examples/chip-tool/commands/tests/Commands.h b/examples/chip-tool/commands/tests/Commands.h index 5fe89ab3b700d0..e8392844f19383 100644 --- a/examples/chip-tool/commands/tests/Commands.h +++ b/examples/chip-tool/commands/tests/Commands.h @@ -27,14 +27,14 @@ class TestCluster : public TestCommand TestCluster() : TestCommand("TestCluster"), mTestIndex(0) {} /////////// TestCommand Interface ///////// - CHIP_ERROR NextTest() override + void NextTest() override { CHIP_ERROR err = CHIP_NO_ERROR; if (mTestCount == mTestIndex) { ChipLogProgress(chipTool, "TestCluster: Test complete"); - SetCommandExitStatus(true); + SetCommandExitStatus(CHIP_NO_ERROR); } // Ensure we increment mTestIndex before we start running the relevant @@ -351,10 +351,8 @@ class TestCluster : public TestCommand if (CHIP_NO_ERROR != err) { ChipLogProgress(chipTool, "TestCluster: %s", chip::ErrorStr(err)); - SetCommandExitStatus(false); + SetCommandExitStatus(err); } - - return err; } private: @@ -408,7 +406,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_0 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -427,7 +425,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_0 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -477,7 +475,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_1 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -496,7 +494,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_1 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -546,7 +544,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_2 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -565,14 +563,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_2 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (returnValue != 7) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "7"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -622,7 +620,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_3 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -641,14 +639,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_3 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (boolean != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -699,7 +697,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_4 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -718,7 +716,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_4 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -768,7 +766,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_5 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -787,14 +785,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_5 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (boolean != 1) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "1"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -845,7 +843,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_6 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -864,7 +862,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_6 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -914,7 +912,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_7 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -933,14 +931,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_7 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (boolean != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -990,7 +988,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_8 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1009,14 +1007,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_8 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (bitmap8 != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1067,7 +1065,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_9 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1086,7 +1084,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_9 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1136,7 +1134,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_10 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1155,14 +1153,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_10 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (bitmap8 != 255) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "255"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1213,7 +1211,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_11 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1232,7 +1230,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_11 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1282,7 +1280,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_12 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1301,14 +1299,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_12 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (bitmap8 != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1358,7 +1356,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_13 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1377,14 +1375,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_13 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (bitmap16 != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1435,7 +1433,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_14 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1454,7 +1452,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_14 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1504,7 +1502,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_15 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1523,14 +1521,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_15 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (bitmap16 != 65535U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "65535"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1581,7 +1579,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_16 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1600,7 +1598,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_16 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1650,7 +1648,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_17 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1669,14 +1667,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_17 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (bitmap16 != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1726,7 +1724,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_18 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1745,14 +1743,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_18 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (bitmap32 != 0UL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1803,7 +1801,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_19 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1822,7 +1820,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_19 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1872,7 +1870,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_20 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1891,14 +1889,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_20 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (bitmap32 != 4294967295UL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "4294967295"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1949,7 +1947,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_21 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -1968,7 +1966,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_21 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2018,7 +2016,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_22 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2037,14 +2035,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_22 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (bitmap32 != 0UL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2094,7 +2092,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_23 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2113,14 +2111,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_23 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (bitmap64 != 0ULL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2171,7 +2169,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_24 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2190,7 +2188,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_24 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2240,7 +2238,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_25 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2259,14 +2257,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_25 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (bitmap64 != 18446744073709551615ULL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "18446744073709551615"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2317,7 +2315,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_26 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2336,7 +2334,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_26 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2386,7 +2384,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_27 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2405,14 +2403,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_27 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (bitmap64 != 0ULL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2462,7 +2460,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_28 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2481,14 +2479,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_28 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int8u != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2539,7 +2537,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_29 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2558,7 +2556,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_29 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2608,7 +2606,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_30 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2627,14 +2625,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_30 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int8u != 255) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "255"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2685,7 +2683,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_31 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2704,7 +2702,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_31 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2754,7 +2752,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_32 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2773,14 +2771,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_32 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int8u != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2830,7 +2828,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_33 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2849,14 +2847,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_33 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int16u != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2907,7 +2905,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_34 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2926,7 +2924,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_34 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2976,7 +2974,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_35 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -2995,14 +2993,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_35 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int16u != 65535U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "65535"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3053,7 +3051,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_36 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3072,7 +3070,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_36 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3122,7 +3120,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_37 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3141,14 +3139,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_37 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int16u != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3198,7 +3196,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_38 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3217,14 +3215,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_38 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int32u != 0UL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3275,7 +3273,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_39 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3294,7 +3292,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_39 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3344,7 +3342,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_40 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3363,14 +3361,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_40 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int32u != 4294967295UL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "4294967295"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3421,7 +3419,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_41 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3440,7 +3438,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_41 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3490,7 +3488,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_42 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3509,14 +3507,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_42 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int32u != 0UL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3566,7 +3564,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_43 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3585,14 +3583,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_43 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int64u != 0ULL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3643,7 +3641,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_44 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3662,7 +3660,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_44 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3712,7 +3710,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_45 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3731,14 +3729,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_45 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int64u != 18446744073709551615ULL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "18446744073709551615"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3789,7 +3787,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_46 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3808,7 +3806,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_46 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3858,7 +3856,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_47 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3877,14 +3875,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_47 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int64u != 0ULL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3934,7 +3932,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_48 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -3953,14 +3951,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_48 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int8s != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4011,7 +4009,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_49 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4030,7 +4028,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_49 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4080,7 +4078,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_50 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4099,14 +4097,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_50 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int8s != 127) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "127"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4157,7 +4155,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_51 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4176,7 +4174,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_51 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4226,7 +4224,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_52 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4245,14 +4243,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_52 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int8s != -128) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "-128"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4303,7 +4301,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_53 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4322,7 +4320,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_53 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4372,7 +4370,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_54 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4391,14 +4389,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_54 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int8s != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4448,7 +4446,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_55 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4467,14 +4465,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_55 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int16s != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4525,7 +4523,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_56 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4544,7 +4542,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_56 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4594,7 +4592,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_57 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4613,14 +4611,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_57 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int16s != 32767) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "32767"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4671,7 +4669,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_58 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4690,7 +4688,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_58 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4740,7 +4738,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_59 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4759,14 +4757,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_59 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int16s != -32768) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "-32768"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4817,7 +4815,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_60 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4836,7 +4834,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_60 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4886,7 +4884,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_61 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4905,14 +4903,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_61 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int16s != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4962,7 +4960,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_62 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -4981,14 +4979,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_62 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int32s != 0L) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5039,7 +5037,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_63 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5058,7 +5056,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_63 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5108,7 +5106,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_64 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5127,14 +5125,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_64 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int32s != 2147483647L) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "2147483647"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5185,7 +5183,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_65 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5204,7 +5202,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_65 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5254,7 +5252,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_66 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5273,14 +5271,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_66 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int32s != -2147483648L) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "-2147483648"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5331,7 +5329,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_67 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5350,7 +5348,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_67 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5400,7 +5398,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_68 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5419,14 +5417,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_68 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int32s != 0L) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5476,7 +5474,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_69 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5495,14 +5493,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_69 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int64s != 0LL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5553,7 +5551,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_70 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5572,7 +5570,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_70 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5622,7 +5620,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_71 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5641,14 +5639,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_71 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int64s != 9223372036854775807LL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "9223372036854775807"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5699,7 +5697,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_72 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5718,7 +5716,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_72 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5768,7 +5766,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_73 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5787,14 +5785,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_73 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int64s != -9223372036854775807LL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "-9223372036854775807"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5845,7 +5843,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_74 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5864,7 +5862,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_74 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5914,7 +5912,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_75 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5933,14 +5931,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_75 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (int64s != 0LL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -5990,7 +5988,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_76 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6009,14 +6007,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_76 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (enum8 != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6067,7 +6065,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_77 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6086,7 +6084,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_77 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6136,7 +6134,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_78 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6155,14 +6153,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_78 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (enum8 != 255) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "255"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6213,7 +6211,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_79 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6232,7 +6230,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_79 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6282,7 +6280,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_80 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6301,14 +6299,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_80 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (enum8 != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6358,7 +6356,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_81 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6377,14 +6375,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_81 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (enum16 != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6435,7 +6433,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_82 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6454,7 +6452,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_82 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6504,7 +6502,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_83 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6523,14 +6521,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_83 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (enum16 != 65535U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "65535"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6581,7 +6579,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_84 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6600,7 +6598,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_84 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6650,7 +6648,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_85 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6669,14 +6667,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_85 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (enum16 != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6726,7 +6724,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_86 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6745,7 +6743,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_86 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6753,7 +6751,7 @@ class TestCluster : public TestCommand if (!octetString.data_equal(octetStringArgument)) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", ""); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6805,7 +6803,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_87 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6824,7 +6822,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_87 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6874,7 +6872,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_88 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6893,7 +6891,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_88 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6901,7 +6899,7 @@ class TestCluster : public TestCommand if (!octetString.data_equal(octetStringArgument)) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "TestValue"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6954,7 +6952,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_89 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -6973,7 +6971,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_89 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7023,7 +7021,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_90 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7042,7 +7040,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_90 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7050,7 +7048,7 @@ class TestCluster : public TestCommand if (!octetString.data_equal(octetStringArgument)) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "TestValue"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7102,7 +7100,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_91 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7121,7 +7119,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_91 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7171,7 +7169,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_92 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7190,7 +7188,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_92 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7198,7 +7196,7 @@ class TestCluster : public TestCommand if (!longOctetString.data_equal(longOctetStringArgument)) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", ""); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7257,7 +7255,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_93 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7276,7 +7274,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_93 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7326,7 +7324,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_94 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7345,7 +7343,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_94 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7363,7 +7361,7 @@ class TestCluster : public TestCommand "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7415,7 +7413,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_95 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7434,7 +7432,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_95 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7484,7 +7482,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_96 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7504,14 +7502,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_96 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (count != 4) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "1,2,3,4"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7561,7 +7559,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_97 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7581,14 +7579,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_97 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (count != 4) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "Test0,Test1,Test2,Test3"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7638,7 +7636,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_98 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7658,7 +7656,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_98 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7666,7 +7664,7 @@ class TestCluster : public TestCommand { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "[object Object],[object Object],[object Object],[object Object]"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7716,7 +7714,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_99 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7735,14 +7733,14 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_99 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (unsupported != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7794,7 +7792,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_100 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7813,7 +7811,7 @@ class TestCluster : public TestCommand if (runner->mIsFailureExpected_100 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7827,14 +7825,14 @@ class Test_3_1_1 : public TestCommand Test_3_1_1() : TestCommand("Test_3_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// - CHIP_ERROR NextTest() override + void NextTest() override { CHIP_ERROR err = CHIP_NO_ERROR; if (mTestCount == mTestIndex) { ChipLogProgress(chipTool, "Test_3_1_1: Test complete"); - SetCommandExitStatus(true); + SetCommandExitStatus(CHIP_NO_ERROR); } // Ensure we increment mTestIndex before we start running the relevant @@ -7860,10 +7858,8 @@ class Test_3_1_1 : public TestCommand if (CHIP_NO_ERROR != err) { ChipLogProgress(chipTool, "Test_3_1_1: %s", chip::ErrorStr(err)); - SetCommandExitStatus(false); + SetCommandExitStatus(err); } - - return err; } private: @@ -7917,7 +7913,7 @@ class Test_3_1_1 : public TestCommand if (runner->mIsFailureExpected_0 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7936,14 +7932,14 @@ class Test_3_1_1 : public TestCommand if (runner->mIsFailureExpected_0 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (clusterRevision != 2U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "2"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -7993,7 +7989,7 @@ class Test_3_1_1 : public TestCommand if (runner->mIsFailureExpected_1 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8012,14 +8008,14 @@ class Test_3_1_1 : public TestCommand if (runner->mIsFailureExpected_1 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (clusterRevision != 2U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "2"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8069,7 +8065,7 @@ class Test_3_1_1 : public TestCommand if (runner->mIsFailureExpected_2 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8088,14 +8084,14 @@ class Test_3_1_1 : public TestCommand if (runner->mIsFailureExpected_2 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (featureMap != 0UL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8145,7 +8141,7 @@ class Test_3_1_1 : public TestCommand if (runner->mIsFailureExpected_3 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8164,14 +8160,14 @@ class Test_3_1_1 : public TestCommand if (runner->mIsFailureExpected_3 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (featureMap != 0UL) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8185,14 +8181,14 @@ class Test_3_2_1 : public TestCommand Test_3_2_1() : TestCommand("Test_3_2_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// - CHIP_ERROR NextTest() override + void NextTest() override { CHIP_ERROR err = CHIP_NO_ERROR; if (mTestCount == mTestIndex) { ChipLogProgress(chipTool, "Test_3_2_1: Test complete"); - SetCommandExitStatus(true); + SetCommandExitStatus(CHIP_NO_ERROR); } // Ensure we increment mTestIndex before we start running the relevant @@ -8242,10 +8238,8 @@ class Test_3_2_1 : public TestCommand if (CHIP_NO_ERROR != err) { ChipLogProgress(chipTool, "Test_3_2_1: %s", chip::ErrorStr(err)); - SetCommandExitStatus(false); + SetCommandExitStatus(err); } - - return err; } private: @@ -8299,7 +8293,7 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_0 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8318,14 +8312,14 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_0 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (onOff != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8375,7 +8369,7 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_1 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8394,14 +8388,14 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_1 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (onOff != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8451,7 +8445,7 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_2 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8470,14 +8464,14 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_2 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (globalSceneControl != 1) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "1"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8527,7 +8521,7 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_3 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8546,14 +8540,14 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_3 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (onTime != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8603,7 +8597,7 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_4 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8622,14 +8616,14 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_4 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (offWaitTime != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8679,7 +8673,7 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_5 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8698,14 +8692,14 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_5 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (startUpOnOff != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8756,7 +8750,7 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_6 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8775,7 +8769,7 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_6 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8827,7 +8821,7 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_7 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8846,7 +8840,7 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_7 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8898,7 +8892,7 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_8 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8917,7 +8911,7 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_8 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8967,7 +8961,7 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_9 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -8986,14 +8980,14 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_9 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (onTime != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9043,7 +9037,7 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_10 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9062,14 +9056,14 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_10 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (offWaitTime != 0U) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9119,7 +9113,7 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_11 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9138,14 +9132,14 @@ class Test_3_2_1 : public TestCommand if (runner->mIsFailureExpected_11 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (startUpOnOff != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9159,14 +9153,14 @@ class Test_3_2_2 : public TestCommand Test_3_2_2() : TestCommand("Test_3_2_2"), mTestIndex(0) {} /////////// TestCommand Interface ///////// - CHIP_ERROR NextTest() override + void NextTest() override { CHIP_ERROR err = CHIP_NO_ERROR; if (mTestCount == mTestIndex) { ChipLogProgress(chipTool, "Test_3_2_2: Test complete"); - SetCommandExitStatus(true); + SetCommandExitStatus(CHIP_NO_ERROR); } // Ensure we increment mTestIndex before we start running the relevant @@ -9222,10 +9216,8 @@ class Test_3_2_2 : public TestCommand if (CHIP_NO_ERROR != err) { ChipLogProgress(chipTool, "Test_3_2_2: %s", chip::ErrorStr(err)); - SetCommandExitStatus(false); + SetCommandExitStatus(err); } - - return err; } private: @@ -9279,7 +9271,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_0 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9298,7 +9290,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_0 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9348,7 +9340,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_1 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9367,14 +9359,14 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_1 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (onOff != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9424,7 +9416,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_2 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9443,7 +9435,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_2 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9493,7 +9485,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_3 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9512,14 +9504,14 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_3 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (onOff != 1) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "1"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9569,7 +9561,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_4 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9588,7 +9580,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_4 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9638,7 +9630,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_5 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9657,14 +9649,14 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_5 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (onOff != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9714,7 +9706,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_6 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9733,7 +9725,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_6 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9783,7 +9775,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_7 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9802,14 +9794,14 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_7 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (onOff != 1) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "1"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9859,7 +9851,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_8 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9878,7 +9870,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_8 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9928,7 +9920,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_9 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -9947,14 +9939,14 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_9 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (onOff != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -10004,7 +9996,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_10 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -10023,7 +10015,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_10 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -10073,7 +10065,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_11 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -10092,14 +10084,14 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_11 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (onOff != 1) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "1"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -10149,7 +10141,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_12 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -10168,7 +10160,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_12 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -10218,7 +10210,7 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_13 == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -10237,14 +10229,14 @@ class Test_3_2_2 : public TestCommand if (runner->mIsFailureExpected_13 == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } if (onOff != 0) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } diff --git a/examples/chip-tool/commands/tests/TestCommand.cpp b/examples/chip-tool/commands/tests/TestCommand.cpp index ca7854eeb732d3..2f3347c6e9c15e 100644 --- a/examples/chip-tool/commands/tests/TestCommand.cpp +++ b/examples/chip-tool/commands/tests/TestCommand.cpp @@ -18,31 +18,15 @@ #include "TestCommand.h" -constexpr uint16_t kWaitDurationInSeconds = 30; - -CHIP_ERROR TestCommand::Run(NodeId localId, NodeId remoteId) +CHIP_ERROR TestCommand::Run() { CHIP_ERROR err = CHIP_NO_ERROR; - // - // Set this to true first BEFORE we send commands to ensure we don't - // end up in a situation where the response comes back faster than we can - // set the variable to true, which will cause it to block indefinitely. - // - UpdateWaitForResponse(true); - - { - chip::DeviceLayer::StackLock lock; - - err = GetExecContext()->commissioner->GetDevice(remoteId, &mDevice); - ReturnErrorOnFailure(err); - - err = NextTest(); - ReturnErrorOnFailure(err); - } + auto * ctx = GetExecContext(); - WaitForResponse(kWaitDurationInSeconds); + err = ctx->commissioner->GetDevice(ctx->remoteId, &mDevice); + ReturnErrorOnFailure(err); - VerifyOrReturnError(GetCommandExitStatus(), CHIP_ERROR_INTERNAL); + NextTest(); return CHIP_NO_ERROR; } diff --git a/examples/chip-tool/commands/tests/TestCommand.h b/examples/chip-tool/commands/tests/TestCommand.h index 16ae7c0f7583aa..88bd0dc9a185f1 100644 --- a/examples/chip-tool/commands/tests/TestCommand.h +++ b/examples/chip-tool/commands/tests/TestCommand.h @@ -27,9 +27,10 @@ class TestCommand : public Command TestCommand(const char * commandName) : Command(commandName) {} /////////// Command Interface ///////// - CHIP_ERROR Run(NodeId localId, NodeId remoteId) override; + CHIP_ERROR Run() override; + uint16_t GetWaitDurationInSeconds() const override { return 30; } - virtual CHIP_ERROR NextTest() = 0; + virtual void NextTest() = 0; protected: ChipDevice * mDevice; diff --git a/examples/chip-tool/templates/commands.zapt b/examples/chip-tool/templates/commands.zapt index 664e3f6cc28b4d..b7660551bcdd7a 100644 --- a/examples/chip-tool/templates/commands.zapt +++ b/examples/chip-tool/templates/commands.zapt @@ -14,7 +14,7 @@ static void OnDefaultSuccessResponse(void * context) ChipLogProgress(chipTool, "Default Success Response"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnDefaultFailureResponse(void * context, uint8_t status) @@ -22,7 +22,7 @@ static void OnDefaultFailureResponse(void * context, uint8_t status) ChipLogProgress(chipTool, "Default Failure Response: 0x%02x", status); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(false); + command->SetCommandExitStatus(CHIP_ERROR_INTERNAL); } static void OnBooleanAttributeResponse(void * context, bool value) @@ -30,7 +30,7 @@ static void OnBooleanAttributeResponse(void * context, bool value) ChipLogProgress(chipTool, "Boolean attribute Response: %d", value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnInt8uAttributeResponse(void * context, uint8_t value) @@ -38,7 +38,7 @@ static void OnInt8uAttributeResponse(void * context, uint8_t value) ChipLogProgress(chipTool, "Int8u attribute Response: %" PRIu8, value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnInt16uAttributeResponse(void * context, uint16_t value) @@ -46,7 +46,7 @@ static void OnInt16uAttributeResponse(void * context, uint16_t value) ChipLogProgress(chipTool, "Int16u attribute Response: %" PRIu16, value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnInt32uAttributeResponse(void * context, uint32_t value) @@ -54,7 +54,7 @@ static void OnInt32uAttributeResponse(void * context, uint32_t value) ChipLogProgress(chipTool, "Int32u attribute Response: %" PRIu32, value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnInt64uAttributeResponse(void * context, uint64_t value) @@ -62,7 +62,7 @@ static void OnInt64uAttributeResponse(void * context, uint64_t value) ChipLogProgress(chipTool, "Int64u attribute Response: %" PRIu64, value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnInt8sAttributeResponse(void * context, int8_t value) @@ -70,7 +70,7 @@ static void OnInt8sAttributeResponse(void * context, int8_t value) ChipLogProgress(chipTool, "Int8s attribute Response: %" PRId8, value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnInt16sAttributeResponse(void * context, int16_t value) @@ -78,7 +78,7 @@ static void OnInt16sAttributeResponse(void * context, int16_t value) ChipLogProgress(chipTool, "Int16s attribute Response: %" PRId16, value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnInt32sAttributeResponse(void * context, int32_t value) @@ -86,7 +86,7 @@ static void OnInt32sAttributeResponse(void * context, int32_t value) ChipLogProgress(chipTool, "Int32s attribute Response: %" PRId32, value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnInt64sAttributeResponse(void * context, int64_t value) @@ -94,7 +94,7 @@ static void OnInt64sAttributeResponse(void * context, int64_t value) ChipLogProgress(chipTool, "Int64s attribute Response: %" PRId64, value); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } static void OnStringAttributeResponse(void * context, const chip::ByteSpan value) @@ -102,7 +102,7 @@ static void OnStringAttributeResponse(void * context, const chip::ByteSpan value ChipLogProgress(chipTool, "String attribute Response: %zu", value.size()); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } {{#chip_client_clusters}} @@ -116,7 +116,7 @@ static void On{{asCamelCased parent.name false}}Cluster{{asCamelCased name false ChipLogProgress(chipTool, "{{asCamelCased parent.name false}}Cluster{{asCamelCased name false}}"); ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } {{/if}} @@ -159,7 +159,7 @@ static void On{{asCamelCased parent.name false}}{{asCamelCased name false}}ListA } ModelCommand * command = reinterpret_cast(context); - command->SetCommandExitStatus(true); + command->SetCommandExitStatus(CHIP_NO_ERROR); } {{/if}} diff --git a/examples/chip-tool/templates/partials/test_cluster.zapt b/examples/chip-tool/templates/partials/test_cluster.zapt index 6eedda1d50bf1b..b0b8b5861bec37 100644 --- a/examples/chip-tool/templates/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/partials/test_cluster.zapt @@ -5,14 +5,14 @@ class {{filename}}: public TestCommand {{filename}}(): TestCommand("{{filename}}"), mTestIndex(0) {} /////////// TestCommand Interface ///////// - CHIP_ERROR NextTest() override + void NextTest() override { CHIP_ERROR err = CHIP_NO_ERROR; if (mTestCount == mTestIndex) { ChipLogProgress(chipTool, "{{filename}}: Test complete"); - SetCommandExitStatus(true); + SetCommandExitStatus(CHIP_NO_ERROR); } // Ensure we increment mTestIndex before we start running the relevant @@ -31,10 +31,8 @@ class {{filename}}: public TestCommand if (CHIP_NO_ERROR != err) { ChipLogProgress(chipTool, "{{filename}}: %s", chip::ErrorStr(err)); - SetCommandExitStatus(false); + SetCommandExitStatus(err); } - - return err; } @@ -109,7 +107,7 @@ class {{filename}}: public TestCommand if (runner->mIsFailureExpected_{{index}} == false) { ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -128,7 +126,7 @@ class {{filename}}: public TestCommand if (runner->mIsFailureExpected_{{index}} == true) { ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } @@ -138,7 +136,7 @@ class {{filename}}: public TestCommand if (count != {{expectedValue.length}}) { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "{{expectedValue}}"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } {{else}} @@ -150,7 +148,7 @@ class {{filename}}: public TestCommand {{/if}} { ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "{{expectedValue}}"); - runner->SetCommandExitStatus(false); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); return; } {{/if}}