Giter Site home page Giter Site logo

azure-iot-arduino's Introduction

AzureIoTHub - Azure IoT Hub library for Arduino

Stop! Before you proceed:

This Arduino Library is deprecated.

It is kept here for reference only and should not be used for any new development.

If you’re looking for an Arduino Library you should use the new version: aka.ms/arduino

You can find more information about it in this IoT Techcommunity blog post.

License

See LICENSE file.

Complete information for contributing to the Azure IoT Arduino libraries

can be found here.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

azure-iot-arduino's People

Contributors

asergaz avatar az-iot-builder-01 avatar danewalton avatar davidbradburyattunix avatar ericwol-msft avatar ewertons avatar gregman-msft avatar jbobotek avatar joecoolish avatar mamokarz avatar obsoleted avatar oneweekiot avatar rafilho avatar sandeepmistry avatar stefangordon avatar tameraw avatar wduraes avatar yaohaizh avatar yaweiw avatar yodama avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-iot-arduino's Issues

Explore replacing default agenttime.c adapter

From discussion in #16 (comment)

The default agenttime.c is currently used, and then the POSIX based time layer is implemented in src/samd/time.cpp using RTCZero on SAMD.

We should explore using a custom agenttime.h implementation that is backed by the NTPClient. This would remove the dependency on RTCZero as the NTPClient can auto-sync the time with the NTP server at a preconfigured interval.

Then a UDP instance or NTPClient instance could be passed in the constructor. Another added benefit is the library is portable to any Arduino board that provides a SSLClient type and UDP type.

Sending not only one message to IoT hub

Hello!
I have tried SDK and simple sample with Genuino MKR1000.

Here are some additional steps that I have made:

  1. AzureIoTProtocol_HTTP was also required for compiling, so I have install it.

  2. It was also exception 'class Serial_' has no member named 'setDebugOutput'. So, I have commented line

        Serial.setDebugOutput(true);
    

After those steps message was send to IoT hub, but it was only one message.
As I think because inside loop there is simplesample_http_run(); - it should be send multiple messages. Right?

May I ask what does means this code?:

            /* wait for commands */
              while (1)
             {
                 IoTHubClient_LL_DoWork(iotHubClientHandle);
                 ThreadAPI_Sleep(1000);
              }

May be I should made corrections to simple sample code to be able send multiple messages?

Compile error In function `strtof' in simplesample_http on ESP8266

When compiling the simplesample_http example, I get the following error:

J:\Programmer\Arduino\hardware\esp8266com\esp8266/tools/sdk/libc/xtensa-lx106-elf/lib\libc.a(lib_a-strtod.o): In function `strtof':

