Skip to content

Commit

Permalink
Merge pull request #9 from cristiansteib/devoloping
Browse files Browse the repository at this point in the history
Devoloping
  • Loading branch information
cristiansteib committed Apr 29, 2016
2 parents cb057a9 + 5c9834b commit 8de01bd
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,28 @@ Arduino Uno | Sim800l | Notes
GND | GND |


## Methods and functions

Name|Return|Notes
:-------|:-------:|:-----------------------------------------------:|
begin()|None|Initialize the library
reset()|None|Reset the module,and wait to Sms Ready.
sendSms(number,text)|true or false|parameters must be Strings.
readSms(index)|String|index is the position of the sms in the prefered memory storage
getNumberSms(index)|String|returns the number of the sms.
delAllSms()|true or false|Delete all sms
answerCall()|true or false|
callNumber(number)|None|
hangoffCall()|true or false|
getCallStatus()|uint8_t|Return the call status, 0=ready,2=Unknown(),3=Ringing,4=Call in progress
setPhoneFunctionality()|None|Set at to full functionality
activateBearerProfile()|None|
deactivateBearerProfile()|None|
RTCtime(int *day,int *month, int *year,int *hour,int *minute, int *second)|None| Parameters must be reference ex: &day
dateNet()|String|Return date time GSM
updateRtc(utc)|true or false|Return if the rtc was update with date time GSM.
____________________________________________________________________________________

You can regulate the voltage to the desired with this, is not the best,
but for start it's easy.

Expand Down
22 changes: 16 additions & 6 deletions Sim800l.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void Sim800l::begin(){
#if (LED)
pinMode(OUTPUT,LED_PIN);
#endif
_buffer.reserve(120); //reserve memory to prevent intern fragmention
_buffer.reserve(255); //reserve memory to prevent intern fragmention
}


Expand Down Expand Up @@ -209,9 +209,15 @@ bool Sim800l::sendSms(char* number,char* text){

String Sim800l::getNumberSms(uint8_t index){
_buffer=readSms(index);
int _idx1=_buffer.indexOf("+CMGR:");
_idx1=_buffer.indexOf("\",\"",_idx1+1);
return _buffer.substring(_idx1+3,_buffer.indexOf("\",\"",_idx1+4));
Serial.println(_buffer.length());
if (_buffer.length() > 10) //avoid empty sms
{
uint8_t _idx1=_buffer.indexOf("+CMGR:");
_idx1=_buffer.indexOf("\",\"",_idx1+1);
return _buffer.substring(_idx1+3,_buffer.indexOf("\",\"",_idx1+4));
}else{
return "";
}
}


Expand All @@ -222,8 +228,12 @@ String Sim800l::readSms(uint8_t index){
SIM.print (F("AT+CMGR="));
SIM.print (index);
SIM.print("\r");
return _readSerial();
}
_buffer=_readSerial();
if (_buffer.indexOf("CMGR:")!=-1){
return _buffer;
}
else return "";
}
else
return "";
}
Expand Down
1 change: 1 addition & 0 deletions examples/readSmsAndFilterNumber/readSmsAndFIlterNumber.ino
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,5 @@ void loop(){


}
}

0 comments on commit 8de01bd

Please sign in to comment.