Skip to content

Commit

Permalink
new: Pigweed RPC signed int support (#12330)
Browse files Browse the repository at this point in the history
Change-Id: I6a5c37af1643a2d2be50bd22c120f4701795d44e

Co-authored-by: Doug Ferraz <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Apr 25, 2023
1 parent 7be38e5 commit 1074191
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 2 deletions.
119 changes: 117 additions & 2 deletions examples/common/pigweed/protos/attributes_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,121 @@ enum AttributeType {
ZCL_UNKNOWN_ATTRIBUTE_TYPE = 0xFF; // Unknown
}

enum ClusterType {
ZCL_INVALID_CLUSTER_ID = 0x0000;
ZCL_POWER_CONFIG_CLUSTER_ID = 0x0001;
ZCL_DEVICE_TEMP_CLUSTER_ID = 0x0002;
ZCL_IDENTIFY_CLUSTER_ID = 0x0003;
ZCL_GROUPS_CLUSTER_ID = 0x0004;
ZCL_SCENES_CLUSTER_ID = 0x0005;
ZCL_ON_OFF_CLUSTER_ID = 0x0006;
ZCL_ON_OFF_SWITCH_CONFIG_CLUSTER_ID = 0x0007;
ZCL_LEVEL_CONTROL_CLUSTER_ID = 0x0008;
ZCL_ALARM_CLUSTER_ID = 0x0009;
ZCL_TIME_CLUSTER_ID = 0x000A;
ZCL_BINARY_INPUT_BASIC_CLUSTER_ID = 0x000F;
ZCL_POWER_PROFILE_CLUSTER_ID = 0x001A;
ZCL_APPLIANCE_CONTROL_CLUSTER_ID = 0x001B;
ZCL_DESCRIPTOR_CLUSTER_ID = 0x001D;
ZCL_POLL_CONTROL_CLUSTER_ID = 0x0020;
ZCL_BRIDGED_ACTIONS_CLUSTER_ID = 0x0025;
ZCL_BASIC_CLUSTER_ID = 0x0028;
ZCL_OTA_PROVIDER_CLUSTER_ID = 0x0029;
ZCL_OTA_REQUESTOR_CLUSTER_ID = 0x002A;
ZCL_POWER_SOURCE_CLUSTER_ID = 0x002F;
ZCL_GENERAL_COMMISSIONING_CLUSTER_ID = 0x0030;
ZCL_NETWORK_COMMISSIONING_CLUSTER_ID = 0x0031;
ZCL_DIAGNOSTIC_LOGS_CLUSTER_ID = 0x0032;
ZCL_GENERAL_DIAGNOSTICS_CLUSTER_ID = 0x0033;
ZCL_SOFTWARE_DIAGNOSTICS_CLUSTER_ID = 0x0034;
ZCL_THREAD_NETWORK_DIAGNOSTICS_CLUSTER_ID = 0x0035;
ZCL_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_ID = 0x0036;
ZCL_ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER_ID = 0x0037;
ZCL_BRIDGED_DEVICE_BASIC_CLUSTER_ID = 0x0039;
ZCL_SWITCH_CLUSTER_ID = 0x003B;
ZCL_ADMINISTRATOR_COMMISSIONING_CLUSTER_ID = 0x003C;
ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID = 0x003E;
ZCL_FIXED_LABEL_CLUSTER_ID = 0x0040;
ZCL_BOOLEAN_STATE_CLUSTER_ID = 0x0045;
ZCL_MODE_SELECT_CLUSTER_ID = 0x0050;
ZCL_SHADE_CONFIG_CLUSTER_ID = 0x0100;
ZCL_DOOR_LOCK_CLUSTER_ID = 0x0101;
ZCL_WINDOW_COVERING_CLUSTER_ID = 0x0102;
ZCL_BARRIER_CONTROL_CLUSTER_ID = 0x0103;
ZCL_PUMP_CONFIG_CONTROL_CLUSTER_ID = 0x0200;
ZCL_THERMOSTAT_CLUSTER_ID = 0x0201;
ZCL_FAN_CONTROL_CLUSTER_ID = 0x0202;
ZCL_DEHUMID_CONTROL_CLUSTER_ID = 0x0203;
ZCL_THERMOSTAT_UI_CONFIG_CLUSTER_ID = 0x0204;
ZCL_COLOR_CONTROL_CLUSTER_ID = 0x0300;
ZCL_BALLAST_CONFIGURATION_CLUSTER_ID = 0x0301;
ZCL_ILLUMINANCE_MEASUREMENT_CLUSTER_ID = 0x0400;
ZCL_TEMP_MEASUREMENT_CLUSTER_ID = 0x0402;
ZCL_PRESSURE_MEASUREMENT_CLUSTER_ID = 0x0403;
ZCL_FLOW_MEASUREMENT_CLUSTER_ID = 0x0404;
ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID = 0x0405;
ZCL_OCCUPANCY_SENSING_CLUSTER_ID = 0x0406;
ZCL_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x040C;
ZCL_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x040D;
ZCL_ETHYLENE_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x040E;
ZCL_ETHYLENE_OXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x040F;
ZCL_HYDROGEN_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0410;
ZCL_HYDROGEN_SULPHIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0411;
ZCL_NITRIC_OXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0412;
ZCL_NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0413;
ZCL_OXYGEN_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0414;
ZCL_OZONE_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0415;
ZCL_SULFUR_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0416;
ZCL_DISSOLVED_OXYGEN_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0417;
ZCL_BROMATE_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0418;
ZCL_CHLORAMINES_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0419;
ZCL_CHLORINE_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x041A;
ZCL_FECAL_COLIFORM_AND_E_COLI_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x041B;
ZCL_FLUORIDE_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x041C;
ZCL_HALOACETIC_ACIDS_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x041D;
ZCL_TOTAL_TRIHALOMETHANES_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x041E;
ZCL_TOTAL_COLIFORM_BACTERIA_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x041F;
ZCL_TURBIDITY_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0420;
ZCL_COPPER_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0421;
ZCL_LEAD_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0422;
ZCL_MANGANESE_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0423;
ZCL_SULFATE_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0424;
ZCL_BROMODICHLOROMETHANE_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0425;
ZCL_BROMOFORM_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0426;
ZCL_CHLORODIBROMOMETHANE_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0427;
ZCL_CHLOROFORM_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0428;
ZCL_SODIUM_CONCENTRATION_MEASUREMENT_CLUSTER_ID = 0x0429;
ZCL_IAS_ZONE_CLUSTER_ID = 0x0500;
ZCL_IAS_ACE_CLUSTER_ID = 0x0501;
ZCL_IAS_WD_CLUSTER_ID = 0x0502;
ZCL_WAKE_ON_LAN_CLUSTER_ID = 0x0503;
ZCL_TV_CHANNEL_CLUSTER_ID = 0x0504;
ZCL_TARGET_NAVIGATOR_CLUSTER_ID = 0x0505;
ZCL_MEDIA_PLAYBACK_CLUSTER_ID = 0x0506;
ZCL_MEDIA_INPUT_CLUSTER_ID = 0x0507;
ZCL_LOW_POWER_CLUSTER_ID = 0x0508;
ZCL_KEYPAD_INPUT_CLUSTER_ID = 0x0509;
ZCL_CONTENT_LAUNCH_CLUSTER_ID = 0x050A;
ZCL_AUDIO_OUTPUT_CLUSTER_ID = 0x050B;
ZCL_APPLICATION_LAUNCHER_CLUSTER_ID = 0x050C;
ZCL_APPLICATION_BASIC_CLUSTER_ID = 0x050D;
ZCL_ACCOUNT_LOGIN_CLUSTER_ID = 0x050E;
ZCL_TEST_CLUSTER_ID = 0x050F;
ZCL_MESSAGING_CLUSTER_ID = 0x0703;
ZCL_APPLIANCE_IDENTIFICATION_CLUSTER_ID = 0x0B00;
ZCL_METER_IDENTIFICATION_CLUSTER_ID = 0x0B01;
ZCL_APPLIANCE_EVENTS_AND_ALERT_CLUSTER_ID = 0x0B02;
ZCL_APPLIANCE_STATISTICS_CLUSTER_ID = 0x0B03;
ZCL_ELECTRICAL_MEASUREMENT_CLUSTER_ID = 0x0B04;
ZCL_BINDING_CLUSTER_ID = 0xF000;
ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID = 0xF004;
ZCL_SAMPLE_MFG_SPECIFIC_CLUSTER_ID = 0xFC00;
}


message AttributeMetadata {
uint32 endpoint = 1;
uint32 cluster = 2;
ClusterType cluster = 2;
uint32 attribute_id = 3;
AttributeType type = 4;
}
Expand All @@ -84,6 +196,9 @@ message AttributeData {
uint32 data_uint16 = 3;
uint32 data_uint32 = 4;
bytes data_bytes = 5;
int32 data_int8 = 6;
int32 data_int16 = 7;
int32 data_int32 = 8;
};
}

