#ifndef PBCMD_H
#define PBCMD_H

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/can.h>
#include <linux/can/raw.h>

#define  CAN0      "can0"

#define  OK         0
#define  BAD_SOCK  -1      // Socket comms failed
#define  BAD_OPTS  -2      // Inconsistent option values

// Battery Controller Command functions
//
int   bender(int argc, char** argv);  // bender
int reset_bc(int argc, char** argv);  // reset battery controller

// Spring Controller Command functions
//
int     pump(int argc, char** argv);  // pump on or off
int    valve(int argc, char** argv);  // valve on or off
int   tether(int argc, char** argv);  // tether power on or off
int reset_sc(int argc, char** argv);  // reset spring controller

// Power Controller Command functions
//
int        reset_pc(int argc, char** argv);  // reset power controller
int           scale(int argc, char** argv);  // set scale 0 to 6.5535
int         retract(int argc, char** argv);  // set retract 0 to 6.5535
int            vmax(int argc, char** argv);  // set vmax 0 to 655.35
int            imax(int argc, char** argv);  // set imax 0 to 131.068
int       batt_mode(int argc, char** argv);  // set the battery charge mode
int             scm(int argc, char** argv);  // set the sto pcharge mode on or off
int            gain(int argc, char** argv);  // set the gs gain
int         vstddev(int argc, char** argv);  // set the gs target
int   max_batt_chrg(int argc, char** argv);  // set the max battery current charge
int   max_batt_draw(int argc, char** argv);  // set the max battery current draw
int  gain_schd_gain(int argc, char** argv);  // set the gain scheduler gain
int       wind_curr(int argc, char** argv);  // set the wind current
int  bias_wind_curr(int argc, char** argv);  // set the bias wind current
int   can_pack_rate(int argc, char** argv);  // set the canbus packet rate

// Umbrella-plate controller commands
//
int          tf_setpos(int argc, char** argv); // set umbrella heave plate opening pos
int    tf_setactualpos(int argc, char** argv); // set umbrella heave plate opening pos
int         tf_setmode(int argc, char** argv); // set controller mode
int   tf_setchargemode(int argc, char** argv); // set battery charging mode
int      tf_setcurrlim(int argc, char** argv); // set current limit
int tf_setstatemachine(int argc, char** argv); // set the state machine logic
int        tf_watchdog(int argc, char** argv); // watchdog 
int           tf_reset(int argc, char** argv); // reset

// The following commands, including all rudder commands, are
// dormant (non-visible) as of August 29 2018  -Henthorn
// 
int set_torque(int argc, char** argv); // Set the torque -40.0 to 40.0
int    set_rpm(int argc, char** argv); // Set the rpm -30000 to 30000

// Rudder Controller Command functions
// 
int     rcmode(int argc, char** argv);  //
int      rcpos(int argc, char** argv);  //
int   rctarget(int argc, char** argv);  //
int      rchdg(int argc, char** argv);  //
int   rcfilter(int argc, char** argv);  //
int   rcperiod(int argc, char** argv);  //
int    rcpgain(int argc, char** argv);  //
int    rcigain(int argc, char** argv);  //
int    rcdgain(int argc, char** argv);  //
int   rcmaxpos(int argc, char** argv);  //
int rcdeadband(int argc, char** argv);  //
int    rcreset(int argc, char** argv);  //

#endif
