Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
BG96 Class Reference
BG96Interface class. More...
#include <BG96.h>
Public Member Functions | |
| BG96 (bool debug=false) | |
| ---------------------------------------------------------- | |
| bool | startup (void) |
| Init the BG96. | |
| void | waitBG96Ready (void) |
| Wait for 'RDY' signal or timeout waiting... | |
| void | reset (void) |
| Reset BG96. | |
| nsapi_error_t | connect (const char *apn, const char *username, const char *password) |
| Connect BG96 to APN. | |
| bool | disconnect (void) |
| Disconnect BG96 from AP. | |
| const char * | getIPAddress (char *) |
| Get the IP address of BG96. | |
| const char * | getMACAddress (char *) |
| Get the MAC address of BG96. | |
| bool | isConnected (void) |
| Check if BG96 is conenected. | |
| bool | open (const char type, int id, const char *addr, int port) |
| Open a socketed connection. | |
| bool | send (int id, const void *data, uint32_t amount) |
| Sends data to an open socket. | |
| int32_t | recv (int, void *, uint32_t) |
| Receives data from an open socket. | |
| bool | close (int id) |
| Closes a socket. | |
| bool | readable () |
| Checks if data is available. | |
| bool | writeable () |
| Checks if data can be written. | |
| bool | resolveUrl (const char *name, char *str) |
| Resolves a URL name to IP address. | |
| int | setContext (int i) |
| ---------------------------------------------------------- | |
| void | doDebug (int f) |
| ---------------------------------------------------------- | |
| const char * | getRev (char *) |
| Return the BG96 revision info. | |
| bool | getError (char *) |
| Return the last error to occur. | |
| int | rxAvail (int) |
| Return the amount a data available. | |
| bool | chkRxAvail (int id) |
| Return true/false if rx data is available. | |
Detailed Description
BG96Interface class.
Interface to a BG96 module.
Definition at line 66 of file BG96.h.
Constructor & Destructor Documentation
| BG96 | ( | bool | debug = false ) |
Member Function Documentation
| bool chkRxAvail | ( | int | id ) |
| bool close | ( | int | id ) |
| nsapi_error_t connect | ( | const char * | apn, |
| const char * | username, | ||
| const char * | password | ||
| ) |
Connect BG96 to APN.
----------------------------------------------------------
- Parameters:
-
apn the name of the APN username (not used) password (not used)
- Returns:
- nsapi_error_t
connect to APN
- Parameters:
-
apn string username (not used) password (not used)
- Return values:
-
nsapi_error_t
| bool disconnect | ( | void | ) |
| void doDebug | ( | int | f ) |
| bool getError | ( | char * | str ) |
| const char * getIPAddress | ( | char * | ipstr ) |
Get the IP address of BG96.
----------------------------------------------------------
- Returns:
- null-teriminated IP address or null if no IP address is assigned
obtain the IP address socket is using
- Parameters:
-
none
- Return values:
-
string containing IP or NULL on failure
| const char * getMACAddress | ( | char * | sn ) |
Get the MAC address of BG96.
----------------------------------------------------------
- Returns:
- null-terminated MAC address or null if no MAC address is assigned
return the MAC
- Parameters:
-
none
- Return values:
-
string containing the MAC or NULL on failure MAC is created using the ICCID of the SIM
| const char * getRev | ( | char * | combined ) |
| bool isConnected | ( | void | ) |
| bool open | ( | const char | type, |
| int | id, | ||
| const char * | addr, | ||
| int | port | ||
| ) |
Open a socketed connection.
----------------------------------------------------------
- Parameters:
-
type the type of socket to open "u" (UDP) or "t" (TCP) id for saving socket number to (returned by BG96) port port to open connection with addr the IP address of the destination
- Returns:
- true only if socket opened successfully
open a BG96 socket
- Parameters:
-
type of socket to open ('u' or 't') id of BG96 socket address (IP) port of the socket
- Return values:
-
true if successful, else false on failure
| bool readable | ( | ) |
| int32_t recv | ( | int | id, |
| void * | data, | ||
| uint32_t | cnt | ||
| ) |
Receives data from an open socket.
----------------------------------------------------------
- Parameters:
-
id to receive from pointer to data for returned information amount number of bytes to be received
- Returns:
- the number of bytes received
receive data from BG96
- Parameters:
-
id of BG96 socket pointer to location to store returned data count of the number of bytes to get
- Return values:
-
number of bytes returned or 0
| void reset | ( | void | ) |
| bool resolveUrl | ( | const char * | name, |
| char * | ipstr | ||
| ) |
| int rxAvail | ( | int | id ) |
| bool send | ( | int | id, |
| const void * | data, | ||
| uint32_t | amount | ||
| ) |
Sends data to an open socket.
----------------------------------------------------------
- Parameters:
-
id of socket to send to data to be sent amount of data to be sent
- Returns:
- true only if data sent successfully
send data to the BG96
- Parameters:
-
id of BG96 socket pointer to the data to send number of bytes to send
- Return values:
-
true if send successfull false otherwise
| int setContext | ( | int | i ) |
| bool startup | ( | void | ) |
| void waitBG96Ready | ( | void | ) |
Wait for 'RDY' signal or timeout waiting...
- Returns:
- none.
Generated on Tue Jul 12 2022 19:02:39 by
1.7.2