コード例 #1
0
        private void CallingGPRSConnectivityProcess()
        {
            try{
                Constants.Commands commandVal = Constants.Commands.AT;
                success = false;
                buffer  = string.Empty;
                foreach (Constants.Commands value in Enum.GetValues(typeof(Constants.Commands)))
                {
                    if (Constants.CurrentRequest == Convert.ToString(value))
                    {
                        commandVal = value;
                        break;
                    }
                }

                switch (commandVal)
                {
                case Constants.Commands.CIPSHUT:
                    CommandSendProcess(Constants.Commands.CGATT.ToString());
                    Constants.PreviousRequest = string.Empty;
                    break;

                case Constants.Commands.CGATT:
                    CommandSendProcess(Constants.Commands.Open_CIPSERVER.ToString());
                    break;

                case Constants.Commands.Open_CIPSERVER:
                    CommandSendProcess(Constants.Commands.CIFSR.ToString(), Constants.GPRSPortNo.ToString());
                    break;

                case Constants.Commands.CIFSR:
                    CommandSendProcess(Constants.Commands.CIPSTATUS.ToString());
                    break;

                case Constants.Commands.CIPSTATUS:
                    CommandSendProcess(string.Empty);
                    break;

                case Constants.Commands.Close_CIPSERVER:
                    CommandSendProcess(string.Empty);

                    break;

                case Constants.Commands.CIPCLOSE:
                    CommandSendProcess(string.Empty);
                    break;
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog(ex);
            }
        }
コード例 #2
0
        internal static McmpResponse ExecuteCommand(this Configuration.ClientConfiguration clientConfig, Uri cluster, Constants.Commands command, params object[] paramList)
        {
            if (paramList.Length % 2 != 0)
            {
                throw new InvalidDataException("paramList must be an even number of parameters");
            }

            Dictionary <string, string> paramStringList = new Dictionary <string, string>();

            for (int idx = 0; idx < paramList.Length; idx += 2)
            {
                paramStringList.Add(paramList[idx].ToString(), paramList[idx + 1].ToString());
            }

            string postData = clientConfig.GetPostData((string[])MCMP.Attributes.CommandAttribute.GetInfoFromCommand(command, "RequiredKeys"), paramStringList);

            return(cluster.ExecuteCommand((string)MCMP.Attributes.CommandAttribute.GetInfoFromCommand(command, "Method"),
                                          (string)MCMP.Attributes.CommandAttribute.GetInfoFromCommand(command, "Path"), postData));
        }
コード例 #3
0
        internal static McmpResponse ExecuteCommand(this Configuration.ClientConfiguration clientConfig, Uri cluster, Constants.Commands command, Dictionary <string, string> paramList = null)
        {
            string postData = clientConfig.GetPostData((string[])MCMP.Attributes.CommandAttribute.GetInfoFromCommand(command, "RequiredKeys"), paramList);

            return(cluster.ExecuteCommand((string)MCMP.Attributes.CommandAttribute.GetInfoFromCommand(command, "Method"),
                                          (string)MCMP.Attributes.CommandAttribute.GetInfoFromCommand(command, "Path"), postData));
        }