• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ sim900_check_with_cmd函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中sim900_check_with_cmd函数的典型用法代码示例。如果您正苦于以下问题:C++ sim900_check_with_cmd函数的具体用法?C++ sim900_check_with_cmd怎么用?C++ sim900_check_with_cmd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sim900_check_with_cmd函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: snprintf

bool GPRS::join()
{
    char cmd[64];
    char ipAddr[32];
    //Select multiple connection
    //sim900_check_with_cmd("AT+CIPMUX=1\r\n","OK",DEFAULT_TIMEOUT,CMD);

    //set APN
    snprintf(cmd,sizeof(cmd),"AT+CSTT=\"%s\",\"%s\",\"%s\"\r\n",_apn,_userName,_passWord);
    sim900_check_with_cmd(cmd, "OK", DEFAULT_TIMEOUT,CMD);

    //Brings up wireless connection
    sim900_check_with_cmd("AT+CIICR\r\n","OK",DEFAULT_TIMEOUT,CMD);

    //Get local IP address
    sim900_send_cmd("AT+CIFSR\r\n");
    sim900_read_buffer(ipAddr,32,2);

    if(NULL != strstr(ipAddr,"AT+CIFSR")) {
        _ip = str_to_ip(ipAddr+12);
        if(_ip != 0) {
            return true;
        }
    }
    return false;
}
开发者ID:HIMADE,项目名称:GPRS_Shield_Suli,代码行数:26,代码来源:GPRS_Shield_Arduino.cpp


示例2: sim900_send_cmd

//Here is where we ask for APN configuration, with F() so we can save MEMORY
bool GPRS::join(const __FlashStringHelper *apn, const __FlashStringHelper *userName, const __FlashStringHelper *passWord)
{
	byte i;
    char *p, *s;
    char ipAddr[32];
    //Select multiple connection
    //sim900_check_with_cmd("AT+CIPMUX=1\r\n","OK",DEFAULT_TIMEOUT,CMD);

    //set APN. OLD VERSION
    //snprintf(cmd,sizeof(cmd),"AT+CSTT=\"%s\",\"%s\",\"%s\"\r\n",_apn,_userName,_passWord);
    //sim900_check_with_cmd(cmd, "OK\r\n", DEFAULT_TIMEOUT,CMD);
    sim900_send_cmd("AT+CSTT=\"");
    if (apn) {
      sim900_send_cmd(apn);
    }
    sim900_send_cmd("\",\"");
    if (userName) {
      sim900_send_cmd(userName);
    }
    sim900_send_cmd("\",\"");
    if (passWord) {
      sim900_send_cmd(passWord);
    }
    sim900_check_with_cmd("\"\r\n", "OK\r\n", CMD);
    

    //Brings up wireless connection
    sim900_check_with_cmd("AT+CIICR\r\n","OK\r\n", CMD);

    //Get local IP address
    sim900_send_cmd("AT+CIFSR\r\n");
    sim900_clean_buffer(ipAddr,32);
    sim900_read_buffer(ipAddr,32);
	//Response:
	//AT+CIFSR\r\n       -->  8 + 2
	//\r\n				 -->  0 + 2
	//10.160.57.120\r\n  --> 15 + 2 (max)   : TOTAL: 29 
	//Response error:
	//AT+CIFSR\r\n       
	//\r\n				 
	//ERROR\r\n
    if (NULL != strstr(ipAddr,"ERROR")) {
		return false;
	}
    s = ipAddr + 12;
    p = strstr((char *)(s),"\r\n"); //p is last character \r\n
    if (NULL != s) {
        i = 0;
        while (s < p) {
            ip_string[i++] = *(s++);
        }
        ip_string[i] = '\0';            
    }
    _ip = str_to_ip(ip_string);
    if(_ip != 0) {
        return true;
    }
    return false;
} 
开发者ID:Yurysamara,项目名称:smart_power31,代码行数:60,代码来源:GPRS_Shield_Arduino.cpp


示例3: init

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;
}
开发者ID:Yurysamara,项目名称:smart_power31,代码行数:15,代码来源:GPRS_Shield_Arduino.cpp


示例4: init

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;
}
开发者ID:HIMADE,项目名称:GPRS_Shield_Suli,代码行数:16,代码来源:GPRS_Shield_Arduino.cpp


示例5: need