/Users/igrokhotkov/e/newlib-xtensa/xtensa-lx106-elf/newlib/libc/stdlib/../../../.././newlib/libc/stdlib/strtod.c:1267: multiple definition of `strtof'

libraries\azure-iot-arduino-master\esp8266\azcpgmspace.cpp.o:I:\DEV\Arduino\libraries\azure-iot-arduino-master\src\esp8266/azcpgmspace.cpp:24: first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Generic ESP8266 Module.

I have also tried many other things:

  • different boards: Adafruit HUZZAH, Sparkfun ESP8266 Dev, WeMo D1 and more. Same result.
  • Stripping the .ino to bare minimum by removing all includes (and related code). It's the inclusion of the AzureIoTHub.h that spawns the problem.

System:

  • Arduino IDE 1.6.12
  • esp8266 Community library v 2.3.0
  • AzureIOTHub, 1.0.0=master branch (not sure if this is actually expected to be working, but if I install 0.2.0, I get other problems during runtime).
  • HW: Arduino WeMo D1 (ESP8266). But not relevant, since I never get through the compiler.

I have removed all other libraries.

What do I do wrong here?

unknown type name 'IRsend'

In the C file in simplesample_mqtt.c, which connects Arduino to the Azure IoT hub, I need to use the IRsend and IrRemoteESP8266 libraries to send an infrared signal with Azure IoT hub.

  1. #include <IRremoteESP8266.h>
  2. #include <IRsend.h>
  3. IRsend irsend(10); // An IR LED is controlled by GPIO pin 4 (D2)

I don't have any problem when I use this code in my main Ardunio file. But when I use these includes in a C file (implesample_mqtt.c), I get this error from line 3: "unknown type name 'IRsend'".

enter image description here

error full info :
Arduino: 1.8.2 (Windows 10), Board: "NodeMCU 0.9 (ESP-12 Module), 80 MHz, 115200, 4M (3M SPIFFS)"

In file included from sketch\simplesample_mqtt.c:29:0:

C:\Program Files (x86)\Arduino\libraries\IRremoteESP8266\src/IRsend.h:29:1: error: unknown type name 'class'

class IRsend {

C:\Program Files (x86)\Arduino\libraries\IRremoteESP8266\src/IRsend.h:29:14: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token

class IRsend {

simplesample_mqtt.c:31: error: unknown type name 'IRsend'

IRsend irsend(10); // An IR LED is controlled by GPIO pin 4 (D2)

simplesample_mqtt.c:31: error: expected declaration specifiers or '...' before numeric constant

IRsend irsend(10); // An IR LED is controlled by GPIO pin 4 (D2)

exit status 1
unknown type name 'IRsend'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

payLoad get from DeviceTwin in not a valid JSON

I try to set a callback for device twin desired data, but when the callback method invoked, I received the payLoad is only a part of JSON. I think it should be the whole part of desired data, don't include any of the reported data

{
  "desired": {
    "$version": 3
  },
  "reported": {
    "$versi+øÊ��-.î®…�%ƒ�10,"humë†Ç�ò
f	3.20}iotë�Ç�2��

Device Commands with Arguments Fail on ESP8266 / NodeMCU 0.9 LSP 12

Hi,

I am using Arduino IDE 1.6.12, NodeMCU 0.9 LSP 12, Azure IoT Arduino 1.0.17 and ESP8266 Boards 2.2.0 (and 2.3.0). No way I can make it run a device command with arguments.
I use the simplesample_http but the same result is observed with the remote_monitoring sample also.

Here are the different tries:

When I sent:
{"Name" : "SetAirResistance","Parameters" : {"Position" : "20" }}

I get:

(result = AGENT_DATA_TYPES_INVALID_ARG)
Failed parsing node "20".

When I sent:
{"Name" : "SetAirResistance","Parameters" : { }}
I get:

(result = MULTITREE_CHILD_NOT_FOUND)
Missing argument Position

And when I sent, what I believe should be correct:
{"Name" : "SetAirResistance","Parameters" : {"Position" : 20 }}
or
{"Name" : "SetAirResistance","Parameters" : [{"Position" : 20 }]}
I get:

Fatal exception 28(LoadProhibitedCause):
epc1=0x40208e60, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000032, depc=0x00000000

Exception (28):
epc1=0x40208e60 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000032 depc=0x00000000

ctx: cont 
sp: 3fff3730 end: 3fff3c10 offset: 01a0

>>>stack>>>
3fff38d0:  3fff2b94 00000627 00000627 3fff81f3  
3fff38e0:  3fff8244 00000000 3fff3910 402097eb  
3fff38f0:  3fff8244 00003138 00000627 3fff81f3  
3fff3900:  3fff8214 00000000 3fff39a0 40208d34  
3fff3910:  3fff8244 3fff6e44 3fff8214 40209565  
3fff3920:  3fff3950 00000000 00000000 0000007b  
3fff3930:  3fff3974 3fff81f0 3fff39a0 40208e4f  
3fff3940:  3fff8214 00000000 3fff3970 402097eb  
3fff3950:  3fff8214 173884aa 33d7cc21 3fff81e2  
3fff3960:  3fff6e44 00000000 3fff39a0 40208d34  
3fff3970:  3fff8214 3fff81ce 3fff830c 402095cc  
3fff3980:  000000cc 3fff8344 3fff7864 3fff81c4  
3fff3990:  3fff3a64 3fff6e44 00000003 402090b8  
3fff39a0:  3fff81fe 000001f7 cee5dd4a 3fff6df4  
3fff39b0:  00000000 00000000 00000046 3fff6df4  
3fff39c0:  00000000 00000000 3fff820a 40204e38  
3fff39d0:  0000000e 3fff39c0 3fff7784 4020d8cb  
3fff39e0:  000000c8 3fff7284 3fff4964 00000000  
3fff39f0:  00000000 3fff48a4 3fff4f4c 40210d91  
3fff3a00:  00000001 3ffeb088 3fff3a60 4020d768  
3fff3a10:  3fff2b94 000001a2 000001a2 4010020c  
3fff3a20:  3fff795c 3fff48a4 3fff497c 4010068c  
3fff3a30:  3fff3b28 3fff48a4 3fff477c 4020c265  
3fff3a40:  3fff795c 3fff48a4 00000000 4020d174  
3fff3a50:  3fff3b28 3fff795c 3fff499c 00000004  
3fff3a60:  00000000 3fff6e44 00000000 00000000  
3fff3a70:  3fff4374 3fff81c4 3fff4964 3fff48a4  
3fff3a80:  3fff499c 00000001 00000000 00000001  
3fff3a90:  00000000 3fff490c 00000001 3fff4324  
3fff3aa0:  00000000 3fff6df4 3fff4324 40205c3b  
3fff3ab0:  00000000 00000046 3fff462c 40204af9  
3fff3ac0:  3fff7844 3fff6e3a 3fff6df4 40201106  
3fff3ad0:  00000046 3fff6d34 3fff7794 3fff6d84  
3fff3ae0:  3fff2b94 00000623 3fff462c 3fff4740  
3fff3af0:  3fff7844 3fff7844 3fff462c 40206048  
3fff3b00:  3fff7844 3fff513c 3fff47dc 402081b6  
3fff3b10:  3fff3b28 3fff795c 3fff499c 40204a1f  
3fff3b20:  3fff6d84 0000000d 000000c8 00000000  
3fff3b30:  0000002c 3fff4cb4 3fff3ba0 3ffeb882  
3fff3b40:  3fff795c 3fff499c 3fff473c 3fff785c  
3fff3b50:  0000000d 3fff462c 00000008 00000000  
3fff3b60:  40211944 00000001 00000000 3ffeac44  
3fff3b70:  00000000 3fff4544 3fff3b90 3fff2be0  
3fff3b80:  3fff4634 3fff462c 3fff462c 40205f9c  
3fff3b90:  0000f230 3fff2be0 402141a8 3fff2bf0  
3fff3ba0:  3fff4634 00000064 00000064 40211063  
3fff3bb0:  3fffdad0 3fff462c 3fff438c 3fff2be0  
3fff3bc0:  3fffdad0 3fff462c 3fff438c 40201334  
3fff3bd0:  0000002c 3fff4db4 00000009 4021286d  
3fff3be0:  3fffdad0 00000000 3fff2bd8 40212720  
3fff3bf0:  feefeffe feefeffe feefeffe 402141f4  
3fff3c00:  feefeffe feefeffe 3fff2bf0 40100718  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,0)

load 0x4010f000, len 1264, room 16 
tail 0
chksum 0x0f
csum 0x0f
~ld

When I sent commands without arguments, everything works just fine. But it seems to be an issue with the argument value parsing.

SERIALIZE does not work with Floats or Doubles

I'm trying to send a float or a double to my IoT Hub, however, the generated JSON is:
{"DeviceId":"Device001", "Temperature":%.*f, "XAccel":%.*f, "YAccel":%.*f, "ZAccel":%.*f}

If I declare the values as integers in DECLARE_MODEL and then cast the floats to int before SERIALIZE, it works.

I think this is due to the fact that Arduino does not support printf of floats or doubles because of the overhead.

Also note that by default the Arduino IDE does not set the AVR linker options to support floating point in the xxprintf() routines. So while that saves quite a bit of code space on the AVR builds, it means that printf() functions cannot be used for floating point output on the AVR. Floating support is included by default for the other processors.
-- http://playground.arduino.cc/Main/Printf

MQTT Not working on ESP8266 (NodeMCU 0.9 LSP12)

The MQTT version of the samples and implementation is not working at all on NodeMCU 0.9 LSP12.
Tried with both Boards versions 2.2.0 and 2.3.0 under Arduino IDE 1.6.12.
Version of Azure IoT Arduino 1.0.17.
MQTT Sample open directly from the Samples section in Arduino IDE.

The result log in Serial Monitor is:

TLS failed to start the connection process.
Error: io_open failed
failure connecting to address ih-demos.azure-devices.net:0.
TLS failed to start the connection process.
Error: io_open failed
failure connecting to address ih-demos.azure-devices.net:0.
Evaluated delay 7 at 5 attempt to retry

Evaluated delay 7 at 5 attempt to retry

Evaluated delay 11 at 5 attempt to retry

Evaluated delay 8 at 5 attempt to retry

HTTP samples work fine (with the except of commands with parameters ref. Issue #35 ).

HTTPS Connection Issue

Hello,

I am using Arduino Zero + Wifi 101 shield.

I have followed the instruction list at
https://github.com/Azure/azure-iot-sdks/blob/master/doc/get_started/arduinoide-arduino-wifi101-c.md

I was able to update firmware and certificate using the instruction. However, when I ran the simplesample_http program, I got the following https connection error:

Attempting to connect to SSID:
Connected to wifi
Info: IoT Hub SDK for C, version 1.0.0-preview.7
IoTHubClient accepted the message for delivery
Error: Time:Sat Apr 2 15:09:38 2016 File:C:\Users\liyangz\Documents\Arduino\libraries\AzureIoT\src\httpapi.cpp Func:HTTPAPI_Init Line:27 Fetching NTP epoch time failed!
Info: Fetched NTP epoch time is: 1459609915

...\Arduino\libraries\AzureIoT\src\httpapi.cpp Func:HTTPAPI_CreateConnection Line:69 HTTPS connection to failed
...\Arduino\libraries\AzureIoT\src\sdk\httpapiex.c Func:HTTPAPIEX_ExecuteRequest Line:476 unable to recover sending to a working state
...\Arduino\libraries\AzureIoT\src\sdk\iothubtransporthttp.c Func:DoEvent Line:1206 unable to HTTPAPIEX_ExecuteRequest

Anyone can help how to troubleshoot this? Thanks

SAM3X8E support

There is Arduino Due build on SAM3X8E Cortex-M3 which is very similar to Mega 2560 from the number of pins perspective.
Is is possible to bring the support of this SDK to this platform?

Publish new version

Can we get a new version of the library published with the latest changes?

Failed to compile when using non-low-level API

I simply have no luck when trying to use the non Low-Level APIs from Arduino and ESP8266.
When using the Low Level API (i.e.
IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, HTTP_Protocol) )
, everything works fine.
But when I try to switch to the "normal" and none-low-level (i.e.
IOTHUB_CLIENT_CONFIG config;
IOTHUB_CLIENT_HANDLE iotHubClientHandle;
....
iotHubClientHandle = IoTHubClient_Create(&config);
) then I get compiler error:

Arduino: 1.6.12 (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), nodemcu, Disabled, None"

libraries\AzureIoTHub\sdk\iothub_client.c.o:(.text.create_iothub_instance+0x28): undefined reference to `Lock'

