Skip to content

Commit

Permalink
Implement encoding empty list for DefaultOTAProviders
Browse files Browse the repository at this point in the history
- Remove length for DefaultOTAProviders attribute from XML file
  • Loading branch information
carol-apple committed Dec 18, 2021
1 parent aea5db2 commit fcedec3
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,7 @@
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
Expand All @@ -1555,7 +1555,7 @@
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
Expand All @@ -1570,7 +1570,7 @@
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
Expand Down Expand Up @@ -19759,5 +19759,6 @@
"endpointVersion": 1,
"deviceIdentifier": 22
}
]
],
"log": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ OtaSoftwareUpdateRequestorAttrAccess gAttrAccess;

CHIP_ERROR OtaSoftwareUpdateRequestorAttrAccess::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder)
{
switch (aPath.mAttributeId)
{
case Attributes::DefaultOtaProviders::Id:
return aEncoder.Encode(DataModel::List<uint8_t>());
default:
break;
}

return CHIP_NO_ERROR;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "1",
Expand All @@ -1135,7 +1135,7 @@
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
Expand All @@ -1150,7 +1150,7 @@
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "External",
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0",
Expand Down
8 changes: 4 additions & 4 deletions examples/thermostat/thermostat-common/thermostat.zap
Original file line number Diff line number Diff line change
Expand Up @@ -4068,7 +4068,7 @@
"commands": [],
"attributes": [
{
"name": "groups",
"name": "groupKeyMap",
"code": 0,
"mfgCode": null,
"side": "server",
Expand All @@ -4083,7 +4083,7 @@
"reportableChange": 0
},
{
"name": "group keys",
"name": "groupTable",
"code": 1,
"mfgCode": null,
"side": "server",
Expand Down Expand Up @@ -8938,7 +8938,7 @@
"commands": [],
"attributes": [
{
"name": "groups",
"name": "groupKeyMap",
"code": 0,
"mfgCode": null,
"side": "server",
Expand All @@ -8953,7 +8953,7 @@
"reportableChange": 0
},
{
"name": "group keys",
"name": "groupTable",
"code": 1,
"mfgCode": null,
"side": "server",
Expand Down
4 changes: 2 additions & 2 deletions examples/tv-app/tv-common/tv-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -4083,7 +4083,7 @@
"commands": [],
"attributes": [
{
"name": "groups",
"name": "groupKeyMap",
"code": 0,
"mfgCode": null,
"side": "server",
Expand All @@ -4098,7 +4098,7 @@
"reportableChange": 0
},
{
"name": "group keys",
"name": "groupTable",
"code": 1,
"mfgCode": null,
"side": "server",
Expand Down
8 changes: 4 additions & 4 deletions examples/tv-casting-app/tv-casting-common/tv-casting-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -4068,7 +4068,7 @@
"commands": [],
"attributes": [
{
"name": "groups",
"name": "groupKeyMap",
"code": 0,
"mfgCode": null,
"side": "server",
Expand All @@ -4083,7 +4083,7 @@
"reportableChange": 0
},
{
"name": "group keys",
"name": "groupTable",
"code": 1,
"mfgCode": null,
"side": "server",
Expand Down Expand Up @@ -8770,7 +8770,7 @@
"commands": [],
"attributes": [
{
"name": "groups",
"name": "groupKeyMap",
"code": 0,
"mfgCode": null,
"side": "server",
Expand All @@ -8785,7 +8785,7 @@
"reportableChange": 0
},
{
"name": "group keys",
"name": "groupTable",
"code": 1,
"mfgCode": null,
"side": "server",
Expand Down
8 changes: 8 additions & 0 deletions src/app/clusters/ota-requestor/ota-requestor-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ OtaSoftwareUpdateRequestorAttrAccess gAttrAccess;

CHIP_ERROR OtaSoftwareUpdateRequestorAttrAccess::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder)
{
switch (aPath.mAttributeId)
{
case Attributes::DefaultOtaProviders::Id:
return aEncoder.Encode(DataModel::List<uint8_t>());
default:
break;
}

return CHIP_NO_ERROR;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/zap-templates/zcl/data-model/chip/chip-ota.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ limitations under the License.
<define>OTA_REQUESTOR_CLUSTER</define>
<client tick="false" init="false">true</client>
<server tick="false" init="false">true</server>
<attribute side="server" code="0x0000" define="DEFAULT_OTA_PROVIDERS" type="ARRAY" entryType="ProviderLocation" length="16" writable="true" optional="false">DefaultOtaProviders</attribute>
<attribute side="server" code="0x0000" define="DEFAULT_OTA_PROVIDERS" type="ARRAY" entryType="ProviderLocation" writable="true" optional="false">DefaultOtaProviders</attribute>
<attribute side="server" code="0x0001" define="UPDATE_POSSIBLE" type="BOOLEAN" default="true" writable="false" optional="false">UpdatePossible</attribute>
<attribute side="server" code="0x0002" define="UPDATE_STATE" type="UpdateStateEnum" default="Unknown" writable="false" optional="false">UpdateState</attribute>
<attribute side="server" code="0x0003" define="UPDATE_STATE_PROGRESS" type="INT8U" min="0" max="100" writable="false" isNullable="true" optional="false">UpdateStateProgress</attribute>
Expand Down
Loading

0 comments on commit fcedec3

Please sign in to comment.