Skip to content

Commit

Permalink
Fixes project-chip#30805 zap_regen_all commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesharrow committed Dec 6, 2023
1 parent ee824c0 commit 2947b9b
Show file tree
Hide file tree
Showing 27 changed files with 583 additions and 171 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3703,7 +3703,7 @@ provisional cluster EnergyEvse = 153 {
}

struct ChargingTargetStruct {
int16u targetTime = 0;
int16u targetTimeMinutesPastMidnight = 0;
optional percent targetSoC = 1;
optional energy_mwh addedEnergy = 2;
}
Expand Down Expand Up @@ -3766,9 +3766,9 @@ provisional cluster EnergyEvse = 153 {
readonly attribute optional nullable energy_mwh batteryCapacity = 49;
readonly attribute optional nullable char_string<32> vehicleID = 50;
readonly attribute nullable int32u sessionID = 64;
readonly attribute elapsed_s sessionDuration = 65;
readonly attribute energy_mwh sessionEnergyCharged = 66;
readonly attribute optional energy_mwh sessionEnergyDischarged = 67;
readonly attribute nullable elapsed_s sessionDuration = 65;
readonly attribute nullable energy_mwh sessionEnergyCharged = 66;
readonly attribute optional nullable energy_mwh sessionEnergyDischarged = 67;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ provisional cluster EnergyEvse = 153 {
}

struct ChargingTargetStruct {
int16u targetTime = 0;
int16u targetTimeMinutesPastMidnight = 0;
optional percent targetSoC = 1;
optional energy_mwh addedEnergy = 2;
}
Expand Down Expand Up @@ -1089,9 +1089,9 @@ provisional cluster EnergyEvse = 153 {
readonly attribute optional nullable energy_mwh batteryCapacity = 49;
readonly attribute optional nullable char_string<32> vehicleID = 50;
readonly attribute nullable int32u sessionID = 64;
readonly attribute elapsed_s sessionDuration = 65;
readonly attribute energy_mwh sessionEnergyCharged = 66;
readonly attribute optional energy_mwh sessionEnergyDischarged = 67;
readonly attribute nullable elapsed_s sessionDuration = 65;
readonly attribute nullable energy_mwh sessionEnergyCharged = 66;
readonly attribute optional nullable energy_mwh sessionEnergyDischarged = 67;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
8 changes: 4 additions & 4 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -4368,7 +4368,7 @@ provisional cluster EnergyEvse = 153 {
}

struct ChargingTargetStruct {
int16u targetTime = 0;
int16u targetTimeMinutesPastMidnight = 0;
optional percent targetSoC = 1;
optional energy_mwh addedEnergy = 2;
}
Expand Down Expand Up @@ -4431,9 +4431,9 @@ provisional cluster EnergyEvse = 153 {
readonly attribute optional nullable energy_mwh batteryCapacity = 49;
readonly attribute optional nullable char_string<32> vehicleID = 50;
readonly attribute nullable int32u sessionID = 64;
readonly attribute elapsed_s sessionDuration = 65;
readonly attribute energy_mwh sessionEnergyCharged = 66;
readonly attribute optional energy_mwh sessionEnergyDischarged = 67;
readonly attribute nullable elapsed_s sessionDuration = 65;
readonly attribute nullable energy_mwh sessionEnergyCharged = 66;
readonly attribute optional nullable energy_mwh sessionEnergyDischarged = 67;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
12 changes: 6 additions & 6 deletions src/controller/data_model/controller-clusters.zap
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
}
],
"package": [
{
"pathRelativity": "relativeToZap",
"path": "../../app/zap-templates/app-templates.json",
"type": "gen-templates-json",
"version": "chip-v1"
},
{
"pathRelativity": "relativeToZap",
"path": "../../app/zap-templates/zcl/zcl.json",
"type": "zcl-properties",
"category": "matter",
"version": 1,
"description": "Matter SDK ZCL data"
},
{
"pathRelativity": "relativeToZap",
"path": "../../app/zap-templates/app-templates.json",
"type": "gen-templates-json",
"version": "chip-v1"
}
],
"endpointTypes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29073,6 +29073,18 @@ public interface SessionIDAttributeCallback extends BaseAttributeCallback {
void onSuccess(@Nullable Long value);
}

public interface SessionDurationAttributeCallback extends BaseAttributeCallback {
void onSuccess(@Nullable Long value);
}

public interface SessionEnergyChargedAttributeCallback extends BaseAttributeCallback {
void onSuccess(@Nullable Long value);
}

public interface SessionEnergyDischargedAttributeCallback extends BaseAttributeCallback {
void onSuccess(@Nullable Long value);
}

public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback {
void onSuccess(List<Long> value);
}
Expand Down Expand Up @@ -29667,76 +29679,76 @@ public void onSuccess(byte[] tlv) {
}

public void readSessionDurationAttribute(
LongAttributeCallback callback) {
SessionDurationAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_DURATION_ATTRIBUTE_ID);

readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
@Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, SESSION_DURATION_ATTRIBUTE_ID, true);
}

public void subscribeSessionDurationAttribute(
LongAttributeCallback callback, int minInterval, int maxInterval) {
SessionDurationAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_DURATION_ATTRIBUTE_ID);

subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
@Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
}
}, SESSION_DURATION_ATTRIBUTE_ID, minInterval, maxInterval);
}

public void readSessionEnergyChargedAttribute(
LongAttributeCallback callback) {
SessionEnergyChargedAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_ENERGY_CHARGED_ATTRIBUTE_ID);

readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
@Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, SESSION_ENERGY_CHARGED_ATTRIBUTE_ID, true);
}

public void subscribeSessionEnergyChargedAttribute(
LongAttributeCallback callback, int minInterval, int maxInterval) {
SessionEnergyChargedAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_ENERGY_CHARGED_ATTRIBUTE_ID);

subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
@Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
}
}, SESSION_ENERGY_CHARGED_ATTRIBUTE_ID, minInterval, maxInterval);
}

public void readSessionEnergyDischargedAttribute(
LongAttributeCallback callback) {
SessionEnergyDischargedAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_ENERGY_DISCHARGED_ATTRIBUTE_ID);

readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
@Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, SESSION_ENERGY_DISCHARGED_ATTRIBUTE_ID, true);
}

public void subscribeSessionEnergyDischargedAttribute(
LongAttributeCallback callback, int minInterval, int maxInterval) {
SessionEnergyDischargedAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_ENERGY_DISCHARGED_ATTRIBUTE_ID);

subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
@Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
}
}, SESSION_ENERGY_DISCHARGED_ATTRIBUTE_ID, minInterval, maxInterval);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6097,26 +6097,26 @@ public String toString() {
}
}
public static class EnergyEvseClusterChargingTargetStruct {
public Integer targetTime;
public Integer targetTimeMinutesPastMidnight;
public Optional<Integer> targetSoC;
public Optional<Long> addedEnergy;
private static final long TARGET_TIME_ID = 0L;
private static final long TARGET_TIME_MINUTES_PAST_MIDNIGHT_ID = 0L;
private static final long TARGET_SO_C_ID = 1L;
private static final long ADDED_ENERGY_ID = 2L;

public EnergyEvseClusterChargingTargetStruct(
Integer targetTime,
Integer targetTimeMinutesPastMidnight,
Optional<Integer> targetSoC,
Optional<Long> addedEnergy
) {
this.targetTime = targetTime;
this.targetTimeMinutesPastMidnight = targetTimeMinutesPastMidnight;
this.targetSoC = targetSoC;
this.addedEnergy = addedEnergy;
}

public StructType encodeTlv() {
ArrayList<StructElement> values = new ArrayList<>();
values.add(new StructElement(TARGET_TIME_ID, new UIntType(targetTime)));
values.add(new StructElement(TARGET_TIME_MINUTES_PAST_MIDNIGHT_ID, new UIntType(targetTimeMinutesPastMidnight)));
values.add(new StructElement(TARGET_SO_C_ID, targetSoC.<BaseTLVType>map((nonOptionaltargetSoC) -> new UIntType(nonOptionaltargetSoC)).orElse(new EmptyType())));
values.add(new StructElement(ADDED_ENERGY_ID, addedEnergy.<BaseTLVType>map((nonOptionaladdedEnergy) -> new IntType(nonOptionaladdedEnergy)).orElse(new EmptyType())));

Expand All @@ -6127,14 +6127,14 @@ public static EnergyEvseClusterChargingTargetStruct decodeTlv(BaseTLVType tlvVal
if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
return null;
}
Integer targetTime = null;
Integer targetTimeMinutesPastMidnight = null;
Optional<Integer> targetSoC = Optional.empty();
Optional<Long> addedEnergy = Optional.empty();
for (StructElement element: ((StructType)tlvValue).value()) {
if (element.contextTagNum() == TARGET_TIME_ID) {
if (element.contextTagNum() == TARGET_TIME_MINUTES_PAST_MIDNIGHT_ID) {
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
UIntType castingValue = element.value(UIntType.class);
targetTime = castingValue.value(Integer.class);
targetTimeMinutesPastMidnight = castingValue.value(Integer.class);
}
} else if (element.contextTagNum() == TARGET_SO_C_ID) {
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
Expand All @@ -6149,7 +6149,7 @@ public static EnergyEvseClusterChargingTargetStruct decodeTlv(BaseTLVType tlvVal
}
}
return new EnergyEvseClusterChargingTargetStruct(
targetTime,
targetTimeMinutesPastMidnight,
targetSoC,
addedEnergy
);
Expand All @@ -6159,8 +6159,8 @@ public static EnergyEvseClusterChargingTargetStruct decodeTlv(BaseTLVType tlvVal
public String toString() {
StringBuilder output = new StringBuilder();
output.append("EnergyEvseClusterChargingTargetStruct {\n");
output.append("\ttargetTime: ");
output.append(targetTime);
output.append("\ttargetTimeMinutesPastMidnight: ");
output.append(targetTimeMinutesPastMidnight);
output.append("\n");
output.append("\ttargetSoC: ");
output.append(targetSoC);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10432,6 +10432,69 @@ public void onError(Exception ex) {
}
}

public static class DelegatedEnergyEvseClusterSessionDurationAttributeCallback implements ChipClusters.EnergyEvseCluster.SessionDurationAttributeCallback, DelegatedClusterCallback {
private ClusterCommandCallback callback;
@Override
public void setCallbackDelegate(ClusterCommandCallback callback) {
this.callback = callback;
}

@Override
public void onSuccess(@Nullable Long value) {
Map<CommandResponseInfo, Object> responseValues = new LinkedHashMap<>();
CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long");
responseValues.put(commandResponseInfo, value);
callback.onSuccess(responseValues);
}

@Override
public void onError(Exception ex) {
callback.onFailure(ex);
}
}

public static class DelegatedEnergyEvseClusterSessionEnergyChargedAttributeCallback implements ChipClusters.EnergyEvseCluster.SessionEnergyChargedAttributeCallback, DelegatedClusterCallback {
private ClusterCommandCallback callback;
@Override
public void setCallbackDelegate(ClusterCommandCallback callback) {
this.callback = callback;
}

@Override
public void onSuccess(@Nullable Long value) {
Map<CommandResponseInfo, Object> responseValues = new LinkedHashMap<>();
CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long");
responseValues.put(commandResponseInfo, value);
callback.onSuccess(responseValues);
}

@Override
public void onError(Exception ex) {
callback.onFailure(ex);
}
}

public static class DelegatedEnergyEvseClusterSessionEnergyDischargedAttributeCallback implements ChipClusters.EnergyEvseCluster.SessionEnergyDischargedAttributeCallback, DelegatedClusterCallback {
private ClusterCommandCallback callback;
@Override
public void setCallbackDelegate(ClusterCommandCallback callback) {
this.callback = callback;
}

@Override
public void onSuccess(@Nullable Long value) {
Map<CommandResponseInfo, Object> responseValues = new LinkedHashMap<>();
CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long");
responseValues.put(commandResponseInfo, value);
callback.onSuccess(responseValues);
}

@Override
public void onError(Exception ex) {
callback.onFailure(ex);
}
}

public static class DelegatedEnergyEvseClusterGeneratedCommandListAttributeCallback implements ChipClusters.EnergyEvseCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback {
private ClusterCommandCallback callback;
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9336,32 +9336,32 @@ private static Map<String, InteractionInfo> readEnergyEvseInteractionInfo() {
InteractionInfo readEnergyEvseSessionDurationAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.EnergyEvseCluster) cluster).readSessionDurationAttribute(
(ChipClusters.LongAttributeCallback) callback
(ChipClusters.EnergyEvseCluster.SessionDurationAttributeCallback) callback
);
},
() -> new ClusterInfoMapping.DelegatedLongAttributeCallback(),
() -> new ClusterInfoMapping.DelegatedEnergyEvseClusterSessionDurationAttributeCallback(),
readEnergyEvseSessionDurationCommandParams
);
result.put("readSessionDurationAttribute", readEnergyEvseSessionDurationAttributeInteractionInfo);
Map<String, CommandParameterInfo> readEnergyEvseSessionEnergyChargedCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readEnergyEvseSessionEnergyChargedAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.EnergyEvseCluster) cluster).readSessionEnergyChargedAttribute(
(ChipClusters.LongAttributeCallback) callback
(ChipClusters.EnergyEvseCluster.SessionEnergyChargedAttributeCallback) callback
);
},
() -> new ClusterInfoMapping.DelegatedLongAttributeCallback(),
() -> new ClusterInfoMapping.DelegatedEnergyEvseClusterSessionEnergyChargedAttributeCallback(),
readEnergyEvseSessionEnergyChargedCommandParams
);
result.put("readSessionEnergyChargedAttribute", readEnergyEvseSessionEnergyChargedAttributeInteractionInfo);
Map<String, CommandParameterInfo> readEnergyEvseSessionEnergyDischargedCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readEnergyEvseSessionEnergyDischargedAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.EnergyEvseCluster) cluster).readSessionEnergyDischargedAttribute(
(ChipClusters.LongAttributeCallback) callback
(ChipClusters.EnergyEvseCluster.SessionEnergyDischargedAttributeCallback) callback
);
},
() -> new ClusterInfoMapping.DelegatedLongAttributeCallback(),
() -> new ClusterInfoMapping.DelegatedEnergyEvseClusterSessionEnergyDischargedAttributeCallback(),
readEnergyEvseSessionEnergyDischargedCommandParams
);
result.put("readSessionEnergyDischargedAttribute", readEnergyEvseSessionEnergyDischargedAttributeInteractionInfo);
Expand Down
Loading

0 comments on commit 2947b9b

Please sign in to comment.