PIR grove sensor that sends the sensed data to Thingspeak.com through the wifi module ESP 8266

Dependencies:   mbed

Committer:
skrawool
Date:
Mon Dec 05 16:39:27 2016 +0000
Revision:
0:3954a906acc2
PIR grove sensor that sends the sensed data to thingspeak through the wifi module ESP 8266

Who changed what in which revision?

UserRevisionLine numberNew contents of line
skrawool 0:3954a906acc2 1 /* mbed Microcontroller Library
skrawool 0:3954a906acc2 2 * Copyright (c) 2006-2013 ARM Limited
skrawool 0:3954a906acc2 3 *
skrawool 0:3954a906acc2 4 * Licensed under the Apache License, Version 2.0 (the "License");
skrawool 0:3954a906acc2 5 * you may not use this file except in compliance with the License.
skrawool 0:3954a906acc2 6 * You may obtain a copy of the License at
skrawool 0:3954a906acc2 7 *
skrawool 0:3954a906acc2 8 * http://www.apache.org/licenses/LICENSE-2.0
skrawool 0:3954a906acc2 9 *
skrawool 0:3954a906acc2 10 * Unless required by applicable law or agreed to in writing, software
skrawool 0:3954a906acc2 11 * distributed under the License is distributed on an "AS IS" BASIS,
skrawool 0:3954a906acc2 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
skrawool 0:3954a906acc2 13 * See the License for the specific language governing permissions and
skrawool 0:3954a906acc2 14 * limitations under the License.
skrawool 0:3954a906acc2 15 */
skrawool 0:3954a906acc2 16 #ifndef MBED_FILESYSTEMLIKE_H
skrawool 0:3954a906acc2 17 #define MBED_FILESYSTEMLIKE_H
skrawool 0:3954a906acc2 18
skrawool 0:3954a906acc2 19 #include "platform/platform.h"
skrawool 0:3954a906acc2 20
skrawool 0:3954a906acc2 21 #include "drivers/FileBase.h"
skrawool 0:3954a906acc2 22 #include "drivers/FileHandle.h"
skrawool 0:3954a906acc2 23 #include "drivers/DirHandle.h"
skrawool 0:3954a906acc2 24
skrawool 0:3954a906acc2 25 namespace mbed {
skrawool 0:3954a906acc2 26 /** \addtogroup drivers */
skrawool 0:3954a906acc2 27 /** @{*/
skrawool 0:3954a906acc2 28
skrawool 0:3954a906acc2 29 /** A filesystem-like object is one that can be used to open files
skrawool 0:3954a906acc2 30 * though it by fopen("/name/filename", mode)
skrawool 0:3954a906acc2 31 *
skrawool 0:3954a906acc2 32 * Implementations must define at least open (the default definitions
skrawool 0:3954a906acc2 33 * of the rest of the functions just return error values).
skrawool 0:3954a906acc2 34 *
skrawool 0:3954a906acc2 35 * @Note Synchronization level: Set by subclass
skrawool 0:3954a906acc2 36 */
skrawool 0:3954a906acc2 37 class FileSystemLike : public FileBase {
skrawool 0:3954a906acc2 38
skrawool 0:3954a906acc2 39 public:
skrawool 0:3954a906acc2 40 /** FileSystemLike constructor
skrawool 0:3954a906acc2 41 *
skrawool 0:3954a906acc2 42 * @param name The name to use for the filesystem.
skrawool 0:3954a906acc2 43 */
skrawool 0:3954a906acc2 44 FileSystemLike(const char *name);
skrawool 0:3954a906acc2 45
skrawool 0:3954a906acc2 46 virtual ~FileSystemLike();
skrawool 0:3954a906acc2 47
skrawool 0:3954a906acc2 48 static DirHandle *opendir();
skrawool 0:3954a906acc2 49 friend class BaseDirHandle;
skrawool 0:3954a906acc2 50
skrawool 0:3954a906acc2 51 /** Opens a file from the filesystem
skrawool 0:3954a906acc2 52 *
skrawool 0:3954a906acc2 53 * @param filename The name of the file to open.
skrawool 0:3954a906acc2 54 * @param flags One of O_RDONLY, O_WRONLY, or O_RDWR, OR'd with
skrawool 0:3954a906acc2 55 * zero or more of O_CREAT, O_TRUNC, or O_APPEND.
skrawool 0:3954a906acc2 56 *
skrawool 0:3954a906acc2 57 * @returns
skrawool 0:3954a906acc2 58 * A pointer to a FileHandle object representing the
skrawool 0:3954a906acc2 59 * file on success, or NULL on failure.
skrawool 0:3954a906acc2 60 */
skrawool 0:3954a906acc2 61 virtual FileHandle *open(const char *filename, int flags) = 0;
skrawool 0:3954a906acc2 62
skrawool 0:3954a906acc2 63 /** Remove a file from the filesystem.
skrawool 0:3954a906acc2 64 *
skrawool 0:3954a906acc2 65 * @param filename the name of the file to remove.
skrawool 0:3954a906acc2 66 * @param returns 0 on success, -1 on failure.
skrawool 0:3954a906acc2 67 */
skrawool 0:3954a906acc2 68 virtual int remove(const char *filename) { (void) filename; return -1; };
skrawool 0:3954a906acc2 69
skrawool 0:3954a906acc2 70 /** Rename a file in the filesystem.
skrawool 0:3954a906acc2 71 *
skrawool 0:3954a906acc2 72 * @param oldname the name of the file to rename.
skrawool 0:3954a906acc2 73 * @param newname the name to rename it to.
skrawool 0:3954a906acc2 74 *
skrawool 0:3954a906acc2 75 * @returns
skrawool 0:3954a906acc2 76 * 0 on success,
skrawool 0:3954a906acc2 77 * -1 on failure.
skrawool 0:3954a906acc2 78 */
skrawool 0:3954a906acc2 79 virtual int rename(const char *oldname, const char *newname) { (void) oldname, (void) newname; return -1; };
skrawool 0:3954a906acc2 80
skrawool 0:3954a906acc2 81 /** Opens a directory in the filesystem and returns a DirHandle
skrawool 0:3954a906acc2 82 * representing the directory stream.
skrawool 0:3954a906acc2 83 *
skrawool 0:3954a906acc2 84 * @param name The name of the directory to open.
skrawool 0:3954a906acc2 85 *
skrawool 0:3954a906acc2 86 * @returns
skrawool 0:3954a906acc2 87 * A DirHandle representing the directory stream, or
skrawool 0:3954a906acc2 88 * NULL on failure.
skrawool 0:3954a906acc2 89 */
skrawool 0:3954a906acc2 90 virtual DirHandle *opendir(const char *name) { (void) name; return NULL; };
skrawool 0:3954a906acc2 91
skrawool 0:3954a906acc2 92 /** Creates a directory in the filesystem.
skrawool 0:3954a906acc2 93 *
skrawool 0:3954a906acc2 94 * @param name The name of the directory to create.
skrawool 0:3954a906acc2 95 * @param mode The permissions to create the directory with.
skrawool 0:3954a906acc2 96 *
skrawool 0:3954a906acc2 97 * @returns
skrawool 0:3954a906acc2 98 * 0 on success,
skrawool 0:3954a906acc2 99 * -1 on failure.
skrawool 0:3954a906acc2 100 */
skrawool 0:3954a906acc2 101 virtual int mkdir(const char *name, mode_t mode) { (void) name, (void) mode; return -1; }
skrawool 0:3954a906acc2 102
skrawool 0:3954a906acc2 103 // TODO other filesystem functions (mkdir, rm, rn, ls etc)
skrawool 0:3954a906acc2 104 };
skrawool 0:3954a906acc2 105
skrawool 0:3954a906acc2 106 } // namespace mbed
skrawool 0:3954a906acc2 107
skrawool 0:3954a906acc2 108 #endif
skrawool 0:3954a906acc2 109
skrawool 0:3954a906acc2 110 /** @}*/