亚马逊 AWS IoT物联网解决方案

AWS IoT 提供将您的物联网设备连接到其他设备和 AWS 云服务的云服务。 AWS IoT 提供设备软件,可帮助您将物联网设备集成到 AWS IoT基于解决方案的解决方案中。如果您的设备可以连接 AWS IoT,则 AWS IoT 可以将它们连接到 AWS 提供的云服务。

在这里插入图片描述


参考

利用 Amazon IoT 生命周期事件和 LWT 管理设备状态

AWS IOT 离线检测功能(MQTT 遗言)


嵌入式端遗言pWillInfo设置

MQTTStatus_t MQTT_Connect( MQTTContext_t * pContext,
                         const MQTTConnectInfo_t * pConnectInfo,
                         const MQTTPublishInfo_t * pWillInfo,
                         uint32_t timeoutMs,
                         bool * pSessionPresent )
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/f51023561e7045b997ae690130f4fc14.png)

MQTTPublishInfo数据结构


/**
* @ingroup mqtt_struct_types
* @brief MQTT PUBLISH packet parameters.
*/
typedef struct MQTTPublishInfo
{
  /**
   * @brief Quality of Service for message.
   */
  MQTTQoS_t qos;

  /**
   * @brief Whether this is a retained message.
   */
  bool retain;

  /**
   * @brief Whether this is a duplicate publish message.
   */
  bool dup;

  /**
   * @brief Topic name on which the message is published.
   */
  const char * pTopicName;

  /**
   * @brief Length of topic name.
   */
  uint16_t topicNameLength;

  /**
   * @brief Message payload.
   */
  const void * pPayload;

  /**
   * @brief Message payload length.
   */
  size_t payloadLength;
} MQTTPublishInfo_t;

更多推荐