Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Modem Pipe. More...

Data Structures

struct  modem_pipe_data_fragment
 Fragment of multi-part data. More...

Typedefs

typedef void(* modem_pipe_api_callback) (struct modem_pipe *pipe, enum modem_pipe_event event, void *user_data)

Enumerations

enum  modem_pipe_event { MODEM_PIPE_EVENT_OPENED = 0 , MODEM_PIPE_EVENT_RECEIVE_READY , MODEM_PIPE_EVENT_TRANSMIT_IDLE , MODEM_PIPE_EVENT_CLOSED }
 Modem pipe event. More...

Functions

int modem_pipe_open (struct modem_pipe *pipe, k_timeout_t timeout)
 Open pipe.
int modem_pipe_open_async (struct modem_pipe *pipe)
 Open pipe asynchronously.
void modem_pipe_attach (struct modem_pipe *pipe, modem_pipe_api_callback callback, void *user_data)
 Attach pipe to callback.
int modem_pipe_transmit_chain (struct modem_pipe *pipe, const struct modem_pipe_data_fragment *frags, size_t num_frags)
 Transmit a chain of data buffers through pipe.
static int modem_pipe_transmit (struct modem_pipe *pipe, const uint8_t *buf, size_t size)
 Transmit data through pipe.
int modem_pipe_receive (struct modem_pipe *pipe, uint8_t *buf, size_t size)
 Receive data through pipe.
void modem_pipe_release (struct modem_pipe *pipe)
 Clear callback.
int modem_pipe_close (struct modem_pipe *pipe, k_timeout_t timeout)
 Close pipe.
int modem_pipe_close_async (struct modem_pipe *pipe)
 Close pipe asynchronously.

Detailed Description

Modem Pipe.

Since
3.5
Version
1.0.0

Typedef Documentation

◆ modem_pipe_api_callback

typedef void(* modem_pipe_api_callback) (struct modem_pipe *pipe, enum modem_pipe_event event, void *user_data)

#include <pipe.h>

Enumeration Type Documentation

◆ modem_pipe_event

#include <pipe.h>

Modem pipe event.

Enumerator
MODEM_PIPE_EVENT_OPENED 
MODEM_PIPE_EVENT_RECEIVE_READY 
MODEM_PIPE_EVENT_TRANSMIT_IDLE 
MODEM_PIPE_EVENT_CLOSED 

Function Documentation

◆ modem_pipe_attach()

void modem_pipe_attach ( struct modem_pipe * pipe,
modem_pipe_api_callback callback,
void * user_data )

#include <pipe.h>

Attach pipe to callback.

Parameters
pipePipe instance
callbackCallback called when pipe event occurs
user_dataFree to use user data passed with callback
Note
The MODEM_PIPE_EVENT_RECEIVE_READY event is invoked immediately if pipe has pending data ready to receive.

◆ modem_pipe_close()

int modem_pipe_close ( struct modem_pipe * pipe,
k_timeout_t timeout )

#include <pipe.h>

Close pipe.

Parameters
pipePipe instance
timeoutTimeout waiting for pipe to close
Returns
0 if pipe open was called closed or pipe was already closed, negative errno value otherwise
Warning
Be cautious when using this synchronous version of the call. It may block the calling thread, which in the case of the system workqueue can result in a deadlock until this call times out waiting for the pipe to be closed.

◆ modem_pipe_close_async()

int modem_pipe_close_async ( struct modem_pipe * pipe)

#include <pipe.h>

Close pipe asynchronously.

Parameters
pipePipe instance
Note
The MODEM_PIPE_EVENT_CLOSED event is invoked immediately if pipe is already closed.
Returns
0 if pipe close was called successfully or pipe was already closed, negative errno value otherwise

◆ modem_pipe_open()

int modem_pipe_open ( struct modem_pipe * pipe,
k_timeout_t timeout )

#include <pipe.h>

Open pipe.

Parameters
pipePipe instance
timeoutTimeout waiting for pipe to open
Returns
0 if pipe was successfully opened or was already open, negative errno value otherwise
Warning
Be cautious when using this synchronous version of the call. It may block the calling thread, which in the case of the system workqueue can result in a deadlock until this call times out waiting for the pipe to be open.

◆ modem_pipe_open_async()

int modem_pipe_open_async ( struct modem_pipe * pipe)

#include <pipe.h>

Open pipe asynchronously.

Parameters
pipePipe instance
Note
The MODEM_PIPE_EVENT_OPENED event is invoked immediately if pipe is already opened.
Returns
0 if pipe open was called successfully or pipe was already open, negative errno value otherwise

◆ modem_pipe_receive()

int modem_pipe_receive ( struct modem_pipe * pipe,
uint8_t * buf,
size_t size )

#include <pipe.h>

Receive data through pipe.

Parameters
pipePipe to receive from
bufDestination for received data; must not be already in use in a modem module.
sizeCapacity of destination for received data
Returns
Number of bytes received from pipe (0 if pipe closed), negative errno value on error
Warning
This call must be non-blocking

◆ modem_pipe_release()

void modem_pipe_release ( struct modem_pipe * pipe)

#include <pipe.h>

Clear callback.

Parameters
pipePipe instance

◆ modem_pipe_transmit()

int modem_pipe_transmit ( struct modem_pipe * pipe,
const uint8_t * buf,
size_t size )
inlinestatic

#include <pipe.h>

Transmit data through pipe.

Parameters
pipePipe to transmit through
bufData to transmit
sizeNumber of bytes to transmit
Returns
Number of bytes placed in pipe (0 if pipe closed), negative errno value on error
Warning
This call must be non-blocking

◆ modem_pipe_transmit_chain()

int modem_pipe_transmit_chain ( struct modem_pipe * pipe,
const struct modem_pipe_data_fragment * frags,
size_t num_frags )

#include <pipe.h>

Transmit a chain of data buffers through pipe.

Parameters
pipePipe to transmit through
fragsArray of data fragments to transmit
num_fragsNumber of fragments in frags
Returns
Number of bytes placed in pipe (0 if pipe closed), negative errno value on error
Warning
This call must be non-blocking