Integrating the ublox LISA C200 modem

Fork of SprintUSBModemHTTPClientTest by Donatien Garnier

Committer:
sam_grove
Date:
Thu Sep 26 00:44:20 2013 -0500
Revision:
5:3f93dd1d4cb3
Exported program and replaced contents of the repo with the source
to build and debug using keil mdk. Libs NOT upto date are lwip, lwip-sys
and socket. these have newer versions under mbed_official but were starting
from a know working point

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sam_grove 5:3f93dd1d4cb3 1 /* mbed Microcontroller Library
sam_grove 5:3f93dd1d4cb3 2 * Copyright (c) 2006-2013 ARM Limited
sam_grove 5:3f93dd1d4cb3 3 *
sam_grove 5:3f93dd1d4cb3 4 * Licensed under the Apache License, Version 2.0 (the "License");
sam_grove 5:3f93dd1d4cb3 5 * you may not use this file except in compliance with the License.
sam_grove 5:3f93dd1d4cb3 6 * You may obtain a copy of the License at
sam_grove 5:3f93dd1d4cb3 7 *
sam_grove 5:3f93dd1d4cb3 8 * http://www.apache.org/licenses/LICENSE-2.0
sam_grove 5:3f93dd1d4cb3 9 *
sam_grove 5:3f93dd1d4cb3 10 * Unless required by applicable law or agreed to in writing, software
sam_grove 5:3f93dd1d4cb3 11 * distributed under the License is distributed on an "AS IS" BASIS,
sam_grove 5:3f93dd1d4cb3 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
sam_grove 5:3f93dd1d4cb3 13 * See the License for the specific language governing permissions and
sam_grove 5:3f93dd1d4cb3 14 * limitations under the License.
sam_grove 5:3f93dd1d4cb3 15 */
sam_grove 5:3f93dd1d4cb3 16 #ifndef MBED_LOCALFILESYSTEM_H
sam_grove 5:3f93dd1d4cb3 17 #define MBED_LOCALFILESYSTEM_H
sam_grove 5:3f93dd1d4cb3 18
sam_grove 5:3f93dd1d4cb3 19 #include "platform.h"
sam_grove 5:3f93dd1d4cb3 20
sam_grove 5:3f93dd1d4cb3 21 #if DEVICE_LOCALFILESYSTEM
sam_grove 5:3f93dd1d4cb3 22
sam_grove 5:3f93dd1d4cb3 23 #include "FileSystemLike.h"
sam_grove 5:3f93dd1d4cb3 24
sam_grove 5:3f93dd1d4cb3 25 namespace mbed {
sam_grove 5:3f93dd1d4cb3 26
sam_grove 5:3f93dd1d4cb3 27 FILEHANDLE local_file_open(const char* name, int flags);
sam_grove 5:3f93dd1d4cb3 28
sam_grove 5:3f93dd1d4cb3 29 class LocalFileHandle : public FileHandle {
sam_grove 5:3f93dd1d4cb3 30
sam_grove 5:3f93dd1d4cb3 31 public:
sam_grove 5:3f93dd1d4cb3 32 LocalFileHandle(FILEHANDLE fh);
sam_grove 5:3f93dd1d4cb3 33
sam_grove 5:3f93dd1d4cb3 34 virtual int close();
sam_grove 5:3f93dd1d4cb3 35
sam_grove 5:3f93dd1d4cb3 36 virtual ssize_t write(const void *buffer, size_t length);
sam_grove 5:3f93dd1d4cb3 37
sam_grove 5:3f93dd1d4cb3 38 virtual ssize_t read(void *buffer, size_t length);
sam_grove 5:3f93dd1d4cb3 39
sam_grove 5:3f93dd1d4cb3 40 virtual int isatty();
sam_grove 5:3f93dd1d4cb3 41
sam_grove 5:3f93dd1d4cb3 42 virtual off_t lseek(off_t position, int whence);
sam_grove 5:3f93dd1d4cb3 43
sam_grove 5:3f93dd1d4cb3 44 virtual int fsync();
sam_grove 5:3f93dd1d4cb3 45
sam_grove 5:3f93dd1d4cb3 46 virtual off_t flen();
sam_grove 5:3f93dd1d4cb3 47
sam_grove 5:3f93dd1d4cb3 48 protected:
sam_grove 5:3f93dd1d4cb3 49 FILEHANDLE _fh;
sam_grove 5:3f93dd1d4cb3 50 int pos;
sam_grove 5:3f93dd1d4cb3 51 };
sam_grove 5:3f93dd1d4cb3 52
sam_grove 5:3f93dd1d4cb3 53 /** A filesystem for accessing the local mbed Microcontroller USB disk drive
sam_grove 5:3f93dd1d4cb3 54 *
sam_grove 5:3f93dd1d4cb3 55 * This allows programs to read and write files on the same disk drive that is used to program the
sam_grove 5:3f93dd1d4cb3 56 * mbed Microcontroller. Once created, the standard C file access functions are used to open,
sam_grove 5:3f93dd1d4cb3 57 * read and write files.
sam_grove 5:3f93dd1d4cb3 58 *
sam_grove 5:3f93dd1d4cb3 59 * Example:
sam_grove 5:3f93dd1d4cb3 60 * @code
sam_grove 5:3f93dd1d4cb3 61 * #include "mbed.h"
sam_grove 5:3f93dd1d4cb3 62 *
sam_grove 5:3f93dd1d4cb3 63 * LocalFileSystem local("local"); // Create the local filesystem under the name "local"
sam_grove 5:3f93dd1d4cb3 64 *
sam_grove 5:3f93dd1d4cb3 65 * int main() {
sam_grove 5:3f93dd1d4cb3 66 * FILE *fp = fopen("/local/out.txt", "w"); // Open "out.txt" on the local file system for writing
sam_grove 5:3f93dd1d4cb3 67 * fprintf(fp, "Hello World!");
sam_grove 5:3f93dd1d4cb3 68 * fclose(fp);
sam_grove 5:3f93dd1d4cb3 69 * remove("/local/out.txt"); // Removes the file "out.txt" from the local file system
sam_grove 5:3f93dd1d4cb3 70 *
sam_grove 5:3f93dd1d4cb3 71 * DIR *d = opendir("/local"); // Opens the root directory of the local file system
sam_grove 5:3f93dd1d4cb3 72 * struct dirent *p;
sam_grove 5:3f93dd1d4cb3 73 * while((p = readdir(d)) != NULL) { // Print the names of the files in the local file system
sam_grove 5:3f93dd1d4cb3 74 * printf("%s\n", p->d_name); // to stdout.
sam_grove 5:3f93dd1d4cb3 75 * }
sam_grove 5:3f93dd1d4cb3 76 * closedir(d);
sam_grove 5:3f93dd1d4cb3 77 * }
sam_grove 5:3f93dd1d4cb3 78 * @endcode
sam_grove 5:3f93dd1d4cb3 79 *
sam_grove 5:3f93dd1d4cb3 80 * @note
sam_grove 5:3f93dd1d4cb3 81 * If the microcontroller program makes an access to the local drive, it will be marked as "removed"
sam_grove 5:3f93dd1d4cb3 82 * on the Host computer. This means it is no longer accessible from the Host Computer.
sam_grove 5:3f93dd1d4cb3 83 *
sam_grove 5:3f93dd1d4cb3 84 * The drive will only re-appear when the microcontroller program exists. Note that if the program does
sam_grove 5:3f93dd1d4cb3 85 * not exit, you will need to hold down reset on the mbed Microcontroller to be able to see the drive again!
sam_grove 5:3f93dd1d4cb3 86 */
sam_grove 5:3f93dd1d4cb3 87 class LocalFileSystem : public FileSystemLike {
sam_grove 5:3f93dd1d4cb3 88
sam_grove 5:3f93dd1d4cb3 89 public:
sam_grove 5:3f93dd1d4cb3 90 LocalFileSystem(const char* n) : FileSystemLike(n) {
sam_grove 5:3f93dd1d4cb3 91
sam_grove 5:3f93dd1d4cb3 92 }
sam_grove 5:3f93dd1d4cb3 93
sam_grove 5:3f93dd1d4cb3 94 virtual FileHandle *open(const char* name, int flags);
sam_grove 5:3f93dd1d4cb3 95 virtual int remove(const char *filename);
sam_grove 5:3f93dd1d4cb3 96 virtual DirHandle *opendir(const char *name);
sam_grove 5:3f93dd1d4cb3 97 };
sam_grove 5:3f93dd1d4cb3 98
sam_grove 5:3f93dd1d4cb3 99 } // namespace mbed
sam_grove 5:3f93dd1d4cb3 100
sam_grove 5:3f93dd1d4cb3 101 #endif
sam_grove 5:3f93dd1d4cb3 102
sam_grove 5:3f93dd1d4cb3 103 #endif