Azure / azure-iot-arduino

Azure IoT library for the Arduino
Other
168 stars 95 forks source link

device twin for azure-iot-arduino #62

Closed MehranMazhar closed 6 years ago

MehranMazhar commented 7 years ago

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.

JetstreamRoySprowl commented 7 years ago

@MehranMazhar : this question was a bit too big for a quick answer, so we're looking at the possibility of adding device twin support to the Arduino libraries; I'll keep you posted.

JetstreamRoySprowl commented 7 years ago

@MehranMazhar : unfortunately, figuring this one out would require much of the work of actually adding device twin support for Arduino, and that is beyond what I'm able to do for now. I've put it in front of our PM, who seemed excited about adding the device twin support, so this picture may change at some point.

JetstreamRoySprowl commented 7 years ago

@MehranMazhar : I think John answered this one here, which seems to be a duplicate. If you're covered, will you please close this issue?

MehranMazhar commented 7 years ago

@JetstreamRoySprowl I still could not do it with John's method. So should we wait for support device twin on ardunio with mqtt ?

JetstreamRoySprowl commented 7 years ago

@MehranMazhar : I'm afraid I don't have any useful info for you at this point. I don't have a timeline for device twin support, nor do I know if such a timeline will ever exist.

MehranMazhar commented 6 years ago

@JetstreamRoySprowl Can I Ask you where is this feature supported? I saw on this issue you said that it will be released soon

JetstreamRoySprowl commented 6 years ago

@MehranMazhar When the (edit 1.0.44) Arduino release comes out (I'm working on it now) it will work with this sample

JetstreamRoySprowl commented 6 years ago

@MehranMazhar The 1.0.44 Azure IoT Arduino libraries are out including twin support. You'll need the 2.4.0 ESP8266 Arduino package as well.