File tree 7 files changed +43
-2
lines changed
7 files changed +43
-2
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ connected KEYWORD2
42
42
43
43
# FileIO Class
44
44
File KEYWORD2
45
+ BridgeFile KEYWORD2
45
46
seek KEYWORD2
46
47
position KEYWORD2
47
48
size KEYWORD2
Original file line number Diff line number Diff line change 1
1
name =Bridge
2
- version =1.0.7
2
+ version =1.1.0
3
3
author =Arduino
4
4
maintainer =Arduino <
[email protected] >
5
5
sentence =Enables the communication between the Linux processor and the AVR. For Arduino Yún and TRE only.
Original file line number Diff line number Diff line change 18
18
19
19
#include < FileIO.h>
20
20
21
-
21
+ namespace BridgeLib {
22
22
23
23
File::File (BridgeClass &b) : mode(255 ), bridge(b) {
24
24
// Empty
@@ -279,3 +279,5 @@ boolean FileSystemClass::rmdir(const char *filepath) {
279
279
}
280
280
281
281
FileSystemClass FileSystem;
282
+
283
+ }
Original file line number Diff line number Diff line change 25
25
#define FILE_WRITE 1
26
26
#define FILE_APPEND 2
27
27
28
+ namespace BridgeLib {
29
+
28
30
class File : public Stream {
29
31
30
32
public:
@@ -100,4 +102,19 @@ class FileSystemClass {
100
102
101
103
extern FileSystemClass FileSystem;
102
104
105
+ };
106
+
107
+ // We enclose File and FileSystem classes in namespace BridgeLib to avoid
108
+ // conflicts with legacy SD library.
109
+
110
+ // This ensure compatibility with older sketches that uses only Bridge lib
111
+ // (the user can still use File instead of BridgeFile)
112
+ using namespace BridgeLib ;
113
+
114
+ // This allows sketches to use BridgeLib::File together with SD library
115
+ // (you must use BridgeFile instead of File when needed to disambiguate)
116
+ typedef BridgeLib::File BridgeFile;
117
+ typedef BridgeLib::FileSystemClass BridgeFileSystemClass;
118
+ #define BridgeFileSystem BridgeLib::FileSystem
119
+
103
120
#endif
Original file line number Diff line number Diff line change 8
8
9
9
SD KEYWORD1 SD
10
10
File KEYWORD1 SD
11
+ SDFile KEYWORD1 SD
11
12
12
13
#######################################
13
14
# Methods and Functions (KEYWORD2)
Original file line number Diff line number Diff line change 52
52
53
53
#include " SD.h"
54
54
55
+ namespace SDLib {
56
+
55
57
// Used by `getNextPathComponent`
56
58
#define MAX_COMPONENT_LEN 12 // What is max length?
57
59
#define PATH_COMPONENT_BUFFER_LEN MAX_COMPONENT_LEN+1
@@ -614,3 +616,5 @@ void File::rewindDirectory(void) {
614
616
}
615
617
616
618
SDClass SD;
619
+
620
+ };
Original file line number Diff line number Diff line change 23
23
#define FILE_READ O_READ
24
24
#define FILE_WRITE (O_READ | O_WRITE | O_CREAT)
25
25
26
+ namespace SDLib {
27
+
26
28
class File : public Stream {
27
29
private:
28
30
char _name[13 ]; // our name
@@ -104,4 +106,18 @@ class SDClass {
104
106
105
107
extern SDClass SD;
106
108
109
+ };
110
+
111
+ // We enclose File and SD classes in namespace SDLib to avoid conflicts
112
+ // with others legacy libraries that redefines File class.
113
+
114
+ // This ensure compatibility with sketches that uses only SD library
115
+ using namespace SDLib ;
116
+
117
+ // This allows sketches to use SDLib::File with other libraries (in the
118
+ // sketch you must use SDFile instead of File to disambiguate)
119
+ typedef SDLib::File SDFile;
120
+ typedef SDLib::SDClass SDFileSystemClass;
121
+ #define SDFileSystem SDLib::SD
122
+
107
123
#endif
You can’t perform that action at this time.
0 commit comments