private byte[] SystemConfig(string[] IotItems) { JSONWriter jw = new JSONWriter(); jw.Begin(); jw.AddProperty("Dev", ConfigurationManager.DeviceName); jw.AddProperty("Id", uniqueDeviceIdentifier); jw.AddProperty("Items", IotItems); jw.End(); return(jw.ToArray()); }
private byte[] ToJson() { jw.Begin(); jw.AddProperty("Dev", deviceName); jw.AddProperty("Type", type); jw.AddProperty("Val", value, "f"); jw.AddProperty("Unit", unit); jw.AddProperty("Utc", DateTime.UtcNow); if (Geo != string.Empty) { jw.AddProperty("Geo", Geo); } jw.AddProperty("Id", msgId++); jw.End(); return(jw.ToArray()); }
/// <summary> /// ToJson function is used to convert sensor data into a JSON string to be sent to Azure Event Hub /// </summary> /// <returns>JSon String containing all info for sensor data</returns> public byte[] ToJson() { SerialiseData(); return(data.ToArray()); }