LibJuno 0.42.0
LibJuno is a lightweight C99 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
async_io_api.h
Go to the documentation of this file.
1/*
2 MIT License
3
4 Copyright (c) 2025 Robin A. Onsay
5
6 Permission is hereby granted, free of charge, to any person obtaining
7 a copy of this software and associated documentation files
8 (the "Software"), to deal in the Software without restriction,
9 including without limitation the rights to use, copy, modify, merge,
10 publish, distribute, sublicense, and/or sell copies of the Software,
11 and to permit persons to whom the Software is furnished to do so,
12 subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be
15 included in all copies or substantial portions of the Software.
16*/
17
27#ifndef JUNO_ASYNC_IO_API_H
28#define JUNO_ASYNC_IO_API_H
29#include "juno/status.h"
30#include "juno/module.h"
31#include "juno/time/time_api.h"
32#include <stdbool.h>
33#ifdef __cplusplus
34extern "C"
35{
36#endif
37
39
40typedef union JUNO_ASYNC_IO_TAG JUNO_ASYNC_IO_T;
41typedef struct JUNO_ASYNC_IO_ROOT_TAG JUNO_ASYNC_IO_ROOT_T;
42
44
46{
48 JUNO_STATUS_T (*Read)(JUNO_ASYNC_IO_T *ptIo, char *pcBuff, size_t *pzBuffSize);
50 JUNO_STATUS_T (*TryRead)(JUNO_ASYNC_IO_T *ptIo, char *pcBuff, size_t *pzBuffSize, JUNO_TIME_MICROS_T iTimeoutUs);
52 JUNO_STATUS_T (*ReadUntil)(JUNO_ASYNC_IO_T *ptIo, char *pcBuff, size_t *pzBuffSize, const char *pcStopChars, size_t zSizeStopChars);
54 JUNO_STATUS_T (*TryReadUntil)(JUNO_ASYNC_IO_T *ptIo, char *pcBuff, size_t *pzBuffSize, const char *pcStopChars, size_t zSizeStopChars, JUNO_TIME_MICROS_T iTimeoutUs);
56 JUNO_STATUS_T (*Write)(JUNO_ASYNC_IO_T *ptIo, const void *pvBuff, size_t *pzBuffSize);
58 JUNO_STATUS_T (*TryWrite)(JUNO_ASYNC_IO_T *ptIo, const void *pvBuff, size_t *pzBuffSize, JUNO_TIME_MICROS_T iTimeoutUs);
60 JUNO_STATUS_T (*Poll)(JUNO_ASYNC_IO_T *ptIo, JUNO_TIME_MICROS_T iTimeoutUs, bool *pbHasData);
61};
62
63#ifdef __cplusplus
64}
65#endif
66#endif // JUNO_ASYNC_IO_API_H
union JUNO_ASYNC_IO_TAG JUNO_ASYNC_IO_T
Definition async_io_api.h:40
struct JUNO_ASYNC_IO_ROOT_TAG JUNO_ASYNC_IO_ROOT_T
Definition async_io_api.h:41
#define JUNO_MODULE_EMPTY
Definition module.h:126
#define JUNO_MODULE_ROOT(API_T,...)
Definition module.h:182
int32_t JUNO_STATUS_T
Definition status.h:23
Definition async_io_api.h:46
JUNO_STATUS_T(* TryWrite)(JUNO_ASYNC_IO_T *ptIo, const void *pvBuff, size_t *pzBuffSize, JUNO_TIME_MICROS_T iTimeoutUs)
Try to write the specified number of bytes to the IO.
Definition async_io_api.h:58
JUNO_STATUS_T(* TryReadUntil)(JUNO_ASYNC_IO_T *ptIo, char *pcBuff, size_t *pzBuffSize, const char *pcStopChars, size_t zSizeStopChars, JUNO_TIME_MICROS_T iTimeoutUs)
Try to read from the IO until the set of characters is recieved.
Definition async_io_api.h:54
JUNO_STATUS_T(* ReadUntil)(JUNO_ASYNC_IO_T *ptIo, char *pcBuff, size_t *pzBuffSize, const char *pcStopChars, size_t zSizeStopChars)
Read from the IO until the set of characters is recieved.
Definition async_io_api.h:52
JUNO_STATUS_T(* Poll)(JUNO_ASYNC_IO_T *ptIo, JUNO_TIME_MICROS_T iTimeoutUs, bool *pbHasData)
Poll the IO.
Definition async_io_api.h:60
JUNO_STATUS_T(* TryRead)(JUNO_ASYNC_IO_T *ptIo, char *pcBuff, size_t *pzBuffSize, JUNO_TIME_MICROS_T iTimeoutUs)
Try to read from the IO until timeout expires.
Definition async_io_api.h:50
JUNO_STATUS_T(* Read)(JUNO_ASYNC_IO_T *ptIo, char *pcBuff, size_t *pzBuffSize)
Read the specified number of bytes from the IO.
Definition async_io_api.h:48
JUNO_STATUS_T(* Write)(JUNO_ASYNC_IO_T *ptIo, const void *pvBuff, size_t *pzBuffSize)
Write the specified number of bytes to the IO.
Definition async_io_api.h:56
uint64_t JUNO_TIME_MICROS_T
Definition time_api.h:40