public void HTTPRequestEventHandler(Object sender, OnHttpRequestArgs requestArgs) //requestArgs { //int bytesSent = 0; string QueryString = requestArgs.Request.Header.RequestPath; string DeviceID = ""; string DeviceValue = ""; string AuthCode = ""; string[] words; //ErrorLog.Notice(requestArgs.Request.Header.RequestType.ToString()); //IP/DeviceID/Value if (requestArgs.Request.Header.RequestType.ToString() == "GET") { //ErrorLog.Notice("QueryString = {0}\n", QueryString); if (QueryString.Contains("code")) //Need to Save this Code for Authorization Sequence { words = QueryString.Split('='); SmartThingsReceiver.AuthCode = words[1]; ErrorLog.Notice("SmartThingsReceiver Authorization Code Received {0}. Authorization will now Continue\n", AuthCode); requestArgs.Response.ContentString = "You May Now Close Your Browser, The Processor Will Finish The Authorization Sequence...Monitor Console For Status\n"; AuthenticateStep2(); //Continue Authentication Procedure } else { words = QueryString.Split('/'); DeviceID = words[1]; DeviceValue = words[2]; if (DeviceID != "" && DeviceValue != "") { SignalChangeEvents.SerialValueChange(DeviceID, DeviceValue); requestArgs.Response.ContentString = "OK"; } else { requestArgs.Response.ContentString = "Invalid Request"; } } } }
public static void SerialValueChange(string DeviceID, string DeviceValue) { SignalChangeEvents.onSerialValueChange(new SerialChangeEventArgs(DeviceID, DeviceValue)); }