COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
agent_receive.cpp File Reference
#include "agent/agentclass.h"
#include <iostream>
Include dependency graph for agent_receive.cpp:

Functions

int main ()
 

Function Documentation

int main ( )
40 {
41 
42  Agent *agent;
43 
44  // TODO: remove telem node, replace by node on the fly
45  agent = new Agent("telem","receive");
46  if (agent->cinfo != nullptr && agent->running())
47  {
48  while (agent->running())
49  {
50  Agent::messstruc mess;
51 
52  agent->readring(mess, (Agent::AgentMessage)0xBB);
53 
54  cout << "rx: " << mess.adata << endl;
55 
56  //COSMOS_SLEEP(0.1);
57  }
58  }
59 
60  return 0;
61 }
AgentMessage
Type of Agent Message. Types > 127 are binary.
Definition: agentclass.h:216
string adata
Definition: agentclass.h:276
uint16_t running()
Check if we&#39;re supposed to be running.
Definition: agentclass.cpp:391
static Agent * agent
ensure the Agent constructor creates only one instance per process
Definition: agent_001.cpp:45
Definition: agentclass.h:139
Storage for messages.
Definition: agentclass.h:272
cosmosstruc * cinfo
Definition: agentclass.h:346
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