program to test exporting mbed-dev
Fork of FONA_CellPhone by
Diff: Adafruit_FONA.h
- Revision:
- 10:9dd3e49dec97
- Parent:
- 9:06eca688f2a3
- Child:
- 15:19a02a88836a
--- a/Adafruit_FONA.h Tue Mar 15 02:09:33 2016 +0000 +++ b/Adafruit_FONA.h Tue Mar 15 02:35:55 2016 +0000 @@ -213,19 +213,47 @@ @param ccid make sure it is at least 21 bytes long @return length of CCID */ + uint8_t getSIMCCID(char *ccid); /** Get the Network Status of FONA @return Code 0-5 - @see - + @see https://www.adafruit.com/datasheets/sim800_series_at_command_manual_v1.01.pdf page 80 */ uint8_t getNetworkStatus(void); + + /** Get the RSSI of the network signal + @return RSSI value in dBm per below reference + + EXAMPLE + @code +// read the RSSI +uint8_t n = fona.getRSSI(); +int8_t r = 0; + +pcSerial.printf("RSSI = %d: ", n); +if (n == 0) r = -115; +if (n == 1) r = -111; +if (n == 31) r = -52; +if ((n >= 2) && (n <= 30)) { + r = map(n, 2, 30, -110, -54); +} +printf("%d dBm\r\n", r); + +// helper function MAP to do calculations +long MAP(long x, long in_min, long in_max, long out_min, long out_max) +{ + return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; +} + @endcode + @see https://www.adafruit.com/datasheets/sim800_series_at_command_manual_v1.01.pdf page 82 + */ uint8_t getRSSI(void); // IMEI---------------------------------------------------------------------- /** Get the International Mobile Station Equipment Identity (IMEI) @param imei A char array with minimum length 16 @return The IMEI of the device + EXAMPLE CODE: @code // Print SIM card IMEI number. @@ -238,7 +266,7 @@ */ uint8_t getIMEI(char *imei); - // set Audio output + // set Audio output---------------------------------------------------------------------- bool setAudio(uint8_t a); bool setVolume(uint8_t i); uint8_t getVolume(void); @@ -246,14 +274,14 @@ bool setMicVolume(uint8_t a, uint8_t level); bool playDTMF(char tone); - // FM radio functions + // FM radio functions---------------------------------------------------------------------- bool tuneFMradio(uint16_t station); bool FMradio(bool onoff, uint8_t a = FONA_HEADSETAUDIO); bool setFMVolume(uint8_t i); int8_t getFMVolume(); int8_t getFMSignalLevel(uint16_t station); - // SMS handling + // SMS handling---------------------------------------------------------------------- bool setSMSInterrupt(uint8_t i); uint8_t getSMSInterrupt(void); int8_t getNumSMS(void); @@ -262,26 +290,26 @@ bool deleteSMS(uint8_t i); bool getSMSSender(uint8_t i, char *sender, int senderlen); - // Time + // Time---------------------------------------------------------------------- bool enableNetworkTimeSync(bool onoff); bool enableNTPTimeSync(bool onoff, const char* ntpserver=0); bool getTime(char* buff, uint16_t maxlen); - // GPRS handling + // GPRS handling---------------------------------------------------------------------- bool enableGPRS(bool onoff); uint8_t GPRSstate(void); bool getGSMLoc(uint16_t *replycode, char *buff, uint16_t maxlen); bool getGSMLoc(float *lat, float *lon); void setGPRSNetworkSettings(const char* apn, const char* username=0, const char* password=0); - // GPS handling + // GPS handling---------------------------------------------------------------------- bool enableGPS(bool onoff); int8_t GPSstatus(void); uint8_t getGPS(uint8_t arg, char *buffer, uint8_t maxbuff); bool getGPS(float *lat, float *lon, float *speed_kph=0, float *heading=0, float *altitude=0); bool enableGPSNMEA(uint8_t nmea); - // TCP raw connections + // TCP raw connections---------------------------------------------------------------------- bool TCPconnect(char *server, uint16_t port); bool TCPclose(void); bool TCPconnected(void); @@ -289,7 +317,7 @@ uint16_t TCPavailable(void); uint16_t TCPread(uint8_t *buff, uint8_t len); - // HTTP low level interface (maps directly to SIM800 commands). + // HTTP low level interface (maps directly to SIM800 commands).---------------------------------------------------------------------- bool HTTP_init(); bool HTTP_term(); void HTTP_para_start(const char* parameter, bool quoted = true); @@ -301,20 +329,20 @@ bool HTTP_readall(uint16_t *datalen); bool HTTP_ssl(bool onoff); - // HTTP high level interface (easier to use, less flexible). + // HTTP high level interface (easier to use, less flexible).---------------------------------------------------------------------- bool HTTP_GET_start(char *url, uint16_t *status, uint16_t *datalen); void HTTP_GET_end(void); bool HTTP_POST_start(char *url, const char* contenttype, const uint8_t *postdata, uint16_t postdatalen, uint16_t *status, uint16_t *datalen); void HTTP_POST_end(void); void setUserAgent(const char* useragent); - // HTTPS + // HTTPS---------------------------------------------------------------------- void setHTTPSRedirect(bool onoff); - // PWM (buzzer) + // PWM (buzzer)---------------------------------------------------------------------- bool setPWM(uint16_t period, uint8_t duty = 50); - // Phone calls + // Phone calls---------------------------------------------------------------------- bool callPhone(char *phonenum); bool hangUp(void); bool pickUp(void);