GamepadCodec Arduino 库 1.0.1
载入中...
搜索中...
未找到
gamepad_codec_data_type.h
浏览该文件的文档.
1#pragma once
2
3#ifndef _GAMEPAD_CODEC_DATA_TYPE_H_
4#define _GAMEPAD_CODEC_DATA_TYPE_H_
5
6#include <stdint.h>
7
8#include "gamepad_input_tracker.h"
9
10/**
11 * @file gamepad_codec_data_type.h
12 */
13
14namespace gamepad::codec {
15/**
16 * @~English
17 * @brief Payload size for DataType::kGamepadInputState.
18 * @details 1 byte type identifier + sizeof(gamepad::input::State).
19 * Use this constant when encoding/decoding this specific data type.
20 */
21/**
22 * @~Chinese
23 * @brief DataType::kGamepadInputState 对应的有效载荷大小。
24 * @details 1 字节类型标识符 + sizeof(gamepad::input::State)。
25 * 编码/解码此特定数据类型时使用此常量。
26 */
27#if __cplusplus >= 201703L
28constexpr inline size_t kGamepadInputStatePayloadSize = sizeof(gamepad::input::State) + 1;
29#else
30static constexpr size_t kGamepadInputStatePayloadSize = sizeof(gamepad::input::State) + 1;
31#endif
32
33/**
34 * @~English
35 * @brief Data type identifiers for the payload.
36 * @details The first byte of the payload identifies the type of data being
37 * transmitted.
38 */
39/**
40 * @~Chinese
41 * @brief 有效载荷的数据类型标识符。
42 * @details 有效载荷的第一个字节标识所传输数据的类型。
43 */
44enum class DataType : uint8_t {
45 /**
46 * @~English
47 * @brief Gamepad input state (buttons + axes).
48 */
49 /**
50 * @~Chinese
51 * @brief 手柄输入状态(按钮 + 摇杆)。
52 */
54};
55
56} // namespace gamepad::codec
57
58#endif
DataType
有效载荷的数据类型标识符。
@ kGamepadInputState
手柄输入状态(按钮 + 摇杆)。