Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Receive commands only once, and only one #45

Closed
gmhewett opened this issue Feb 15, 2017 · 2 comments
Closed

Receive commands only once, and only one #45

gmhewett opened this issue Feb 15, 2017 · 2 comments

Comments

@gmhewett
Copy link

gmhewett commented Feb 15, 2017

Hi,

I am using the remote monitoring solution and an Arduino M0 feather. When using the HTTP protocol to send messages from the Arduino to IoTHub, everything works great. However, I can only receive one command per startup. After that, the IoTHubClient_LL_DoWork function is called, but no command is processed.

The code in question from remote_moitoring.c:

            sendMessage(iotHubClientHandle, buffer, bufferSize);
        }
    }

IoTHubClient_LL_DoWork(iotHubClientHandle);
ThreadAPI_Sleep(1000);
currentCycle++;

The first time IoTHubClient_LL_DoWork(iotHubClientHandle) is called, it processes one command, and one command only, even if more are in the queue. I've modified iothub_client_ll.c to log what's happing, and the IoTHubClient_LL_DoWork(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle) appears to be working fine, so I'm not sure what's going on.

Any help would be appreciated. Thanks!

@gmhewett gmhewett changed the title Receive commands only at startup Receive commands only once, and one at atime Feb 15, 2017
@gmhewett gmhewett changed the title Receive commands only once, and one at atime Receive commands only once, and only one Feb 15, 2017
@GregTerrell
Copy link

As I recall the example remote monitoring example only does one sample and likewise one command. You will need to create a loop. The work of sending the serialized sample and of processing the incoming command are both done within IoTHubClient_LL_DoWork().

@gmhewett
Copy link
Author

@GregTerrell thanks for responding. I figured out what my issue was: I was using HTTP protocol to send/receive messages, and the SDK only checks for commands every 25 minutes or so, as per current HTTP guidelines. So, even though my while loop was calling dowork, there was no work to be done because the client hadn't polled the IoT Hub yet. Unfortunately, MQTT is not currently working on the Arduino Feather M0, though. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants