SIM900
sim900_defs.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
32#ifndef SIM900_DEFS_H
33#define SIM900_DEFS_H
34
44typedef enum _SIM900DialResult {
46 SIM900_DIAL_RESULT_NO_DIALTONE,
47
49 SIM900_DIAL_RESULT_BUSY,
50
52 SIM900_DIAL_RESULT_NO_CARRIER,
53
55 SIM900_DIAL_RESULT_NO_ANSWER,
56
58 SIM900_DIAL_RESULT_ERROR,
59
61 SIM900_DIAL_RESULT_OK
62} SIM900DialResult;
63
73typedef enum _SIM900OperatorFormat {
75 SIM900_OPERATOR_FORMAT_AUTO,
76
78 SIM900_OPERATOR_FORMAT_MANUAL,
79
81 SIM900_OPERATOR_FORMAT_DEREGISTER,
82
84 SIM900_OPERATOR_FORMAT_SET_ONLY,
85
87 SIM900_OPERATOR_FORMAT_MANUAL_AUTO
88} SIM900OperatorFormat;
89
100inline SIM900OperatorFormat intToSIM900OperatorFormat(uint8_t i){
101 if(i < SIM900OperatorFormat::SIM900_OPERATOR_FORMAT_AUTO ||
102 i > SIM900OperatorFormat::SIM900_OPERATOR_FORMAT_MANUAL_AUTO)
103 return SIM900OperatorFormat::SIM900_OPERATOR_FORMAT_AUTO;
104
105 return static_cast<SIM900OperatorFormat>(i);
106}
107
117typedef enum _SIM900OperatorMode {
119 SIM900_OPERATOR_MODE_GSM,
120
122 SIM900_OPERATOR_MODE_GSM_COMPACT,
123
125 SIM900_OPERATOR_MODE_UTRAN,
126
128 SIM900_OPERATOR_MODE_GSM_EGPRS,
129
131 SIM900_OPERATOR_MODE_UTRAN_HSDPA,
132
134 SIM900_OPERATOR_MODE_UTRAN_HSUPA,
135
137 SIM900_OPERATOR_MODE_UTRAN_HSDPA_HSUPA,
138
140 SIM900_OPERATOR_MODE_E_UTRAN
141} SIM900OperatorMode;
142
153inline SIM900OperatorMode intToSIM900OperatorMode(int i){
154 if(i < SIM900OperatorMode::SIM900_OPERATOR_MODE_GSM ||
155 i > SIM900OperatorMode::SIM900_OPERATOR_MODE_E_UTRAN)
156 return SIM900OperatorMode::SIM900_OPERATOR_MODE_GSM;
157
158 return static_cast<SIM900OperatorMode>(i);
159}
160
169typedef enum _SIM900CardService {
171 SIM900_CARD_SERVICE_ASYNC,
172
174 SIM900_CARD_SERVICE_SYNC,
175
177 SIM900_CARD_SERVICE_PAD_ACCESS,
178
180 SIM900_CARD_SERVICE_PACKET,
181
183 SIM900_CARD_SERVICE_VOICE,
184
186 SIM900_CARD_SERVICE_FAX
187} SIM900CardService;
188
199inline SIM900CardService intToSIM900CardService(uint8_t i){
200 if(i < SIM900CardService::SIM900_CARD_SERVICE_ASYNC ||
201 i > SIM900CardService::SIM900_CARD_SERVICE_FAX)
202 return SIM900CardService::SIM900_CARD_SERVICE_ASYNC;
203
204 return static_cast<SIM900CardService>(i);
205}
206
216typedef enum _SIM900PhonebookType {
218 SIM900_PHONEBOOK_NATIONAL = 145,
219
221 SIM900_PHONEBOOK_INTERNATIONAL = 129,
222
224 SIM900_PHONEBOOK_UNKNOWN = 0
225} SIM900PhonebookType;
226
235typedef struct _SIM900Operator {
237 SIM900OperatorMode mode;
238
240 SIM900OperatorFormat format;
241
243 String name;
245
254typedef struct _SIM900RTC {
256 uint8_t day;
257
259 uint8_t month;
260
262 uint8_t year;
263
265 uint8_t hour;
266
268 uint8_t minute;
269
271 uint8_t second;
272
274 int8_t gmt;
275} SIM900RTC;
276
285typedef struct _SIM900APN {
287 String apn;
288
290 String username;
291
293 String password;
294} SIM900APN;
295
304typedef struct _SIM900HTTPHeader {
306 String key;
307
309 String value;
311
321typedef struct _SIM900HTTPRequest {
323 String method;
324
326 String data;
327
329 String domain;
330
332 String resource;
333
335 uint8_t status;
336
338 uint16_t port;
339
342
344 uint16_t header_count;
346
356typedef struct _SIM900HTTPResponse {
358 uint16_t status;
359
362
364 uint16_t header_count;
365
367 String data;
369
379typedef struct _SIM900CardAccount {
381 String name;
382
384 String number;
385
387 uint8_t type;
388
390 uint8_t speed;
391
393 SIM900PhonebookType numberType;
394
396 SIM900CardService service;
398
411
413 uint8_t used;
414
416 uint8_t max;
418
428typedef struct _SIM900Signal {
430 uint8_t rssi;
431
435
436#endif
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 header key-value pair.
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.
String username
The username for APN authentication.
Definition: sim900_defs.h:290
String apn
The Access Point Name (APN) for data connectivity.
Definition: sim900_defs.h:287
String password
The password for APN authentication.
Definition: sim900_defs.h:293
uint8_t type
The card's type (e.g., SIM card).
Definition: sim900_defs.h:387
String name
The name associated with the card account.
Definition: sim900_defs.h:381
SIM900CardService service
The type of card service (e.g., voice, data) associated with the card account.
Definition: sim900_defs.h:396
SIM900PhonebookType numberType
The type of phonebook (national, international) where the number is stored.
Definition: sim900_defs.h:393
uint8_t speed
The card's speed or data rate.
Definition: sim900_defs.h:390
String number
The card's phone number.
Definition: sim900_defs.h:384
String value
The header field value.
Definition: sim900_defs.h:309
String key
The header field key.
Definition: sim900_defs.h:306
String data
The data to be included in the request (e.g., POST data).
Definition: sim900_defs.h:326
String resource
The resource or URL path to access on the server.
Definition: sim900_defs.h:332
uint16_t header_count
The number of HTTP headers in the array.
Definition: sim900_defs.h:344
String domain
The domain or server to which the request is sent.
Definition: sim900_defs.h:329
SIM900HTTPHeader * headers
An array of HTTP headers associated with the request.
Definition: sim900_defs.h:341
uint16_t port
The port on which the server is listening (e.g., 80 for HTTP).
Definition: sim900_defs.h:338
String method
The HTTP method for the request (e.g., GET, POST).
Definition: sim900_defs.h:323
uint8_t status
The status of the HTTP request.
Definition: sim900_defs.h:335
String data
The data received in the HTTP response, such as HTML content or JSON data.
Definition: sim900_defs.h:367
SIM900HTTPHeader * headers
An array of HTTP headers included in the response.
Definition: sim900_defs.h:361
uint16_t header_count
The number of HTTP headers in the array.
Definition: sim900_defs.h:364
uint16_t status
The HTTP status code of the response.
Definition: sim900_defs.h:358
SIM900OperatorFormat format
The operator selection format.
Definition: sim900_defs.h:240
String name
The name of the mobile network operator.
Definition: sim900_defs.h:243
SIM900OperatorMode mode
The operating mode of the mobile network operator.
Definition: sim900_defs.h:237
uint8_t used
The number of entries used in the phonebook memory.
Definition: sim900_defs.h:413
uint8_t max
The maximum number of entries that can be stored in the phonebook memory.
Definition: sim900_defs.h:416
String memoryType
The type of phonebook memory (e.g., "SM" for SIM memory).
Definition: sim900_defs.h:410
uint8_t minute
Time component: minute.
Definition: sim900_defs.h:268
int8_t gmt
GMT (Greenwich Mean Time) offset in hours.
Definition: sim900_defs.h:274
uint8_t year
Date component: year.
Definition: sim900_defs.h:262
uint8_t day
Date component: day.
Definition: sim900_defs.h:256
uint8_t month
Date component: month.
Definition: sim900_defs.h:259
uint8_t second
Time component: second.
Definition: sim900_defs.h:271
uint8_t hour
Time component: hour.
Definition: sim900_defs.h:265
uint8_t rssi
Received Signal Strength Indication (RSSI) in decibels (dBm).
Definition: sim900_defs.h:430
uint8_t bit_error_rate
Bit Error Rate (BER) as a unitless ratio.
Definition: sim900_defs.h:433