Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / platform / cc13x2_26x2 / chipOBleProfile.h
1 /*
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *    Copyright (c) 2020 Texas Instruments Incorporated
5  *
6  *    Licensed under the Apache License, Version 2.0 (the "License");
7  *    you may not use this file except in compliance with the License.
8  *    You may obtain a copy of the License at
9  *
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *    Unless required by applicable law or agreed to in writing, software
13  *    distributed under the License is distributed on an "AS IS" BASIS,
14  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *    See the License for the specific language governing permissions and
16  *    limitations under the License.
17  */
18
19 /**
20  *         @file  chipOBLeProfile.h
21  *         This file contains the CHIPOBLE profile definitions and prototypes
22  *         prototypes.
23  */
24
25 #ifndef CHIPOBLEPROFILE_H
26 #define CHIPOBLEPROFILE_H
27
28 #ifdef __cplusplus
29 #include <ble/BleUUID.h>
30 #include <platform/internal/BLEManager.h>
31 #include <platform/internal/CHIPDeviceLayerInternal.h>
32
33 extern "C" {
34 #endif
35
36 /*********************************************************************
37  * INCLUDES
38  */
39
40 /*********************************************************************
41  * CONSTANTS
42  */
43
44 // Simple Keys Profile Services bit fields
45 #define CHIPOBLEPROFILE_SERVICE 0x00000001
46
47 #define CHIPOBLE_SERV_UUID 0xFEAF           // Servuce UUID
48 #define CHIPOBLEPROFILE_TX_CHAR_UUID 0x129D // GATT indications/read
49 #define CHIPOBLEPROFILE_RX_CHAR_UUID 0x119D // GATT Writes
50
51 #define CHIPOBLEPROFILE_SERV_UUID_BASE128(uuid)                                                                                    \
52     0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, LO_UINT16(uuid), HI_UINT16(uuid), 0x00, 0x00
53
54 #define CHIPOBLEPROFILE_CHAR_UUID_BASE128(uuid)                                                                                    \
55     HI_UINT16(uuid), LO_UINT16(uuid), 0x9F, 0x42, 0x9C, 0x4F, 0x9F, 0x95, 0x59, 0x45, 0x3D, 0x26, 0xF5, 0x2E, 0xEE, 0x18
56
57 #define CHIPOBLEPROFILE_TX_CHAR 0  // R uint8 - Profile Characteristic 1 (CHIPOBLE Tx) value
58 #define CHIPOBLEPROFILE_RX_CHAR 1  // W uint8 - Profile Characteristic 2 (CHIPOBLE Rx) value
59 #define CHIPOBLEPROFILE_CCCWrite 2 // Client Characteristic Configuration
60
61 #define CHIPOBLEPROFILE_CHAR_LEN (244)
62 #define CHIPOBLEPROFILE_MAX_DESCRIPTION_LEN (20)
63
64 /*********************************************************************
65  * TYPEDEFS
66  */
67
68 /* Callback when a characteristic value has changed */
69 typedef void (*chipOBleProfileChange_t)(uint8 paramID, uint16 len, uint16_t connHandle);
70
71 typedef struct
72 {
73     chipOBleProfileChange_t pfnchipOBleProfileChange; // Called when characteristic value changes
74 } chipOBleProfileCBs_t;
75
76 /*********************************************************************
77  * API FUNCTIONS
78  */
79
80 /*
81  * CHIPoBLEProfile_AddService- Initializes the CHIPoBLE Profile service by registering
82  *          GATT attributes with the GATT server.
83  *
84  * @param   services - services to add. This is a bit map and can
85  *                     contain more than one service.
86  */
87
88 bStatus_t CHIPoBLEProfile_AddService(uint32 services);
89
90 /*
91  *    CHIPoBLEProfile_RegisterAppCBs - Registers the application callback function.
92  *                    Only call this function once.
93  *
94  *    appCallbacks - pointer to application callbacks.
95  */
96 bStatus_t CHIPoBLEProfile_RegisterAppCBs(chipOBleProfileCBs_t * appCallbacks);
97
98 /*
99  *    CHIPoBLEProfile_SetParameter - Set a Simple GATT Profile parameter.
100  *
101  *    param - Profile parameter ID
102  *    len - length of data to right
103  *    value - pointer to data to write.  This is dependent on
104  *          the parameter ID and WILL be cast to the appropriate
105  *          data type (example: data type of uint16 will be cast to
106  *          uint16 pointer).
107  */
108 bStatus_t CHIPoBLEProfile_SetParameter(uint8 param, uint8 len, void * value, uint8_t taskId);
109
110 /*
111  *    CHIPoBLEProfile_GetParameter - Get a Simple GATT Profile parameter.
112  *
113  *    param - Profile parameter ID
114  *    value - pointer to data to write.  This is dependent on
115  *          the parameter ID and WILL be cast to the appropriate
116  *          data type (example: data type of uint16 will be cast to
117  *          uint16 pointer).
118  */
119 bStatus_t CHIPoBLEProfile_GetParameter(uint8 param, void * value, uint16_t len);
120
121 #ifdef __cplusplus
122 }
123 #endif
124
125 #endif /* CHIPOBLEPROFILE_H */