1

I am struggling to get "Event" type measurements into the IOT central app. I have successfully gotten Telemetry, State, and Location working as far as measurements go. However, when I call SendEventAsync() from my C# app and pass in my event ("shutdown"), I never see any updates for Event in my app.

What is the proper syntax for this type of event?

Currently trying:

Code snippets:

using Microsoft.Azure.Devices.Client; 

var eventString = "shutdown"; 

await Client.SendEventAsync(new Message(Encoding.ASCII.GetBytes(eventString)));
4

1 回答 1

1

Based on the Set up a device template, the Events are the measurement type of the device stream pipeline data, so they are in the name=value format. Specifically for the Event measurements the format is represented as:

nameOfTheEvent = value 

where, the value is the string type and can be used for additional info of the event, e.g. reason for shutdown, etc.

In your scenario, the following code snippet shows a message for sending a shutdown event to the Azure IoT Central:

var message = new Message(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(new { shutdown = "User exited", })));
于 2019-07-30T06:25:44.260 回答