Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
To support OTA requestor functionality, we need OTA requestor server and
OTA provider client. OTA provider client was enabled in project-chip#13246 which
broke the ZAP regen.

Having same cluster's client and server in same app is not supported in
the zap. Removed OTA provider client from all-clusters-app

Removing the OTA requestor support from all-clusters-app/esp32
  • Loading branch information
shubhamdp committed Jan 11, 2022
1 parent 19f61eb commit 347397b
Show file tree
Hide file tree
Showing 15 changed files with 125 additions and 566 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1357,31 +1357,31 @@
"mfgCode": null,
"define": "OTA_PROVIDER_CLUSTER",
"side": "client",
"enabled": 1,
"enabled": 0,
"commands": [
{
"name": "QueryImage",
"code": 0,
"mfgCode": null,
"source": "client",
"incoming": 0,
"incoming": 1,
"outgoing": 1
},
{
"name": "ApplyUpdateRequest",
"code": 2,
"mfgCode": null,
"source": "client",
"incoming": 0,
"incoming": 1,
"outgoing": 1
},
{
"name": "NotifyUpdateApplied",
"code": 4,
"mfgCode": null,
"source": "client",
"incoming": 0,
"outgoing": 1
"incoming": 1,
"outgoing": 0
}
],
"attributes": [
Expand Down
1 change: 0 additions & 1 deletion examples/all-clusters-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ set(SRC_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/low-power-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/keypad-input-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/media-playback-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-requestor"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-provider"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/target-navigator-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-server"
Expand Down
26 changes: 0 additions & 26 deletions examples/all-clusters-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
#include <app-common/zap-generated/cluster-id.h>
#include <app/clusters/door-lock-server/door-lock-server.h>
#include <app/clusters/on-off-server/on-off-server.h>
#include <app/clusters/ota-requestor/BDXDownloader.h>
#include <app/clusters/ota-requestor/OTARequestor.h>
#include <app/server/AppDelegate.h>
#include <app/server/Dnssd.h>
#include <app/server/OnboardingCodesUtil.h>
Expand All @@ -66,8 +64,6 @@
#include <lib/support/CHIPMem.h>
#include <lib/support/ErrorStr.h>
#include <platform/CHIPDeviceLayer.h>
#include <platform/ESP32/OTAImageProcessorImpl.h>
#include <platform/GenericOTARequestorDriver.h>
#include <setup_payload/ManualSetupPayloadGenerator.h>
#include <setup_payload/QRCodeSetupPayloadGenerator.h>

Expand Down Expand Up @@ -125,13 +121,6 @@ std::vector<gpio_num_t> button_gpios = { BUTTON_1_GPIO_NUM, BUTTON_2_GPIO_NUM, B

#endif

#if CONFIG_ENABLE_OTA_REQUESTOR
OTARequestor gRequestorCore;
GenericOTARequestorDriver gRequestorUser;
BDXDownloader gDownloader;
OTAImageProcessorImpl gImageProcessor;
#endif

// Pretend these are devices with endpoints with clusters with attributes
typedef std::tuple<std::string, std::string> Attribute;
typedef std::vector<Attribute> Attributes;
Expand Down Expand Up @@ -527,19 +516,6 @@ static void InitServer(intptr_t context)
SetupPretendDevices();
}

static void InitOTARequestor(void)
{
#if CONFIG_ENABLE_OTA_REQUESTOR
SetRequestorInstance(&gRequestorCore);
gRequestorCore.SetServerInstance(&Server::GetInstance());
gRequestorCore.SetOtaRequestorDriver(&gRequestorUser);
gImageProcessor.SetOTADownloader(&gDownloader);
gDownloader.SetImageProcessorDelegate(&gImageProcessor);
gRequestorUser.Init(&gRequestorCore, &gImageProcessor);
gRequestorCore.SetBDXDownloader(&gDownloader);
#endif
}

extern "C" void app_main()
{
ESP_LOGI(TAG, "All Clusters Demo!");
Expand Down Expand Up @@ -598,8 +574,6 @@ extern "C" void app_main()
// Print QR Code URL
PrintOnboardingCodes(chip::RendezvousInformationFlags(CONFIG_RENDEZVOUS_MODE));

InitOTARequestor();

#if CONFIG_HAVE_DISPLAY
std::string qrCodeText;

Expand Down
4 changes: 1 addition & 3 deletions src/app/tests/suites/TestDescriptorCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ tests:
command: "readAttribute"
attribute: "Client List"
response:
value: [
0x0029, # OTA Software Update Provider
]
value: []

- label: "Read attribute Parts list"
command: "readAttribute"
Expand Down
3 changes: 1 addition & 2 deletions src/darwin/Framework/CHIPTests/CHIPClustersTests.m

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/lib/shell/commands/Ota.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
using namespace chip::DeviceLayer;

namespace chip {

// TODO: Remove weak functions when ESP32 all-clusters-app includes code from src/app/clusters/ota-requestor
// The code requires OTA Provider client cluster which interferes with OTA Provider server cluster,
// already enabled in the all-clusters-app.
__attribute__((weak)) void SetRequestorInstance(OTARequestorInterface * instance) {}
__attribute__((weak)) OTARequestorInterface * GetRequestorInstance()
{
return nullptr;
}

namespace Shell {
namespace {

Expand Down
129 changes: 0 additions & 129 deletions zzz_generated/all-clusters-app/zap-generated/CHIPClientCallbacks.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 0 additions & 21 deletions zzz_generated/all-clusters-app/zap-generated/CHIPClientCallbacks.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 347397b

Please sign in to comment.