diff --git a/examples/lighting-app/qpg/args.gni b/examples/lighting-app/qpg/args.gni index e19f57f7d483d6..ea22dfd187fbb2 100644 --- a/examples/lighting-app/qpg/args.gni +++ b/examples/lighting-app/qpg/args.gni @@ -29,8 +29,6 @@ chip_stack_lock_tracking = "none" matter_device_vid = "0xFFF1" matter_device_pid = "0x8005" -matter_device_software_version = "0x0001" -matter_device_software_version_string = "1.0" pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" diff --git a/examples/lighting-app/qpg/src/AppTask.cpp b/examples/lighting-app/qpg/src/AppTask.cpp index c4fe7ff0c06e91..5781e4069ad1eb 100644 --- a/examples/lighting-app/qpg/src/AppTask.cpp +++ b/examples/lighting-app/qpg/src/AppTask.cpp @@ -257,15 +257,23 @@ void AppTask::InitServer(intptr_t arg) // Open commissioning after boot if no fabric was available if (chip::Server::GetInstance().GetFabricTable().FabricCount() == 0) { - PlatformMgr().ScheduleWork(OpenCommissioning, 0); + ChipLogProgress(NotSpecified, "No fabrics, starting commissioning."); + AppTask::OpenCommissioning((intptr_t) 0); } } void AppTask::OpenCommissioning(intptr_t arg) { // Enable BLE advertisements - chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow(); - ChipLogProgress(NotSpecified, "BLE advertising started. Waiting for Pairing."); + + SystemLayer().ScheduleLambda([] { + CHIP_ERROR err; + err = chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow(); + if (err == CHIP_NO_ERROR) + { + ChipLogProgress(NotSpecified, "BLE advertising started. Waiting for Pairing."); + } + }); } CHIP_ERROR AppTask::Init() @@ -486,10 +494,8 @@ void AppTask::FunctionHandler(AppEvent * aEvent) else { // Enable BLE advertisements and pairing window - if (chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR) - { - ChipLogProgress(NotSpecified, "BLE advertising started. Waiting for Pairing."); - } + AppTask::OpenCommissioning((intptr_t) 0); + ChipLogProgress(NotSpecified, "BLE advertising started. Waiting for Pairing."); } } else if (sAppTask.mFunctionTimerActive && sAppTask.mFunction == kFunction_SoftwareUpdate) diff --git a/examples/lighting-app/qpg/zap/light.matter b/examples/lighting-app/qpg/zap/light.matter index d0f37c17c22356..61efe83c64c161 100644 --- a/examples/lighting-app/qpg/zap/light.matter +++ b/examples/lighting-app/qpg/zap/light.matter @@ -206,9 +206,6 @@ server cluster LevelControl = 8 { readonly attribute int16u remainingTime = 1; readonly attribute int8u minLevel = 2; readonly attribute int8u maxLevel = 3; - readonly attribute int16u currentFrequency = 4; - readonly attribute int16u minFrequency = 5; - readonly attribute int16u maxFrequency = 6; attribute LevelControlOptions options = 15; attribute nullable int8u onLevel = 17; attribute access(write: manage) nullable int8u startUpCurrentLevel = 16384; @@ -957,7 +954,6 @@ server cluster GeneralDiagnostics = 51 { readonly attribute NetworkInterface networkInterfaces[] = 0; readonly attribute int16u rebootCount = 1; readonly attribute int64u upTime = 2; - readonly attribute int32u totalOperationalHours = 3; readonly attribute BootReasonEnum bootReason = 4; readonly attribute HardwareFaultEnum activeHardwareFaults[] = 5; readonly attribute RadioFaultEnum activeRadioFaults[] = 6; @@ -1873,7 +1869,6 @@ endpoint 0 { callback attribute networkInterfaces; callback attribute rebootCount default = 0x0000; callback attribute upTime default = 0x0000000000000000; - callback attribute totalOperationalHours default = 0x00000000; callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; @@ -2115,9 +2110,6 @@ endpoint 1 { ram attribute remainingTime default = 0x0000; ram attribute minLevel default = 0x01; ram attribute maxLevel default = 0xFE; - ram attribute currentFrequency default = 0x0000; - ram attribute minFrequency default = 0x0000; - ram attribute maxFrequency default = 0x0000; ram attribute options default = 0x00; ram attribute onLevel default = 0xFF; persist attribute startUpCurrentLevel default = 255; @@ -2149,24 +2141,6 @@ endpoint 1 { callback attribute clusterRevision default = 1; } - server cluster FixedLabel { - callback attribute labelList; - callback attribute generatedCommandList; - callback attribute acceptedCommandList; - callback attribute attributeList; - ram attribute featureMap default = 0; - ram attribute clusterRevision default = 1; - } - - server cluster UserLabel { - callback attribute labelList; - callback attribute generatedCommandList; - callback attribute acceptedCommandList; - callback attribute attributeList; - ram attribute featureMap default = 0; - ram attribute clusterRevision default = 1; - } - server cluster ColorControl { ram attribute currentHue default = 0x00; ram attribute currentSaturation default = 0x00; diff --git a/examples/lighting-app/qpg/zap/light.zap b/examples/lighting-app/qpg/zap/light.zap index af746454e6158a..897774c9d8167a 100644 --- a/examples/lighting-app/qpg/zap/light.zap +++ b/examples/lighting-app/qpg/zap/light.zap @@ -1782,22 +1782,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "TotalOperationalHours", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "int32u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00000000", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "BootReason", "code": 4, @@ -4793,54 +4777,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "CurrentFrequency", - "code": 4, - "mfgCode": null, - "side": "server", - "type": "int16u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "MinFrequency", - "code": 5, - "mfgCode": null, - "side": "server", - "type": "int16u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "MaxFrequency", - "code": 6, - "mfgCode": null, - "side": "server", - "type": "int16u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x0000", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "Options", "code": 15, @@ -5125,218 +5061,6 @@ } ] }, - { - "name": "Fixed Label", - "code": 64, - "mfgCode": null, - "define": "FIXED_LABEL_CLUSTER", - "side": "server", - "enabled": 1, - "attributes": [ - { - "name": "LabelList", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "GeneratedCommandList", - "code": 65528, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "AcceptedCommandList", - "code": 65529, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "AttributeList", - "code": 65531, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "FeatureMap", - "code": 65532, - "mfgCode": null, - "side": "server", - "type": "bitmap32", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "ClusterRevision", - "code": 65533, - "mfgCode": null, - "side": "server", - "type": "int16u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "1", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - } - ] - }, - { - "name": "User Label", - "code": 65, - "mfgCode": null, - "define": "USER_LABEL_CLUSTER", - "side": "server", - "enabled": 1, - "attributes": [ - { - "name": "LabelList", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "GeneratedCommandList", - "code": 65528, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "AcceptedCommandList", - "code": 65529, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "AttributeList", - "code": 65531, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "FeatureMap", - "code": 65532, - "mfgCode": null, - "side": "server", - "type": "bitmap32", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "ClusterRevision", - "code": 65533, - "mfgCode": null, - "side": "server", - "type": "int16u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "1", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - } - ] - }, { "name": "Color Control", "code": 768, diff --git a/examples/lock-app/qpg/args.gni b/examples/lock-app/qpg/args.gni index 9a51da863c921f..d5dcdfe217c635 100644 --- a/examples/lock-app/qpg/args.gni +++ b/examples/lock-app/qpg/args.gni @@ -22,6 +22,7 @@ qpg_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_ota_requestor = true chip_openthread_ftd = false enable_sleepy_device = true +chip_enable_icd_server = true # Disable lock tracking, since our FreeRTOS configuration does not set # INCLUDE_xSemaphoreGetMutexHolder @@ -29,8 +30,6 @@ chip_stack_lock_tracking = "none" matter_device_vid = "0xFFF1" matter_device_pid = "0x8006" -matter_device_software_version = "0x0001" -matter_device_software_version_string = "1.0" pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip" pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" diff --git a/examples/lock-app/qpg/include/AppConfig.h b/examples/lock-app/qpg/include/AppConfig.h index 2f2cb7cd385cf3..b5947d8641bad6 100644 --- a/examples/lock-app/qpg/include/AppConfig.h +++ b/examples/lock-app/qpg/include/AppConfig.h @@ -23,6 +23,7 @@ #define APP_TASK_NAME "APP" #define APP_LOCK_BUTTON BTN_SW4 #define APP_FUNCTION_BUTTON BTN_SW5 +#define APP_LOCK_JAMMED_BUTTON BTN_SW1 #define SYSTEM_STATE_LED LED_GREEN #define LOCK_STATE_LED LED_WHITE diff --git a/examples/lock-app/qpg/include/AppTask.h b/examples/lock-app/qpg/include/AppTask.h index 3219c5676036f9..3734eeadeef816 100644 --- a/examples/lock-app/qpg/include/AppTask.h +++ b/examples/lock-app/qpg/include/AppTask.h @@ -66,6 +66,7 @@ class AppTask static void FunctionTimerEventHandler(AppEvent * aEvent); static void FunctionHandler(AppEvent * aEvent); static void LockActionEventHandler(AppEvent * aEvent); + static void JammedLockEventHandler(AppEvent * aEvent); static void TimerEventHandler(chip::System::Layer * aLayer, void * aAppState); static void MatterEventHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg); @@ -86,6 +87,7 @@ class AppTask Function_t mFunction; bool mFunctionTimerActive; bool mSyncClusterToButtonAction; + bool mNotifyState; chip::DeviceLayer::FactoryDataProvider mFactoryDataProvider; diff --git a/examples/lock-app/qpg/include/BoltLockManager.h b/examples/lock-app/qpg/include/BoltLockManager.h index c80e3555fc8d3d..0afef972db93b4 100644 --- a/examples/lock-app/qpg/include/BoltLockManager.h +++ b/examples/lock-app/qpg/include/BoltLockManager.h @@ -65,8 +65,6 @@ class BoltLockManager CHIP_ERROR Init(); bool IsUnlocked(); - void EnableAutoRelock(bool aOn); - void SetAutoLockDuration(uint32_t aDurationInSecs); bool IsActionInProgress(); bool InitiateAction(int32_t aActor, Action_t aAction); @@ -92,15 +90,10 @@ class BoltLockManager Callback_fn_initiated mActionInitiated_CB; Callback_fn_completed mActionCompleted_CB; - bool mAutoRelock; - uint32_t mAutoLockDuration; - bool mAutoLockTimerArmed; - void CancelTimer(void); void StartTimer(uint32_t aTimeoutMs); static void TimerEventHandler(TimerHandle_t xTimer); - static void AutoReLockTimerEventHandler(AppEvent * aEvent); static void ActuatorMovementTimerEventHandler(AppEvent * aEvent); static BoltLockManager sLock; diff --git a/examples/lock-app/qpg/src/AppTask.cpp b/examples/lock-app/qpg/src/AppTask.cpp index 3466d8c4a4c395..8bbd6b7ce19a8a 100644 --- a/examples/lock-app/qpg/src/AppTask.cpp +++ b/examples/lock-app/qpg/src/AppTask.cpp @@ -260,6 +260,23 @@ void AppTask::AppTaskMain(void * pvParameter) } } +void AppTask::JammedLockEventHandler(AppEvent * aEvent) +{ + SystemLayer().ScheduleLambda([] { + bool retVal; + + retVal = DoorLockServer::Instance().SendLockAlarmEvent(QPG_LOCK_ENDPOINT_ID, AlarmCodeEnum::kLockJammed); + if (!retVal) + { + ChipLogProgress(NotSpecified, "[BTN] Lock jammed event send failed"); + } + else + { + ChipLogProgress(NotSpecified, "[BTN] Lock jammed event sent"); + } + }); +} + void AppTask::LockActionEventHandler(AppEvent * aEvent) { bool initiated = false; @@ -302,7 +319,7 @@ void AppTask::LockActionEventHandler(AppEvent * aEvent) void AppTask::ButtonEventHandler(uint8_t btnIdx, bool btnPressed) { - if (btnIdx != APP_LOCK_BUTTON && btnIdx != APP_FUNCTION_BUTTON) + if (btnIdx != APP_LOCK_BUTTON && btnIdx != APP_FUNCTION_BUTTON && btnIdx != APP_LOCK_JAMMED_BUTTON) { return; } @@ -316,6 +333,10 @@ void AppTask::ButtonEventHandler(uint8_t btnIdx, bool btnPressed) { button_event.Handler = LockActionEventHandler; } + else if (btnIdx == APP_LOCK_JAMMED_BUTTON && btnPressed == true) + { + button_event.Handler = JammedLockEventHandler; + } else if (btnIdx == APP_FUNCTION_BUTTON) { // Hand off to Functionality handler - depends on duration of press @@ -511,6 +532,11 @@ void AppTask::ActionInitiated(BoltLockManager::Action_t aAction, int32_t aActor) sAppTask.mSyncClusterToButtonAction = true; } + if (aActor == AppEvent::kEventType_Lock) + { + sAppTask.mNotifyState = true; + } + qvIO_LedBlink(LOCK_STATE_LED, 50, 50); } @@ -532,10 +558,11 @@ void AppTask::ActionCompleted(BoltLockManager::Action_t aAction) qvIO_LedSet(LOCK_STATE_LED, false); } - if (sAppTask.mSyncClusterToButtonAction) + if (sAppTask.mSyncClusterToButtonAction || sAppTask.mNotifyState) { sAppTask.UpdateClusterState(); sAppTask.mSyncClusterToButtonAction = false; + sAppTask.mNotifyState = false; } } @@ -585,6 +612,7 @@ void AppTask::UpdateClusterState(void) auto newValue = BoltLockMgr().IsUnlocked() ? DoorLock::DlLockState::kUnlocked : DoorLock::DlLockState::kLocked; SystemLayer().ScheduleLambda([newValue] { + bool retVal = true; chip::app::DataModel::Nullable currentLockState; chip::app::Clusters::DoorLock::Attributes::LockState::Get(QPG_LOCK_ENDPOINT_ID, currentLockState); @@ -599,7 +627,17 @@ void AppTask::UpdateClusterState(void) else { ChipLogProgress(NotSpecified, "Updating LockState attribute"); - if (!DoorLockServer::Instance().SetLockState(QPG_LOCK_ENDPOINT_ID, newValue)) + if (sAppTask.mSyncClusterToButtonAction) + { + retVal = DoorLockServer::Instance().SetLockState(QPG_LOCK_ENDPOINT_ID, newValue, OperationSourceEnum::kManual); + } + + if (retVal && sAppTask.mNotifyState) + { + retVal = DoorLockServer::Instance().SetLockState(QPG_LOCK_ENDPOINT_ID, newValue, OperationSourceEnum::kRemote); + } + + if (!retVal) { ChipLogError(NotSpecified, "ERR: updating DoorLock"); } diff --git a/examples/lock-app/qpg/src/BoltLockManager.cpp b/examples/lock-app/qpg/src/BoltLockManager.cpp index 44bb81abaebdc8..e06c34535238c7 100644 --- a/examples/lock-app/qpg/src/BoltLockManager.cpp +++ b/examples/lock-app/qpg/src/BoltLockManager.cpp @@ -58,10 +58,7 @@ CHIP_ERROR BoltLockManager::Init() return APP_ERROR_CREATE_TIMER_FAILED; } - mState = kState_LockingCompleted; - mAutoLockTimerArmed = false; - mAutoRelock = false; - mAutoLockDuration = 0; + mState = kState_LockingCompleted; return CHIP_NO_ERROR; } @@ -82,16 +79,6 @@ bool BoltLockManager::IsUnlocked() return (mState == kState_UnlockingCompleted); } -void BoltLockManager::EnableAutoRelock(bool aOn) -{ - mAutoRelock = aOn; -} - -void BoltLockManager::SetAutoLockDuration(uint32_t aDurationInSecs) -{ - mAutoLockDuration = aDurationInSecs; -} - bool BoltLockManager::GetUser(uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user) const { user = mUsers[userIndex - 1]; @@ -224,15 +211,6 @@ bool BoltLockManager::InitiateAction(int32_t aActor, Action_t aAction) if (action_initiated) { - if (mAutoLockTimerArmed && new_state == kState_LockingInitiated) - { - // If auto lock timer has been armed and someone initiates locking, - // cancel the timer and continue as normal. - mAutoLockTimerArmed = false; - - CancelTimer(); - } - StartTimer(ACTUATOR_MOVEMENT_PERIOS_MS); // Since the timer started successfully, update the state and trigger callback @@ -285,35 +263,10 @@ void BoltLockManager::TimerEventHandler(TimerHandle_t xTimer) AppEvent event; event.Type = AppEvent::kEventType_Timer; event.TimerEvent.Context = lock; - if (lock->mAutoLockTimerArmed) - { - event.Handler = AutoReLockTimerEventHandler; - } - else - { - event.Handler = ActuatorMovementTimerEventHandler; - } + event.Handler = ActuatorMovementTimerEventHandler; GetAppTask().PostEvent(&event); } -void BoltLockManager::AutoReLockTimerEventHandler(AppEvent * aEvent) -{ - BoltLockManager * lock = static_cast(aEvent->TimerEvent.Context); - int32_t actor = 0; - - // Make sure auto lock timer is still armed. - if (!lock->mAutoLockTimerArmed) - { - return; - } - - lock->mAutoLockTimerArmed = false; - - ChipLogProgress(NotSpecified, "Auto Re-Lock has been triggered!"); - - lock->InitiateAction(actor, LOCK_ACTION); -} - void BoltLockManager::ActuatorMovementTimerEventHandler(AppEvent * aEvent) { Action_t actionCompleted = INVALID_ACTION; @@ -337,16 +290,5 @@ void BoltLockManager::ActuatorMovementTimerEventHandler(AppEvent * aEvent) { lock->mActionCompleted_CB(actionCompleted); } - - if (lock->mAutoRelock && actionCompleted == UNLOCK_ACTION) - { - // Start the timer for auto relock - lock->StartTimer(lock->mAutoLockDuration * 1000); - - lock->mAutoLockTimerArmed = true; - - ChipLogProgress(NotSpecified, "Auto Re-lock enabled. Will be triggered in %" PRIu32 " seconds", - lock->mAutoLockDuration); - } } } diff --git a/examples/lock-app/qpg/src/ZclCallbacks.cpp b/examples/lock-app/qpg/src/ZclCallbacks.cpp index 25a06b533c5cad..51751c43ed4058 100644 --- a/examples/lock-app/qpg/src/ZclCallbacks.cpp +++ b/examples/lock-app/qpg/src/ZclCallbacks.cpp @@ -40,10 +40,10 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & switch (*value) { case to_underlying(DlLockState::kLocked): - BoltLockMgr().InitiateAction(0, BoltLockManager::LOCK_ACTION); + // BoltLockMgr().InitiateAction(0, BoltLockManager::LOCK_ACTION); break; case to_underlying(DlLockState::kUnlocked): - BoltLockMgr().InitiateAction(0, BoltLockManager::UNLOCK_ACTION); + // BoltLockMgr().InitiateAction(0, BoltLockManager::UNLOCK_ACTION); break; default: break; @@ -82,9 +82,11 @@ bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, const N { bool returnValue = false; + ChipLogProgress(Zcl, "Door Lock App: Lock Command endpoint=%d", endpointId); + if (BoltLockMgr().ValidatePIN(pinCode, err)) { - BoltLockMgr().InitiateAction(0, BoltLockManager::LOCK_ACTION); + BoltLockMgr().InitiateAction(AppEvent::kEventType_Lock, BoltLockManager::LOCK_ACTION); returnValue = true; } @@ -97,9 +99,11 @@ bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, const { bool returnValue = false; + ChipLogProgress(Zcl, "Door Lock App: UnLock Command endpoint=%d", endpointId); + if (BoltLockMgr().ValidatePIN(pinCode, err)) { - BoltLockMgr().InitiateAction(0, BoltLockManager::UNLOCK_ACTION); + BoltLockMgr().InitiateAction(AppEvent::kEventType_Lock, BoltLockManager::UNLOCK_ACTION); returnValue = true; } @@ -123,3 +127,9 @@ void emberAfDoorLockClusterInitCallback(EndpointId endpoint) logOnFailure(DoorLock::Attributes::NumberOfCredentialsSupportedPerUser::Set(endpoint, CONFIG_LOCK_NUM_CREDENTIALS_PER_USER), "number of credentials per user"); } + +void emberAfPluginDoorLockOnAutoRelock(chip::EndpointId endpointId) +{ + // Apply the relock state in the application control + BoltLockMgr().InitiateAction(AppEvent::kEventType_Timer, BoltLockManager::LOCK_ACTION); +} diff --git a/examples/lock-app/qpg/zap/lock.matter b/examples/lock-app/qpg/zap/lock.matter index 573fbe867361c6..bb64f66facd5b1 100644 --- a/examples/lock-app/qpg/zap/lock.matter +++ b/examples/lock-app/qpg/zap/lock.matter @@ -790,7 +790,6 @@ server cluster GeneralDiagnostics = 51 { readonly attribute NetworkInterface networkInterfaces[] = 0; readonly attribute int16u rebootCount = 1; readonly attribute int64u upTime = 2; - readonly attribute int32u totalOperationalHours = 3; readonly attribute BootReasonEnum bootReason = 4; readonly attribute HardwareFaultEnum activeHardwareFaults[] = 5; readonly attribute RadioFaultEnum activeRadioFaults[] = 6; @@ -1277,6 +1276,51 @@ server cluster UserLabel = 65 { readonly attribute int16u clusterRevision = 65533; } +/** Allows servers to ensure that listed clients are notified when a server is available for communication. */ +server cluster IcdManagement = 70 { + bitmap Feature : bitmap32 { + kCheckInProtocolSupport = 0x1; + kUserActiveModeTrigger = 0x2; + kLongIdleTimeSupport = 0x4; + } + + bitmap UserActiveModeTriggerBitmap : bitmap32 { + kPowerCycle = 0x1; + kSettingsMenu = 0x2; + kCustomInstruction = 0x4; + kDeviceManual = 0x8; + kActuateSensor = 0x10; + kActuateSensorSeconds = 0x20; + kActuateSensorTimes = 0x40; + kActuateSensorLightsBlink = 0x80; + kResetButton = 0x100; + kResetButtonLightsBlink = 0x200; + kResetButtonSeconds = 0x400; + kResetButtonTimes = 0x800; + kSetupButton = 0x1000; + kSetupButtonSeconds = 0x2000; + kSetupButtonLightsBlink = 0x4000; + kSetupButtonTimes = 0x8000; + kAppDefinedButton = 0x10000; + } + + fabric_scoped struct MonitoringRegistrationStruct { + fabric_sensitive node_id checkInNodeID = 1; + fabric_sensitive int64u monitoredSubject = 2; + fabric_idx fabricIndex = 254; + } + + readonly attribute int32u idleModeDuration = 0; + readonly attribute int32u activeModeDuration = 1; + readonly attribute int16u activeModeThreshold = 2; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + /** An interface to a generic way to secure a door */ server cluster DoorLock = 257 { enum AlarmCodeEnum : enum8 { @@ -1907,7 +1951,6 @@ endpoint 0 { callback attribute networkInterfaces; callback attribute rebootCount default = 0x0000; callback attribute upTime default = 0x0000000000000000; - callback attribute totalOperationalHours default = 0x00000000; callback attribute bootReason; callback attribute activeHardwareFaults; callback attribute activeRadioFaults; @@ -2086,6 +2129,18 @@ endpoint 0 { ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; } + + server cluster IcdManagement { + callback attribute idleModeDuration default = 1; + callback attribute activeModeDuration default = 300; + callback attribute activeModeThreshold default = 300; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0x0001; + ram attribute clusterRevision default = 2; + } } endpoint 1 { device type ma_doorlock = 10, version 1; @@ -2136,24 +2191,6 @@ endpoint 1 { callback attribute clusterRevision default = 1; } - server cluster FixedLabel { - callback attribute labelList; - callback attribute generatedCommandList; - callback attribute acceptedCommandList; - callback attribute attributeList; - ram attribute featureMap default = 0; - ram attribute clusterRevision default = 1; - } - - server cluster UserLabel { - callback attribute labelList; - callback attribute generatedCommandList; - callback attribute acceptedCommandList; - callback attribute attributeList; - ram attribute featureMap default = 0; - ram attribute clusterRevision default = 1; - } - server cluster DoorLock { emits event DoorLockAlarm; emits event DoorStateChange; diff --git a/examples/lock-app/qpg/zap/lock.zap b/examples/lock-app/qpg/zap/lock.zap index fc0f478213e3be..ed241d2ab91866 100644 --- a/examples/lock-app/qpg/zap/lock.zap +++ b/examples/lock-app/qpg/zap/lock.zap @@ -1782,22 +1782,6 @@ "maxInterval": 65534, "reportableChange": 0 }, - { - "name": "TotalOperationalHours", - "code": 3, - "mfgCode": null, - "side": "server", - "type": "int32u", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "0x00000000", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, { "name": "BootReason", "code": 4, @@ -4077,6 +4061,160 @@ "reportableChange": 0 } ] + }, + { + "name": "ICD Management", + "code": 70, + "mfgCode": null, + "define": "ICD_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "IdleModeDuration", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeDuration", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "300", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeThreshold", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "300", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] } ] }, @@ -4589,218 +4727,6 @@ } ] }, - { - "name": "Fixed Label", - "code": 64, - "mfgCode": null, - "define": "FIXED_LABEL_CLUSTER", - "side": "server", - "enabled": 1, - "attributes": [ - { - "name": "LabelList", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "GeneratedCommandList", - "code": 65528, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "AcceptedCommandList", - "code": 65529, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "AttributeList", - "code": 65531, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "FeatureMap", - "code": 65532, - "mfgCode": null, - "side": "server", - "type": "bitmap32", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "ClusterRevision", - "code": 65533, - "mfgCode": null, - "side": "server", - "type": "int16u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "1", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - } - ] - }, - { - "name": "User Label", - "code": 65, - "mfgCode": null, - "define": "USER_LABEL_CLUSTER", - "side": "server", - "enabled": 1, - "attributes": [ - { - "name": "LabelList", - "code": 0, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "GeneratedCommandList", - "code": 65528, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "AcceptedCommandList", - "code": 65529, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "AttributeList", - "code": 65531, - "mfgCode": null, - "side": "server", - "type": "array", - "included": 1, - "storageOption": "External", - "singleton": 0, - "bounded": 0, - "defaultValue": "", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "FeatureMap", - "code": 65532, - "mfgCode": null, - "side": "server", - "type": "bitmap32", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "0", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - }, - { - "name": "ClusterRevision", - "code": 65533, - "mfgCode": null, - "side": "server", - "type": "int16u", - "included": 1, - "storageOption": "RAM", - "singleton": 0, - "bounded": 0, - "defaultValue": "1", - "reportable": 1, - "minInterval": 1, - "maxInterval": 65534, - "reportableChange": 0 - } - ] - }, { "name": "Door Lock", "code": 257, diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 2160af0d1e0322..3a29eed2ffcfc3 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -576,6 +576,8 @@ def BuildQorvoTarget(): TargetPart('persistent-storage', app=QpgApp.PERSISTENT_STORAGE), ]) + target.AppendModifier('updateimage', update_image=True) + return target diff --git a/scripts/build/builders/qpg.py b/scripts/build/builders/qpg.py index 2c4f3ebf2e4884..67f224b80a4657 100644 --- a/scripts/build/builders/qpg.py +++ b/scripts/build/builders/qpg.py @@ -81,18 +81,22 @@ def __init__(self, runner, app: QpgApp = QpgApp.LIGHT, board: QpgBoard = QpgBoard.QPG6105, - enable_rpcs: bool = False): + enable_rpcs: bool = False, + update_image: bool = False): super(QpgBuilder, self).__init__( root=app.BuildRoot(root), runner=runner) self.app = app self.board = board self.enable_rpcs = enable_rpcs + self.update_image = update_image def GnBuildArgs(self): args = ['qpg_target_ic=\"%s\"' % self.board.GnArgName()] if self.enable_rpcs: args.append('import("//with_pw_rpc.gni")') + if self.update_image: + args.append('matter_device_software_version_string=\"1.1_OTA_TEST\" matter_device_software_version=4') return args def build_outputs(self): diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt index b5402ab140189a..b5f8ad99719433 100644 --- a/scripts/build/testdata/all_targets_linux_x64.txt +++ b/scripts/build/testdata/all_targets_linux_x64.txt @@ -19,7 +19,7 @@ mbed-cy8cproto_062_4343w-{lock,light,all-clusters,all-clusters-minimal,pigweed,o mw320-all-clusters-app nrf-{nrf5340dk,nrf52840dk,nrf52840dongle}-{all-clusters,all-clusters-minimal,lock,light,light-switch,shell,pump,pump-controller,window-covering}[-rpc] nrf-native-posix-64-tests -qpg-qpg6105-{lock,light,shell,persistent-storage} +qpg-qpg6105-{lock,light,shell,persistent-storage}[-updateimage] stm32-stm32wb5mm-dk-light tizen-arm-{all-clusters,all-clusters-minimal,chip-tool,light,tests}[-no-ble][-no-thread][-no-wifi][-asan][-ubsan][-with-ui] telink-{tlsr9518adk80d,tlsr9528a}-{air-quality-sensor,all-clusters,all-clusters-minimal,bridge,contact-sensor,light,light-switch,lock,ota-requestor,pump,pump-controller,resource-monitoring,shell,smoke-co-alarm,temperature-measurement,thermostat,window-covering}[-ota][-dfu][-shell][-rpc][-factory-data][-4mb] diff --git a/src/platform/qpg/ConfigurationManagerImpl.cpp b/src/platform/qpg/ConfigurationManagerImpl.cpp index 872b05cc6c08f6..a7a59bf1438483 100644 --- a/src/platform/qpg/ConfigurationManagerImpl.cpp +++ b/src/platform/qpg/ConfigurationManagerImpl.cpp @@ -70,11 +70,6 @@ CHIP_ERROR ConfigurationManagerImpl::Init() err = StoreRebootCount(1); SuccessOrExit(err); } - if (!QPGConfig::ConfigValueExists(QPGConfig::kCounterKey_TotalOperationalHours)) - { - err = StoreTotalOperationalHours(0); - SuccessOrExit(err); - } qvRebootReason = qvCHIP_GetResetReason(); diff --git a/src/platform/qpg/DiagnosticDataProviderImpl.cpp b/src/platform/qpg/DiagnosticDataProviderImpl.cpp index 1afd80c1e5181f..da5435009685cb 100644 --- a/src/platform/qpg/DiagnosticDataProviderImpl.cpp +++ b/src/platform/qpg/DiagnosticDataProviderImpl.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -181,5 +182,27 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetActiveNetworkFaults(GeneralFaultsname = Span(threadNetworkName, strlen(threadNetworkName)); + ifp->isOperational = true; + ifp->offPremiseServicesReachableIPv4.SetNull(); + ifp->offPremiseServicesReachableIPv6.SetNull(); + ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::kThread; + uint8_t macBuffer[ConfigurationManager::kPrimaryMACAddressLength]; + ConfigurationMgr().GetPrimary802154MACAddress(macBuffer); + ifp->hardwareAddress = ByteSpan(macBuffer, ConfigurationManager::kPrimaryMACAddressLength); +#else + ifp->isOperational = false; + ifp->type = app::Clusters::GeneralDiagnostics::InterfaceTypeEnum::kUnspecified; +#endif + *netifpp = ifp; + return CHIP_NO_ERROR; +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/qpg/DiagnosticDataProviderImpl.h b/src/platform/qpg/DiagnosticDataProviderImpl.h index 7f0e9147c0b53b..2da5292409021d 100644 --- a/src/platform/qpg/DiagnosticDataProviderImpl.h +++ b/src/platform/qpg/DiagnosticDataProviderImpl.h @@ -54,6 +54,7 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider CHIP_ERROR GetActiveHardwareFaults(GeneralFaults & hardwareFaults) override; CHIP_ERROR GetActiveRadioFaults(GeneralFaults & radioFaults) override; CHIP_ERROR GetActiveNetworkFaults(GeneralFaults & networkFaults) override; + CHIP_ERROR GetNetworkInterfaces(NetworkInterface ** netifpp) override; }; /** diff --git a/third_party/qpg_sdk/qpg_executable.gni b/third_party/qpg_sdk/qpg_executable.gni index adfb2550a695ed..f759eddcea21ad 100644 --- a/third_party/qpg_sdk/qpg_executable.gni +++ b/third_party/qpg_sdk/qpg_executable.gni @@ -19,13 +19,6 @@ import("${build_root}/toolchain/flashable_executable.gni") import("${chip_root}/src/platform/device.gni") import("qpg_sdk.gni") -declare_args() { - matter_device_vid = "" - matter_device_pid = "" - matter_device_software_version = "" - matter_device_software_version_string = "" -} - # Run the generator script that takes a .HEX file and adds the OTA header to it. # # This requires a Python script, given by ota_header_generator, @@ -78,20 +71,6 @@ template("qpg_executable") { defines += invoker.defines } - # Overrule CHIPProjectConfig.h settings - if (matter_device_vid != "") { - defines += [ "CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID=${matter_device_vid}" ] - } - if (matter_device_pid != "") { - defines += [ "CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID=${matter_device_pid}" ] - } - if (matter_device_software_version_string != "") { - defines += [ "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING=\"${matter_device_software_version_string}\"" ] - } - if (matter_device_software_version != "") { - defines += [ "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION=${matter_device_software_version}" ] - } - # Copy flashing dependencies to the output directory so that the output # is collectively self-contained; this allows flashing to work reliably # even if the build and flashing steps take place on different machines diff --git a/third_party/qpg_sdk/qpg_sdk.gni b/third_party/qpg_sdk/qpg_sdk.gni index 67b0780d8fe731..d8898c3dabcf72 100644 --- a/third_party/qpg_sdk/qpg_sdk.gni +++ b/third_party/qpg_sdk/qpg_sdk.gni @@ -38,6 +38,12 @@ declare_args() { # Enable mbedtls HW acceleration mbedtls_alt_enabled = true + + # OTA parameters + matter_device_vid = "" + matter_device_pid = "" + matter_device_software_version = "" + matter_device_software_version_string = "" } assert(qpg_sdk_root != "", "qpg_sdk_root must be specified") @@ -92,6 +98,26 @@ template("qpg_sdk") { #MBed TLS built from third_party/mbedtls tree - OT config not used defines = [ "MBEDTLS_CONFIG_FILE=\"${qpg_target_ic}-mbedtls-config.h\"" ] + # Overrule CHIPProjectConfig.h settings + if (matter_device_vid != "") { + defines += [ "CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID=${matter_device_vid}" ] + } + if (matter_device_pid != "") { + defines += [ "CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID=${matter_device_pid}" ] + } + if (matter_device_software_version_string != "") { + defines += [ "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING=\"${matter_device_software_version_string}\"" ] + } + if (matter_device_software_version != "") { + defines += [ "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION=${matter_device_software_version}" ] + } + + if (qpg_target_ic == "qpg6200") { + defines += [ "QPG_6200" ] + } else { + include_dirs += [ "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt_3.3.0" ] + } + if (mbedtls_alt_enabled) { defines += [ "QORVO_CRYPTO_ENGINE" ] } else {