libraries\AzureIoTHub\sdk\iothub_client.c.o:(.text.create_iothub_instance+0x2c): undefined reference to `Unlock'

libraries\AzureIoTHub\sdk\iothub_client.c.o:(.text.create_iothub_instance+0x30): undefined reference to `Lock_Init'

libraries\AzureIoTHub\sdk\iothub_client.c.o:(.text.create_iothub_instance+0x34): undefined reference to `Lock_Deinit'

libraries\AzureIoTHub\sdk\iothub_client.c.o: In function `create_iothub_instance':

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock_Init'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock_Init'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock_Deinit'

libraries\AzureIoTHub\sdk\iothub_client.c.o:(.text.garbageCollectorImpl$isra$0+0x3c): undefined reference to `Lock'

libraries\AzureIoTHub\sdk\iothub_client.c.o: In function `garbageCollectorImpl':

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock_Deinit'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock'

libraries\AzureIoTHub\sdk\iothub_client.c.o: In function `ScheduleWork_Thread':

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock'

libraries\AzureIoTHub\sdk\iothub_client.c.o: In function `dispatch_user_callbacks':

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'

libraries\AzureIoTHub\sdk\iothub_client.c.o:(.text.IoTHubClient_Destroy+0x1c): undefined reference to `Lock'

libraries\AzureIoTHub\sdk\iothub_client.c.o: In function `IoTHubClient_Destroy':

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock_Deinit'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock'

libraries\AzureIoTHub\sdk\iothub_client.c.o: In function `IoTHubClient_SendEventAsync':

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'

libraries\AzureIoTHub\sdk\iothub_client.c.o: In function `IoTHubClient_SetMessageCallback':

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:816: undefined reference to `Lock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:839: undefined reference to `Unlock'

libraries\AzureIoTHub\sdk\iothubtransport.c.o:(.text.transport_worker_thread+0xe): undefined reference to `Lock'

libraries\AzureIoTHub\sdk\iothubtransport.c.o: In function `transport_worker_thread':

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothubtransport.c:286: undefined reference to `Unlock'

C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothubtransport.c:286: undefined reference to `Unlock'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Generic ESP8266 Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Which, I don't understand. I have installed all 4 Arduino libraries - AzureIoTHub, AzureIoTProtocol_HTTP, AzureIoTProtocol_MQTT, AzureIoTUtility

Initially I had a lot of other errors, like "undefined IOTHUB_CLIENT_HANDLE", which I overcame with editing the AzureIoTHub.h by adding the following line:
#include "sdk/iothub_client.h"
because it is not there. Is it intentionally that the "high-level" APIs are not included by default for Arduino?

I see that AzureIoTHub.h already includes the Utility:
#include "AzureIoTUtility.h"
which, at least in theory, should also include the:
#include "azure_c_shared_utility/lock.h"
#include "azure_c_shared_utility/threadapi.h"

where the Lock/Unlock are defined. But I see these compilation errors. Arduino IDE is 1.6.12, which should not affect the results, since the Low Level APIs works fine, as already mentioned.

Simplify/unify examples

After discussing with @cmaglie, we should avoid having platform specific examples. This causes code to be duplicated, as well is not "Arduino" library style.

His suggestion is to have a single set of examples with comments for how to run on non-Arduino/Genuino boards.

DECLARE_MODEL does not name a type

