Ejemplo n.º 1
0
 public void Call(PhoneBook Contact)
 {
     Call(Contact.Number);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// The AT^SPBC write command searches the current phonebook for the index number of the first (lowest) entry 
        /// that matches the character specified with "schar". The AT^SPBC test command returns the list of phonebooks which can be searched through with AT^SPBC.
        /// CAUTION: Please note that AT^SPBC is assigned the same index as AT^SPBG or AT^SPBS which is not identical
        /// with the physical location numbers used in the various phonebooks. Therefore, do not use the index numbers retrieved with AT^SPBC to dial out or modify phonebook entries.
        /// 
        /// AT+CPBR serves to read one or more entries from the phonebook selected with AT command AT+CPBS.
        /// The AT+CPBR test command returns the location range supported by the current phonebook storage, the maximum
        /// length of "number" field and the maximum length of "text" field.
        /// Note: Length information may not be available while SIM storage is selected. If storage does not offer format information, the format list contains empty parenthesizes.
        /// The AT+CPBR write command determines the phonebook entry to be displayed with "location1" or a location range from "location1" to "location2".
        /// Hence, if no "location2" is given only the entry at "location1" will be displayed. If no entries are found at the selected location "OK" will be returned.
        /// </summary>
        /// <param name="StartLocationID"></param>
        /// <param name="EndLocationID"></param>
        /// <param name="Alphabetically"></param>
        /// <returns></returns>
        public PhoneBook[] Phonebook_List(string StartLocationID, string EndLocationID, bool Alphabetically)
        {
            GeneralResponse re = null;
            if (Alphabetically)
                re = SendATCommand("AT^SPBG=" + StartLocationID + "," + EndLocationID + ",1");
            else
                re = SendATCommand("AT+CPBR=" + StartLocationID + "," + EndLocationID);
            if (re.IsSuccess)
            {
                PhoneBook[] entries = new PhoneBook[re.PayLoad.Length];
                for (int i = 0; i < re.PayLoad.Length; i++)
                {
                    entries[i] = new PhoneBook();
                    string[] values = re.PayLoad[i].Split(',');

                    if (values[0].IndexOf("^SPBG") >=0 )
                    {
                        entries[i].Number = values[1].Split('"')[1];
                        entries[i].NumberType = (CallNumberType)int.Parse(values[2]);
                        entries[i].Name = values[3].Split('"')[1];
                        entries[i].LocationID = values[4];
                    }
                    else if (values[0].IndexOf("+CPBR") >= 0)
                    {
                        entries[i].Number = values[1].Split('"')[1];
                        entries[i].NumberType = (CallNumberType)int.Parse(values[2]);
                        entries[i].Name = values[3].Split('"')[1];
                        entries[i].LocationID = values[0].Split(' ')[1];
                    }
                }

                return entries;
            }

            return null;
        }