10#ifndef ZEPHYR_MODEM_PIPE_
11#define ZEPHYR_MODEM_PIPE_
49typedef int (*modem_pipe_api_open)(
void *data);
51typedef int (*modem_pipe_api_transmit)(
void *data,
const uint8_t *buf,
size_t size);
53typedef int (*modem_pipe_api_receive)(
void *data,
uint8_t *buf,
size_t size);
55typedef int (*modem_pipe_api_close)(
void *data);
57struct modem_pipe_api {
58 modem_pipe_api_open
open;
59 modem_pipe_api_transmit transmit;
60 modem_pipe_api_receive receive;
61 modem_pipe_api_close
close;
64enum modem_pipe_state {
65 MODEM_PIPE_STATE_CLOSED = 0,
66 MODEM_PIPE_STATE_OPEN,
71 struct modem_pipe_api *api;
74 enum modem_pipe_state
state;
77 uint8_t receive_ready_pending : 1;
78 uint8_t transmit_idle_pending : 1;
88void modem_pipe_init(
struct modem_pipe *pipe,
void *data,
struct modem_pipe_api *api);
208void modem_pipe_notify_opened(
struct modem_pipe *pipe);
217void modem_pipe_notify_closed(
struct modem_pipe *pipe);
226void modem_pipe_notify_receive_ready(
struct modem_pipe *pipe);
235void modem_pipe_notify_transmit_idle(
struct modem_pipe *pipe);
static int close(int sock)
POSIX wrapper for zsock_close.
Definition: socket.h:880
int modem_pipe_open_async(struct modem_pipe *pipe)
Open pipe asynchronously.
int modem_pipe_close(struct modem_pipe *pipe)
Close pipe.
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_close_async(struct modem_pipe *pipe)
Close pipe asynchronously.
int modem_pipe_receive(struct modem_pipe *pipe, uint8_t *buf, size_t size)
Receive data through pipe.
modem_pipe_event
Modem pipe event.
Definition: pipe.h:25
void modem_pipe_release(struct modem_pipe *pipe)
Clear callback.
int modem_pipe_open(struct modem_pipe *pipe)
Open pipe.
void(* modem_pipe_api_callback)(struct modem_pipe *pipe, enum modem_pipe_event event, void *user_data)
Definition: pipe.h:42
@ MODEM_PIPE_EVENT_RECEIVE_READY
Definition: pipe.h:27
@ MODEM_PIPE_EVENT_OPENED
Definition: pipe.h:26
@ MODEM_PIPE_EVENT_TRANSMIT_IDLE
Definition: pipe.h:28
@ MODEM_PIPE_EVENT_CLOSED
Definition: pipe.h:29
int open(const char *name, int flags,...)
state
Definition: parser_state.h:29
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
Definition: kernel.h:3026
Mutex Structure.
Definition: kernel.h:2914