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();
        }
示例#2
0
        private static void ExportSensorData(ISensorDataExport Output, ReadoutRequest Request)
        {
            Output.Start();

            lock (synchObject)
            {
                Output.StartNode("Sensor");

                Export(Output, new Record[] { new Record(DateTime.Now, temperatureC, lightPercent, motionDetected) }, ReadoutType.MomentaryValues, Request);

                Export(Output, perSecond, ReadoutType.HistoricalValuesSecond, Request);
                Export(Output, perMinute, ReadoutType.HistoricalValuesMinute, Request);
                Export(Output, perHour, ReadoutType.HistoricalValuesHour, Request);
                Export(Output, perDay, ReadoutType.HistoricalValuesDay, Request);
                Export(Output, perMonth, ReadoutType.HistoricalValuesMonth, Request);

                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();
        }
示例#4
0
		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 ();
		}
示例#5
0
		private static void ExportSensorData (ISensorDataExport Output, ReadoutRequest Request)
		{
			Output.Start ();

			lock (synchObject)
			{
				Output.StartNode ("Sensor");

				Export (Output, new Record[]{ new Record (DateTime.Now, temperatureC, lightPercent, motionDetected) }, ReadoutType.MomentaryValues, Request);

				Export (Output, perSecond, ReadoutType.HistoricalValuesSecond, Request);
				Export (Output, perMinute, ReadoutType.HistoricalValuesMinute, Request);
				Export (Output, perHour, ReadoutType.HistoricalValuesHour, Request);
				Export (Output, perDay, ReadoutType.HistoricalValuesDay, Request);
				Export (Output, perMonth, ReadoutType.HistoricalValuesMonth, Request);

				Output.EndNode ();
			} 

			Output.End ();
		}
示例#6
0
		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 ();
		}