Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
 4.1.99
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

Modem Ubx . More...

Data Structures

struct  modem_ubx_match
 
struct  modem_ubx_script
 
struct  modem_ubx
 
struct  modem_ubx_config
 

Macros

#define MODEM_UBX_MATCH_ARRAY_DEFINE(_name, ...)
 
#define MODEM_UBX_MATCH_DEFINE(_class_id, _msg_id, _handler)
 

Typedefs

typedef void(* modem_ubx_match_callback) (struct modem_ubx *ubx, const struct ubx_frame *frame, size_t len, void *user_data)
 

Functions

int modem_ubx_attach (struct modem_ubx *ubx, struct modem_pipe *pipe)
 Attach pipe to Modem Ubx.
 
void modem_ubx_release (struct modem_ubx *ubx)
 Release pipe from Modem Ubx instance.
 
int modem_ubx_init (struct modem_ubx *ubx, const struct modem_ubx_config *config)
 Initialize Modem Ubx instance.
 
int modem_ubx_run_script (struct modem_ubx *ubx, struct modem_ubx_script *script)
 Writes the ubx frame in script.request and reads back its response (if available)
 
int modem_ubx_run_script_for_each (struct modem_ubx *ubx, struct modem_ubx_script *script, struct ubx_frame *array, size_t array_size)
 

Detailed Description

Modem Ubx .

Macro Definition Documentation

◆ MODEM_UBX_MATCH_ARRAY_DEFINE

#define MODEM_UBX_MATCH_ARRAY_DEFINE ( _name,
... )

#include <zephyr/modem/ubx.h>

Value:
struct modem_ubx_match _name[] = {__VA_ARGS__};
Definition ubx.h:37

◆ MODEM_UBX_MATCH_DEFINE

#define MODEM_UBX_MATCH_DEFINE ( _class_id,
_msg_id,
_handler )

#include <zephyr/modem/ubx.h>

Value:
{ \
.filter = { \
.class = _class_id, \
.id = _msg_id, \
}, \
.handler = _handler, \
}

Typedef Documentation

◆ modem_ubx_match_callback

typedef void(* modem_ubx_match_callback) (struct modem_ubx *ubx, const struct ubx_frame *frame, size_t len, void *user_data)

#include <zephyr/modem/ubx.h>

Function Documentation

◆ modem_ubx_attach()

int modem_ubx_attach ( struct modem_ubx * ubx,
struct modem_pipe * pipe )

#include <zephyr/modem/ubx.h>

Attach pipe to Modem Ubx.

Parameters
ubxModem Ubx instance
pipePipe instance to attach Modem Ubx instance to
Returns
0 if successful
negative errno code if failure
Note
Modem Ubx instance is enabled if successful

◆ modem_ubx_init()

int modem_ubx_init ( struct modem_ubx * ubx,
const struct modem_ubx_config * config )

#include <zephyr/modem/ubx.h>

Initialize Modem Ubx instance.

Parameters
ubxModem Ubx instance
configConfiguration which shall be applied to the Modem Ubx instance
Note
Modem Ubx instance must be attached to a pipe instance

◆ modem_ubx_release()

void modem_ubx_release ( struct modem_ubx * ubx)

#include <zephyr/modem/ubx.h>

Release pipe from Modem Ubx instance.

Parameters
ubxModem Ubx instance

◆ modem_ubx_run_script()

int modem_ubx_run_script ( struct modem_ubx * ubx,
struct modem_ubx_script * script )

#include <zephyr/modem/ubx.h>

Writes the ubx frame in script.request and reads back its response (if available)

For each ubx frame sent, the device responds in 0, 1 or both of the following ways:

  1. The device sends back a UBX-ACK frame to denote 'acknowledge' and 'not-acknowledge'. Note: the message id of UBX-ACK frame determines whether the device acknowledged. Ex: when we send a UBX-CFG frame, the device responds with a UBX-ACK frame.
  2. The device sends back the same frame that we sent to it, with it's payload populated. It's used to get the current configuration corresponding to the frame that we sent. Ex: frame types such as "get" or "poll" ubx frames respond this way. This response (if received) is written to script.response.

This function writes the ubx frame in script.request then reads back it's response. If script.match is not NULL, then every ubx frame received from the device is compared with script.match to check if a match occurred. This could be used to match UBX-ACK frame sent from the device by populating script.match with UBX-ACK that the script expects to receive.

The script terminates when either of the following happens:

  1. script.match is successfully received and matched.
  2. timeout (denoted by script.timeout) occurs.
    Parameters
    ubxModem Ubx instance
    scriptScript to be executed
    Note
    The length of ubx frame in the script.request should not exceed UBX_FRAME_SZ_MAX
    Modem Ubx instance must be attached to a pipe instance
    Returns
    0 if successful
    negative errno code if failure

◆ modem_ubx_run_script_for_each()

int modem_ubx_run_script_for_each ( struct modem_ubx * ubx,
struct modem_ubx_script * script,
struct ubx_frame * array,
size_t array_size )

#include <zephyr/modem/ubx.h>