Closed matteoscordino closed 5 years ago
Hi,
Thanks for reporting the issue. Our doxygen comment was not correct about IOT_BLE_ENABLE_MQTT
, it was for BLE data transfer service, not for setting which connection type to use in MQTT. So to clarify,
configENABLED_NETWORKS
in aws_iot_network_config.h
controls which module is being built, and initialized in demos. So if you set it to ( AWSIOT_NETWORK_TYPE_WIFI | AWSIOT_NETWORK_TYPE_BLE )
, then both WiFi and BLE will be built and initialized.
IOT_BLE_ENABLE_WIFI_PROVISIONING
is 0, then WiFi credentials in aws_clientcredential.h
will be used. If IOT_BLE_ENABLE_WIFI_PROVISIONING
is 1, then WiFi will be provisioned through BLE and the mobile app.democonfigNETWORK_TYPES
in aws_demo_config.h
controls which transportation layer is used for MQTT. If democonfigNETWORK_TYPES
is set to AWSIOT_NETWORK_TYPE_WIFI | AWSIOT_NETWORK_TYPE_BLE
, then the first connection available will used for MQTT. Based on the first point, if you want to provision WiFi through BLE, BLE will be connected first, and WiFi will be waiting until it's provisioned through the app, so in this case BLE will be used in MQTT.So, if you intention is to do WiFi provisioning through BLE, then use WiFi for MQTT,
#define configENABLED_NETWORKS ( AWSIOT_NETWORK_TYPE_WIFI | AWSIOT_NETWORK_TYPE_BLE )
in aws_iot_network_config.h
#define democonfigNETWORK_TYPES ( AWSIOT_NETWORK_TYPE_WIFI )
in aws_demo_config.h (Make sure it's set in the #if defined( CONFIG_MQTT_DEMO_ENABLED )
section)Thank you Tiangang,
that is exactly what I needed to achieve, and indeed it was all about understanding the intended usage of those configuration macros. I guess the related PR #1283 is not needed, I'll go ahead and close it.
Hi @matteoscordino,
Please let us know if you have any further questions. Closing issue.
Describe the bug It seems that if the define
BLE_ENABLED
is true, demos will try to use a BLE connection as an MQTT proxy regardless of whetherIOT_BLE_ENABLE_MQTT
is enabled. In other words, there is the assumption that a BLE connection will always have on the other end an app that uses the AWS Mobile SDK to provide an MQTT proxy. This is not true if we want to run the BLE Wifi Provisioning demo without the MQTT proxy. It is also a problem if in your device you only want to use BLE for WiFI provisioning, and then have NetworkManager handle the wifi connection (which is my use case) Of course, I might have misunderstood the meaning of the defines in question, but in my use case this seems to be an issue.System information
Expected behavior
To reproduce Steps to reproduce the behavior:
#define configENABLED_NETWORKS ( AWSIOT_NETWORK_TYPE_WIFI | AWSIOT_NETWORK_TYPE_BLE )
inaws_iot_network_config.h
#define IOT_BLE_ENABLE_MQTT (0)
iniot_ble_config.h
#define IOT_BLE_ENABLE_WIFI_PROVISIONING ( 1 )
iniot_ble_config.h
Additional context As a fix I have wrapped certain parts of
iot_demo_freertos.c
in#if BLE_ENABLED && (IOT_BLE_ENABLE_MQTT == 1)
checks. I can create a PR if this is considered valuable and I have not misunderstood the meaning of the defines in question Thank you!