Skip to content

Commit

Permalink
[OTA] Add support for DefaultOTAProviders attribute (#15170)
Browse files Browse the repository at this point in the history
  • Loading branch information
carol-apple authored and pull[bot] committed Feb 21, 2022
1 parent 3a34166 commit 3225715
Show file tree
Hide file tree
Showing 17 changed files with 460 additions and 110 deletions.
5 changes: 1 addition & 4 deletions examples/all-clusters-app/ameba/main/chipinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,9 @@ AmebaOTAImageProcessor gImageProcessor;
#endif

#if CONFIG_ENABLE_OTA_REQUESTOR
extern "C" void amebaQueryImageCmdHandler(uint32_t nodeId, uint32_t fabricId)
extern "C" void amebaQueryImageCmdHandler()
{
ChipLogProgress(DeviceLayer, "Calling amebaQueryImageCmdHandler");
// In this mode Provider node ID and fabric idx must be supplied explicitly from ATS$ cmd
gRequestorCore.TestModeSetProviderParameters(nodeId, fabricId, chip::kRootEndpointId);

static_cast<OTARequestor *>(GetRequestorInstance())->TriggerImmediateQuery();
}

Expand Down
5 changes: 1 addition & 4 deletions examples/lighting-app/ameba/main/chipinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,9 @@ AmebaOTAImageProcessor gImageProcessor;
#endif

#if CONFIG_ENABLE_OTA_REQUESTOR
extern "C" void amebaQueryImageCmdHandler(uint32_t nodeId, uint32_t fabricId)
extern "C" void amebaQueryImageCmdHandler()
{
ChipLogProgress(DeviceLayer, "Calling amebaQueryImageCmdHandler");
// In this mode Provider node ID and fabric idx must be supplied explicitly from ATS$ cmd
gRequestorCore.TestModeSetProviderParameters(nodeId, fabricId, chip::kRootEndpointId);

static_cast<OTARequestor *>(GetRequestorInstance())->TriggerImmediateQuery();
}

Expand Down
6 changes: 0 additions & 6 deletions examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ DeviceLayer::GenericOTARequestorDriver gRequestorUser;
static BDXDownloader gDownloader;
static OTAImageProcessorImpl gImageProcessor;

static NodeId providerNodeId = 2;
static FabricIndex providerFabricIndex = 1;

CHIP_ERROR AppTask::StartAppTask()
{
CHIP_ERROR err = CHIP_NO_ERROR;
Expand Down Expand Up @@ -493,9 +490,6 @@ void AppTask::OTAHandler(AppEvent * aEvent)
return;
}

// In this mode Provider node ID and fabric idx must be supplied explicitly from program args
gRequestorCore.TestModeSetProviderParameters(providerNodeId, providerFabricIndex, chip::kRootEndpointId);

static_cast<OTARequestor *>(GetRequestorInstance())->TriggerImmediateQuery();
}

Expand Down
5 changes: 1 addition & 4 deletions examples/ota-requestor-app/ameba/main/chipinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,9 @@ GenericOTARequestorDriver gRequestorUser;
BDXDownloader gDownloader;
AmebaOTAImageProcessor gImageProcessor;

extern "C" void amebaQueryImageCmdHandler(uint32_t nodeId, uint32_t fabricId)
extern "C" void amebaQueryImageCmdHandler()
{
ChipLogProgress(DeviceLayer, "Calling amebaQueryImageCmdHandler");
// In this mode Provider node ID and fabric idx must be supplied explicitly from ATS$ cmd
gRequestorCore.TestModeSetProviderParameters(nodeId, fabricId, chip::kRootEndpointId);

static_cast<OTARequestor *>(GetRequestorInstance())->TriggerImmediateQuery();
}

Expand Down
5 changes: 1 addition & 4 deletions examples/ota-requestor-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,9 @@ void ApplicationInit()
// Initialize all OTA download components
InitOTARequestor();

// Test Mode operation: If a delay is provided, QueryImage after the timer expires
// If a delay is provided, after the timer expires, QueryImage from default OTA provider
if (delayQueryTimeInSec > 0)
{
// In this mode Provider node ID and fabric idx must be supplied explicitly from program args
gRequestorCore.TestModeSetProviderParameters(providerNodeId, providerFabricIndex, chip::kRootEndpointId);

chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Milliseconds32(delayQueryTimeInSec * 1000),
OnStartDelayTimerHandler, nullptr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,42 @@ server cluster AccessControl = 31 {
readonly global attribute int16u clusterRevision = 65533;
}

server cluster AdministratorCommissioning = 60 {
enum CommissioningWindowStatus : ENUM8 {
kWindowNotOpen = 0;
kEnhancedWindowOpen = 1;
kBasicWindowOpen = 2;
}

enum StatusCode : ENUM8 {
kBusy = 1;
kPAKEParameterError = 2;
kWindowNotOpen = 3;
}

readonly attribute int8u windowStatus = 0;
readonly attribute fabric_idx adminFabricIndex = 1;
readonly attribute int16u adminVendorId = 2;
readonly global attribute int16u clusterRevision = 65533;

request struct OpenBasicCommissioningWindowRequest {
INT16U commissioningTimeout = 0;
}

request struct OpenCommissioningWindowRequest {
INT16U commissioningTimeout = 0;
OCTET_STRING PAKEVerifier = 1;
INT16U discriminator = 2;
INT32U iterations = 3;
OCTET_STRING salt = 4;
INT16U passcodeID = 5;
}

timed command OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1;
timed command OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0;
timed command RevokeCommissioning(): DefaultSuccess = 2;
}

server cluster Basic = 40 {
critical event StartUp = 0 {
INT32U softwareVersion = 0;
Expand Down Expand Up @@ -577,6 +613,7 @@ server cluster UserLabel = 65 {

endpoint 0 {
server cluster AccessControl;
server cluster AdministratorCommissioning;
server cluster Basic;
server cluster FixedLabel;
server cluster GeneralCommissioning;
Expand Down
109 changes: 108 additions & 1 deletion examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -2033,6 +2033,112 @@
}
]
},
{
"name": "AdministratorCommissioning",
"code": 60,
"mfgCode": null,
"define": "ADMINISTRATOR_COMMISSIONING_CLUSTER",
"side": "client",
"enabled": 0,
"commands": [
{
"name": "OpenCommissioningWindow",
"code": 0,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 0
},
{
"name": "OpenBasicCommissioningWindow",
"code": 1,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 0
},
{
"name": "RevokeCommissioning",
"code": 2,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 0
}
],
"attributes": []
},
{
"name": "AdministratorCommissioning",
"code": 60,
"mfgCode": null,
"define": "ADMINISTRATOR_COMMISSIONING_CLUSTER",
"side": "server",
"enabled": 1,
"commands": [],
"attributes": [
{
"name": "WindowStatus",
"code": 0,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "AdminFabricIndex",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "AdminVendorId",
"code": 2,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"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": 1,
"maxInterval": 65534,
"reportableChange": 0
}
]
},
{
"name": "Operational Credentials",
"code": 62,
Expand Down Expand Up @@ -4332,5 +4438,6 @@
"endpointVersion": 1,
"deviceIdentifier": 22
}
]
],
"log": []
}
Loading

0 comments on commit 3225715

Please sign in to comment.