# TinyGsmCommon.h (file)
**Module:** **[src](dir_68267d1309a1af8e8297ef4c3efbcdba.html)** **/** **[TinyGsmCommon.h](_tiny_gsm_common_8h.html)**
Common TinyGSM macros, utilities, and shared constants.
**Author**
Volodymyr Shymanskyy
**License**
LGPL-3.0
**Copyright**
Copyright (c) 2016 Volodymyr Shymanskyy
**Date**
Nov 2016
## Types
| | Name |
| --- | --- |
| typedef const char \* | [GsmConstStr](#a9c8c9c8249f99863e157f8fae76e7cab)
Helper typedef for a constant string stored in program memory (PROGMEM) on AVR platforms and in standard memory on other systems. |
## Functions
| | Name |
| --- | --- |
| String | **[TinyGsmStringFromIp](#a9aa41fa9f1de3b78f74ff7c778441044)**(IPAddress ip)
Convert an IPAddress to a String for use in connect(). |
| template
uint32_t | **[TinyGsmAutoBaud](#a684256b15d5c8e3224079861b340bf76)**(T & at_serial, uint32_t minimum = 9600, uint32_t maximum = 921600)
Attempts to automatically find the baud rate for the modem. |
## Attributes
| | Name |
| --- | --- |
| const uint32_t | **[TINY_GSM_AUTOBAUD_RATES](#a52e0076b986e14cb1d3948794977d6fa)**
Standard baud rates to attempt during auto-baud detection and modem initialization. |
## Defines
| | Name |
| --- | --- |
| | **[TINYGSM_VERSION](#af3ededbb99754308412f7673e355d2e8)**
The current library version number. |
| | **[TINY_GSM_RX_BUFFER](#ac7071d3c75c853b6ead225fdb9b46c62)**
The size of the receive buffer for the modem. |
| | **[TINY_GSM_INTERCHAR_TIMEOUT_MS](#a7877add0c7c5cb8520adb8b7a52ce7bf)**
Maximum silence between characters before timing out. |
| | **[TINY_GSM_RESPONSE_MAX_GRACE_MS](#ae7c8b530d52734bd00740b657b8c256b)**
Maximum total response-completion time after the overall timeout. |
| | **[TINY_GSM_UNREAD_CHECK_MS](#a7960b3b4309feff8ac36ba70edd161ab)**
The time in milliseconds to wait before checking for unread data from the modem. |
| | **[TINY_GSM_ATTR_NOT_AVAILABLE](#a3af62d9c29d391c76db1b5081cc8bdaa)**
Helper macro to mark a function as not available on this modem type. |
| | **[TINY_GSM_ATTR_NOT_IMPLEMENTED](#a1788414d4b7a976376187402340b7005)**
Helper macro to mark a function as not implemented on this modem type. |
| | **[TINY_GSM_PROGMEM](#af36c4b50d69b1b716166cc5ba6608de9)**
Helper macro for memory storage location. |
| | **[GFP](#aeb13a6f7de94e1e36a4ecad3d1abb6d8)**(x)
Helper macro to cast data as a constant string in program memory (PROGMEM) on AVR platforms and in standard memory on other systems. |
| | **[GF](#ad3002787007c15407a2dd49d38ca3227)**(x)
Helper macro to store data in program memory (PROGMEM) on AVR platforms and in standard memory on other systems. |
| | **[TINY_GSM_F_READ](#a05989f79991bb627ef852db5aee7e6e4)**(value)
Read a 32-bit constant stored with TINY_GSM_PROGMEM. |
| | **[TINY_GSM_F_STRNCMP](#aa825798f7b5b2496028a2c989708ca26)**(str, constant, length)
Compare a RAM string with a constant string wrapped in [GFP()](_tiny_gsm_common_8h.md#aeb13a6f7de94e1e36a4ecad3d1abb6d8). |
| | **[TINY_GSM_F_STRCPY](#aeedf5dc1a9854603110974548b9f5a89)**(dest, constant)
Copy a constant string wrapped in [GFP()](_tiny_gsm_common_8h.md#aeb13a6f7de94e1e36a4ecad3d1abb6d8) into a RAM buffer. |
## Types Documentation
### GsmConstStr
```cpp
;
```
## Functions Documentation
### TinyGsmStringFromIp(IPAddress)
```cpp
String TinyGsmStringFromIp(IPAddress ip)
```
- **Parameters**:
- **ip** The IPAddress to convert
- **Return**: A String representation of the IPAddress
### TinyGsmAutoBaud(T &, uint32_t, uint32_t)
```cpp
uint32_t TinyGsmAutoBaud(T & at_serial, uint32_t minimum = 9600, uint32_t maximum = 921600)
```
> [!NOTE]
> This DOES NOT work with the XBee module
- **Parameters**:
- **at_serial** The serial port connected to the modem
- **minimum** The minimum baud rate to try (default: 9600)
- **maximum** The maximum baud rate to try (default: 921600)
- **Return**: The baud rate that the modem responded to, or 0 if no response was received
## Attributes Documentation
### TINY_GSM_AUTOBAUD_RATES
```cpp
static const uint32_t TINY_GSM_AUTOBAUD_RATES;
```
This array is shared between [TinyGsmAutoBaud()](_tiny_gsm_common_8h.md#a684256b15d5c8e3224079861b340bf76) and forceModemBaud() to ensure consistent baud rate selection across the library.
## Macros Documentation
### TINYGSM_VERSION
```cpp
#define TINYGSM_VERSION "0.13.0"
```
### TINY_GSM_RX_BUFFER
```cpp
#define TINY_GSM_RX_BUFFER 64
```
This is used in the TinyGsm class to store incoming data from the modem. This buffer is used to store incoming data from the modem before it is read by the user. If this buffer is too small, data may be lost if the user does not read it quickly enough - especially for modems that do not internally buffer data. If this buffer is too large, it may use more memory than necessary.
> [!NOTE]
> This is *not* the size of the modem's internal buffer!
> [!IMPORTANT]
> This is a library-wide setting. It applies to all modems and all clients. If you need different buffer sizes for different modems, you will need to modify the library.
### TINY_GSM_INTERCHAR_TIMEOUT_MS
```cpp
#define TINY_GSM_INTERCHAR_TIMEOUT_MS 10L
```
### TINY_GSM_RESPONSE_MAX_GRACE_MS
```cpp
#define TINY_GSM_RESPONSE_MAX_GRACE_MS 1000L
```
This bounds the inter-character grace period so that continuous input cannot cause waitResponse() to wait indefinitely.
### TINY_GSM_UNREAD_CHECK_MS
```cpp
#define TINY_GSM_UNREAD_CHECK_MS 500
```
This is used to ask the modem if there is any unread data available because they don't always issue a URC to notify the host that data is available.
> [!IMPORTANT]
> This is a library-wide setting. It applies to all modems and all clients. If you need a different check interval for different modems, you will need to modify the library.
### TINY_GSM_ATTR_NOT_AVAILABLE
```cpp
#define TINY_GSM_ATTR_NOT_AVAILABLE __attribute__((error("Not available on this modem type")))
```
### TINY_GSM_ATTR_NOT_IMPLEMENTED
```cpp
#define TINY_GSM_ATTR_NOT_IMPLEMENTED __attribute__((error("Not implemented")))
```
### TINY_GSM_PROGMEM
```cpp
#define TINY_GSM_PROGMEM
```
### GFP
```cpp
#define GFP(x) x
```
### GF
```cpp
#define GF(x) x
```
### TINY_GSM_F_READ
```cpp
#define TINY_GSM_F_READ(value) (*(value))
```
- **Parameters**:
- **value** Pointer to the stored constant.
- **Return**: The stored value.
### TINY_GSM_F_STRNCMP
```cpp
#define TINY_GSM_F_STRNCMP(str, constant, length) strncmp((str), (constant), (length))
```
- **Parameters**:
- **str** The string in RAM.
- **constant** The constant string wrapped in [GFP()](_tiny_gsm_common_8h.md#aeb13a6f7de94e1e36a4ecad3d1abb6d8).
- **length** The maximum number of characters to compare.
- **Return**: A negative, zero, or positive value as for strncmp().
### TINY_GSM_F_STRCPY
```cpp
#define TINY_GSM_F_STRCPY(dest, constant) strcpy((dest), (constant))
```
- **Parameters**:
- **dest** The destination buffer, large enough for the string and terminator.
- **constant** The constant string wrapped in [GFP()](_tiny_gsm_common_8h.md#aeb13a6f7de94e1e36a4ecad3d1abb6d8).
- **Return**: The destination buffer.
---
Generated by [Doxygen](https://www.doxygen.nl) and [m.css](https://mcss.mosra.cz/) with templates from [doxybook2](https://github.com/matusnovak/doxybook2)