mbed based IoT Gateway More details http://blog.thiseldo.co.uk/wp-filez/IoTGateway.pdf

Dependencies:   NetServices FatFileSystem csv_parser mbed MQTTClient RF12B DNSResolver SDFileSystem

Committer:
SomeRandomBloke
Date:
Mon Apr 02 22:05:20 2012 +0000
Revision:
0:a29a0225f203
Initial version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
SomeRandomBloke 0:a29a0225f203 1 /* mbed Microcontroller Library - FATFileSystem
SomeRandomBloke 0:a29a0225f203 2 * Copyright (c) 2008, sford
SomeRandomBloke 0:a29a0225f203 3 */
SomeRandomBloke 0:a29a0225f203 4
SomeRandomBloke 0:a29a0225f203 5 /* Library: FATFileSystem.h
SomeRandomBloke 0:a29a0225f203 6 * A library of stuff to make a fat filesystem on top of a block device
SomeRandomBloke 0:a29a0225f203 7 */
SomeRandomBloke 0:a29a0225f203 8
SomeRandomBloke 0:a29a0225f203 9 #ifndef MBED_FATFILESYSTEM_H
SomeRandomBloke 0:a29a0225f203 10 #define MBED_FATFILESYSTEM_H
SomeRandomBloke 0:a29a0225f203 11
SomeRandomBloke 0:a29a0225f203 12 #ifndef FFSDEBUG_ENABLED
SomeRandomBloke 0:a29a0225f203 13 #define FFSDEBUG_ENABLED 0
SomeRandomBloke 0:a29a0225f203 14 #endif
SomeRandomBloke 0:a29a0225f203 15
SomeRandomBloke 0:a29a0225f203 16 #if FFSDEBUG_ENABLED
SomeRandomBloke 0:a29a0225f203 17 #define FFSDEBUG(FMT, ...) printf(FMT, ##__VA_ARGS__)
SomeRandomBloke 0:a29a0225f203 18 #else
SomeRandomBloke 0:a29a0225f203 19 #define FFSDEBUG(FMT, ...)
SomeRandomBloke 0:a29a0225f203 20 #endif
SomeRandomBloke 0:a29a0225f203 21
SomeRandomBloke 0:a29a0225f203 22 #include "FileSystemLike.h"
SomeRandomBloke 0:a29a0225f203 23 #include "FileHandle.h"
SomeRandomBloke 0:a29a0225f203 24 #include "ff.h"
SomeRandomBloke 0:a29a0225f203 25 #include "diskio.h"
SomeRandomBloke 0:a29a0225f203 26
SomeRandomBloke 0:a29a0225f203 27 namespace mbed {
SomeRandomBloke 0:a29a0225f203 28 /* Class: FATFileSystem
SomeRandomBloke 0:a29a0225f203 29 * The class itself
SomeRandomBloke 0:a29a0225f203 30 */
SomeRandomBloke 0:a29a0225f203 31 class FATFileSystem : public FileSystemLike {
SomeRandomBloke 0:a29a0225f203 32 public:
SomeRandomBloke 0:a29a0225f203 33
SomeRandomBloke 0:a29a0225f203 34 FATFileSystem(const char* n);
SomeRandomBloke 0:a29a0225f203 35 virtual ~FATFileSystem();
SomeRandomBloke 0:a29a0225f203 36
SomeRandomBloke 0:a29a0225f203 37 /* Function: open
SomeRandomBloke 0:a29a0225f203 38 * open a file on the filesystem. never called directly
SomeRandomBloke 0:a29a0225f203 39 */
SomeRandomBloke 0:a29a0225f203 40 virtual FileHandle *open(const char* name, int flags);
SomeRandomBloke 0:a29a0225f203 41 virtual int remove(const char *filename);
SomeRandomBloke 0:a29a0225f203 42 virtual int format();
SomeRandomBloke 0:a29a0225f203 43 virtual DirHandle *opendir(const char *name);
SomeRandomBloke 0:a29a0225f203 44 virtual int mkdir(const char *name, mode_t mode);
SomeRandomBloke 0:a29a0225f203 45
SomeRandomBloke 0:a29a0225f203 46 FATFS _fs; // Work area (file system object) for logical drive
SomeRandomBloke 0:a29a0225f203 47 static FATFileSystem *_ffs[_VOLUMES]; // FATFileSystem objects, as parallel to FatFs drives array
SomeRandomBloke 0:a29a0225f203 48 int _fsid;
SomeRandomBloke 0:a29a0225f203 49
SomeRandomBloke 0:a29a0225f203 50 virtual int disk_initialize() { return 0; }
SomeRandomBloke 0:a29a0225f203 51 virtual int disk_status() { return 0; }
SomeRandomBloke 0:a29a0225f203 52 virtual int disk_read(char *buffer, int sector) = 0;
SomeRandomBloke 0:a29a0225f203 53 virtual int disk_write(const char *buffer, int sector) = 0;
SomeRandomBloke 0:a29a0225f203 54 virtual int disk_sync() { return 0; }
SomeRandomBloke 0:a29a0225f203 55 virtual int disk_sectors() = 0;
SomeRandomBloke 0:a29a0225f203 56
SomeRandomBloke 0:a29a0225f203 57 };
SomeRandomBloke 0:a29a0225f203 58
SomeRandomBloke 0:a29a0225f203 59 }
SomeRandomBloke 0:a29a0225f203 60
SomeRandomBloke 0:a29a0225f203 61 #endif