Closed yaweiw closed 8 years ago
Thank you @yaweiw! I will take a look through these. Note that some of these changes are in the core Azure C libraries that do not live in this repo (they are just synced in via a script in the source), but I will share with those people so they can evaluate. (e.g. https://github.com/Azure/azure-iot-sdks/tree/master/c)
Hi @yaweiw @stefangordon,
On SAMD src/samd/time.cpp makes the use of the RTC to make time(NULL)
work. However iotHubClient.setEpochTime(time)
needs to be called in the sketch as shown in the example.
Let me know if this isn't working.
Hi @sandeepmistry,
Yes you are right. setEpochTime is actually something I've been trying to find out or create.
Thanks.
Hi @stefangordon
Thanks mate. Please let me know if anything is wrong. Cheers.
Can this PR be closed then?
Have you verified the PR has fixed the authentication issue or not? Or are the bits currently working on any of your boards?
@yaweiw last time I used this library everything was working as with the simplesample_http.ino example on my Arduino MKR1000.
@sandeepmistry i am pretty sure that my adafruit boards don't work at all. Can you try this on your MKR1000 board and see if it works? It won't cost you much time i think.
@yaweiw looks good:
Attempting to connect to SSID: F0645C
Connected to wifi
Fetched NTP epoch time is: 1471010039
Info: IoT Hub SDK for C, version 1.0.1
Info: IoTHubClient accepted the message for delivery
Info: Message Id: 1 Received.
Info: Result Call Back Called! Result is: IOTHUB_CLIENT_CONFIRMATION_OK
Info: Turning fan on.
@sandeepmistry can you please pull my bits and try with your boards as well? https://github.com/yaweiw/azureiothub/tree/develop
Yes, that works as well. I had to provide 2 connection strings in the updated example.
@sandeepmistry yeah. two connections are required and it guarantees working. However, i have just pulled your bits and tried again and seems to be working. I think it's because of setEpochTime was correctly called so SASToken_Create starts to function normally. Let's close this PR off for now.
SAS token generated out of device constr doesn't seem to work. We generate SAS token from iothubowner constr in this fix so that whatever changes in iothub in future won't break the existing code.
The code has been verified with Feather M0 Wifi board. Contact yaweiw@microsoft.com should you have questions.