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()); }
private void SerialiseData() { DateTime now = DateTime.UtcNow; if (Util.utcOffset != null) { now = DateTime.UtcNow - Util.utcOffset; } data.Begin(); data.AddProperty("value", Value[0], 0); data.AddProperty("measurename", measurename); data.AddProperty("unitofmeasure", unitofmeasure); data.AddProperty("timecreated", now.ToString("o")); data.AddProperty("guid", guid); data.AddProperty("displayname", displayname); data.AddProperty("organization", organization); data.AddProperty("location", location); data.End(); }
private void SerialiseData() { DateTime now = DateTime.UtcNow; if (Util.utcOffset != null) { now = DateTime.UtcNow - Util.utcOffset; } jw.Begin(); jw.AddProperty("Dev", DeviceName); jw.AddProperty("Type", Type); jw.AddProperty("Val", Value, 2); jw.AddProperty("Unit", Unit); jw.AddProperty("Utc", now); if (Geo != string.Empty) { jw.AddProperty("Geo", Geo); } jw.AddProperty("Id", MsgId++); jw.End(); }