Test serial console demonstrating various API functions of WiConnect library.

Dependencies:   WiConnect mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FileTests.h Source File

FileTests.h

00001 /**
00002  * ACKme WiConnect Host Library is licensed under the BSD licence: 
00003  * 
00004  * Copyright (c)2014 ACKme Networks.
00005  * All rights reserved. 
00006  * 
00007  * Redistribution and use in source and binary forms, with or without modification, 
00008  * are permitted provided that the following conditions are met: 
00009  * 
00010  * 1. Redistributions of source code must retain the above copyright notice, 
00011  * this list of conditions and the following disclaimer. 
00012  * 2. Redistributions in binary form must reproduce the above copyright notice, 
00013  * this list of conditions and the following disclaimer in the documentation 
00014  * and/or other materials provided with the distribution. 
00015  * 3. The name of the author may not be used to endorse or promote products 
00016  * derived from this software without specific prior written permission. 
00017  * 
00018  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS AND ANY EXPRESS OR IMPLIED 
00019  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
00020  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
00021  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
00022  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
00023  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00024  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00025  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
00026  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
00027  * OF SUCH DAMAGE.
00028  */
00029 #pragma once
00030 
00031 #define FILE_TEST_CMD_LIST \
00032     ADD_HEADER("File commands:"), \
00033     ADD_CMD("ls",            fileList,                       "list files (optionally by name, type, version)", \
00034                                                              "Usage: ls [-n <name>] [-t <type>] [-v <version>]\n" \
00035                                                              "Examples:\n" \
00036                                                              "> ls                  // list all files\n" \
00037                                                              "> ls -n *.exe         // list all executable files\n" \
00038                                                              "> ls -v 1.2           // list all files with version 1.2\n" \
00039                                                              "> ls -t FE            // list all miscellaneous files"), \
00040     ADD_CMD("create",       fileCreate,                      "create a file", \
00041                                                              "Usage: create <name> <size> [<version> [<type>]]\n" \
00042                                                              "Example:\n" \
00043                                                              "> create my_file.txt 100 4.56 // create file name 'my_file.txt'\n" \
00044                                                              "                              // immediately following should be 100 bytes of data"), \
00045     ADD_CMD("read",         fileRead,                        "read a file", \
00046                                                              "Usage: read <name>\n" \
00047                                                              "Example:\n" \
00048                                                              "> read my_file.txt "), \
00049     ADD_CMD("delete",       fileDelete,                      "delete a file", \
00050                                                              "Usage: delete <name>\n" \
00051                                                              "Example:\n" \
00052                                                              "> delete my_file.txt ")
00053 
00054 
00055 WiconnectResult fileListCommand(int argc, char **argv);
00056 WiconnectResult fileCreateCommand(int argc, char **argv);
00057 WiconnectResult fileReadCommand(int argc, char **argv);
00058 WiconnectResult fileDeleteCommand(int argc, char **argv);