Skip to content

Commit

Permalink
Update General Commissioning cluster to align with the latest spec
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca committed Feb 2, 2022
1 parent 4f391f1 commit c6ea27d
Show file tree
Hide file tree
Showing 21 changed files with 75 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1982,12 +1982,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down Expand Up @@ -9619,12 +9619,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down
4 changes: 2 additions & 2 deletions examples/bridge-app/bridge-common/bridge-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -799,12 +799,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down
4 changes: 2 additions & 2 deletions examples/door-lock-app/door-lock-common/door-lock-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1755,12 +1755,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1872,7 +1872,7 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/lighting-common/lighting-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1855,12 +1855,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/lock-common/lock-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1755,12 +1755,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down
4 changes: 2 additions & 2 deletions examples/log-source-app/log-source-common/log-source-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1173,12 +1173,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1532,12 +1532,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1631,12 +1631,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down
4 changes: 2 additions & 2 deletions examples/placeholder/linux/apps/app1/config.zap
Original file line number Diff line number Diff line change
Expand Up @@ -586,12 +586,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down
4 changes: 2 additions & 2 deletions examples/placeholder/linux/apps/app2/config.zap
Original file line number Diff line number Diff line change
Expand Up @@ -586,12 +586,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down
4 changes: 2 additions & 2 deletions examples/pump-app/pump-common/pump-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1498,12 +1498,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1498,12 +1498,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1201,12 +1201,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
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 @@ -1661,12 +1661,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down Expand Up @@ -8691,12 +8691,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
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 @@ -1661,12 +1661,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
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 @@ -1661,12 +1661,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down Expand Up @@ -8523,12 +8523,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down
4 changes: 2 additions & 2 deletions examples/window-app/common/window-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1450,12 +1450,12 @@
"reportableChange": 0
},
{
"name": "BasicCommissioningInfoList",
"name": "BasicCommissioningInfo",
"code": 1,
"mfgCode": null,
"side": "server",
"included": 1,
"storageOption": "RAM",
"storageOption": "External",
"singleton": 0,
"bounded": 0,
"defaultValue": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class GeneralCommissioningAttrAccess : public AttributeAccessInterface

private:
CHIP_ERROR ReadIfSupported(CHIP_ERROR (ConfigurationManager::*getter)(uint8_t &), AttributeValueEncoder & aEncoder);
CHIP_ERROR ReadBasicCommissioningInfo(AttributeValueEncoder & aEncoder);
};

GeneralCommissioningAttrAccess gAttrAccess;
Expand All @@ -82,9 +83,8 @@ CHIP_ERROR GeneralCommissioningAttrAccess::Read(const ConcreteReadAttributePath
case LocationCapability::Id: {
return ReadIfSupported(&ConfigurationManager::GetLocationCapability, aEncoder);
}
case BasicCommissioningInfoList::Id: {
// TODO: This should not be a list at all!
return aEncoder.EncodeEmptyList();
case BasicCommissioningInfo::Id: {
return ReadBasicCommissioningInfo(aEncoder);
}
default: {
break;
Expand All @@ -110,6 +110,17 @@ CHIP_ERROR GeneralCommissioningAttrAccess::ReadIfSupported(CHIP_ERROR (Configura
return aEncoder.Encode(data);
}

CHIP_ERROR GeneralCommissioningAttrAccess::ReadBasicCommissioningInfo(AttributeValueEncoder & aEncoder)
{
BasicCommissioningInfo::TypeInfo::Type basicCommissioningInfo;

// TODO: The commissioner might use the critical parameters in BasicCommissioningInfo to initialize
// the CommissioningParameters at the beginning of commissioning flow.
basicCommissioningInfo.failSafeExpiryLengthSeconds = CHIP_DEVICE_CONFIG_FAILSAFE_EXPIRY_LENGTH_SEC;

return aEncoder.Encode(basicCommissioningInfo);
}

} // anonymous namespace

bool emberAfGeneralCommissioningClusterArmFailSafeCallback(app::CommandHandler * commandObj,
Expand All @@ -120,7 +131,7 @@ bool emberAfGeneralCommissioningClusterArmFailSafeCallback(app::CommandHandler *
CheckSuccess(server->ArmFailSafe(System::Clock::Seconds16(commandData.expiryLengthSeconds)), Failure);

Commands::ArmFailSafeResponse::Type response;
response.errorCode = GeneralCommissioningError::kOk;
response.errorCode = CommissioningError::kOk;
response.debugText = CharSpan("", 0);
CheckSuccess(commandObj->AddResponseData(commandPath, response), Failure);

Expand All @@ -145,7 +156,7 @@ bool emberAfGeneralCommissioningClusterCommissioningCompleteCallback(
CheckSuccess(server->CommissioningComplete(), Failure);

Commands::CommissioningCompleteResponse::Type response;
response.errorCode = GeneralCommissioningError::kOk;
response.errorCode = CommissioningError::kOk;
response.debugText = CharSpan("", 0);
CheckSuccess(commandObj->AddResponseData(commandPath, response), Failure);

Expand All @@ -162,7 +173,7 @@ bool emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(app::CommandH
Failure);

Commands::SetRegulatoryConfigResponse::Type response;
response.errorCode = GeneralCommissioningError::kOk;
response.errorCode = CommissioningError::kOk;
response.debugText = CharSpan("", 0);
CheckSuccess(commandObj->AddResponseData(commandPath, response), Failure);

Expand Down
Loading

0 comments on commit c6ea27d

Please sign in to comment.