SIM900
Loading...
Searching...
No Matches
sim900.h
1/*
2 * This file is part of the SIM900 Arduino Shield library.
3 * Copyright (c) 2023 Nathanne Isip
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 */
23
24#ifndef SIM900_H
25#define SIM900_H
26
27#include <Arduino.h>
28#include <SoftwareSerial.h>
29
30#include <sim900_defs.h>
31
42class SIM900 {
43private:
45 SoftwareSerial *sim900;
46
48 bool hasAPN = false;
49
51 void sendCommand(String message);
52
54 bool isSuccessCommand();
55
57 String getResponse();
58
60 String getReturnedMode();
61
63 String rawQueryOnLine(uint16_t line);
64
66 String queryResult();
67
68public:
76 SIM900(SoftwareSerial *_sim900);
77
85 bool handshake();
86
92 void close();
93
101 bool isCardReady();
102
111 bool changeCardPin(uint8_t pin);
112
121
130 SIM900DialResult dialUp(String number);
131
141 SIM900DialResult redialUp();
142
152 SIM900DialResult acceptIncomingCall();
153
163 bool hangUp();
164
176 bool sendSMS(String number, String message);
177
188 bool connectAPN(SIM900APN apn);
189
199 bool enableGPRS();
200
212
223
235
246 SIM900RTC rtc();
247
258 bool updateRtc(SIM900RTC config);
259
271 bool savePhonebook(uint8_t index, SIM900CardAccount account);
272
283 bool deletePhonebook(uint8_t index);
284
296
308
316 String manufacturer();
317
325 String softwareRelease();
326
334 String imei();
335
343 String chipModel();
344
352 String chipName();
353
361 String ipAddress();
362};
363
364#endif
A class for interfacing with the SIM900 GSM/GPRS module using Arduino and SoftwareSerial.
Definition sim900.h:42
bool savePhonebook(uint8_t index, SIM900CardAccount account)
Save a contact in the SIM card's phonebook.
Definition sim900.cpp:336
String manufacturer()
Get the manufacturer name of the SIM900 module.
Definition sim900.cpp:417
SIM900DialResult redialUp()
Redial the last outgoing call.
Definition sim900.cpp:149
String chipName()
Get the chip name of the SIM900 module.
Definition sim900.cpp:441
SIM900PhonebookCapacity phonebookCapacity()
Get information about the capacity of the SIM card's phonebook.
Definition sim900.cpp:374
SIM900DialResult acceptIncomingCall()
Accept an incoming call.
Definition sim900.cpp:169
SIM900DialResult dialUp(String number)
Initiate an outgoing call to a phone number.
Definition sim900.cpp:129
bool enableGPRS()
Enable the General Packet Radio Service (GPRS) for data communication.
Definition sim900.cpp:239
String ipAddress()
Get the IP address assigned to the SIM900 module.
Definition sim900.cpp:446
SIM900CardAccount cardNumber()
Get the SIM card number.
Definition sim900.cpp:392
String chipModel()
Get the chip model of the SIM900 module.
Definition sim900.cpp:436
bool deletePhonebook(uint8_t index)
Delete a contact from the SIM card's phonebook.
Definition sim900.cpp:369
SIM900Operator networkOperator()
Get information about the current network operator.
Definition sim900.cpp:202
bool sendSMS(String number, String message)
Send an SMS (Short Message Service).
Definition sim900.cpp:188
bool updateRtc(SIM900RTC config)
Update the SIM900 module's real-time clock (RTC).
Definition sim900.cpp:286
String softwareRelease()
Get the software release version of the SIM900 module.
Definition sim900.cpp:422
void close()
Close the communication with the SIM900 module.
Definition sim900.cpp:125
bool hangUp()
Hang up an active call.
Definition sim900.cpp:183
bool connectAPN(SIM900APN apn)
Connect to an Access Point Name (APN) for mobile data.
Definition sim900.cpp:221
bool changeCardPin(uint8_t pin)
Change the PIN code of the SIM card.
Definition sim900.cpp:100
SIM900RTC rtc()
Get the real-time clock (RTC) information.
Definition sim900.cpp:300
bool handshake()
Initialize communication with the SIM900 module and perform a handshake.
Definition sim900.cpp:90
bool isCardReady()
Check if the SIM card is ready.
Definition sim900.cpp:95
String imei()
Get the International Mobile Equipment Identity (IMEI) number of the SIM900 module.
Definition sim900.cpp:431
SIM900CardAccount retrievePhonebook(uint8_t index)
Retrieve a contact from the SIM card's phonebook.
Definition sim900.cpp:346
SIM900Signal signal()
Get the signal strength and bit error rate of the network connection.
Definition sim900.cpp:108
SIM900HTTPResponse request(SIM900HTTPRequest request)
Send an HTTP request to a remote server.
Definition sim900.cpp:249
A structure representing Access Point Name (APN) configuration for mobile data.
A structure representing a card account, including name, number, type, and service information.
A structure representing an HTTP request.
A structure representing an HTTP response.
A structure representing mobile network operator information.
A structure representing the capacity of a phonebook memory type.
A structure representing real-time clock (RTC) information.
A structure representing signal strength and bit error rate information.