当前位置: 首页>>代码示例>>C++>>正文


C++ SIMCOM900类代码示例

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


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

示例1: SimpleWriteln

 int SIMCOM900::readCellData(int &mcc, int &mnc, long &lac, long &cellid)
{
  if (getStatus()==IDLE)
    return 0;
    
   //_tf.setTimeout(_GSM_DATA_TOUT_);
   //_cell.flush();
  SimpleWriteln(F("AT+QENG=1,0")); 
  SimpleWriteln(F("AT+QENG?")); 
  if(gsm.WaitResp(5000, 50, "+QENG")!=RX_FINISHED_STR_NOT_RECV)
    return 0;

  //mcc=_tf.getValue(); // The first one is 0
  mcc=_cell.read();
  //mcc=_tf.getValue();
  mcc=_cell.read();
  //mnc=_tf.getValue();
  mnc=_cell.read();
  //lac=_tf.getValue();
  lac=_cell.read();
  //cellid=_tf.getValue();
  cellid=_cell.read();
  
  gsm.WaitResp(5000, 50, "+OK");
  SimpleWriteln(F("AT+QENG=1,0")); 
  gsm.WaitResp(5000, 50, "+OK");
  return 1;
}
开发者ID:DwaineGarden,项目名称:Davis-Weather-Station-GSM-Code,代码行数:28,代码来源:SIM900.cpp

示例2: SimpleWriteln

int SIMCOM900::configandwait(char* pin)
{
     int connCode;
     //_tf.setTimeout(_GSM_CONNECTION_TOUT_);

     if(pin) setPIN(pin); //syv

     // Try 10 times to register in the network. Note this can take some time!
     for(int i=0; i<10; i++) {
          //Ask for register status to GPRS network.
          SimpleWriteln(F("AT+CGREG?"));

          //Se espera la unsolicited response de registered to network.
          while(gsm.WaitResp(5000, 50, "+CGREG: 0,")!=RX_FINISHED_STR_RECV)
               //while (_tf.find("+CGREG: 0,"))  // CHANGE!!!!
          {
               //connCode=_tf.getValue();
               connCode=_cell.read();
               if((connCode==1)||(connCode==5)) {
                    setStatus(READY);

                    SimpleWriteln(F("AT+CMGF=1")); //SMS text mode.
                    delay(200);
                    // Buah, we should take this to readCall()
                    SimpleWriteln(F("AT+CLIP=1")); //SMS text mode.
                    delay(200);
                    //_cell << "AT+QIDEACT" <<  _DEC(cr) << endl; //To make sure not pending connection.
                    //delay(1000);

                    return 1;
               }
          }
     }
     return 0;
}
开发者ID:Adrenalinism,项目名称:Microduino-IDE,代码行数:35,代码来源:SIM900.cpp

示例3:

int SIMCOM900::read(char* result, int resultlength)
{
	char temp;
	int i=0;
	for(i=0; i<resultlength;i++){
		temp=gsm.read();
		if(temp>0){
			Serial.print(temp);
			result[i]=temp;
		}
	}
  return i;
}
开发者ID:DwaineGarden,项目名称:Davis-Weather-Station-GSM-Code,代码行数:13,代码来源:SIM900.cpp

示例4: while

/**
 * SIMCOM900::read(char* buffer, int buffersize)
 *
 * Waits for data to be readable from the gsm module, reads data until
 * no more is available or the buffer has been filled
 *
 * returns number of bytes read
 *
 */
int SIMCOM900::read(char* result, int resultlength)
{
     char temp;
     int i=0;

#ifdef DEBUG_ON
     Serial.print(F("Starting read..\nWaiting for Data.."));
#endif
     // Wait until we start receiving data
     while(gsm.available()<1) {
          delay(100);
#ifdef DEBUG_ON
          Serial.print(F("."));
#endif
     }

     while(gsm.available()>0 && i<(resultlength-1)) {
          temp=_cell.read();
          if(temp>0) {
#ifdef DEBUG_ON
               Serial.print(temp);
#endif
               result[i]=temp;
               i++;
          }
          delay(1);
     }

     // Terminate the string
     result[resultlength-1]='\0';

#ifdef DEBUG_ON
     Serial.println(F("\nDone.."));
#endif
     return i;
}
开发者ID:Adrenalinism,项目名称:Microduino-IDE,代码行数:45,代码来源:SIM900.cpp

