aboutsummaryrefslogtreecommitdiff
path: root/inc/bluetooth/profile/server/voice_service.h
blob: 88249d2126cdcff53618fa526600d9fd13b9e275 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/**
*****************************************************************************************
*     Copyright(c) 2015, Realtek Semiconductor Corporation. All rights reserved.
*****************************************************************************************
  * @file     hids_rmc.h
  * @brief    Head file for using Voice Service.
  * @details  Voice service data structs and external functions declaration.
  * @author   Chenjie Jin
  * @date     2019-6-27
  * @version  v1.1
  * *************************************************************************************
  */

/* Define to prevent recursive inclusion */
#ifndef _VOICE_SERVICE_H_
#define _VOICE_SERVICE_H_

#ifdef __cplusplus
extern "C"  {
#endif      /* __cplusplus */


/* Add Includes here */
#include "profile_server.h"
#include "board.h"
#include "app_msg.h"

/** @defgroup Voice_Service Voice Service
  * @brief Voice Service based on GATT
  * @{
  */

/** @defgroup Voice_Service_Exported_Constants Voice Service Exported Constants
  * @brief macros that other .c files may use all defined here
  * @{
  */

///@cond
/** @brief  Voice_Service related UUIDs. */
#define GATT_UUID_VOICE_CHAR_CTL                     0x3A40
#define GATT_UUID_VOICE_CHAR_DATA                    0x3A41
#define GATT_UUID_VOICE_CHAR_CMD                     0x3A42

///@endcond

/** @defgroup Voice_Service_Attribute_Index Voice Service Attribute Index
  * @brief  Index defines for Characteristic's value in Voice_Service
  * @{
  */
#define GATT_SRV_VOICE_CHAR_CTL_VALUE_INDEX             2
#define GATT_SRV_VOICE_CHAR_DATA_VALUE_INDEX            4
#define GATT_SRV_VOICE_CHAR_DATA_CCCD_INDEX             5
#define GATT_SRV_VOICE_CHAR_CMD_VALUE_INDEX             7
#define GATT_SRV_VOICE_CHAR_CMD_CCCD_INDEX              8

/** @} */

/** @defgroup Voice_Service_Upstream_Message Voice Service Upstream Message
  * @brief  Upstream message used to inform application.
  * @{
  */

/** @defgroup Voice_Service_Read_Info Voice Service Read Info
  * @brief  Parameter for read characteristic value.
  * @{
  */
#define VOICE_SVC_READ_PARAM_VOICE_DATA         1
#define VOICE_SVC_READ_PARAM_VOICE_CMD          2
/** @} */

/** @defgroup Voice_Service_Write_Info Voice Service Write Info
  * @brief  Parameter for write characteristic value.
  * @{
  */
#define VOICE_SVC_WRITE_CHAR_CTL_INDEX   1
/** @} */

/** @defgroup Voice_Service_Notify_Indicate_Info Voice Service Notify Indicate Info
  * @brief  Parameter for enable or disable notification or indication.
  * @{
  */
#define  VOICE_NOTIFY_DATA_ENABLE             1
#define  VOICE_NOTIFY_DATA_DISABLE            2
#define  VOICE_NOTIFY_CMD_ENABLE              3
#define  VOICE_NOTIFY_CMD_DISABLE             4
/** @} */

/** @} End of Voice_Service_Upstream_Message */

/** @} End of Voice_Service_Exported_Constants */

/** @defgroup Voice_Service_Exported_Types Voice Service Exported Types
  * @brief  types that other.c files may use all defined here
  * @{
  */

/** Message content */
typedef union
{
    struct
    {
        uint8_t len;
        uint8_t *report;
    } report_data;
} T_VOICE_WRITE_PARAMETER;

/** @struct T_VOICE_WRITE_MSG
  * @brief write message
  */
typedef struct
{
    uint8_t write_type;
    T_VOICE_WRITE_PARAMETER write_parameter;
} T_VOICE_WRITE_MSG;

/** @struct T_VOICE_UPSTREAM_MSG_DATA
  * @brief upstream message
  */
typedef struct
{
    uint8_t notification_indification_index;
    uint8_t read_value_index;
    T_VOICE_WRITE_MSG write;
} T_VOICE_UPSTREAM_MSG_DATA;

/** @struct T_VOICE_CALLBACK_DATA
  * @brief callback data
  */
typedef struct
{
    uint8_t                 conn_id;
    T_SERVICE_CALLBACK_TYPE     msg_type;
    T_VOICE_UPSTREAM_MSG_DATA    msg_data;
} T_VOICE_CALLBACK_DATA;


/** @} End of Voice_Service_Exported_Types */



/** @defgroup Voice_Service_Exported_Functions Voice Service Exported Functions
  * @brief functions that other .c files may use all defined here.
  * @{
  */
uint8_t voice_service_add_service(void *pfn);
/** @} End of Voice_Service_Exported_Functions */

/** @} End of Voice_Service */


#ifdef __cplusplus
}
#endif      /*  __cplusplus */

#endif /* _VOICE_SERVICE_H_ */