Adafruit FONA Arduino Library
|
#include <Adafruit_FONA.h>
Public Member Functions | |
Adafruit_FONA (int8_t r) | |
Construct a new Adafruit_FONA object. More... | |
bool | begin (FONAStreamType &port) |
Connect to the cell module. More... | |
uint8_t | type () |
Get the module type. More... | |
int | available (void) |
Serial data available. More... | |
size_t | write (uint8_t x) |
Serial write. More... | |
int | read (void) |
Serial read. More... | |
int | peek (void) |
Serial peek. More... | |
void | flush () |
Flush the serial data. | |
bool | setBaudrate (uint16_t baud) |
Set the baud rate that the module will use. More... | |
bool | enableRTC (uint8_t mode) |
Enable the Real Time Clock. More... | |
bool | readRTC (uint8_t *year, uint8_t *month, uint8_t *day, uint8_t *hr, uint8_t *min, uint8_t *sec) |
Read the Real Time Clock. More... | |
bool | getADCVoltage (uint16_t *v) |
Get the current ADC voltage. More... | |
bool | getBattPercent (uint16_t *p) |
Get the percentage charge of battery as reported by sim800. More... | |
bool | getBattVoltage (uint16_t *v) |
Get the current batery voltage. More... | |
uint8_t | unlockSIM (char *pin) |
Unlock the sim with a provided PIN. More... | |
uint8_t | getSIMCCID (char *ccid) |
Get the SIM CCID. More... | |
uint8_t | getNetworkStatus (void) |
Gets the current network status. More... | |
uint8_t | getRSSI (void) |
get the current Received Signal Strength Indication More... | |
uint8_t | getIMEI (char *imei) |
Get the IMEI. More... | |
bool | setAudio (uint8_t audio_output) |
Set the audio ouput. More... | |
bool | setVolume (uint8_t volume_level) |
Set the volume. More... | |
uint8_t | getVolume (void) |
Get the current volume level. More... | |
bool | playToolkitTone (uint8_t t, uint16_t len) |
Play a toolkit tone. More... | |
bool | setMicVolume (uint8_t a, uint8_t level) |
Set the microphone gain. More... | |
bool | playDTMF (char tone) |
Play a DTMF/Key tone. More... | |
bool | tuneFMradio (uint16_t station) |
Set the FM Radio station. More... | |
bool | FMradio (bool onoff, uint8_t a=FONA_HEADSETAUDIO) |
Turn the FM Radio on or off. More... | |
bool | setFMVolume (uint8_t i) |
Set the FM Radio Volume. More... | |
int8_t | getFMVolume (void) |
Get the current volume level. More... | |
int8_t | getFMSignalLevel (uint16_t station) |
Gets the current FM signal level. More... | |
bool | setSMSInterrupt (uint8_t i) |
Attach an interrupt for SMS notifications. More... | |
uint8_t | getSMSInterrupt (void) |
Get the current SMS Iterrupt. More... | |
int8_t | getNumSMS (void) |
Get the number of SMS. More... | |
bool | readSMS (uint8_t message_index, char *smsbuff, uint16_t max, uint16_t *readsize) |
Read an SMS message into a provided buffer. More... | |
bool | sendSMS (char *smsaddr, char *smsmsg) |
Send an SMS Message from a buffer provided. More... | |
bool | deleteSMS (uint8_t message_index) |
Delete an SMS Message. More... | |
bool | getSMSSender (uint8_t message_index, char *sender, int senderlen) |
Retrieve the sender of the specified SMS message and copy it as a string to the sender buffer. Up to senderlen characters of the sender will be copied and a null terminator will be added if less than senderlen characters are copied to the result. More... | |
bool | sendUSSD (char *ussdmsg, char *ussdbuff, uint16_t maxlen, uint16_t *readlen) |
Send USSD. More... | |
bool | enableNetworkTimeSync (bool onoff) |
Enable network time sync. More... | |
bool | enableNTPTimeSync (bool onoff, FONAFlashStringPtr ntpserver=0) |
Enable NTP time sync. More... | |
bool | getTime (char *time_buffer, uint16_t maxlen) |
Get the current time. More... | |
bool | enableGPRS (bool onoff) |
Enable GPRS. More... | |
uint8_t | GPRSstate (void) |
Get the GPRS state. More... | |
bool | getGSMLoc (uint16_t *replycode, char *buff, uint16_t maxlen) |
Get GSM location. More... | |
bool | getGSMLoc (float *lat, float *lon) |
Get GSM Location. More... | |
void | setGPRSNetworkSettings (FONAFlashStringPtr apn, FONAFlashStringPtr username=0, FONAFlashStringPtr password=0) |
Set the GPRS network settings. More... | |
bool | enableGPS (bool onoff) |
Enable GPS. More... | |
int8_t | GPSstatus (void) |
Get teh GPS status. More... | |
uint8_t | getGPS (uint8_t arg, char *buffer, uint8_t maxbuff) |
Fill a buffer with the current GPS reading. More... | |
bool | getGPS (float *lat, float *lon, float *speed_kph=0, float *heading=0, float *altitude=0) |
Get a GPS reading. More... | |
bool | enableGPSNMEA (uint8_t enable_value) |
Enable GPS NMEA output. More... | |
bool | TCPconnect (char *server, uint16_t port) |
Start a TCP connection. More... | |
bool | TCPclose (void) |
Close the TCP connection. More... | |
bool | TCPconnected (void) |
Check the TCP connection status. More... | |
bool | TCPsend (char *data, uint8_t len) |
Send data via TCP. More... | |
uint16_t | TCPavailable (void) |
Check if TCP bytes are available. More... | |
uint16_t | TCPread (uint8_t *buff, uint8_t len) |
Read from a TCP socket. More... | |
bool | HTTP_init () |
Initialize HTTP. More... | |
bool | HTTP_term () |
Terminate HTTP. More... | |
void | HTTP_para_start (FONAFlashStringPtr parameter, bool quoted=true) |
Start sending an HTTP parameter. More... | |
bool | HTTP_para_end (bool quoted=true) |
Finish sending an HTTP parameter. More... | |
bool | HTTP_para (FONAFlashStringPtr parameter, const char *value) |
Send HTTP parameter. More... | |
bool | HTTP_para (FONAFlashStringPtr parameter, FONAFlashStringPtr value) |
Send HTTP parameter. More... | |
bool | HTTP_para (FONAFlashStringPtr parameter, int32_t value) |
Send HTTP parameter. More... | |
bool | HTTP_data (uint32_t size, uint32_t maxTime=10000) |
Begin sending data via HTTP. More... | |
bool | HTTP_action (uint8_t method, uint16_t *status, uint16_t *datalen, int32_t timeout=10000) |
Make an HTTP Request. More... | |
bool | HTTP_readall (uint16_t *datalen) |
Read all available HTTP data. More... | |
bool | HTTP_ssl (bool onoff) |
Enable or disable SSL. More... | |
bool | HTTP_GET_start (char *url, uint16_t *status, uint16_t *datalen) |
Start a HTTP GET request. More... | |
void | HTTP_GET_end (void) |
End an HTTP GET. | |
bool | HTTP_POST_start (char *url, FONAFlashStringPtr contenttype, const uint8_t *postdata, uint16_t postdatalen, uint16_t *status, uint16_t *datalen) |
Start an HTTP POST request. More... | |
void | HTTP_POST_end (void) |
End an HTTP POST request. | |
void | setUserAgent (FONAFlashStringPtr useragent) |
Set the User Agent for HTTP requests. More... | |
void | setHTTPSRedirect (bool onoff) |
Set the HTTPS redirect flag. More... | |
bool | setPWM (uint16_t period, uint8_t duty=50) |
Set the PWM Period and Duty Cycle. More... | |
bool | callPhone (char *phonenum) |
Call a phone number. More... | |
uint8_t | getCallStatus (void) |
Get the current call status. More... | |
bool | hangUp (void) |
End the current call. More... | |
bool | pickUp (void) |
Answer a call. More... | |
bool | callerIdNotification (bool enable, uint8_t interrupt=0) |
Enable or disable caller ID. More... | |
bool | incomingCallNumber (char *phonenum) |
Get the number of the incoming call. More... | |
bool | expectReply (FONAFlashStringPtr reply, uint16_t timeout=10000) |
Check if the received reply matches the expectation. More... | |
bool | sendCheckReply (char *send, char *reply, uint16_t timeout=FONA_DEFAULT_TIMEOUT_MS) |
Send data and verify the response matches an expected response. More... | |
bool | sendCheckReply (FONAFlashStringPtr send, FONAFlashStringPtr reply, uint16_t timeout=FONA_DEFAULT_TIMEOUT_MS) |
Send data and verify the response matches an expected response. More... | |
bool | sendCheckReply (char *send, FONAFlashStringPtr reply, uint16_t timeout=FONA_DEFAULT_TIMEOUT_MS) |
Send data and verify the response matches an expected response. More... | |
Protected Member Functions | |
bool | HTTP_setup (char *url) |
Configure an HTTP request. More... | |
void | flushInput () |
Read all available serial input to flush pending data. | |
uint16_t | readRaw (uint16_t read_length) |
Read directly into the reply buffer. More... | |
uint8_t | readline (uint16_t timeout=FONA_DEFAULT_TIMEOUT_MS, bool multiline=false) |
Read a single line or up to 254 bytes. More... | |
uint8_t | getReply (char *send, uint16_t timeout=FONA_DEFAULT_TIMEOUT_MS) |
Send a command and return the reply. More... | |
uint8_t | getReply (FONAFlashStringPtr send, uint16_t timeout=FONA_DEFAULT_TIMEOUT_MS) |
Send a command and return the reply. More... | |
uint8_t | getReply (FONAFlashStringPtr prefix, char *suffix, uint16_t timeout=FONA_DEFAULT_TIMEOUT_MS) |
Send a command as prefix and suffix. More... | |
uint8_t | getReply (FONAFlashStringPtr prefix, int32_t suffix, uint16_t timeout=FONA_DEFAULT_TIMEOUT_MS) |
Send a command with. More... | |
uint8_t | getReply (FONAFlashStringPtr prefix, int32_t suffix1, int32_t suffix2, uint16_t timeout) |
Send command with prefix and two suffixes. More... | |
uint8_t | getReplyQuoted (FONAFlashStringPtr prefix, FONAFlashStringPtr suffix, uint16_t timeout=FONA_DEFAULT_TIMEOUT_MS) |
Send command prefix and suffix, returning the response length. More... | |
bool | sendCheckReply (FONAFlashStringPtr prefix, char *suffix, FONAFlashStringPtr reply, uint16_t timeout=FONA_DEFAULT_TIMEOUT_MS) |
Send data and verify the response matches an expected response. More... | |
bool | sendCheckReply (FONAFlashStringPtr prefix, int32_t suffix, FONAFlashStringPtr reply, uint16_t timeout=FONA_DEFAULT_TIMEOUT_MS) |
Send data and verify the response matches an expected response. More... | |
bool | sendCheckReply (FONAFlashStringPtr prefix, int32_t suffix, int32_t suffix2, FONAFlashStringPtr reply, uint16_t timeout=FONA_DEFAULT_TIMEOUT_MS) |
Send data and verify the response matches an expected response. More... | |
bool | sendCheckReplyQuoted (FONAFlashStringPtr prefix, FONAFlashStringPtr suffix, FONAFlashStringPtr reply, uint16_t timeout=FONA_DEFAULT_TIMEOUT_MS) |
Send data and verify the response matches an expected response. More... | |
bool | parseReply (FONAFlashStringPtr toreply, uint16_t *v, char divider=',', uint8_t index=0) |
Parse a string in the response fields using a designated separator and copy the value at the specified index in to the supplied buffer. More... | |
bool | parseReply (FONAFlashStringPtr toreply, char *v, char divider=',', uint8_t index=0) |
Parse a string in the response fields using a designated separator and copy the string at the specified index in to the supplied char buffer. More... | |
bool | parseReplyQuoted (FONAFlashStringPtr toreply, char *v, int maxlen, char divider, uint8_t index) |
Parse a string in the response fields using a designated separator and copy the string (without quotes) at the specified index in to the supplied char buffer. More... | |
bool | sendParseReply (FONAFlashStringPtr tosend, FONAFlashStringPtr toreply, uint16_t *v, char divider=',', uint8_t index=0) |
Send data and parse the reply. More... | |
Static Protected Member Functions | |
static void | onIncomingCall () |
On incoming call callback. | |
Protected Attributes | |
int8_t | _rstpin |
Reset pin. | |
uint8_t | _type |
Module type. | |
char | replybuffer [255] |
buffer for holding replies from the module | |
FONAFlashStringPtr | apn |
Access point name. | |
FONAFlashStringPtr | apnusername |
Access point username. | |
FONAFlashStringPtr | apnpassword |
Access point password. | |
bool | httpsredirect |
HTTPS redirect state. | |
FONAFlashStringPtr | useragent |
User agent used when making requests. | |
FONAFlashStringPtr | ok_reply |
OK reply for successful requests. | |
FONAStreamType * | mySerial |
Serial connection. | |
Static Protected Attributes | |
static bool | _incomingCall = false |
Incoming call state var. | |
Object that controls and keeps state for the FONA module.
Adafruit_FONA::Adafruit_FONA | ( | int8_t | rst | ) |
Construct a new Adafruit_FONA object.
rst | The reset pin |
bool Adafruit_FONA::begin | ( | FONAStreamType & | port | ) |
Connect to the cell module.
port | the serial connection to use to connect |
uint8_t Adafruit_FONA::type | ( | void | ) |
Get the module type.
|
inline |
Serial data available.
|
inline |
Serial write.
x |
|
inline |
Serial read.
|
inline |
Serial peek.
bool Adafruit_FONA::setBaudrate | ( | uint16_t | baud | ) |
Set the baud rate that the module will use.
baud | The new baud rate to set |
bool Adafruit_FONA::enableRTC | ( | uint8_t | mode | ) |
Enable the Real Time Clock.
mode | 1: Enable 0: Disable |
bool Adafruit_FONA::readRTC | ( | uint8_t * | year, |
uint8_t * | month, | ||
uint8_t * | day, | ||
uint8_t * | hr, | ||
uint8_t * | min, | ||
uint8_t * | sec | ||
) |
Read the Real Time Clock.
NOTE Currently this function will only fill the 'year' variable
year | Pointer to a uint8_t to be set with year data |
month | Pointer to a uint8_t to be set with month data NOT WORKING |
day | Pointer to a uint8_t to be set with day data NOT WORKING |
hr | Pointer to a uint8_t to be set with hour data NOT WORKING |
min | Pointer to a uint8_t to be set with minute data NOT WORKING |
sec | Pointer to a uint8_t to be set with year data NOT WORKING |
bool Adafruit_FONA::getADCVoltage | ( | uint16_t * | v | ) |
Get the current ADC voltage.
v | Ponter to a uint16_t to set with the ADC voltage |
bool Adafruit_FONA::getBattPercent | ( | uint16_t * | p | ) |
Get the percentage charge of battery as reported by sim800.
p | Ponter to a uint16_t to set with the battery change as a percentage |
bool Adafruit_FONA::getBattVoltage | ( | uint16_t * | v | ) |
Get the current batery voltage.
v | battery value pointer to be filled with the current value in mV (uint16_t) |
uint8_t Adafruit_FONA::unlockSIM | ( | char * | pin | ) |
Unlock the sim with a provided PIN.
pin | Pointer to a buffer with the PIN to use to unlock the SIM |
uint8_t Adafruit_FONA::getSIMCCID | ( | char * | ccid | ) |
Get the SIM CCID.
ccid | Pointer to a buffer to be filled with the CCID |
uint8_t Adafruit_FONA::getNetworkStatus | ( | void | ) |
Gets the current network status.
uint8_t Adafruit_FONA::getRSSI | ( | void | ) |
get the current Received Signal Strength Indication
uint8_t Adafruit_FONA::getIMEI | ( | char * | imei | ) |
Get the IMEI.
imei | Pointer to a buffer to be filled with the IMEI |
bool Adafruit_FONA::setAudio | ( | uint8_t | audio_output | ) |
Set the audio ouput.
audio_output | The output to set.
|
bool Adafruit_FONA::setVolume | ( | uint8_t | volume_level | ) |
Set the volume.
volume_level | The new volume to set |
uint8_t Adafruit_FONA::getVolume | ( | void | ) |
Get the current volume level.
bool Adafruit_FONA::playToolkitTone | ( | uint8_t | t, |
uint16_t | len | ||
) |
Play a toolkit tone.
t | The tone to play |
len | The tone length |
bool Adafruit_FONA::setMicVolume | ( | uint8_t | a, |
uint8_t | level | ||
) |
Set the microphone gain.
a | Which microphone gain to set.
|
level | The new gain level |
bool Adafruit_FONA::playDTMF | ( | char | dtmf | ) |
Play a DTMF/Key tone.
dtmf | The tone to play |
bool Adafruit_FONA::tuneFMradio | ( | uint16_t | station | ) |
Set the FM Radio station.
station | The station to set the radio to |
bool Adafruit_FONA::FMradio | ( | bool | onoff, |
uint8_t | a = FONA_HEADSETAUDIO |
||
) |
Turn the FM Radio on or off.
onoff | true; on false: off |
a | The audio source to use:
|
bool Adafruit_FONA::setFMVolume | ( | uint8_t | i | ) |
Set the FM Radio Volume.
i | The volume to set |
int8_t Adafruit_FONA::getFMVolume | ( | void | ) |
Get the current volume level.
int8_t Adafruit_FONA::getFMSignalLevel | ( | uint16_t | station | ) |
Gets the current FM signal level.
station | The station to chek the signal level of |
bool Adafruit_FONA::setSMSInterrupt | ( | uint8_t | i | ) |
Attach an interrupt for SMS notifications.
i | The interrupt to set |
uint8_t Adafruit_FONA::getSMSInterrupt | ( | void | ) |
Get the current SMS Iterrupt.
int8_t Adafruit_FONA::getNumSMS | ( | void | ) |
Get the number of SMS.
bool Adafruit_FONA::readSMS | ( | uint8_t | message_index, |
char * | smsbuff, | ||
uint16_t | maxlen, | ||
uint16_t * | readlen | ||
) |
Read an SMS message into a provided buffer.
message_index | The SMS message index to retrieve |
smsbuff | SMS message buffer |
maxlen | The maximum read length |
readlen | The length read |
bool Adafruit_FONA::sendSMS | ( | char * | smsaddr, |
char * | smsmsg | ||
) |
Send an SMS Message from a buffer provided.
smsaddr | The SMS address buffer |
smsmsg | The SMS message buffer |
bool Adafruit_FONA::deleteSMS | ( | uint8_t | message_index | ) |
Delete an SMS Message.
message_index | The message to delete |
bool Adafruit_FONA::getSMSSender | ( | uint8_t | message_index, |
char * | sender, | ||
int | senderlen | ||
) |
Retrieve the sender of the specified SMS message and copy it as a string to the sender buffer. Up to senderlen characters of the sender will be copied and a null terminator will be added if less than senderlen characters are copied to the result.
message_index | The SMS message index to retrieve the sender for |
sender | Pointer to a buffer to fill with the sender |
senderlen | The maximum length to read |
bool Adafruit_FONA::sendUSSD | ( | char * | ussdmsg, |
char * | ussdbuff, | ||
uint16_t | maxlen, | ||
uint16_t * | readlen | ||
) |
Send USSD.
ussdmsg | The USSD message buffer |
ussdbuff | The USSD bufer |
maxlen | The maximum read length |
readlen | The length actually read |
bool Adafruit_FONA::enableNetworkTimeSync | ( | bool | onoff | ) |
Enable network time sync.
onoff | true: enable false: disable |
bool Adafruit_FONA::enableNTPTimeSync | ( | bool | onoff, |
FONAFlashStringPtr | ntpserver = 0 |
||
) |
Enable NTP time sync.
onoff | true: enable false: disable |
ntpserver | The NTP server buffer |
bool Adafruit_FONA::getTime | ( | char * | time_buffer, |
uint16_t | maxlen | ||
) |
Get the current time.
time_buffer | Pointer to a buffer to hold the time |
maxlen | maximum read length |
bool Adafruit_FONA::enableGPRS | ( | bool | onoff | ) |
Enable GPRS.
onoff | true: enable false: disable |
uint8_t Adafruit_FONA::GPRSstate | ( | void | ) |
Get the GPRS state.
bool Adafruit_FONA::getGSMLoc | ( | uint16_t * | errorcode, |
char * | buff, | ||
uint16_t | maxlen | ||
) |
Get GSM location.
errorcode | Pointer to a uint16_t to hold any resulting error code |
buff | Pointer to a buffer to hold the location |
maxlen | maximum read length |
bool Adafruit_FONA::getGSMLoc | ( | float * | lat, |
float * | lon | ||
) |
Get GSM Location.
lat | Pointer to a buffer to hold the latitude |
lon | Pointer to a buffer to hold the longitude |
void Adafruit_FONA::setGPRSNetworkSettings | ( | FONAFlashStringPtr | apn, |
FONAFlashStringPtr | username = 0 , |
||
FONAFlashStringPtr | password = 0 |
||
) |
Set the GPRS network settings.
apn | Pointer to the Access point name buffer |
username | Pointer to the Username buffer |
password | Pointer to the Password buffer |
bool Adafruit_FONA::enableGPS | ( | bool | onoff | ) |
Enable GPS.
onoff | true: enable false: disable |
int8_t Adafruit_FONA::GPSstatus | ( | void | ) |
Get teh GPS status.
uint8_t Adafruit_FONA::getGPS | ( | uint8_t | arg, |
char * | buffer, | ||
uint8_t | maxbuff | ||
) |
Fill a buffer with the current GPS reading.
arg | The mode to use, where applicable |
buffer | The buffer to be filled with the reading |
maxbuff | the maximum amound to write into the buffer |
bool Adafruit_FONA::getGPS | ( | float * | lat, |
float * | lon, | ||
float * | speed_kph = 0 , |
||
float * | heading = 0 , |
||
float * | altitude = 0 |
||
) |
Get a GPS reading.
lat | Pointer to a buffer to be filled with thelatitude |
lon | Pointer to a buffer to be filled with the longitude |
speed_kph | Pointer to a buffer to be filled with the speed in kilometers per hour |
heading | Pointer to a buffer to be filled with the heading |
altitude | Pointer to a buffer to be filled with the altitude |
bool Adafruit_FONA::enableGPSNMEA | ( | uint8_t | enable_value | ) |
Enable GPS NMEA output.
enable_value |
|
bool Adafruit_FONA::TCPconnect | ( | char * | server, |
uint16_t | port | ||
) |
Start a TCP connection.
server | Pointer to a buffer with the server to connect to |
port | Pointer to a buffer witht the port to connect to |
bool Adafruit_FONA::TCPclose | ( | void | ) |
Close the TCP connection.
bool Adafruit_FONA::TCPconnected | ( | void | ) |
Check the TCP connection status.
bool Adafruit_FONA::TCPsend | ( | char * | data, |
uint8_t | len | ||
) |
Send data via TCP.
data | Pointer to a buffer with the data to send |
len | length of the data to send |
uint16_t Adafruit_FONA::TCPavailable | ( | void | ) |
Check if TCP bytes are available.
uint16_t Adafruit_FONA::TCPread | ( | uint8_t * | buff, |
uint8_t | len | ||
) |
Read from a TCP socket.
buff | Pointer to a buffer to read into |
len | The number of bytes to read |
bool Adafruit_FONA::HTTP_init | ( | ) |
Initialize HTTP.
bool Adafruit_FONA::HTTP_term | ( | ) |
Terminate HTTP.
void Adafruit_FONA::HTTP_para_start | ( | FONAFlashStringPtr | parameter, |
bool | quoted = true |
||
) |
Start sending an HTTP parameter.
parameter | Pointer to a buffer with the parameter to send |
quoted | true if the parameter should be quoted |
bool Adafruit_FONA::HTTP_para_end | ( | bool | quoted = true | ) |
Finish sending an HTTP parameter.
quoted | true if the parameter should be quoted |
bool Adafruit_FONA::HTTP_para | ( | FONAFlashStringPtr | parameter, |
const char * | value | ||
) |
Send HTTP parameter.
parameter | Pointer to a buffer with the parameter to send |
value | Pointer to a buffer with the parameter value |
bool Adafruit_FONA::HTTP_para | ( | FONAFlashStringPtr | parameter, |
FONAFlashStringPtr | value | ||
) |
Send HTTP parameter.
parameter | Pointer to a buffer with the parameter to send |
value | Pointer to a buffer with the parameter value |
bool Adafruit_FONA::HTTP_para | ( | FONAFlashStringPtr | parameter, |
int32_t | value | ||
) |
Send HTTP parameter.
parameter | Pointer to a buffer with the parameter to send |
value | The parameter value |
bool Adafruit_FONA::HTTP_data | ( | uint32_t | size, |
uint32_t | maxTime = 10000 |
||
) |
Begin sending data via HTTP.
size | The amount of data to be sent in bytes |
maxTime | The maximum amount of time in which to send the data, in milliseconds |
bool Adafruit_FONA::HTTP_action | ( | uint8_t | method, |
uint16_t * | status, | ||
uint16_t * | datalen, | ||
int32_t | timeout = 10000 |
||
) |
Make an HTTP Request.
method | The request method:
|
status | Pointer to a uint16_t to hold the request status as an RFC2616 HTTP response code: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes |
datalen | Pointer to the a uint16_t to hold the length of the data read |
timeout | Timeout for waiting for response |
bool Adafruit_FONA::HTTP_readall | ( | uint16_t * | datalen | ) |
Read all available HTTP data.
datalen | Pointer to the a uint16_t to hold the length of the data read |
bool Adafruit_FONA::HTTP_ssl | ( | bool | onoff | ) |
Enable or disable SSL.
onoff | true: enable false: disable |
bool Adafruit_FONA::HTTP_GET_start | ( | char * | url, |
uint16_t * | status, | ||
uint16_t * | datalen | ||
) |
Start a HTTP GET request.
url | Pointer to a buffer with the URL to request |
status | Pointer to a uint16_t to hold the request status as an RFC2616 HTTP response code: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes |
datalen | Pointer to the a uint16_t to hold the length of the data read |
bool Adafruit_FONA::HTTP_POST_start | ( | char * | url, |
FONAFlashStringPtr | contenttype, | ||
const uint8_t * | postdata, | ||
uint16_t | postdatalen, | ||
uint16_t * | status, | ||
uint16_t * | datalen | ||
) |
Start an HTTP POST request.
url | Pointer to a buffer with the URL to POST |
contenttype | The message content type |
postdata | Pointer to a buffer with the POST data to be sent |
postdatalen | The length of the POST data |
status | Pointer to a uint16_t to hold the request status as an RFC2616 HTTP response code: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes |
datalen |
void Adafruit_FONA::setUserAgent | ( | FONAFlashStringPtr | useragent | ) |
Set the User Agent for HTTP requests.
useragent | Pointer to a buffer with the user agent string to set |
void Adafruit_FONA::setHTTPSRedirect | ( | bool | onoff | ) |
Set the HTTPS redirect flag.
onoff |
bool Adafruit_FONA::setPWM | ( | uint16_t | period, |
uint8_t | duty = 50 |
||
) |
Set the PWM Period and Duty Cycle.
period | The PWM period |
duty | The PWM duty cycle |
bool Adafruit_FONA::callPhone | ( | char * | number | ) |
Call a phone number.
number | Pointer to a buffer with the phone number to call |
uint8_t Adafruit_FONA::getCallStatus | ( | void | ) |
Get the current call status.
bool Adafruit_FONA::hangUp | ( | void | ) |
End the current call.
bool Adafruit_FONA::pickUp | ( | void | ) |
Answer a call.
bool Adafruit_FONA::callerIdNotification | ( | bool | enable, |
uint8_t | interrupt = 0 |
||
) |
Enable or disable caller ID.
enable | true to enable, false to disable |
interrupt | An optional interrupt to attach |
bool Adafruit_FONA::incomingCallNumber | ( | char * | phonenum | ) |
Get the number of the incoming call.
phonenum | Pointer to a buffer to hold the incoming caller's phone number |
bool Adafruit_FONA::expectReply | ( | FONAFlashStringPtr | reply, |
uint16_t | timeout = 10000 |
||
) |
Check if the received reply matches the expectation.
reply | The expected reply |
timeout | Read timeout |
bool Adafruit_FONA::sendCheckReply | ( | char * | send, |
char * | reply, | ||
uint16_t | timeout = FONA_DEFAULT_TIMEOUT_MS |
||
) |
Send data and verify the response matches an expected response.
send | Pointer to the buffer of data to send |
reply | Buffer with the expected reply |
timeout | Read timeout |
bool Adafruit_FONA::sendCheckReply | ( | FONAFlashStringPtr | send, |
FONAFlashStringPtr | reply, | ||
uint16_t | timeout = FONA_DEFAULT_TIMEOUT_MS |
||
) |
Send data and verify the response matches an expected response.
send | Pointer to the buffer of data to send |
reply | Pointer to a buffer with the expected reply |
timeout | Read timeout |
bool Adafruit_FONA::sendCheckReply | ( | char * | send, |
FONAFlashStringPtr | reply, | ||
uint16_t | timeout = FONA_DEFAULT_TIMEOUT_MS |
||
) |
Send data and verify the response matches an expected response.
send | Pointer to the buffer of data to send |
reply | Pointer to a buffer with the expected reply |
timeout | Read timeout |
|
protected |
Configure an HTTP request.
url | Pointer to a buffer with the URL to POST |
|
protected |
Read directly into the reply buffer.
read_length | The number of bytes to return |
|
protected |
Read a single line or up to 254 bytes.
timeout | Reply timeout |
multiline | true: read the maximum amount. false: read up to the second newline |
|
protected |
Send a command and return the reply.
send | The char* command to send |
timeout | Timeout for reading a response |
|
protected |
Send a command and return the reply.
send | The FONAFlashStringPtr command to send |
timeout | Timeout for reading a response |
|
protected |
Send a command as prefix and suffix.
prefix | Pointer to a buffer with the command prefix |
suffix | Pointer to a buffer with the command suffix |
timeout | Timeout for reading a response |
|
protected |
Send a command with.
prefix | Pointer to a buffer with the command prefix |
suffix | The command suffix |
timeout | Timeout for reading a response |
|
protected |
Send command with prefix and two suffixes.
prefix | Pointer to a buffer with the command prefix |
suffix1 | The comannd first suffix |
suffix2 | The command second suffix |
timeout | Timeout for reading a response |
|
protected |
Send command prefix and suffix, returning the response length.
prefix | Pointer to a buffer with the command prefix |
suffix | Pointer to a buffer with the command suffix |
timeout | Timeout for reading a response |
|
protected |
Send data and verify the response matches an expected response.
prefix | Pointer to a buffer with the prefix send |
suffix | Pointer to a buffer with the suffix send |
reply | Pointer to a buffer with the expected reply |
timeout | Read timeout |
|
protected |
Send data and verify the response matches an expected response.
prefix | Pointer to a buffer with the prefix to send |
suffix | The suffix to send |
reply | Pointer to a buffer with the expected reply |
timeout | Read timeout |
|
protected |
Send data and verify the response matches an expected response.
prefix | Ponter to a buffer with the prefix to send |
suffix1 | The first suffix to send |
suffix2 | The second suffix to send |
reply | Pointer to a buffer with the expected reply |
timeout | Read timeout |
|
protected |
Send data and verify the response matches an expected response.
prefix | Pointer to a buffer with the prefix to send |
suffix | Pointer to a buffer with the suffix to send |
reply | Pointer to a buffer with the expected response |
timeout | Read timeout |
|
protected |
Parse a string in the response fields using a designated separator and copy the value at the specified index in to the supplied buffer.
toreply | Pointer to a buffer with reply with the field being parsed |
v | Pointer to a buffer to fill with the the value from the parsed field |
divider | The divider character |
index | The index of the parsed field to retrieve |
|
protected |
Parse a string in the response fields using a designated separator and copy the string at the specified index in to the supplied char buffer.
toreply | Pointer to a buffer with reply with the field being parsed |
v | Pointer to a buffer to fill with the string |
divider | The divider character |
index | The index of the parsed field to retrieve |
|
protected |
Parse a string in the response fields using a designated separator and copy the string (without quotes) at the specified index in to the supplied char buffer.
toreply | Pointer to a buffer with reply with the field being parsed |
v | Pointer to a buffer to fill with the string. Make sure to supply a buffer large enough to retrieve the expected value |
maxlen | The maximum read length |
divider | The divider character |
index | The index of the parsed field to retrieve |
|
protected |
Send data and parse the reply.
tosend | Pointer to the data buffer to send |
toreply | Pointer to a buffer with the expected reply string |
v | Pointer to a uint16_t buffer to hold the value of the parsed response |
divider | The divider character |
index | The index of the parsed field to retrieve |