If I compile with Arduino v1.6.7 or earlier, everything seems to work fine. But if I compile with Arduino v1.6.8 or later, I get an error on DECLARE_MODEL that the does not name a type.

EX:
BEGIN_NAMESPACE(wfi);
DECLARE_MODEL(widget,
WITH_DATA(ascii_char_ptr, DeviceId),
WITH_DATA(int, Value)
);
END_NAMESPACE(wfi);

report_to_iothub:16: error: 'widget' does not name a type
DECLARE_MODEL(widget,
^
report_to_iothub:16: error: ISO C++ forbids declaration of 'value' with no type [-fpermissive]
DECLARE_MODEL(widget,

simplesample_mqtt crash

After upgrading from 1.0.17 to 1.0.21, both simplesample_mqtt and simplesample_http crash at:
...
Connected to wifi
please start sntp first !
Fetching NTP epoch time failed! Waiting 2 seconds to retry.
Mon Jan 23 19:43:57 2017

Fetched NTP epoch time is: 1485200638
Fatal exception 3(LoadStoreErrorCause):
epc1=0x4000bf64, epc2=0x00000000, epc3=0x00000000, excvaddr=0x40251d6b, depc=0x00000000

Exception (3):
epc1=0x4000bf64 epc2=0x00000000 epc3=0x00000000 excvaddr=0x40251d6b depc=0x00000000

ctx: cont
sp: 3fff3230 end: 3fff3530 offset: 01a0

stack>>>
3fff33d0: 3fff35b8 3fff430c 00000035 401077e0
3fff33e0: 40105f9f 3fff34c0 3fff34c0 3ffec846
3fff33f0: 40105ff8 00000000 40001da0 3fff34c0
3fff3400: 3fff2504 3fff35b8 00000004 000000d2
3fff3410: 3fff35b8 00000000 00000000 3fff33a0
3fff3420: 01000100 00000009 3fff348f 4021520c
3fff3430: 00000000 3ffe8372 3fff2504 3fff24d8
3fff3440: 00000031 0000000a 3fff24d8 40214b65
3fff3450: 3fff3486 3fff35cc 3fff35c0 4023f9e8
3fff3460: 3fff3480 4020652d 00000000 3ffe937c
3fff3470: 3fffdad0 4defeffe 64676e69 00000000
3fff3480: 40251d6b 3ffea967 00000000 3fff23c8
3fff3490: 00000002 ff000000 3ffe92de 4021520c
3fff34a0: 00000009 0000001a 3ffe9a8f 3fff2504
3fff34b0: 3fffdad0 0000000a 3fff24d8 40214b65
3fff34c0: 3ffe92dd 58865cfe 3fff23d0 40203f2c
3fff34d0: 3ffe9a75 3fff2504 3fff24d8 3fff2504
3fff34e0: 3fffdad0 00000000 00000000 40201216
3fff34f0: 3fffdad0 58865cfe 3fff24d8 40213421
3fff3500: 3fffdad0 00000000 3fff24fc 402132fc
3fff3510: feefeffe feefeffe feefeffe 40214ea0
3fff3520: feefeffe feefeffe 3fff2510 40100718
<<<stack<<<

ets Jan 8 2013,rst cause:1, boot mode:(3,7)

Any idea?

Question: Is it possible to extract the while(1) {} in a separate function?

Hi,

this is a general question. I was wondering whether is it possible to extract the main while(){} loop into a separate function (without endless loop). The idea is to have that separate function being called from the main Arduinos loop.

End goal is to have Arduino doing more in its loop. By doing so I will avoid placing more Arduinos logic into the Azure IoT Hub related functions. For example - reading from various external sensors and sending real data. I am having hard time putting that loop into its own function. Seems like the serializer has some issues - I cannot serialize data when in another function.

The very simple sample I would like to achieve is - having my Arduinos loop in which I read sensor data and send these values to the IoT Hub. I am unable to extract such logic in its own function. Of course everything while maintaining integrity (the state of my already created model).

All of the C samples do have this XXX_run() function which contains the endless loop. Is it possible at all to achieve what I am asking?

Lock/Unlock/Lock_Deinit undefined

Versions:

  • Arduino IDE 1.8.1
  • esp8266 board 2.3.0
  • AzureIoTHub 1.0.21
  • AzureIoTUtility 1.0.21

I am trying to use device twin functions (and direct methods) from the SDK, namely, IoTHubDeviceTwin_CreateXXX macros.

But when I compile my code, it said,

libraries\AzureIoTHub\sdk\iothub_client.c.o: In function `iothub_ll_device_twin_callback':

C:\Users\JohnDoe\Documents\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:1336: undefined reference to `Lock'

C:\Users\JohnDoe\Documents\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:1336: undefined reference to `Unlock'

C:\Users\JohnDoe\Documents\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:1336: undefined reference to `Lock_Deinit'

libraries\AzureIoTHub\sdk\iothub_client.c.o:(.text.garbageCollectorImpl$isra$0+0x48): undefined reference to `Lock'

Searching thru all files under C:\Users\JohnDoe\Documents\Arduino\libraries\AzureIoTUtility, I only see Lock/Unlock/Lock_Deinit declared in src\azure_c_shared_utility\lock.h, but found nothing in *.c files.

ESP8266 - Direct Methods

Hi,

Tried out direct methods on a ESP8266 with Arduino, based on this example.
https://github.com/Azure/azure-iot-sdk-c/tree/master/serializer/samples/devicemethod_simplesample

It crashes executing this method,
METHODRETURN_HANDLE result = MethodReturn_Create(1, "{"Message":"Turning fan on with Method"}");

Setting the returned JSON payload to null makes it work,
METHODRETURN_HANDLE result = MethodReturn_Create(1, NULL);

Exception from the ESP8266 serial debug,
Result Call Back Called! Result is: IOTHUB_CLIENT_CONFIRMATION_OK
<- PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_MOST_ONCE = 0x00 | TOPIC_NAME: $iothub/methods/POST/TurnFanOn_with_Method/?$rid=1 | PAYLOAD_LEN: 14
Turning fan on with Method.
Fatal exception 28(LoadProhibitedCause):
epc1=0x4020baa4, epc2=0x00000000, epc3=0x00000000, excvaddr=0x0000007c, depc=0x00000000

ESP32 Arduino porting...

I got unreferenced errors:

C:\Users\MOP\AppData\Local\Temp\arduino_build_729655\libraries\AzureIoTUtility\azure_c_shared_utility\httpapiex.c.o:(.literal.HTTPAPIEX_ExecuteRequest+0x3c): undefined reference to `HTTPAPI_Init'

C:\Users\MOP\AppData\Local\Temp\arduino_build_729655\libraries\AzureIoTUtility\azure_c_shared_utility\httpapiex.c.o:(.literal.HTTPAPIEX_ExecuteRequest+0x40): undefined reference to `HTTPAPI_CreateConnection'

C:\Users\MOP\AppData\Local\Temp\arduino_build_729655\libraries\AzureIoTUtility\azure_c_shared_utility\httpapiex.c.o:(.literal.HTTPAPIEX_ExecuteRequest+0x44): undefined reference to `HTTPAPI_SetOption'

C:\Users\MOP\AppData\Local\Temp\arduino_build_729655\libraries\AzureIoTUtility\azure_c_shared_utility\httpapiex.c.o:(.literal.HTTPAPIEX_ExecuteRequest+0x48): undefined reference to `HTTPAPI_ExecuteRequest'

C:\Users\MOP\AppData\Local\Temp\arduino_build_729655\libraries\AzureIoTUtility\azure_c_shared_utility\httpapiex.c.o:(.literal.HTTPAPIEX_ExecuteRequest+0x4c): undefined reference to `HTTPAPI_Deinit'

C:\Users\MOP\AppData\Local\Temp\arduino_build_729655\libraries\AzureIoTUtility\azure_c_shared_utility\httpapiex.c.o:(.literal.HTTPAPIEX_ExecuteRequest+0x50): undefined reference to `HTTPAPI_CloseConnection'

C:\Users\MOP\AppData\Local\Temp\arduino_build_729655\libraries\AzureIoTUtility\azure_c_shared_utility\httpapiex.c.o:(.literal.HTTPAPIEX_SetOption+0x10): undefined reference to `HTTPAPI_CloneOption'

C:\Users\MOP\AppData\Local\Temp\arduino_build_729655\libraries\AzureIoTUtility\azure_c_shared_utility\httpapiex.c.o: In function `HTTPAPIEX_ExecuteRequest':

C:\Users\MOP\Documents\Arduino\libraries\AzureIoTUtility\src\azure_c_shared_utility/httpapiex.c:337: undefined reference to `HTTPAPI_Init'

C:\Users\MOP\Documents\Arduino\libraries\AzureIoTUtility\src\azure_c_shared_utility/httpapiex.c:475: undefined reference to `HTTPAPI_CreateConnection'

C:\Users\MOP\Documents\Arduino\libraries\AzureIoTUtility\src\azure_c_shared_utility/httpapiex.c:385: undefined reference to `HTTPAPI_SetOption'

C:\Users\MOP\Documents\Arduino\libraries\AzureIoTUtility\src\azure_c_shared_utility/httpapiex.c:400: undefined reference to `HTTPAPI_ExecuteRequest'

C:\Users\MOP\Documents\Arduino\libraries\AzureIoTUtility\src\azure_c_shared_utility/httpapiex.c:411: undefined reference to `HTTPAPI_Deinit'

C:\Users\MOP\Documents\Arduino\libraries\AzureIoTUtility\src\azure_c_shared_utility/httpapiex.c:411: undefined reference to `HTTPAPI_CloseConnection'

C:\Users\MOP\AppData\Local\Temp\arduino_build_729655\libraries\AzureIoTUtility\azure_c_shared_utility\httpapiex.c.o: In function `HTTPAPIEX_Destroy':

C:\Users\MOP\Documents\Arduino\libraries\AzureIoTUtility\src\azure_c_shared_utility/httpapiex.c:497: undefined reference to `HTTPAPI_CloseConnection'

C:\Users\MOP\Documents\Arduino\libraries\AzureIoTUtility\src\azure_c_shared_utility/httpapiex.c:432: undefined reference to `HTTPAPI_Deinit'

C:\Users\MOP\AppData\Local\Temp\arduino_build_729655\libraries\AzureIoTUtility\azure_c_shared_utility\httpapiex.c.o: In function `HTTPAPIEX_SetOption':

C:\Users\MOP\Documents\Arduino\libraries\AzureIoTUtility\src\azure_c_shared_utility/httpapiex.c:603: undefined reference to `HTTPAPI_CloneOption'

C:\Users\MOP\Documents\Arduino\libraries\AzureIoTUtility\src\azure_c_shared_utility/httpapiex.c:651: undefined reference to `HTTPAPI_SetOption'

collect2.exe: error: ld returned 1 exit status
where are definitions of those functions?
Thanks a lot.

HTTPSClient::connected() hang when _sslClient is NULL

uint8_t HTTPSClient::connected()
{
return _sslClient->connected();
}
when _sslClient is null, HTTPSClient::connected() hangs indefinitely. This doesn't seem right. Can we have some notification via e.g. serial port rather than completely unresponsive?

Convert Adafruit M0 references from WINC1500 to WiFi101

Please consider removal of the WINC1500 library references in the libary (for the Adafruit M0).

The Adafruit WINC1500 library has been deprecated for months. WiFi101 has went through numerous enhancements and fixes since the deprecated Adafruit fork. 10 months ago Adafruit updated the github readme with...

This fork is deprecated! Please use WiFi101, which now has pin-setting support Thak you! :)

I have been using the WiFi101 library on the Adafruit board for over 6 months with success. With every azure-iot-arduino update we are forced, and instruct our customers, to go in to the AzureIoTUtility\src\adapters library folder and modify the sslClient_arduino.cpp file to comment out the lines below...

#elif ARDUINO_SAMD_FEATHER_M0 
#include "Adafruit_WINC1500.h" 
#include "Adafruit_WINC1500Client.h" 
#include "Adafruit_WINC1500SSLClient.h" 
static Adafruit_WINC1500SSLClient sslClient; // for Adafruit WINC1500 
#else 

In your readme.md your instructions for the Adafruit M0

  1. Install the Adafruit WINC1500 wifi library

link to a page on Adafruit Learn with specific instructions to download the WiFi101 library.

By removing the library references only minor INO sample changes are required for WiFi101 to function with the Adafruit M0.

Near top of .INO...

#ifdef ARDUINO_SAMD_FEATHER_M0
  #define VBAT_ENABLED              1
  #define VBAT_PIN                  A7

  #define WINC_CS   8
  #define WINC_IRQ  7
  #define WINC_RST  4
  #define WINC_EN   2

  #include <WiFi101.h>
  #include <WiFiSSLClient.h>
  #include <WiFiUdp.h>
  WiFiSSLClient sslClient;
  #include "NTPClient.h"

In the initWifi() function...

 #ifdef ARDUINO_SAMD_FEATHER_M0
    Serial.println(F("WINC1500 on FeatherM0 detected."));
    Serial.println(F("Setting pins for WiFi101 library (WINC1500 on FeatherM0)"));

    //Configure pins for Adafruit ATWINC1500 Feather
    WiFi.setPins(WINC_CS, WINC_IRQ, WINC_RST, WINC_EN);

    // for the Adafruit WINC1500 we need to enable the chip
    pinMode(WINC_EN, OUTPUT);
    digitalWrite(WINC_EN, HIGH);
    Serial.println(F("Enabled WINC1500 interface for FeatherM0"));
  #endif

Thanks,
Greg @ LooUQ

Ethernet Compatibility

Current have an Adafruit Ethernet FeatherWing and installed the Ethernet2 library. Wanted to us that to send data to the Azure IoT Hub. I see that in the simplesample_http sample, the AzureIoTHubClient instance expects a WiFiClientSecure but wanted to know if there is anyway to pass in an ethernet client of some kind.

I also was not able to find a secure ethernet client so that may be another road block but I have extremely limited knowledge of all of this so I could be mistaken.

Reference to AzureIoTHubClient in SimpleSample code appears not necessary

I am probably missing something, but when testing with the SimpleSample MQTT code I discovered that the references to AzureIoTHubClient appear to do nothing for the solution.

static AzureIoTHubClient iotHubClient; 
...
void setup() {
    unsigned long epochTime = 0;
    
    initSerial();
    initWifi();
    initTime();

    iotHubClient.begin(sslClient);
}

I followed the logic into the IoTHub code and searched IoTHub files for any reference to the AzureIoTHubClient class, without finding any purpose to this class. With that experience, I commented out the iotHubClient.begin(sslClient) line; this did not break the successful operation of the SimpleSample code example or my project based from it.

Is there a reason for AzureIoTHubClient and the invocation of the .begin() method?

Thanks,
Greg

simplesample_http fails on ESP8266

Hello, I've setup a new IoT hub, added my device and modified the sample code as instructed but am getting the following error:

Fetched NTP epoch time is: 1476801841
IoT Hub SDK for C, version 1.0.1
IoTHubClient accepted the message for delivery
HTTPS connection to eshome.azure-devices.net failed
unable to recover sending to a working state
unable to HTTPAPIEX_ExecuteRequest

This is on an Adafruit ESP8266 Huzzah using Arduino IDE 1.6.12 and I can confirm that the ESP8266 is connected to my wifi router. Is this something others are seeing or local to me?

Thanks!

Problem with sending events to the Azure IoT Hub

Hello,

I have installed the sample code and when I run it, I see these errors in the log on the Arduino Serial Output: (running this on an ESP8266). But I don't have any clue what is wrong...

Log:

connected with EnGenius0E148E, channel 2
dhcp client start...
ip:192.168.2.21,mask:255.255.255.0,gw:192.168.2.254
retrying ... f r0, failed ... scandone
retrying ... f 0, failed ... scandone
retrying ... f -180, failed ... scandone
chg_B1:-140
chg_B1:-100
chg_B1:-60
retrying ... f r-60, failed ... scandone
retrying ... f 0, failed ... scandone
retrying ... f -180, failed ... scandone

cant compile the demo example have all 1.0.21 library installed open example this error bellow latest arduino IDE

AzureIoTHub, AzureIoTUtility, AzureIoTProtocol_MQTT no sample would compile with error bellow all 1.0.21

In file included from /Users/michelcousineau/Documents/Arduino/libraries/AzureIoTUtility/src/azure_c_shared_utility/xlogging.h:57:0,
from /Users/michelcousineau/Documents/Arduino/libraries/AzureIoTHub/src/sdk/serializer.h:58,
from /Users/michelcousineau/Documents/Arduino/libraries/AzureIoTHub/src/AzureIoTHub.h:9,
from /Users/michelcousineau/Documents/Arduino/libraries/AzureIoTProtocol_MQTT/examples/simplesample_mqtt/simplesample_mqtt.ino:42:
/Users/michelcousineau/Documents/Arduino/libraries/AzureIoTHub/src/esp8266/azcpgmspace.h:15:53: fatal error: azure_c_shared_utility\crt_abstractions.h: No such file or directory
#include "azure_c_shared_utility\crt_abstractions.h"
^
compilation terminated

Exception when using jsondecoder to decode invalid json

When I use JSONDecoder_JSON_To_MultiTree(char *, MULTITREE_HANDLE *) to decode an invalid json(maybe "test"), the program will crash at this line.

stack treace:

0x4010010e: umm_assimilate_up at C:\Users\yuwzho\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1163
0x4010010e: umm_assimilate_up at C:\Users\yuwzho\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1163
0x40204621: MultiTree_Destroy at C:\Users\yuwzho\Documents\Arduino\libraries\AzureIoTHub\src\sdk/multitree.c line 642
0x4010020c: _umm_free at C:\Users\yuwzho\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1287
0x4010068c: free at C:\Users\yuwzho\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1733
0x40204608: MultiTree_Destroy at C:\Users\yuwzho\Documents\Arduino\libraries\AzureIoTHub\src\sdk/multitree.c line 629

Doc improvements : device setup clarifications

I noticed some links in the README that are broken:

  • Setup your IoT hub
  • Provision your device and get its credentials

It also wasn't immediately clear to me that I needed to

When I pasted the one from the azure portal it didn't work

static const char* connectionString = "HostName=xxxx.azure-devices.net;DeviceId=arduino-mkr1000;SharedAccessKey=xxxxx";

When creating a SAS token for my device (iothub-explorer sas-token), and using that in the connection string it worked

static const char* connectionString = "HostName=xxxx.azure-devices.net;CredentialType=SharedAccessSignature;DeviceId=arduino-mkr1000;SharedAccessSignature=SharedAccessSignature sr=xxxx.azure-devices.net%2Fdevices%2Farduino-mkr1000&sig=xxxx&se=1503763760";

However, these SAS tokens expire after one hour and it's not immediately clear to me how to get them refreshed from the mkr1000.

Should the sample work with a regular connection string (without the sas token) also ?

ESP8266 not verifying fingerprint?

Last week, while looking at the ESP8266 side, I noticed the HTTPSRequest.ino example verifies the fingerprint using something like:

// Use web browser to view and copy
// SHA1 fingerprint of the certificate
const char* fingerprint = "CF 05 98 89 CA FF 8E D8 5E 5C E0 C2 E4 F7 E6 C3 C7 50 DD 5C";

// ....

void setup() {
  // ...

  // Use WiFiClientSecure class to create TLS connection
  WiFiClientSecure client;
  Serial.print("connecting to ");
  Serial.println(host);
  if (!client.connect(host, httpsPort)) {
    Serial.println("connection failed");
    return;
  }

  if (client.verify(fingerprint, host)) {
    Serial.println("certificate matches");
  } else {
    Serial.println("certificate doesn't match");
  }

  // ....
}

This is not something I see in this library now.

IoTHubClient_LL_DoWork only receiving 1 command until I restart the sketch

When I run the sample, the following code responsible for listening to incoming commands (fanOn / fanOff) only processes a single messages, and then it keeps waiting for commands (although ofhter messages have been sent and should be processed)

If I am sending 5 commands to the device, only first one is received and processed.
If I restart the sketch then the second one is received and so on.

The sketch keeps executing the IoTHubClient_LL_DoWork function but nothing comes in.

while (1)
{
  (void)printf("Waiting for commands.... \r\n");
  IoTHubClient_LL_DoWork(iotHubClientHandle);
  ThreadAPI_Sleep(100);
}

If remove the endless loop in the simplesample_http.c and rely on the loop in the ino file, then all commands are executed propertly (but offcourse then the program needs to connect to IoTHUB on every run.

Any ideas what might be causing this ?

device twin for azure-iot-arduino

i need to use device twin in azure-iot-ardunio simplesample_mqtt example .but when i use this line of codes : (devicetwin_simplesample in azure-iot-c-sdk )

DECLARE_STRUCT(Maker,
ascii_char_ptr, makerName, /*Fabrikam, Contoso ... */
ascii_char_ptr, style, /sedan, minivan .../
int, year
);

DECLARE_STRUCT(Geo,
double, longitude,
double, latitude
);

DECLARE_MODEL(CarState,
WITH_REPORTED_PROPERTY(int32_t, softwareVersion),
WITH_REPORTED_PROPERTY(uint8_t, reported_maxSpeed),
WITH_REPORTED_PROPERTY(ascii_char_ptr, vanityPlate)
);

DECLARE_MODEL(CarSettings,
WITH_DESIRED_PROPERTY(uint8_t, desired_maxSpeed, onDesiredMaxSpeed),
WITH_DESIRED_PROPERTY(Geo, location)
);

DECLARE_DEVICETWIN_MODEL(Car,
WITH_REPORTED_PROPERTY(ascii_char_ptr, lastOilChangeDate), /this is a simple reported property/
WITH_DESIRED_PROPERTY(ascii_char_ptr, changeOilReminder),

WITH_REPORTED_PROPERTY(Maker, maker), /*this is a structured reported property*/
WITH_REPORTED_PROPERTY(CarState, state), /*this is a model in model*/
WITH_DESIRED_PROPERTY(CarSettings, settings) /*this is a model in model*/

);

Arduino: 1.8.3 (Windows 10), Board: "NodeMCU 0.9 (ESP-12 Module), 80 MHz, 115200, 4M (3M SPIFFS)"
Build options changed, rebuilding all
In file included from C:\Users\mehran-pc\Documents\Arduino\libraries\AzureIoTHub\src/AzureIoTHub.h:9:0,
from sketch\simplesample_mqtt.c:15:
C:\Users\mehran-pc\Documents\Arduino\libraries\AzureIoTHub\src/sdk/serializer.h:226:67: error: expected ')' before '(' token
#define WITH_REPORTED_PROPERTY(type, name) MODEL_REPORTED_PROPERTY(type, name)
sketch\simplesample_mqtt.c:63:5: note: in expansion of macro 'WITH_REPORTED_PROPERTY'

WITH_REPORTED_PROPERTY(ascii_char_ptr, lastOilChangeDate), /this is a simple reported property/

exit status 1
Error compiling for board NodeMCU 0.9 (ESP-12 Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Gracefully reconnect after sas-url expires

We noticed the SAS_TOKEN_DEFAULT_LIFETIME set to an hour. This causes the system to be down for 4 minutes every hour times SAS_REFRESH_MULTIPLIER 0.8.

-> 10:55:08 DISCONNECT	69129107                // is 19.2 hours = 24 * 0.8
-> 10:55:08 CONNECT	69129377
timed out waiting for CONNACK	69361077
-> 10:59:09 DISCONNECT	69370097
-> 10:59:10 CONNECT	69371437
<- 10:59:10 CONNACK	69371457                // 4 minutes later

DEFAULT_MQTT_KEEPALIVE is set to 4 * 60
SAS_TOKEN_DEFAULT_LIFETIME is set to 3600 * 24
SAS_REFRESH_MULTIPLIER 0.8

We changed the lifetime to 24 hours, but we would like to gracefully refresh the sas token and reconnect.
Preferably without the 4 minutes downtime, caused by the DEFAULT_MQTT_KEEPALIVE?
Any suggestions?

SetOption TrustedCert lost in DiconnectFromClient

When a timeout occurs in the connect message of iothubtransport_mqtt_common. The DisconnectFromClient function will call xio_destroy(). In our case the xio is tlsio_mbedtls. This destroy call frees the cacert which was set by a IoTHubClient_LL_SetOption(_handle,"TrustedCerts",cert) call at the initialization of the IoTHubClient. After which the IoTHubClient cannot reconnect to Azure because of a missing certificate.

Log File contains a situation where we were connected, an error occured, a connect message was sent, that message timed out, and the cacert was lost. The system was still connected to the internet and had a active connection to a web server when this happened.

How can we ensure that the IoTHubClient can retain the cacert set by SetOption, and properly reconnect to the AzureIoTHub.

Getting Azure IoT to work on Sparkfun ESP32 Thing

I'm working on an IoT project with the Sparkfun ESP32 Thing. I'm getting the following compile time error.
/home/vaishaks/Arduino/libraries/WiFi101/src/WiFiMDNSResponder.cpp:24:26: fatal error: avr/pgmspace.h: No such file or directory

Can someone tell me how I can contribute to support the ESP32 board?

azure-iot-arduino fails IoTHub connection after a couple hours

I am is working on an embedded solution targeting Arduino architecture and WINC1500 (using the Adafruit Feather M0 with WINC1500 for our reference build). My application code works fine for several hours then fails with one of two scenarios… 1) the WINC1500 transmit LED (yellow) goes on solid; or 2) the connection to the IoT Hub is lost and a sequence of errors is produced (exact sequence depends on which WINC client: Adafruit_WINC1500 or WiFi101).

I can reproduce the issue with the Remote_Monitoring example provided in the Getting Started kit at https://github.com/Azure-Samples/iot-hub-c-m0wifi-getstartedkit and I have moved all testing from my code to the remote_monitoring example.

Scenario #2 errors with Adafruit_WIN1500 and AzureIoTHub (0.2.0)
AzureIoTHub\src\httpapi.cpp Func:HTTPAPI_CreateConnection Line:39 HTTPS connection to loouq-iotos-preview.azure-devices.net failed
AzureIoTHub\src\sdk\httpapiex.c Func:HTTPAPIEX_ExecuteRequest Line:476 unable to recover sending to a working state
AzureIoTHub\src\sdk\iothubtransporthttp.c Func:DoEvent Line:1223 unable to HTTPAPIEX_ExecuteRequest

Scenario #2 errors with WINC1500 and azure-iot-arduino (master - Latest commit df88a5a on Oct 14)
azure-iot-arduino-master\src\adapters\tlsio_arduino.c Func:tlsio_arduino_create Line:159 Host loouq-iotos-preview.azure-devices.net not found.
azure-iot-arduino-master\src\adapters\httpapi_compact.c Func:HTTPAPI_CreateConnection Line:221 Create connection failed
azure-iot-arduino-master\src\azure_c_shared_utility\httpapiex.c Func:HTTPAPIEX_ExecuteRequest Line:478 unable to recover sending to a working state
azure-iot-arduino-master\src\sdk\iothubtransporthttp.c Func:DoEvent Line:1582 unable to HTTPAPIEX_SAS_ExecuteRequest

I also noted a huge slowdown in the IoTHubClient_LL_DoWork() method with the newer azure-iot-arduino, from a about 10 millis to a range of 4 to 9 seconds.

I tried switching to the WiFi101 driver (both 0.10.0 and github master latest as of 11/13/2016) with the same results. I attempted to use the WiFi101 driver due to the statement on the Adafruit WINC1500 github repo… “This fork is deprecated! Please use WiFi101, which now has pin-setting support Thak you! :)” and has not had commits since Sep 22nd.

  • (Scenario #1) - I have traced the solid transmit LED to an endless loop within the WINC socket write function while waiting for the send() loop (no SOCK_ERR_BUFFER_FULL). I know this is WINC driver code, not azure IoT code; I am wondering if this is exasperated by the AzureIoTHub code or a known issue.
size_t WiFiClient::write(const uint8_t *buf, size_t size)
{
	sint16 err;

	if (_socket < 0 || size == 0) {
		setWriteError();
		return 0;
	}

	// Network led ON (rev A then rev B).
	m2m_periph_gpio_set_val(M2M_PERIPH_GPIO16, 0);
	m2m_periph_gpio_set_val(M2M_PERIPH_GPIO5, 0);

	m2m_wifi_handle_events(NULL);

	#ifdef DEBUG_STREAM
		DEBUG_STREAM.print(F("WiFiClient()::write, ready to send: "));
		DEBUG_STREAM.println((char*)buf);
	#endif

	while ((err = send(_socket, (void *)buf, size, 0)) < 0) {

		#ifdef DEBUG_STREAM
			DEBUG_STREAM.print(F("WiFiClient()::write, send error="));
			DEBUG_STREAM.println(err);
		#endif

		// Exit on fatal error, retry if buffer not ready.
		if (err != SOCK_ERR_BUFFER_FULL) {
			setWriteError();
			m2m_periph_gpio_set_val(M2M_PERIPH_GPIO16, 1);
			m2m_periph_gpio_set_val(M2M_PERIPH_GPIO5, 1);
			return 0;
		}
		m2m_wifi_handle_events(NULL);
	}

	#ifdef DEBUG_STREAM
		DEBUG_STREAM.println(F("WiFiClient()::write, send operation completed"));
	#endif
	
	// Network led OFF (rev A then rev B).
	m2m_periph_gpio_set_val(M2M_PERIPH_GPIO16, 1);
	m2m_periph_gpio_set_val(M2M_PERIPH_GPIO5, 1);
			
	return size;
}


My questions…

  • If the Adafruit WINC1500 fork is depreciated, should not the azure-iot-arduino library shift to be using WiFi101? Is this simply waiting for WiFi101 to hit 1.x status?
  • Is there a known, but unreported, issue with the azure-iot-arduino driver failing after several hours?
  • Is there any way to trap these two scenarios so that application code can reset the WINC chip and start processing again?

Thanks,
Greg

Possible bug in, or related to use of, IoTHubClient_LL_SendReportedState()

I cannot find an example demonstrating use of IoTHubClient_LL_SendReportedState() on the ESP8266. When I try use that function in an otherwise stable tutorial project, the device locks up moments later during a call to delay(10);. I've tried to alter the call sequence and delay durations, but the result is always the same. Execution freezes inside of delay() and the WDT resets the module after a few seconds.

I attempted to switch the entire project to the non _LL function variants, but they are not included (at least not fully).

Arduino links not working

Under the Prerequisites, the links to:
"Setup your IoT hub"
"Provision your device and get its credentials"
Are invalid.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.