Monado OpenXR Runtime
opengloves_communication.h
Go to the documentation of this file.
1
// Copyright 2019-2022, Collabora, Ltd.
2
// SPDX-License-Identifier: BSL-1.0
3
/*!
4
* @file
5
* @brief Communication structures for OpenGloves
6
* @author Daniel Willmott <web@dan-w.com>
7
* @ingroup drv_opengloves
8
*/
9
10
#pragma once
11
#include <stdint.h>
12
#include <stddef.h>
13
14
#ifdef __cplusplus
15
extern
"C"
{
16
#endif
17
18
/*!
19
* @interface opengloves_communication_device
20
*
21
* Interface for a communication method
22
*
23
* @ingroup drv_opengloves
24
*/
25
struct
opengloves_communication_device
26
{
27
int (*read)(
struct
opengloves_communication_device
*comm_dev,
char
*data,
size_t
size);
28
29
int (*write)(
struct
opengloves_communication_device
*comm_dev,
const
char
*data,
size_t
size);
30
31
void (*destroy)(
struct
opengloves_communication_device
*comm_dev);
32
};
33
34
static
inline
int
35
opengloves_communication_device_read(
struct
opengloves_communication_device
*comm_dev,
char
*data,
size_t
size)
36
{
37
return
comm_dev->read(comm_dev, data, size);
38
}
39
40
static
inline
int
41
opengloves_communication_device_write(
struct
opengloves_communication_device
*comm_dev,
const
char
*data,
size_t
size)
42
{
43
return
comm_dev->write(comm_dev, data, size);
44
}
45
46
47
static
inline
void
48
opengloves_communication_device_destory(
struct
opengloves_communication_device
*comm_dev)
49
{
50
comm_dev->destroy(comm_dev);
51
}
52
53
54
#ifdef __cplusplus
55
}
56
#endif
opengloves_communication_device
Interface for a communication method.
Definition:
opengloves_communication.h:26
drivers
opengloves
communication
opengloves_communication.h
Generated by
1.9.4