/// @file cli_api.h
/// @authors k. headley
/// @date 05 dec 2019

/// Command line interface API implementation

/// @sa doxygen-examples.c for more examples of Doxygen markup


/////////////////////////
// Terms of use
/////////////////////////
/*
 Copyright Information
 
 Copyright 2002-2019 MBARI
 Monterey Bay Aquarium Research Institute, all rights reserved.
 
 Terms of Use
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version. You can access the GPLv3 license at
 http://www.gnu.org/licenses/gpl-3.0.html
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details
 (http://www.gnu.org/licenses/gpl-3.0.html)
 
 MBARI provides the documentation and software code "as is", with no warranty,
 express or implied, as to the software, title, non-infringement of third party
 rights, merchantability, or fitness for any particular purpose, the accuracy of
 the code, or the performance or results which you may obtain from its use. You
 assume the entire risk associated with use of the code, and you agree to be
 responsible for the entire cost of repair or servicing of the program with
 which you are using the code.
 
 In no event shall MBARI be liable for any damages, whether general, special,
 incidental or consequential damages, arising out of your use of the software,
 including, but not limited to, the loss or corruption of your data or damages
 of any kind resulting from use of the software, any prohibited use, or your
 inability to use the software. You agree to defend, indemnify and hold harmless
 MBARI and its officers, directors, and employees against any claim, loss,
 liability or expense, including attorneys' fees, resulting from loss of or
 damage to property or the injury to or death of any person arising out of the
 use of the software.
 
 The MBARI software is provided without obligation on the part of the
 Monterey Bay Aquarium Research Institute to assist in its use, correction,
 modification, or enhancement.
 
 MBARI assumes no responsibility or liability for any third party and/or
 commercial software required for the database or applications. Licensee agrees
 to obtain and maintain valid licenses for any additional third party software
 required.
 */

// Always do this
#ifndef CLI_API_H
#define CLI_API_H

/////////////////////////
// Includes
/////////////////////////

#include "script.h"

/////////////////////////
// Macros
/////////////////////////
#define ARG_LICOR "LI"
#define ARG_PUMP0 "P0"
#define ARG_PUMP1 "P1"
#define ARG_ADC0  "A0"
#define ARG_ADC1  "A1"
#define ARG_ADC2  "A2"
#define ARG_XL    "XL"
#define ARG_XH    "XH"
#define ARG_XC    "XC"
#define ARG_HOST  "HO"
#define CMD_ON    "ON"
#define CMD_OFF   "OFF"

#define ACT_UPLOAD_TO_MSEC 5000

/////////////////////////
// Type Definitions
/////////////////////////
typedef return_code_t (*cmd_func)(int argc,char **argv);

/// An entry in a table of commands
typedef struct CmdStruct_s {
    char* name;             ///<command name(what's typed into CLI)
    cmd_func cmd_fn;//return_code_t (*func)(char *);    ///<pointer to function to be called
}CmdStruct;

/////////////////////////
// Exports
/////////////////////////

#ifdef __cplusplus
extern "C" {
#endif
    extern const CmdStruct cmdsRoot[];  /// <base level commands
    extern const CmdStruct cmdsGet[];   /// <GET sub-commands
    extern const CmdStruct cmdsSet[];   /// <SET sub-commnads
    extern const CmdStruct cmdsClr[];   /// <CLEAR sub-commands
    extern const CmdStruct cmdsLi[];    /// <licor sub-commnds
    extern const CmdStruct cmdsPulse[];   /// <Pulse sub-commands
    extern const CmdStruct cmdsTest[];   /// <TEST sub-commands
    extern const ScrCmdStruct cmdsScr[];   /// <Scripting sub-commands

#ifdef __cplusplus
}
#endif

#endif // THIS_FILE

