Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

aws sdk - Set up Named Shadow from AWS C++ SDK

I'm setting up a AWS Named Shadow (C++) Connection. I'm very new to this area and would like to get some clarification about the required processes. Because the aws-iot-device-sdk-cpp-v2 example is a bit confusing: https://github.com/aws/aws-iot-device-sdk-cpp-v2/

From my understanding, I will need a MQTT Client Class that has valid Network Connection. The MQTT Client will be responsible of connecting/disconnecting to the AWS MQTT broker. MQTT Client Class example: https://github.com/aws/aws-iot-device-sdk-cpp/blob/master/include/mqtt/Client.hpp

Then I need to create the Shadow Class to initialize the Shadow topics:

#define SHADOW_REQUEST_TYPE_GET_STRING "get"
#define SHADOW_REQUEST_TYPE_UPDATE_STRING "update"
#define SHADOW_REQUEST_TYPE_DELETE_STRING "delete"
#define SHADOW_REQUEST_TYPE_DELTA_STRING "delta"

#define SHADOW_RESPONSE_TYPE_ACCEPTED_STRING "accepted"
#define SHADOW_RESPONSE_TYPE_REJECTED_STRING "rejected"

#define SHADOW_TOPIC_PREFIX "$aws/things/"
#define SHADOW_TOPIC_MIDDLE "/shadow/"

At the Shadow Class point I'm not sure what I need to do to implement the Named Shadow. Do I create another class same as the Shadow Class but with different SHADOW_TOPIC_MIDDLE say SHADOW_TOPIC_MIDDLE "/shadow/name" to enable the Named Shadow feature?

This is the Shadow Class code example I was looking into:https://github.com/aws/aws-iot-device-sdk-cpp/blob/master/src/shadow/Shadow.cpp Here is the main.c that will drive the Shadow: https://github.com/aws/aws-iot-device-sdk-cpp-v2/blob/main/samples/shadow/shadow_sync/main.cpp

question from:https://stackoverflow.com/questions/65855262/set-up-named-shadow-from-aws-c-sdk

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...