You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library provides a toolkit for interacting with the official Arduino 4G Modules. It allows you to connect to the internet, send and receive SMS messages, and get location from the cellular network or GPS.
The SMS functionality allows devices to exchange information with users or other systems through simple text messages, enabling a wide range of applications from remote monitoring to control systems or a fallback communication method when the others are not available.
89
90
91
+
### Reading SMS Messages
92
+
**getReadSMS():** This method returns a vector containing SMS messages that have already been read. It's particularly useful for applications that need to process or display messages that have been acknowledged.
90
93
91
-
## Time and Location
94
+
**getUnreadSMS(): **This method fetches a vector of unread SMS messages, allowing the application to process or notify users about new messages.
95
+
96
+
Each SMS message is represented as an instance of the `SMS` class, which contains the sender's number, the message text, and a timestamp marking when the message was received.
97
+
98
+
99
+
### The SMS Class
100
+
The SMS class serves as a container for information related to a single SMS message. It includes the following attributes:
101
+
102
+
*`number`: The phone number from which the SMS was sent.
103
+
*`message`: The body of the SMS message.
104
+
*`timestamp`: A timestamp indicating when the message was received by the module.
105
+
106
+
The class provides constructors for initializing an SMS object either with default values or with specific details about the message.
107
+
108
+
### Sending SMS Messages
109
+
Sending SMS messages is a straightforward process with the Arduino cellular library.
110
+
111
+
The method sendSMS() is designed for this purpose, taking two parameters:
112
+
113
+
*`number`: The recipient's phone number.
114
+
*`message`: The text of the message to be sent.
115
+
116
+
This functionality allows Arduino devices to communicate outwardly to users or other systems, sending alerts, data, or control commands via SMS.
117
+
118
+
## Time and Location
119
+
These features enable precise tracking of device locations and ensure synchronized operations across different systems. This guide focuses on utilizing GPS and cellular network capabilities for location tracking and time synchronization. It's important to note that GPS functionality is exclusively available in the Global Version of the modem, highlighting the need for appropriate hardware selection based on the project requirements.
120
+
121
+
### GPS Location
122
+
**Method Overview:**`getGPSLocation(unsigned long timeout = 60000)` is a blocking call that attempts to acquire the current GPS location within the specified timeout period. The method returns a Location structure, containing latitude and longitude values. If the location cannot be retrieved within the timeout, both values default to 0.0.
123
+
124
+
GPS Location is ideal for applications requiring high-precision location data, such as asset tracking or outdoor navigation solutions. This functionality relies on the Global Version of the modem, which is equipped with GPS capabilities.
125
+
126
+
To enable GPS Location you will need to call `enableGPS(bool assisted)`. Assisted GPS or A-GPS is an enchancement of GPS that uses the cellular network to get the location, it performs that much quicker than without assistence but depends on Cellular network coverage.
127
+
128
+
### Cellular Location
129
+
**Method Overview:**`getCellularLocation(unsigned long timeout = 10000)` also provides location tracking but utilizes the cellular network. Similar to the GPS method, it's a blocking call with a specified timeout, returning latitude and longitude values through a Location structure. If the location is not obtained, the values default to 0.0.
130
+
131
+
Cellular location is suitable for scenarios where GPS signals are weak or unavailable, offering a broader coverage area at the expense of location accuracy. This method leverages the cellular network's infrastructure to approximate the device's location.
132
+
133
+
### Time Synchronization
134
+
Time synchronization is crucial for maintaining accurate timing across IoT devices, especially for data logging, scheduled tasks, and time-stamped communications.
135
+
136
+
#### Cellular Time
137
+
**Method Overview**: `getCellularTime()` fetches the current time from the cellular network, providing a reliable time source even without GPS signals. The time is returned as a Time object.
138
+
139
+
Cellular time is perfect for devices that require accurate time but operate in areas with limited or no GPS coverage. Since it relies on the cellular network, it ensures time synchronization across devices distributed geographically.
140
+
141
+
#### GPS Time
142
+
**Method Overview**: getGPSTime() obtains the current time from the GPS module, offering highly accurate and globally synchronized time data. The method returns a Time object.
143
+
144
+
GPS Time for applications demanding precise timekeeping, benefiting from the global synchronization capabilities of GPS satellites. This feature is exclusive to devices equipped with the Global Version of the modem that includes GPS functionality.
145
+
146
+
147
+
### The Time Class
148
+
The Time class represents a specific point in time, including year, month, day, hour, minute, second, and timezone offset.
149
+
150
+
It supports parsing from ISO8601 and UNIX timestamp formats, offering flexibility in handling time data. This class is crucial for applications that manage events, log data with timestamps, or perform scheduled operations.
0 commit comments