IvanAldas / gsm-shield-arduino

Automatically exported from code.google.com/p/gsm-shield-arduino
0 stars 0 forks source link

Add Phonebook methods to work with phonenames, not just phonenumbers #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Existing Phonebook methods:
char GetPhoneNumber(byte position, char *phone_number);
char WritePhoneNumber(byte position, char *phone_number);
char DelPhoneNumber(byte position);
char ComparePhoneNumber(byte position, char *phone_number);

Create new Phonebook methods:
char FindPhoneNumber (char *phone_number) /* Returns the position where the 
number was found on the phonebook or empty if not found */

char FindPhoneName (char *phone_name) /* Returns the position where the name 
was found on the phonebook or empty if not found */

char GetPhoneName (byte position, char *phone_name) /* returns the name saved 
on the phonebook at specified position or empty if not found */

This will allow a crude way to configure sketch variables at run time by the 
user with the SIM phonebook.
Example:
Create a phonebook entry on the SIM with name "CONF-DoStuff" and phonenumber 
"1".

When the sketch runs, just do something like (not tested):
bkPos = FindPhoneName("CONF-DoStuff");
if(bkPos)
   GetPhoneNumber(bkPos, DoStuff);
else
  DoStuff = 0; /* default is not to do stuff */
endif

Also, when sending SMS will allow more detail on messages sent and received:
bkPos = FindPhoneNumber(phone_number);
if (bkPos)
  GetPhoneName(bkPos, phone_name);
else
  phone_name = phone_number; /* or you could use something like "<phonename> phonenumber" if you wanted to have both*/
endif
Serial.print("Message received from ");
Serial.println(phone_name);

Original issue reported on code.google.com by sjfaust...@gmail.com on 10 Dec 2011 at 1:58

GoogleCodeExporter commented 8 years ago

Original comment by dmg...@gmail.com on 21 Jan 2012 at 4:53

GoogleCodeExporter commented 8 years ago

Original comment by martines...@gmail.com on 11 Dec 2012 at 5:01

GoogleCodeExporter commented 8 years ago
This issue section is not longer supported.
Please check the support page www.gsmlib.org 

Original comment by martines...@gmail.com on 6 Jul 2013 at 11:27