コード例 #1
0
        static public string CreateReplyMessage(DataClasses.ControllerData controllerdata)
        {
            string replymessage = "";

            DateTime ontime      = DatabaseCalls.GetNextRelayOnTime(controllerdata.UID);
            long     ontime_unix = new DateTimeOffset(ontime).ToUnixTimeSeconds();

            replymessage += "<TimeOn=" + ontime_unix.ToString() + ">";

            DateTime offtime      = DatabaseCalls.GetNextRelayOffTime(controllerdata.UID);
            long     offtime_unix = new DateTimeOffset(offtime).ToUnixTimeSeconds();

            replymessage += "<TimeOff=" + offtime_unix.ToString() + ">";

            string newstate = DatabaseCalls.GetNewRelayState(controllerdata.UID);

            if (newstate != "") //ensure content
            {
                replymessage += "<RelayState=" + newstate + ">";
            }
            else
            {
                Console.WriteLine("No New State");
            }

            return(replymessage);
        }
コード例 #2
0
 static public void StoreControllerData(DataClasses.ControllerData controllerdata)
 {
     DatabaseCalls.AddNewControllerDataToDatabase(controllerdata);
 }