VSF Documented
vsf_distbus_transport_stream.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __VSF_DISTBUS_TRANSPORT_STREAM_H__
19#define __VSF_DISTBUS_TRANSPORT_STREAM_H__
20
21#include "vsf_cfg.h"
22
23#if VSF_USE_SIMPLE_STREAM == ENABLED
24
25// for stream
27// for bool
29
30#if defined(__VSF_DISTBUS_TRANSPORT_STREAM_CLASS_IMPLEMENT)
31# undef __VSF_DISTBUS_TRANSPORT_STREAM_CLASS_IMPLEMENT
32# define __VSF_CLASS_IMPLEMENT__
33#elif defined(__VSF_DISTBUS_TRANSPORT_STREAM_CLASS_INHERIT__)
34# undef __VSF_DISTBUS_TRANSPORT_STREAM_CLASS_INHERIT__
35# define __VSF_CLASS_INHERIT__
36#endif
37
38#include "utilities/ooc_class.h"
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44/*============================ INCLUDES ======================================*/
45/*============================ MACROS ========================================*/
46/*============================ MACROFIED FUNCTIONS ===========================*/
47/*============================ TYPES =========================================*/
48
50 public_member(
51 // distbus <== stream_rx.rx
52 // distbus ==> stream_tx.tx
53 vsf_stream_t *stream_rx;
54 vsf_stream_t *stream_tx;
55 )
56
57 private_member(
58 struct {
59 void *param;
60 void (*on_inited)(void *param);
61 } callback;
62 struct {
63 uint8_t *buffer;
65
66 struct {
67 void *param;
68 void (*on_sent)(void *p);
69 } callback;
70 bool is_connected;
71 } tx;
72 struct {
73 uint8_t *buffer;
75
76 struct {
77 void *param;
78 void (*on_recv)(void *p);
79 } callback;
80 bool is_connected;
81 } rx;
82 )
83};
84
85/*============================ GLOBAL VARIABLES ==============================*/
86/*============================ PROTOTYPES ====================================*/
87
88extern bool vsf_distbus_transport_stream_init(void *transport, void *p, void (*on_inited)(void *p));
89extern bool vsf_distbus_transport_stream_send(void *transport, uint8_t *buffer, uint_fast32_t size, void *p, void (*on_sent)(void *p));
90extern bool vsf_distbus_transport_stream_recv(void *transport, uint8_t *buffer, uint_fast32_t size, void *p, void (*on_recv)(void *p));
91
92#ifdef __cplusplus
93}
94#endif
95
96#endif // VSF_DISTBUS_TRANSPORT_USE_STREAM
97#endif // __VSF_DISTBUS_TRANSPORT_STREAM_H__
Definition vsf_distbus_transport_stream.h:49
Definition vsf_simple_stream.h:254
#define vsf_class(__name)
Definition ooc_class.h:48
unsigned uint32_t
Definition stdint.h:9
unsigned int uint_fast32_t
Definition stdint.h:27
unsigned char uint8_t
Definition stdint.h:5
bool vsf_distbus_transport_stream_init(void *transport, void *p, void(*on_inited)(void *p))
Definition vsf_distbus_transport_stream.c:130
bool vsf_distbus_transport_stream_recv(void *transport, uint8_t *buffer, uint_fast32_t size, void *p, void(*on_recv)(void *p))
Definition vsf_distbus_transport_stream.c:161
bool vsf_distbus_transport_stream_send(void *transport, uint8_t *buffer, uint_fast32_t size, void *p, void(*on_sent)(void *p))
Definition vsf_distbus_transport_stream.c:151
uint32_t size
Definition vsf_memfs.h:50
vsf simple stream
Generated from commit: vsfteam/vsf@74aa6ce