COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
agentclass.h
Go to the documentation of this file.
1 /********************************************************************
2 * Copyright (C) 2015 by Interstel Technologies, Inc.
3 * and Hawaii Space Flight Laboratory.
4 *
5 * This file is part of the COSMOS/core that is the central
6 * module for COSMOS. For more information on COSMOS go to
7 * <http://cosmos-project.com>
8 *
9 * The COSMOS/core software is licenced under the
10 * GNU Lesser General Public License (LGPL) version 3 licence.
11 *
12 * You should have received a copy of the
13 * GNU Lesser General Public License
14 * If not, go to <http://www.gnu.org/licenses/>
15 *
16 * COSMOS/core is free software: you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public License
18 * as published by the Free Software Foundation, either version 3 of
19 * the License, or (at your option) any later version.
20 *
21 * COSMOS/core is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * Refer to the "licences" folder for further information on the
27 * condititons and terms to use this software.
28 ********************************************************************/
29 
30 #ifndef COSMOSAGENT_H
31 #define COSMOSAGENT_H
32 
38 
124 #include "support/configCosmos.h"
125 #include "support/cosmos-errno.h"
126 #include "support/stringlib.h"
127 #include "support/timelib.h"
128 #include "support/jsondef.h"
129 #include "support/sliplib.h"
130 #include "support/socketlib.h"
131 #include "support/jsonlib.h"
132 #include "support/elapsedtime.h"
133 #include "device/cpu/devicecpu.h"
134 
135 namespace Cosmos
136 {
137  namespace Support
138  {
139  class Agent
140  {
141  public:
142  Agent(
143  const string &node_name = "",
144  const string &agent_name = "",
145  double bprd = 0.,
146  uint32_t bsize = AGENTMAXBUFFER,
147  bool mflag = false,
148  int32_t portnum = 0,
150  uint16_t dlevel = 1
151  );
152 
153  ~Agent();
154 
156  vector<jsonentry*> sohtable;
157  vector<jsonentry*> fullsohtable;
158 
159  enum class State : uint16_t {
161  SHUTDOWN=0,
163  INIT,
165  IDLE,
167  RUN,
169  MONITOR,
171  ASAFE,
173  DEBUG,
175  RESET
176  };
177 
179 #define AGENT_MULTIPLE true
180 #define AGENT_SINGLE false
182 #define AGENT_BLOCKING SOCKET_BLOCKING
184 #define AGENT_NONBLOCKING SOCKET_NONBLOCKING
186 #define AGENT_TALK SOCKET_TALK
188 #define AGENT_LISTEN SOCKET_LISTEN
190 #define AGENT_COMMUNICATE SOCKET_COMMUNICATE
192 #define AGENT_JABBER SOCKET_JABBER
194 
196 #define AGENTBASE 10020
197 #define AGENTSENDPORT 10020
199 #define AGENTRECVPORT 10021
201 #define AGENTMCAST "225.1.1.1"
203 #define AGENTMAXLIST 500
205 #define AGENTMAXHEARTBEAT 200
207 #define AGENTRCVTIMEO 100000
209 #define AGENT_HEARTBEAT_PERIOD_MIN 0.01
211 
213 #define MESSAGE_RING_SIZE 100
214 
216  enum class AgentMessage : uint8_t {
218  ALL=1,
220  BEAT=2,
222  SOH=3,
224  GENERIC=4,
225  TIME=5,
226  LOCATION=6,
227  TRACK=7,
228  IMU=8,
230  EVENT=9,
232  REQUEST=10,
234  RESPONSE=11,
236  BINARY=128,
237  COMM=129
238  };
239 
240  enum class Where : size_t {
241  HEAD = 0,
242  TAIL = 1
243  };
244 
246 
247 #define MAXARGCOUNT 100
248 
252 
253 
257  {
259  int16_t count;
261  beatstruc *heartbeat[AGENTMAXLIST];
262  };
263 
264  struct pollstruc
265  {
266  AgentMessage type; // > 128 is binary, <128 is json, look for AGENT_MESSAGE in agentclass.h
267  uint16_t jlength; // length of JSON header
268  beatstruc beat; // all the information of the heartbeat (name, ip, etc.)
269  };
270 
272  struct messstruc
273  {
274  pollstruc meta; // agent control information
275  vector <uint8_t> bdata; // binary data if present
276  string adata; // ascii data if present
277  string jdata; // json header data, always present
278  };
279 
282  typedef int32_t (*external_request_function)(string& request_string, string& output_string, Agent* agent);
283 
286  // agent functions
287  int32_t start();
288  int32_t start_active_loop();
289  int32_t finish_active_loop();
290  int32_t add_request(string token, external_request_function function, string synopsis="", string description="");
291  int32_t send_request(beatstruc cbeat, string request, string &output, float waitsec=5.);
292  int32_t send_request_jsonnode(beatstruc cbeat, jsonnode &jnode, float waitsec=5.);
293  int32_t get_agent(string node, string agent, double waitsec, beatstruc &cbeat);
294  int32_t check_agent(string node, string agent, double waitsec);
295  beatstruc find_agent(string node, string agent, double waitsec=0.);
296  vector<beatstruc> find_agents(double waitsec=0.);
297  uint16_t running();
298  int32_t wait(State state=State::RUN, double waitsec=10.);
299  int32_t last_error();
300  int32_t set_sohstring(string list);
301  int32_t set_fullsohstring(string list);
303  void get_ip(char* buffer, size_t buflen);
304  void get_ip_list(uint16_t port);
305  int32_t unpublish();
306  int32_t post(messstruc mess);
307  int32_t post(AgentMessage type, string message="");
308  int32_t post(AgentMessage type, vector <uint8_t> message);
309  int32_t post_beat();
310  int32_t post_soh();
311  int32_t publish(NetworkType type, uint16_t port);
312  int32_t subscribe(NetworkType type, const char *address, uint16_t port);
313  int32_t subscribe(NetworkType type, const char *address, uint16_t port, uint32_t usectimeo);
314  int32_t unsubscribe();
315  // int32_t poll(pollstruc &meta, string &message, uint8_t type, float waitsec = 1.);
316  // int32_t poll(pollstruc &meta, vector <uint8_t> &message, uint8_t type, float waitsec = 1.);
317  int32_t poll(messstruc &mess, AgentMessage type, float waitsec = 1.);
318  int32_t readring(messstruc &message, AgentMessage type = Agent::AgentMessage::ALL, float waitsec = 1., Where where=Where::TAIL, string proc="", string node="");
319  int32_t parsering(AgentMessage type = Agent::AgentMessage::ALL, float waitsec=1., Where where=Where::HEAD, string proc="", string node="");
320  int32_t resizering(size_t newsize);
321  int32_t clearring();
322  // timestruc poll_time(float waitsec);
323  // beatstruc poll_beat(float waitsec);
324  // locstruc poll_location(float waitsec);
325  // nodestruc poll_info(float waitsec);
326  // imustruc poll_imu(float waitsec);
328  vector<socket_channel> find_addresses(NetworkType ntype);
329  int32_t shutdown();
330  int32_t send(uint8_t address, string message);
331  int32_t receive(uint8_t address, string &message);
332  int32_t receiveAll(uint8_t address, string &message);
333  string getNode();
334  string getAgent();
335  int32_t getJson(string node, jsonnode &jnode);
336 
337  int32_t set_agent_time_producer(double (*source)());
338  int32_t get_agent_time(double &agent_time, double &epsilon, double &delta, string agent, string node="any", double wait_sec=2.);
339 
340  // poll
342  string metaHeader;
343 
344  void log(string log_entry);
345  bool setSoh(string sohFields);
347 
349  vector <beatstruc> agent_list;
351  vector <jsonnode> node_list;
352 
354 // vector <messstruc> message_ring;
355  deque <messstruc> message_queue;
360 
362  uint16_t debug_level = 0;
363  FILE *get_debug_fd(double mjd=0.);
364  int32_t close_debug_fd();
365 
366  // agent variables
367  string nodeName;
368  string agentName;
369  vector<beatstruc> slist;
370 
371  protected:
372  private:
373 
375  double activeTimeout = 0.0; // in MJD
377  bool multiflag = false;
378  int32_t portNumber = 0;
379  FILE *debug_fd = nullptr;
381  string version = "2.0";
382  double timeoutSec = 2.0;
383  bool logTime = true; // by default
384  double timeStart; // UTC starting time for this agent in MJD
385  string hbjstring;
387  thread cthread;
389  thread hthread;
391  thread mthread;
393  int32_t error_value;
396 
399 
403  {
405  string token;
408  string synopsis;
409  string description;
410  };
411 
412  vector <request_entry> reqs;
413 
414  void heartbeat_loop();
415  void request_loop() noexcept;
416  int32_t process_request(string &bufferin, string &bufferout);
417  void message_loop();
418 
419  char* parse_request(char *input);
421 
422  static int32_t req_forward(string &request, string &response, Agent *agent);
423  static int32_t req_echo(string &request, string &response, Agent *agent);
424  static int32_t req_help(string &request, string &response, Agent *agent);
425  static int32_t req_help_json(string &request, string &response, Agent *agent);
426  static int32_t req_shutdown(string &request, string &response, Agent *agent);
427  static int32_t req_idle(string &request, string &response, Agent *agent);
428  static int32_t req_init(string &request, string &response, Agent *agent);
429  static int32_t req_monitor(string &request, string &response, Agent *agent);
430  static int32_t req_reset(string &request, string &response, Agent *agent);
431  static int32_t req_run(string &request, string &response, Agent *agent);
432  static int32_t req_status(string &request, string &response, Agent *agent);
433  static int32_t req_debug_level(string &request, string &response, Agent *agent);
434  static int32_t req_getvalue(string &request, string &response, Agent *agent);
435  static int32_t req_get_value(string &request, string &response, Agent *agent);
436  static int32_t req_get_time(string &request, string &response, Agent *agent);
437  static int32_t req_get_position(string &request, string &response, Agent *agent);
438  static int32_t req_get_position_data(string &request, string &response, Agent *agent);
439  static int32_t req_setvalue(string &request, string &response, Agent *agent);
440  static int32_t req_set_value(string &request, string &response, Agent *agent);
441  static int32_t req_listnames(string &request, string &response, Agent *agent);
442  static int32_t req_nodejson(string &request, string &response, Agent *agent);
443  static int32_t req_statejson(string &request, string &response, Agent *agent);
444  static int32_t req_utcstartjson(string &request, string &response, Agent *agent);
445  static int32_t req_piecesjson(string &request, string &response, Agent *agent);
446  static int32_t req_vertexsjson(string &request, string &response, Agent *agent);
447  static int32_t req_facesjson(string &request, string &response, Agent *agent);
448  static int32_t req_devgenjson(string &request, string &response, Agent *agent);
449  static int32_t req_devspecjson(string &request, string &response, Agent *agent);
450  static int32_t req_portsjson(string &request, string &response, Agent *agent);
451  static int32_t req_targetsjson(string &request, string &response, Agent *agent);
452  static int32_t req_heartbeat(string &request, string &response, Agent *agent);
453  static int32_t req_postsoh(string &request, string &response, Agent *agent);
454  static int32_t req_utc(string &request, string &response, Agent *agent);
455  static int32_t req_soh(string &, string &response, Agent *agent);
456  static int32_t req_fullsoh(string &, string &response, Agent *agent);
457  static int32_t req_jsondump(string &, string &response, Agent *agent);
458  };
459  } // end of namespace Support
460 } // end of namespace Cosmos
461 
462 #endif // COSMOSAGENT_H
static string port
Definition: add_radio.cpp:16
static int32_t req_run(string &request, string &response, Agent *agent)
Built-in Set state to Run request.
Definition: agentclass.cpp:977
static int32_t req_help_json(string &request, string &response, Agent *agent)
Built-in Help request.
Definition: agentclass.cpp:900
Definition: agentclass.cpp:54
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
int json_map_agentstruc(agentstruc **agent)
external_request_function efunction
Pointer to function to call with request string as argument and returning any error.
Definition: agentclass.h:407
int32_t finish_active_loop()
Definition: agentclass.cpp:355
string token
Character token for request.
Definition: agentclass.h:405
bool multiflag
Definition: agentclass.h:377
size_t message_tail
Last message rad in message ring buffer.
Definition: agentclass.h:359
FILE * get_debug_fd(double mjd=0.)
Definition: agentclass.cpp:2645
AgentMessage
Type of Agent Message. Types > 127 are binary.
Definition: agentclass.h:216
static int32_t req_get_position(string &request, string &response, Agent *agent)
Definition: agentclass.cpp:1253
string version
Definition: agentclass.h:381
double(* agent_time_producer)()
Function in which we generate our time, for the mjd request.
Definition: agentclass.h:398
beatstruc beat
Definition: agentclass.h:268
void get_ip_list(uint16_t port)
FILE * debug_fd
Definition: agentclass.h:379
Agent socket using Unicast UDP.
vector< uint8_t > bdata
Definition: agentclass.h:275
static int32_t req_utc(string &request, string &response, Agent *agent)
Definition: agentclass.cpp:1556
static double delta
Definition: agent_exec-2-0.cpp:141
static int32_t req_listnames(string &request, string &response, Agent *agent)
Built-in List Name Space Names request.
Definition: agentclass.cpp:1375
Definition: jsondef.h:923
uint16_t bsize
Definition: netperf_listen.cpp:71
int32_t receiveAll(uint8_t address, string &message)
string nodeName
Definition: agentclass.h:367
COSMOS SLIP support include file.
int32_t send_request(beatstruc cbeat, string request, string &output, float waitsec=5.)
Send a request over AGENT.
Definition: agentclass.cpp:424
string getNode()
Listen for heartbeat.
Definition: agentclass.cpp:2607
static int32_t req_facesjson(string &request, string &response, Agent *agent)
Built-in Return Face JSON request.
Definition: agentclass.cpp:1445
Where
Definition: agentclass.h:240
#define AGENTMAXLIST
Maximum AGENT server list count.
Definition: agentclass.h:204
int16_t count
Number of heartbeats in list.
Definition: agentclass.h:259
static int32_t req_jsondump(string &, string &response, Agent *agent)
Definition: agentclass.cpp:1576
static int32_t req_utcstartjson(string &request, string &response, Agent *agent)
Built-in Return UTC Start Time JSON request.
Definition: agentclass.cpp:1417
static int32_t req_piecesjson(string &request, string &response, Agent *agent)
Built-in Return Pieces JSON request.
Definition: agentclass.cpp:1431
Run without monitoring.
static int32_t req_get_value(string &request, string &response, Agent *agent)
Definition: agentclass.cpp:1123
string hbjstring
Definition: agentclass.h:385
string metaHeader
Definition: agentclass.h:342
int32_t unsubscribe()
Close COSMOS subscription channel.
Definition: agentclass.cpp:2251
vector< socket_channel > find_addresses(NetworkType ntype)
Discover interfaces.
Definition: agentclass.cpp:1917
bool logTime
Definition: agentclass.h:383
int32_t wait(State state=State::RUN, double waitsec=10.)
Definition: agentclass.cpp:398
string output
Definition: agent-2-0.cpp:56
int32_t post_soh()
Definition: agentclass.cpp:2194
int32_t process_request(string &bufferin, string &bufferout)
Definition: agentclass.cpp:743
int32_t poll(messstruc &mess, AgentMessage type, float waitsec=1.)
Listen for message.
Definition: agentclass.cpp:2264
static int32_t req_nodejson(string &request, string &response, Agent *agent)
Built-in Return Node JSON request.
Definition: agentclass.cpp:1389
int32_t set_sohstring(string list)
Set Limited SOH string.
Definition: agentclass.cpp:641
static double epsilon
Definition: agent_exec-2-0.cpp:140
double timeoutSec
Definition: agentclass.h:382
string description
Definition: agentclass.h:409
double activeTimeout
Definition: agentclass.h:375
static int32_t req_status(string &request, string &response, Agent *agent)
Built-in Status request.
Definition: agentclass.cpp:1064
static int32_t req_fullsoh(string &, string &response, Agent *agent)
Definition: agentclass.cpp:1569
mutex process_mutex
mutex to protect process_request
Definition: agentclass.h:395
Definition: agentclass.h:256
string adata
Definition: agentclass.h:276
size_t message_head
Last message placed in message ring buffer.
Definition: agentclass.h:357
string node_name
Definition: agent_001.cpp:46
int32_t send(uint8_t address, string message)
static int32_t req_statejson(string &request, string &response, Agent *agent)
Built-in Return State Vector JSON request.
Definition: agentclass.cpp:1403
thread cthread
Handle for request thread.
Definition: agentclass.h:387
int32_t close_debug_fd()
Definition: agentclass.cpp:2692
static int32_t req_get_time(string &request, string &response, Agent *agent)
Definition: agentclass.cpp:1148
uint16_t running()
Check if we&#39;re supposed to be running.
Definition: agentclass.cpp:391
static int32_t req_setvalue(string &request, string &response, Agent *agent)
Built-in Set Internal Value request.
Definition: agentclass.cpp:1345
static int32_t req_reset(string &request, string &response, Agent *agent)
Built-in Set state to Reset request.
Definition: agentclass.cpp:1033
int32_t start()
Start Agent Request and Heartbeat loops.
Definition: agentclass.cpp:337
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 receive(uint8_t address, string &message)
int32_t get_agent(string node, string agent, double waitsec, beatstruc &cbeat)
Get specific server.
Definition: agentclass.cpp:513
devicecpu include file.
int32_t post(messstruc mess)
Post a Cosmos::Agent::messstruc.
Definition: agentclass.cpp:2074
static int32_t req_debug_level(string &request, string &response, Agent *agent)
Definition: agentclass.cpp:1090
static int32_t req_getvalue(string &request, string &response, Agent *agent)
Built-in Get Internal Value request.
Definition: agentclass.cpp:1105
char address[]
Definition: netperf_listen.cpp:69
int32_t publish(NetworkType type, uint16_t port)
Open COSMOS output channel.
Definition: agentclass.cpp:1588
Definition: devicecpu.h:239
Definition: agentclass.h:264
int32_t check_agent(string node, string agent, double waitsec)
Check agent.
Definition: agentclass.cpp:546
int32_t resizering(size_t newsize)
Definition: agentclass.cpp:2454
int32_t unpublish()
Close COSMOS output channel.
Definition: agentclass.cpp:2205
char * parse_request(char *input)
static char buffer[255]
Definition: propagator_simple.cpp:60
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
static Agent * agent
ensure the Agent constructor creates only one instance per process
Definition: agent_001.cpp:45
int32_t set_fullsohstring(string list)
Set Full SOH string.
Definition: agentclass.cpp:654
static int32_t req_soh(string &, string &response, Agent *agent)
Definition: agentclass.cpp:1562
int32_t parsering(AgentMessage type=Agent::AgentMessage::ALL, float waitsec=1., Where where=Where::HEAD, string proc="", string node="")
Parse next message from ring.
Definition: agentclass.cpp:2428
uint8_t message[300]
Definition: kpc9612p_send.cpp:36
bool setSoh(string sohFields)
int waitsec
Definition: agent_add_soh.cpp:56
static int32_t req_monitor(string &request, string &response, Agent *agent)
Built-in Set state to Monitor request.
Definition: agentclass.cpp:1019
Definition: agentclass.h:139
Definition: inflate.h:23
JSON Support definitions.
uint32_t bufferSize
Definition: agentclass.h:376
Headers and definitions common to all COSMOS.
uint16_t jlength
Definition: agentclass.h:267
NetworkType
Definition: socketlib.h:63
Socket Support header file.
void heartbeat_loop()
Heartbeat Loop.
Definition: agentclass.cpp:671
static int32_t req_devspecjson(string &request, string &response, Agent *agent)
Built-in Return devspec JSON request.
Definition: agentclass.cpp:1487
Agent(const string &node_name="", const string &agent_name="", double bprd=0., uint32_t bsize=AGENTMAXBUFFER, bool mflag=false, int32_t portnum=0, NetworkType ntype=NetworkType::UDP, uint16_t dlevel=1)
Definition: agentclass.cpp:78
static int32_t req_echo(string &request, string &response, Agent *agent)
Built-in Echo request.
Definition: agentclass.cpp:880
int32_t shutdown()
Shutdown agent gracefully.
Definition: agentclass.cpp:366
void log(string log_entry)
DeviceCpu deviceCpu_
Definition: agentclass.h:420
COSMOS Error Codes.
vector< beatstruc > slist
Definition: agentclass.h:369
Storage for messages.
Definition: agentclass.h:272
vector< jsonentry * > fullsohtable
Definition: agentclass.h:157
Definition: inflate.h:21
double mjd
Definition: udp_send.cpp:41
timelib include file A library providing functions for handling various types of time.
int32_t portNumber
Definition: agentclass.h:378
static int32_t req_idle(string &request, string &response, Agent *agent)
Built-in Set state to Idle request.
Definition: agentclass.cpp:1005
#define MESSAGE_RING_SIZE
Default size of message ring buffer.
Definition: agentclass.h:213
int32_t set_agent_time_producer(double(*source)())
Definition: agentclass.cpp:2704
thread mthread
Handle for message thread.
Definition: agentclass.h:391
double currentmjd(double offset)
Current UTC in Modified Julian Days.
Definition: timelib.cpp:65
int32_t post_beat()
Definition: agentclass.cpp:2178
Elapsed Time header file.
~Agent()
Definition: agentclass.cpp:269
Agent control structure.
Definition: jsondef.h:1006
int32_t last_error()
Definition: agentclass.cpp:414
int32_t clearring()
Definition: agentclass.cpp:2466
pollstruc meta
Definition: agentclass.h:274
string jdata
Definition: agentclass.h:277
Do minimal necessary to run.
beatstruc find_agent(string node, string agent, double waitsec=0.)
Find agent.
Definition: agentclass.cpp:559
string agent_name
Definition: agent_001.cpp:47
AgentMessage type
Definition: agentclass.h:266
int32_t error_value
Last error.
Definition: agentclass.h:393
Definition: jsondef.h:724
NetworkType networkType
Definition: agentclass.h:374
NetworkType ntype
Definition: agent_node.cpp:50
static int32_t req_init(string &request, string &response, Agent *agent)
Built-in Set state to Init request.
Definition: agentclass.cpp:991
thread hthread
Handle for heartbeat thread.
Definition: agentclass.h:389
static string source
Definition: ax25_recv.cpp:42
deque< messstruc > message_queue
Ring buffer for incoming messages.
Definition: agentclass.h:355
void message_loop()
Definition: agentclass.cpp:806
cosmosstruc * get_cosmosstruc()
Return Agent cosmosstruc.
Definition: agentclass.cpp:664
static int32_t req_heartbeat(string &request, string &response, Agent *agent)
Built-in Send Heartbeat request.
Definition: agentclass.cpp:1539
vector< request_entry > reqs
Definition: agentclass.h:412
stringlib include file A library providing functions for handling various types of string...
static int32_t req_set_value(string &request, string &response, Agent *agent)
Definition: agentclass.cpp:1352
int32_t start_active_loop()
Definition: agentclass.cpp:347
int32_t send_request_jsonnode(beatstruc cbeat, jsonnode &jnode, float waitsec=5.)
Send request for Node JSON.
Definition: agentclass.cpp:477
static beatstruc cbeat
Definition: agent_file.cpp:92
cosmosstruc * cinfo
Definition: agentclass.h:346
void get_ip(char *buffer, size_t buflen)
pollstruc metaRx
Definition: agentclass.h:341
#define AGENTMAXBUFFER
Maximum AGENT transfer buffer size.
Definition: jsondef.h:438
static int32_t req_forward(string &request, string &response, Agent *agent)
Built-in Forward request.
Definition: agentclass.cpp:856
static int32_t req_vertexsjson(string &request, string &response, Agent *agent)
Built-in Return Vertex JSON request.
Definition: agentclass.cpp:1459
static int32_t req_portsjson(string &request, string &response, Agent *agent)
Built-in Return Ports JSON request.
Definition: agentclass.cpp:1501
vector< beatstruc > agent_list
List of active agents.
Definition: agentclass.h:349
int32_t(* external_request_function)(string &request_string, string &output_string, Agent *agent)
Definition: agentclass.h:282
vector< jsonentry * > sohtable
State of Health element vector.
Definition: agentclass.h:156
static int32_t req_help(string &request, string &response, Agent *agent)
Definition: agentclass.cpp:947
string debug_pathName
Definition: agentclass.h:380
static string node
Definition: agent_monitor.cpp:126
Definition: jsondef.h:4199
Definition: agentclass.h:402
vector< jsonnode > node_list
List of active Nodes.
Definition: agentclass.h:351
double timeStart
Definition: agentclass.h:384
Inertial Measurement Unit.
Definition: jsondef.h:496
int32_t getJson(string node, jsonnode &jnode)
Definition: agentclass.cpp:2612
string synopsis
Definition: agentclass.h:408
int32_t readring(messstruc &message, AgentMessage type=Agent::AgentMessage::ALL, float waitsec=1., Where where=Where::TAIL, string proc="", string node="")
Check Ring for message.
Definition: agentclass.cpp:2395
vector< beatstruc > find_agents(double waitsec=0.)
Find single server.
Definition: agentclass.cpp:605
static int32_t req_targetsjson(string &request, string &response, Agent *agent)
Built-in Return Target JSON request.
Definition: agentclass.cpp:1520
string agentName
Definition: agentclass.h:368
static int32_t req_devgenjson(string &request, string &response, Agent *agent)
Built-in Return devgen JSON request.
Definition: agentclass.cpp:1473
void request_loop() noexcept
Request Loop.
Definition: agentclass.cpp:722
int32_t subscribe(NetworkType type, const char *address, uint16_t port)
Open COSMOS channel for polling with 100 usec timeout.
Definition: agentclass.cpp:2242
State
Definition: agentclass.h:159
static int32_t req_shutdown(string &request, string &response, Agent *agent)
Built-in Set state to Shutdown request.
Definition: agentclass.cpp:1047
static int32_t req_get_position_data(string &request, string &response, Agent *agent)
Definition: agentclass.cpp:1156
static int32_t req_postsoh(string &request, string &response, Agent *agent)
Definition: agentclass.cpp:1548