int GPRS::readSMS(int messageIndex, char *message, int length, char *phone, char *datetime)  
{
  /* Response is like:
  AT+CMGR=2
  
  +CMGR: "REC READ","XXXXXXXXXXX","","14/10/09,17:30:17+08"
  SMS text here
  
  So we need (more or lees), 80 chars plus expected message length in buffer. CAUTION FREE MEMORY
  */

    int i = 0;
    char gprsBuffer[80 + length];
    char cmd[16];
    char *p,*p2,*s;
    
    sim900_check_with_cmd("AT+CMGF=1\r\n","OK\r\n",CMD);
    suli_delay_ms(1000);
    sprintf(cmd,"AT+CMGR=%d\r\n",messageIndex);
    sim900_send_cmd(cmd);
    sim900_clean_buffer(gprsBuffer,sizeof(gprsBuffer));
    sim900_read_buffer(gprsBuffer,sizeof(gprsBuffer),DEFAULT_TIMEOUT);
    
    if(NULL != ( s = strstr(gprsBuffer,"+CMGR:"))){
        // Extract phone number string
        p = strstr(s,",");
        p2 = p + 2; //We are in the first phone number character
        p = strstr((char *)(p2), "\"");
        if (NULL != p) {
            i = 0;
            while (p2 < p) {
                phone[i++] = *(p2++);
            }
            phone[i] = '\0';            
        }
        // Extract date time string
        p = strstr((char *)(p2),",");
        p2 = p + 1; 
        p = strstr((char *)(p2), ","); 
        p2 = p + 2; //We are in the first date time character
        p = strstr((char *)(p2), "\"");
        if (NULL != p) {
            i = 0;
            while (p2 < p) {
                datetime[i++] = *(p2++);
            }
            datetime[i] = '\0';
        }        
        if(NULL != ( s = strstr(s,"\r\n"))){
            i = 0;
            p = s + 2;
            while((*p != '\r')&&(i < length-1)) {
                message[i++] = *(p++);
            }
            message[i] = '\0';
        }
        return 0;
    }
    return -1;    
}
开发者ID:alhabbal,项目名称:GPRS_Shield_Suli,代码行数:60,代码来源:GPRS_Shield_Arduino.cpp


示例6: sim900_check_with_cmd

bool GPRS::readSMS(int messageIndex, char *message,int length)
{
    int i = 0;
    char gprsBuffer[100];
    //char cmd[16];
	char num[4];
    char *p,*s;
    
    sim900_check_with_cmd("AT+CMGF=1\r\n","OK\r\n",CMD);
    delay(1000);
	sim900_send_cmd("AT+CMGR=");
	itoa(messageIndex, num, 10);
	sim900_send_cmd(num);
	sim900_send_cmd("\r\n");
//  sprintf(cmd,"AT+CMGR=%d\r\n",messageIndex);
//    sim900_send_cmd(cmd);
    sim900_clean_buffer(gprsBuffer,sizeof(gprsBuffer));
    sim900_read_buffer(gprsBuffer,sizeof(gprsBuffer),DEFAULT_TIMEOUT);
    if(NULL != ( s = strstr(gprsBuffer,"+CMGR:"))){
        if(NULL != ( s = strstr(s,"\r\n"))){
            p = s + 2;
            while((*p != '\r')&&(i < length-1)) {
                message[i++] = *(p++);
            }
            message[i] = '\0';
            return true;
        }
    }
    return false;   
}
开发者ID:Yurysamara,项目名称:smart_power31,代码行数:30,代码来源:GPRS_Shield_Arduino.cpp


示例7: suli_delay_ms

int GPRS::sendSMS(char *number, char *data)
{
    char cmd[32];
    if(0 != sim900_check_with_cmd("AT+CMGF=1\r\n", "OK", DEFAULT_TIMEOUT,CMD)) { // Set message mode to ASCII
        return -1;
    }
    suli_delay_ms(500);
    snprintf(cmd, sizeof(cmd),"AT+CMGS=\"%s\"\r\n", number);
    if(0 != sim900_check_with_cmd(cmd,">",DEFAULT_TIMEOUT,CMD)) {
        return -1;
    }
    suli_delay_ms(1000);
    sim900_send_cmd(data);
    suli_delay_ms(500);
    sim900_send_End_Mark();
    return 0;
}
开发者ID:HIMADE,项目名称:GPRS_Shield_Suli,代码行数:17,代码来源:GPRS_Shield_Arduino.cpp


示例8: init

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;
}
开发者ID:amperka,项目名称:gprs-shield,代码行数:30,代码来源:GPRS_Shield_Arduino.cpp


示例9: itoa

 bool GPRS::delBookEntry(int index)
{
	char indexStr[4];
	itoa(index, indexStr, 10);
	sim900_flush_serial();
    sim900_send_cmd(F("AT+CPBW="));
    sim900_send_cmd(indexStr);
    return sim900_check_with_cmd(F("\r"),"OK\r\n",CMD);	
}
开发者ID:Seeed-Studio,项目名称:GPRS_SIM900,代码行数:9,代码来源:GPRS_Shield_Arduino.cpp


示例10: queryBearer

