3 * Copyright (c) 2020 Project CHIP Authors
4 * Copyright (c) 2020 Texas Instruments Incorporated
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 * @file chipOBLeProfile.h
21 * This file contains the CHIPOBLE profile definitions and prototypes
25 #ifndef CHIPOBLEPROFILE_H
26 #define CHIPOBLEPROFILE_H
29 #include <ble/BleUUID.h>
30 #include <platform/internal/BLEManager.h>
31 #include <platform/internal/CHIPDeviceLayerInternal.h>
36 /*********************************************************************
40 /*********************************************************************
44 // Simple Keys Profile Services bit fields
45 #define CHIPOBLEPROFILE_SERVICE 0x00000001
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
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
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
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
61 #define CHIPOBLEPROFILE_CHAR_LEN (244)
62 #define CHIPOBLEPROFILE_MAX_DESCRIPTION_LEN (20)
64 /*********************************************************************
68 /* Callback when a characteristic value has changed */
69 typedef void (*chipOBleProfileChange_t)(uint8 paramID, uint16 len, uint16_t connHandle);
73 chipOBleProfileChange_t pfnchipOBleProfileChange; // Called when characteristic value changes
74 } chipOBleProfileCBs_t;
76 /*********************************************************************
81 * CHIPoBLEProfile_AddService- Initializes the CHIPoBLE Profile service by registering
82 * GATT attributes with the GATT server.
84 * @param services - services to add. This is a bit map and can
85 * contain more than one service.
88 bStatus_t CHIPoBLEProfile_AddService(uint32 services);
91 * CHIPoBLEProfile_RegisterAppCBs - Registers the application callback function.
92 * Only call this function once.
94 * appCallbacks - pointer to application callbacks.
96 bStatus_t CHIPoBLEProfile_RegisterAppCBs(chipOBleProfileCBs_t * appCallbacks);
99 * CHIPoBLEProfile_SetParameter - Set a Simple GATT Profile parameter.
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
108 bStatus_t CHIPoBLEProfile_SetParameter(uint8 param, uint8 len, void * value, uint8_t taskId);
111 * CHIPoBLEProfile_GetParameter - Get a Simple GATT Profile parameter.
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
119 bStatus_t CHIPoBLEProfile_GetParameter(uint8 param, void * value, uint16_t len);
125 #endif /* CHIPOBLEPROFILE_H */