MKRGSM
MKRGSM copied to clipboard
GSM Contact interface
Whats up!
I am was working on a contact manager for the MKRGSM, and put together a class that allow access to the SIM Contact memory.
I tested this code with a AT&T sim card with 250 contacts, the example works on my device. My device may have a few burned pins and sometimes uploads but returns error messages, so testing on another device would probably be helpful
Not sure how I wanted to implement searching contacts and such, I'm open to other idea's. Right now it returns a byte array of contact id's and you can look them up with .get()
P.S. This is my first pull request (ever) so I'm pretty excited! Let me know how it goes.
Hi @jklein131,
Thank you for taking the time to submit this pull request, we think it's an interesting feature.
However, I think the API needs to be changed to be a little more Arduino like. We prefer to avoid API's that use pointers, structs, etc. See Arduino Style Guide for Writing Libraries.
Here's a proposal, we welcome feedback on it :)
class GSMContacts {
public:
GSMContacts();
~GSMContacts();
int begin(); // combine the current begin and ready into one call
// add a new contact, returns the contact id on success, -1 on failure
int add(const char* name, const char* number, int type);
int add(const String& name, const String& number, int type);
// update a contact by index
int update(int index, const char* name, const char* number, int type);
int update(int index, const String& name, const String& number, int type);
// remove a contact by id, returns 1 on success, 0 on failure
int remove(int id);
// search for a contact by name, returns the id if found or -1 on failure
int search(const char* name);
int search(const String& q);
// retrieve an index's info
String name(int index);
String number(int index);
String type(int index);
// maybe an API to get the number of contacts if possible?
};
@cmaglie @facchinm @tigoe any thoughts on the API proposal above and what's in the original pull request?
Thanks I actually just came back to this, these are changes I can make thanks!
Just getting to this now, sorry. Looks legible and useful to me.
I've forked this and changed the API to something that resembles the above. I need to test a bit further before uploading.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.