Пример #1
0
bool GPRS::init(void)
{
  if (!sim900_check_with_cmd("AT\r\n","OK\r\n",CMD))
    return false;


  if (!sim900_check_with_cmd("AT+CFUN=1\r\n","OK\r\n",CMD))
    return false;


  if (!checkSIMStatus())
    return false;

  if (!sim900_check_with_cmd("AT+CNMI?\r\n", "+CNMI: 2,2,0,0,0\r\nOK\r\n", CMD)) {
    if (!sim900_check_with_cmd("AT+CNMI=2,2,0,0,0\r\n","OK\r\n", CMD)) {
      return false;
    }
  }

  if (!sim900_check_with_cmd("AT+CMGF?\r\n", "+CMGF: 1\r\nOK\r\n", CMD)) {
    if (!sim900_check_with_cmd("AT+CMGF=1\r\n","OK\r\n", CMD)) {
      return false;
    }
  }

  if (!sim900_check_with_cmd("AT+CLIP=1\r\n","OK\r\n", CMD)) {
      return false;
  }
  return true;
}
Пример #2
0
bool GPRS::preInit()
{
    for(int i = 0; i < 2; i++) {
        sendCmd("AT\r\n");
        delay(1000);
    }
    return checkSIMStatus();
}
bool GPRS::init(void)
{
    if(!sim900_check_with_cmd("AT\r\n","OK\r\n",CMD)){
		return false;
    }
    
    if(!sim900_check_with_cmd("AT+CFUN=1\r\n","OK\r\n",CMD)){
        return false;
    }
    
    if(!checkSIMStatus()) {
		return false;
    }
    return true;
}
int GPRS::init(void)
{
    if(0 != sim900_check_with_cmd("AT\r\n","OK",DEFAULT_TIMEOUT,CMD)){
        return -1;
    }
    
    if(0 != sim900_check_with_cmd("AT+CFUN=1\r\n","OK",DEFAULT_TIMEOUT,CMD)){
        return -1;
    }
    
    if(0 != checkSIMStatus()) {
        return -1;
    }
    
    return 0;
}
bool GPRS::init(void)
{
    if(!sim900_check_with_cmd(F("AT\r\n"),"OK\r\n",CMD)){
		return false;
    }
    
    if(!sim900_check_with_cmd(F("AT+CFUN=1\r\n"),"OK\r\n",CMD)){
        return false;
    }
	
	//180822 Set SMS to text mode
	if(!sim900_check_with_cmd(F("AT+CMGF=1\r\n"), "OK\r\n", CMD)) { // Set message mode to ASCII
        return false;
    }
    //delay(500);	It is not necessary, as we have time before next command
    
    if(!checkSIMStatus()) {
		return false;
    }
    return true;
}