From 358d36263aa0f9ec14212d027c62b65d4b1ae371 Mon Sep 17 00:00:00 2001 From: Dieter Van der Meulen Date: Thu, 8 Jun 2023 07:37:29 +0000 Subject: [PATCH] [QPG] Update version + fix in DoorLock state after boot --- .../qpg/include/CHIPProjectConfig.h | 4 ++-- .../lock-app/qpg/include/CHIPProjectConfig.h | 4 ++-- examples/lock-app/qpg/src/AppTask.cpp | 21 ++++++++++++++----- examples/platform/qpg/app/main.cpp | 2 +- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/examples/lighting-app/qpg/include/CHIPProjectConfig.h b/examples/lighting-app/qpg/include/CHIPProjectConfig.h index f5f8d12be7797f..61dc9fdebc86af 100644 --- a/examples/lighting-app/qpg/include/CHIPProjectConfig.h +++ b/examples/lighting-app/qpg/include/CHIPProjectConfig.h @@ -42,7 +42,7 @@ * A uint32_t identifying the software version running on the device. */ #ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0002 +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0003 #endif /** @@ -53,7 +53,7 @@ * {MAJOR_VERSION}.0d{MINOR_VERSION} */ #ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.0" +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.1" #endif /** * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE diff --git a/examples/lock-app/qpg/include/CHIPProjectConfig.h b/examples/lock-app/qpg/include/CHIPProjectConfig.h index 802aa5b2a1f2f3..4989ed2f85051d 100644 --- a/examples/lock-app/qpg/include/CHIPProjectConfig.h +++ b/examples/lock-app/qpg/include/CHIPProjectConfig.h @@ -42,7 +42,7 @@ * A uint32_t identifying the software version running on the device. */ #ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0002 +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0003 #endif /** @@ -53,7 +53,7 @@ * {MAJOR_VERSION}.0d{MINOR_VERSION} */ #ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.0" +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.1" #endif /** * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE diff --git a/examples/lock-app/qpg/src/AppTask.cpp b/examples/lock-app/qpg/src/AppTask.cpp index 616e7d231482f3..3466d8c4a4c395 100644 --- a/examples/lock-app/qpg/src/AppTask.cpp +++ b/examples/lock-app/qpg/src/AppTask.cpp @@ -585,13 +585,24 @@ void AppTask::UpdateClusterState(void) auto newValue = BoltLockMgr().IsUnlocked() ? DoorLock::DlLockState::kUnlocked : DoorLock::DlLockState::kLocked; SystemLayer().ScheduleLambda([newValue] { - ChipLogProgress(NotSpecified, "UpdateClusterState"); + chip::app::DataModel::Nullable currentLockState; + chip::app::Clusters::DoorLock::Attributes::LockState::Get(QPG_LOCK_ENDPOINT_ID, currentLockState); - EmberAfStatus status = DoorLock::Attributes::LockState::Set(QPG_LOCK_ENDPOINT_ID, newValue); - - if (status != EMBER_ZCL_STATUS_SUCCESS) + if (currentLockState.IsNull()) + { + EmberAfStatus status = DoorLock::Attributes::LockState::Set(QPG_LOCK_ENDPOINT_ID, newValue); + if (status != EMBER_ZCL_STATUS_SUCCESS) + { + ChipLogError(NotSpecified, "ERR: updating DoorLock %x", status); + } + } + else { - ChipLogError(NotSpecified, "ERR: updating DoorLock %x", status); + ChipLogProgress(NotSpecified, "Updating LockState attribute"); + if (!DoorLockServer::Instance().SetLockState(QPG_LOCK_ENDPOINT_ID, newValue)) + { + ChipLogError(NotSpecified, "ERR: updating DoorLock"); + } } }); } diff --git a/examples/platform/qpg/app/main.cpp b/examples/platform/qpg/app/main.cpp index 5fb2b01a53cad5..bc3b28e230efe8 100644 --- a/examples/platform/qpg/app/main.cpp +++ b/examples/platform/qpg/app/main.cpp @@ -192,7 +192,7 @@ CHIP_ERROR CHIP_Init(void) qvIO_EnableSleep(true); #elif CHIP_DEVICE_CONFIG_THREAD_FTD ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); - qvIO_EnableSleep(false); + qvIO_EnableSleep(true); #else ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); qvIO_EnableSleep(false);