Members | Descriptions |
---|---|
class ArduinoCellular |
This class provides methods to interact with the Arduino Pro Modem, such as connecting to the network, sending SMS messages, getting GPS location, and more. |
class ModemInterface |
Represents the interface to the 4G modem module which extends the TinyGsmBG96 class. |
class SMS |
Represents an SMS message. |
class Time |
Represents a point in time with year, month, day, hour, minute, second, and offset. |
struct Geolocation |
Represents a geographic location with latitude and longitude coordinates. |
This class provides methods to interact with the Arduino Pro Modem, such as connecting to the network, sending SMS messages, getting GPS location, and more.
Members | Descriptions |
---|---|
ArduinoCellular |
Creates an instance of the ArduinoCellular class. |
begin |
Initializes the modem. This function must be called before using any other functions in the library. |
unlockSIM |
Unlocks the SIM card using the specified PIN. |
connect |
Registers with the cellular network and connects to the Internet if the APN, GPRS username, and GPRS password are provided. |
isConnectedToOperator |
Checks if the modem is registered on the network. |
isConnectedToInternet |
Checks if the GPRS network is connected. |
enableGPS |
Enables or disables the GPS functionality. |
getGPSLocation |
Gets the GPS location. (Blocking call) |
getCellularTime |
Gets the current time from the network. |
getGPSTime |
Gets the current time from the GPS module. |
sendSMS |
Sends an SMS message to the specified number. |
getReadSMS |
Gets the list of read SMS messages. |
getUnreadSMS |
Gets the list of unread SMS messages. |
deleteSMS |
Deletes an SMS message at the specified index. |
sendATCommand |
Sends an AT command to the modem and waits for a response, then returns the response. |
sendUSSDCommand |
Sends a USSD command to the network operator and waits for a response. |
getNetworkClient |
Gets the Network client. (OSI Layer 3) |
getSecureNetworkClient |
Gets the Transport Layer Security (TLS) client. (OSI Layer 4) |
getHTTPClient |
Gets the HTTP client for the specified server and port. |
getHTTPSClient |
Gets the HTTPS client for the specified server and port. |
getIPAddress |
Gets the local IP address. |
getSignalQuality |
Gets the signal quality. |
setDebugStream |
Sets the debug stream for ArduinoCellular. |
ArduinoCellular()
Creates an instance of the ArduinoCellular class.
void begin()
Initializes the modem. This function must be called before using any other functions in the library.
bool unlockSIM(String pin)
Unlocks the SIM card using the specified PIN.
pin
The SIM card PIN.
True if the SIM card is unlocked, false otherwise.
bool connect(String apn, String username, String password)
Registers with the cellular network and connects to the Internet if the APN, GPRS username, and GPRS password are provided.
-
apn
The Access Point Name. -
username
The APN username. -
password
The APN password.
True if the connection is successful, false otherwise.
bool isConnectedToOperator()
Checks if the modem is registered on the network.
True if the network is connected, false otherwise.
bool isConnectedToInternet()
Checks if the GPRS network is connected.
True if the GPRS network is connected, false otherwise.
bool enableGPS(bool assisted)
Enables or disables the GPS functionality.
assisted
True to enable assisted GPS, false to disable it. Assist GPS uses the network to get the GPS location faster, so cellular needs to be enabled.
True if GPS was enabled successfully, false otherwise.
Geolocation getGPSLocation(unsigned long timeout)
Gets the GPS location. (Blocking call)
timeout
The timeout (In milliseconds) to wait for the GPS location.
The GPS location. If the location is not retrieved, the latitude and longitude will be 0.0.
Time getCellularTime()
Gets the current time from the network.
The current time.
Time getGPSTime()
Gets the current time from the GPS module.
The current time.
void sendSMS(String number, String message)
Sends an SMS message to the specified number.
-
number
The phone number to send the SMS to. -
message
The message to send.
std::vector< SMS > getReadSMS()
Gets the list of read SMS messages.
A vector of SMS messages.
std::vector< SMS > getUnreadSMS()
Gets the list of unread SMS messages.
A vector of SMS messages.
bool deleteSMS(uint16_t index)
Deletes an SMS message at the specified index.
index
The index of the SMS message to delete.
True if the SMS message was successfully deleted, false otherwise.
String sendATCommand(const char * command, unsigned long timeout)
Sends an AT command to the modem and waits for a response, then returns the response.
-
command
The AT command to send. -
timeout
The timeout (In milliseconds) to wait for the response. Default is 1000ms.
The response from the modem.
String sendUSSDCommand(const char * command)
Sends a USSD command to the network operator and waits for a response.
command
The USSD command to send.
The response from the network operator. (Note: The response may be an SMS message or a USSD response)
TinyGsmClient getNetworkClient()
Gets the Network client. (OSI Layer 3)
The GSM client.
BearSSLClient getSecureNetworkClient()
Gets the Transport Layer Security (TLS) client. (OSI Layer 4)
The GSM client.
HttpClient getHTTPClient(const char * server, const int port)
Gets the HTTP client for the specified server and port.
-
server
The server address. -
port
The server port.
The HTTP client.
HttpClient getHTTPSClient(const char * server, const int port)
Gets the HTTPS client for the specified server and port.
-
server
The server address. -
port
The server port.
The HTTPS client.
IPAddress getIPAddress()
Gets the local IP address.
The local IP address.
int getSignalQuality()
Gets the signal quality.
The signal quality.
void setDebugStream(Stream & stream)
Sets the debug stream for ArduinoCellular.
This function allows you to set the debug stream for ArduinoCellular. The debug stream is used to output debug messages and information.
stream
A pointer to the Stream object that will be used as the debug stream.
class ModemInterface
: public TinyGsmBG96
Represents the interface to the 4G modem module which extends the TinyGsmBG96 class.
Members | Descriptions |
---|---|
stream |
The stream object for communication with the modem. |
powerPin |
The pin number for controlling the power of the modem. |
ModemInterface |
Constructor for the ModemInterface class. |
init |
Initializes the modem interface. (Overrides the init method in TinyGsmBG96) |
Stream * stream
The stream object for communication with the modem.
int powerPin
The pin number for controlling the power of the modem.
inline explicit ModemInterface(Stream & stream, int powerPin)
Constructor for the ModemInterface class.
-
stream
The stream object for communication with the modem. -
powerPin
The pin number for controlling the power of the modem.
inline bool init(const char * pin)
Initializes the modem interface. (Overrides the init method in TinyGsmBG96)
pin
The PIN code for the SIM card (optional).
True if initialization is successful, false otherwise.
Represents an SMS message.
Members | Descriptions |
---|---|
index |
The index of the SMS message. |
sender |
The phone number associated with the SMS. |
message |
The content of the SMS message. |
timestamp |
The timestamp when the SMS was received. |
SMS |
Default constructor for SMS. Initializes the number, message, and timestamp to empty values. |
SMS |
Constructor for SMS. |
int16_t index
The index of the SMS message.
String sender
The phone number associated with the SMS.
String message
The content of the SMS message.
Time timestamp
The timestamp when the SMS was received.
inline SMS()
Default constructor for SMS. Initializes the number, message, and timestamp to empty values.
inline SMS(int16_t index, String sender, String message, Time timestamp)
Constructor for SMS.
-
index
The index of the SMS message. -
sender
The phone number associated with the sender of the SMS. -
message
The content of the SMS message. -
timestamp
The timestamp when the SMS was received.
Represents a point in time with year, month, day, hour, minute, second, and offset.
The Time class provides methods to manipulate and retrieve information about a specific point in time. It supports conversion to and from ISO8601 format and UNIX timestamp.
Members | Descriptions |
---|---|
Time |
Constructor for Time class. Initializes the year, month, day, hour, minute, second, and offset to zero. |
Time |
Default constructor for Time class. Initializes the year, month, day, hour, minute, second, and offset to zero. |
fromISO8601 |
Parses an ISO8601 formatted string and sets the time components accordingly. |
fromUNIXTimestamp |
Parses a UNIX timestamp and sets the time components accordingly. |
fromComponents |
Initialises the time components with the given values. |
getISO8601 |
Returns the time in ISO8601 format. |
getUNIXTimestampString |
Returns the time in UNIX timestamp format. |
getUNIXTimestamp |
Returns the time in UNIX timestamp format. |
parseISO8601 |
Returns the year component of the time.\ |
parseUNIXTimestamp |
Parses a UNIX timestamp and sets the time components accordingly. |
setYear |
Sets the year component of the time. |
setMonth |
Sets the month component of the time. |
setDay |
Sets the day component of the time. |
setHour |
Sets the hour component of the time. |
setMinute |
Sets the minute component of the time. |
setSecond |
Sets the second component of the time. |
setOffset |
Sets the timezone offset of the time. |
getYear |
Returns the year component of the time. |
getMonth |
Returns the month component of the time. |
getDay |
Returns the day component of the time. |
getHour |
Returns the hour component of the time. |
getMinute |
Returns the minute component of the time. |
getSecond |
Returns the second component of the time. |
getOffset |
Returns the timezone offset of the time. |
inline Time(int year, int month, int day, int hour, int minute, int second, int offset)
Constructor for Time class. Initializes the year, month, day, hour, minute, second, and offset to zero.
-
year
The year component of the time. -
month
The month component of the time. -
day
The day component of the time. -
hour
The hour component of the time. -
minute
The minute component of the time. -
second
The second component of the time. -
offset
The timezone offset in hours (default is 0).
inline Time()
Default constructor for Time class. Initializes the year, month, day, hour, minute, second, and offset to zero.
inline void fromISO8601(String ISO8601)
Parses an ISO8601 formatted string and sets the time components accordingly.
ISO8601
The ISO8601 formatted string to parse.
inline void fromUNIXTimestamp(String UNIXTimestamp)
Parses a UNIX timestamp and sets the time components accordingly.
UNIXTimestamp
The UNIX timestamp to parse.
inline void fromComponents(int year, int month, int day, int hour, int minute, int second, int offset)
Initialises the time components with the given values.
-
year
The year component of the time. -
month
The month component of the time. -
day
The day component of the time. -
hour
The hour component of the time. -
minute
The minute component of the time. -
second
The second component of the time. -
offset
The timezone offset in hours (default is 0).
inline String getISO8601()
Returns the time in ISO8601 format.
The time in ISO8601 format.
inline String getUNIXTimestampString()
Returns the time in UNIX timestamp format.
The time in UNIX timestamp format.
inline unsigned long getUNIXTimestamp()
Returns the time in UNIX timestamp format.
The time in UNIX timestamp format.
inline void parseISO8601(String iso8601)
Returns the year component of the time.\
iso8601
The ISO8601 formatted string to parse.
inline void parseUNIXTimestamp(long unixTimestamp)
Parses a UNIX timestamp and sets the time components accordingly.
unixTimestamp
The UNIX timestamp to parse.
inline void setYear(int year)
Sets the year component of the time.
year
The year component of the time.
inline void setMonth(int month)
Sets the month component of the time.
month
The month component of the time.
inline void setDay(int day)
Sets the day component of the time.
day
The day component of the time.
inline void setHour(int hour)
Sets the hour component of the time.
hour
The hour component of the time.
inline void setMinute(int minute)
Sets the minute component of the time.
minute
The minute component of the time.
inline void setSecond(int second)
Sets the second component of the time.
second
The second component of the time.
inline void setOffset(int offset)
Sets the timezone offset of the time.
offset
The timezone offset of the time.
inline int getYear()
Returns the year component of the time.
The year component of the time.
inline int getMonth()
Returns the month component of the time.
The month component of the time.
inline int getDay()
Returns the day component of the time.
The day component of the time.
inline int getHour()
Returns the hour component of the time.
The hour component of the time.
inline int getMinute()
Returns the minute component of the time.
The minute component of the time.
inline int getSecond()
Returns the second component of the time.
The second component of the time.
inline int getOffset()
Returns the timezone offset of the time.
The timezone offset of the time.
Represents a geographic location with latitude and longitude coordinates.
Members | Descriptions |
---|---|
latitude |
The latitude coordinate of the location. |
longitude |
The longitude coordinate of the location. |
float latitude
The latitude coordinate of the location.
float longitude
The longitude coordinate of the location.