private static void Export(ISensorDataExport Output, IEnumerable <Record> History, ReadoutType Type, ReadoutRequest Request) { if ((Request.Types & Type) != 0) { foreach (Record Rec in History) { if (!Request.ReportTimestamp(Rec.Timestamp)) { continue; } Output.StartTimestamp(Rec.Timestamp); if (Request.ReportField("Temperature")) { Output.ExportField("Temperature", Rec.TemperatureC, 1, "C", Type); } if (Request.ReportField("Light")) { Output.ExportField("Light", Rec.LightPercent, 1, "%", Type); } if (Request.ReportField("Motion")) { Output.ExportField("Motion", Rec.Motion, Type); } Output.EndTimestamp(); } } }
private static void HttpGetSensorData(HttpServerResponse resp, string ContentType, ISensorDataExport Output, ReadoutRequest Request) { DateTime Now = DateTime.Now; string s; int i; resp.ContentType = ContentType; resp.Encoding = System.Text.Encoding.UTF8; resp.Expires = DateTime.Now; resp.ReturnCode = HttpStatusCode.Successful_OK; Output.Start(); Output.StartNode("Actuator"); Output.StartTimestamp(Now); if ((Request.Types & ReadoutType.MomentaryValues) != 0 && Request.ReportTimestamp(Now)) { if (Request.ReportField("Digital Output Count")) { Output.ExportField("Digital Output Count", 8, ReadoutType.StatusValues); } for (i = 0; i < 8; i++) { s = "Digital Output " + (i + 1).ToString(); if (Request.ReportField(s)) { Output.ExportField(s, digitalOutputs [i].Value); } } if (Request.ReportField("State")) { Output.ExportField("State", alarmThread != null); } } Output.EndTimestamp(); Output.EndNode(); Output.End(); }
private static void ExportSensorData(ISensorDataExport Output, ReadoutRequest Request) { DateTime Now = DateTime.Now; string s; int i; Output.Start(); Output.StartNode("Actuator"); Output.StartTimestamp(Now); if ((Request.Types & ReadoutType.MomentaryValues) != 0 && Request.ReportTimestamp(Now)) { if (Request.ReportField("Digital Output Count")) { Output.ExportField("Digital Output Count", 8, ReadoutType.StatusValues); } for (i = 0; i < 8; i++) { s = "Digital Output " + (i + 1).ToString(); if (Request.ReportField(s)) { Output.ExportField(s, digitalOutputs [i].Value); } } if (Request.ReportField("State")) { Output.ExportField("State", alarmThread != null); } } Output.EndTimestamp(); Output.EndNode(); Output.End(); }
private static void ExportSensorData (ISensorDataExport Output, ReadoutRequest Request) { DateTime Now = DateTime.Now; string s; int i; Output.Start (); Output.StartNode ("Actuator"); Output.StartTimestamp (Now); if ((Request.Types & ReadoutType.MomentaryValues) != 0 && Request.ReportTimestamp (Now)) { if (Request.ReportField ("Digital Output Count")) Output.ExportField ("Digital Output Count", 8, ReadoutType.StatusValues); for (i = 0; i < 8; i++) { s = "Digital Output " + (i + 1).ToString (); if (Request.ReportField (s)) Output.ExportField (s, digitalOutputs [i].Value); } if (Request.ReportField ("State")) Output.ExportField ("State", alarmThread != null); } Output.EndTimestamp (); Output.EndNode (); Output.End (); }
private static void Export (ISensorDataExport Output, IEnumerable<Record> History, ReadoutType Type, ReadoutRequest Request) { if ((Request.Types & Type) != 0) { foreach (Record Rec in History) { if (!Request.ReportTimestamp (Rec.Timestamp)) continue; Output.StartTimestamp (Rec.Timestamp); if (Request.ReportField ("Temperature")) Output.ExportField ("Temperature", Rec.TemperatureC, 1, "C", Type); if (Request.ReportField ("Light")) Output.ExportField ("Light", Rec.LightPercent, 1, "%", Type); if (Request.ReportField ("Motion")) Output.ExportField ("Motion", Rec.Motion, Type); Output.EndTimestamp (); } } }
private static void HttpGetSensorData (HttpServerResponse resp, string ContentType, ISensorDataExport Output, ReadoutRequest Request) { DateTime Now = DateTime.Now; string s; int i; resp.ContentType = ContentType; resp.Encoding = System.Text.Encoding.UTF8; resp.Expires = DateTime.Now; resp.ReturnCode = HttpStatusCode.Successful_OK; Output.Start (); Output.StartNode ("Actuator"); Output.StartTimestamp (Now); if ((Request.Types & ReadoutType.MomentaryValues) != 0 && Request.ReportTimestamp (Now)) { if (Request.ReportField ("Digital Output Count")) Output.ExportField ("Digital Output Count", 8, ReadoutType.StatusValues); for (i = 0; i < 8; i++) { s = "Digital Output " + (i + 1).ToString (); if (Request.ReportField (s)) Output.ExportField (s, digitalOutputs [i].Value); } if (Request.ReportField ("State")) Output.ExportField ("State", alarmThread != null); } Output.EndTimestamp (); Output.EndNode (); Output.End (); }