├── .gitignore ├── .readthedocs.yml ├── .vscode └── settings.json ├── LICENSE ├── README.docs.md ├── README.md ├── README_CN.md ├── TODO ├── components └── tbcmh │ ├── CMakeLists.txt │ ├── README.md │ ├── README_CN.md │ ├── component.mk │ ├── esp-mqtt_api.ods │ ├── include │ ├── tbc_extension.h │ ├── tbc_extension_clientattributes.h │ ├── tbc_extension_sharedattributes.h │ ├── tbc_extension_timeseriesdata.h │ ├── tbc_mqtt_helper.h │ ├── tbc_mqtt_protocol.h │ ├── tbc_transport_config.h │ └── tbc_utils.h │ ├── src │ ├── extension │ │ ├── tbc_extension_clientattributes.c │ │ ├── tbc_extension_sharedattributes.c │ │ └── tbc_extension_timeseriesdata.c │ ├── helper │ │ ├── attributes_request.c │ │ ├── attributes_request.h │ │ ├── attributes_subscribe.c │ │ ├── attributes_subscribe.h │ │ ├── attributes_update.c │ │ ├── attributes_update.h │ │ ├── claiming_device.c │ │ ├── claiming_device.h │ │ ├── client_rpc.c │ │ ├── client_rpc.h │ │ ├── ota_fwupdate.c │ │ ├── ota_fwupdate.h │ │ ├── ota_update.c │ │ ├── ota_update.h │ │ ├── provision_request.c │ │ ├── provision_request.h │ │ ├── server_rpc.c │ │ ├── server_rpc.h │ │ ├── tbc_mqtt_helper.c │ │ ├── tbc_mqtt_helper_internal.h │ │ ├── telemetry_upload.c │ │ └── telemetry_upload.h │ ├── transport │ │ ├── tbc_transport_config.c │ │ ├── tbc_transport_storage.c │ │ └── tbc_transport_storage.h │ └── wapper │ │ ├── tbc_mqtt_payload_buffer.c │ │ ├── tbc_mqtt_payload_buffer.h │ │ ├── tbc_mqtt_wapper.c │ │ └── tbc_mqtt_wapper.h │ └── test │ ├── CMakeLists.txt │ ├── component.mk │ └── test_tb_mqtt_client.c ├── docs ├── Makefile ├── about │ └── copyright.rst ├── api │ └── mqtt-api │ │ ├── attributes-api.rst │ │ ├── claiming-devices-api.rst │ │ ├── firmware-api.rst │ │ ├── provisioning-api.rst │ │ ├── rpc-api.rst │ │ ├── security.rst │ │ ├── telemetry-upload-api.rst │ │ └── thingsboard-mqtt-api.rst ├── concepts │ ├── attributes.rst │ ├── claiming_devices.rst │ ├── ota_update.rst │ ├── overview.rst │ ├── provision.rst │ ├── rpc.rst │ └── time-series_data.rst ├── conf.py ├── index.rst ├── intro │ └── usage.rst ├── make.bat └── requirements.txt └── examples ├── .docs ├── add-or-modify-device-profile-for-device-provisioning-that-allow-to-create-new-devices.md ├── add-or-modify-device-profile-for-device-provisioning-using-pre-provisioned-devices.md ├── check-latest-telemetry.md ├── copy-access-token.md ├── delete-provisioned-device.md ├── device-provisioning-results-that-allow-to-create-new-devices.md ├── device-provisioning-results-using-pre-provisioned-devices.md ├── generate-client-certificate.md ├── images │ ├── add-or-modify-device-profile-for-device-provisioning-that-allow-to-create-new-devices │ │ ├── add-device-profile-1.png │ │ ├── add-device-profile-2.png │ │ ├── add-device-profile-3.png │ │ ├── modify-device-profile-1.png │ │ └── modify-device-profile-2.png │ ├── add-or-modify-device-profile-for-device-provisioning-using-pre-provisioned-devices │ │ ├── add-device-profile-1.png │ │ ├── add-device-profile-2.png │ │ ├── add-device-profile-3.png │ │ ├── modify-device-profile-1.png │ │ └── modify-device-profile-2.png │ ├── check-latest-telemetry │ │ └── check-latest-telemetry-1.png │ ├── copy-access-token │ │ └── copy-access-token-1.png │ ├── delete-provisioned-device │ │ ├── delete-provisioned-device-1.png │ │ └── delete-provisoned-device-2.png │ ├── device-provisioning-results-that-allow-to-create-new-devices │ │ ├── device-provisioning-results-that-allow-to-create-new-devices-1.png │ │ ├── device-provisioning-results-that-allow-to-create-new-devices-2.png │ │ └── device-provisioning-results-that-allow-to-create-new-devices-3.png │ ├── device-provisioning-results-using-pre-provisioned-devices │ │ ├── device-provisioning-results-using-pre-provisioned-devices-1.png │ │ └── device-provisioning-results-using-pre-provisioned-devices-2.png │ ├── pre-provisioning-device-status │ │ ├── pre-provisioning-device-status-1.png │ │ ├── pre-provisioning-device-status-2.png │ │ └── pre-provisioning-device-status-3.png │ ├── pre-provisioning-device-with-access-token │ │ ├── pre-provisioning-device-with-access-token-1.png │ │ └── pre-provisioning-device-with-access-token-2.png │ ├── pre-provisioning-device-with-basic-mqtt-c │ │ ├── pre-provisioning-device-with-basic-mqtt-c-1.png │ │ └── pre-provisioning-device-with-basic-mqtt-c-2.png │ ├── pre-provisioning-device-with-basic-mqtt-cup │ │ ├── pre-provisioning-device-with-basic-mqtt-cup-1.png │ │ └── pre-provisioning-device-with-basic-mqtt-cup-2.png │ ├── pre-provisioning-device-with-basic-mqtt-up │ │ ├── pre-provisioning-device-with-basic-mqtt-up-1.png │ │ └── pre-provisioning-device-with-basic-mqtt-up-2.png │ └── pre-provisioning-device-with-x509-ceritificate │ │ ├── pre-provisioning-device-with-x509-ceritificate-1.png │ │ └── pre-provisioning-device-with-x509-ceritificate-2.png ├── mqtt-over-ssl-ssl-configuration-using-pem-certificates-file.md ├── pre-provisioning-device-status.md ├── pre-provisioning-device-with-access-token.md ├── pre-provisioning-device-with-basic-mqtt-c.md ├── pre-provisioning-device-with-basic-mqtt-cup.md ├── pre-provisioning-device-with-basic-mqtt-up.md └── pre-provisioning-device-with-x509-ceritificate.md ├── README.md ├── README_CN.md ├── authentication ├── a11_access_token_wo_ssl │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── access_token_wo_ssl_main.c │ │ └── component.mk │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── a12_access_token_w_onewayssl │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── access_token_w_onewayssl_main.c │ │ ├── component.mk │ │ └── mqtt_thingsboard_server_cert.pem │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── a21_basic_mqtt_credential_c_wo_ssl │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── basic_mqtt_credential_c_wo_ssl_1.png │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── basic_mqtt_credential_c_wo_ssl_main.c │ │ └── component.mk │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── a22_basic_mqtt_credential_up_wo_ssl │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── basic_mqtt_credential_up_wo_ssl_1.png │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── basic_mqtt_credential_up_wo_ssl_main.c │ │ └── component.mk │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── a23_basic_mqtt_credential_cup_wo_ssl │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── basic_mqtt_credential_cup_wo_ssl_1.png │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── basic_mqtt_credential_cup_wo_ssl_main.c │ │ └── component.mk │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── a24_basic_mqtt_credential_cup_w_onewayssl │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── basic_mqtt_credential_cup_w_onewayssl_1.png │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── basic_mqtt_credential_cup_w_onewayssl_main.c │ │ ├── component.mk │ │ └── mqtt_thingsboard_server_cert.pem │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old └── a31_x.509_ceritificate_w_twowayssl │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ ├── CMakeLists.txt │ ├── Kconfig.projbuild │ ├── client.crt │ ├── client.key │ ├── component.mk │ ├── mqtt_thingsboard_server_cert.pem │ └── x.509_ceritificate_w_twowayssl_main.c │ ├── sdkconfig │ ├── sdkconfig.ci │ ├── sdkconfig.old │ └── x.509_ceritificate_w_twowayssl_1.png ├── build_all_examples.bat ├── build_all_examples.sh ├── clean_all_examples.bat ├── clean_all_examples.sh ├── extension ├── e10_timeseries_data │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── component.mk │ │ └── timeseries_data_main.c │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── e20_client_attributes │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── client_attributes_main.c │ │ └── component.mk │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old └── e30_shared_attributes │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ ├── CMakeLists.txt │ ├── Kconfig.projbuild │ ├── component.mk │ └── shared_attributes_main.c │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── fullclean_all_examples.bat ├── fullclean_all_examples.sh ├── getstarted └── g00_hello_world │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── example_test.py │ ├── main │ ├── CMakeLists.txt │ ├── component.mk │ └── hello_world_main.c │ ├── sdkconfig │ └── sdkconfig.ci ├── helper ├── h10_telemetry_upload │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── component.mk │ │ └── telemetry_upload_main.c │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── h20_attributes_update │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── attributes_update_main.c │ │ └── component.mk │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── h21_attributes_subscribe │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── attributes_subscribe_main.c │ │ └── component.mk │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── h22_attributes_request │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── attribute_request_main.c │ │ └── component.mk │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── h30_server_side_rpc │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── Root-Rule-Chain_4_Server-RPC.png │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── component.mk │ │ └── server_side_rpc_main.c │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── h31_client_side_rpc │ ├── CMakeLists.txt │ ├── ESP-IDF-Thingsboard-MQTT_Client-side_RPC_Test_Rule_Chain.png │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── Root_Rule_Chain.png │ ├── esp_idf_thingsboard_mqtt_client_side_rpc_test_rule_chain.json │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── client_side_rpc_main.c │ │ └── component.mk │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── h40_claiming_device │ ├── 1_device_claiming_dashboard.png │ ├── 2_assign_dashboard_to_customer.png │ ├── 3_unassign_device_from_cusotmer.png │ ├── 4_claiming_device.png │ ├── 5_device_list.png │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── claiming_device_main.c │ │ └── component.mk │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old └── h50_fw_update │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── fw_ota_1_upload.png │ ├── fw_ota_2_uploaded.png │ ├── fw_ota_3_update.png │ ├── fw_ota_4_updated.png │ ├── fw_ota_5_updated_history.png │ ├── main │ ├── CMakeLists.txt │ ├── Kconfig.projbuild │ ├── component.mk │ └── fw_update_main.c │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── provision ├── pd11_dev_sup_access_token_wo_ssl │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── component.mk │ │ ├── dev_sup_access_token_wo_ssl_main.c │ │ ├── tbc_front_connection.c │ │ ├── tbc_normal_connection.c │ │ ├── tbc_transport_credentials_memory.c │ │ └── tbc_transport_credentials_memory.h │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── pd12_dev_sup_access_token_w_onewayssl │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── component.mk │ │ ├── dev_sup_access_token_w_onewayssl_main.c │ │ ├── mqtt_thingsboard_server_cert.pem │ │ ├── tbc_front_connection.c │ │ ├── tbc_normal_connection.c │ │ ├── tbc_transport_credentials_memory.c │ │ └── tbc_transport_credentials_memory.h │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── pd21_dev_sup_basic_mqtt_credential_c_wo_ssl │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── component.mk │ │ ├── dev_sup_basic_mqtt_credential_c_wo_ssl_main.c │ │ ├── tbc_front_connection.c │ │ ├── tbc_normal_connection.c │ │ ├── tbc_transport_credentials_memory.c │ │ └── tbc_transport_credentials_memory.h │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── pd22_dev_sup_basic_mqtt_credential_up_wo_ssl │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── Root_Rule_Chain.png │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── component.mk │ │ ├── dev_sup_basic_mqtt_credential_up_wo_ssl_main.c │ │ ├── tbc_front_connection.c │ │ ├── tbc_normal_connection.c │ │ ├── tbc_transport_credentials_memory.c │ │ └── tbc_transport_credentials_memory.h │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── pd23_dev_sup_basic_mqtt_credential_cup_wo_ssl │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── component.mk │ │ ├── dev_sup_basic_mqtt_credential_cup_wo_ssl_main.c │ │ ├── tbc_front_connection.c │ │ ├── tbc_normal_connection.c │ │ ├── tbc_transport_credentials_memory.c │ │ └── tbc_transport_credentials_memory.h │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── pd24_dev_sup_basic_mqtt_credential_cup_w_onewayssl │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── component.mk │ │ ├── dev_sup_basic_mqtt_credential_cup_w_onewayssl_main.c │ │ ├── mqtt_thingsboard_server_cert.pem │ │ ├── tbc_front_connection.c │ │ ├── tbc_normal_connection.c │ │ ├── tbc_transport_credentials_memory.c │ │ └── tbc_transport_credentials_memory.h │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── pd31_dev_sup_x.509_ceritificate_w_twowayssl │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── client.crt │ │ ├── client.key │ │ ├── component.mk │ │ ├── dev_sup_x.509_ceritificate_w_twowayssl_main.c │ │ ├── mqtt_thingsboard_server_cert.pem │ │ ├── tbc_front_connection.c │ │ ├── tbc_normal_connection.c │ │ ├── tbc_transport_credentials_memory.c │ │ └── tbc_transport_credentials_memory.h │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old ├── ps10_srv_gen_credentials_wo_ssl │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── component.mk │ │ ├── srv_gen_credentials_wo_ssl_main.c │ │ ├── tbc_front_connection.c │ │ ├── tbc_normal_connection.c │ │ ├── tbc_transport_credentials_memory.c │ │ └── tbc_transport_credentials_memory.h │ ├── pre-provisioned_server_generate_access_token_without_ssl-add_device_1.png │ ├── pre-provisioned_server_generate_access_token_without_ssl-add_device_2.png │ ├── pre-provisioned_server_generate_access_token_without_ssl-device_status_1.png │ ├── pre-provisioned_server_generate_access_token_without_ssl-device_status_2.png │ ├── pre-provisioned_server_generate_access_token_without_ssl-device_status_3.png │ ├── pre-provisioned_server_generate_access_token_without_ssl-modify_device_profile_1.png │ ├── pre-provisioned_server_generate_access_token_without_ssl-modify_device_profile_2.png │ ├── pre-provisioned_server_generate_access_token_without_ssl-result_1.png │ ├── pre-provisioned_server_generate_access_token_without_ssl-result_2.png │ ├── pre-provisioned_server_generate_basic_mqtt_credential_c_u_p_without_ssl-add_device_2.png │ ├── sdkconfig │ ├── sdkconfig.ci │ ├── sdkconfig.old │ ├── server_generate_access_token_without_ssl_add_provision_1.png │ ├── server_generate_access_token_without_ssl_add_provision_2.png │ ├── server_generate_access_token_without_ssl_add_provision_3.png │ ├── server_generate_access_token_without_ssl_delete_device_1.png │ ├── server_generate_access_token_without_ssl_delete_device_2.png │ ├── server_generate_access_token_without_ssl_result_1.png │ ├── server_generate_access_token_without_ssl_result_2.png │ └── server_generate_access_token_without_ssl_result_3.png ├── ps20_srv_gen_credentials_w_onewayssl │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── case-ps12_server_generate_access_token_with_onewayssl │ ├── case-ps24_1_server_generate_basic_mqtt_credential_c_with_onewayssl │ ├── case-ps24_2_server_generate_basic_mqtt_credential_u_p_with_onewayssl │ ├── case-ps24_3_server_generate_basic_mqtt_credential_c_u_p_with_onewayssl │ ├── example_test.py │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── component.mk │ │ ├── mqtt_thingsboard_server_cert.pem │ │ ├── srv_gen_credentials_w_onewayssl_main.c │ │ ├── tbc_front_connection.c │ │ ├── tbc_normal_connection.c │ │ ├── tbc_transport_credentials_memory.c │ │ └── tbc_transport_credentials_memory.h │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old └── px00_device_provisioning │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── README_CN.md │ ├── Root_Rule_Chain.png │ ├── example_test.py │ ├── main │ ├── CMakeLists.txt │ ├── Kconfig.projbuild │ ├── client.crt │ ├── client.key │ ├── component.mk │ ├── device_provisioning_main.c │ ├── mqtt_thingsboard_server_cert.pem │ ├── tbc_front_connection.c │ ├── tbc_normal_connection.c │ ├── tbc_transport_credentials_memory.c │ └── tbc_transport_credentials_memory.h │ ├── sdkconfig │ ├── sdkconfig.ci │ └── sdkconfig.old └── provison └── ps20_srv_gen_credentials_w_onewayssl /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | 54 | # ESP-IDF 55 | build/ 56 | sdkconfig.old 57 | 58 | # Visual Studio Code 59 | .vscode/ 60 | 61 | #python 62 | .venv 63 | 64 | # Sphinx 65 | docs/_build/* 66 | 67 | # This project 68 | log.txt 69 | ~$*.ods 70 | -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | # Build documentation in the docs/ directory with Sphinx 9 | sphinx: 10 | configuration: docs/conf.py 11 | 12 | # Build documentation with MkDocs 13 | #mkdocs: 14 | # configuration: mkdocs.yml 15 | 16 | # Optionally build your docs in additional formats such as PDF 17 | formats: all 18 | 19 | # Optionally set the version of Python and requirements required to build your docs 20 | python: 21 | version: 3.8 22 | install: 23 | - requirements: docs/requirements.txt -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "timeseries_data_helper.h": "c", 4 | "attributes_request_observer.h": "c", 5 | "client_attribute_helper.h": "c", 6 | "client_rpc_observer.h": "c", 7 | "fw_update_observer.h": "c", 8 | "server_rpc_observer.h": "c", 9 | "tb_mqtt_client_helper_log.h": "c", 10 | "shared_attribute_observer.h": "c", 11 | "tb_mqtt_client_helper.h": "c", 12 | "tbc_mqtt_helper_internal.h": "c", 13 | "provision_observer.h": "c", 14 | "ota_update_observer.h": "c", 15 | "tbc_mqtt_adapter.h": "c", 16 | "client_rpc.h": "c", 17 | "tbc_utils.h": "c", 18 | "tbc_mqtt_wapper.h": "c", 19 | "tbc_mqtt_helper.h": "c", 20 | "tbc_extension_timeseriesdata.h": "c" 21 | }, 22 | "cmake.configureOnOpen": false, 23 | "esbonio.sphinx.confDir": "" 24 | } -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | TODO List 2 | ============ 3 | 4 | 5 | * Security option `testing`. 6 | * Device provisioning `testing`. 7 | 8 | * A new examples of all in one. 9 | 10 | * Docs... 11 | * Append supported ThingsBoard MQTT API in commonents/README.md. 12 | * Append some pictures of ThingsBoard in examples/.../README.md. 13 | 14 | * Dead lock & protected data in tb_mqtt.c/.h & tb_mqtt_helper.c/h. 15 | 16 | * Subscribe/unsubscribe fw_chunk_response topic if sw & fw are upgrading at same time. 17 | * OTA update support MD5-checksum-ALG. 18 | * Software OTA upgrade. 19 | 20 | ----------------------------------------------------------------------- 21 | * Is default login data correct? 22 | constexpr char PROV_ACCESS_TOKEN[] = PSTR("provision"); 23 | constexpr char DEFAULT_CLIENT_ID[] = PSTR("TbDev"); 24 | 25 | * OTA update only has Firmware OTA and Software OTA at most, no need to form a list. 26 | * Provision has at most one request and does not require a list. 27 | 28 | ------------------------------------------------------------------------ 29 | * Is there only one parameter for QoS of ThingsBoard MQTT API, which does not need to appear in every publish API? 30 | 31 | ------------------------------------------------------------------------ 32 | * MQTT Gateway API. 33 | -------------------------------------------------------------------------------- /components/tbcmh/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(includes "include") 2 | 3 | set(priv_includes "src/transport" 4 | "src/wapper" 5 | "src/helper" 6 | "src/extension") 7 | 8 | #set(priv_requires "mqtt") 9 | 10 | set(requires "mqtt" "json" "app_update") 11 | 12 | set(srcs "src/transport/tbc_transport_config.c" 13 | "src/transport/tbc_transport_storage.c" 14 | "src/wapper/tbc_mqtt_wapper.c" 15 | "src/wapper/tbc_mqtt_payload_buffer.c" 16 | "src/helper/tbc_mqtt_helper.c" 17 | "src/helper/telemetry_upload.c" 18 | "src/helper/attributes_update.c" 19 | "src/helper/attributes_request.c" 20 | "src/helper/attributes_subscribe.c" 21 | "src/helper/client_rpc.c" 22 | "src/helper/provision_request.c" 23 | "src/helper/ota_update.c" 24 | "src/helper/ota_fwupdate.c" 25 | "src/helper/server_rpc.c" 26 | "src/helper/claiming_device.c" 27 | "src/extension/tbc_extension_timeseriesdata.c" 28 | "src/extension/tbc_extension_clientattributes.c" 29 | "src/extension/tbc_extension_sharedattributes.c") 30 | 31 | #list(APPEND priv_requires "json") 32 | #list(APPEND requires "json") 33 | 34 | idf_component_register(SRCS ${srcs} 35 | INCLUDE_DIRS ${includes} 36 | PRIV_INCLUDE_DIRS ${priv_includes} 37 | REQUIRES ${requires} ) 38 | 39 | #PRIV_REQUIRES ${priv_requires} 40 | -------------------------------------------------------------------------------- /components/tbcmh/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Component Makefile 3 | # 4 | 5 | COMPONENT_ADD_INCLUDEDIRS := include 6 | 7 | COMPONENT_PRIV_INCLUDEDIRS += src/transport 8 | COMPONENT_PRIV_INCLUDEDIRS += src/wapper 9 | COMPONENT_PRIV_INCLUDEDIRS += src/helper 10 | COMPONENT_PRIV_INCLUDEDIRS += src/extension 11 | 12 | COMPONENT_SRCDIRS := src/transport 13 | COMPONENT_SRCDIRS += src/wapper 14 | COMPONENT_SRCDIRS += src/helper 15 | COMPONENT_SRCDIRS += src/extension 16 | 17 | -------------------------------------------------------------------------------- /components/tbcmh/esp-mqtt_api.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/components/tbcmh/esp-mqtt_api.ods -------------------------------------------------------------------------------- /components/tbcmh/include/tbc_extension.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 liangzhuzhi2020@gmail.com, https://github.com/liang-zhu-zi/esp32-thingsboard-mqtt-client 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // This file is called by user. 16 | 17 | #ifndef _TBC_EXTENSION_H_ 18 | #define _TBC_EXTENSION_H_ 19 | 20 | #include "tbc_extension_timeseriesdata.h" 21 | #include "tbc_extension_clientattributes.h" 22 | #include "tbc_extension_sharedattributes.h" 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif //__cplusplus 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /components/tbcmh/src/helper/attributes_update.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 liangzhuzhi2020@gmail.com, https://github.com/liang-zhu-zi/esp32-thingsboard-mqtt-client 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // This file is called by tbc_mqtt_helper.c/.h. 16 | 17 | #ifndef _ATTRIBUTES_UPDATE_H_ 18 | #define _ATTRIBUTES_UPDATE_H_ 19 | 20 | //#include "tbc_utils.h" 21 | //#include "tbc_mqtt_helper.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | // 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif //__cplusplus 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /components/tbcmh/src/helper/claiming_device.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 liangzhuzhi2020@gmail.com, https://github.com/liang-zhu-zi/esp32-thingsboard-mqtt-client 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // This file is called by tbc_mqtt_helper.c/.h. 16 | 17 | #ifndef _CLAIMING_DEVICE_HELPER_H_ 18 | #define _CLAIMING_DEVICE_HELPER_H_ 19 | 20 | #include "tbc_utils.h" 21 | #include "tbc_mqtt_helper.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | void _tbcmh_claimingdevice_on_create(tbcmh_handle_t client); 28 | void _tbcmh_claimingdevice_on_destroy(tbcmh_handle_t client); 29 | void _tbcmh_claimingdevice_on_connected(tbcmh_handle_t client); 30 | void _tbcmh_claimingdevice_on_disconnected(tbcmh_handle_t client); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif //__cplusplus 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /components/tbcmh/src/helper/telemetry_upload.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 liangzhuzhi2020@gmail.com, https://github.com/liang-zhu-zi/esp32-thingsboard-mqtt-client 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // This file is called by tbc_mqtt_helper.c/.h. 16 | 17 | #ifndef _TELEMETRY_UPLOAD_H_ 18 | #define _TELEMETRY_UPLOAD_H_ 19 | 20 | //#include "tbc_utils.h" 21 | //#include "tbc_mqtt_helper.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | // 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif //__cplusplus 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /components/tbcmh/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRC_DIRS . 2 | PRIV_INCLUDE_DIRS . 3 | PRIV_REQUIRES cmock test_utils esp32-thingsboard-mqtt-client) 4 | -------------------------------------------------------------------------------- /components/tbcmh/test/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | #Component Makefile 3 | # 4 | 5 | COMPONENT_SRCDIRS := . 6 | 7 | COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive -------------------------------------------------------------------------------- /components/tbcmh/test/test_tb_mqtt_client.c: -------------------------------------------------------------------------------- 1 | #if !CONFIG_FREERTOS_UNICORE 2 | 3 | #ifdef CONFIG_ESP_IPC_USES_CALLERS_PRIORITY 4 | 5 | #endif /* CONFIG_ESP_IPC_USE_CALLERS_PRIORITY */ 6 | 7 | #endif /* !CONFIG_FREERTOS_UNICORE */ -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /docs/about/copyright.rst: -------------------------------------------------------------------------------- 1 | Copyrights and Licenses 2 | ####################### 3 | 4 | 5 | Copyrights 6 | =========== 7 | 8 | All original source code & document in this repository is Copyright (C) 2022 Liang Zhuzi. This source code is licensed under the Apache License 2.0 as described in the file `LICENSE`__. 9 | 10 | Additional third party copyrighted code & document is included under the following licenses. 11 | 12 | Where source code & document headers specify Copyright & License information, this information takes precedence over the summaries made here. 13 | 14 | .. __: https://github.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/blob/main/LICENSE 15 | 16 | 17 | ThingsBoard License 18 | ===================== 19 | 20 | `thingsboard/thingsboard.github.io`__ is licensed under the `Apache License 2.0`__. 21 | 22 | .. __: https://github.com/thingsboard/thingsboard.github.io 23 | 24 | .. __: https://github.com/thingsboard/thingsboard.github.io/blob/master/LICENSE -------------------------------------------------------------------------------- /docs/api/mqtt-api/claiming-devices-api.rst: -------------------------------------------------------------------------------- 1 | Claiming Devices API 2 | ------------------------------------------- 3 | 4 | Please see the corresponding article to get more information about the `Claiming devices`__ feature. 5 | 6 | .. __: https://thingsboard.io/docs/user-guide/claiming-devices 7 | 8 | In order to initiate claiming device, send PUBLISH message to the following topic:: 9 | 10 | v1/devices/me/claim 11 | 12 | The supported data format is: 13 | 14 | .. code:: json 15 | 16 | {"secretKey":"value", "durationMs":60000} 17 | 18 | **Please note** that the above fields are optional. In case the **secretKey** is not specified, the empty string as a default value is used. In case the **durationMs** is not specified, the system parameter **device.claim.duration** is used (in the file **/etc/thingsboard/conf/thingsboard.yml** ). 19 | 20 | -------------------------------------------------------------------------------- /docs/api/mqtt-api/firmware-api.rst: -------------------------------------------------------------------------------- 1 | Firmware API 2 | ------------------------------ 3 | 4 | When ThingsBoard initiates an MQTT device firmware update, it sets the fw_title, fw_version, fw_checksum, fw_checksum_algorithm shared attributes. -------------------------------------------------------------------------------- /docs/api/mqtt-api/provisioning-api.rst: -------------------------------------------------------------------------------- 1 | Device provisioning API 2 | ------------------------------- -------------------------------------------------------------------------------- /docs/api/mqtt-api/security.rst: -------------------------------------------------------------------------------- 1 | Security 2 | ########################## 3 | 4 | MQTT Transport 5 | ==================== 6 | 7 | * [MQTT over SSL](https://thingsboard.io/docs/user-guide/mqtt-over-ssl/) 8 | * [Device authentication options](https://thingsboard.io/docs/user-guide/device-credentials/) 9 | * [Access Token based authentication](https://thingsboard.io/docs/user-guide/access-token/) 10 | * [Basic MQTT authentication](https://thingsboard.io/docs/user-guide/basic-mqtt/) 11 | * [X.509 Certificate Based Authentication](https://thingsboard.io/docs/user-guide/certificates/) -------------------------------------------------------------------------------- /docs/concepts/claiming_devices.rst: -------------------------------------------------------------------------------- 1 | Claiming Devies 2 | ======================= 3 | 4 | Claiming devices 5 | ---------------- 6 | 7 | See `Claiming devices`__. 8 | 9 | .. __: https://thingsboard.io/docs/user-guide/claiming-devices/ 10 | 11 | **TODO**: Claiming devices. 12 | 13 | [MQTT Device API Reference - Claiming devices](https://thingsboard.io/docs/reference/mqtt-api/#claiming-devices) 14 | 15 | [Other Features - Claiming devices](https://thingsboard.io/docs/user-guide/claiming-devices/?claimingscenario=deviceside#use-case-description) 16 | 17 | -------------------------------------------------------------------------------- /docs/intro/usage.rst: -------------------------------------------------------------------------------- 1 | Usage 2 | ===== 3 | 4 | .. _installation: 5 | 6 | Installation 7 | ------------ 8 | 9 | ... 10 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | 13 | %SPHINXBUILD% >NUL 2>NUL 14 | if errorlevel 9009 ( 15 | echo. 16 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 17 | echo.installed, then set the SPHINXBUILD environment variable to point 18 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 19 | echo.may add the Sphinx directory to PATH. 20 | echo. 21 | echo.If you don't have Sphinx installed, grab it from 22 | echo.https://www.sphinx-doc.org/ 23 | exit /b 1 24 | ) 25 | 26 | if "%1" == "" goto help 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | plantweb -------------------------------------------------------------------------------- /examples/.docs/check-latest-telemetry.md: -------------------------------------------------------------------------------- 1 | Check out the latest Telemetry data on ThingsBoard. 2 | 3 | * Check out the latest Telemetry data. 4 | 5 | `Login in ThingsBoard CE/PE as tenant` --> `Devices` --> Click on *my device* --> `Latest tememetry`. You can find `humidity` and `temprature`. Their values change over time. 6 | 7 | ![image](./images/check-latest-telemetry/check-latest-telemetry-1.png) -------------------------------------------------------------------------------- /examples/.docs/copy-access-token.md: -------------------------------------------------------------------------------- 1 | # Copy access token 2 | 3 | `Login in ThingsBoard CE/PE as tenant` --> `Devices` --> Click on *my device* --> `Copy access token`. 4 | 5 | ![image](./images/copy-access-token/copy-access-token-1.png) -------------------------------------------------------------------------------- /examples/.docs/delete-provisioned-device.md: -------------------------------------------------------------------------------- 1 | # Detele provisioned device 2 | 3 | In order to ensure that the example runs successfully next time, the newly added device needs to be deleted. 4 | 5 | 1. `Login in ThingsBoard CE/PE as tenant` --> `Devices` --> Click *my prvisioned device* --> `Delete device`. 6 | ![image](images/delete-provisioned-device/delete-provisioned-device-1.png) 7 | 8 | 1. `Yes`. 9 | ![image](images/delete-provisioned-device/delete-provisioned-device-2.png) 10 | -------------------------------------------------------------------------------- /examples/.docs/device-provisioning-results-that-allow-to-create-new-devices.md: -------------------------------------------------------------------------------- 1 | # Check the device provisioning results that allow to create new devices 2 | 3 | 1. Now my new device should be listed first. 4 | ![image](images/device-provisioning-results-that-allow-to-create-new-devices/device-provisioning-results-that-allow-to-create-new-devices-1.png) 5 | 6 | 1. The value of the service-side attribute `provisionState` is `provisioned`. 7 | ![image](images/device-provisioning-results-that-allow-to-create-new-devices/device-provisioning-results-that-allow-to-create-new-devices-2.png) 8 | 9 | 1. Successfully connected to the server with new credentials and uploaded new time-series data. 10 | ![image](images/device-provisioning-results-that-allow-to-create-new-devices/device-provisioning-results-that-allow-to-create-new-devices-3.png) 11 | -------------------------------------------------------------------------------- /examples/.docs/device-provisioning-results-using-pre-provisioned-devices.md: -------------------------------------------------------------------------------- 1 | # Device provisioning results using pre-provisioned devices 2 | 3 | 1. The value of the service-side attribute `provisionState` is `provisioned`. 4 | ![image](images/device-provisioning-results-using-pre-provisioned-devices/device-provisioning-results-using-pre-provisioned-devices-1.png) 5 | 6 | 1. Successfully connected to the server with new credentials and uploaded new time-series data. 7 | ![image](images/device-provisioning-results-using-pre-provisioned-devices/device-provisioning-results-using-pre-provisioned-devices-2.png) 8 | -------------------------------------------------------------------------------- /examples/.docs/generate-client-certificate.md: -------------------------------------------------------------------------------- 1 | # Generate Client certificate 2 | 3 | Refer [here](https://thingsboard.io/docs/user-guide/certificates/) 4 | 5 | 1. Generate Client certificate 6 | 7 | Use the following command to generate the self-signed private key and x509 certificate. The command is based on the openssl tool which is most likely already installed on your workstation: 8 | 9 | To generate the RSA based key and certificate, use: 10 | 11 | ```bash 12 | openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365 -nodes 13 | ``` 14 | 15 | The output of the command will be a private key file `key.pem` and a public certificate `cert.pem`. We will use them in next steps. 16 | 17 | 1. Rename `cert.pem` to `client.crt`; Copy it to `main\client.crt` in your ESP32 source code; 18 | 19 | 1. Rename `key.pem` to `client.key`; Copy it to `main\client.key` in your ESP32 source code; 20 | 21 | -------------------------------------------------------------------------------- /examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-that-allow-to-create-new-devices/add-device-profile-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-that-allow-to-create-new-devices/add-device-profile-1.png -------------------------------------------------------------------------------- /examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-that-allow-to-create-new-devices/add-device-profile-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-that-allow-to-create-new-devices/add-device-profile-2.png -------------------------------------------------------------------------------- /examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-that-allow-to-create-new-devices/add-device-profile-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-that-allow-to-create-new-devices/add-device-profile-3.png -------------------------------------------------------------------------------- /examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-that-allow-to-create-new-devices/modify-device-profile-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-that-allow-to-create-new-devices/modify-device-profile-1.png -------------------------------------------------------------------------------- /examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-that-allow-to-create-new-devices/modify-device-profile-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-that-allow-to-create-new-devices/modify-device-profile-2.png -------------------------------------------------------------------------------- /examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-using-pre-provisioned-devices/add-device-profile-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-using-pre-provisioned-devices/add-device-profile-1.png -------------------------------------------------------------------------------- /examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-using-pre-provisioned-devices/add-device-profile-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-using-pre-provisioned-devices/add-device-profile-2.png -------------------------------------------------------------------------------- /examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-using-pre-provisioned-devices/add-device-profile-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-using-pre-provisioned-devices/add-device-profile-3.png -------------------------------------------------------------------------------- /examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-using-pre-provisioned-devices/modify-device-profile-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-using-pre-provisioned-devices/modify-device-profile-1.png -------------------------------------------------------------------------------- /examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-using-pre-provisioned-devices/modify-device-profile-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/add-or-modify-device-profile-for-device-provisioning-using-pre-provisioned-devices/modify-device-profile-2.png -------------------------------------------------------------------------------- /examples/.docs/images/check-latest-telemetry/check-latest-telemetry-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/check-latest-telemetry/check-latest-telemetry-1.png -------------------------------------------------------------------------------- /examples/.docs/images/copy-access-token/copy-access-token-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/copy-access-token/copy-access-token-1.png -------------------------------------------------------------------------------- /examples/.docs/images/delete-provisioned-device/delete-provisioned-device-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/delete-provisioned-device/delete-provisioned-device-1.png -------------------------------------------------------------------------------- /examples/.docs/images/delete-provisioned-device/delete-provisoned-device-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/delete-provisioned-device/delete-provisoned-device-2.png -------------------------------------------------------------------------------- /examples/.docs/images/device-provisioning-results-that-allow-to-create-new-devices/device-provisioning-results-that-allow-to-create-new-devices-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/device-provisioning-results-that-allow-to-create-new-devices/device-provisioning-results-that-allow-to-create-new-devices-1.png -------------------------------------------------------------------------------- /examples/.docs/images/device-provisioning-results-that-allow-to-create-new-devices/device-provisioning-results-that-allow-to-create-new-devices-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/device-provisioning-results-that-allow-to-create-new-devices/device-provisioning-results-that-allow-to-create-new-devices-2.png -------------------------------------------------------------------------------- /examples/.docs/images/device-provisioning-results-that-allow-to-create-new-devices/device-provisioning-results-that-allow-to-create-new-devices-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/device-provisioning-results-that-allow-to-create-new-devices/device-provisioning-results-that-allow-to-create-new-devices-3.png -------------------------------------------------------------------------------- /examples/.docs/images/device-provisioning-results-using-pre-provisioned-devices/device-provisioning-results-using-pre-provisioned-devices-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/device-provisioning-results-using-pre-provisioned-devices/device-provisioning-results-using-pre-provisioned-devices-1.png -------------------------------------------------------------------------------- /examples/.docs/images/device-provisioning-results-using-pre-provisioned-devices/device-provisioning-results-using-pre-provisioned-devices-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/device-provisioning-results-using-pre-provisioned-devices/device-provisioning-results-using-pre-provisioned-devices-2.png -------------------------------------------------------------------------------- /examples/.docs/images/pre-provisioning-device-status/pre-provisioning-device-status-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/pre-provisioning-device-status/pre-provisioning-device-status-1.png -------------------------------------------------------------------------------- /examples/.docs/images/pre-provisioning-device-status/pre-provisioning-device-status-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/pre-provisioning-device-status/pre-provisioning-device-status-2.png -------------------------------------------------------------------------------- /examples/.docs/images/pre-provisioning-device-status/pre-provisioning-device-status-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/pre-provisioning-device-status/pre-provisioning-device-status-3.png -------------------------------------------------------------------------------- /examples/.docs/images/pre-provisioning-device-with-access-token/pre-provisioning-device-with-access-token-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/pre-provisioning-device-with-access-token/pre-provisioning-device-with-access-token-1.png -------------------------------------------------------------------------------- /examples/.docs/images/pre-provisioning-device-with-access-token/pre-provisioning-device-with-access-token-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/pre-provisioning-device-with-access-token/pre-provisioning-device-with-access-token-2.png -------------------------------------------------------------------------------- /examples/.docs/images/pre-provisioning-device-with-basic-mqtt-c/pre-provisioning-device-with-basic-mqtt-c-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/pre-provisioning-device-with-basic-mqtt-c/pre-provisioning-device-with-basic-mqtt-c-1.png -------------------------------------------------------------------------------- /examples/.docs/images/pre-provisioning-device-with-basic-mqtt-c/pre-provisioning-device-with-basic-mqtt-c-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/pre-provisioning-device-with-basic-mqtt-c/pre-provisioning-device-with-basic-mqtt-c-2.png -------------------------------------------------------------------------------- /examples/.docs/images/pre-provisioning-device-with-basic-mqtt-cup/pre-provisioning-device-with-basic-mqtt-cup-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/pre-provisioning-device-with-basic-mqtt-cup/pre-provisioning-device-with-basic-mqtt-cup-1.png -------------------------------------------------------------------------------- /examples/.docs/images/pre-provisioning-device-with-basic-mqtt-cup/pre-provisioning-device-with-basic-mqtt-cup-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/pre-provisioning-device-with-basic-mqtt-cup/pre-provisioning-device-with-basic-mqtt-cup-2.png -------------------------------------------------------------------------------- /examples/.docs/images/pre-provisioning-device-with-basic-mqtt-up/pre-provisioning-device-with-basic-mqtt-up-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/pre-provisioning-device-with-basic-mqtt-up/pre-provisioning-device-with-basic-mqtt-up-1.png -------------------------------------------------------------------------------- /examples/.docs/images/pre-provisioning-device-with-basic-mqtt-up/pre-provisioning-device-with-basic-mqtt-up-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/pre-provisioning-device-with-basic-mqtt-up/pre-provisioning-device-with-basic-mqtt-up-2.png -------------------------------------------------------------------------------- /examples/.docs/images/pre-provisioning-device-with-x509-ceritificate/pre-provisioning-device-with-x509-ceritificate-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/pre-provisioning-device-with-x509-ceritificate/pre-provisioning-device-with-x509-ceritificate-1.png -------------------------------------------------------------------------------- /examples/.docs/images/pre-provisioning-device-with-x509-ceritificate/pre-provisioning-device-with-x509-ceritificate-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/.docs/images/pre-provisioning-device-with-x509-ceritificate/pre-provisioning-device-with-x509-ceritificate-2.png -------------------------------------------------------------------------------- /examples/.docs/pre-provisioning-device-status.md: -------------------------------------------------------------------------------- 1 | # The status of pre-provisioning device 2 | 3 | * Now my pre-provisioned device should be listed first, since the table sort devices using the time of the creation by default. 4 | ![image](images/pre-provisioning-device-status/pre-provisioning-device-status-1.png) 5 | 6 | ![image](images/pre-provisioning-device-status/pre-provisioning-device-status-2.png) 7 | 8 | ![image](images/pre-provisioning-device-status/pre-provisioning-device-status-3.png) -------------------------------------------------------------------------------- /examples/.docs/pre-provisioning-device-with-access-token.md: -------------------------------------------------------------------------------- 1 | # Pre-provisioning device with Access token 2 | 3 | 1. `Login in ThingsBoard CE/PE as tenant` --> `Device` --> `+` --> `Add new device` --> Input *device name* --> Select *my device profile* --> `Credentials Options`. 4 | ![image](images/pre-provisioning-device-with-access-token/pre-provisioning-device-with-access-token-1.png) 5 | 6 | 1. Checked `Add credentials` --> Select `Access token` --> Input *my access token* --> `Add`. 7 | ![image](images/pre-provisioning-device-with-access-token/pre-provisioning-device-with-access-token-2.png) 8 | -------------------------------------------------------------------------------- /examples/.docs/pre-provisioning-device-with-basic-mqtt-c.md: -------------------------------------------------------------------------------- 1 | # Pre-provisioning device with basic MQTT credentials - Client ID 2 | 3 | 4 | 1. `Login in ThingsBoard CE/PE as tenant` --> `Device` --> `+` --> `Add new device` --> Input *device name* --> Select *my device profile* --> `Credentials Options`. 5 | ![image](images/pre-provisioning-device-with-basic-mqtt-c/pre-provisioning-device-with-basic-mqtt-c-1.png) 6 | 7 | 1. Checked `Add credentials` --> Select `MQTT Basic` --> Input *my client id* --> `Add`. 8 | ![image](images/pre-provisioning-device-with-basic-mqtt-c/pre-provisioning-device-with-basic-mqtt-c-2.png) 9 | 10 | -------------------------------------------------------------------------------- /examples/.docs/pre-provisioning-device-with-basic-mqtt-cup.md: -------------------------------------------------------------------------------- 1 | # Pre-provisioning device with basic MQTT credentials - Client ID, Username and Password 2 | 3 | 1. `Login in ThingsBoard CE/PE as tenant` --> `Device` --> `+` --> `Add new device` --> Input *device name* --> Select *my device profile* --> `Credentials Options`. 4 | ![image](images/pre-provisioning-device-with-basic-mqtt-cup/pre-provisioning-device-with-basic-mqtt-cup-1.png) 5 | 6 | 1. Checked `Add credentials` --> Select `MQTT Basic` --> Input *my client id*, *my username* & *my password* --> `Add`. 7 | ![image](images/pre-provisioning-device-with-basic-mqtt-cup/pre-provisioning-device-with-basic-mqtt-cup-2.png) 8 | 9 | -------------------------------------------------------------------------------- /examples/.docs/pre-provisioning-device-with-basic-mqtt-up.md: -------------------------------------------------------------------------------- 1 | # Pre-provisioning device with basic MQTT credentials - Username and Password 2 | 3 | **Only for ESP-IDF-v5.x** 4 | 5 | 1. `Login in ThingsBoard CE/PE as tenant` --> `Device` --> `+` --> `Add new device` --> Input *device name* --> Select *my device profile* --> `Credentials Options`. 6 | ![image](images/pre-provisioning-device-with-basic-mqtt-up/pre-provisioning-device-with-basic-mqtt-up-1.png) 7 | 8 | 1. Checked `Add credentials` --> Select `MQTT Basic` --> Input *my username* & *my password* --> `Add`. 9 | ![image](images/pre-provisioning-device-with-basic-mqtt-up/pre-provisioning-device-with-basic-mqtt-up-2.png) 10 | 11 | -------------------------------------------------------------------------------- /examples/.docs/pre-provisioning-device-with-x509-ceritificate.md: -------------------------------------------------------------------------------- 1 | # Pre-provisioning device with X.509 Certificate 2 | 3 | 1. `Login in ThingsBoard CE/PE as tenant` --> `Device` --> `+` --> `Add new device` --> Input *device name* --> Select *my device profile* --> `Credentials Options`. 4 | ![image](images/pre-provisioning-device-with-x509-ceritificate/pre-provisioning-device-with-x509-ceritificate-1.png) 5 | 6 | 1. Checked `Add credentials` --> Select `X.509` --> Insert the contents of cert.pem file *my client certificate file(`cert.pem` or `client.crt`)* --> `Add`. 7 | ![image](images/pre-provisioning-device-with-x509-ceritificate/pre-provisioning-device-with-x509-ceritificate-2.png) 8 | -------------------------------------------------------------------------------- /examples/authentication/a11_access_token_wo_ssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(access_token_wo_ssl) 11 | -------------------------------------------------------------------------------- /examples/authentication/a11_access_token_wo_ssl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := access_token_wo_ssl 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/authentication/a11_access_token_wo_ssl/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'access_token_wo_ssl' 11 | dut = env.get_dut(app_name, 'examples/authentication/a11_access_token_wo_ssl') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/authentication/a11_access_token_wo_ssl/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "access_token_wo_ssl_main.c" 4 | INCLUDE_DIRS "") 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/authentication/a11_access_token_wo_ssl/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config TBC_TRANSPORT_ADDRESS_HOST 4 | string "Hostname, to set ipv4 pass it as string" 5 | default "" 6 | help 7 | Hostname to connect to server/broker 8 | 9 | config TBC_TRANSPORT_ADDRESS_PORT 10 | int "Port" 11 | default 1883 12 | help 13 | MQTT over TCP:1883. MQTT over SSL: 8883. MQTT over WebSocket:80. MQTT over WebSocket Secure:443. 14 | 15 | config TBC_TRANSPORT_ACCESS_TOKEN 16 | string "Access Token" 17 | default "" 18 | help 19 | Access token to connect to broker 20 | 21 | endmenu 22 | -------------------------------------------------------------------------------- /examples/authentication/a11_access_token_wo_ssl/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json -------------------------------------------------------------------------------- /examples/authentication/a11_access_token_wo_ssl/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/authentication/a12_access_token_w_onewayssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(access_token_w_onewayssl) 11 | -------------------------------------------------------------------------------- /examples/authentication/a12_access_token_w_onewayssl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := access_token_w_onewayssl 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/authentication/a12_access_token_w_onewayssl/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'access_token_w_onewayssl' 11 | dut = env.get_dut(app_name, 'examples/authentication/a12_access_token_w_onewayssl') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/authentication/a12_access_token_w_onewayssl/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "access_token_w_onewayssl_main.c" 4 | INCLUDE_DIRS "" 5 | EMBED_TXTFILES mqtt_thingsboard_server_cert.pem) 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/authentication/a12_access_token_w_onewayssl/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config TBC_TRANSPORT_ADDRESS_HOST 4 | string "Hostname, to set ipv4 pass it as string" 5 | default "" 6 | help 7 | Hostname to connect to server/broker 8 | 9 | config TBC_TRANSPORT_ADDRESS_PORT 10 | int "Port" 11 | default 8883 12 | help 13 | MQTT over TCP:1883. MQTT over SSL: 8883. MQTT over WebSocket:80. MQTT over WebSocket Secure:443. 14 | 15 | config TBC_TRANSPORT_ACCESS_TOKEN 16 | string "Access Token" 17 | default "" 18 | help 19 | Access token to connect to broker 20 | 21 | config TBC_TRANSPORT_SKIP_CERT_COMMON_NAME_CHECK 22 | prompt "Skip any validation of server certificate CN field" 23 | bool 24 | default true 25 | help 26 | Skip any validation of server certificate CN field, this reduces the 27 | security of TLS and makes the mqtt client susceptible to MITM attacks 28 | 29 | endmenu 30 | -------------------------------------------------------------------------------- /examples/authentication/a12_access_token_w_onewayssl/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json 7 | COMPONENT_EMBED_TXTFILES := mqtt_thingsboard_server_cert.pem -------------------------------------------------------------------------------- /examples/authentication/a12_access_token_w_onewayssl/main/mqtt_thingsboard_server_cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB8TCCAZegAwIBAgIUIhfgcWGR8rLEgp2S29bN3iiIKjcwCgYIKoZIzj0EAwIw 3 | TjELMAkGA1UEBhMCQ04xCzAJBgNVBAgMAkhLMSEwHwYDVQQKDBhJbnRlcm5ldCBX 4 | aWRnaXRzIFB0eSBMdGQxDzANBgNVBAMMBkVTUC1UQjAeFw0yMzAxMDIwMzAxMjla 5 | Fw0yNDAxMDIwMzAxMjlaME4xCzAJBgNVBAYTAkNOMQswCQYDVQQIDAJISzEhMB8G 6 | A1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMQ8wDQYDVQQDDAZFU1AtVEIw 7 | WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARiDSfabSxy/73uBQbuBKfPuTIRPErm 8 | QMg2JxITWKIFU6GL5q6uFnIgbGAx0xrzG+RRqXJsIMfdTQG3HFanlTbbo1MwUTAd 9 | BgNVHQ4EFgQURcU7VC4OxRT6Yu//6hJYQzVWr8kwHwYDVR0jBBgwFoAURcU7VC4O 10 | xRT6Yu//6hJYQzVWr8kwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNIADBF 11 | AiBjrCDIC5fRAorK05MGojVdAGcsNzNvg0zLzNwCTRN66AIhAI6FbwA/HrUD4ZAJ 12 | 6c+5NgoZVlkeYzFsVZPFapkhFhKn 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /examples/authentication/a12_access_token_w_onewayssl/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/authentication/a21_basic_mqtt_credential_c_wo_ssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(basic_mqtt_credential_c_wo_ssl) 11 | -------------------------------------------------------------------------------- /examples/authentication/a21_basic_mqtt_credential_c_wo_ssl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := basic_mqtt_credential_c_wo_ssl 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/authentication/a21_basic_mqtt_credential_c_wo_ssl/basic_mqtt_credential_c_wo_ssl_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/authentication/a21_basic_mqtt_credential_c_wo_ssl/basic_mqtt_credential_c_wo_ssl_1.png -------------------------------------------------------------------------------- /examples/authentication/a21_basic_mqtt_credential_c_wo_ssl/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'basic_mqtt_credential_c_wo_ssl' 11 | dut = env.get_dut(app_name, 'examples/authentication/a21_basic_mqtt_credential_c_wo_ssl') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/authentication/a21_basic_mqtt_credential_c_wo_ssl/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "basic_mqtt_credential_c_wo_ssl_main.c" 4 | INCLUDE_DIRS "") 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/authentication/a21_basic_mqtt_credential_c_wo_ssl/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config TBC_TRANSPORT_ADDRESS_HOST 4 | string "Hostname, to set ipv4 pass it as string" 5 | default "" 6 | help 7 | Hostname to connect to server/broker 8 | 9 | config TBC_TRANSPORT_ADDRESS_PORT 10 | int "Port" 11 | default 1883 12 | help 13 | MQTT over TCP:1883. MQTT over SSL: 8883. MQTT over WebSocket:80. MQTT over WebSocket Secure:443. 14 | 15 | config TBC_TRANSPORT_CREDENTIALS_CLIENT_ID 16 | string "Client ID" 17 | default "" 18 | help 19 | Client ID to connect to broker 20 | 21 | endmenu 22 | -------------------------------------------------------------------------------- /examples/authentication/a21_basic_mqtt_credential_c_wo_ssl/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json -------------------------------------------------------------------------------- /examples/authentication/a21_basic_mqtt_credential_c_wo_ssl/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/authentication/a22_basic_mqtt_credential_up_wo_ssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(basic_mqtt_credential_up_wo_ssl) 11 | -------------------------------------------------------------------------------- /examples/authentication/a22_basic_mqtt_credential_up_wo_ssl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := basic_mqtt_credential_up_wo_ssl 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/authentication/a22_basic_mqtt_credential_up_wo_ssl/basic_mqtt_credential_up_wo_ssl_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/authentication/a22_basic_mqtt_credential_up_wo_ssl/basic_mqtt_credential_up_wo_ssl_1.png -------------------------------------------------------------------------------- /examples/authentication/a22_basic_mqtt_credential_up_wo_ssl/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'basic_mqtt_credential_up_wo_ssl' 11 | dut = env.get_dut(app_name, 'examples/authentication/a22_basic_mqtt_credential_up_wo_ssl') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/authentication/a22_basic_mqtt_credential_up_wo_ssl/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "basic_mqtt_credential_up_wo_ssl_main.c" 4 | INCLUDE_DIRS "") 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/authentication/a22_basic_mqtt_credential_up_wo_ssl/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config TBC_TRANSPORT_ADDRESS_HOST 4 | string "Hostname, to set ipv4 pass it as string" 5 | default "" 6 | help 7 | Hostname to connect to server/broker 8 | 9 | config TBC_TRANSPORT_ADDRESS_PORT 10 | int "Port" 11 | default 1883 12 | help 13 | MQTT over TCP:1883. MQTT over SSL: 8883. MQTT over WebSocket:80. MQTT over WebSocket Secure:443. 14 | 15 | config TBC_TRANSPORT_CREDENTIALS_USER_NAME 16 | string "User name" 17 | default "" 18 | help 19 | User name to connect to broker 20 | 21 | config TBC_TRANSPORT_CREDENTIALS_PASSWORD 22 | string "Password" 23 | default "" 24 | help 25 | Password to connect to broker 26 | 27 | endmenu 28 | -------------------------------------------------------------------------------- /examples/authentication/a22_basic_mqtt_credential_up_wo_ssl/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json -------------------------------------------------------------------------------- /examples/authentication/a22_basic_mqtt_credential_up_wo_ssl/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/authentication/a23_basic_mqtt_credential_cup_wo_ssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(basic_mqtt_credential_cup_wo_ssl) 11 | -------------------------------------------------------------------------------- /examples/authentication/a23_basic_mqtt_credential_cup_wo_ssl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := basic_mqtt_credential_cup_wo_ssl 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/authentication/a23_basic_mqtt_credential_cup_wo_ssl/basic_mqtt_credential_cup_wo_ssl_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/authentication/a23_basic_mqtt_credential_cup_wo_ssl/basic_mqtt_credential_cup_wo_ssl_1.png -------------------------------------------------------------------------------- /examples/authentication/a23_basic_mqtt_credential_cup_wo_ssl/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'basic_mqtt_credential_cup_wo_ssl' 11 | dut = env.get_dut(app_name, 'examples/authentication/a23_basic_mqtt_credential_cup_wo_ssl') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/authentication/a23_basic_mqtt_credential_cup_wo_ssl/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "basic_mqtt_credential_cup_wo_ssl_main.c" 4 | INCLUDE_DIRS "") 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/authentication/a23_basic_mqtt_credential_cup_wo_ssl/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config TBC_TRANSPORT_ADDRESS_HOST 4 | string "Hostname, to set ipv4 pass it as string" 5 | default "" 6 | help 7 | Hostname to connect to server/broker 8 | 9 | config TBC_TRANSPORT_ADDRESS_PORT 10 | int "Port" 11 | default 1883 12 | help 13 | MQTT over TCP:1883. MQTT over SSL: 8883. MQTT over WebSocket:80. MQTT over WebSocket Secure:443. 14 | 15 | config TBC_TRANSPORT_CREDENTIALS_CLIENT_ID 16 | string "Client ID" 17 | default "" 18 | help 19 | Client ID to connect to broker 20 | 21 | config TBC_TRANSPORT_CREDENTIALS_USER_NAME 22 | string "User name" 23 | default "" 24 | help 25 | User name to connect to broker 26 | 27 | config TBC_TRANSPORT_CREDENTIALS_PASSWORD 28 | string "Password" 29 | default "" 30 | help 31 | Password to connect to broker 32 | 33 | endmenu 34 | -------------------------------------------------------------------------------- /examples/authentication/a23_basic_mqtt_credential_cup_wo_ssl/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json -------------------------------------------------------------------------------- /examples/authentication/a23_basic_mqtt_credential_cup_wo_ssl/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/authentication/a24_basic_mqtt_credential_cup_w_onewayssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(basic_mqtt_credential_cup_w_onewayssl) 11 | -------------------------------------------------------------------------------- /examples/authentication/a24_basic_mqtt_credential_cup_w_onewayssl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := basic_mqtt_credential_cup_w_onewayssl 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/authentication/a24_basic_mqtt_credential_cup_w_onewayssl/basic_mqtt_credential_cup_w_onewayssl_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/authentication/a24_basic_mqtt_credential_cup_w_onewayssl/basic_mqtt_credential_cup_w_onewayssl_1.png -------------------------------------------------------------------------------- /examples/authentication/a24_basic_mqtt_credential_cup_w_onewayssl/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'basic_mqtt_credential_cup_w_onewayssl' 11 | dut = env.get_dut(app_name, 'examples/authentication/a24_basic_mqtt_credential_cup_w_onewayssl') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/authentication/a24_basic_mqtt_credential_cup_w_onewayssl/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "basic_mqtt_credential_cup_w_onewayssl_main.c" 4 | INCLUDE_DIRS "" 5 | EMBED_TXTFILES mqtt_thingsboard_server_cert.pem) 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/authentication/a24_basic_mqtt_credential_cup_w_onewayssl/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config TBC_TRANSPORT_ADDRESS_HOST 4 | string "Hostname, to set ipv4 pass it as string" 5 | default "" 6 | help 7 | Hostname to connect to server/broker 8 | 9 | config TBC_TRANSPORT_ADDRESS_PORT 10 | int "Port" 11 | default 8883 12 | help 13 | MQTT over TCP:1883. MQTT over SSL: 8883. MQTT over WebSocket:80. MQTT over WebSocket Secure:443. 14 | 15 | config TBC_TRANSPORT_CREDENTIALS_CLIENT_ID 16 | string "Client ID" 17 | default "" 18 | help 19 | Client ID to connect to broker 20 | 21 | config TBC_TRANSPORT_CREDENTIALS_USER_NAME 22 | string "User name" 23 | default "" 24 | help 25 | User name to connect to broker 26 | 27 | config TBC_TRANSPORT_CREDENTIALS_PASSWORD 28 | string "Password" 29 | default "" 30 | help 31 | Password to connect to broker 32 | 33 | config TBC_TRANSPORT_SKIP_CERT_COMMON_NAME_CHECK 34 | prompt "Skip any validation of server certificate CN field" 35 | bool 36 | default true 37 | help 38 | Skip any validation of server certificate CN field, this reduces the 39 | security of TLS and makes the mqtt client susceptible to MITM attacks 40 | 41 | 42 | endmenu 43 | -------------------------------------------------------------------------------- /examples/authentication/a24_basic_mqtt_credential_cup_w_onewayssl/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json 7 | COMPONENT_EMBED_TXTFILES := mqtt_thingsboard_server_cert.pem -------------------------------------------------------------------------------- /examples/authentication/a24_basic_mqtt_credential_cup_w_onewayssl/main/mqtt_thingsboard_server_cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB8TCCAZegAwIBAgIUIhfgcWGR8rLEgp2S29bN3iiIKjcwCgYIKoZIzj0EAwIw 3 | TjELMAkGA1UEBhMCQ04xCzAJBgNVBAgMAkhLMSEwHwYDVQQKDBhJbnRlcm5ldCBX 4 | aWRnaXRzIFB0eSBMdGQxDzANBgNVBAMMBkVTUC1UQjAeFw0yMzAxMDIwMzAxMjla 5 | Fw0yNDAxMDIwMzAxMjlaME4xCzAJBgNVBAYTAkNOMQswCQYDVQQIDAJISzEhMB8G 6 | A1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMQ8wDQYDVQQDDAZFU1AtVEIw 7 | WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARiDSfabSxy/73uBQbuBKfPuTIRPErm 8 | QMg2JxITWKIFU6GL5q6uFnIgbGAx0xrzG+RRqXJsIMfdTQG3HFanlTbbo1MwUTAd 9 | BgNVHQ4EFgQURcU7VC4OxRT6Yu//6hJYQzVWr8kwHwYDVR0jBBgwFoAURcU7VC4O 10 | xRT6Yu//6hJYQzVWr8kwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNIADBF 11 | AiBjrCDIC5fRAorK05MGojVdAGcsNzNvg0zLzNwCTRN66AIhAI6FbwA/HrUD4ZAJ 12 | 6c+5NgoZVlkeYzFsVZPFapkhFhKn 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /examples/authentication/a24_basic_mqtt_credential_cup_w_onewayssl/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/authentication/a31_x.509_ceritificate_w_twowayssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(x.509_ceritificate_w_twowayssl) 11 | -------------------------------------------------------------------------------- /examples/authentication/a31_x.509_ceritificate_w_twowayssl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := x.509_ceritificate_w_twowayssl 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/authentication/a31_x.509_ceritificate_w_twowayssl/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'x.509_ceritificate_w_twowayssl' 11 | dut = env.get_dut(app_name, 'examples/authentication/a31_x.509_ceritificate_w_twowayssl') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/authentication/a31_x.509_ceritificate_w_twowayssl/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "x.509_ceritificate_w_twowayssl_main.c" 4 | INCLUDE_DIRS "" 5 | EMBED_TXTFILES mqtt_thingsboard_server_cert.pem client.crt client.key) 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/authentication/a31_x.509_ceritificate_w_twowayssl/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example ThingsBoard MQTT Configuration" 2 | 3 | config TBC_TRANSPORT_ADDRESS_HOST 4 | string "Hostname, to set ipv4 pass it as string" 5 | default "" 6 | help 7 | Hostname to connect to server/broker 8 | 9 | config TBC_TRANSPORT_ADDRESS_PORT 10 | int "Port" 11 | default 8883 12 | help 13 | MQTT over TCP:1883. MQTT over SSL: 8883. MQTT over WebSocket:80. MQTT over WebSocket Secure:443. 14 | 15 | config TBC_TRANSPORT_SKIP_CERT_COMMON_NAME_CHECK 16 | prompt "Skip any validation of server certificate CN field" 17 | bool 18 | default true 19 | help 20 | Skip any validation of server certificate CN field, this reduces the 21 | security of TLS and makes the mqtt client susceptible to MITM attacks 22 | 23 | endmenu 24 | -------------------------------------------------------------------------------- /examples/authentication/a31_x.509_ceritificate_w_twowayssl/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json 7 | COMPONENT_EMBED_TXTFILES := mqtt_thingsboard_server_cert.pem 8 | COMPONENT_EMBED_TXTFILES += client.crt 9 | COMPONENT_EMBED_TXTFILES += client.key -------------------------------------------------------------------------------- /examples/authentication/a31_x.509_ceritificate_w_twowayssl/main/mqtt_thingsboard_server_cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB8TCCAZegAwIBAgIUIhfgcWGR8rLEgp2S29bN3iiIKjcwCgYIKoZIzj0EAwIw 3 | TjELMAkGA1UEBhMCQ04xCzAJBgNVBAgMAkhLMSEwHwYDVQQKDBhJbnRlcm5ldCBX 4 | aWRnaXRzIFB0eSBMdGQxDzANBgNVBAMMBkVTUC1UQjAeFw0yMzAxMDIwMzAxMjla 5 | Fw0yNDAxMDIwMzAxMjlaME4xCzAJBgNVBAYTAkNOMQswCQYDVQQIDAJISzEhMB8G 6 | A1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMQ8wDQYDVQQDDAZFU1AtVEIw 7 | WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARiDSfabSxy/73uBQbuBKfPuTIRPErm 8 | QMg2JxITWKIFU6GL5q6uFnIgbGAx0xrzG+RRqXJsIMfdTQG3HFanlTbbo1MwUTAd 9 | BgNVHQ4EFgQURcU7VC4OxRT6Yu//6hJYQzVWr8kwHwYDVR0jBBgwFoAURcU7VC4O 10 | xRT6Yu//6hJYQzVWr8kwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNIADBF 11 | AiBjrCDIC5fRAorK05MGojVdAGcsNzNvg0zLzNwCTRN66AIhAI6FbwA/HrUD4ZAJ 12 | 6c+5NgoZVlkeYzFsVZPFapkhFhKn 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /examples/authentication/a31_x.509_ceritificate_w_twowayssl/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/authentication/a31_x.509_ceritificate_w_twowayssl/x.509_ceritificate_w_twowayssl_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/authentication/a31_x.509_ceritificate_w_twowayssl/x.509_ceritificate_w_twowayssl_1.png -------------------------------------------------------------------------------- /examples/extension/e10_timeseries_data/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(timeseries_data) 11 | -------------------------------------------------------------------------------- /examples/extension/e10_timeseries_data/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := timeseries_data 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/extension/e10_timeseries_data/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'timeseries_data' 11 | dut = env.get_dut(app_name, 'examples/extension/e10_timeseries_data') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/extension/e10_timeseries_data/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "timeseries_data_main.c" 4 | INCLUDE_DIRS "") 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/extension/e10_timeseries_data/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config BROKER_URL 4 | string "Broker URL" 5 | default "mqtt://mqtt.eclipseprojects.io" 6 | help 7 | URL of the broker to connect to ThingsBoard (MQTT) Server, eg, 8 | "mqtt://iot.eclipse.org" : MQTT over TCP, default port 1883 9 | "mqtt://iot.eclipse.org:1884" : MQTT over TCP, port 1884 10 | "mqtt://username:password@iot.eclipse.org:1884" : MQTT over TCP, port 1884, with username and password 11 | 12 | 13 | config ACCESS_TOKEN 14 | string "Access Token" 15 | default "" 16 | help 17 | Access token to connect to broker 18 | 19 | config BROKER_URL_FROM_STDIN 20 | bool 21 | default y if BROKER_URL = "FROM_STDIN" 22 | 23 | 24 | config ACCESS_TOKEN_FROM_STDIN 25 | bool 26 | default y if ACCESS_TOKEN = "FROM_STDIN" 27 | 28 | endmenu 29 | -------------------------------------------------------------------------------- /examples/extension/e10_timeseries_data/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json -------------------------------------------------------------------------------- /examples/extension/e10_timeseries_data/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/extension/e20_client_attributes/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(client_attributes) 11 | -------------------------------------------------------------------------------- /examples/extension/e20_client_attributes/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := client_attributes 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/extension/e20_client_attributes/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'client_attributes' 11 | dut = env.get_dut(app_name, 'examples/extension/e20_client_attributes') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/extension/e20_client_attributes/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "client_attributes_main.c" 4 | INCLUDE_DIRS "") 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/extension/e20_client_attributes/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config BROKER_URL 4 | string "Broker URL" 5 | default "mqtt://mqtt.eclipseprojects.io" 6 | help 7 | URL of the broker to connect to ThingsBoard (MQTT) Server, eg, 8 | "mqtt://iot.eclipse.org" : MQTT over TCP, default port 1883 9 | "mqtt://iot.eclipse.org:1884" : MQTT over TCP, port 1884 10 | "mqtt://username:password@iot.eclipse.org:1884" : MQTT over TCP, port 1884, with username and password 11 | 12 | 13 | config ACCESS_TOKEN 14 | string "Access Token" 15 | default "" 16 | help 17 | Access token to connect to broker 18 | 19 | config BROKER_URL_FROM_STDIN 20 | bool 21 | default y if BROKER_URL = "FROM_STDIN" 22 | 23 | 24 | config ACCESS_TOKEN_FROM_STDIN 25 | bool 26 | default y if ACCESS_TOKEN = "FROM_STDIN" 27 | 28 | endmenu 29 | -------------------------------------------------------------------------------- /examples/extension/e20_client_attributes/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json -------------------------------------------------------------------------------- /examples/extension/e20_client_attributes/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/extension/e30_shared_attributes/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(shared_attributes) 11 | -------------------------------------------------------------------------------- /examples/extension/e30_shared_attributes/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := shared_attributes 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/extension/e30_shared_attributes/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'shared_attributes' 11 | dut = env.get_dut(app_name, 'examples/extension/21_shared_attributes') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/extension/e30_shared_attributes/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "shared_attributes_main.c" 4 | INCLUDE_DIRS "") 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/extension/e30_shared_attributes/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config BROKER_URL 4 | string "Broker URL" 5 | default "mqtt://mqtt.eclipseprojects.io" 6 | help 7 | URL of the broker to connect to ThingsBoard (MQTT) Server, eg, 8 | "mqtt://iot.eclipse.org" : MQTT over TCP, default port 1883 9 | "mqtt://iot.eclipse.org:1884" : MQTT over TCP, port 1884 10 | "mqtt://username:password@iot.eclipse.org:1884" : MQTT over TCP, port 1884, with username and password 11 | 12 | 13 | config ACCESS_TOKEN 14 | string "Access Token" 15 | default "" 16 | help 17 | Access token to connect to broker 18 | 19 | config BROKER_URL_FROM_STDIN 20 | bool 21 | default y if BROKER_URL = "FROM_STDIN" 22 | 23 | 24 | config ACCESS_TOKEN_FROM_STDIN 25 | bool 26 | default y if ACCESS_TOKEN = "FROM_STDIN" 27 | 28 | endmenu 29 | -------------------------------------------------------------------------------- /examples/extension/e30_shared_attributes/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json -------------------------------------------------------------------------------- /examples/extension/e30_shared_attributes/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/getstarted/g00_hello_world/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's 2 | # CMakeLists in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | set(EXTRA_COMPONENT_DIRS ../../../components/tbcmh) 6 | 7 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 8 | project(hello_world) 9 | -------------------------------------------------------------------------------- /examples/getstarted/g00_hello_world/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := hello_world 7 | 8 | EXTRA_COMPONENT_DIRS := ../../../components/tbcmh 9 | 10 | include $(IDF_PATH)/make/project.mk 11 | -------------------------------------------------------------------------------- /examples/getstarted/g00_hello_world/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'hello_world' 11 | dut = env.get_dut(app_name, 'examples/getstarted/g00_hello_world') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/getstarted/g00_hello_world/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "hello_world_main.c" 4 | INCLUDE_DIRS "") 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/getstarted/g00_hello_world/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json -------------------------------------------------------------------------------- /examples/getstarted/g00_hello_world/main/hello_world_main.c: -------------------------------------------------------------------------------- 1 | /* Hello World Example 2 | 3 | This example code is in the Public Domain (or CC0 licensed, at your option.) 4 | 5 | Unless required by applicable law or agreed to in writing, this 6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 7 | CONDITIONS OF ANY KIND, either express or implied. 8 | */ 9 | #include 10 | #include "sdkconfig.h" 11 | #include "freertos/FreeRTOS.h" 12 | #include "freertos/task.h" 13 | #include "esp_system.h" 14 | #include "esp_spi_flash.h" 15 | 16 | void app_main(void) 17 | { 18 | printf("Hello world!\n"); 19 | 20 | /* Print chip information */ 21 | esp_chip_info_t chip_info; 22 | esp_chip_info(&chip_info); 23 | printf("This is %s chip with %d CPU core(s), WiFi%s%s, ", 24 | CONFIG_IDF_TARGET, 25 | chip_info.cores, 26 | (chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "", 27 | (chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : ""); 28 | 29 | printf("silicon revision %d, ", chip_info.revision); 30 | 31 | printf("%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024), 32 | (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external"); 33 | 34 | printf("Minimum free heap size: %d bytes\n", esp_get_minimum_free_heap_size()); 35 | 36 | for (int i = 10; i >= 0; i--) { 37 | printf("Restarting in %d seconds...\n", i); 38 | vTaskDelay(1000 / portTICK_PERIOD_MS); 39 | } 40 | printf("Restarting now.\n"); 41 | fflush(stdout); 42 | esp_restart(); 43 | } 44 | -------------------------------------------------------------------------------- /examples/getstarted/g00_hello_world/sdkconfig.ci: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/getstarted/g00_hello_world/sdkconfig.ci -------------------------------------------------------------------------------- /examples/helper/h10_telemetry_upload/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(telemetry_upload) 11 | -------------------------------------------------------------------------------- /examples/helper/h10_telemetry_upload/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := telemetry_upload 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/helper/h10_telemetry_upload/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'telemetry_upload' 11 | dut = env.get_dut(app_name, 'examples/helper/h10_telemetry_upload') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/helper/h10_telemetry_upload/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "telemetry_upload_main.c" 4 | INCLUDE_DIRS "") 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/helper/h10_telemetry_upload/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config BROKER_URL 4 | string "Broker URL" 5 | default "mqtt://mqtt.eclipseprojects.io" 6 | help 7 | URL of the broker to connect to ThingsBoard (MQTT) Server, eg, 8 | "mqtt://iot.eclipse.org" : MQTT over TCP, default port 1883 9 | "mqtt://iot.eclipse.org:1884" : MQTT over TCP, port 1884 10 | "mqtt://username:password@iot.eclipse.org:1884" : MQTT over TCP, port 1884, with username and password 11 | 12 | 13 | config ACCESS_TOKEN 14 | string "Access Token" 15 | default "" 16 | help 17 | Access token to connect to broker 18 | 19 | config BROKER_URL_FROM_STDIN 20 | bool 21 | default y if BROKER_URL = "FROM_STDIN" 22 | 23 | 24 | config ACCESS_TOKEN_FROM_STDIN 25 | bool 26 | default y if ACCESS_TOKEN = "FROM_STDIN" 27 | 28 | endmenu 29 | -------------------------------------------------------------------------------- /examples/helper/h10_telemetry_upload/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json -------------------------------------------------------------------------------- /examples/helper/h10_telemetry_upload/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/helper/h20_attributes_update/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(attributes_update) 11 | -------------------------------------------------------------------------------- /examples/helper/h20_attributes_update/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := attributes_update 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/helper/h20_attributes_update/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'attributes_update' 11 | dut = env.get_dut(app_name, 'examples/helper/h20_attributes_update') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/helper/h20_attributes_update/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "attributes_update_main.c" 4 | INCLUDE_DIRS "") 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/helper/h20_attributes_update/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config BROKER_URL 4 | string "Broker URL" 5 | default "mqtt://mqtt.eclipseprojects.io" 6 | help 7 | URL of the broker to connect to ThingsBoard (MQTT) Server, eg, 8 | "mqtt://iot.eclipse.org" : MQTT over TCP, default port 1883 9 | "mqtt://iot.eclipse.org:1884" : MQTT over TCP, port 1884 10 | "mqtt://username:password@iot.eclipse.org:1884" : MQTT over TCP, port 1884, with username and password 11 | 12 | 13 | config ACCESS_TOKEN 14 | string "Access Token" 15 | default "" 16 | help 17 | Access token to connect to broker 18 | 19 | config BROKER_URL_FROM_STDIN 20 | bool 21 | default y if BROKER_URL = "FROM_STDIN" 22 | 23 | 24 | config ACCESS_TOKEN_FROM_STDIN 25 | bool 26 | default y if ACCESS_TOKEN = "FROM_STDIN" 27 | 28 | endmenu 29 | -------------------------------------------------------------------------------- /examples/helper/h20_attributes_update/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json -------------------------------------------------------------------------------- /examples/helper/h20_attributes_update/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/helper/h21_attributes_subscribe/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(attributes_subscribe) 11 | -------------------------------------------------------------------------------- /examples/helper/h21_attributes_subscribe/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := attributes_subscribe 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/helper/h21_attributes_subscribe/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'attributes_subscribe' 11 | dut = env.get_dut(app_name, 'examples/helper/h21_attributes_subscribe') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/helper/h21_attributes_subscribe/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "attributes_subscribe_main.c" 4 | INCLUDE_DIRS "") 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/helper/h21_attributes_subscribe/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config BROKER_URL 4 | string "Broker URL" 5 | default "mqtt://mqtt.eclipseprojects.io" 6 | help 7 | URL of the broker to connect to ThingsBoard (MQTT) Server, eg, 8 | "mqtt://iot.eclipse.org" : MQTT over TCP, default port 1883 9 | "mqtt://iot.eclipse.org:1884" : MQTT over TCP, port 1884 10 | "mqtt://username:password@iot.eclipse.org:1884" : MQTT over TCP, port 1884, with username and password 11 | 12 | 13 | config ACCESS_TOKEN 14 | string "Access Token" 15 | default "" 16 | help 17 | Access token to connect to broker 18 | 19 | config BROKER_URL_FROM_STDIN 20 | bool 21 | default y if BROKER_URL = "FROM_STDIN" 22 | 23 | 24 | config ACCESS_TOKEN_FROM_STDIN 25 | bool 26 | default y if ACCESS_TOKEN = "FROM_STDIN" 27 | 28 | endmenu 29 | -------------------------------------------------------------------------------- /examples/helper/h21_attributes_subscribe/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json -------------------------------------------------------------------------------- /examples/helper/h21_attributes_subscribe/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/helper/h22_attributes_request/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(attribute_request) 11 | -------------------------------------------------------------------------------- /examples/helper/h22_attributes_request/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := attribute_request 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/helper/h22_attributes_request/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'attribute_request' 11 | dut = env.get_dut(app_name, 'examples/helper/22_attribute_request') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/helper/h22_attributes_request/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "attribute_request_main.c" 4 | INCLUDE_DIRS "") 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/helper/h22_attributes_request/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config BROKER_URL 4 | string "Broker URL" 5 | default "mqtt://mqtt.eclipseprojects.io" 6 | help 7 | URL of the broker to connect to ThingsBoard (MQTT) Server, eg, 8 | "mqtt://iot.eclipse.org" : MQTT over TCP, default port 1883 9 | "mqtt://iot.eclipse.org:1884" : MQTT over TCP, port 1884 10 | "mqtt://username:password@iot.eclipse.org:1884" : MQTT over TCP, port 1884, with username and password 11 | 12 | 13 | config ACCESS_TOKEN 14 | string "Access Token" 15 | default "" 16 | help 17 | Access token to connect to broker 18 | 19 | config BROKER_URL_FROM_STDIN 20 | bool 21 | default y if BROKER_URL = "FROM_STDIN" 22 | 23 | 24 | config ACCESS_TOKEN_FROM_STDIN 25 | bool 26 | default y if ACCESS_TOKEN = "FROM_STDIN" 27 | 28 | endmenu 29 | -------------------------------------------------------------------------------- /examples/helper/h22_attributes_request/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json -------------------------------------------------------------------------------- /examples/helper/h22_attributes_request/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/helper/h30_server_side_rpc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(server_side_rpc) 11 | -------------------------------------------------------------------------------- /examples/helper/h30_server_side_rpc/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := server_side_rpc 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/helper/h30_server_side_rpc/Root-Rule-Chain_4_Server-RPC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/helper/h30_server_side_rpc/Root-Rule-Chain_4_Server-RPC.png -------------------------------------------------------------------------------- /examples/helper/h30_server_side_rpc/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'server_side_rpc' 11 | dut = env.get_dut(app_name, 'examples/helper/h30_server_side_rpc') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/helper/h30_server_side_rpc/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "server_side_rpc_main.c" 4 | INCLUDE_DIRS "") 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/helper/h30_server_side_rpc/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config BROKER_URL 4 | string "Broker URL" 5 | default "mqtt://mqtt.eclipseprojects.io" 6 | help 7 | URL of the broker to connect to ThingsBoard (MQTT) Server, eg, 8 | "mqtt://iot.eclipse.org" : MQTT over TCP, default port 1883 9 | "mqtt://iot.eclipse.org:1884" : MQTT over TCP, port 1884 10 | "mqtt://username:password@iot.eclipse.org:1884" : MQTT over TCP, port 1884, with username and password 11 | 12 | 13 | config ACCESS_TOKEN 14 | string "Access Token" 15 | default "" 16 | help 17 | Access token to connect to broker 18 | 19 | config BROKER_URL_FROM_STDIN 20 | bool 21 | default y if BROKER_URL = "FROM_STDIN" 22 | 23 | 24 | config ACCESS_TOKEN_FROM_STDIN 25 | bool 26 | default y if ACCESS_TOKEN = "FROM_STDIN" 27 | 28 | endmenu 29 | -------------------------------------------------------------------------------- /examples/helper/h30_server_side_rpc/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json -------------------------------------------------------------------------------- /examples/helper/h30_server_side_rpc/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/helper/h31_client_side_rpc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(client_side_rpc) 11 | -------------------------------------------------------------------------------- /examples/helper/h31_client_side_rpc/ESP-IDF-Thingsboard-MQTT_Client-side_RPC_Test_Rule_Chain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/helper/h31_client_side_rpc/ESP-IDF-Thingsboard-MQTT_Client-side_RPC_Test_Rule_Chain.png -------------------------------------------------------------------------------- /examples/helper/h31_client_side_rpc/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := client_side_rpc 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/helper/h31_client_side_rpc/Root_Rule_Chain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/helper/h31_client_side_rpc/Root_Rule_Chain.png -------------------------------------------------------------------------------- /examples/helper/h31_client_side_rpc/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'client_side_rpc' 11 | dut = env.get_dut(app_name, 'examples/helper/h31_client_side_rpc') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/helper/h31_client_side_rpc/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "client_side_rpc_main.c" 4 | INCLUDE_DIRS "") 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/helper/h31_client_side_rpc/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config BROKER_URL 4 | string "Broker URL" 5 | default "mqtt://mqtt.eclipseprojects.io" 6 | help 7 | URL of the broker to connect to ThingsBoard (MQTT) Server, eg, 8 | "mqtt://iot.eclipse.org" : MQTT over TCP, default port 1883 9 | "mqtt://iot.eclipse.org:1884" : MQTT over TCP, port 1884 10 | "mqtt://username:password@iot.eclipse.org:1884" : MQTT over TCP, port 1884, with username and password 11 | 12 | 13 | config ACCESS_TOKEN 14 | string "Access Token" 15 | default "" 16 | help 17 | Access token to connect to broker 18 | 19 | config BROKER_URL_FROM_STDIN 20 | bool 21 | default y if BROKER_URL = "FROM_STDIN" 22 | 23 | 24 | config ACCESS_TOKEN_FROM_STDIN 25 | bool 26 | default y if ACCESS_TOKEN = "FROM_STDIN" 27 | 28 | endmenu 29 | -------------------------------------------------------------------------------- /examples/helper/h31_client_side_rpc/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json -------------------------------------------------------------------------------- /examples/helper/h31_client_side_rpc/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/helper/h40_claiming_device/1_device_claiming_dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/helper/h40_claiming_device/1_device_claiming_dashboard.png -------------------------------------------------------------------------------- /examples/helper/h40_claiming_device/2_assign_dashboard_to_customer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/helper/h40_claiming_device/2_assign_dashboard_to_customer.png -------------------------------------------------------------------------------- /examples/helper/h40_claiming_device/3_unassign_device_from_cusotmer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/helper/h40_claiming_device/3_unassign_device_from_cusotmer.png -------------------------------------------------------------------------------- /examples/helper/h40_claiming_device/4_claiming_device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/helper/h40_claiming_device/4_claiming_device.png -------------------------------------------------------------------------------- /examples/helper/h40_claiming_device/5_device_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/helper/h40_claiming_device/5_device_list.png -------------------------------------------------------------------------------- /examples/helper/h40_claiming_device/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(claiming_device) 11 | -------------------------------------------------------------------------------- /examples/helper/h40_claiming_device/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := claiming_device 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/helper/h40_claiming_device/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'claiming_device' 11 | dut = env.get_dut(app_name, 'examples/helper/30_claiming_device') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/helper/h40_claiming_device/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "claiming_device_main.c" 4 | INCLUDE_DIRS "") 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/helper/h40_claiming_device/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config BROKER_URL 4 | string "Broker URL" 5 | default "mqtt://mqtt.eclipseprojects.io" 6 | help 7 | URL of the broker to connect to ThingsBoard (MQTT) Server, eg, 8 | "mqtt://iot.eclipse.org" : MQTT over TCP, default port 1883 9 | "mqtt://iot.eclipse.org:1884" : MQTT over TCP, port 1884 10 | "mqtt://username:password@iot.eclipse.org:1884" : MQTT over TCP, port 1884, with username and password 11 | 12 | 13 | config ACCESS_TOKEN 14 | string "Access Token" 15 | default "" 16 | help 17 | Access token to connect to broker 18 | 19 | config BROKER_URL_FROM_STDIN 20 | bool 21 | default y if BROKER_URL = "FROM_STDIN" 22 | 23 | 24 | config ACCESS_TOKEN_FROM_STDIN 25 | bool 26 | default y if ACCESS_TOKEN = "FROM_STDIN" 27 | 28 | endmenu 29 | -------------------------------------------------------------------------------- /examples/helper/h40_claiming_device/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json -------------------------------------------------------------------------------- /examples/helper/h40_claiming_device/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/helper/h50_fw_update/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | set(PROJECT_VER "0.1.0.1") 10 | 11 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 12 | project(fw_update) 13 | -------------------------------------------------------------------------------- /examples/helper/h50_fw_update/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := fw_update 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/helper/h50_fw_update/fw_ota_1_upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/helper/h50_fw_update/fw_ota_1_upload.png -------------------------------------------------------------------------------- /examples/helper/h50_fw_update/fw_ota_2_uploaded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/helper/h50_fw_update/fw_ota_2_uploaded.png -------------------------------------------------------------------------------- /examples/helper/h50_fw_update/fw_ota_3_update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/helper/h50_fw_update/fw_ota_3_update.png -------------------------------------------------------------------------------- /examples/helper/h50_fw_update/fw_ota_4_updated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/helper/h50_fw_update/fw_ota_4_updated.png -------------------------------------------------------------------------------- /examples/helper/h50_fw_update/fw_ota_5_updated_history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/helper/h50_fw_update/fw_ota_5_updated_history.png -------------------------------------------------------------------------------- /examples/helper/h50_fw_update/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "fw_update_main.c" 4 | INCLUDE_DIRS "") 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/helper/h50_fw_update/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example Configuration" 2 | 3 | config BROKER_URL 4 | string "Broker URL" 5 | default "mqtt://mqtt.eclipseprojects.io" 6 | help 7 | URL of the broker to connect to ThingsBoard (MQTT) Server, eg, 8 | "mqtt://iot.eclipse.org" : MQTT over TCP, default port 1883 9 | "mqtt://iot.eclipse.org:1884" : MQTT over TCP, port 1884 10 | "mqtt://username:password@iot.eclipse.org:1884" : MQTT over TCP, port 1884, with username and password 11 | 12 | 13 | config ACCESS_TOKEN 14 | string "Access Token" 15 | default "" 16 | help 17 | Access token to connect to broker 18 | 19 | config BROKER_URL_FROM_STDIN 20 | bool 21 | default y if BROKER_URL = "FROM_STDIN" 22 | 23 | 24 | config ACCESS_TOKEN_FROM_STDIN 25 | bool 26 | default y if ACCESS_TOKEN = "FROM_STDIN" 27 | 28 | endmenu 29 | -------------------------------------------------------------------------------- /examples/helper/h50_fw_update/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json -------------------------------------------------------------------------------- /examples/helper/h50_fw_update/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/provision/pd11_dev_sup_access_token_wo_ssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(dev_sup_access_token_wo_ssl) 11 | -------------------------------------------------------------------------------- /examples/provision/pd11_dev_sup_access_token_wo_ssl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := dev_sup_access_token_wo_ssl 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/provision/pd11_dev_sup_access_token_wo_ssl/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'dev_sup_access_token_wo_ssl' 11 | dut = env.get_dut(app_name, 'examples/provision/pd11_dev_sup_access_token_wo_ssl') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/provision/pd11_dev_sup_access_token_wo_ssl/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "dev_sup_access_token_wo_ssl_main.c" 4 | "tbc_front_connection.c" 5 | "tbc_normal_connection.c" 6 | "tbc_transport_credentials_memory.c" 7 | INCLUDE_DIRS "") 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/provision/pd11_dev_sup_access_token_wo_ssl/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example ThingsBoard MQTT Configuration" 2 | 3 | menu "Transport server address" 4 | config TBC_TRANSPORT_ADDRESS_HOST 5 | string "Hostname, to set ipv4 pass it as string" 6 | default "" 7 | help 8 | Hostname to connect to server/broker 9 | 10 | config TBC_TRANSPORT_ADDRESS_PORT 11 | int "Port" 12 | default 1883 13 | help 14 | MQTT over TCP:1883. MQTT over SSL: 8883. MQTT over WebSocket:80. MQTT over WebSocket Secure:443. 15 | endmenu 16 | 17 | menu "Provisioning config" 18 | config TBC_PROVISION_DEVICE_NAME 19 | string "Device name (Optional)" 20 | default "" 21 | help 22 | e.g., ESP32 chip ID 23 | 24 | config TBC_PROVISION_DEVICE_KEY 25 | string "Device key" 26 | default "" 27 | help 28 | ThingsBoard --> Device profiles --> Click a row --> Device provisiong --> Provison device key. 29 | 30 | config TBC_PROVISION_DEVICE_SECRET 31 | string "Device secret" 32 | default "" 33 | help 34 | ThingsBoard --> Device profiles --> Click a row --> Device provisiong --> Provison device secret. 35 | 36 | config TBC_PROVISION_TOKEN 37 | string "Token" 38 | default "" 39 | endmenu 40 | 41 | endmenu 42 | -------------------------------------------------------------------------------- /examples/provision/pd11_dev_sup_access_token_wo_ssl/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json 7 | 8 | # embed files from the "certs" directory as binary data symbols 9 | # in the app 10 | # COMPONENT_EMBED_TXTFILES := mqtt_thingsboard_server_cert.pem 11 | # COMPONENT_EMBED_TXTFILES += client.crt 12 | # COMPONENT_EMBED_TXTFILES += client.key 13 | -------------------------------------------------------------------------------- /examples/provision/pd11_dev_sup_access_token_wo_ssl/main/tbc_transport_credentials_memory.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 liangzhuzhi2020@gmail.com, https://github.com/liang-zhu-zi/esp32-thingsboard-mqtt-client 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // ThingsBoard Client transprot credentials in memory API 16 | 17 | #ifndef _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 18 | #define _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 19 | 20 | #include "tbc_transport_config.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | //#define TBC_TRANSPORT_AUTH_CONFIG_PATH "xxxx" 27 | 28 | void tbc_transport_credentials_memory_init(void); 29 | void tbc_transport_credentials_memory_uninit(void); 30 | const tbc_transport_credentials_config_t *tbc_transport_credentials_memory_get(void); 31 | bool tbc_transport_credentials_memory_save(const tbc_transport_credentials_config_t *credentials); 32 | void tbc_transport_credentials_memory_clean(void); 33 | bool tbc_transport_credentials_memory_is_existed(void); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif //__cplusplus 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /examples/provision/pd11_dev_sup_access_token_wo_ssl/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/provision/pd12_dev_sup_access_token_w_onewayssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(dev_sup_access_token_w_onewayssl) 11 | -------------------------------------------------------------------------------- /examples/provision/pd12_dev_sup_access_token_w_onewayssl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := dev_sup_access_token_w_onewayssl 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/provision/pd12_dev_sup_access_token_w_onewayssl/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'dev_sup_access_token_w_onewayssl' 11 | dut = env.get_dut(app_name, 'examples/provision/pd12_dev_sup_access_token_w_onewayssl') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/provision/pd12_dev_sup_access_token_w_onewayssl/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "dev_sup_access_token_w_onewayssl_main.c" 4 | "tbc_front_connection.c" 5 | "tbc_normal_connection.c" 6 | "tbc_transport_credentials_memory.c" 7 | INCLUDE_DIRS "" 8 | EMBED_TXTFILES mqtt_thingsboard_server_cert.pem) 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/provision/pd12_dev_sup_access_token_w_onewayssl/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json 7 | 8 | # embed files from the "certs" directory as binary data symbols 9 | # in the app 10 | COMPONENT_EMBED_TXTFILES := mqtt_thingsboard_server_cert.pem 11 | # COMPONENT_EMBED_TXTFILES += client.crt 12 | # COMPONENT_EMBED_TXTFILES += client.key 13 | -------------------------------------------------------------------------------- /examples/provision/pd12_dev_sup_access_token_w_onewayssl/main/mqtt_thingsboard_server_cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB8TCCAZegAwIBAgIUIhfgcWGR8rLEgp2S29bN3iiIKjcwCgYIKoZIzj0EAwIw 3 | TjELMAkGA1UEBhMCQ04xCzAJBgNVBAgMAkhLMSEwHwYDVQQKDBhJbnRlcm5ldCBX 4 | aWRnaXRzIFB0eSBMdGQxDzANBgNVBAMMBkVTUC1UQjAeFw0yMzAxMDIwMzAxMjla 5 | Fw0yNDAxMDIwMzAxMjlaME4xCzAJBgNVBAYTAkNOMQswCQYDVQQIDAJISzEhMB8G 6 | A1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMQ8wDQYDVQQDDAZFU1AtVEIw 7 | WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARiDSfabSxy/73uBQbuBKfPuTIRPErm 8 | QMg2JxITWKIFU6GL5q6uFnIgbGAx0xrzG+RRqXJsIMfdTQG3HFanlTbbo1MwUTAd 9 | BgNVHQ4EFgQURcU7VC4OxRT6Yu//6hJYQzVWr8kwHwYDVR0jBBgwFoAURcU7VC4O 10 | xRT6Yu//6hJYQzVWr8kwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNIADBF 11 | AiBjrCDIC5fRAorK05MGojVdAGcsNzNvg0zLzNwCTRN66AIhAI6FbwA/HrUD4ZAJ 12 | 6c+5NgoZVlkeYzFsVZPFapkhFhKn 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /examples/provision/pd12_dev_sup_access_token_w_onewayssl/main/tbc_transport_credentials_memory.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 liangzhuzhi2020@gmail.com, https://github.com/liang-zhu-zi/esp32-thingsboard-mqtt-client 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // ThingsBoard Client transprot credentials in memory API 16 | 17 | #ifndef _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 18 | #define _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 19 | 20 | #include "tbc_transport_config.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | //#define TBC_TRANSPORT_AUTH_CONFIG_PATH "xxxx" 27 | 28 | void tbc_transport_credentials_memory_init(void); 29 | void tbc_transport_credentials_memory_uninit(void); 30 | const tbc_transport_credentials_config_t *tbc_transport_credentials_memory_get(void); 31 | bool tbc_transport_credentials_memory_save(const tbc_transport_credentials_config_t *credentials); 32 | void tbc_transport_credentials_memory_clean(void); 33 | bool tbc_transport_credentials_memory_is_existed(void); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif //__cplusplus 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /examples/provision/pd12_dev_sup_access_token_w_onewayssl/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/provision/pd21_dev_sup_basic_mqtt_credential_c_wo_ssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(dev_sup_basic_mqtt_credential_c_wo_ssl) 11 | -------------------------------------------------------------------------------- /examples/provision/pd21_dev_sup_basic_mqtt_credential_c_wo_ssl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := dev_sup_basic_mqtt_credential_c_wo_ssl 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/provision/pd21_dev_sup_basic_mqtt_credential_c_wo_ssl/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'dev_sup_basic_mqtt_credential_c_wo_ssl' 11 | dut = env.get_dut(app_name, 'examples/provision/pd21_dev_sup_basic_mqtt_credential_c_wo_ssl') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/provision/pd21_dev_sup_basic_mqtt_credential_c_wo_ssl/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "dev_sup_basic_mqtt_credential_c_wo_ssl_main.c" 4 | "tbc_front_connection.c" 5 | "tbc_normal_connection.c" 6 | "tbc_transport_credentials_memory.c" 7 | INCLUDE_DIRS "") 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/provision/pd21_dev_sup_basic_mqtt_credential_c_wo_ssl/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example ThingsBoard MQTT Configuration" 2 | 3 | menu "Transport server address" 4 | config TBC_TRANSPORT_ADDRESS_HOST 5 | string "Hostname, to set ipv4 pass it as string" 6 | default "" 7 | help 8 | Hostname to connect to server/broker 9 | 10 | config TBC_TRANSPORT_ADDRESS_PORT 11 | int "Port" 12 | default 1883 13 | help 14 | MQTT over TCP:1883. MQTT over SSL: 8883. MQTT over WebSocket:80. MQTT over WebSocket Secure:443. 15 | endmenu 16 | 17 | menu "Provisioning config" 18 | config TBC_PROVISION_DEVICE_NAME 19 | string "Device name (Optional)" 20 | default "" 21 | help 22 | e.g., ESP32 chip ID 23 | 24 | config TBC_PROVISION_DEVICE_KEY 25 | string "Device key" 26 | default "" 27 | help 28 | ThingsBoard --> Device profiles --> Click a row --> Device provisiong --> Provison device key. 29 | 30 | config TBC_PROVISION_DEVICE_SECRET 31 | string "Device secret" 32 | default "" 33 | help 34 | ThingsBoard --> Device profiles --> Click a row --> Device provisiong --> Provison device secret. 35 | 36 | config TBC_PROVISION_CLIENT_ID 37 | string "Client ID" 38 | default "" 39 | endmenu 40 | 41 | endmenu 42 | -------------------------------------------------------------------------------- /examples/provision/pd21_dev_sup_basic_mqtt_credential_c_wo_ssl/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json 7 | 8 | # embed files from the "certs" directory as binary data symbols 9 | # in the app 10 | # COMPONENT_EMBED_TXTFILES := mqtt_thingsboard_server_cert.pem 11 | # COMPONENT_EMBED_TXTFILES += client.crt 12 | # COMPONENT_EMBED_TXTFILES += client.key 13 | -------------------------------------------------------------------------------- /examples/provision/pd21_dev_sup_basic_mqtt_credential_c_wo_ssl/main/tbc_transport_credentials_memory.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 liangzhuzhi2020@gmail.com, https://github.com/liang-zhu-zi/esp32-thingsboard-mqtt-client 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // ThingsBoard Client transprot credentials in memory API 16 | 17 | #ifndef _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 18 | #define _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 19 | 20 | #include "tbc_transport_config.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | //#define TBC_TRANSPORT_AUTH_CONFIG_PATH "xxxx" 27 | 28 | void tbc_transport_credentials_memory_init(void); 29 | void tbc_transport_credentials_memory_uninit(void); 30 | const tbc_transport_credentials_config_t *tbc_transport_credentials_memory_get(void); 31 | bool tbc_transport_credentials_memory_save(const tbc_transport_credentials_config_t *credentials); 32 | void tbc_transport_credentials_memory_clean(void); 33 | bool tbc_transport_credentials_memory_is_existed(void); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif //__cplusplus 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /examples/provision/pd21_dev_sup_basic_mqtt_credential_c_wo_ssl/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/provision/pd22_dev_sup_basic_mqtt_credential_up_wo_ssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(dev_sup_basic_mqtt_credential_up_wo_ssl) 11 | -------------------------------------------------------------------------------- /examples/provision/pd22_dev_sup_basic_mqtt_credential_up_wo_ssl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := dev_sup_basic_mqtt_credential_up_wo_ssl 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/provision/pd22_dev_sup_basic_mqtt_credential_up_wo_ssl/Root_Rule_Chain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/pd22_dev_sup_basic_mqtt_credential_up_wo_ssl/Root_Rule_Chain.png -------------------------------------------------------------------------------- /examples/provision/pd22_dev_sup_basic_mqtt_credential_up_wo_ssl/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'dev_sup_basic_mqtt_credential_up_wo_ssl' 11 | dut = env.get_dut(app_name, 'examples/provision/pd22_dev_up_basic_mqtt_credential_cup_wo_ssl') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/provision/pd22_dev_sup_basic_mqtt_credential_up_wo_ssl/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "dev_sup_basic_mqtt_credential_up_wo_ssl_main.c" 4 | "tbc_front_connection.c" 5 | "tbc_normal_connection.c" 6 | "tbc_transport_credentials_memory.c" 7 | INCLUDE_DIRS "") 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/provision/pd22_dev_sup_basic_mqtt_credential_up_wo_ssl/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example ThingsBoard MQTT Configuration" 2 | 3 | menu "Transport server address" 4 | config TBC_TRANSPORT_ADDRESS_HOST 5 | string "Hostname, to set ipv4 pass it as string" 6 | default "" 7 | help 8 | Hostname to connect to server/broker 9 | 10 | config TBC_TRANSPORT_ADDRESS_PORT 11 | int "Port" 12 | default 1883 13 | help 14 | MQTT over TCP:1883. MQTT over SSL: 8883. MQTT over WebSocket:80. MQTT over WebSocket Secure:443. 15 | endmenu 16 | 17 | menu "Provisioning config" 18 | config TBC_PROVISION_DEVICE_NAME 19 | string "Device name (Optional)" 20 | default "" 21 | help 22 | e.g., ESP32 chip ID 23 | 24 | config TBC_PROVISION_DEVICE_KEY 25 | string "Device key" 26 | default "" 27 | help 28 | ThingsBoard --> Device profiles --> Click a row --> Device provisiong --> Provison device key. 29 | 30 | config TBC_PROVISION_DEVICE_SECRET 31 | string "Device secret" 32 | default "" 33 | help 34 | ThingsBoard --> Device profiles --> Click a row --> Device provisiong --> Provison device secret. 35 | 36 | config TBC_PROVISION_USER_NAME 37 | string "User name" 38 | default "" 39 | 40 | config TBC_PROVISION_PASSWORD 41 | string "Password" 42 | default "" 43 | 44 | endmenu 45 | 46 | endmenu 47 | -------------------------------------------------------------------------------- /examples/provision/pd22_dev_sup_basic_mqtt_credential_up_wo_ssl/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json 7 | 8 | # embed files from the "certs" directory as binary data symbols 9 | # in the app 10 | # COMPONENT_EMBED_TXTFILES := mqtt_thingsboard_server_cert.pem 11 | # COMPONENT_EMBED_TXTFILES += client.crt 12 | # COMPONENT_EMBED_TXTFILES += client.key 13 | -------------------------------------------------------------------------------- /examples/provision/pd22_dev_sup_basic_mqtt_credential_up_wo_ssl/main/tbc_transport_credentials_memory.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 liangzhuzhi2020@gmail.com, https://github.com/liang-zhu-zi/esp32-thingsboard-mqtt-client 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // ThingsBoard Client transprot credentials in memory API 16 | 17 | #ifndef _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 18 | #define _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 19 | 20 | #include "tbc_transport_config.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | //#define TBC_TRANSPORT_AUTH_CONFIG_PATH "xxxx" 27 | 28 | void tbc_transport_credentials_memory_init(void); 29 | void tbc_transport_credentials_memory_uninit(void); 30 | const tbc_transport_credentials_config_t *tbc_transport_credentials_memory_get(void); 31 | bool tbc_transport_credentials_memory_save(const tbc_transport_credentials_config_t *credentials); 32 | void tbc_transport_credentials_memory_clean(void); 33 | bool tbc_transport_credentials_memory_is_existed(void); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif //__cplusplus 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /examples/provision/pd22_dev_sup_basic_mqtt_credential_up_wo_ssl/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/provision/pd23_dev_sup_basic_mqtt_credential_cup_wo_ssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(dev_sup_basic_mqtt_credential_cup_wo_ssl) 11 | -------------------------------------------------------------------------------- /examples/provision/pd23_dev_sup_basic_mqtt_credential_cup_wo_ssl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := dev_sup_basic_mqtt_credential_cup_wo_ssl 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/provision/pd23_dev_sup_basic_mqtt_credential_cup_wo_ssl/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'dev_sup_basic_mqtt_credential_cup_wo_ssl' 11 | dut = env.get_dut(app_name, 'examples/provision/pd23_dev_sup_basic_mqtt_credential_cup_wo_ssl') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/provision/pd23_dev_sup_basic_mqtt_credential_cup_wo_ssl/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "dev_sup_basic_mqtt_credential_cup_wo_ssl_main.c" 4 | "tbc_front_connection.c" 5 | "tbc_normal_connection.c" 6 | "tbc_transport_credentials_memory.c" 7 | INCLUDE_DIRS "") 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/provision/pd23_dev_sup_basic_mqtt_credential_cup_wo_ssl/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example ThingsBoard MQTT Configuration" 2 | 3 | menu "Transport server address" 4 | config TBC_TRANSPORT_ADDRESS_HOST 5 | string "Hostname, to set ipv4 pass it as string" 6 | default "" 7 | help 8 | Hostname to connect to server/broker 9 | 10 | config TBC_TRANSPORT_ADDRESS_PORT 11 | int "Port" 12 | default 1883 13 | help 14 | MQTT over TCP:1883. MQTT over SSL: 8883. MQTT over WebSocket:80. MQTT over WebSocket Secure:443. 15 | endmenu 16 | 17 | menu "Provisioning config" 18 | config TBC_PROVISION_DEVICE_NAME 19 | string "Device name (Optional)" 20 | default "" 21 | help 22 | e.g., ESP32 chip ID 23 | 24 | config TBC_PROVISION_DEVICE_KEY 25 | string "Device key" 26 | default "" 27 | help 28 | ThingsBoard --> Device profiles --> Click a row --> Device provisiong --> Provison device key. 29 | 30 | config TBC_PROVISION_DEVICE_SECRET 31 | string "Device secret" 32 | default "" 33 | help 34 | ThingsBoard --> Device profiles --> Click a row --> Device provisiong --> Provison device secret. 35 | 36 | config TBC_PROVISION_CLIENT_ID 37 | string "Client ID" 38 | default "" 39 | 40 | config TBC_PROVISION_USER_NAME 41 | string "User name" 42 | default "" 43 | 44 | config TBC_PROVISION_PASSWORD 45 | string "Password" 46 | default "" 47 | 48 | endmenu 49 | 50 | endmenu 51 | -------------------------------------------------------------------------------- /examples/provision/pd23_dev_sup_basic_mqtt_credential_cup_wo_ssl/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json 7 | 8 | # embed files from the "certs" directory as binary data symbols 9 | # in the app 10 | # COMPONENT_EMBED_TXTFILES := mqtt_thingsboard_server_cert.pem 11 | # COMPONENT_EMBED_TXTFILES += client.crt 12 | # COMPONENT_EMBED_TXTFILES += client.key 13 | -------------------------------------------------------------------------------- /examples/provision/pd23_dev_sup_basic_mqtt_credential_cup_wo_ssl/main/tbc_transport_credentials_memory.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 liangzhuzhi2020@gmail.com, https://github.com/liang-zhu-zi/esp32-thingsboard-mqtt-client 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // ThingsBoard Client transprot credentials in memory API 16 | 17 | #ifndef _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 18 | #define _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 19 | 20 | #include "tbc_transport_config.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | //#define TBC_TRANSPORT_AUTH_CONFIG_PATH "xxxx" 27 | 28 | void tbc_transport_credentials_memory_init(void); 29 | void tbc_transport_credentials_memory_uninit(void); 30 | const tbc_transport_credentials_config_t *tbc_transport_credentials_memory_get(void); 31 | bool tbc_transport_credentials_memory_save(const tbc_transport_credentials_config_t *credentials); 32 | void tbc_transport_credentials_memory_clean(void); 33 | bool tbc_transport_credentials_memory_is_existed(void); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif //__cplusplus 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /examples/provision/pd23_dev_sup_basic_mqtt_credential_cup_wo_ssl/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/provision/pd24_dev_sup_basic_mqtt_credential_cup_w_onewayssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(dev_sup_basic_mqtt_credential_cup_w_onewayssl) 11 | -------------------------------------------------------------------------------- /examples/provision/pd24_dev_sup_basic_mqtt_credential_cup_w_onewayssl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := dev_sup_basic_mqtt_credential_cup_w_onewayssl 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/provision/pd24_dev_sup_basic_mqtt_credential_cup_w_onewayssl/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'dev_sup_basic_mqtt_credential_cup_w_onewayssl' 11 | dut = env.get_dut(app_name, 'examples/provision/pd24_dev_sup_basic_mqtt_credential_cup_w_onewayssl') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/provision/pd24_dev_sup_basic_mqtt_credential_cup_w_onewayssl/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "dev_sup_basic_mqtt_credential_cup_w_onewayssl_main.c" 4 | "tbc_front_connection.c" 5 | "tbc_normal_connection.c" 6 | "tbc_transport_credentials_memory.c" 7 | INCLUDE_DIRS "" 8 | EMBED_TXTFILES mqtt_thingsboard_server_cert.pem) 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/provision/pd24_dev_sup_basic_mqtt_credential_cup_w_onewayssl/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json 7 | 8 | # embed files from the "certs" directory as binary data symbols 9 | # in the app 10 | COMPONENT_EMBED_TXTFILES := mqtt_thingsboard_server_cert.pem 11 | # COMPONENT_EMBED_TXTFILES += client.crt 12 | # COMPONENT_EMBED_TXTFILES += client.key 13 | -------------------------------------------------------------------------------- /examples/provision/pd24_dev_sup_basic_mqtt_credential_cup_w_onewayssl/main/mqtt_thingsboard_server_cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB8TCCAZegAwIBAgIUIhfgcWGR8rLEgp2S29bN3iiIKjcwCgYIKoZIzj0EAwIw 3 | TjELMAkGA1UEBhMCQ04xCzAJBgNVBAgMAkhLMSEwHwYDVQQKDBhJbnRlcm5ldCBX 4 | aWRnaXRzIFB0eSBMdGQxDzANBgNVBAMMBkVTUC1UQjAeFw0yMzAxMDIwMzAxMjla 5 | Fw0yNDAxMDIwMzAxMjlaME4xCzAJBgNVBAYTAkNOMQswCQYDVQQIDAJISzEhMB8G 6 | A1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMQ8wDQYDVQQDDAZFU1AtVEIw 7 | WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARiDSfabSxy/73uBQbuBKfPuTIRPErm 8 | QMg2JxITWKIFU6GL5q6uFnIgbGAx0xrzG+RRqXJsIMfdTQG3HFanlTbbo1MwUTAd 9 | BgNVHQ4EFgQURcU7VC4OxRT6Yu//6hJYQzVWr8kwHwYDVR0jBBgwFoAURcU7VC4O 10 | xRT6Yu//6hJYQzVWr8kwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNIADBF 11 | AiBjrCDIC5fRAorK05MGojVdAGcsNzNvg0zLzNwCTRN66AIhAI6FbwA/HrUD4ZAJ 12 | 6c+5NgoZVlkeYzFsVZPFapkhFhKn 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /examples/provision/pd24_dev_sup_basic_mqtt_credential_cup_w_onewayssl/main/tbc_transport_credentials_memory.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 liangzhuzhi2020@gmail.com, https://github.com/liang-zhu-zi/esp32-thingsboard-mqtt-client 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // ThingsBoard Client transprot credentials in memory API 16 | 17 | #ifndef _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 18 | #define _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 19 | 20 | #include "tbc_transport_config.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | //#define TBC_TRANSPORT_AUTH_CONFIG_PATH "xxxx" 27 | 28 | void tbc_transport_credentials_memory_init(void); 29 | void tbc_transport_credentials_memory_uninit(void); 30 | const tbc_transport_credentials_config_t *tbc_transport_credentials_memory_get(void); 31 | bool tbc_transport_credentials_memory_save(const tbc_transport_credentials_config_t *credentials); 32 | void tbc_transport_credentials_memory_clean(void); 33 | bool tbc_transport_credentials_memory_is_existed(void); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif //__cplusplus 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /examples/provision/pd24_dev_sup_basic_mqtt_credential_cup_w_onewayssl/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/provision/pd31_dev_sup_x.509_ceritificate_w_twowayssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(dev_sup_x.509_ceritificate_w_twowayssl) 11 | -------------------------------------------------------------------------------- /examples/provision/pd31_dev_sup_x.509_ceritificate_w_twowayssl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := dev_sup_x.509_ceritificate_w_twowayssl 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/provision/pd31_dev_sup_x.509_ceritificate_w_twowayssl/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'dev_sup_x.509_ceritificate_w_twowayssl' 11 | dut = env.get_dut(app_name, 'examples/provision/pd31_dev_sup_x.509_ceritificate_w_twowayssl') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/provision/pd31_dev_sup_x.509_ceritificate_w_twowayssl/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "dev_sup_x.509_ceritificate_w_twowayssl_main.c" 4 | "tbc_front_connection.c" 5 | "tbc_normal_connection.c" 6 | "tbc_transport_credentials_memory.c" 7 | INCLUDE_DIRS "" 8 | EMBED_TXTFILES mqtt_thingsboard_server_cert.pem client.crt client.key) 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/provision/pd31_dev_sup_x.509_ceritificate_w_twowayssl/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json 7 | 8 | # embed files from the "certs" directory as binary data symbols 9 | # in the app 10 | COMPONENT_EMBED_TXTFILES := mqtt_thingsboard_server_cert.pem 11 | COMPONENT_EMBED_TXTFILES += client.crt 12 | COMPONENT_EMBED_TXTFILES += client.key 13 | -------------------------------------------------------------------------------- /examples/provision/pd31_dev_sup_x.509_ceritificate_w_twowayssl/main/mqtt_thingsboard_server_cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB8TCCAZegAwIBAgIUIhfgcWGR8rLEgp2S29bN3iiIKjcwCgYIKoZIzj0EAwIw 3 | TjELMAkGA1UEBhMCQ04xCzAJBgNVBAgMAkhLMSEwHwYDVQQKDBhJbnRlcm5ldCBX 4 | aWRnaXRzIFB0eSBMdGQxDzANBgNVBAMMBkVTUC1UQjAeFw0yMzAxMDIwMzAxMjla 5 | Fw0yNDAxMDIwMzAxMjlaME4xCzAJBgNVBAYTAkNOMQswCQYDVQQIDAJISzEhMB8G 6 | A1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMQ8wDQYDVQQDDAZFU1AtVEIw 7 | WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARiDSfabSxy/73uBQbuBKfPuTIRPErm 8 | QMg2JxITWKIFU6GL5q6uFnIgbGAx0xrzG+RRqXJsIMfdTQG3HFanlTbbo1MwUTAd 9 | BgNVHQ4EFgQURcU7VC4OxRT6Yu//6hJYQzVWr8kwHwYDVR0jBBgwFoAURcU7VC4O 10 | xRT6Yu//6hJYQzVWr8kwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNIADBF 11 | AiBjrCDIC5fRAorK05MGojVdAGcsNzNvg0zLzNwCTRN66AIhAI6FbwA/HrUD4ZAJ 12 | 6c+5NgoZVlkeYzFsVZPFapkhFhKn 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /examples/provision/pd31_dev_sup_x.509_ceritificate_w_twowayssl/main/tbc_transport_credentials_memory.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 liangzhuzhi2020@gmail.com, https://github.com/liang-zhu-zi/esp32-thingsboard-mqtt-client 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // ThingsBoard Client transprot credentials in memory API 16 | 17 | #ifndef _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 18 | #define _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 19 | 20 | #include "tbc_transport_config.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | //#define TBC_TRANSPORT_AUTH_CONFIG_PATH "xxxx" 27 | 28 | void tbc_transport_credentials_memory_init(void); 29 | void tbc_transport_credentials_memory_uninit(void); 30 | const tbc_transport_credentials_config_t *tbc_transport_credentials_memory_get(void); 31 | bool tbc_transport_credentials_memory_save(const tbc_transport_credentials_config_t *credentials); 32 | void tbc_transport_credentials_memory_clean(void); 33 | bool tbc_transport_credentials_memory_is_existed(void); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif //__cplusplus 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /examples/provision/pd31_dev_sup_x.509_ceritificate_w_twowayssl/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(srv_gen_credentials_wo_ssl) 11 | -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := srv_gen_credentials_wo_ssl 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'srv_gen_credentials_wo_ssl' 11 | dut = env.get_dut(app_name, 'examples/provision/ps10_srv_gen_credentials_wo_ssl') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "srv_gen_credentials_wo_ssl_main.c" 4 | "tbc_front_connection.c" 5 | "tbc_normal_connection.c" 6 | "tbc_transport_credentials_memory.c" 7 | INCLUDE_DIRS "") 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "Example ThingsBoard MQTT Configuration" 2 | 3 | menu "Transport server address" 4 | config TBC_TRANSPORT_ADDRESS_HOST 5 | string "Hostname, to set ipv4 pass it as string" 6 | default "" 7 | help 8 | Hostname to connect to server/broker 9 | 10 | config TBC_TRANSPORT_ADDRESS_PORT 11 | int "Port" 12 | default 1883 13 | help 14 | MQTT over TCP:1883. MQTT over SSL: 8883. MQTT over WebSocket:80. MQTT over WebSocket Secure:443. 15 | endmenu 16 | 17 | menu "Provisioning config" 18 | config TBC_PROVISION_DEVICE_NAME 19 | string "Device name (Optional)" 20 | default "" 21 | help 22 | e.g., ESP32 chip ID 23 | 24 | config TBC_PROVISION_DEVICE_KEY 25 | string "Device key" 26 | default "" 27 | help 28 | ThingsBoard --> Device profiles --> Click a row --> Device provisiong --> Provison device key. 29 | 30 | config TBC_PROVISION_DEVICE_SECRET 31 | string "Device secret" 32 | default "" 33 | help 34 | ThingsBoard --> Device profiles --> Click a row --> Device provisiong --> Provison device secret. 35 | endmenu 36 | 37 | endmenu 38 | -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json 7 | 8 | # embed files from the "certs" directory as binary data symbols 9 | # in the app 10 | # COMPONENT_EMBED_TXTFILES := mqtt_thingsboard_server_cert.pem 11 | # COMPONENT_EMBED_TXTFILES += client.crt 12 | # COMPONENT_EMBED_TXTFILES += client.key 13 | -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/main/tbc_transport_credentials_memory.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 liangzhuzhi2020@gmail.com, https://github.com/liang-zhu-zi/esp32-thingsboard-mqtt-client 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // ThingsBoard Client transprot credentials in memory API 16 | 17 | #ifndef _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 18 | #define _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 19 | 20 | #include "tbc_transport_config.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | //#define TBC_TRANSPORT_AUTH_CONFIG_PATH "xxxx" 27 | 28 | void tbc_transport_credentials_memory_init(void); 29 | void tbc_transport_credentials_memory_uninit(void); 30 | const tbc_transport_credentials_config_t *tbc_transport_credentials_memory_get(void); 31 | bool tbc_transport_credentials_memory_save(const tbc_transport_credentials_config_t *credentials); 32 | void tbc_transport_credentials_memory_clean(void); 33 | bool tbc_transport_credentials_memory_is_existed(void); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif //__cplusplus 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-add_device_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-add_device_1.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-add_device_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-add_device_2.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-device_status_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-device_status_1.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-device_status_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-device_status_2.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-device_status_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-device_status_3.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-modify_device_profile_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-modify_device_profile_1.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-modify_device_profile_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-modify_device_profile_2.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-result_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-result_1.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-result_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_access_token_without_ssl-result_2.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_basic_mqtt_credential_c_u_p_without_ssl-add_device_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/pre-provisioned_server_generate_basic_mqtt_credential_c_u_p_without_ssl-add_device_2.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/server_generate_access_token_without_ssl_add_provision_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/server_generate_access_token_without_ssl_add_provision_1.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/server_generate_access_token_without_ssl_add_provision_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/server_generate_access_token_without_ssl_add_provision_2.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/server_generate_access_token_without_ssl_add_provision_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/server_generate_access_token_without_ssl_add_provision_3.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/server_generate_access_token_without_ssl_delete_device_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/server_generate_access_token_without_ssl_delete_device_1.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/server_generate_access_token_without_ssl_delete_device_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/server_generate_access_token_without_ssl_delete_device_2.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/server_generate_access_token_without_ssl_result_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/server_generate_access_token_without_ssl_result_1.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/server_generate_access_token_without_ssl_result_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/server_generate_access_token_without_ssl_result_2.png -------------------------------------------------------------------------------- /examples/provision/ps10_srv_gen_credentials_wo_ssl/server_generate_access_token_without_ssl_result_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps10_srv_gen_credentials_wo_ssl/server_generate_access_token_without_ssl_result_3.png -------------------------------------------------------------------------------- /examples/provision/ps20_srv_gen_credentials_w_onewayssl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(srv_gen_credentials_w_onewayssl) 11 | -------------------------------------------------------------------------------- /examples/provision/ps20_srv_gen_credentials_w_onewayssl/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := srv_gen_credentials_w_onewayssl 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/provision/ps20_srv_gen_credentials_w_onewayssl/case-ps12_server_generate_access_token_with_onewayssl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps20_srv_gen_credentials_w_onewayssl/case-ps12_server_generate_access_token_with_onewayssl -------------------------------------------------------------------------------- /examples/provision/ps20_srv_gen_credentials_w_onewayssl/case-ps24_1_server_generate_basic_mqtt_credential_c_with_onewayssl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps20_srv_gen_credentials_w_onewayssl/case-ps24_1_server_generate_basic_mqtt_credential_c_with_onewayssl -------------------------------------------------------------------------------- /examples/provision/ps20_srv_gen_credentials_w_onewayssl/case-ps24_2_server_generate_basic_mqtt_credential_u_p_with_onewayssl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps20_srv_gen_credentials_w_onewayssl/case-ps24_2_server_generate_basic_mqtt_credential_u_p_with_onewayssl -------------------------------------------------------------------------------- /examples/provision/ps20_srv_gen_credentials_w_onewayssl/case-ps24_3_server_generate_basic_mqtt_credential_c_u_p_with_onewayssl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/ps20_srv_gen_credentials_w_onewayssl/case-ps24_3_server_generate_basic_mqtt_credential_c_u_p_with_onewayssl -------------------------------------------------------------------------------- /examples/provision/ps20_srv_gen_credentials_w_onewayssl/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'srv_gen_credentials_w_onewayssl' 11 | dut = env.get_dut(app_name, 'examples/provision/ps20_srv_gen_credentials_w_onewayssl') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/provision/ps20_srv_gen_credentials_w_onewayssl/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "srv_gen_credentials_w_onewayssl_main.c" 4 | "tbc_front_connection.c" 5 | "tbc_normal_connection.c" 6 | "tbc_transport_credentials_memory.c" 7 | INCLUDE_DIRS "" 8 | EMBED_TXTFILES mqtt_thingsboard_server_cert.pem) 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/provision/ps20_srv_gen_credentials_w_onewayssl/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json 7 | 8 | # embed files from the "certs" directory as binary data symbols 9 | # in the app 10 | COMPONENT_EMBED_TXTFILES := mqtt_thingsboard_server_cert.pem 11 | # COMPONENT_EMBED_TXTFILES += client.crt 12 | # COMPONENT_EMBED_TXTFILES += client.key 13 | -------------------------------------------------------------------------------- /examples/provision/ps20_srv_gen_credentials_w_onewayssl/main/mqtt_thingsboard_server_cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB8TCCAZegAwIBAgIUIhfgcWGR8rLEgp2S29bN3iiIKjcwCgYIKoZIzj0EAwIw 3 | TjELMAkGA1UEBhMCQ04xCzAJBgNVBAgMAkhLMSEwHwYDVQQKDBhJbnRlcm5ldCBX 4 | aWRnaXRzIFB0eSBMdGQxDzANBgNVBAMMBkVTUC1UQjAeFw0yMzAxMDIwMzAxMjla 5 | Fw0yNDAxMDIwMzAxMjlaME4xCzAJBgNVBAYTAkNOMQswCQYDVQQIDAJISzEhMB8G 6 | A1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMQ8wDQYDVQQDDAZFU1AtVEIw 7 | WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARiDSfabSxy/73uBQbuBKfPuTIRPErm 8 | QMg2JxITWKIFU6GL5q6uFnIgbGAx0xrzG+RRqXJsIMfdTQG3HFanlTbbo1MwUTAd 9 | BgNVHQ4EFgQURcU7VC4OxRT6Yu//6hJYQzVWr8kwHwYDVR0jBBgwFoAURcU7VC4O 10 | xRT6Yu//6hJYQzVWr8kwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNIADBF 11 | AiBjrCDIC5fRAorK05MGojVdAGcsNzNvg0zLzNwCTRN66AIhAI6FbwA/HrUD4ZAJ 12 | 6c+5NgoZVlkeYzFsVZPFapkhFhKn 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /examples/provision/ps20_srv_gen_credentials_w_onewayssl/main/tbc_transport_credentials_memory.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 liangzhuzhi2020@gmail.com, https://github.com/liang-zhu-zi/esp32-thingsboard-mqtt-client 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // ThingsBoard Client transprot credentials in memory API 16 | 17 | #ifndef _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 18 | #define _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 19 | 20 | #include "tbc_transport_config.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | //#define TBC_TRANSPORT_AUTH_CONFIG_PATH "xxxx" 27 | 28 | void tbc_transport_credentials_memory_init(void); 29 | void tbc_transport_credentials_memory_uninit(void); 30 | const tbc_transport_credentials_config_t *tbc_transport_credentials_memory_get(void); 31 | bool tbc_transport_credentials_memory_save(const tbc_transport_credentials_config_t *credentials); 32 | void tbc_transport_credentials_memory_clean(void); 33 | bool tbc_transport_credentials_memory_is_existed(void); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif //__cplusplus 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /examples/provision/ps20_srv_gen_credentials_w_onewayssl/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/provision/px00_device_provisioning/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following four lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | # (Not part of the boilerplate) 6 | # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. 7 | set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common ../../../components/tbcmh) 8 | 9 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 10 | project(device_provisioning) 11 | -------------------------------------------------------------------------------- /examples/provision/px00_device_provisioning/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | PROJECT_NAME := device_provisioning 6 | 7 | EXTRA_COMPONENT_DIRS = $(IDF_PATH)/examples/common_components/protocol_examples_common ../../../components/tbcmh 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | -------------------------------------------------------------------------------- /examples/provision/px00_device_provisioning/Root_Rule_Chain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provision/px00_device_provisioning/Root_Rule_Chain.png -------------------------------------------------------------------------------- /examples/provision/px00_device_provisioning/example_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import division, print_function, unicode_literals 4 | 5 | import ttfw_idf 6 | 7 | 8 | @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) 9 | def test_examples_hello_world(env, extra_data): 10 | app_name = 'device_provisioning' 11 | dut = env.get_dut(app_name, 'examples/provision/px00_device_provisioning') #'examples/get-started/hello_world' 12 | dut.start_app() 13 | res = dut.expect(ttfw_idf.MINIMUM_FREE_HEAP_SIZE_RE) 14 | if not res: 15 | raise ValueError('Maximum heap size info not found') 16 | ttfw_idf.print_heap_size(app_name, dut.app.config_name, dut.TARGET, res[0]) 17 | 18 | 19 | if __name__ == '__main__': 20 | test_examples_hello_world() 21 | -------------------------------------------------------------------------------- /examples/provision/px00_device_provisioning/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #set(COMPONENT_REQUIRES json) 2 | 3 | idf_component_register(SRCS "device_provisioning_main.c" 4 | "tbc_front_connection.c" 5 | "tbc_normal_connection.c" 6 | "tbc_transport_credentials_memory.c" 7 | INCLUDE_DIRS "" 8 | EMBED_TXTFILES mqtt_thingsboard_server_cert.pem client.crt client.key) 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/provision/px00_device_provisioning/main/client.crt: -------------------------------------------------------------------------------- 1 | Please paste your client certificate here (follow instructions in README.md) 2 | -------------------------------------------------------------------------------- /examples/provision/px00_device_provisioning/main/client.key: -------------------------------------------------------------------------------- 1 | Please paste here your client key (follow instructions in README.md) 2 | -------------------------------------------------------------------------------- /examples/provision/px00_device_provisioning/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | #COMPONENT_REQUIRES := json 7 | 8 | # embed files from the "certs" directory as binary data symbols 9 | # in the app 10 | COMPONENT_EMBED_TXTFILES := mqtt_thingsboard_server_cert.pem 11 | COMPONENT_EMBED_TXTFILES += client.crt 12 | COMPONENT_EMBED_TXTFILES += client.key 13 | -------------------------------------------------------------------------------- /examples/provision/px00_device_provisioning/main/mqtt_thingsboard_server_cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIEAzCCAuugAwIBAgIUBY1hlCGvdj4NhBXkZ/uLUZNILAwwDQYJKoZIhvcNAQEL 3 | BQAwgZAxCzAJBgNVBAYTAkdCMRcwFQYDVQQIDA5Vbml0ZWQgS2luZ2RvbTEOMAwG 4 | A1UEBwwFRGVyYnkxEjAQBgNVBAoMCU1vc3F1aXR0bzELMAkGA1UECwwCQ0ExFjAU 5 | BgNVBAMMDW1vc3F1aXR0by5vcmcxHzAdBgkqhkiG9w0BCQEWEHJvZ2VyQGF0Y2hv 6 | by5vcmcwHhcNMjAwNjA5MTEwNjM5WhcNMzAwNjA3MTEwNjM5WjCBkDELMAkGA1UE 7 | BhMCR0IxFzAVBgNVBAgMDlVuaXRlZCBLaW5nZG9tMQ4wDAYDVQQHDAVEZXJieTES 8 | MBAGA1UECgwJTW9zcXVpdHRvMQswCQYDVQQLDAJDQTEWMBQGA1UEAwwNbW9zcXVp 9 | dHRvLm9yZzEfMB0GCSqGSIb3DQEJARYQcm9nZXJAYXRjaG9vLm9yZzCCASIwDQYJ 10 | KoZIhvcNAQEBBQADggEPADCCAQoCggEBAME0HKmIzfTOwkKLT3THHe+ObdizamPg 11 | UZmD64Tf3zJdNeYGYn4CEXbyP6fy3tWc8S2boW6dzrH8SdFf9uo320GJA9B7U1FW 12 | Te3xda/Lm3JFfaHjkWw7jBwcauQZjpGINHapHRlpiCZsquAthOgxW9SgDgYlGzEA 13 | s06pkEFiMw+qDfLo/sxFKB6vQlFekMeCymjLCbNwPJyqyhFmPWwio/PDMruBTzPH 14 | 3cioBnrJWKXc3OjXdLGFJOfj7pP0j/dr2LH72eSvv3PQQFl90CZPFhrCUcRHSSxo 15 | E6yjGOdnz7f6PveLIB574kQORwt8ePn0yidrTC1ictikED3nHYhMUOUCAwEAAaNT 16 | MFEwHQYDVR0OBBYEFPVV6xBUFPiGKDyo5V3+Hbh4N9YSMB8GA1UdIwQYMBaAFPVV 17 | 6xBUFPiGKDyo5V3+Hbh4N9YSMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL 18 | BQADggEBAGa9kS21N70ThM6/Hj9D7mbVxKLBjVWe2TPsGfbl3rEDfZ+OKRZ2j6AC 19 | 6r7jb4TZO3dzF2p6dgbrlU71Y/4K0TdzIjRj3cQ3KSm41JvUQ0hZ/c04iGDg/xWf 20 | +pp58nfPAYwuerruPNWmlStWAXf0UTqRtg4hQDWBuUFDJTuWuuBvEXudz74eh/wK 21 | sMwfu1HFvjy5Z0iMDU8PUDepjVolOCue9ashlS4EB5IECdSR2TItnAIiIwimx839 22 | LdUdRudafMu5T5Xma182OC0/u/xRlEm+tvKGGmfFcN0piqVl8OrSPBgIlb+1IKJE 23 | m/XriWr/Cq4h/JfB7NTsezVslgkBaoU= 24 | -----END CERTIFICATE----- 25 | -------------------------------------------------------------------------------- /examples/provision/px00_device_provisioning/main/tbc_transport_credentials_memory.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 liangzhuzhi2020@gmail.com, https://github.com/liang-zhu-zi/esp32-thingsboard-mqtt-client 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // ThingsBoard Client transprot credentials in memory API 16 | 17 | #ifndef _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 18 | #define _TBC_TRANSPORT_CREDENTIALS_MEMORY_H_ 19 | 20 | #include "tbc_transport_config.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | //#define TBC_TRANSPORT_AUTH_CONFIG_PATH "xxxx" 27 | 28 | void tbc_transport_credentials_memory_init(void); 29 | void tbc_transport_credentials_memory_uninit(void); 30 | const tbc_transport_credentials_config_t *tbc_transport_credentials_memory_get(void); 31 | bool tbc_transport_credentials_memory_save(const tbc_transport_credentials_config_t *credentials); 32 | void tbc_transport_credentials_memory_clean(void); 33 | bool tbc_transport_credentials_memory_is_existed(void); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif //__cplusplus 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /examples/provision/px00_device_provisioning/sdkconfig.ci: -------------------------------------------------------------------------------- 1 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y 2 | CONFIG_BROKER_URL="FROM_STDIN" 3 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n 4 | CONFIG_EXAMPLE_CONNECT_ETHERNET=y 5 | CONFIG_EXAMPLE_CONNECT_WIFI=n 6 | CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET=y 7 | CONFIG_EXAMPLE_ETH_PHY_IP101=y 8 | CONFIG_EXAMPLE_ETH_MDC_GPIO=23 9 | CONFIG_EXAMPLE_ETH_MDIO_GPIO=18 10 | CONFIG_EXAMPLE_ETH_PHY_RST_GPIO=5 11 | CONFIG_EXAMPLE_ETH_PHY_ADDR=1 12 | CONFIG_EXAMPLE_CONNECT_IPV6=y 13 | -------------------------------------------------------------------------------- /examples/provison/ps20_srv_gen_credentials_w_onewayssl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liang-zhu-zi/esp32-thingsboard-mqtt-client/39cf2817c61a32226fac5d111f95629432e49e44/examples/provison/ps20_srv_gen_credentials_w_onewayssl --------------------------------------------------------------------------------