Skip to content

Commit

Permalink
Adding ota-requestor support in qpg lighting app (#13534)
Browse files Browse the repository at this point in the history
General:
* Add ota-upgrade AnnounceOTAProvider handling to lighting-app .zap

QPG:
* Add OTA upgrade to QPG platform and lighting-app
* Enable DNS client to resolve OTA provider

Restyled by whitespace
Restyled by clang-format
Restyled by gn

* Update to latest API for OTARequestor
  • Loading branch information
tima-q authored and pull[bot] committed Apr 26, 2022
1 parent f25dcdf commit 1713708
Show file tree
Hide file tree
Showing 22 changed files with 687 additions and 87 deletions.
2 changes: 0 additions & 2 deletions config/qpg/chip-gn/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ declare_args() {

examples_plat_dir = "//examples/platform/qpg"
qpg_sdk("sdk") {
sources = [ "//examples/platform/qpg/app/include/Service.h" ]

include_dirs = [
"//src/platform/qpg",
"${examples_plat_dir}/project_include",
Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ idf_component_register(PRIV_INCLUDE_DIRS
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/occupancy-sensor-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-requestor"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/switch-server"
Expand Down
209 changes: 203 additions & 6 deletions examples/lighting-app/lighting-common/lighting-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1305,14 +1305,14 @@
"code": 65533,
"mfgCode": null,
"side": "client",
"included": 0,
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "1",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"defaultValue": "0x0001",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
Expand Down Expand Up @@ -1342,7 +1342,204 @@
"outgoing": 0
}
],
"attributes": []
"attributes": [
{
"name": "AttributeList",
"code": 65531,
"mfgCode": null,
"side": "server",
"included": 0,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "FeatureMap",
"code": 65532,
"mfgCode": null,
"side": "server",
"included": 0,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ClusterRevision",
"code": 65533,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x0001",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "OTA Software Update Requestor",
"code": 42,
"mfgCode": null,
"define": "OTA_REQUESTOR_CLUSTER",
"side": "client",
"enabled": 0,
"commands": [
{
"name": "AnnounceOtaProvider",
"code": 0,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 0
}
],
"attributes": [
{
"name": "ClusterRevision",
"code": 65533,
"mfgCode": null,
"side": "client",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "1",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "OTA Software Update Requestor",
"code": 42,
"mfgCode": null,
"define": "OTA_REQUESTOR_CLUSTER",
"side": "server",
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "DefaultOtaProviders",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "UpdatePossible",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "1",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "UpdateState",
"code": 2,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
},
{
"name": "UpdateStateProgress",
"code": 3,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "AttributeList",
"code": 65531,
"mfgCode": null,
"side": "server",
"included": 0,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "FeatureMap",
"code": 65532,
"mfgCode": null,
"side": "server",
"included": 0,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
"reportable": 0,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ClusterRevision",
"code": 65533,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "1",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
"reportableChange": 0
}
]
},
{
"name": "Localization Configuration",
Expand Down
4 changes: 4 additions & 0 deletions examples/lighting-app/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ target_include_directories(${APP_TARGET} PRIVATE
${CHIP_ROOT}/third_party/nlio/repo/include
)

# TODO - re-use chip_data_model.cmake to add cluster implementations.
target_sources(${APP_TARGET} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/main/AppTask.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main/LightingManager.cpp
Expand Down Expand Up @@ -95,6 +96,9 @@ target_sources(${APP_TARGET} PRIVATE
${CHIP_ROOT}/src/app/clusters/occupancy-sensor-server/occupancy-sensor-server.cpp
${CHIP_ROOT}/src/app/clusters/network-commissioning-old/network-commissioning-ember.cpp
${CHIP_ROOT}/src/app/clusters/network-commissioning-old/network-commissioning-old.cpp
${CHIP_ROOT}/src/app/clusters/ota-requestor/ota-requestor-server.cpp
${CHIP_ROOT}/src/app/clusters/ota-requestor/BDXDownloader.cpp
${CHIP_ROOT}/src/app/clusters/ota-requestor/OTARequestor.cpp
)

target_link_libraries(${APP_TARGET} mbed-os-posix-socket mbed-os mbed-ble mbed-events mbed-netsocket mbed-storage mbed-storage-kv-global-api mbed-mbedtls mbed-emac chip)
Expand Down
10 changes: 5 additions & 5 deletions examples/lighting-app/qpg/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ qpg_project_dir = "${chip_root}/examples/lighting-app/qpg"
examples_plat_dir = "${chip_root}/examples/platform/qpg"

qpg_sdk("sdk") {
sources = [
"${examples_plat_dir}/app/include/Service.h",
"${examples_plat_dir}/project_include/CHIPProjectConfig.h",
]
sources = [ "${examples_plat_dir}/project_include/CHIPProjectConfig.h" ]

include_dirs = [
"${chip_root}/src/platform/qpg",
Expand All @@ -41,9 +38,12 @@ qpg_sdk("sdk") {
qpg_executable("lighting_app") {
output_name = "chip-${qpg_target_ic}-lighting-example.out"

include_dirs = []

sources = [
"${chip_root}/examples/lighting-app/lighting-common/color_format/color_format.cpp",
"${examples_plat_dir}/app/main.cpp",
"${examples_plat_dir}/ota/ota.cpp",
"src/AppTask.cpp",
"src/LightingManager.cpp",
"src/ZclCallbacks.cpp",
Expand Down Expand Up @@ -75,7 +75,7 @@ qpg_executable("lighting_app") {
include_dirs = [
"${qpg_project_dir}/include/",
"${examples_plat_dir}",
"${examples_plat_dir}/app/include",
"${examples_plat_dir}/ota",
"${chip_root}/examples/lighting-app/lighting-common/color_format",
]

Expand Down
4 changes: 4 additions & 0 deletions examples/lighting-app/qpg/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ import("//build_overrides/chip.gni")
import("${chip_root}/examples/platform/qpg/args.gni")

qpg_sdk_target = get_label_info(":sdk", "label_no_toolchain")

declare_args() {
chip_enable_ota_requestor = true
}
5 changes: 1 addition & 4 deletions examples/lighting-app/qpg/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#include "FreeRTOS.h"
#include "timers.h" // provides FreeRTOS timer support
#include <ble/BLEEndPoint.h>
#include <platform/CHIPDeviceLayer.h>

#define APP_NAME "Lighting-app"
Expand Down Expand Up @@ -68,8 +67,7 @@ class AppTask
enum Function_t
{
kFunction_NoneSelected = 0,
kFunction_SoftwareUpdate = 0,
kFunction_Joiner = 1,
kFunction_SoftwareUpdate = 1,
kFunction_FactoryReset = 2,

kFunction_Invalid
Expand All @@ -78,7 +76,6 @@ class AppTask
Function_t mFunction;
bool mFunctionTimerActive;
bool mSyncClusterToButtonAction;
chip::Ble::BLEEndPoint * mBLEEndPoint;

static AppTask sAppTask;
};
Expand Down
Loading

0 comments on commit 1713708

Please sign in to comment.