155 double llogmjd, dlogmjd, clogmjd;
187 FILE *
fp = fopen((
"/cosmos/nodes/" +
agent->
nodeName +
"/last_date").c_str(),
"r");
199 printf(
"Initialized time from file: Delta %f\n", delta);
209 cout<<
" started."<<endl;
217 cout<<
"unable to create directory: <"<<(
agent->
getNode()+
"/immediate")+
"/exec"<<
"> ... exiting."<<endl;
224 cout<<
"unable to create directory: <"<<(
agent->
getNode()+
"/incoming")+
"/exec"<<
"> ... exiting."<<endl;
231 cout<<
"unable to create directory: <"<<(
agent->
getNode()+
"/outgoing")+
"/exec"<<
"> ... exiting."<<endl;
238 cout<<
"unable to create directory: <"<<(
agent->
getNode()+
"/temp")+
"/exec"<<
"> ... exiting."<<endl;
253 if ((iretn=
agent->
add_request(
"addcommand",
request_add_command,
"{\"event_name\":\"\"}{\"event_utc\":0}{\"event_utcexec\":0}{\"event_flag\":0}{\"event_type\":0}{\"event_data\":\"\"}{\"event_condition\":\"\"}",
"adds the specified command event to the queue")))
292 bool log_data_flag =
true;
296 if (strcmp(
i.node,
agent->
nodeName.c_str()) && !strcmp(
i.proc,
"exec"))
298 log_data_flag =
false;
305 printf(
"Primary: SOH logger\n");
309 printf(
"Secondary: Not logging SOH\n");
316 printf(
"===\nlogstring: %s\n===\n", logstring.c_str()); fflush(stdout);
322 agent->
post(Agent::AgentMessage::REQUEST,
"postsoh");
362 dlogmjd = (clogmjd-llogmjd)*86400.;
431 agent->
post(Agent::AgentMessage::REQUEST,
"postsoh");
437 for (uint32_t k=0; k<events.size(); ++k)
451 if (savet.
split() > 60.)
453 FILE *fp = fopen((
"/cosmos/nodes/" +
agent->
nodeName +
"/last_date").c_str(),
"w");
static double newlogperiod
Definition: agent_exec-2-0.cpp:116
static string incoming_dir
Definition: agent_exec-2-0.cpp:143
int32_t dom
Definition: timelib.h:110
int32_t request_get_logstring(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:791
static vector< eventstruc > eventdict
Definition: agent_exec-2-0.cpp:127
uint16_t debug_level
Flag for level of debugging, keep it public so that it can be controlled from the outside...
Definition: agentclass.h:362
int32_t request_add_command(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:703
int32_t finish_active_loop()
Definition: agentclass.cpp:355
string json_list_of_soh(cosmosstruc *cinfo)
Definition: jsonlib.cpp:9252
static string logstring
Definition: agent_exec-2-0.cpp:113
#define DATA_LOG_TYPE_EVENT
Definition: datalib.h:109
static double logdate_exec
Definition: agent_exec-2-0.cpp:77
calstruc mjd2cal(double mjd)
MJD to Calendar.
Definition: timelib.cpp:180
int16_t powmode
Definition: jsondef.h:3580
FILE * get_debug_fd(double mjd=0.)
Definition: agentclass.cpp:2645
size_t calc_events(vector< eventstruc > &dictionary, cosmosstruc *cinfo, vector< eventstruc > &events)
Calculate current Events.
Definition: jsonlib.cpp:11356
Definition: eci2kep_test.cpp:33
int32_t request_save_command(string &request, string &response, Agent *)
Definition: agent_exec-2-0.cpp:594
int32_t request_remote_command(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:732
static double delta
Definition: agent_exec-2-0.cpp:141
Definition: jsondef.h:923
int32_t request_get_event(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:559
static CommandQueue cmd_queue
Definition: agent_exec-2-0.cpp:74
string nodeName
Definition: agentclass.h:367
int i
Definition: rw_test.cpp:37
string getNode()
Listen for heartbeat.
Definition: agentclass.cpp:2607
int32_t request_reopen_exec(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:545
const char * json_of_table(string &jstring, vector< jsonentry * > table, cosmosstruc *cinfo)
Create JSON stream from entries.
Definition: jsonlib.cpp:8733
int32_t update_target(cosmosstruc *cinfo)
Update Track list.
Definition: jsonlib.cpp:11262
int32_t request_set_logperiod(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:771
int32_t request_get_queue_size(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:553
int32_t load_commands(string incoming_dir)
Load queue of Events from a file.
Definition: command_queue.cpp:420
size_t join_event_threads()
Join all threads spawn and empty our vector.
Definition: command_queue.cpp:115
int iretn
Definition: rw_test.cpp:37
static vector< jsonentry * > logtable
Definition: agent_exec-2-0.cpp:114
int32_t wait(State state=State::RUN, double waitsec=10.)
Definition: agentclass.cpp:398
double utc
Overall Node time.
Definition: jsondef.h:3592
vector< vector< jsonequation > > emap
JSON Equation Map matrix.
Definition: jsondef.h:4211
static double logstride_soh
Definition: agent_exec-2-0.cpp:119
static double newlogstride_exec
Definition: agent_exec-2-0.cpp:78
int32_t hour
Definition: timelib.h:112
string data_base_path(string node, string location, string agent, string filename)
Create data file path.
Definition: datalib.cpp:767
int32_t set_sohstring(string list)
Set Limited SOH string.
Definition: agentclass.cpp:641
static double epsilon
Definition: agent_exec-2-0.cpp:140
int32_t run_commands(Agent *agent, string nodename, double logdate_exec)
Traverse the entire queue of Events, clearing those that have finished.
Definition: command_queue.cpp:261
int32_t json_table_of_list(vector< jsonentry * > &table, string tokens, cosmosstruc *cinfo)
Output a vector of JSON entries.
Definition: jsonlib.cpp:3086
int32_t request_get_logstride_exec(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:538
static string temp_dir
Definition: agent_exec-2-0.cpp:146
nodestruc node
Structure for summary information in node.
Definition: jsondef.h:4220
string cosmos_error_string(int32_t cosmos_errno)
Definition: cosmos-errno.cpp:45
uint16_t running()
Check if we're supposed to be running.
Definition: agentclass.cpp:391
void collect_data_loop() noexcept
Definition: agent_exec-2-0.cpp:809
Definition: timelib.h:106
int32_t get_last_offset()
Definition: agent_exec-2-0.cpp:472
int32_t get_agent_time(double &agent_time, double &epsilon, double &delta, string agent, string node="any", double wait_sec=2.)
Definition: agentclass.cpp:2711
int32_t post(messstruc mess)
Post a Cosmos::Agent::messstruc.
Definition: agentclass.cpp:2074
static Agent * agent
Definition: agent_exec-2-0.cpp:72
int32_t request_set_logstride_soh(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:797
double set_local_clock(double utc_to)
Definition: timelib.cpp:1626
static thread cdthread
Definition: agent_exec-2-0.cpp:110
int32_t month
Definition: timelib.h:109
uint32_t downtime
Seconds Node will be down.
Definition: jsondef.h:3582
string getAgent()
Definition: agentclass.cpp:2609
int32_t add_request(string token, external_request_function function, string synopsis="", string description="")
Add internal request to Agent request list with description and synopsis.
Definition: agentclass.cpp:312
int32_t restore_commands(string temp_dir, string name=".queue")
Restore the queue of Events from a file.
Definition: command_queue.cpp:385
char name[40+1]
Node Name.
Definition: jsondef.h:3556
Definition: agentclass.h:139
static double correcttime
Definition: agent_exec-2-0.cpp:139
double cal2mjd(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, int32_t second, int32_t nsecond)
Calendar representation to Modified Julian Day - full.
Definition: timelib.cpp:294
locstruc loc
Location structure.
Definition: jsondef.h:3596
void move_and_compress_soh()
Definition: agent_exec-2-0.cpp:844
static string immediate_dir
Definition: agent_exec-2-0.cpp:145
size_t load_dictionary(vector< eventstruc > &dict, cosmosstruc *cinfo, const char *file)
Load Event Dictionary.
Definition: jsonlib.cpp:11313
int32_t shutdown()
Shutdown agent gracefully.
Definition: agentclass.cpp:366
Full COSMOS Event structure.
Definition: jsondef.h:1093
void move_and_compress_beacon()
Definition: agent_exec-2-0.cpp:850
const char * json_of_event(string &jstring, cosmosstruc *cinfo)
Create JSON for an event.
Definition: jsonlib.cpp:9854
void move_and_compress_exec()
Definition: agent_exec-2-0.cpp:838
double data_ctime(string path)
Definition: datalib.cpp:1910
int32_t get_flags()
Definition: agent_exec-2-0.cpp:484
int32_t request_set_logstring(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:783
int32_t minute
Definition: timelib.h:113
Definition: elapsedtime.h:62
int32_t loc_update(locstruc *loc)
Synchronize all frames in location structure.
Definition: convertlib.cpp:2294
static string jjstring
Definition: agent_exec-2-0.cpp:106
void log_write(string node, string agent, double utc, string extra, string type, string record, string location)
Write log entry - full.
Definition: datalib.cpp:75
double currentmjd(double offset)
Current UTC in Modified Julian Days.
Definition: timelib.cpp:65
#define DATA_LOG_TYPE_SOH
Definition: datalib.h:108
string utc2iso8601(double utc)
ISO 8601 version of time.
Definition: timelib.cpp:1286
static string myjstring
Definition: agent_exec-2-0.cpp:107
int32_t request_reopen_soh(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:763
vector< agentstruc > agent
Single entry vector for agent information.
Definition: jsondef.h:4247
int32_t year
Definition: timelib.h:108
int32_t start_active_loop()
Definition: agentclass.cpp:347
cosmosstruc * cinfo
Definition: agentclass.h:346
FILE * fp
Definition: rw_test.cpp:38
int32_t request_del_command_id(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:644
int32_t request_set_logstride_exec(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:533
int32_t request_get_command(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:608
vector< eventstruc > event
Single entry vector for event information.
Definition: jsondef.h:4250
static double logdate_soh
Definition: agent_exec-2-0.cpp:115
static double logstride_exec
Definition: agent_exec-2-0.cpp:79
int32_t request_del_command(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:675
int32_t second
Definition: timelib.h:114
int32_t request_get_logperiod(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:777
int32_t request_get_logstride_soh(string &request, string &response, Agent *agent)
Definition: agent_exec-2-0.cpp:803
double split()
ElapsedTime::split, gets the current elapsed time since the start()
Definition: elapsedtime.cpp:234
string mjd2iso8601(double mjd)
Definition: timelib.cpp:1316
static double newlogstride_soh
Definition: agent_exec-2-0.cpp:118
int32_t get_power_mode()
Definition: agent_exec-2-0.cpp:859
vector< beatstruc > find_agents(double waitsec=0.)
Find single server.
Definition: agentclass.cpp:605
static string outgoing_dir
Definition: agent_exec-2-0.cpp:144
static double logperiod
Definition: agent_exec-2-0.cpp:117
void reset()
ElapsedTime::reset.
Definition: elapsedtime.cpp:278
static vector< eventstruc > events
Definition: agent_exec-2-0.cpp:128