UVic Assistive Technology Lab / Mbed 2 deprecated DSLR_Camera_Gimbal

Dependencies:   mbed ros_lib_kinetic

Committer:
group-UVic-Assistive-Technolog
Date:
Wed Jan 31 05:24:12 2018 +0000
Revision:
0:3a767f41cf04
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
group-UVic-Assistive-Technolog 0:3a767f41cf04 1 /* mbed Microcontroller Library
group-UVic-Assistive-Technolog 0:3a767f41cf04 2 * Copyright (c) 2006-2013 ARM Limited
group-UVic-Assistive-Technolog 0:3a767f41cf04 3 *
group-UVic-Assistive-Technolog 0:3a767f41cf04 4 * Licensed under the Apache License, Version 2.0 (the "License");
group-UVic-Assistive-Technolog 0:3a767f41cf04 5 * you may not use this file except in compliance with the License.
group-UVic-Assistive-Technolog 0:3a767f41cf04 6 * You may obtain a copy of the License at
group-UVic-Assistive-Technolog 0:3a767f41cf04 7 *
group-UVic-Assistive-Technolog 0:3a767f41cf04 8 * http://www.apache.org/licenses/LICENSE-2.0
group-UVic-Assistive-Technolog 0:3a767f41cf04 9 *
group-UVic-Assistive-Technolog 0:3a767f41cf04 10 * Unless required by applicable law or agreed to in writing, software
group-UVic-Assistive-Technolog 0:3a767f41cf04 11 * distributed under the License is distributed on an "AS IS" BASIS,
group-UVic-Assistive-Technolog 0:3a767f41cf04 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
group-UVic-Assistive-Technolog 0:3a767f41cf04 13 * See the License for the specific language governing permissions and
group-UVic-Assistive-Technolog 0:3a767f41cf04 14 * limitations under the License.
group-UVic-Assistive-Technolog 0:3a767f41cf04 15 */
group-UVic-Assistive-Technolog 0:3a767f41cf04 16 #ifndef MBED_DIRHANDLE_H
group-UVic-Assistive-Technolog 0:3a767f41cf04 17 #define MBED_DIRHANDLE_H
group-UVic-Assistive-Technolog 0:3a767f41cf04 18
group-UVic-Assistive-Technolog 0:3a767f41cf04 19 #if defined(__ARMCC_VERSION) || defined(__ICCARM__)
group-UVic-Assistive-Technolog 0:3a767f41cf04 20 # define NAME_MAX 255
group-UVic-Assistive-Technolog 0:3a767f41cf04 21 typedef int mode_t;
group-UVic-Assistive-Technolog 0:3a767f41cf04 22
group-UVic-Assistive-Technolog 0:3a767f41cf04 23 #else
group-UVic-Assistive-Technolog 0:3a767f41cf04 24 # include <sys/syslimits.h>
group-UVic-Assistive-Technolog 0:3a767f41cf04 25 #endif
group-UVic-Assistive-Technolog 0:3a767f41cf04 26
group-UVic-Assistive-Technolog 0:3a767f41cf04 27 #include "FileHandle.h"
group-UVic-Assistive-Technolog 0:3a767f41cf04 28
group-UVic-Assistive-Technolog 0:3a767f41cf04 29 struct dirent {
group-UVic-Assistive-Technolog 0:3a767f41cf04 30 char d_name[NAME_MAX+1];
group-UVic-Assistive-Technolog 0:3a767f41cf04 31 };
group-UVic-Assistive-Technolog 0:3a767f41cf04 32
group-UVic-Assistive-Technolog 0:3a767f41cf04 33 namespace mbed {
group-UVic-Assistive-Technolog 0:3a767f41cf04 34
group-UVic-Assistive-Technolog 0:3a767f41cf04 35 /** Represents a directory stream. Objects of this type are returned
group-UVic-Assistive-Technolog 0:3a767f41cf04 36 * by a FileSystemLike's opendir method. Implementations must define
group-UVic-Assistive-Technolog 0:3a767f41cf04 37 * at least closedir, readdir and rewinddir.
group-UVic-Assistive-Technolog 0:3a767f41cf04 38 *
group-UVic-Assistive-Technolog 0:3a767f41cf04 39 * If a FileSystemLike class defines the opendir method, then the
group-UVic-Assistive-Technolog 0:3a767f41cf04 40 * directories of an object of that type can be accessed by
group-UVic-Assistive-Technolog 0:3a767f41cf04 41 * DIR *d = opendir("/example/directory") (or opendir("/example")
group-UVic-Assistive-Technolog 0:3a767f41cf04 42 * to open the root of the filesystem), and then using readdir(d) etc.
group-UVic-Assistive-Technolog 0:3a767f41cf04 43 *
group-UVic-Assistive-Technolog 0:3a767f41cf04 44 * The root directory is considered to contain all FileLike and
group-UVic-Assistive-Technolog 0:3a767f41cf04 45 * FileSystemLike objects, so the DIR* returned by opendir("/") will
group-UVic-Assistive-Technolog 0:3a767f41cf04 46 * reflect this.
group-UVic-Assistive-Technolog 0:3a767f41cf04 47 */
group-UVic-Assistive-Technolog 0:3a767f41cf04 48 class DirHandle {
group-UVic-Assistive-Technolog 0:3a767f41cf04 49
group-UVic-Assistive-Technolog 0:3a767f41cf04 50 public:
group-UVic-Assistive-Technolog 0:3a767f41cf04 51 /** Closes the directory.
group-UVic-Assistive-Technolog 0:3a767f41cf04 52 *
group-UVic-Assistive-Technolog 0:3a767f41cf04 53 * @returns
group-UVic-Assistive-Technolog 0:3a767f41cf04 54 * 0 on success,
group-UVic-Assistive-Technolog 0:3a767f41cf04 55 * -1 on error.
group-UVic-Assistive-Technolog 0:3a767f41cf04 56 */
group-UVic-Assistive-Technolog 0:3a767f41cf04 57 virtual int closedir()=0;
group-UVic-Assistive-Technolog 0:3a767f41cf04 58
group-UVic-Assistive-Technolog 0:3a767f41cf04 59 /** Return the directory entry at the current position, and
group-UVic-Assistive-Technolog 0:3a767f41cf04 60 * advances the position to the next entry.
group-UVic-Assistive-Technolog 0:3a767f41cf04 61 *
group-UVic-Assistive-Technolog 0:3a767f41cf04 62 * @returns
group-UVic-Assistive-Technolog 0:3a767f41cf04 63 * A pointer to a dirent structure representing the
group-UVic-Assistive-Technolog 0:3a767f41cf04 64 * directory entry at the current position, or NULL on reaching
group-UVic-Assistive-Technolog 0:3a767f41cf04 65 * end of directory or error.
group-UVic-Assistive-Technolog 0:3a767f41cf04 66 */
group-UVic-Assistive-Technolog 0:3a767f41cf04 67 virtual struct dirent *readdir()=0;
group-UVic-Assistive-Technolog 0:3a767f41cf04 68
group-UVic-Assistive-Technolog 0:3a767f41cf04 69 /** Resets the position to the beginning of the directory.
group-UVic-Assistive-Technolog 0:3a767f41cf04 70 */
group-UVic-Assistive-Technolog 0:3a767f41cf04 71 virtual void rewinddir()=0;
group-UVic-Assistive-Technolog 0:3a767f41cf04 72
group-UVic-Assistive-Technolog 0:3a767f41cf04 73 /** Returns the current position of the DirHandle.
group-UVic-Assistive-Technolog 0:3a767f41cf04 74 *
group-UVic-Assistive-Technolog 0:3a767f41cf04 75 * @returns
group-UVic-Assistive-Technolog 0:3a767f41cf04 76 * the current position,
group-UVic-Assistive-Technolog 0:3a767f41cf04 77 * -1 on error.
group-UVic-Assistive-Technolog 0:3a767f41cf04 78 */
group-UVic-Assistive-Technolog 0:3a767f41cf04 79 virtual off_t telldir() { return -1; }
group-UVic-Assistive-Technolog 0:3a767f41cf04 80
group-UVic-Assistive-Technolog 0:3a767f41cf04 81 /** Sets the position of the DirHandle.
group-UVic-Assistive-Technolog 0:3a767f41cf04 82 *
group-UVic-Assistive-Technolog 0:3a767f41cf04 83 * @param location The location to seek to. Must be a value returned by telldir.
group-UVic-Assistive-Technolog 0:3a767f41cf04 84 */
group-UVic-Assistive-Technolog 0:3a767f41cf04 85 virtual void seekdir(off_t location) { }
group-UVic-Assistive-Technolog 0:3a767f41cf04 86
group-UVic-Assistive-Technolog 0:3a767f41cf04 87 virtual ~DirHandle() {}
group-UVic-Assistive-Technolog 0:3a767f41cf04 88 };
group-UVic-Assistive-Technolog 0:3a767f41cf04 89
group-UVic-Assistive-Technolog 0:3a767f41cf04 90 } // namespace mbed
group-UVic-Assistive-Technolog 0:3a767f41cf04 91
group-UVic-Assistive-Technolog 0:3a767f41cf04 92 typedef mbed::DirHandle DIR;
group-UVic-Assistive-Technolog 0:3a767f41cf04 93
group-UVic-Assistive-Technolog 0:3a767f41cf04 94 extern "C" {
group-UVic-Assistive-Technolog 0:3a767f41cf04 95 DIR *opendir(const char*);
group-UVic-Assistive-Technolog 0:3a767f41cf04 96 struct dirent *readdir(DIR *);
group-UVic-Assistive-Technolog 0:3a767f41cf04 97 int closedir(DIR*);
group-UVic-Assistive-Technolog 0:3a767f41cf04 98 void rewinddir(DIR*);
group-UVic-Assistive-Technolog 0:3a767f41cf04 99 long telldir(DIR*);
group-UVic-Assistive-Technolog 0:3a767f41cf04 100 void seekdir(DIR*, long);
group-UVic-Assistive-Technolog 0:3a767f41cf04 101 int mkdir(const char *name, mode_t n);
group-UVic-Assistive-Technolog 0:3a767f41cf04 102 };
group-UVic-Assistive-Technolog 0:3a767f41cf04 103
group-UVic-Assistive-Technolog 0:3a767f41cf04 104 #endif /* MBED_DIRHANDLE_H */