comparison src/aci2/mfw/mfw_bt_flash.c @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
1 /*
2 +-------------------------------------------------------------------+
3 | PROJECT: MMI-Framework (8445) $Workfile:: mfw_bt_flash.c $|
4 | $Author:: Thomas Sommer $Revision:: 1 $|
5 | CREATED: 03.05.04 $Modtime:: 22.04.04 11:07 $|
6 | STATE : code |
7 +-------------------------------------------------------------------+
8
9
10 MODULE : MFW_BT_DB
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
19 #define ENTITY_MFW
20
21 #include <string.h>
22
23 #if defined (NEW_FRAME)
24
25 #include "typedefs.h"
26 #include "vsi.h"
27 #include "pei.h"
28 #include "custom.h"
29 #include "gsm.h"
30
31 #else
32
33 #include "STDDEFS.H"
34 #include "custom.h"
35 #include "gsm.h"
36 #include "vsi.h"
37
38 #endif
39
40 #include "mfw_ffs.h"
41 #include "mfw_bte.h"
42 #include "mfw_bt_dm.h"
43 #include "mfw_bt_geh.h"
44 #include "mfw_bt_flash.h"
45
46
47 /*****************************************************************************
48 ** Constants. Please do not modify length of the parameters, because of alignement
49 constraints in flash
50 *****************************************************************************/
51
52
53 /* this is the template for the conf file in case it does not exist or is corrupted */
54
55 static const tMFW_BT_CFG mfw_bt_default_cfg = {
56 MFW_BT_ENABLED,
57 MFW_BT_DISCOVERABLE_MODE,
58 NULL
59 };
60
61 /* Also keep an image of the flash file in RAM */
62 static tMFW_BT_CFG mfw_bt_current_cfg;
63
64 /* we store the devices data base in a static structure because it will be loaded each time
65 the phone is powered on: there is no need here to allocate/free memory dynamically . */
66 static T_MFW_BT_REM_DEVICE mfw_bt_device_db[MFW_BT_NUM_REM_DEVICE];
67 const UINT8 MFW_BT_FLASH_DB_SIZE = MFW_BT_NUM_REM_DEVICE*sizeof(T_MFW_BT_REM_DEVICE);
68
69 /* newly found devices => RAM database */
70 static T_MFW_BT_REM_DEVICE mfw_bt_inq_db[MFW_BT_NUM_REM_DEVICE];
71
72
73 /*
74 * Local functions
75 */
76
77 /* update the device data base in flash */
78 static int mfw_bt_flash_store_db(void);
79 /* load the device data base in RAM */
80 static int mfw_bt_flash_read_db(void);
81 /* store config file in flash */
82 static int mfw_bt_flash_store_cfg( void );
83 /* load config file in RAM */
84 static int mfw_bt_flash_read_cfg( void );
85
86
87
88 /*******************************************************************************
89
90 $Function: mfw_bt_flash_init
91
92 $Description: update the RAM information with the files in flash
93
94 $Returns: TRUE if OK, wrong is something failed => no stored file, and not possible to
95 create a new one. Typically, this mean the flash is not formatted.
96
97 $Arguments: None
98
99 *******************************************************************************/
100 BOOL mfw_bt_flash_init( void )
101 {
102 int status_db, status_cfg;
103 /* first, read config file */
104 status_cfg = mfw_bt_flash_read_cfg( );
105 /* then load the saved device data base in RAM */
106 status_db = mfw_bt_flash_read_db( );
107 if( status_cfg < 0 || status_db < 0 )
108 /* something wrong happened, notify it */
109 return FALSE;
110
111 return TRUE;
112 }
113
114
115
116
117 /*******************************************************************************
118
119 $Function: mfw_bt_read_status
120
121 $Description: update the flash information with the files in flash
122
123 $Returns: TRUE if OK, wrong is something failed => no stored file, and not possible to
124 create a new one. Typically, this mean the flash is not formatted
125
126 $Arguments: UINT32, value of bt_enable flag. 1 if enabled.
127
128 *******************************************************************************/
129 BOOL mfw_bt_read_status( void )
130 {
131 return mfw_bt_current_cfg.bt_enable;
132 }
133
134
135
136 /*******************************************************************************
137
138 $Function: mfw_bt_store_status
139
140 $Description: update the BT status in flash
141
142 $Returns: MFW_BT_SUCCESS if OK, wrong is something failed => no stored file, and not possible to
143 create a new one. Typically, this mean the flash is not formatted
144
145 $Arguments: new BT status: TRUE if enabled, FALSE if disabled.
146
147 *******************************************************************************/
148 T_MFW_BT_STATUS mfw_bt_store_status( BOOL new_enable_status )
149 {
150 mfw_bt_current_cfg.bt_enable = new_enable_status;
151 if( mfw_bt_flash_store_cfg() != (int)EFFS_OK)
152 return MFW_BT_FAIL;
153
154 return MFW_BT_SUCCESS;
155 }
156
157 /*******************************************************************************
158
159 $Function: mfw_bt_read_visibility
160
161 $Description: read the discoverability setting
162
163 $Returns: discoverability setting => TRUE if visible, FALSE if hidden
164
165 $Arguments: None
166
167 *******************************************************************************/
168 BOOL mfw_bt_read_visibility( void )
169 {
170 return mfw_bt_current_cfg.discoverable;
171 }
172
173 /*******************************************************************************
174
175 $Function: mfw_bt_store_visibility
176
177 $Description: store the discoverability setting
178
179 $Returns: MFW_BT_SUCCESS if OK, MFW_BT_FAIL is something failed
180 => no stored file, and not possible to
181 create a new one. Typically, this mean the flash is not formatted
182
183 $Arguments: new discoverability setting: TRUE if visible, FALSE if hidden
184
185 *******************************************************************************/
186 T_MFW_BT_STATUS mfw_bt_store_visibility( BOOL new_visibility )
187 {
188 mfw_bt_current_cfg.discoverable = new_visibility;
189 if( mfw_bt_flash_store_cfg() != (int)EFFS_OK)
190 return MFW_BT_FAIL;
191
192 return MFW_BT_SUCCESS;
193 }
194
195 /*******************************************************************************
196
197 $Function: mfw_bt_read_local_name
198
199 $Description: read local BT name
200
201 $Returns: local BT name. Pointer to a the string in the local database => this has to
202 be copied if needed for other things.
203
204 $Arguments: None
205
206 *******************************************************************************/
207 UINT8* mfw_bt_read_local_name( void )
208 {
209 return (UINT8*) mfw_bt_current_cfg.local_device_name;
210 }
211
212 /*******************************************************************************
213
214 $Function: mfw_bt_store_local_name
215
216 $Description: update the local name in flash
217
218 $Returns: MFW_BT_SUCCESS if OK, MFW_BT_FAIL is something failed
219 => typically, this mean the flash is not formatted
220
221 $Arguments: new local name. This data is copied and not freed.
222
223 *******************************************************************************/
224 T_MFW_BT_STATUS mfw_bt_store_local_name( char* new_name )
225 {
226 if( new_name == NULL )
227 return MFW_BT_FAIL;
228 mfwStrncpy(mfw_bt_current_cfg.local_device_name, new_name, MFW_BT_NAME_LENGTH);
229
230 if( mfw_bt_flash_store_cfg() != (int)EFFS_OK)
231 return MFW_BT_FAIL;
232
233 return MFW_BT_SUCCESS;
234 }
235
236
237
238
239
240
241 /*******************************************************************************
242
243 $Function: mfw_bt_flash_store_device
244
245 $Description: stores peer device to NVRAM. If device not already in data base => add it. If
246 there, update its information. !!! It will overwrite existing information! Use
247 this function wisely!=> typically, call mfw_bt_flash_get_device_info before to
248 get the pointer of an existing device, or allocate memory for a new one.
249
250 $Returns: MFW_BT_DATA_BASE_FULL if data base full. MFW_BT_FAIL if not
251 able to write in flash. Else, success.
252
253 $Arguments: pointer to a device descriptor. IF NOT ALREADY IN THE DATABASE, WILL BE
254 COPIED. IF ALREADY IN THE DATABASE, THE DATA IS NOT COPIED!
255
256 *******************************************************************************/
257 T_MFW_BT_STATUS mfw_bt_flash_store_device( T_MFW_BT_REM_DEVICE * p_rem_device)
258 {
259 UINT8 i;
260
261 /* first verify if we already have the device in our list */
262 for(i=0; i<MFW_BT_NUM_REM_DEVICE; i++)
263 {
264 if( memcmp(&mfw_bt_device_db[i].bd_addr[0], &p_rem_device->bd_addr[0], BD_ADDR_LEN) == 0)
265 /* ok, we found our device */
266 break;
267 }
268 if(i == MFW_BT_NUM_REM_DEVICE)
269 {
270 /* we are here => our device is not yet known. */
271 for(i=0; i<MFW_BT_NUM_REM_DEVICE; i++)
272 if(!(mfw_bt_device_db[i].in_use))
273 /* we just found an empty record, great. */
274 break;
275 }
276 /* verify if the database is not full */
277 if( i == MFW_BT_NUM_REM_DEVICE)
278 return MFW_BT_DATA_BASE_FULL;
279
280
281 /* we are here. This means either we found our device in the DB, either we have an empty
282 record to fill in with our new device ( typically into the inquiry data base ). So first verify
283 if it's a know device. */
284 if( p_rem_device != &mfw_bt_device_db[i])
285 {
286 /* it's a new record, so copy it in our local db */
287 memcpy(&mfw_bt_device_db[i], p_rem_device, sizeof(T_MFW_BT_REM_DEVICE));
288 }
289 mfw_bt_device_db[i].in_use = TRUE;
290 mfw_bt_device_db[i].is_new = FALSE;
291
292
293
294 /* update data base in nvram */
295 if( mfw_bt_flash_store_db() != EFFS_OK )
296 return MFW_BT_FAIL;
297 return MFW_BT_SUCCESS;
298 }
299
300
301
302 /*******************************************************************************
303
304 $Function: mfw_bt_clean_inq_db
305
306 $Description: clean the contents of the inquiry data base in RAM. To be called before each
307 new inquiry.
308
309 $Returns:
310
311 $Arguments:
312
313 *******************************************************************************/
314 void mfw_bt_clean_inq_db( void )
315 {
316 UINT8 i;
317 /*
318 ** CQ21834 : use the sizeof function to take into account any padding bytes which may have been added
319 */
320 memset( (void*)mfw_bt_inq_db, 0, sizeof(mfw_bt_inq_db));
321 for( i=0;i<MFW_BT_NUM_REM_DEVICE; i++ )
322 mfw_bt_inq_db[i].is_new = TRUE;
323 }
324
325
326
327 /*******************************************************************************
328
329 $Function: mfw_bt_add_inq_device
330
331 $Description: copy the information received into the RAM inquiry database.
332
333 $Returns: T_MFW_BT_STATUS. MFW_BT_DATA_BASE_FULL or SUCCESS.
334
335 $Arguments: pointer to an inquiry result. Data is copied.
336
337 *******************************************************************************/
338 T_MFW_BT_STATUS mfw_bt_add_inq_device( T_MFW_BT_DM_INQ_RES* p_rem_device)
339 {
340 UINT8 i;
341
342 /* first verify if we already have the device in our list */
343 for(i=0; i<MFW_BT_NUM_REM_DEVICE; i++)
344 {
345 if(!(mfw_bt_inq_db[i].in_use))
346 {
347 /* we just found an empty record, great. */
348 break;
349 }
350 else if (memcmp(&mfw_bt_inq_db[i].bd_addr, &p_rem_device->bd_addr, sizeof(BD_ADDR)) == 0)
351 {
352 /* we already know about this device ... just exit indicating SUCCESS */
353 return MFW_BT_SUCCESS;
354 }
355 }
356
357 /* verify if the database is not full */
358 if(i == MFW_BT_NUM_REM_DEVICE)
359 return MFW_BT_DATA_BASE_FULL;
360
361 /* we found an unused device record. Update it */
362 mfw_bt_inq_db[i].in_use = TRUE;
363 memcpy(mfw_bt_inq_db[i].bd_addr, p_rem_device->bd_addr, BD_ADDR_LEN);
364 memcpy(mfw_bt_inq_db[i].dev_class, p_rem_device->dev_class, BD_ADDR_LEN);
365 return MFW_BT_SUCCESS;
366
367 }
368
369
370
371 /*******************************************************************************
372
373 $Function: mfw_bt_add_disc_device
374
375 $Description: copy the information received into the RAM inquiry database.
376
377 $Returns: T_MFW_BT_STATUS. MFW_BT_DATA_BASE_FULL or SUCCESS.
378
379 $Arguments: pointer to a discovery result. Data is copied.
380
381 *******************************************************************************/
382 T_MFW_BT_STATUS mfw_bt_add_disc_device( T_MFW_BT_DM_DISC_RES* p_rem_device)
383 {
384 UINT8 i;
385
386 /* first verify if we already have the device in our list */
387 for(i=0; i<MFW_BT_NUM_REM_DEVICE; i++)
388 {
389 if( memcmp(&mfw_bt_inq_db[i].bd_addr, &p_rem_device->bd_addr, sizeof(BD_ADDR)) == 0)
390 {
391 /* we just found an empty record, great. */
392 break;
393 }
394 }
395
396 /* verify if the database is not full */
397 if(i == MFW_BT_NUM_REM_DEVICE)
398 return MFW_BT_DATA_BASE_FULL;
399
400 /* now update the device with the new informations */
401 mfwStrncpy((char*)mfw_bt_inq_db[i].name, (char*)p_rem_device->name, MFW_BT_NAME_LENGTH);
402 /*
403 ** CQ21834 : Update the Friendly Name also.
404 */
405 mfwStrncpy((char*)mfw_bt_inq_db[i].friendly_name, (char*)p_rem_device->name, MFW_BT_NAME_LENGTH);
406 mfw_bt_inq_db[i].services = p_rem_device->services;
407
408 return MFW_BT_SUCCESS;
409
410 }
411
412 /*******************************************************************************
413
414 $Function: mfw_bt_get_device_info
415
416 $Description: gets the device record of a stored device.
417
418 $Returns: NULL if device not found. Pointer to a device structure if found. This data should
419 be copied if wanted to be used somewhere else.
420 If the device is not stored in Flash, the is_new flag is set => this means it is
421 a newly found device ( from an inquiry or discovery result ).
422
423 $Arguments: DB_ADDR of the device wanted.
424
425
426 *******************************************************************************/
427 T_MFW_BT_REM_DEVICE * mfw_bt_get_device_info(BD_ADDR bd_addr)
428 {
429 UINT8 i;
430 T_MFW_BT_REM_DEVICE *p_device;
431
432 for(i=0; i<MFW_BT_NUM_REM_DEVICE; i++)
433 {
434 if (mfw_bt_device_db[i].in_use)
435 {
436 if(memcmp(&mfw_bt_device_db[i].bd_addr[0], &bd_addr[0], BD_ADDR_LEN) == 0)
437 {
438 return &mfw_bt_device_db[i];
439 }
440 }
441 }
442
443 /* we didn't find our device, look into the inquiry db */
444 for(i=0; i<MFW_BT_NUM_REM_DEVICE; i++)
445 {
446 if (mfw_bt_inq_db[i].in_use)
447 {
448 if(memcmp(&mfw_bt_inq_db[i].bd_addr[0], &bd_addr[0], BD_ADDR_LEN) == 0)
449 {
450 return &mfw_bt_inq_db[i];
451 }
452 }
453 }
454
455 return NULL;
456
457 }
458
459
460 /*******************************************************************************
461
462 $Function: mfw_bt_get_device_by_service
463
464 $Description: gets a list of device records corresponding to the given service. If service = 0,
465 will return all the stored devices.
466
467 $Returns: T_MFW_BT_STATUS
468
469 $Arguments: services => mask of services to look for
470
471 pp_device: a pointer to a T_MFW_BT_REM_DEVICE[MFW_BT_NUM_REM_DEVICE]
472 array. THIS MEMORY HAVE TO BE ALLOCATED!!! This function will add the
473 pointers one by one into this array!!! The pointers are pointing on local data =>
474 might need to be copied.
475 (Note ... The pointer pp_device is a pointer to an ARRAY OF POINTERS of type T_MFW_BT_REM_DEVICE,
476 ie declared in the calling function as T_MFW_BT_REM_DEVICE *ptr_device[MFW_BT_NUM_REM_DEVICE])
477
478 number_of_devices: will be used to return the number of devices matching
479 the service mask.
480
481 *******************************************************************************/
482 void mfw_bt_get_device_by_service( T_MFW_BT_SERVICE_MASK services,
483 T_MFW_BT_REM_DEVICE ** pp_device,
484 UINT8* number_of_devices )
485 {
486 UINT8 i;
487
488 *number_of_devices = 0;
489 if( services == 0 )
490 services = BTA_ALL_SERVICE_MASK;
491
492 for(i=0; i<MFW_BT_NUM_REM_DEVICE; i++)
493 {
494 /*
495 ** CQ21834 : The entry in the known devices database is valid only if the 'in_use' flag is TRUE AND
496 ** the 'is_new' flag is FALSE.
497 */
498 if ( ( mfw_bt_device_db[i].in_use == TRUE ) && (mfw_bt_device_db[i].is_new == FALSE))
499 {
500 if ( (mfw_bt_device_db[i].services & services) != 0 )
501 {
502 MFW_BT_TRACE_P1("mfw_bt_get_device_by_service(), Device %d is Active and matches the criteria", i);
503 pp_device[(*number_of_devices)] = &mfw_bt_device_db[i];
504 (*number_of_devices) ++;
505 }
506 }
507 }
508 return;
509 }
510
511
512
513 /*******************************************************************************
514
515 $Function: mfw_bt_flash_delete_device
516
517 $Description: deletes the device from nvram
518
519 $Returns: MFW_BT_FAIL, MFW_BT_SUCCESS,
520 MFW_BT_UNKNOWN_DEVICE
521
522 $Arguments: BD_ADDR of the device to remove from flash.
523
524 *******************************************************************************/
525 T_MFW_BT_STATUS mfw_bt_flash_delete_device(BD_ADDR bd_addr)
526 {
527 UINT8 i;
528 T_MFW_BT_STATUS status;
529 T_MFW_BT_REM_DEVICE *p_device;
530
531 for(i=0; i<MFW_BT_NUM_REM_DEVICE; i++)
532 {
533 if(memcmp(&mfw_bt_device_db[i].bd_addr[0], &bd_addr[0], BD_ADDR_LEN) == 0)
534 {
535 /*
536 ** CQ21834 : Erase the details from the Device Database and check whether the
537 ** device is in the Inquiry Database. If so, set the 'is_new' flag in the Inquiry Db
538 ** to TRUE to indicate that the device is 'not known'
539 */
540 memset(&mfw_bt_device_db[i], 0x00, sizeof(T_MFW_BT_REM_DEVICE));
541
542 status = mfw_bt_flash_store_device(&mfw_bt_device_db[i]);
543
544 p_device = mfw_bt_get_device_info(bd_addr);
545
546 if (p_device != NULL)
547 {
548 p_device->is_new = TRUE;
549 }
550
551 return status;
552
553 }
554 }
555
556 return MFW_BT_UNKNOWN_DEVICE;
557 }
558
559
560
561
562 /*******************************************************************************
563
564 $Function: mfw_bt_flash_store_db
565
566 $Description: write the whole device data base in flash
567
568 $Returns: =0 if ok, <0 if error ( see ffs code )
569
570 $Arguments: none
571
572 *******************************************************************************/
573 static int mfw_bt_flash_store_db(void)
574 {
575 effs_t status;
576
577 /*
578 ** CQ21834 : use the sizeof function to take into account any padding bytes which may have been added
579 */
580 status = flash_data_write( MFW_BT_CFG_ROOT_PATH,
581 MFW_BT_SEC_FILE,
582 (void *)&mfw_bt_device_db,
583 sizeof(mfw_bt_device_db));
584 if ( status != EFFS_OK )
585 {
586 /* mmh thats bad, well go with stored default config. */
587 MFW_BT_TRACE_P1(" mfw_bt_nv_init_device_db(): flash_data_write failed: %d", status );
588 }
589
590 return (int)status;
591 }
592
593
594
595 /*******************************************************************************
596
597 $Function: mfw_bt_flash_read_cfg
598
599 $Description: load the BT config from flash to RAM
600
601 $Returns: >0 if read ok, =0 if create default ok, <0 if error ( see ffs code )
602
603 $Arguments: none
604
605 *******************************************************************************/
606 static int mfw_bt_flash_read_cfg( void )
607 {
608 int status;
609 effs_t ffs_status;
610
611 /* first, reset RAM-based config */
612 memset(&mfw_bt_current_cfg,0x00,sizeof(mfw_bt_current_cfg));
613
614 /* then read the one in flash */
615 status = flash_data_read ( MFW_BT_CFG_ROOT_PATH,
616 MFW_BT_CFG_FILE,
617 (void *)&mfw_bt_current_cfg,
618 sizeof(tMFW_BT_CFG) );
619 if( status <= 0)
620 {
621 /* no config file? => update the RAM settings with the default ones */
622 mfw_bt_current_cfg.bt_enable = MFW_BT_ENABLED;
623 mfw_bt_current_cfg.discoverable = MFW_BT_DISCOVERABLE_MODE;
624 memset(&mfw_bt_current_cfg.local_device_name, 0x00, MFW_BT_NAME_LENGTH);
625
626 /* then try to create one */
627 MFW_BT_TRACE(" mfw_bt_read_cfg_file(): flash_data_read failed. Create default one.");
628 ffs_status = flash_data_write(MFW_BT_CFG_ROOT_PATH,
629 MFW_BT_CFG_FILE,
630 (void *)&mfw_bt_current_cfg,
631 sizeof(tMFW_BT_CFG));
632 if ( ffs_status != EFFS_OK )
633 {
634 /* mmh thats really bad! */
635 MFW_BT_TRACE_P1(" mfw_bt_read_cfg_file(): flash_data_write failed: %d", ffs_status );
636 status = (int)ffs_status;
637 }
638 else
639 status = sizeof(tMFW_BT_CFG);
640 }
641
642 /* else, nothing to do: mfw_bt_current_cfg has already been updated */
643 return status;
644 }
645
646
647
648
649 /*******************************************************************************
650
651 $Function: mfw_bt_flash_store_cfg
652
653 $Description: writes the cfg file in flash
654
655 $Returns: =0 if ok, <0 if error ( see ffs code )
656
657 $Arguments: none
658
659 *******************************************************************************/
660 static int mfw_bt_flash_store_cfg( void )
661 {
662 effs_t status;
663
664 status = flash_data_write(MFW_BT_CFG_ROOT_PATH,
665 MFW_BT_CFG_FILE,
666 (void *)&mfw_bt_current_cfg,
667 sizeof(mfw_bt_current_cfg));
668 if ( status != EFFS_OK )
669 {
670 /* mmh thats really bad! */
671 MFW_BT_TRACE_P1(" mfw_bt_store_cfg_file(): flash_data_write failed: %d", status );
672 }
673
674 /* else, nothing to do, just return */
675 return (int)status;
676 }
677
678
679
680 /*******************************************************************************
681
682 $Function: mfw_bt_flash_read_db
683
684 $Description: load the device data base from flash to RAM
685
686 $Returns: >0 if read ok, =0 if create default ok, <0 if error ( see ffs code )
687
688 $Arguments: none
689
690 *******************************************************************************/
691 static int mfw_bt_flash_read_db(void)
692 {
693 int status;
694 effs_t ffs_status;
695
696 /* Phone needs to store in nvram some information about other bluetooth devices
697 which it regularly communicates with. The information that has to be stored typically
698 are bdaddr, name, link_key, trust relationship etc. */
699 MFW_BT_TRACE( "mfw_bt_flash_read_db()");
700
701 /* first, reset RAM-based db */
702 memset(&mfw_bt_device_db,0x00,sizeof(mfw_bt_device_db));
703
704 /* try to read existing device database stored in nv-ram */
705 status = flash_data_read( MFW_BT_CFG_ROOT_PATH,
706 MFW_BT_SEC_FILE,
707 (void *)&mfw_bt_device_db,
708 sizeof(mfw_bt_device_db));
709
710 if ( status <= 0 )
711 {
712 /* failed => the device db file doesn't exist. Create an empty one. */
713 MFW_BT_TRACE(" mfw_bt_flash_read_db(): flash_data_read failed. Create one" );
714
715 ffs_status = flash_data_write( MFW_BT_CFG_ROOT_PATH,
716 MFW_BT_SEC_FILE,
717 (void *)&mfw_bt_device_db,
718 sizeof(mfw_bt_device_db));
719
720 if ( ffs_status != EFFS_OK )
721 {
722 /* mmh thats really bad, well go with stored default config. */
723 MFW_BT_TRACE_P1(" mfw_bt_flash_read_db(): flash_data_write failed: %d", ffs_status );
724 status = (int)ffs_status;
725 }
726 else
727 status = sizeof(tMFW_BT_CFG);
728 }
729 return status;
730 }
731
732
733
734
735
736
737