bool GPRS::queryBearer(uint8_t * bearerStatus)
{
    char receiveBuffer[32];
    char * commaPtr;

    // send AT+SAPBR=2,1 and read "+SAPBR"
    if (sim900_check_with_cmd(F("AT+SAPBR=2,1\r\n"),"+SAPBR:", DATA) == false)
        return false;

    sim900_clean_buffer(receiveBuffer, sizeof(receiveBuffer));

    // check response which looks like:
    // +SAPBR: <cid>,<Status>,<IP_Addr>\r\nOK

    // read cid (always 1)
    if (sim900_read_string_until(receiveBuffer, sizeof(receiveBuffer), "1,") == NULL)
        return false;

    // read until next comma -> status
    commaPtr = sim900_read_string_until(receiveBuffer, sizeof(receiveBuffer), ",");
    if (commaPtr == NULL)
        return false;

    // replace comma with string termination
    *commaPtr = '\0';

    // now extract status
    *bearerStatus = (uint8_t)atol(receiveBuffer);

    // only check for ip address if we are connected (=1)
    if (*bearerStatus == 1)
    {
        char * endOfIpAddress = NULL;

        // read ip address, which is enclosed in '"', so read first '"'
        if (sim900_read_string_until(receiveBuffer, sizeof(receiveBuffer), "\"") == NULL)
            return false;

        // read second '"'
        endOfIpAddress = sim900_read_string_until(receiveBuffer, sizeof(receiveBuffer), "\"");
        if (endOfIpAddress == NULL)
            return false;

        *endOfIpAddress = '\0';

        strncpy(ip_string, receiveBuffer, sizeof(ip_string));
        _ip = str_to_ip(ip_string);
    }

    // flush rest of data which should be "\r\nOK"
    sim900_flush_serial();

    return true;;
}
开发者ID:Seeed-Studio,项目名称:GPRS_SIM900,代码行数:54,代码来源:GPRS_Shield_Arduino.cpp


示例11: callUp

int GPRS::callUp(char *number)
{
    char cmd[24];
    if(0 != sim900_check_with_cmd("AT+COLP=1\r\n","OK",DEFAULT_TIMEOUT,CMD)) {
        return -1;
    }
    suli_delay_ms(1000);
    sprintf(cmd,"ATD%s;\r\n", number);
    sim900_send_cmd(cmd);
    return 0;
}
开发者ID:HIMADE,项目名称:GPRS_Shield_Suli,代码行数:11,代码来源:GPRS_Shield_Arduino.cpp


示例12: sim900_send_cmd

bool GPRS::ntpSyncDateTime(int8_t timezone)
{
    // e.g. "-105\0", this is not a valid value to pass to the SIM module, but we need to make sure not
    // to cross boundaries of the char array
    char timezoneString[5] = {'\0'};

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

    sim900_send_cmd(F("AT+CNTP=\"pool.ntp.org\","));

    itoa(timezone, timezoneString, 10);

    sim900_send_cmd(timezoneString);

    if (sim900_check_with_cmd(F("\r\n"), "OK\r\n", CMD) == false)
        return false;

    return sim900_check_with_cmd(F("AT+CNTP\r\n"), "+CNTP: 1", CMD);
}
开发者ID:Seeed-Studio,项目名称:GPRS_SIM900,代码行数:20,代码来源:GPRS_Shield_Arduino.cpp


示例13: close

bool GPRS::close()
{
    // if not connected, return
    if (is_connected() == false) {
        return true;
    }
    if(0 != sim900_check_with_cmd("AT+CIPCLOSE\r\n", "CLOSE OK", DEFAULT_TIMEOUT,CMD)) {
        return false;
    }
    return true;
}
开发者ID:HIMADE,项目名称:GPRS_Shield_Suli,代码行数:11,代码来源:GPRS_Shield_Arduino.cpp


示例14: callUp

bool GPRS::callUp(char *number)
{
  if(!sim900_check_with_cmd("AT+COLP=1\r\n","OK\r\n",CMD)) {
      return false;
  }
  delay(1000);
  sim900_send_cmd("ATD");
  sim900_send_cmd(number);
  sim900_send_cmd(";\r\n");
  return true;
}
开发者ID:amperka,项目名称:gprs-shield,代码行数:11,代码来源:GPRS_Shield_Arduino.cpp


示例15: init

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;
}
开发者ID:Seeed-Studio,项目名称:GPRS_SIM900,代码行数:21,代码来源:GPRS_Shield_Arduino.cpp


示例16: delay

