Skip to content

Commit a4b28fe

Browse files
Sergiy Pastukhsilabs-borisl
authored andcommitted
GH-43: UCL XML API mismatch some enums parsed as integer
Bug-SiliconLabs: UIC-2725 Bug-GitHub: #43 Signed-off-by: Philippe Coval <philippe.coval@silabs.com>
1 parent 10dea47 commit a4b28fe

24 files changed

+193
-123
lines changed

applications/dev_ui/dev_gui/zap-generated/src/cluster-types/cluster-type-attributes.ts

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//This file is generated automatically. Don't try to change something here.
22
//To add support for new clusters, modify addon-helper.js
33
//To change the stucture of the ClusterTypeAttrs, modify cluster-type-attributes.zapt
4-
4+
55

66
//generate ClusterTypes
77
export let ClusterTypeAttrs: any = {
@@ -7258,21 +7258,13 @@ export let ClusterTypeAttrs: any = {
72587258
type: "enum",
72597259
isArray: false,
72607260
enum:[
7261-
{
7262-
name: "Available",
7263-
value: 0
7264-
},
72657261
{
72667262
name: "OccupiedEnabled",
72677263
value: 1
72687264
},
72697265
{
72707266
name: "OccupiedDisabled",
72717267
value: 3
7272-
},
7273-
{
7274-
name: "NotSupported",
7275-
value: 255
72767268
}
72777269
],
72787270
},
@@ -7719,21 +7711,13 @@ export let ClusterTypeAttrs: any = {
77197711
type: "enum",
77207712
isArray: false,
77217713
enum:[
7722-
{
7723-
name: "Available",
7724-
value: 0
7725-
},
77267714
{
77277715
name: "OccupiedEnabled",
77287716
value: 1
77297717
},
77307718
{
77317719
name: "OccupiedDisabled",
77327720
value: 3
7733-
},
7734-
{
7735-
name: "NotSupported",
7736-
value: 255
77377721
}
77387722
],
77397723
},
@@ -9933,18 +9917,14 @@ export let ClusterTypeAttrs: any = {
99339917
{
99349918
id: 16387,
99359919
name: "ColorLoopDirection",
9936-
type: "enum",
9920+
type: "number",
99379921
max: 255,
99389922
required: false,
99399923
reportRequired: false,
99409924
sceneRequired: true,
99419925
writable: false,
99429926
isArray: false,
99439927
default: 0,
9944-
enum: [
9945-
{ name: "DecrementEnhancedCurrentHue", value: 0},
9946-
{ name: "IncrementEnhancedCurrentHue", value: 1}
9947-
],
99489928
},
99499929
{
99509930
id: 16388,
@@ -10906,11 +10886,11 @@ export let ClusterTypeAttrs: any = {
1090610886
isArray: false,
1090710887
enum:[
1090810888
{
10909-
name: "DecrementEnhancedCurrentHue",
10889+
name: "ColorLoopHueDecrement",
1091010890
value: 0
1091110891
},
1091210892
{
10913-
name: "IncrementEnhancedCurrentHue",
10893+
name: "ColorLoopHueIncrement",
1091410894
value: 1
1091510895
}
1091610896
],

applications/zigpc/components/attribute_management/zap-generated/src/zigpc_attrmgmt_publish.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2189,8 +2189,8 @@ sl_status_t zigpc_attrmgmt_color_control_publish(const char* unid_ep_topic, cons
21892189
break;
21902190
case ZIGPC_ZCL_CLUSTER_COLOR_CONTROL_ATTR_COLOR_LOOP_DIRECTION:
21912191
{
2192-
CCColorLoopDirection value;
2193-
memcpy(&value, attr_value, sizeof(CCColorLoopDirection));
2192+
uint8_t value;
2193+
memcpy(&value, attr_value, sizeof(uint8_t));
21942194
status = uic_mqtt_dotdot_color_control_color_loop_direction_publish(unid_ep_topic, value, UCL_MQTT_PUBLISH_TYPE_REPORTED);
21952195
}
21962196
break;

applications/zigpc/components/command_mapper/zap-generated/src/zigpc_command_mapper_handlers.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5570,7 +5570,7 @@ sl_status_t zigpc_command_mapper_door_lock_clear_all_rfid_codes_handler(
55705570
55715571
* @param user_uniqueid Command argument of type uint32_t
55725572
5573-
* @param user_status Command argument of type DrlkUserStatus
5573+
* @param user_status Command argument of type DrlkSettableUserStatus
55745574
55755575
* @param user_type Command argument of type DrlkUserType
55765576
@@ -5591,7 +5591,7 @@ sl_status_t zigpc_command_mapper_door_lock_set_user_handler(
55915591

55925592
uint32_t user_uniqueid,
55935593

5594-
DrlkUserStatus user_status,
5594+
DrlkSettableUserStatus user_status,
55955595

55965596
DrlkUserType user_type,
55975597

@@ -5750,7 +5750,7 @@ sl_status_t zigpc_command_mapper_door_lock_clear_user_handler(
57505750
57515751
* @param user_index Command argument of type uint16_t
57525752
5753-
* @param user_status Command argument of type DrlkUserStatus
5753+
* @param user_status Command argument of type DrlkSettableUserStatus
57545754
57555755
* @param user_type Command argument of type DrlkUserType
57565756
* @return SL_STATUS_OK if callback_type == UIC_MQTT_DOTDOT_CALLBACK_TYPE_NORMAL and call is successful
@@ -5769,7 +5769,7 @@ sl_status_t zigpc_command_mapper_door_lock_set_credential_handler(
57695769

57705770
uint16_t user_index,
57715771

5772-
DrlkUserStatus user_status,
5772+
DrlkSettableUserStatus user_status,
57735773

57745774
DrlkUserType user_type
57755775

components/uic_dotdot/dotdot-xml/ColorControl.xml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ applicable to this document can be found in the LICENSE.md file.
5555
<type:maxInclusiveRef ref="ColorTempPhysicalMaxMireds" />
5656
</restriction>
5757
</type:type>
58-
<type:type short="CCColorLoopDirection" name="CCColorLoopDirection" id="20" inheritsFrom="uint8">
58+
<type:type short="CCColorLoopDirection" name="CCColorLoopDirection" id="20" inheritsFrom="enum8">
5959
<restriction>
60-
<type:enumeration value="00" name="DecrementEnhancedCurrentHue" />
61-
<type:enumeration value="01" name="IncrementEnhancedCurrentHue" />
60+
<type:enumeration value="00" name="ColorLoopHueDecrement" />
61+
<type:enumeration value="01" name="ColorLoopHueIncrement" />
6262
</restriction>
6363
</type:type>
6464

@@ -115,7 +115,12 @@ applicable to this document can be found in the LICENSE.md file.
115115
<type:enumeration value="01" name="ColorLoopActive" />
116116
</restriction>
117117
</attribute>
118-
<attribute id="4003" name="ColorLoopDirection" type="CCColorLoopDirection" max="255" sceneRequired="true" default="0" requiredIf="ColorCapabilities.ColorLoopSupported = true" />
118+
<attribute id="4003" name="ColorLoopDirection" type="uint8" max="255" sceneRequired="true" default="0" requiredIf="ColorCapabilities.ColorLoopSupported = true">
119+
<restriction>
120+
<type:enumeration value="00" name="DecrementEnhancedCurrentHue" />
121+
<type:enumeration value="01" name="IncrementEnhancedCurrentHue" />
122+
</restriction>
123+
</attribute>
119124
<attribute id="4004" name="ColorLoopTime" type="uint16" max="65535" sceneRequired="true" default="25" requiredIf="ColorCapabilities.ColorLoopSupported = true" />
120125
<attribute id="4005" name="ColorLoopStartEnhancedHue" type="uint16" max="65535" default="8960" requiredIf="ColorCapabilities.ColorLoopSupported = true" />
121126
<attribute id="4006" name="ColorLoopStoredEnhancedHue" type="uint16" max="65535" default="0" requiredIf="ColorCapabilities.ColorLoopSupported = true" />

components/uic_dotdot/dotdot-xml/DoorLock.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ applicable to this document can be found in the LICENSE.md file.
5050
</restriction>
5151
</type:type>
5252

53-
<type:type short="DrlkUserStatus" name="DrlkUserStatus" id="20" inheritsFrom="uint8">
53+
<type:type short="DrlkUserStatus" name="DrlkUserStatus" id="20" inheritsFrom="enum8">
5454
<restriction>
5555
<type:enumeration value="00" name="Available" />
5656
<type:enumeration value="01" name="OccupiedEnabled" />
@@ -60,7 +60,7 @@ applicable to this document can be found in the LICENSE.md file.
6060
</restriction>
6161
</type:type>
6262

63-
<type:type short="DrlkSettableUserStatus" name="DrlkSettableUserStatus" id="20" inheritsFrom="uint8">
63+
<type:type short="DrlkSettableUserStatus" name="DrlkSettableUserStatus" id="20" inheritsFrom="enum8">
6464
<restriction>
6565
<type:enumeration value="01" name="OccupiedEnabled" />
6666
<!-- 02 is not defined. -->
@@ -641,7 +641,7 @@ applicable to this document can be found in the LICENSE.md file.
641641
<field name="UserIndex" type="uint16" />
642642
<field name="UserName" type="string" />
643643
<field name="UserUniqueID" type="uint32" />
644-
<field name="UserStatus" type="DrlkUserStatus" />
644+
<field name="UserStatus" type="DrlkSettableUserStatus" />
645645
<field name="UserType" type="DrlkUserType" />
646646
<field name="CredentialRule" type="CredentialRuleEnum" />
647647
</fields>
@@ -662,7 +662,7 @@ applicable to this document can be found in the LICENSE.md file.
662662
<field name="Credential" type="CredentialStruct" />
663663
<field name="CredentialData" type="octstr" />
664664
<field name="UserIndex" type="uint16" />
665-
<field name="UserStatus" type="DrlkUserStatus" />
665+
<field name="UserStatus" type="DrlkSettableUserStatus" />
666666
<field name="UserType" type="DrlkUserType" />
667667
</fields>
668668
</command>

components/uic_dotdot/zap-generated/include/zap-types.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,8 @@ typedef enum {
408408

409409
// Enum for CCColorLoopDirection
410410
typedef enum {
411-
ZCL_CC_COLOR_LOOP_DIRECTION_DECREMENT_ENHANCED_CURRENT_HUE = 0,
412-
ZCL_CC_COLOR_LOOP_DIRECTION_INCREMENT_ENHANCED_CURRENT_HUE = 1,
411+
ZCL_CC_COLOR_LOOP_DIRECTION_COLOR_LOOP_HUE_DECREMENT = 0,
412+
ZCL_CC_COLOR_LOOP_DIRECTION_COLOR_LOOP_HUE_INCREMENT = 1,
413413
} CCColorLoopDirection;
414414

415415
// Enum for CCDirection
@@ -439,6 +439,12 @@ typedef enum {
439439
ZCL_COLOR_CONTROL_COLOR_LOOP_ACTIVE_COLOR_LOOP_ACTIVE = 1,
440440
} ColorControlColorLoopActive;
441441

442+
// Enum for ColorControlColorLoopDirection
443+
typedef enum {
444+
ZCL_COLOR_CONTROL_COLOR_LOOP_DIRECTION_DECREMENT_ENHANCED_CURRENT_HUE = 0,
445+
ZCL_COLOR_CONTROL_COLOR_LOOP_DIRECTION_INCREMENT_ENHANCED_CURRENT_HUE = 1,
446+
} ColorControlColorLoopDirection;
447+
442448
// Enum for ColorControlColorMode
443449
typedef enum {
444450
ZCL_COLOR_CONTROL_COLOR_MODE_CURRENT_HUE_AND_CURRENT_SATURATION = 0,

components/uic_dotdot/zap-generated/readme_ucl_mqtt_reference.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16831,7 +16831,7 @@ mosquitto_sub -t 'ucl/by-unid/<UNID>/<EP>/DoorLock/GeneratedCommands/ClearAllRFI
1683116831
"type": "integer"
1683216832
},
1683316833
"UserStatus": {
16834-
"type": "DrlkUserStatus"
16834+
"type": "DrlkSettableUserStatus"
1683516835
},
1683616836
"UserType": {
1683716837
"type": "DrlkUserType"
@@ -17157,7 +17157,7 @@ mosquitto_sub -t 'ucl/by-unid/<UNID>/<EP>/DoorLock/GeneratedCommands/Programming
1715717157
"type": "integer"
1715817158
},
1715917159
"UserStatus": {
17160-
"type": "DrlkUserStatus"
17160+
"type": "DrlkSettableUserStatus"
1716117161
},
1716217162
"UserType": {
1716317163
"type": "DrlkUserType"
@@ -27238,7 +27238,7 @@ ucl/by-unid/<UNID>/ep0/ColorControl/Attributes/ColorLoopActive/Reported { "value
2723827238
"type": "object",
2723927239
"properties": {
2724027240
"value": {
27241-
"type": "CCColorLoopDirection"
27241+
"type": "integer"
2724227242
}
2724327243
},
2724427244
"required": [
@@ -55008,8 +55008,8 @@ mosquitto_pub -t 'ucl/by-unid/<UNID>/<EP>/Descriptor/Commands/ForceReadAttribute
5500855008
"title": "CCColorLoopDirection Enum Properties",
5500955009
"type": "string",
5501055010
"enum": [
55011-
"DecrementEnhancedCurrentHue",
55012-
"IncrementEnhancedCurrentHue"
55011+
"ColorLoopHueDecrement",
55012+
"ColorLoopHueIncrement"
5501355013
]
5501455014
}
5501555015
```
@@ -55115,6 +55115,29 @@ mosquitto_pub -t 'ucl/by-unid/<UNID>/<EP>/Descriptor/Commands/ForceReadAttribute
5511555115

5511655116
<br><br>
5511755117

55118+
<!-- -->
55119+
<!-- START OF Enum ColorControlColorLoopDirection Section -->
55120+
<!-- -->
55121+
\section enum_color_control_color_loop_direction ColorControlColorLoopDirection Enum
55122+
55123+
```json
55124+
{
55125+
"$schema": "http://json-schema.org/draft-07/schema#",
55126+
"title": "ColorControlColorLoopDirection Enum Properties",
55127+
"type": "string",
55128+
"enum": [
55129+
"DecrementEnhancedCurrentHue",
55130+
"IncrementEnhancedCurrentHue"
55131+
]
55132+
}
55133+
```
55134+
55135+
<!-- -->
55136+
<!-- END OF Enum ColorControlColorLoopDirection Section -->
55137+
<!-- -->
55138+
55139+
<br><br>
55140+
5511855141
<!-- -->
5511955142
<!-- START OF Enum ColorControlColorMode Section -->
5512055143
<!-- -->

components/uic_dotdot/zap-generated/src/dotdot_attribute_id_definitions.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6622,9 +6622,6 @@ bool uic_dotdot_attribute_is_enum(dotdot_cluster_id_t cluster_id,
66226622
if (16385 == attribute_id) {
66236623
return true;
66246624
}
6625-
if (16387 == attribute_id) {
6626-
return true;
6627-
}
66286625
}
66296626

66306627
if (769 == cluster_id) {

components/uic_dotdot/zap/addon-base-helper.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ function asUnderlyingType(arg) {
6868
* - bitmap types
6969
*/
7070
zcl_type_map = (function() {
71-
/* FIXME: Type-workarounds where ZAP fails to properly create our required
72-
* types.
73-
*/
71+
/* FIXME: Type-workarounds where ZAP fails to properly create our required types. */
7472
const _map = {
7573
CCMinMiredsField: 'uint16',
7674
CCMaxMiredsField: 'uint16',

components/uic_dotdot_mqtt/test/dotdot_mqtt_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ void test_dotdot_mqtt_bitmaps_commands()
555555
"UpdateStartHue": false
556556
},
557557
"Action": "ActivateColorLoopFromColorLoopStartEnhancedHue",
558-
"Direction": "IncrementEnhancedCurrentHue",
558+
"Direction": "ColorLoopHueIncrement",
559559
"Time": 1,
560560
"StartHue": 0,
561561
"OptionsMask": "0",
@@ -577,7 +577,7 @@ void test_dotdot_mqtt_bitmaps_commands()
577577
TEST_ASSERT_EQUAL(
578578
ZCL_COLOR_LOOP_SET_ACTION_ACTIVATE_COLOR_LOOP_FROM_COLOR_LOOP_START_ENHANCED_HUE,
579579
action_status);
580-
TEST_ASSERT_EQUAL(ZCL_CC_COLOR_LOOP_DIRECTION_INCREMENT_ENHANCED_CURRENT_HUE,
580+
TEST_ASSERT_EQUAL(ZCL_CC_COLOR_LOOP_DIRECTION_COLOR_LOOP_HUE_INCREMENT,
581581
direction_status);
582582
TEST_ASSERT_EQUAL(time_payload_state, time_state);
583583
TEST_ASSERT_EQUAL(start_hue_payload_state, start_hue_state);

0 commit comments

Comments
 (0)