$rrpc/rxd/${productID}/${deviceName}/+ is used to subscribe to RRPC request messages sent by the cloud (downstream).$rrpc/rxd/${productID}/${deviceName}/${processID} is used for the cloud to publish (downstream) RRPC request messages.$rrpc/txd/${productID}/${deviceName}/${processID} is used to publish (upstream) RRPC response messages.${productID}: product ID${deviceName}: device name${processID}: unique message ID generated by the server to identify different RRPC messages. The corresponding RRPC request message can be found through the processID carried in the RRPC response message.processID distributed by the cloud in the request message topic, sets it as the processID of the response message topic, and publishes a return message of the device to the response message topic.processID and sends the return message to the server.
airConditioner1 device as instructed in Device Interconnection.CMakeLists.txt and make sure that the following options exist:set(BUILD_TYPE "release")set(COMPILE_TOOLS "gcc")set(PLATFORM "linux")set(FEATURE_MQTT_COMM_ENABLED ON)set(FEATURE_RRPC_ENABLED ON)set(FEATURE_AUTH_MODE "KEY")set(FEATURE_AUTH_WITH_NOTLS OFF)set(FEATURE_DEBUG_DEV_INFO_USED OFF)
./cmake_build.sh
rrpc_sample is in the output/release/bin folder.airConditioner1 device created above in the JSON file aircond_device_info1.json.{"auth_mode":"KEY","productId":"KL4J2****8","deviceName":"airConditioner1","key_deviceinfo":{"deviceSecret":"zOZXUaycuwleP****78dBA=="}}
rrpc_sample demoairConditioner1 device has subscribed to the RRPC message and then entered the waiting status../rrpc_sample -c ./aircond_device_info1.json -l 1000INF|2020-08-03 23:57:55|qcloud_iot_device.c|iot_device_info_set(50): SDK_Ver: 3.2.0, Product_ID: KL4J2****8, Device_Name: airConditioner1DBG|2020-08-03 23:57:55|HAL_TLS_mbedtls.c|HAL_TLS_Connect(200): Setting up the SSL/TLS structure...DBG|2020-08-03 23:57:55|HAL_TLS_mbedtls.c|HAL_TLS_Connect(242): Performing the SSL/TLS handshake...DBG|2020-08-03 23:57:55|HAL_TLS_mbedtls.c|HAL_TLS_Connect(243): Connecting to /KL4J2****8.iotcloud.tencentdevices.com/8883...INF|2020-08-03 23:57:55|HAL_TLS_mbedtls.c|HAL_TLS_Connect(265): connected with /KL4J2****8.iotcloud.tencentdevices.com/8883...INF|2020-08-03 23:57:56|mqtt_client.c|IOT_MQTT_Construct(113): mqtt connect with id: 2**** successINF|2020-08-03 23:57:56|rrpc_sample.c|main(206): Cloud Device Construct SuccessDBG|2020-08-03 23:57:56|mqtt_client_subscribe.c|qcloud_iot_mqtt_subscribe(142): topicName=$rrpc/rxd/KL4J2****8/airConditioner1/+|packet_id=****INF|2020-08-03 23:57:56|rrpc_sample.c|_mqtt_event_handler(49): subscribe success, packet-id=*****DBG|2020-08-03 23:57:56|rrpc_client.c|_rrpc_event_callback(104): rrpc topic subscribe success
PublishRRPCMessage to send an RRPC request messageairConditioner1 device, and you can see that the RRPC request message has been received, and the processID is ***.DBG|2020-08-04 00:07:36|rrpc_client.c|_rrpc_message_cb(85): topic=$rrpc/rxd/KL4J2****8/airConditioner1/***INF|2020-08-04 00:07:36|rrpc_client.c|_rrpc_message_cb(86): len=6, topic_msg=closedINF|2020-08-04 00:07:36|rrpc_client.c|_rrpc_get_process_id(76): len=3, process id=***INF|2020-08-04 00:07:36|rrpc_sample.c|_rrpc_message_handler(137): rrpc message=closed
airConditioner1 device, and you can see that the RRPC request message has been processed, the RRPC response message has been replied, and the processID is ***.DBG|2020-08-04 00:07:36|mqtt_client_publish.c|qcloud_iot_mqtt_publish(340): publish packetID=0|topicName=$rrpc/txd/KL4J2****8/airConditioner1/***|payload=ok
MessageId is ***, and Payload is **** after being Base64-encoded, which is the same as the actual response message of the client after being Base64-encoded. At this point, it can be confirmed that the response message has been received.Feedback