bool GPRS::sendSMS(char *number, char *data)
{
    //char cmd[32];
    if(!sim900_check_with_cmd("AT+CMGF=1\r\n", "OK\r\n", CMD)) { // Set message mode to ASCII
        return false;
    }
    delay(500);
	sim900_send_cmd("AT+CMGS=\"");
	sim900_send_cmd(number);
    //sprintf(cmd,"AT+CMGS=\"%s\"\r\n", number);
	//snprintf(cmd, sizeof(cmd),"AT+CMGS=\"%s\"\r\n", number);
//    if(!sim900_check_with_cmd(cmd,">",CMD)) {
    if(!sim900_check_with_cmd("\"\r\n",">",CMD)) {
        return false;
    }
    delay(1000);
    sim900_send_cmd(data);
    delay(500);
    sim900_send_End_Mark();
    return true;
}
开发者ID:yavuzoguzipek,项目名称:HapticNavigationDevice,代码行数:21,代码来源:GPRS_Shield_Arduino.cpp


示例17: delay

bool GPRS::sendSMS(char *number, char *data)
{
  // Set message mode to ASCII
  if(!sim900_check_with_cmd("AT+CMGF=1\r\n", "OK\r\n", CMD)) {
    return false;
  }

  delay(500);
  sim900_send_cmd("AT+CMGS=\"");
  sim900_send_cmd(number);

  if(!sim900_check_with_cmd("\"\r\n",">",CMD)) {
      return false;
  }

  delay(1000);
  sim900_send_cmd(data);
  delay(500);
  sim900_send_End_Mark();
  return true;
}
开发者ID:amperka,项目名称:gprs-shield,代码行数:21,代码来源:GPRS_Shield_Arduino.cpp


示例18: sim900_check_with_cmd

//Here is where we ask for APN configuration, with F() so we can save MEMORY
bool GPRS::join(const __FlashStringHelper *apn, const __FlashStringHelper *userName, const __FlashStringHelper *passWord)

{
    char cmd[64];
    char ipAddr[32];
    //Select multiple connection
    //sim900_check_with_cmd("AT+CIPMUX=1\r\n","OK",DEFAULT_TIMEOUT,CMD);

    //set APN. OLD VERSION
/*    snprintf(cmd,sizeof(cmd),"AT+CSTT=\"%s\",\"%s\",\"%s\"\r\n",_apn,_userName,_passWord);
    sim900_check_with_cmd(cmd, "OK\r\n", DEFAULT_TIMEOUT,CMD);
*/
    sim900_send_cmd("AT+CSTT=\"");
    sim900_send_cmd(apn);
    sim900_send_cmd("\",\"");
    sim900_send_cmd(userName);
    sim900_send_cmd("\",\"");
    sim900_send_cmd(passWord);
    sim900_check_with_cmd("\"\r\n", "OK\r\n", CMD);
    

    //Brings up wireless connection
    sim900_check_with_cmd("AT+CIICR\r\n","OK\r\n", CMD);

    //Get local IP address
    sim900_send_cmd("AT+CIFSR\r\n");
    sim900_clean_buffer(ipAddr,32);
    sim900_read_buffer(ipAddr,32,2);
//Serial.print("ipAddr: ");
//Serial.println(ipAddr);

    if(NULL != strstr(ipAddr,"AT+CIFSR")) {
        _ip = str_to_ip(ipAddr+12);
        if(_ip != 0) {
            return true;
        }
    }
    return false;
} 
开发者ID:alhabbal,项目名称:GPRS_Shield_Suli,代码行数:40,代码来源:GPRS_Shield_Arduino.cpp


示例19: send

boolean GPRS::send(const char * str)
{
	if(!sim900_check_with_cmd(F("AT+CIPSEND\r\n"),">",CMD)) {
		return false;
	}
	delay(500);
	sim900_send_cmd(str);
	delay(500);
	sim900_send_End_Mark();
	if(!sim900_wait_for_resp("SEND OK\r\n", DATA, DEFAULT_TIMEOUT * 10, DEFAULT_INTERCHAR_TIMEOUT * 10)) {
		return false;
	}   
    return true;
}
开发者ID:Seeed-Studio,项目名称:GPRS_SIM900,代码行数:14,代码来源:GPRS_Shield_Arduino.cpp


示例20: callUp

bool GPRS::callUp(char *number)
{
    //char cmd[24];
    if(!sim900_check_with_cmd("AT+COLP=1\r\n","OK\r\n",CMD)) {
        return false;
    }
    delay(1000);
	//HACERR quitar SPRINTF para ahorar memoria ???
    //sprintf(cmd,"ATD%s;\r\n", number);
    //sim900_send_cmd(cmd);
	sim900_send_cmd("ATD");
	sim900_send_cmd(number);
	sim900_send_cmd(";\r\n");
    return true;
}
开发者ID:Yurysamara,项目名称:smart_power31,代码行数:15,代码来源:GPRS_Shield_Arduino.cpp



注:本文中的sim900_check_with_cmd函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sim900_send_cmd函数代码示例发布时间:2022-05-30
下一篇:
C++ sim3pulse函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap