FreeCalypso > hg > tcs211-l1-reconst
comparison g23m/condat/ms/src/mfw/mfw_bt_flash.h @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /* | |
2 +-------------------------------------------------------------------+ | |
3 | PROJECT: MMI-Framework (8445) $Workfile:: mfw_bt_flash.h $| | |
4 | $Author:: Thomas Sommer $Revision:: 1 $| | |
5 | CREATED: 17.04.04 $Modtime:: 17.04.04 10:48 $| | |
6 | STATE : code | | |
7 +-------------------------------------------------------------------+ | |
8 | |
9 | |
10 MODULE : MFW_BT_FLASH | |
11 | |
12 PURPOSE : This module contains the functions for MFW Bluetooth Data Base facilities. It is a LOCAL | |
13 DATA BASE, thus doesn't require the BT stack to be started. Just call the mfw_bt_flash_init( ) | |
14 function to be able to use the following functions. | |
15 | |
16 */ | |
17 | |
18 #ifndef DEF_MFW_BT_FLASH_HEADER | |
19 #define DEF_MFW_BT_FLASH_HEADER | |
20 | |
21 #include "bta_api.h" | |
22 #include "mfw_bte.h" | |
23 | |
24 /* default values for mfw_bt_default_cfg */ | |
25 #define MFW_BT_ENABLED FALSE | |
26 #define MFW_BT_DISCOVERABLE_MODE TRUE | |
27 #define MFW_BT_DEVICE_NAME "BT Mobile Phone" | |
28 | |
29 /* config and device db paths */ | |
30 #define MFW_BT_CFG_ROOT_PATH "/bt" | |
31 #define MFW_BT_CFG_FILE "conf" | |
32 #define MFW_BT_SEC_FILE "security" | |
33 #define MFW_BT_VAR_ROOT_PATH "/var/bt" | |
34 #define RIV_PATH_SEP "/" | |
35 | |
36 | |
37 #define MFW_BT_MAX_PATH_LENGTH 127 | |
38 | |
39 | |
40 /* this is the core configuration for bta/riviera */ | |
41 typedef struct | |
42 { | |
43 BOOL bt_enable; /* TRUE if bluetooth is enabled */ | |
44 BOOL discoverable; /* discoverable mode FALSE = NONE, TRUE = GENERAL */ | |
45 char local_device_name[MFW_BT_NAME_LENGTH]; /* our device name */ | |
46 } tMFW_BT_CFG; | |
47 | |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | |
54 /* | |
55 ** Bluetooth Flash Manager Profile Prototypes | |
56 */ | |
57 | |
58 /******************************************************************************* | |
59 $Function: mfw_bt_flash_init | |
60 $Description: update the RAM information with the files in flash | |
61 $Returns: TRUE if OK, wrong is something failed => no stored file, and not possible to | |
62 create a new one. Typically, this mean the flash is not formatted. | |
63 $Arguments: None | |
64 *******************************************************************************/ | |
65 BOOL mfw_bt_flash_init( void ); | |
66 | |
67 /******************************************************************************* | |
68 $Function: mfw_bt_read_status | |
69 $Description: update the flash information with the files in flash | |
70 $Returns: TRUE if OK, wrong is something failed => no stored file, and not possible to | |
71 create a new one. Typically, this mean the flash is not formatted | |
72 $Arguments: UINT32, value of bt_enable flag. 1 if enabled. | |
73 *******************************************************************************/ | |
74 BOOL mfw_bt_read_status( void ); | |
75 | |
76 /******************************************************************************* | |
77 $Function: mfw_bt_store_status | |
78 $Description: update the BT status in flash | |
79 $Returns: MFW_BT_SUCCESS if OK, wrong is something failed => no stored file, and not possible to | |
80 create a new one. Typically, this mean the flash is not formatted | |
81 $Arguments: new BT status: TRUE if enabled, FALSE if disabled. | |
82 *******************************************************************************/ | |
83 T_MFW_BT_STATUS mfw_bt_store_status( BOOL new_enable_status ); | |
84 | |
85 /******************************************************************************* | |
86 $Function: mfw_bt_read_visibility | |
87 $Description: read the discoverability setting | |
88 $Returns: discoverability setting => TRUE if visible, FALSE if hidden | |
89 $Arguments: None | |
90 *******************************************************************************/ | |
91 BOOL mfw_bt_read_visibility( void ); | |
92 | |
93 /******************************************************************************* | |
94 $Function: mfw_bt_store_visibility | |
95 $Description: store the discoverability setting | |
96 $Returns: MFW_BT_SUCCESS if OK, MFW_BT_FAIL is something failed | |
97 => no stored file, and not possible to | |
98 create a new one. Typically, this mean the flash is not formatted | |
99 $Arguments: new discoverability setting: TRUE if visible, FALSE if hidden | |
100 *******************************************************************************/ | |
101 T_MFW_BT_STATUS mfw_bt_store_visibility( BOOL new_visibility ); | |
102 | |
103 /******************************************************************************* | |
104 $Function: mfw_bt_read_local_name | |
105 $Description: read local BT name | |
106 $Returns: local BT name. Pointer to a the string in the local database => this has to | |
107 be copied if needed for other things. | |
108 $Arguments: None | |
109 *******************************************************************************/ | |
110 UINT8* mfw_bt_read_local_name( void ); | |
111 | |
112 /******************************************************************************* | |
113 $Function: mfw_bt_store_local_name | |
114 $Description: update the local name in flash | |
115 $Returns: MFW_BT_SUCCESS if OK, MFW_BT_FAIL is something failed | |
116 => typically, this mean the flash is not formatted | |
117 $Arguments: new local name. This data is copied and not freed. | |
118 *******************************************************************************/ | |
119 T_MFW_BT_STATUS mfw_bt_store_local_name( char* new_name ); | |
120 | |
121 | |
122 /******************************************************************************* | |
123 $Function: mfw_bt_flash_store_device | |
124 $Description: stores peer device to NVRAM. If device not already in data base => add it. If | |
125 there, update its information. !!! It will overwrite existing information! Use | |
126 this function wisely!=> typically, call mfw_bt_flash_get_device_info before to | |
127 get the pointer of an existing device, or allocate memory for a new one. | |
128 $Returns: MFW_BT_DATA_BASE_FULL if data base full. MFW_BT_FAIL if not | |
129 able to write in flash. Else, success. | |
130 $Arguments: pointer to a device descriptor. IF NOT ALREADY IN THE DATABASE, WILL BE | |
131 COPIED. IF ALREADY IN THE DATABASE, THE DATA IS NOT COPIED! | |
132 *******************************************************************************/ | |
133 T_MFW_BT_STATUS mfw_bt_flash_store_device( T_MFW_BT_REM_DEVICE * p_rem_device); | |
134 | |
135 /******************************************************************************* | |
136 $Function: mfw_bt_clean_inq_db | |
137 $Description: clean the contents of the inquiry data base in RAM. To be called before each | |
138 new inquiry/discovery. | |
139 $Returns: | |
140 $Arguments: | |
141 *******************************************************************************/ | |
142 void mfw_bt_clean_inq_db( void ); | |
143 | |
144 /******************************************************************************* | |
145 $Function: mfw_bt_add_inq_device | |
146 $Description: copy the information received into the RAM inquiry database. | |
147 $Returns: T_MFW_BT_STATUS. MFW_BT_DATA_BASE_FULL or SUCCESS. | |
148 $Arguments: pointer to an inquiry result. Data is copied. | |
149 *******************************************************************************/ | |
150 T_MFW_BT_STATUS mfw_bt_add_inq_device( T_MFW_BT_DM_INQ_RES* p_rem_device); | |
151 | |
152 /******************************************************************************* | |
153 $Function: mfw_bt_add_disc_device | |
154 $Description: copy the information received into the RAM inquiry database. | |
155 $Returns: T_MFW_BT_STATUS. MFW_BT_DATA_BASE_FULL or SUCCESS. | |
156 $Arguments: pointer to a discovery result. Data is copied. | |
157 *******************************************************************************/ | |
158 T_MFW_BT_STATUS mfw_bt_add_disc_device( T_MFW_BT_DM_DISC_RES* p_rem_device); | |
159 | |
160 /******************************************************************************* | |
161 $Function: mfw_bt_get_device_info | |
162 $Description: gets the device record of a stored device. | |
163 $Returns: NULL if device not found. Pointer to a device structure if found. This data should | |
164 be copied if wanted to be used somewhere else. | |
165 If the device is not stored in Flash, the is_new flag is set => this means it is | |
166 a newly found device ( from an inquiry or discovery result ). | |
167 $Arguments: DB_ADDR of the device wanted. | |
168 *******************************************************************************/ | |
169 T_MFW_BT_REM_DEVICE * mfw_bt_get_device_info(BD_ADDR bd_addr); | |
170 | |
171 /******************************************************************************* | |
172 $Function: mfw_bt_get_device_by_service | |
173 $Description: gets a list of device records corresponding to the given service. If service = 0, | |
174 will return all the stored devices. | |
175 $Returns: T_MFW_BT_STATUS | |
176 $Arguments: services => mask of services to look for | |
177 | |
178 pp_device: a pointer to a T_MFW_BT_REM_DEVICE[MFW_BT_NUM_REM_DEVICE] | |
179 array. THIS MEMORY HAVE TO BE ALLOCATED!!! This function will add the | |
180 pointers one by one into this array!!! The pointers are pointing on local data => | |
181 might need to be copied. | |
182 | |
183 number_of_devices: will be used to return the number of devices matching | |
184 the service mask. | |
185 *******************************************************************************/ | |
186 void mfw_bt_get_device_by_service( T_MFW_BT_SERVICE_MASK services, | |
187 T_MFW_BT_REM_DEVICE ** pp_device, | |
188 UINT8* number_of_devices ); | |
189 | |
190 /******************************************************************************* | |
191 $Function: mfw_bt_flash_delete_device | |
192 $Description: deletes the device from nvram | |
193 $Returns: MFW_BT_FAIL, MFW_BT_SUCCESS, | |
194 MFW_BT_UNKNOWN_DEVICE | |
195 $Arguments: BD_ADDR of the device to remove from flash. | |
196 *******************************************************************************/ | |
197 T_MFW_BT_STATUS mfw_bt_flash_delete_device(BD_ADDR bd_addr); | |
198 | |
199 | |
200 #endif | |
201 | |
202 | |
203 | |
204 |