Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.4k 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


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

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...