18
18
19
19
#include < bluefruit.h>
20
20
#include < Nffs.h>
21
+ #include < utility/bonding.h>
21
22
22
23
void setup ()
23
24
{
@@ -29,13 +30,17 @@ void setup()
29
30
30
31
Serial.println ();
31
32
Serial.println (" ----- Before -----\n " );
32
- printDir (" /adafruit/bond" );
33
+ bond_print_list (BLE_GAP_ROLE_PERIPH);
34
+ bond_print_list (BLE_GAP_ROLE_CENTRAL);
33
35
34
36
Bluefruit.clearBonds ();
37
+ Bluefruit.Central .clearBonds ();
35
38
36
39
Serial.println ();
37
40
Serial.println (" ----- After -----\n " );
38
- printDir (" /adafruit/bond" );
41
+
42
+ bond_print_list (BLE_GAP_ROLE_PERIPH);
43
+ bond_print_list (BLE_GAP_ROLE_CENTRAL);
39
44
}
40
45
41
46
void loop ()
@@ -46,54 +51,3 @@ void loop()
46
51
delay (1000 );
47
52
}
48
53
49
- void printDir (const char * cwd)
50
- {
51
- // Open the input folder
52
- NffsDir dir (cwd);
53
-
54
- Serial.println (cwd);
55
-
56
- // File Entry Information which hold file attribute and name
57
- NffsDirEntry dirEntry;
58
-
59
- // Loop through the directory
60
- while ( dir.read (&dirEntry) )
61
- {
62
- // Indentation
63
- Serial.print (" |_ " );
64
-
65
- char eName[64 ];
66
- dirEntry.getName (eName, sizeof (eName));
67
-
68
- char fullpath[256 ];
69
- strcpy (fullpath, cwd);
70
- strcat (fullpath, " /" );
71
- strcat (fullpath, eName);
72
-
73
- Serial.print ( eName );
74
-
75
- if ( dirEntry.isDirectory () )
76
- {
77
- Serial.println (" /" );
78
- }else
79
- {
80
- // Print file size starting from position 50
81
- int pos = 3 + strlen (eName);
82
-
83
- // Print padding
84
- for (int i=pos; i<50 ; i++) Serial.print (' ' );
85
-
86
- // Print at least one extra space in case current position > 50
87
- Serial.print (' ' );
88
-
89
- NffsFile file (fullpath);
90
-
91
- Serial.print ( file.size () );
92
- Serial.println ( " Bytes" );
93
-
94
- file.close ();
95
- }
96
- }
97
-
98
- dir.close ();
99
- }
0 commit comments