Azure_IoT_Central_ESP32調査 その2

これの続き。

matsujirushi.hatenablog.jp

AzureIoT

使い勝手は良さそう。
MQTTからの通知がesp_mqttに合わせてある。他のMQTTライブラリで使おうとしたときに、うまく適合できるかは未知。(ノンブロックでコールバック形式じゃないライブラリと組み合わせるのは辛いか?)

基本

  • azure_iot_init()
  • azure_iot_start()
  • azure_iot_stop()
  • azure_iot_do_work()

状態

  • azure_iot_status_t azure_iot_get_status()
    • azure_iot_disconnected
    • azure_iot_connecting
    • azure_iot_connected
    • azure_iot_error

操作

  • azure_iot_send_telemetry(az_span message)
  • azure_iot_send_properties_update(uint32_t request_id, az_span message)
  • azure_iot_send_command_response(az_span request_id, uint16_t response_status, az_span payload)

MQTTからの通知

  • azure_iot_mqtt_client_connected()
  • azure_iot_mqtt_client_disconnected()
  • azure_iot_mqtt_client_subscribe_completed(int packet_id)
  • azure_iot_mqtt_client_publish_completed(int packet_id)
  • azure_iot_mqtt_client_message_received(mqtt_message_t* mqtt_message)
    • az_span topic
    • az_span payload
    • mqtt_qos_t qos

これらは、esp_mqttのevent_handleから呼び出している。

Azure_IoT_PnP_Template

全てAzure_IoT_Central_ESP32.inoから呼ばれている。Azure IoTからの呼び出しは無し。(つまり、Azure_IoT_PnP_TemplateはAzure IoTに依存しない。)

  • azure_pnp_init() <--- Azure_IoT_Central_ESP32.ino
  • azure_pnp_get_model_id() <--- Azure_IoT_Central_ESP32.ino
  • azure_pnp_send_device_info() <--- Azure_IoT_Central_ESP32.ino
  • azure_pnp_set_telemetry_frequency() <--- Azure_IoT_PnP_Template.cpp
  • azure_pnp_send_telemetry() <--- Azure_IoT_Central_ESP32.ino
  • azure_pnp_handle_command_request() <--- Azure_IoT_Central_ESP32.ino
  • azure_pnp_handle_properties_update() <--- Azure_IoT_Central_ESP32.ino