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

/// Command line interface implementation API

/// @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_IMPL_H
#define CLI_IMPL_H
/////////////////////////
// Includes
/////////////////////////
#include "cwgsys.h"
#include "cwg-shared.h"
#include "script.h"
#include "sequence.h"

/////////////////////////
// Macros
/////////////////////////

/////////////////////////
// Type Definitions
/////////////////////////

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

#ifdef __cplusplus
extern "C" {
#endif
    void cli_show_tokens(const char *caller, int argc, char **argv);

    /// Root commands
    return_code_t cli_get(int argc, char **argv);
    return_code_t cli_set(int argc, char **argv);
    return_code_t cli_clr(int argc, char **argv);
    return_code_t cli_pulse(int argc, char **argv);
    return_code_t cli_li(int argc, char **argv);
    return_code_t cli_script(int argc, char **argv);
  
    // Measurement commands
    return_code_t cli_mdio(int argc, char **argv);
    return_code_t cli_mmeas(int argc, char **argv);
   
    // IO, data queue
    return_code_t cli_creg(int argc, char **argv);
    return_code_t cli_dreg(int argc, char **argv);
    return_code_t cli_freg(int argc, char **argv);
    return_code_t cli_qcount(int argc, char **argv);
    return_code_t cli_qpop(int argc, char **argv);
    return_code_t cli_qpeek(int argc, char **argv);
    return_code_t cli_qclear(int argc, char **argv);

    // config, logging
    return_code_t cli_cfg_export(int argc, char **argv);
    return_code_t cli_log(int argc, char **argv);
    return_code_t cli_lcat(int argc, char **argv);
    return_code_t cli_linfo(int argc, char **argv);
    return_code_t cli_lless(int argc, char **argv);
    return_code_t cli_lseq(int argc, char **argv);
    return_code_t cli_lsetseq(int argc, char **argv);
    return_code_t cli_lshow(int argc, char **argv);
    return_code_t cli_lseg(int argc, char **argv);
    
    // file system
    return_code_t cli_cp(int argc, char **argv);
    return_code_t cli_ls(int argc, char **argv);
    return_code_t cli_ren(int argc, char **argv);
    return_code_t cli_upload(int argc, char **argv);
#ifdef WITH_XCAT
    return_code_t cli_xcat(int argc, char **argv);
#else
    return_code_t cli_cat(int argc, char **argv);
#endif
    return_code_t cli_fsize(int argc, char** argv);
    return_code_t cli_less(int argc, char **argv);
    return_code_t cli_line_count(int argc, char **argv);

    // diagnostics
    return_code_t cli_help(int argc, char **argv);
    #ifdef WITH_UI_HISTORY
    return_code_t cli_history(int argc, char **argv);
    #endif // WITH_UI_HISTORY

    return_code_t cli_con(int argc, char **argv);
    return_code_t cli_cron(int argc, char **argv);
    return_code_t cli_set_debug(int argc, char **argv);
#ifdef WITH_UI_ECHO
    return_code_t cli_echo(int argc, char **argv);
#endif //WITH_UI_ECHO
    return_code_t cli_print(int argc, char **argv);
    return_code_t cli_println(int argc, char **argv);
    return_code_t cli_version(int argc, char **argv);
    return_code_t cli_uptime(int argc, char **argv);
    return_code_t cli_reset(int argc, char **argv);
    return_code_t cli_hello(int argc, char **argv);
    return_code_t cli_sleep(int argc, char **argv);
    return_code_t cli_sweep(int argc, char **argv);
    return_code_t cli_test(int argc, char **argv);

    /// Get commands
    return_code_t cli_get_analog(int argc, char **argv);
    return_code_t cli_get_bits(int argc, char **argv);
    return_code_t cli_get_data(int argc, char **argv);
    return_code_t cli_get_err(int argc, char **argv);
    return_code_t cli_get_next_event(int argc, char **argv);
    return_code_t cli_get_print(int argc, char **argv);
    return_code_t cli_get_ser(int argc, char **argv);
    return_code_t cli_get_time(int argc, char **argv);
    return_code_t cli_get_var(int argc, char **argv);
    
    /// Set commands
    return_code_t cli_set_baud(int argc, char **argv);
    return_code_t cli_set_bits(int argc, char **argv);
    return_code_t cli_set_ser(int argc, char **argv);
    return_code_t cli_set_time(int argc, char **argv);
    return_code_t cli_set_var(int argc, char **argv);
    return_code_t cli_set_print(int argc, char **argv);
    
    /// Clear commands
    return_code_t cli_clr_bits(int argc, char **argv);

    /// Test commands
    return_code_t cli_test_bits(int argc, char **argv);
    
    /// Pulse commands
    return_code_t cli_pulse_bits(int argc, char **argv);
    return_code_t cli_pulse_nbits(int argc, char **argv);
    
    // Licor commands
    return_code_t cli_licor_init(int argc, char **argv);
    return_code_t cli_licor_cal(int argc, char **argv);
    return_code_t cli_licor_nmeas(int argc, char **argv);
    return_code_t cli_licor_or(int argc, char **argv);
    return_code_t cli_licor_tm(int argc, char **argv);
    return_code_t cli_licor_stat(int argc, char **argv);
    return_code_t cli_licor_model(int argc, char **argv);

    /// Script commands
    return_code_t cli_scr_load(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_unload(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_reset(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_run(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_jog(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_kill(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_end(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_schedule(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_stat(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_sync(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_show(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_sdebug(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_delay(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_pause(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_resume(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_goto(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_if(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_macro(int argc, char **argv, script_hnd_t hnd);
    return_code_t cli_scr_nop(int argc, char **argv, script_hnd_t hnd);

#ifdef __cplusplus
}
#endif

#endif // THIS_FILE


