RDK Documentation (Open Sourced RDK Components)
btrMgr_persistIface.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2017 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 /**
20  * @file btrMgr_persistIface.h
21  *
22  * @defgroup Persistant_Interface Persistant Interface
23  * This file defines bluetooth manager's Persistent storage interfaces.
24  * @ingroup BTR_MGR
25  *
26  */
27 #ifndef __BTR_MGR_PERSIST_IFCE_H__
28 #define __BTR_MGR_PERSIST_IFCE_H__
29 
30 /**
31  * @addtogroup Persistant_Interface
32  * @{
33  *
34  */
35 
36 #define BTRMGR_NAME_LEN_MAX 64
37 #define BTRMGR_MAX_PERSISTENT_PROFILE_COUNT 5
38 #define BTRMGR_MAX_PERSISTENT_DEVICE_COUNT 5
39 #define BTRMGR_PERSISTENT_DATA_PATH "/opt/lib/bluetooth/btmgrPersist.json"
40 #define BTRMGR_A2DP_SRC_PROFILE_ID "0x110a"
41 #define BTRMGR_A2DP_SINK_PROFILE_ID "0x110b"
42 
43 #ifdef BUILD_SKY
44 #define RDKTV_PERSIST_VOLUME_SKY 1
45 #endif
46 
47 typedef void* tBTRMgrPIHdl;
48 
49 /**
50  * @brief This API initializes bluetooth manager's persistent storage interface.
51  */
52 typedef struct _stBTRMgrPersistDevice {
53  unsigned long long deviceId;
54  int isConnected;
56 
57 typedef struct _stBTRMgrPersistProfile {
58  unsigned char numOfDevices;
59  char profileId[BTRMGR_NAME_LEN_MAX];
60  stBTRMgrPersistDevice deviceList[BTRMGR_MAX_PERSISTENT_DEVICE_COUNT];
62 
64  char limitBeaconDetection[BTRMGR_NAME_LEN_MAX];
66 
67 #ifdef RDKTV_PERSIST_VOLUME_SKY
68 typedef struct _BTRMGR_Volume_PersistentData_t {
69  unsigned char Volume;
70 } BTRMGR_Volume_PersistentData_t;
71 
72 typedef struct _BTRMGR_Mute_PersistentData_t {
73  char Mute[BTRMGR_NAME_LEN_MAX];
74 } BTRMGR_Mute_PersistentData_t;
75 #endif
76 
77 typedef struct _BTRMGR_PersistentData_t {
78  char adapterId[BTRMGR_NAME_LEN_MAX];
79  unsigned short numOfProfiles;
80  stBTRMgrPersistProfile profileList[BTRMGR_NAME_LEN_MAX];
81  char limitBeaconDetection[BTRMGR_NAME_LEN_MAX];
83 
84 
85 typedef struct _BTRMGR_Profile_t {
86  char adapterId[BTRMGR_NAME_LEN_MAX];
87  char profileId[BTRMGR_NAME_LEN_MAX];
88  unsigned long long deviceId;
89  int isConnect;
91 
92 eBTRMgrRet BTRMgr_PI_GetLEBeaconLimitingStatus (BTRMGR_Beacon_PersistentData_t* persistentData);
93 eBTRMgrRet BTRMgr_PI_SetLEBeaconLimitingStatus (BTRMGR_Beacon_PersistentData_t* persistentData);
94 #ifdef RDKTV_PERSIST_VOLUME_SKY
95 eBTRMgrRet BTRMgr_PI_GetVolume (BTRMGR_Volume_PersistentData_t* persistentData);
96 eBTRMgrRet BTRMgr_PI_SetVolume (BTRMGR_Volume_PersistentData_t* persistentData);
97 eBTRMgrRet BTRMgr_PI_GetMute (BTRMGR_Mute_PersistentData_t* persistentData);
98 eBTRMgrRet BTRMgr_PI_SetMute (BTRMGR_Mute_PersistentData_t* persistentData);
99 #endif
100 
101 /**
102  * @brief This API initializes bluetooth manager's persistent storage interface.
103  *
104  * @param[in] hBTRMgrPiHdl Handle to the audio capture interface.
105  *
106  * @return Returns the status of the operation.
107  * @retval eBTRMgrSuccess on success, appropriate error code otherwise.
108  */
109 eBTRMgrRet BTRMgr_PI_Init (tBTRMgrPIHdl* hBTRMgrPiHdl);
110 
111 
112 /**
113 * @brief This API deinitializes bluetooth manager's persistent storage interface.
114 *
115 * @param[in] hBTRMgrPiHdl Handle to the audio capture interface.
116 *
117 * @return Returns the status of the operation.
118 * @retval eBTRMgrSuccess on success, appropriate error code otherwise.
119 */
120 eBTRMgrRet BTRMgr_PI_DeInit (tBTRMgrPIHdl hBTRMgrPiHdl);
121 
122 /**
123  * @brief This API reads all bluetooth profiles from json file and saves to BTRMGR_PersistentData_t structure.
124  *
125  * @param[in] hBTRMgrPiHdl Handle to the audio capture interface.
126  * @param[out] persistentData Structure that fetches persistent profiles data.
127  *
128  * @return Returns the status of the operation.
129  * @retval eBTRMgrSuccess on success, appropriate error code otherwise.
130  */
131 eBTRMgrRet BTRMgr_PI_GetAllProfiles(tBTRMgrPIHdl hBTRMgrPiHdl,BTRMGR_PersistentData_t* persistentData);
132 
133 
134 /**
135  * @brief This API sets all bluetooth profiles.
136  *
137  * @param[in] hBTRMgrPiHdl Handle to the audio capture interface.
138  * @param[in] persistentData Structure that is used to set the profiles data.
139  *
140  * @return Returns the status of the operation.
141  * @retval eBTRMgrSuccess on success, appropriate error code otherwise.
142  */
143 eBTRMgrRet BTRMgr_PI_SetAllProfiles (tBTRMgrPIHdl hBTRMgrPiHdl,BTRMGR_PersistentData_t* persistentData);
144 
145 /**
146  * @brief This API adds a single bluetooth profile to json file.
147  *
148  * @param[in] hBTRMgrPiHdl Handle to the audio capture interface.
149  * @param[in] persistProfile Profile to be added.
150  *
151  * @return Returns the status of the operation.
152  * @retval eBTRMgrSuccess on success, appropriate error code otherwise.
153  */
154 eBTRMgrRet BTRMgr_PI_AddProfile (tBTRMgrPIHdl hBTRMgrPiHdl,BTRMGR_Profile_t* persistProfile);
155 
156 /**
157  * @brief This API removes a single bluetooth profile from json file.
158  *
159  * @param[in] hBTRMgrPiHdl Handle to the persistant storage interface.
160  * @param[in] persistProfile Profile to be removed.
161  *
162  * @return Returns the status of the operation.
163  * @retval eBTRMgrSuccess on success, appropriate error code otherwise.
164  */
165 eBTRMgrRet BTRMgr_PI_RemoveProfile (tBTRMgrPIHdl hBTRMgrPiHdl,BTRMGR_Profile_t* persistProfile);
166 /** @} */
167 
168 #endif /* __BTR_MGR_PERSIST_IFCE_H__ */
_BTRMGR_PersistentData_t
Definition: btrMgr_persistIface.h:77
_stBTRMgrPersistDevice
This API initializes bluetooth manager's persistent storage interface.
Definition: btrMgr_persistIface.h:52
BTRMgr_PI_SetAllProfiles
eBTRMgrRet BTRMgr_PI_SetAllProfiles(tBTRMgrPIHdl hBTRMgrPiHdl, BTRMGR_PersistentData_t *persistentData)
This API sets all bluetooth profiles.
Definition: btrMgr_persistIface.c:552
BTRMgr_PI_Init
eBTRMgrRet BTRMgr_PI_Init(tBTRMgrPIHdl *hBTRMgrPiHdl)
This API initializes bluetooth manager's persistent storage interface.
Definition: btrMgr_persistIface.c:127
_BTRMGR_Profile_t
Definition: btrMgr_persistIface.h:85
eBTRMgrRet
enum _eBTRMgrRet eBTRMgrRet
Represents the bluetooth manager return values.
_BTRMGR_Beacon_PersistentData_t
Definition: btrMgr_persistIface.h:63
BTRMgr_PI_DeInit
eBTRMgrRet BTRMgr_PI_DeInit(tBTRMgrPIHdl hBTRMgrPiHdl)
This API deinitializes bluetooth manager's persistent storage interface.
Definition: btrMgr_persistIface.c:145
BTRMgr_PI_AddProfile
eBTRMgrRet BTRMgr_PI_AddProfile(tBTRMgrPIHdl hBTRMgrPiHdl, BTRMGR_Profile_t *persistProfile)
This API adds a single bluetooth profile to json file.
Definition: btrMgr_persistIface.c:476
BTRMgr_PI_RemoveProfile
eBTRMgrRet BTRMgr_PI_RemoveProfile(tBTRMgrPIHdl hBTRMgrPiHdl, BTRMGR_Profile_t *persistProfile)
This API removes a single bluetooth profile from json file.
Definition: btrMgr_persistIface.c:622
_stBTRMgrPersistProfile
Definition: btrMgr_persistIface.h:57
stBTRMgrPersistDevice
struct _stBTRMgrPersistDevice stBTRMgrPersistDevice
This API initializes bluetooth manager's persistent storage interface.
BTRMgr_PI_GetAllProfiles
eBTRMgrRet BTRMgr_PI_GetAllProfiles(tBTRMgrPIHdl hBTRMgrPiHdl, BTRMGR_PersistentData_t *persistentData)
This API reads all bluetooth profiles from json file and saves to BTRMGR_PersistentData_t structure.
Definition: btrMgr_persistIface.c:370