27 void help(
const char *progName_){
28 std::cout <<
"\n SYNTAX: " << progName_ <<
" [options]\n";
29 std::cout <<
" --alarm (-a) [e-mail] | Call the alarm script with a given e-mail (or no argument)\n";
30 std::cout <<
" --fast (-f) | Fast boot (false by default)\n";
31 std::cout <<
" --verbose (-v) | Run quietly (false by default)\n";
32 std::cout <<
" --no-wall-clock | Do not insert the wall clock in the data stream\n";
33 std::cout <<
" --rates | Display module rates in quiet mode (false by defualt)\n";
34 std::cout <<
" --thresh (-t) <num> | Sets FIFO read threshold to num% full (50% by default)\n";
35 std::cout <<
" --zero | Zero clocks on each START_ACQ (false by default)\n";
36 std::cout <<
" --debug (-d) | Set debug mode to true (false by default)\n";
37 std::cout <<
" --pacman (-p) | Use classic poll operation for use with Pacman.\n";
38 std::cout <<
" --help (-h) | Display this help dialogue.\n\n";
49 int main(
int argc,
char *argv[]){
51 unsigned int threshPercent = 50;
52 std::string alarmArgument =
"";
54 struct option longOpts[] = {
55 {
"alarm", optional_argument, NULL,
'a' },
56 {
"fast", no_argument, NULL,
'f' },
57 {
"verbose", no_argument, NULL,
'v' },
58 {
"no-wall-clock", no_argument, NULL, 0 },
59 {
"rates", no_argument, NULL, 0 },
60 {
"thresh", required_argument, NULL,
't' },
61 {
"zero", no_argument, NULL, 0 },
62 {
"debug", no_argument, NULL,
'd' },
63 {
"pacman", no_argument, NULL,
'p' },
64 {
"help", no_argument, NULL,
'h' },
65 {
"prefix", no_argument, NULL, 0 },
66 {
"?", no_argument, NULL, 0 },
67 { NULL, no_argument, NULL, 0 }
80 while ( (retval = getopt_long(argc, argv,
"afvt:dph", longOpts, &idx)) != -1) {
83 alarmArgument = optarg;
93 threshPercent = atoi(optarg);
94 if(threshPercent <= 0){
95 std::cout <<
Display::ErrorStr() <<
" Failed to set threshold level to (" << threshPercent <<
")!\n";
109 if(strcmp(
"prefix", longOpts[idx].name) == 0 ) {
110 std::cout << INSTALL_PREFIX <<
"\n";
113 else if(strcmp(
"no-wall-clock", longOpts[idx].name) == 0 ) {
116 else if(strcmp(
"rates", longOpts[idx].name) == 0 ) {
119 else if(strcmp(
"zero", longOpts[idx].name) == 0 ) {
136 std::string poll2Dir = getenv(
"HOME");
137 if (!mkdir(poll2Dir.append(
"/.poll2/").c_str(), S_IRWXU)) {
139 std::cout <<
Display::ErrorStr() <<
"Unable to create poll2 settings directory '" << poll2Dir <<
"'!\n";
145 std::cout <<
"\n######### ##### #### #### ########\n";
146 std::cout <<
" ## ## ## ## ## ## ## ##\n";
147 std::cout <<
" ## ## ## ## ## ## ##\n";
148 std::cout <<
" ## ## ## ## ## ## ##\n";
149 std::cout <<
" ####### ## ## ## ## ##\n";
150 std::cout <<
" ## ## ## ## ## ##\n";
151 std::cout <<
" ## ## ## ## ## ##\n";
152 std::cout <<
" ## ## ## ## ## ##\n";
153 std::cout <<
" ## ## ## ## ## ## ## ##\n";
154 std::cout <<
"#### ##### ######### ######### ###########\n";
157 std::cout <<
" == == == == == \n\n";
172 std::cout <<
"Using Pixie16 revision A\n";
173 #elif (defined PIF_REVD) 174 std::cout <<
"Using Pixie16 revision D\n";
175 #elif (defined PIF_REVF) 176 std::cout <<
"Using Pixie16 revision F\n";
178 std::cout <<
"Using unknown Pixie16 revision!!!\n";
181 if(poll.
GetPacmanMode()){ std::cout <<
"Using pacman mode!\n"; }
182 std::cout << std::endl;
188 if(alarmArgument.empty()){ std::cout <<
Display::InfoStr(
"DEFAULT") << std::endl; }
193 std::cout <<
pad_string(
"Starting run control thread", 49);
199 std::cout <<
pad_string(
"Starting command thread", 49);
std::string WarningStr(const std::string &str="[WARNING]")
void EnableTimeout(float timeout=0.5)
Enable a timeout while waiting fro a command.
void start_cmd_control(Poll *poll_)
std::string InfoStr(const std::string &str="[INFO]")
void SetCommandHistory(std::string filename, bool overwrite=false)
Set the command filename for storing previous commands.
void start_run_control(Poll *poll_)
void CommandControl()
Main control loop for handling user input.
void help(const char *progName_)
bool SetLogFile(std::string logFileName)
Specify the log file to append.
void Close()
Close the window and restore control to the terminal.
Controls the poll2 command interpreter and data acquisition system.
void LeaderPrint(const std::string &str)
void SetQuietMode(bool input_=true)
void SetPrompt(const char *input_)
Set the command prompt.
void SetThreshWords(const size_t &thresh_)
int main(int argc, char *argv[])
void AddStatusWindow(unsigned short numLines=1)
Initalizes a status window under the input temrinal.
void SetDebugMode(bool input_=true)
void SetSendAlarm(bool input_=true)
Library to handle all aspects of a stand-alone command line interface.
#define POLL2_CORE_VERSION
std::string pad_string(const std::string &input_, unsigned int length_)
Pad a string with periods until it is the specified length_.
void SetWallClock(bool input_=true)
void SetShowRates(bool input_=true)
void PrintModuleInfo()
Prints the information about each module.
bool Close()
Close the sockets, any open files, and clean up.
void SetBootFast(bool input_=true)
void SetZeroClocks(bool input_=true)
std::string ErrorStr(const std::string &str="[ERROR]")
void SetPacmanMode(bool input_=true)
void EnableTabComplete(bool enable=true)
Enable tab auto complete functionlity.
#define EXTERNAL_FIFO_LENGTH
std::string OkayStr(const std::string &str="[OK]")
void Initialize()
Initialize the terminal interface.
void RunControl()
Main acquisition control loop for handling data acq.
bool Initialize()
Initialize the poll object.
void SetTerminal(Terminal *term)
Set the terminal pointer.