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

Modem Pipe. 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 (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.

Typedef Documentation

◆ modem_pipe_api_callback

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

Enumeration Type Documentation

◆ modem_pipe_event

#include <include/zephyr/modem/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 <include/zephyr/modem/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 <include/zephyr/modem/pipe.h>

Close pipe.

Parameters
pipePipe instance
timeoutTimeout waiting for pipe to close
Return values
0if pipe open was called closed or pipe was already closed
-errnocode 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 <include/zephyr/modem/pipe.h>

Close pipe asynchronously.

Parameters
pipePipe instance
Note
The MODEM_PIPE_EVENT_CLOSED event is invoked immediately if pipe is already closed.
Return values
0if pipe close was called successfully or pipe was already closed
-errnocode otherwise

◆ modem_pipe_open()

int modem_pipe_open ( struct modem_pipe *  pipe,
k_timeout_t  timeout 
)

#include <include/zephyr/modem/pipe.h>

Open pipe.

Parameters
pipePipe instance
timeoutTimeout waiting for pipe to open
Return values
0if pipe was successfully opened or was already open
-errnocode 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 <include/zephyr/modem/pipe.h>

Open pipe asynchronously.

Parameters
pipePipe instance
Note
The MODEM_PIPE_EVENT_OPENED event is invoked immediately if pipe is already opened.
Return values
0if pipe open was called successfully or pipe was already open
-errnocode otherwise

◆ modem_pipe_receive()

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

#include <include/zephyr/modem/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
Return values
Numberof bytes received from pipe
-EPERMif pipe is closed
-errnocode on error
Warning
This call must be non-blocking

◆ modem_pipe_release()

void modem_pipe_release ( struct modem_pipe *  pipe)

#include <include/zephyr/modem/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 
)

#include <include/zephyr/modem/pipe.h>

Transmit data through pipe.

Parameters
pipePipe to transmit through
bufData to transmit
sizeNumber of bytes to transmit
Return values
Numberof bytes placed in pipe
-EPERMif pipe is closed
-errnocode on error
Warning
This call must be non-blocking