Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ADU device props to GA fields #2437

Merged
merged 2 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sdk/src/azure/iot/az_iot_adu_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
/* Define the ADU agent component name. */
#define AZ_IOT_ADU_CLIENT_AGENT_COMPONENT_NAME "deviceUpdate"

#define AZ_IOT_ADU_CLIENT_AGENT_INTERFACE_ID "dtmi:azure:iot:deviceUpdate;1"
#define AZ_IOT_ADU_CLIENT_AGENT_CONTRACT_MODEL_ID "dtmi:azure:iot:deviceUpdateContractModel;2"

/* Define the ADU agent property name "agent" and sub property names. */
#define AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_AGENT "agent"

#define AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_DEVICEPROPERTIES "deviceProperties"
#define AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_MANUFACTURER "manufacturer"
#define AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_MODEL "model"
#define AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_INTERFACE_ID "interfaceId"
#define AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_CONTRACT_MODEL_ID "contractModelId"
#define AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_ADU_VERSION "aduVer"
#define AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_DO_VERSION "doVer"

Expand Down Expand Up @@ -206,9 +206,9 @@ AZ_NODISCARD az_result az_iot_adu_client_get_agent_state_payload(
}

_az_RETURN_IF_FAILED(az_json_writer_append_property_name(
ref_json_writer, AZ_SPAN_FROM_STR(AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_INTERFACE_ID)));
ref_json_writer, AZ_SPAN_FROM_STR(AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_CONTRACT_MODEL_ID)));
_az_RETURN_IF_FAILED(az_json_writer_append_string(
ref_json_writer, AZ_SPAN_FROM_STR(AZ_IOT_ADU_CLIENT_AGENT_INTERFACE_ID)));
ref_json_writer, AZ_SPAN_FROM_STR(AZ_IOT_ADU_CLIENT_AGENT_CONTRACT_MODEL_ID)));

_az_RETURN_IF_FAILED(az_json_writer_append_property_name(
ref_json_writer, AZ_SPAN_FROM_STR(AZ_IOT_ADU_CLIENT_AGENT_PROPERTY_NAME_ADU_VERSION)));
Expand Down
9 changes: 6 additions & 3 deletions sdk/tests/iot/adu/test_az_iot_adu.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@

static uint8_t expected_agent_state_payload[]
= "{\"deviceUpdate\":{\"__t\":\"c\",\"agent\":{\"deviceProperties\":{\"manufacturer\":"
"\"Contoso\",\"model\":\"Foobar\",\"interfaceId\":\"dtmi:azure:iot:deviceUpdate;1\","
"\"Contoso\",\"model\":\"Foobar\",\"contractModelId\":\"dtmi:azure:iot:"
"deviceUpdateContractModel;2\","
"\"aduVer\":\"DU;agent/"
"1.0.0\"},\"compatPropertyNames\":\"manufacturer,model\",\"state\":0,"
"\"installedUpdateId\":\"{\\\"provider\\\":\\\"Contoso\\\",\\\"name\\\":\\\"Foobar\\\","
"\\\"version\\\":\\\"1.0\\\"}\"}}}";
static uint8_t expected_agent_state_long_payload[]
= "{\"deviceUpdate\":{\"__t\":\"c\",\"agent\":{\"deviceProperties\":{\"manufacturer\":"
"\"Contoso\",\"model\":\"Foobar\",\"interfaceId\":\"dtmi:azure:iot:deviceUpdate;1\","
"\"Contoso\",\"model\":\"Foobar\",\"contractModelId\":\"dtmi:azure:iot:"
"deviceUpdateContractModel;2\","
"\"aduVer\":\"DU;agent/"
"1.0.0\"},\"compatPropertyNames\":\"manufacturer,model\","
"\"lastInstallResult\":{\"resultCode\":0,\"extendedResultCode\":1234,\"resultDetails\":"
Expand All @@ -46,7 +48,8 @@ static uint8_t expected_agent_state_long_payload[]
"\\\"version\\\":\\\"1.0\\\"}\"}}}";
static uint8_t expected_agent_state_long_payload_with_retry[]
= "{\"deviceUpdate\":{\"__t\":\"c\",\"agent\":{\"deviceProperties\":{\"manufacturer\":"
"\"Contoso\",\"model\":\"Foobar\",\"interfaceId\":\"dtmi:azure:iot:deviceUpdate;1\","
"\"Contoso\",\"model\":\"Foobar\",\"contractModelId\":\"dtmi:azure:iot:"
"deviceUpdateContractModel;2\","
"\"aduVer\":\"DU;agent/"
"1.0.0\"},\"compatPropertyNames\":\"manufacturer,model\","
"\"lastInstallResult\":{\"resultCode\":0,\"extendedResultCode\":1234,\"resultDetails\":"
Expand Down