I just started playing with the mxchip. I want my device to trigger an alarm when receiving some command. It seems to me all examples I found are device collecting info and send to iot hub. Can mxchip receive data from iothub or azure function? And maybe some guidance on getting started?
Asked
Active
Viewed 104 times
2 Answers
2
Yes, assuming you use the SDK from the examples for the MXChip you have those handlers available:
DevKitMQTTClient_SetMessageCallback(MessageCallback);
DevKitMQTTClient_SetDeviceMethodCallback(DeviceMethodCallback);
Examples:
static void MessageCallback(const char *payLoad, int size)
{
Screen.print(1, payLoad, true);
}
static int DeviceMethodCallback(const char *methodName, const unsigned char *payload,
int size, unsigned char **response, int *response_size)
{
LogInfo("Try to invoke method %s", methodName);
// Do your logic...
int result = 200;
return result;
}

silent
- 14,494
- 4
- 46
- 86
1
Yes. Its possible to send messages to device ( Cloud-to-device) from IOT Hub. Here is some example mentioned in these links
https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-csharp-csharp-c2d
https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messaging

Rahul Ruikar
- 1,076
- 6
- 9