45 string condition =
"";
55 node = string(argv[6]);
74 if (condition !=
"{}")
86 double seconds = atof(&argv[3][1]);
109 cout <<
"The command generator produces the command string to be fed into the command\n" 110 "queue which is managed by agent_exec. Commands are a subset of events\n" 111 "in COSMOS." << endl << endl;
113 cout <<
"Usage" << endl << endl;
114 cout <<
" command_generator [options]" << endl;
115 cout <<
" command_generator name command [time | +sec] [condition] [repeat_flag] [node]" << endl << endl;
118 cout <<
"Example" << endl << endl;
119 cout <<
" $ command_generator myCmd1 \"agent kauaicc_sim execsoh get_queue_size\" +10" << endl << endl;
120 cout <<
" This will run the command \"agent kauaicc_sim execsoh get_queue_size\" \n" 121 " with name 'myCmd' within 10 seconds from now." << endl << endl;
123 cout <<
"Arguments" << endl << endl;
125 cout <<
" name \t = name of the command, can be a string or combination of \n " 126 " \t alphanumeric characters (ex: myCmd1)" << endl;
127 cout <<
" command\t = the actual command to be executed, if more than one word \n" 128 " \t enclose the command string in quotes \n" 129 " \t (ex: \"agent kauaicc_sim execsoh get_queue_size\"" << endl;
130 cout <<
" time \t = optional argument to enter the desired modified julian date\n" 131 " \t (mjd). If not entered it will use the current time. \n" 132 " \t If '+' is used instead then the number of seconds can be\n" 133 " \t inserted. For 10 seconds in the future use +10" << endl;
134 cout <<
" condition \t = optional argument to enter a COSMOS condition\n" 135 " \t Shoold be in JSON. Empty {} will mean no condition \n";
136 cout <<
" repeat_flag \t = Optional repeat flag.\n" 138 cout <<
" node \t = optional argument to add the generated command to the command\n" 139 " \t queue on the specified node (ex: kauaicc_sim) " << endl;
148 cout <<
event.
generator(name, data, utc, condition, flag) << endl << endl;
151 cout <<
"Adding command/event to node " << node << endl;
165 scheduler.addEvent(event);
169 scheduler.getEventQueue();
Class to manage Event information.
Definition: event.h:57
Definition: scheduler.h:56
string generator(string name, string data, double utc, string condition, uint32_t flag)
Definition: event.cpp:53
#define EVENT_FLAG_SOLO
Command Event should run by itself.
Definition: cosmos-defs.h:175
#define EVENT_FLAG_REPEAT
Repeating event.
Definition: cosmos-defs.h:171
string name
Definition: cubesat2obj.cpp:6
double currentmjd(double offset)
Current UTC in Modified Julian Days.
Definition: timelib.cpp:65
#define EVENT_FLAG_CONDITIONAL
Conditional event.
Definition: cosmos-defs.h:169
static string node
Definition: agent_monitor.cpp:126