示例5: SimpleWrite

int SIMCOM900::changeNSIPmode(char mode)
{
    //_tf.setTimeout(_TCP_CONNECTION_TOUT_);
    
    //if (getStatus()!=ATTACHED)
    //    return 0;

    //_cell.flush();

    SimpleWrite(F("AT+QIDNSIP="));
	SimpleWriteln(mode);
	if(gsm.WaitResp(5000, 50, "OK")!=RX_FINISHED_STR_NOT_RECV) return 0;
    //if(!_tf.find("OK")) return 0;
    
    return 1;
}
开发者ID:DwaineGarden,项目名称:Davis-Weather-Station-GSM-Code,代码行数:16,代码来源:SIM900.cpp

示例6: WaitResp

boolean SIMCOM900::readSMS(char* msg, int msglength, char* number, int nlength)
{
  Serial.println(F("This method is deprecated! Please use GetSMS in the SMS class."));
  long index;
  char *p_char; 
  char *p_char1;

  /*
  if (getStatus()==IDLE)
    return false;
  */
  #ifdef UNO
	_tf.setTimeout(_GSM_DATA_TOUT_);
  #endif
  //_cell.flush();
  WaitResp(500, 500);
  SimpleWriteln(F("AT+CMGL=\"REC UNREAD\",1"));

  WaitResp(5000, 500);
  if(gsm.IsStringReceived("+CMGL")) 
  {
	
	//index
	p_char = strchr((char *)(gsm.comm_buf),'+CMGL');
	p_char1 = p_char+3;  //we are on the first char of string
	p_char = p_char1+1;
          *p_char = 0; 
	index=atoi(p_char1);
	
	p_char1 = p_char+1;
	p_char = strstr((char *)(p_char1), "\",\"");
	p_char1 = p_char+3;
	p_char = strstr((char *)(p_char1), "\",\"");
	if (p_char != NULL) {
          *p_char = 0; 
    }	
	strcpy(number, (char *)(p_char1));
	//////
	
	p_char1 = p_char+3;
	p_char = strstr((char *)(p_char1), "\",\"");
	p_char1 = p_char+3;
	
	p_char = strstr((char *)(p_char1), "\n");
	p_char1 = p_char+1;
	p_char = strstr((char *)(p_char1), "\n");
	if (p_char != NULL) {
          *p_char = 0; 
    }	
	strcpy(msg, (char *)(p_char1));	

	// #ifdef UNO
		// index=_tf.getValue();
	// #endif
	// #ifdef MEGA
	//index=_cell.read();
	// #endif
	// Serial.println("DEBUG");
	// #ifdef UNO
		// _tf.getString("\",\"", "\"", number, nlength);
	// #endif
	// Serial.println("PRIMA");
	// #ifdef MEGA
		// _cell.getString("\",\"", "\"", number, nlength);
	// #endif
	// Serial.println("DEBUG");
	// #ifdef UNO
		// _tf.getString("\n", "\nOK", msg, msglength);
	// #endif
	// #ifdef MEGA
		// _cell.getString("\n", "\nOK", msg, msglength);
	// #endif
	
    SimpleWrite(F("AT+CMGD="));
	SimpleWriteln(index);
	// Serial.print("VAL= ");
	// Serial.println(index);
    gsm.WaitResp(5000, 50, "OK"); 
    return true;
  };
  return false;
};
开发者ID:danielchen76,项目名称:GSMSHIELD,代码行数:82,代码来源:SIM900.cpp


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