LwGSM
- Ring buffer
- Connections
- Debug support
- Device info
- Event management
- File Transfer Protocol
- HTTP
- Input module
- Memory manager
- Network
- Network API
- Network operator
- Packet buffer
- Phonebook
- Ping support
- SIM card
- SMS
- Timeout manager
- Structures and enumerations
- Unicode
- Unstructured Supplementary Service Data
- Utilities
- group LWGSM
Lightweight GSM-AT parser library.
Functions
-
lwgsmr_t lwgsm_init(lwgsm_evt_fn evt_func, const uint32_t blocking)
Init and prepare GSM stack for device operation.
Note
Function must be called from operating system thread context. It creates necessary threads and waits them to start, thus running operating system is important.
When LWGSM_CFG_RESET_ON_INIT is enabled, reset sequence will be sent to device otherwise manual call to lwgsm_reset is required to setup device
- Parameters
evt_func – [in] Global event callback function for all major events
blocking – [in] Status whether command should be blocking or not. Used when LWGSM_CFG_RESET_ON_INIT is enabled.
- Returns
lwgsmOK on success, member of lwgsmr_t enumeration otherwise
-
lwgsmr_t lwgsm_reset(const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
Execute reset and send default commands.
-
lwgsmr_t lwgsm_reset_with_delay(uint32_t delay, const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
Execute reset and send default commands with delay.
- Parameters
delay – [in] Number of milliseconds to wait before initiating first command to device
evt_fn – [in] Callback function called when command is finished. Set to
NULL
when not usedevt_arg – [in] Custom argument for event callback function
blocking – [in] Status whether command should be blocking or not
- Returns
lwgsmOK on success, member of lwgsmr_t enumeration otherwise
-
lwgsmr_t lwgsm_set_func_mode(uint8_t mode, const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
Set modem function mode.
Note
Use this function to set modem to normal or low-power mode
- Parameters
mode – [in] Mode status. Set to
1
for full functionality or0
for low-power mode (no functionality)evt_fn – [in] Callback function called when command is finished. Set to
NULL
when not usedevt_arg – [in] Custom argument for event callback function
blocking – [in] Status whether command should be blocking or not
- Returns
lwgsmOK on success, member of lwgsmr_t enumeration otherwise
-
lwgsmr_t lwgsm_core_lock(void)
Lock stack from multi-thread access, enable atomic access to core.
If lock was
0
prior function call, lock is enabled and increasedNote
Function may be called multiple times to increase locks. Application must take care to call lwgsm_core_unlock the same amount of time to make sure lock gets back to
0
-
lwgsmr_t lwgsm_core_unlock(void)
Unlock stack for multi-thread access.
Used in conjunction with lwgsm_core_lock function
If lock was non-zero before function call, lock is decreased. When
lock == 0
, protection is disabled and other threads may access to core
-
lwgsmr_t lwgsm_device_set_present(uint8_t present, const lwgsm_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
Notify stack if device is present or not.
Use this function to notify stack that device is not physically connected and not ready to communicate with host device
- Parameters
present – [in] Flag indicating device is present
evt_fn – [in] Callback function called when command is finished. Set to
NULL
when not usedevt_arg – [in] Custom argument for event callback function
blocking – [in] Status whether command should be blocking or not
- Returns
lwgsmOK on success, member of lwgsmr_t enumeration otherwise
-
uint8_t lwgsm_device_is_present(void)
Check if device is present.
- Returns
1
on success,0
otherwise
-
uint8_t lwgsm_delay(uint32_t ms)
Delay for amount of milliseconds.
Delay is based on operating system semaphores. It locks semaphore and waits for timeout in
ms
time. Based on operating system, thread may be put to blocked list during delay and may improve execution speed- Parameters
ms – [in] Milliseconds to delay
- Returns
1
on success,0
otherwise
-
lwgsmr_t lwgsm_init(lwgsm_evt_fn evt_func, const uint32_t blocking)