Azure / azure-iot-arduino

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

Calling Direct Methods not working on new version of azure-iot-arduino #73

Closed MehranMazhar closed 5 years ago

MehranMazhar commented 6 years ago

I tested the new version of the Arduino module. When I send a message to Arduino with : {"Name" : "TurnFanOn", "Parameters" : {}}

This method works correctly .

METHODRETURN_HANDLE TurnOn(ContosoAnemometer* device)
{
    (void)device;
    (void)printf("Turning fan on with Method.\r\n");

    METHODRETURN_HANDLE result = MethodReturn_Create(1, "{\"Message\":\"Turning fan on with Method\"}");
    return result;
}

but when i add the model : WITH_METHOD(TurnOn)

and define this function :

METHODRETURN_HANDLE TurnOn(ContosoAnemometer* device)
{
    (void)device;
    (void)printf("Turning fan on with Method.\r\n");

    METHODRETURN_HANDLE result = MethodReturn_Create(1, "{\"Message\":\"Turning fan on with Method\"}");
    return result;
}

Calling direct methods does not work But in previous versions of this solution it responded.

I have to work with the direct method in arduino for the following reasons:

Durability : Disconnected devices are not contacted. The solution back end is notified that the device is not connected.

Data flow: Two-way. The device app can respond to the method right away. The solution back end receives the outcome contextually to the request.

goyalhonney commented 6 years ago

Did you find anything i am also unable to call direct method

JetstreamRoySprowl commented 6 years ago

The direct methods are not currently supported on Arduino. I've marked this as an enhancement request.

MehranMazhar commented 6 years ago

https://github.com/Azure/azure-iot-sdk-c/issues/378

khushvir commented 4 years ago

Do we have any solution for Direct methods. I am using Esp8266