Expand All @@ -95,4 +210,4 @@ message AttributeWrite {
service Attributes {
rpc Write(AttributeWrite) returns (pw.protobuf.Empty){}
rpc Read(AttributeMetadata) returns (AttributeData){}
}
}
21 changes: 21 additions & 0 deletions examples/common/pigweed/rpc_services/Attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ class Attributes : public generated::Attributes<Attributes>
case chip_rpc_AttributeData_data_uint32_tag:
data = &request.data.data.data_uint32;
break;
case chip_rpc_AttributeData_data_int8_tag:
data = &request.data.data.data_int8;
break;
case chip_rpc_AttributeData_data_int16_tag:
data = &request.data.data.data_int16;
break;
case chip_rpc_AttributeData_data_int32_tag:
data = &request.data.data.data_int32;
break;
case chip_rpc_AttributeData_data_bytes_tag:
data = &request.data.data.data_bytes;
break;
Expand Down Expand Up @@ -108,9 +117,21 @@ class Attributes : public generated::Attributes<Attributes>
case chip_rpc_AttributeType_ZCL_INT56U_ATTRIBUTE_TYPE:
case chip_rpc_AttributeType_ZCL_INT64U_ATTRIBUTE_TYPE:
case chip_rpc_AttributeType_ZCL_INT8S_ATTRIBUTE_TYPE:
data = &response.data.data_int8;
size = sizeof(response.data.data_int8);
response.which_data = chip_rpc_AttributeData_data_int8_tag;
break;
case chip_rpc_AttributeType_ZCL_INT16S_ATTRIBUTE_TYPE:
data = &response.data.data_int16;
size = sizeof(response.data.data_int16);
response.which_data = chip_rpc_AttributeData_data_int16_tag;
break;
case chip_rpc_AttributeType_ZCL_INT24S_ATTRIBUTE_TYPE:
case chip_rpc_AttributeType_ZCL_INT32S_ATTRIBUTE_TYPE:
data = &response.data.data_int32;
size = sizeof(response.data.data_int32);
response.which_data = chip_rpc_AttributeData_data_int32_tag;
break;
case chip_rpc_AttributeType_ZCL_INT40S_ATTRIBUTE_TYPE:
case chip_rpc_AttributeType_ZCL_INT48S_ATTRIBUTE_TYPE:
case chip_rpc_AttributeType_ZCL_INT56S_ATTRIBUTE_TYPE:
Expand Down

0 comments on commit 1074191

Please sign in to comment.