Пример #1
0
 private string SendCommandLN(Command cmd, int timeout)
 {
     StringBuilder sb = new StringBuilder("S");
     sb.Append(cmd.ToString());
     sb.Append("$$"); // End of packet
     string output = string.Empty;
     output = cp_.sendDataLN(sb.ToString(), timeout);
     
     return output;
 }
Пример #2
0
        public bool SendPhoneList(string phones)
        {
            const int MAX_TRIES = 1;
            string output = "";
            int tries = 0;

            string data = setData(ref phones);
            Command cmd = new Command(0x23, 0x00, 0x00, data);
            StringBuilder sb = new StringBuilder("S");
            sb.Append(cmd.ToString());
            data = sb.ToString();
            while (data.Length > 0 && tries < MAX_TRIES)
            {
                output = SendDataLN(data, FormTools.SEC * 20);
                if (output.IndexOf("ACK") == 0)
                {
                    data = setData(ref phones);
                    tries = 0;
                }
                else
                    tries++;
            }

            bool result = true;
            if (data.Length > 0 && tries >= MAX_TRIES)
            {
                result = false;
            }
            return result;
        }
Пример #3
0
 private string SendCommand(Command cmd, int timeout)
 {
     StringBuilder sb = new StringBuilder("S");
     sb.Append(cmd.ToString());
     sb.Append("$$"); // End of packet
     string output = string.Empty;
     output = cp_.sendData(sb.ToString(), timeout);
     if (output.LastIndexOf("$$") > 0)
         output = output.Substring(0, output.Length - 2);
     return output;
 }
Пример #4
0
 public void GetPhoneList(ref string phones)
 {
     byte[] data = new byte[] { 0x00 };
     Command cmd = new Command(0x21, 0x00, 0x00, data);
     phones = SendCommandLN(cmd, FormTools.SEC * 100);
 }