Obtener los contactos / almacenar contactos en la tarjeta SIM


11

Tengo el escudo GSM y ¿hay alguna forma de obtener los contactos almacenados en la tarjeta SIM? ¿Parece que la biblioteca GSM no admite escribir datos en / leer datos de la tarjeta SIM?

Mi objetivo es almacenar el número de teléfono de la tarjeta SIM y algunas variables en la tarjeta SIM, por lo que no necesitaría cambiar el programa de vez en cuando.

Todo lo que necesito hacer es ingresar todas las variables en la tarjeta SIM a través de cualquier teléfono móvil (quizás almacenando las variables como contactos, ya que la función de la guía telefónica debería ser muy común en los teléfonos).

Respuestas:


6

¿Qué has investigado hasta ahora? Siguiendo el enlace que ha proporcionado para el escudo, aproximadamente la tercera línea de la descripción es una referencia al conjunto de comandos AT utilizado por el chip.

Acabo de hacer un par de búsquedas rápidas y encontré:

2.2.4 ATD><n> Originar llamada telefónica al número en la memoria

3.2.26 AT+CPBF Encuentra entradas de la guía telefónica

3.2.27 AT+CPBR Leer las entradas actuales de la agenda telefónica

3.2.28 AT+CPBS Seleccionar el almacenamiento de memoria de la agenda telefónica

Probablemente sea un buen lugar para comenzar.


1

Gracias a @Madivad por la inspiración del comando AT. No estoy muy familiarizado con GSM y Arduino. Pero de todos modos, lo siguiente funcionó para mí.

Créditos a @Madivad y personas del foro arduino.

#include <GSM.h>
GSM gsmAccess(true);
int sizer = 200;
char myNumber[200];
int timeout = 5000; // in milli seconds

void setup()
{
  Serial.begin(9600);

  boolean notConnected = true;

  Serial.println("Connecting to the GSM network");

  while(notConnected){
    if(gsmAccess.begin() == GSM_READY) // Note: I do not require PIN #
      notConnected = false;
    else {
      Serial.println("Not connected, trying again");
      delay(1000);
    }
  }

  Serial.println("Connected");

  theGSM3ShieldV1ModemCore.println("AT+CPBS=\"SM\"");  
  int start1 = millis();   
  while((millis() - start1) < timeout){
    Serial.print(theGSM3ShieldV1ModemCore.theBuffer().read());
  }   
  Serial.print("Set to look at SIM card storage");

  // search for contact name "test"
  theGSM3ShieldV1ModemCore.println("AT+CPBF=\"test\"");  
  start1 = 0;
  start1 = millis();   
  while((millis() - start1) < timeout && !theGSM3ShieldV1ModemCore.theBuffer().extractSubstring(",\"", "\",", myNumber, sizer)){
    Serial.print(theGSM3ShieldV1ModemCore.theBuffer().read());
  }   
  Serial.print("Got contact number");

 // print out the phone of "test"
 Serial.println(myNumber);

}

void loop()
{

}
Al usar nuestro sitio, usted reconoce que ha leído y comprende nuestra Política de Cookies y Política de Privacidad.
Licensed under cc by-sa 3.0 with attribution required.