--- title: TinyGsmSim7000 --- # TinyGsmSim7000 (class) **Module:** **[TinyGsmSim7000](class_tiny_gsm_sim7000.html)** Class for the SIMCOM SIM7000 using the TCP-IP toolkit. `#include ` Inherits from TinyGsmSim70xx<TinyGsmSim7000, TinyGsmSim7000ModemConfig>, TinyGsmTCP<TinyGsmSim7000, TinyGsmSim7000TcpConfig>, TinyGsmSMS<TinyGsmSim7000>, TinyGsmTime<TinyGsmSim7000>, TinyGsmNTP<TinyGsmSim7000>, TinyGsmGSMLocation<TinyGsmSim7000>, TinyGsmBattery<TinyGsmSim7000> ## Public Types | | Name | | -------------- | -------------- | | class | GsmClientSim7000
Inner client. | | typedef typename [ModemConfig::RegStatus](../modules/group__simcom__sim70xx.md#ga1a1a4b2205048e9327b5df1468487481) | [regStatusType](class_tiny_gsm_modem.md#aaea225677f054ad2f5ea23918b11e7f0) | ## Basic functions ### Public Functions | | Name | | -------------- | -------------- | | bool | **[begin](class_tiny_gsm_modem.md#ae4397a65939a770e478e29c718d13e59)**(const char * pin = nullptr)
Sets up the GSM module. | | bool | **[init](class_tiny_gsm_modem.md#a27f7f71fb1a2008dc57f6d454564022c)**(const char * pin = nullptr)
Sets up the GSM module. | | void | **[sendAT](class_tiny_gsm_modem.md#afa190e606feb7831c86094577064d2e6)**(Args... cmd)
Recursive variadic template to send AT commands. | | bool | **[setBaud](class_tiny_gsm_modem.md#a279bffb4e905f1150dadab726e8482f2)**(uint32_t baud)
Set the module baud rate. | | bool | **[setDefaultBaud](class_tiny_gsm_modem.md#ac0a4b1d359f20a7bf54667858141b591)**(uint32_t baud)
Set the default baud rate for the modem, ie, the baud rate that the modem will use after a reset or power cycle. | | bool | **[forceModemBaud](class_tiny_gsm_modem.md#a0ff68001b77fed375db7e048bc5ab5f4)**(StreamObject & at_serial, uint32_t targetBaud)
Attempt to set the modem baud rate by trying set the command to change the baud rate to various common baud rates and seeing if the modem responds to AT commands at that baud rate. | | bool | **[testAT](class_tiny_gsm_modem.md#a5bfedec6b19edfbcbc0a5832fff7d603)**(uint32_t timeout_ms = 10000L)
Test response to AT commands. | | int8_t | **[waitResponse](class_tiny_gsm_modem.md#a4416426fc61492fcb761139b85f1535b)**(uint32_t timeout_ms, String & data, [GsmConstStr](../files/_tiny_gsm_common_8h.md#a9c8c9c8249f99863e157f8fae76e7cab) r1 = ModemConfig::GSM_OK, [GsmConstStr](../files/_tiny_gsm_common_8h.md#a9c8c9c8249f99863e157f8fae76e7cab) r2 = ModemConfig::GSM_ERROR, [GsmConstStr](../files/_tiny_gsm_common_8h.md#a9c8c9c8249f99863e157f8fae76e7cab) r3 = nullptr, [GsmConstStr](../files/_tiny_gsm_common_8h.md#a9c8c9c8249f99863e157f8fae76e7cab) r4 = nullptr, [GsmConstStr](../files/_tiny_gsm_common_8h.md#a9c8c9c8249f99863e157f8fae76e7cab) r5 = nullptr, [GsmConstStr](../files/_tiny_gsm_common_8h.md#a9c8c9c8249f99863e157f8fae76e7cab) r6 = nullptr, [GsmConstStr](../files/_tiny_gsm_common_8h.md#a9c8c9c8249f99863e157f8fae76e7cab) r7 = nullptr, [GsmConstStr](../files/_tiny_gsm_common_8h.md#a9c8c9c8249f99863e157f8fae76e7cab) r8 = nullptr)
Listen for responses to commands and handle URCs. | | String | **[getConfiguredModem](class_tiny_gsm_modem.md#a2f9a76aa8ef51867e560196a8261c170)**()
Gets the configured modem manufacture and model based on the compile-time traits. | | String | **[getModemInfo](class_tiny_gsm_modem.md#a587c942eefa8b4905da4cfaf79d04c53)**()
Asks for modem information via the 3GPP TS 27.007 standard ATI command. | | String | **[getModemName](class_tiny_gsm_modem.md#a500246b8d736f654ffd91db17664e42a)**()
Get the modem name - a combination of the manufacturer and model, as the modem calls itself. | | String | **[getModemManufacturer](class_tiny_gsm_modem.md#a3bf0eb3d18cefc70a0277103719873aa)**()
Get the modem manufacturer. | | String | **[getModemModel](class_tiny_gsm_modem.md#ae0ca787c0bb16776f3b326a899c39d4e)**()
Get the modem model. | | String | **[getModemRevision](class_tiny_gsm_modem.md#a748dce8b32f1a5d4ca0f9bf9a5ea55a2)**()
Get the modem revision information. | | String | **[getModemSerialNumber](class_tiny_gsm_modem.md#a3a13f308ec6beb7e2a270d1ece67978e)**()
Get the modem serial number. | | bool | **[factoryDefault](class_tiny_gsm_modem.md#a229a18e6a1226a51301ba3a41f75947d)**()
Reset the module to factory defaults. | ## Power functions ### Public Functions | | Name | | -------------- | -------------- | | bool | **[restart](class_tiny_gsm_modem.md#a986567555e19bc82fc3f4f154f89de40)**(const char * pin = nullptr)
Restart the module. | | bool | **[poweroff](class_tiny_gsm_modem.md#ab46d127fe8c4352aa21925e429c799d0)**()
Power off the module. | | bool | **[powerOff](class_tiny_gsm_modem.md#ac6d0ce36377992e00b0d38c5cb1a9126)**()
Power off the module. | | bool | **[radioOff](class_tiny_gsm_modem.md#a084efec47f33f71933c2084bf4c3fead)**()
Turn off the module radio. | | bool | **[sleepEnable](class_tiny_gsm_modem.md#ae293a3c9ef0c55ce7dbc05a29dd5c3a7)**(bool enable = true)
Enable sleep on the module. | | bool | **[setPhoneFunctionality](class_tiny_gsm_modem.md#a496f2e6fb026bea432f2f3d31b50d2be)**(uint8_t fun, bool reset = false)
Set the phone functionality. | ## Generic network functions ### Public Functions | | Name | | -------------- | -------------- | | regStatusType | **[getRegistrationStatus](class_tiny_gsm_modem.md#a75286fdda3bb1672f1c88a06d010c04d)**()
Get the modem registration status on the network. | | bool | **[isNetworkConnected](class_tiny_gsm_modem.md#ac6923f6667d67ec47e88a15d34d365fe)**()
Confirm whether the module is currently connected to the GSM/GPRS/LTE network. | | bool | **[waitForNetwork](class_tiny_gsm_modem.md#a8cdad3a71c520124dd1d5aed16ee726b)**(uint32_t timeout_ms = 60000L, bool check_signal = false)
Wait until the module has connected to the network. | | int16_t | **[getSignalQuality](class_tiny_gsm_modem.md#a714c21a155a823bb32a7be87fde815bd)**()
Get the signal quality report. | | String | **[getLocalIP](class_tiny_gsm_modem.md#a69cbe284005cf8831b0155f5ba721d87)**()
Get the Local IP address assigned to the module by the network as a String. | | IPAddress | **[localIP](class_tiny_gsm_modem.md#ab6aae9d6513ea9496f79704367eeff44)**()
Get the Local IP address assigned to the module by the network as an IPAddress object. | ## Utilities ### Public Functions | | Name | | -------------- | -------------- | | void | **[streamWrite](class_tiny_gsm_modem.md#aa03b38efd4eb8437c9e5ed92aac89742)**(T last)
Write a value to the modem stream. | | void | **[streamClear](class_tiny_gsm_modem.md#a7879aad8a0f9def7cd8d7450800b2d64)**()
Clear the modem stream attempting to parse any URC's in it. | | void | **[streamDump](class_tiny_gsm_modem.md#a20ccc061bab4e038a8800c244e761ecd)**(int16_t expected_len)
Dump the modem stream, completely discarding any data in it without attempting to parse any URC's in it. | ## SIM card functions ### Public Functions | | Name | | -------------- | -------------- | | bool | **[simUnlock](class_tiny_gsm_g_p_r_s.md#a466fae623fa90d89e3b899f8ad9b6770)**(const char * pin)
Unlock the SIM card with a PIN code. | | String | **[getSimCCID](class_tiny_gsm_g_p_r_s.md#a8ba9e16bbba657b10ebb7da122c21d54)**()
Get the SIM card's CCID via AT+CCID. | | String | **[getIMEI](class_tiny_gsm_g_p_r_s.md#a27acb4e97886f54e2d741c5554a25aa4)**()
Get the modem's TA Serial Number Identification (IMEI) via AT+GSN. | | String | **[getIMSI](class_tiny_gsm_g_p_r_s.md#a33c0b782e1076262c262063857d648a2)**()
Get the modem's International Mobile Subscriber Identity (IMSI) via AT+CIMI. | | [SimStatus](../files/_tiny_gsm_g_p_r_s_8tpp.md#a88faf9e645594ddb7300d159bc0fe5e0) | **[getSimStatus](class_tiny_gsm_g_p_r_s.md#a04fe0ca24dc592e8e564c9669fd4a314)**(uint32_t timeout_ms = 10000L)
Get the SIM card status. | ## GPRS functions ### Public Functions | | Name | | -------------- | -------------- | | bool | **[gprsConnect](class_tiny_gsm_g_p_r_s.md#a23ddc191f39cb31d183d91bc89b4bd44)**(const char * apn, const char * user = nullptr, const char * pwd = nullptr)
Connect to a GPRS network. | | bool | **[gprsDisconnect](class_tiny_gsm_g_p_r_s.md#aa6decbde976ddbdee7e0d5a0047f46da)**()
Disconnect from the GPRS network. | | bool | **[isGprsConnected](class_tiny_gsm_g_p_r_s.md#a047ca5d9e0d99bcc87e5dbce11403aec)**()
Check if currently attached to GPRS/EPS service. | | String | **[getOperator](class_tiny_gsm_g_p_r_s.md#aa80d4559b92f4ab0d4a1142013364821)**()
Get the current network operator. | | String | **[getProvider](class_tiny_gsm_g_p_r_s.md#ab7e7f9a40980a4430c9320f307c0713d)**()
Get the current network provider. | ## GPS (GNSS, GLONASS) functions ### Public Functions | | Name | | -------------- | -------------- | | bool | **[enableGPS](class_tiny_gsm_g_p_s.md#a2e2ba379f9703e75cd9fcccbaa612b14)**()
Enable the GPS module. | | bool | **[disableGPS](class_tiny_gsm_g_p_s.md#a0a241f7bc6888f1f3029bf05a3eb7447)**()
Disable the GPS module. | | String | **[getGPSraw](class_tiny_gsm_g_p_s.md#a72ee31b48c9c88b9e58e0990a49fc070)**()
Get the raw GPS data string. | | bool | **[getGPS](class_tiny_gsm_g_p_s.md#a74e228fb9ee58595c6d009a1cc1ed299)**(float * lat, float * lon, float * speed = 0, float * alt = 0, int * vsat = 0, int * usat = 0, float * accuracy = 0, int * year = 0, int * month = 0, int * day = 0, int * hour = 0, int * minute = 0, int * second = 0)
Get the GPS location data. | | bool | **[getGPSTime](class_tiny_gsm_g_p_s.md#a80b8c15b45600f4ea898ed3a6050c0d4)**(int * year, int * month, int * day, int * hour, int * minute, int * second)
Get the time associated with the GPS data. | | String | **[setGNSSMode](class_tiny_gsm_g_p_s.md#a06c014af9726e678f7ca075a7861b840)**(uint8_t mode, bool dpo)
Set the GNSS mode. | | uint8_t | **[getGNSSMode](class_tiny_gsm_g_p_s.md#a4890bbf0e624e696509d5fb196d50b3a)**()
Get the current GNSS mode. | ## Socket listening functions ### Public Functions | | Name | | -------------- | -------------- | | void | **[maintain](class_tiny_gsm_t_c_p.md#a35e2f8d26fd77dd0c217631b153d41bc)**()
Maintain the modem connection and check for incoming data. | ## Text messaging (SMS) functions ### Public Functions | | Name | | -------------- | -------------- | | String | **[sendUSSD](class_tiny_gsm_s_m_s.md#a0d0e6c715e06650381620ec1417edcfd)**(const String & code)
Send a USSD code to the network. | | bool | **[sendSMS](class_tiny_gsm_s_m_s.md#afbbd31f4c58b16319bef3e3b9e42b5dd)**(const String & number, const String & text)
Send an SMS message. | | bool | **[sendSMS_UTF16](class_tiny_gsm_s_m_s.md#a430127e129d6fb41b643a0364deca94b)**(const char *const number, const void * text, size_t len)
Send an SMS message in UTF-16 encoding. | ## Time functions ### Public Functions | | Name | | -------------- | -------------- | | String | **[getGSMDateTime](class_tiny_gsm_time.md#adaaa4aba622ee5d874fcc2abc6109e84)**([TinyGSMDateTimeFormat](../files/_tiny_gsm_time_8tpp.md#a4d77a5e8d7107365e5ca6f8815ac5714) format)
Get the Date Time as a String. | | bool | **[getNetworkTime](class_tiny_gsm_time.md#a68d9baf6ba1f006441b3d71e5e058cdb)**(int * year, int * month, int * day, int * hour, int * minute, int * second, float * timezone)
Get the date and time as parts. | | bool | **[getNetworkUTCTime](class_tiny_gsm_time.md#ae8e03f2f8c124b8758383ac8c109bc9e)**(int * year, int * month, int * day, int * hour, int * minute, int * second, float * timezone)
Get the date and time as parts in UTC. | | uint32_t | **[getNetworkEpoch](class_tiny_gsm_time.md#a96cf8b52cd88938c4211d17de826376e)**([TinyGSM_EpochStart](../files/_tiny_gsm_time_8tpp.md#a5addcc95a1822928505c18c8b9b9a277) epoch = TinyGSM_EpochStart::UNIX)
Get the Date/Time as an epoch value. | ## NTP server functions ### Public Functions | | Name | | -------------- | -------------- | | bool | **[NTPServerSync](class_tiny_gsm_n_t_p.md#a72a863af36cd16f7f0211b1f1f5105e8)**(const char * server = "pool.ntp.org", int TimeZone = 0)
Synchronize the modem with an NTP server. | | bool | **[waitForTimeSync](class_tiny_gsm_n_t_p.md#a50d239cdcd408a6448ab1e5e1b24504a)**(uint16_t timeout_s = 120)
Wait for the modem to synchronize with the NTP server. | ## GSM location functions ### Public Functions | | Name | | -------------- | -------------- | | String | **[getGsmLocationRaw](class_tiny_gsm_g_s_m_location.md#af00b039ec514996fda8e509f84c48066)**()
Get the raw GSM location data. | | String | **[getGsmLocation](class_tiny_gsm_g_s_m_location.md#a58c3f3447ffd2b0971193c01cd3b249c)**()
Get the GSM location data. | | bool | **[getGsmLocationTime](class_tiny_gsm_g_s_m_location.md#ad75df6e99b6198fa36a881747526b86b)**(int * year, int * month, int * day, int * hour, int * minute, int * second)
Get the time attached to the GSM location data. | ## Battery functions ### Public Functions | | Name | | -------------- | -------------- | | int16_t | **[getBattVoltage](class_tiny_gsm_battery.md#af41311b4c55dea716a0ef6afd14846ac)**()
Get the current battery voltage. | | int8_t | **[getBattPercent](class_tiny_gsm_battery.md#a349ded65e22bc04beb5dd320b58965d6)**()
Get the current battery percent. | | int8_t | **[getBattChargeState](class_tiny_gsm_battery.md#ac2179871063de50df9e3134a049f68b0)**()
Get the battery charging state. | | bool | **[getBattStats](class_tiny_gsm_battery.md#a0aeea9308d460dcd811089c5821eada3)**(int8_t & chargeState, int8_t & percent, int16_t & milliVolts)
Get the all battery state. | ## Public Functions | | Name | | -------------- | -------------- | | String | **[getNetworkModes](class_tiny_gsm_sim70xx.md#a268a375e537d145985f6125f3d286f18)**()
Get the available network modes of the modem. | | int16_t | **[getNetworkMode](class_tiny_gsm_sim70xx.md#a58c6648da882fd8ccb56ec7fdfcf6d6f)**()
Get the current network mode of the modem. | | bool | **[setNetworkMode](class_tiny_gsm_sim70xx.md#a9d65cd4f95243878eb0fd105d3695f7b)**(uint8_t mode)
Set the network mode of the modem. | | String | **[getPreferredModes](class_tiny_gsm_sim70xx.md#a5273db44a8bfc91c12f886d010072d8f)**()
Get the available preferred network modes of the modem. | | int16_t | **[getPreferredMode](class_tiny_gsm_sim70xx.md#a1871b4c4c510098414e11299c9cf921b)**()
Get the current preferred network mode of the modem. | | bool | **[setPreferredMode](class_tiny_gsm_sim70xx.md#a5f76cbbcbc824a358dc0e04738a38e16)**(uint8_t mode)
Set the preferred network mode of the modem. | | bool | **[getNetworkSystemMode](class_tiny_gsm_sim70xx.md#a559092f61fe3268296a30d7fc6ec5661)**(bool & n, int16_t & stat)
Get the network system mode of the modem. | | bool | **[setNetworkSystemMode](class_tiny_gsm_sim70xx.md#ab06db37e92c6732c55ca289e0887a54a)**(bool n)
Set the network system mode of the modem. | ## Public Attributes | | Name | | -------------- | -------------- | | Stream & | **[stream](class_tiny_gsm_sim70xx.md#ae0822b8efe8751d6e0cd43a815fd10e8)**
Stream used to communicate with the modem. | ## Public Types Documentation ### classGsmClientSim7000 ### typedefregStatusType ```cpp ; ``` ## Public Functions Documentation ### functiongetNetworkModes ```cpp String getNetworkModes() ``` - **Return**: A string representing the available network modes. ### functiongetNetworkMode ```cpp int16_t getNetworkMode() ``` - **Return**: The current network mode as an integer. ### functionsetNetworkMode ```cpp bool setNetworkMode(uint8_t mode) ``` - **Parameters**: - **mode** The network mode to set. - **Return**: True if the operation was successful, false otherwise. ### functiongetPreferredModes ```cpp String getPreferredModes() ``` - **Return**: A string representing the available preferred network modes. ### functiongetPreferredMode ```cpp int16_t getPreferredMode() ``` - **Return**: The current preferred network mode as an integer. ### functionsetPreferredMode ```cpp bool setPreferredMode(uint8_t mode) ``` - **Parameters**: - **mode**

The preferred network mode to set.

- **Return**: True if the operation was successful, false otherwise. ### functiongetNetworkSystemMode ```cpp bool getNetworkSystemMode(bool & n, int16_t & stat) ``` - **Parameters**: - **n** A reference to a boolean that will be set to true if the modem is in automatic reporting mode, false otherwise. - **stat** A reference to an integer that will be set to the current service status. 0 if not connected. - **Return**: True if the operation was successful, false otherwise. ### functionsetNetworkSystemMode ```cpp bool setNetworkSystemMode(bool n) ``` - **Parameters**: - **n** A boolean indicating whether to enable automatic reporting of the system mode info. - **Return**: True if the operation was successful, false otherwise. ## Public Attributes Documentation ### variablestream ```cpp Stream & stream; ``` ## Public Functions Documentation ### Basic functions #### functionbegin ```cpp bool begin(const char * pin = nullptr) ``` - **Parameters**: - **pin** A pin code to unlock the SIM, if necessary - **Return**: True if the module was set up as expected, false otherwise. #### functioninit ```cpp bool init(const char * pin = nullptr) ``` - **Parameters**: - **pin** A pin code to unlock the SIM, if necessary - **Return**: True if the module was set up as expected, false otherwise. #### functionsendAT ```cpp void sendAT(Args... cmd) ``` - **Parameters**: - **cmd** The commands to send #### functionsetBaud ```cpp bool setBaud(uint32_t baud) ``` > [!NOTE] > After setting and applying the new baud rate, you will have to end() and begin() the serial object. - **Parameters**: - **baud** The baud rate to use - **Return**: True if the baud rate was set successfully, false otherwise. #### functionsetDefaultBaud ```cpp bool setDefaultBaud(uint32_t baud) ``` - **Parameters**: - **baud** The baud rate to set the modem to use after a reset or power cycle. - **Return**: True if the command was successful, false otherwise. #### functionforceModemBaud ```cpp bool forceModemBaud(StreamObject & at_serial, uint32_t targetBaud) ``` Unlike TinyGsmAutoBaud, this function will try to set the baud rate on the modem and will attempt to communicate with the modem at the new baud rate whether or not it gets a response at the old baud rate. This is useful in cases where the modem is set to a baud rate that is just a little too fast for the processor, where you might get a response but it will be garbled and not recognized as a response, because in this case you still want to try to set the baud rate. > [!NOTE] > After setting and applying the new baud rate, you will have to end() and [begin()](class_tiny_gsm_modem.md#ae4397a65939a770e478e29c718d13e59) the serial object. - **Parameters**: - **at_serial** The serial object to use for communicating with the modem - **targetBaud** The final baud rate to try to set the modem to - **Return**: True if the modem responded after the baud rate was set, false otherwise. #### functiontestAT ```cpp bool testAT(uint32_t timeout_ms = 10000L) ``` - **Parameters**: - **timeout_ms** the amount of time to test for; optional with a default value of 10s. - **Return**: True if the module responded to AT commands, false otherwise. #### functionwaitResponse ```cpp int8_t waitResponse(uint32_t timeout_ms, String & data, [GsmConstStr](../files/_tiny_gsm_common_8h.md#a9c8c9c8249f99863e157f8fae76e7cab) r1 = ModemConfig::GSM_OK, [GsmConstStr](../files/_tiny_gsm_common_8h.md#a9c8c9c8249f99863e157f8fae76e7cab) r2 = ModemConfig::GSM_ERROR, [GsmConstStr](../files/_tiny_gsm_common_8h.md#a9c8c9c8249f99863e157f8fae76e7cab) r3 = nullptr, [GsmConstStr](../files/_tiny_gsm_common_8h.md#a9c8c9c8249f99863e157f8fae76e7cab) r4 = nullptr, [GsmConstStr](../files/_tiny_gsm_common_8h.md#a9c8c9c8249f99863e157f8fae76e7cab) r5 = nullptr, [GsmConstStr](../files/_tiny_gsm_common_8h.md#a9c8c9c8249f99863e157f8fae76e7cab) r6 = nullptr, [GsmConstStr](../files/_tiny_gsm_common_8h.md#a9c8c9c8249f99863e157f8fae76e7cab) r7 = nullptr, [GsmConstStr](../files/_tiny_gsm_common_8h.md#a9c8c9c8249f99863e157f8fae76e7cab) r8 = nullptr) ``` - **Parameters**: - **timeout_ms** The time to wait for a response - **data** A string of data to fill in with response results - **r1** The first output to test against, optional with a default value of "OK" - **r2** The second output to test against, optional with a default value of "ERROR" - **r3** The third output to test against, optional with a default value of nullptr - **r4** The fourth output to test against, optional with a default value of nullptr - **r5** The fifth output to test against, optional with a default value of nullptr - **r6** The sixth output to test against, optional with a default value of nullptr - **r7** The seventh output to test against, optional with a default value of nullptr - **r8** The eighth output to test against, optional with a default value of nullptr - **Return**: the index of the response input #### functiongetConfiguredModem ```cpp String getConfiguredModem() ``` > [!TIP] > This does **not** query the modem for its actual manufacture and model, but rather returns the values that were set at compile time. - **Return**: The configured modem manufacture and model based on the compile-time traits. #### functiongetModemInfo ```cpp String getModemInfo() ``` > [!NOTE] > The actual value and style of the response is quite varied - **Return**: Some info about the GSM module. #### functiongetModemName ```cpp String getModemName() ``` - **Return**: The modem name #### functiongetModemManufacturer ```cpp String getModemManufacturer() ``` - **Return**: The modem manufacturer #### functiongetModemModel ```cpp String getModemModel() ``` - **Return**: The modem model, as it calls itself #### functiongetModemRevision ```cpp String getModemRevision() ``` What is returned as the revision may be either a hardware or a firmware version or some combination of both. - **Return**: The modem revision information #### functiongetModemSerialNumber ```cpp String getModemSerialNumber() ``` This is usually equivalent to the IMEI for cellular modems and the MAC address for WiFi modems. - **Return**: The modem serial number #### functionfactoryDefault ```cpp bool factoryDefault() ``` This generally restarts the module as well. - **Return**: True if the module successfully reset to default, false otherwise. ### Power functions #### functionrestart ```cpp bool restart(const char * pin = nullptr) ``` - **Parameters**: - **pin** A pin code to unlock the SIM, if necessary - **Return**: True if the module was successfully restarted, false otherwise. #### functionpoweroff ```cpp bool poweroff() ``` **Deprecated**: [deprecated](deprecated.html#_deprecated000001) - **Deprecated**: deprecated - **Return**: True if the module was successfully powered down, false otherwise. #### functionpowerOff ```cpp bool powerOff() ``` - **Return**: True if the module was successfully powered down, false otherwise. #### functionradioOff ```cpp bool radioOff() ``` - **Return**: True if the module radio was successfully turned off, false otherwise. #### functionsleepEnable ```cpp bool sleepEnable(bool enable = true) ``` For some modules this immediately puts the module to sleep, for others this sets them to be able to sleep based on pin levels. - **Parameters**: - **enable** True to enable sleep, false to disable - **Return**: True if sleep was successfully enabled or disabled, false otherwise. #### functionsetPhoneFunctionality ```cpp bool setPhoneFunctionality(uint8_t fun, bool reset = false) ``` - **Parameters**: - **fun** The phone functionality setting. The value and meaning of this varies by module; check your documentation. - **reset** True to reset the module before changing the functionality. - **Return**: True if the phone functionality was successfully changed, false otherwise. ### Generic network functions #### functiongetRegistrationStatus ```cpp regStatusType getRegistrationStatus() ``` - **Return**: The modem-specific registration status value. #### functionisNetworkConnected ```cpp bool isNetworkConnected() ``` - **Return**: True if the module is connected to the network, false otherwise. #### functionwaitForNetwork ```cpp bool waitForNetwork(uint32_t timeout_ms = 60000L, bool check_signal = false) ``` - **Parameters**: - **timeout_ms** The time to wait for attachment in milliseconds. Optional with a default value of 1 minute. - **check_signal** True to alternate between checking for connection and checking the signal strength. - **Return**: True if the module is now connected to the network, false otherwise. #### functiongetSignalQuality ```cpp int16_t getSignalQuality() ``` This is often a "CSQ" value ranging from 0 to 32, but may be an RSSI or a percent. - **Return**: The signal quality #### functiongetLocalIP ```cpp String getLocalIP() ``` - **Return**: The local IP address #### functionlocalIP ```cpp IPAddress localIP() ``` - **Return**: The local IP address ### Utilities #### functionstreamWrite ```cpp void streamWrite(T last) ``` - **Parameters**: - **last** The value to write. #### functionstreamClear ```cpp void streamClear() ``` > [!WARNING] > Never call this inside of a [waitResponse()](class_tiny_gsm_modem.md#a4416426fc61492fcb761139b85f1535b) call or a URC parser! **Todo**: [todo](todo.html#_todo000022) #### functionstreamDump ```cpp void streamDump(int16_t expected_len) ``` This is good for discarding an expected number of characters from the stream without waiting a full timeout for each character. **Todo**: [todo](todo.html#_todo000023) - **Parameters**: - **expected_len** The number of characters to discard from the stream. ### SIM card functions #### functionsimUnlock ```cpp bool simUnlock(const char * pin) ``` - **Parameters**: - **pin** The PIN code to unlock the SIM card. - **Return**: True if the SIM card was successfully unlocked, false otherwise #### functiongetSimCCID ```cpp String getSimCCID() ``` - **Return**: The SIM card's CCID as a String. #### functiongetIMEI ```cpp String getIMEI() ``` - **Return**: The modem's IMEI as a String. #### functiongetIMSI ```cpp String getIMSI() ``` - **Return**: The modem's IMSI as a String. #### functiongetSimStatus ```cpp [SimStatus](../files/_tiny_gsm_g_p_r_s_8tpp.md#a88faf9e645594ddb7300d159bc0fe5e0) getSimStatus(uint32_t timeout_ms = 10000L) ``` - **Parameters**: - **timeout_ms** The timeout in milliseconds to wait for a response. - **Return**: The SIM card status as a SimStatus enum value. ### GPRS functions #### functiongprsConnect ```cpp bool gprsConnect(const char * apn, const char * user = nullptr, const char * pwd = nullptr) ``` - **Parameters**: - **apn** The Access Point Name (APN) of the network. - **user** The username for the APN (optional). - **pwd** The password for the APN (optional). - **Return**: True if the connection was successful, false otherwise. #### functiongprsDisconnect ```cpp bool gprsDisconnect() ``` - **Return**: True if the disconnection was successful, false otherwise. #### functionisGprsConnected ```cpp bool isGprsConnected() ``` - **Return**: True if connected, false otherwise. #### functiongetOperator ```cpp String getOperator() ``` - **Return**: The current network operator as a String. #### functiongetProvider ```cpp String getProvider() ``` - **Return**: The current network provider as a String. ### GPS (GNSS, GLONASS) functions #### functionenableGPS ```cpp bool enableGPS() ``` - **Return**: True if the GPS module was successfully enabled, false otherwise. #### functiondisableGPS ```cpp bool disableGPS() ``` - **Return**: True if the GPS module was successfully disabled, false otherwise. #### functiongetGPSraw ```cpp String getGPSraw() ``` - **Return**: The raw GPS data string. #### functiongetGPS ```cpp bool getGPS(float * lat, float * lon, float * speed = 0, float * alt = 0, int * vsat = 0, int * usat = 0, float * accuracy = 0, int * year = 0, int * month = 0, int * day = 0, int * hour = 0, int * minute = 0, int * second = 0) ``` - **Parameters**: - **lat** Pointer to store the latitude. - **lon** Pointer to store the longitude. - **speed** Pointer to store the speed (optional). - **alt** Pointer to store the altitude (optional). - **vsat** Pointer to store the number of visible satellites (optional). - **usat** Pointer to store the number of used satellites (optional). - **accuracy** Pointer to store the accuracy (optional). - **year** Pointer to store the year (optional). - **month** Pointer to store the month (optional). - **day** Pointer to store the day (optional). - **hour** Pointer to store the hour (optional). - **minute** Pointer to store the minute (optional). - **second** Pointer to store the second (optional). - **Return**: True if the GPS data was successfully retrieved, false otherwise. #### functiongetGPSTime ```cpp bool getGPSTime(int * year, int * month, int * day, int * hour, int * minute, int * second) ``` - **Parameters**: - **year** Pointer to store the year. - **month** Pointer to store the month. - **day** Pointer to store the day. - **hour** Pointer to store the hour. - **minute** Pointer to store the minute. - **second** Pointer to store the second. - **Return**: True if the GPS time data was successfully retrieved, false otherwise. #### functionsetGNSSMode ```cpp String setGNSSMode(uint8_t mode, bool dpo) ``` - **Parameters**: - **mode** The GNSS mode to set. - **dpo** Whether to enable or disable DPO. - **Return**: The result of the operation. #### functiongetGNSSMode ```cpp uint8_t getGNSSMode() ``` - **Return**: The current GNSS mode. ### Socket listening functions #### functionmaintain ```cpp void maintain() ``` ### Text messaging (SMS) functions #### functionsendUSSD ```cpp String sendUSSD(const String & code) ``` - **Parameters**: - **code** The USSD code to send. - **Return**: The response from the network as a String. #### functionsendSMS ```cpp bool sendSMS(const String & number, const String & text) ``` - **Parameters**: - **number** The recipient's phone number. - **text** The message text. - **Return**: True if the message was successfully sent, false otherwise. #### functionsendSMS_UTF16 ```cpp bool sendSMS_UTF16(const char *const number, const void * text, size_t len) ``` - **Parameters**: - **number** The recipient's phone number. - **text** The message text in UTF-16 encoding. - **len** The length of the message text. - **Return**: True if the message was successfully sent, false otherwise. ### Time functions #### functiongetGSMDateTime ```cpp String getGSMDateTime([TinyGSMDateTimeFormat](../files/_tiny_gsm_time_8tpp.md#a4d77a5e8d7107365e5ca6f8815ac5714) format) ``` - **Parameters**: - **format** The date or time part to get: TinyGSMDateTimeFormat::DATE_FULL, TinyGSMDateTimeFormat::DATE_TIME, or TinyGSMDateTimeFormat::DATE_DATE - **Return**: The date and/or time from the module #### functiongetNetworkTime ```cpp bool getNetworkTime(int * year, int * month, int * day, int * hour, int * minute, int * second, float * timezone) ``` - **Parameters**: - **year** Reference to an int for the year - **month** Reference to an int for the month - **day** Reference to an int for the day - **hour** Reference to an int for the hour - **minute** Reference to an int for the minute - **second** Reference to an int for the second - **timezone** Reference to a float for the timezone - **Return**: True if the references have been filled with valid values from the GSM module, false otherwise. #### functiongetNetworkUTCTime ```cpp bool getNetworkUTCTime(int * year, int * month, int * day, int * hour, int * minute, int * second, float * timezone) ``` - **Parameters**: - **year** Reference to an int for the year - **month** Reference to an int for the month - **day** Reference to an int for the day - **hour** Reference to an int for the hour - **minute** Reference to an int for the minute - **second** Reference to an int for the second - **timezone** Reference to a float for the timezone - **Return**: True if the references have been filled with valid values from the GSM module, false otherwise. #### functiongetNetworkEpoch ```cpp uint32_t getNetworkEpoch([TinyGSM_EpochStart](../files/_tiny_gsm_time_8tpp.md#a5addcc95a1822928505c18c8b9b9a277) epoch = TinyGSM_EpochStart::UNIX) ``` - **Parameters**: - **epoch** The epoch start to use. - **Return**: The offset from the start of the epoch or 0 if the epoch could not be retrieved. ### NTP server functions #### functionNTPServerSync ```cpp bool NTPServerSync(const char * server = "pool.ntp.org", int TimeZone = 0) ``` > [!TIP] > In versions 0.12.0 and prior, this function returned a byte, the meaning of which varied by modem. In some cases the return value indicated success with 0 and failure with other codes. In the current version, it returns a boolean indicating success or failure. - **Parameters**: - **server** The NTP server to use - **TimeZone** The timezone offset - **Return**: True if the synchronization was successful, false otherwise. #### functionwaitForTimeSync ```cpp bool waitForTimeSync(uint16_t timeout_s = 120) ``` - **Parameters**: - **timeout_s** The timeout in seconds - **Return**: True if the modem synchronized successfully, false otherwise. ### GSM location functions #### functiongetGsmLocationRaw ```cpp String getGsmLocationRaw() ``` - **Return**: The raw GSM location data as a String. #### functiongetGsmLocation ```cpp String getGsmLocation() ``` - **Return**: The GSM location data as a String. #### functiongetGsmLocationTime ```cpp bool getGsmLocationTime(int * year, int * month, int * day, int * hour, int * minute, int * second) ``` - **Parameters**: - **year** Pointer to store the year. - **month** Pointer to store the month. - **day** Pointer to store the day. - **hour** Pointer to store the hour. - **minute** Pointer to store the minute. - **second** Pointer to store the second. - **Return**: True if the time was successfully retrieved, false otherwise. ### Battery functions #### functiongetBattVoltage ```cpp int16_t getBattVoltage() ``` > [!NOTE] > Unless you have a battery directly connected to your modem module, this will be the input voltage going to the module from your main processor board, not the battery voltage of your main processor. - **Return**: The battery voltage measured by the modem module. #### functiongetBattPercent ```cpp int8_t getBattPercent() ``` > [!NOTE] > Unless you have a battery directly connected to your modem module, this will be the percent from the input voltage going to the module from your main processor board, not the battery percent of your main processor. - **Return**: The current battery percent. #### functiongetBattChargeState ```cpp int8_t getBattChargeState() ``` - **Return**: The battery charge state. #### functiongetBattStats ```cpp bool getBattStats(int8_t & chargeState, int8_t & percent, int16_t & milliVolts) ``` - **Parameters**: - **chargeState** A reference to an int to set to the battery charge state - **percent** A reference to an int to set to the battery percent - **milliVolts** A reference to an int to set to the battery voltage - **Return**: True if the battery stats were updated by the module, false otherwise. ------------------------------- Generated by [Doxygen](https://www.doxygen.nl) and [m.css](https://mcss.mosra.cz/) with templates from [doxybook2](https://github.com/matusnovak/doxybook2) Updated on 2026-09-11