Input module

Input module is used to input received data from GSM device to LwGSM-Lib middleware part. 2 processing options are possible:

Tip

Direct or indirect processing mode is select by setting LWGSM_CFG_INPUT_USE_PROCESS configuration value.

Indirect processing

With indirect processing mode, every received character from GSM physical device is written to intermediate buffer between low-level driver and processing thread.

Function lwgsm_input() is used to write data to buffer, which is later processed by processing thread.

Indirect processing mode allows embedded systems to write received data to buffer from interrupt context (outside threads). As a drawback, its performance is decreased as it involves copying every receive character to intermediate buffer, and may also introduce RAM memory footprint increase.

Direct processing

Direct processing is targeting more advanced host controllers, like STM32 or WIN32 implementation use. It is developed with DMA support in mind, allowing low-level drivers to skip intermediate data buffer and process input bytes directly.

Note

When using this mode, function lwgsm_input_process() must be used and it may only be called from thread context. Processing of input bytes is done in low-level input thread, started by application.

Tip

Check Porting guide for implementation examples.

group LWGSM_INPUT

Input function for received data.

Functions

lwgsmr_t lwgsm_input(const void *data, size_t len)

Write data to input buffer.

Note

LWGSM_CFG_INPUT_USE_PROCESS must be disabled to use this function

Parameters
  • data[in] Pointer to data to write

  • len[in] Number of data elements in units of bytes

Returns

lwgsmOK on success, member of lwgsmr_t enumeration otherwise

lwgsmr_t lwgsm_input_process(const void *data, size_t len)

Process input data directly without writing it to input buffer.

Note

This function may only be used when in OS mode, where single thread is dedicated for input read of AT receive

Note

LWGSM_CFG_INPUT_USE_PROCESS must be enabled to use this function

Parameters
  • data[in] Pointer to received data to be processed

  • len[in] Length of data to process in units of bytes

Returns

lwgsmOK on success, member of lwgsmr_t enumeration otherwise