Skip to content

Commit c4dae19

Browse files
ravichandhraReanJonathanHenson
authored andcommitted
Updated s_changeShadowValue method (#47)
* Updated s_changeShadowValue method Updated s_changeShadowValue method to construct updateShadowRequest using ShadowState instead of using completely JsonObject * Updated thingName.c_str() with just thingName * run shadow_sync sample with clang-format
1 parent 74bcc22 commit c4dae19

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

samples/shadow/shadow_sync/main.cpp

+9-10
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,19 @@ static void s_changeShadowValue(
8080
{
8181
fprintf(stdout, "Changing local shadow value to %s.\n", value.c_str());
8282

83-
UpdateShadowRequest updateShadowRequest;
84-
Aws::Crt::UUID uuid;
85-
updateShadowRequest.ClientToken = uuid.ToString();
86-
87-
JsonObject stateDocument;
88-
JsonObject reported;
89-
reported.WithString(shadowProperty, value);
90-
stateDocument.WithObject("reported", std::move(reported));
83+
ShadowState state;
9184
JsonObject desired;
9285
desired.WithString(shadowProperty, value);
93-
stateDocument.WithObject("desired", std::move(desired));
86+
JsonObject reported;
87+
reported.WithString(shadowProperty, value);
88+
state.Desired = desired;
89+
state.Reported = reported;
9490

95-
updateShadowRequest.State = std::move(stateDocument);
91+
UpdateShadowRequest updateShadowRequest;
92+
Aws::Crt::UUID uuid;
93+
updateShadowRequest.ClientToken = uuid.ToString();
9694
updateShadowRequest.ThingName = thingName;
95+
updateShadowRequest.State = state;
9796

9897
auto publishCompleted = [thingName, value](int ioErr) {
9998
if (ioErr != AWS_OP_SUCCESS)

0 commit comments

Comments
 (0)