COSMOS core
1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
|
Functions | |
Cosmos::Support::Agent::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) | |
Cosmos::Support::Agent::~Agent () | |
int32_t | Cosmos::Support::Agent::add_request (string token, external_request_function function, string synopsis="", string description="") |
Add internal request to Agent request list with description and synopsis. More... | |
int32_t | Cosmos::Support::Agent::start () |
Start Agent Request and Heartbeat loops. More... | |
int32_t | Cosmos::Support::Agent::start_active_loop () |
int32_t | Cosmos::Support::Agent::finish_active_loop () |
int32_t | Cosmos::Support::Agent::shutdown () |
Shutdown agent gracefully. More... | |
uint16_t | Cosmos::Support::Agent::running () |
Check if we're supposed to be running. More... | |
int32_t | Cosmos::Support::Agent::wait (State state=State::RUN, double waitsec=10.) |
int32_t | Cosmos::Support::Agent::last_error () |
int32_t | Cosmos::Support::Agent::send_request (beatstruc cbeat, string request, string &output, float waitsec=5.) |
Send a request over AGENT. More... | |
int32_t | Cosmos::Support::Agent::send_request_jsonnode (beatstruc cbeat, jsonnode &jnode, float waitsec=5.) |
Send request for Node JSON. More... | |
int32_t | Cosmos::Support::Agent::get_agent (string node, string agent, double waitsec, beatstruc &cbeat) |
Get specific server. More... | |
int32_t | Cosmos::Support::Agent::check_agent (string node, string agent, double waitsec) |
Check agent. More... | |
beatstruc | Cosmos::Support::Agent::find_agent (string node, string agent, double waitsec=0.) |
Find agent. More... | |
vector< beatstruc > | Cosmos::Support::Agent::find_agents (double waitsec=0.) |
Find single server. More... | |
int32_t | Cosmos::Support::Agent::set_sohstring (string list) |
Set Limited SOH string. More... | |
int32_t | Cosmos::Support::Agent::set_fullsohstring (string list) |
Set Full SOH string. More... | |
cosmosstruc * | Cosmos::Support::Agent::get_cosmosstruc () |
Return Agent cosmosstruc. More... | |
void | Cosmos::Support::Agent::heartbeat_loop () |
Heartbeat Loop. More... | |
void | Cosmos::Support::Agent::request_loop () noexcept |
Request Loop. More... | |
int32_t | Cosmos::Support::Agent::process_request (string &bufferin, string &bufferout) |
void | Cosmos::Support::Agent::message_loop () |
static int32_t | Cosmos::Support::Agent::req_forward (string &request, string &response, Agent *agent) |
Built-in Forward request. More... | |
static int32_t | Cosmos::Support::Agent::req_echo (string &request, string &response, Agent *agent) |
Built-in Echo request. More... | |
static int32_t | Cosmos::Support::Agent::req_help_json (string &request, string &response, Agent *agent) |
Built-in Help request. More... | |
static int32_t | Cosmos::Support::Agent::req_help (string &request, string &response, Agent *agent) |
static int32_t | Cosmos::Support::Agent::req_run (string &request, string &response, Agent *agent) |
Built-in Set state to Run request. More... | |
static int32_t | Cosmos::Support::Agent::req_init (string &request, string &response, Agent *agent) |
Built-in Set state to Init request. More... | |
static int32_t | Cosmos::Support::Agent::req_idle (string &request, string &response, Agent *agent) |
Built-in Set state to Idle request. More... | |
static int32_t | Cosmos::Support::Agent::req_monitor (string &request, string &response, Agent *agent) |
Built-in Set state to Monitor request. More... | |
static int32_t | Cosmos::Support::Agent::req_reset (string &request, string &response, Agent *agent) |
Built-in Set state to Reset request. More... | |
static int32_t | Cosmos::Support::Agent::req_shutdown (string &request, string &response, Agent *agent) |
Built-in Set state to Shutdown request. More... | |
static int32_t | Cosmos::Support::Agent::req_status (string &request, string &response, Agent *agent) |
Built-in Status request. More... | |
static int32_t | Cosmos::Support::Agent::req_debug_level (string &request, string &response, Agent *agent) |
static int32_t | Cosmos::Support::Agent::req_getvalue (string &request, string &response, Agent *agent) |
Built-in Get Internal Value request. More... | |
static int32_t | Cosmos::Support::Agent::req_get_value (string &request, string &response, Agent *agent) |
static int32_t | Cosmos::Support::Agent::req_get_time (string &request, string &response, Agent *agent) |
static int32_t | Cosmos::Support::Agent::req_get_position_data (string &request, string &response, Agent *agent) |
static int32_t | Cosmos::Support::Agent::req_get_position (string &request, string &response, Agent *agent) |
static int32_t | Cosmos::Support::Agent::req_setvalue (string &request, string &response, Agent *agent) |
Built-in Set Internal Value request. More... | |
static int32_t | Cosmos::Support::Agent::req_set_value (string &request, string &response, Agent *agent) |
static int32_t | Cosmos::Support::Agent::req_listnames (string &request, string &response, Agent *agent) |
Built-in List Name Space Names request. More... | |
static int32_t | Cosmos::Support::Agent::req_nodejson (string &request, string &response, Agent *agent) |
Built-in Return Node JSON request. More... | |
static int32_t | Cosmos::Support::Agent::req_statejson (string &request, string &response, Agent *agent) |
Built-in Return State Vector JSON request. More... | |
static int32_t | Cosmos::Support::Agent::req_utcstartjson (string &request, string &response, Agent *agent) |
Built-in Return UTC Start Time JSON request. More... | |
static int32_t | Cosmos::Support::Agent::req_piecesjson (string &request, string &response, Agent *agent) |
Built-in Return Pieces JSON request. More... | |
static int32_t | Cosmos::Support::Agent::req_facesjson (string &request, string &response, Agent *agent) |
Built-in Return Face JSON request. More... | |
static int32_t | Cosmos::Support::Agent::req_vertexsjson (string &request, string &response, Agent *agent) |
Built-in Return Vertex JSON request. More... | |
static int32_t | Cosmos::Support::Agent::req_devgenjson (string &request, string &response, Agent *agent) |
Built-in Return devgen JSON request. More... | |
static int32_t | Cosmos::Support::Agent::req_devspecjson (string &request, string &response, Agent *agent) |
Built-in Return devspec JSON request. More... | |
static int32_t | Cosmos::Support::Agent::req_portsjson (string &request, string &response, Agent *agent) |
Built-in Return Ports JSON request. More... | |
static int32_t | Cosmos::Support::Agent::req_targetsjson (string &request, string &response, Agent *agent) |
Built-in Return Target JSON request. More... | |
static int32_t | Cosmos::Support::Agent::req_heartbeat (string &request, string &response, Agent *agent) |
Built-in Send Heartbeat request. More... | |
static int32_t | Cosmos::Support::Agent::req_postsoh (string &request, string &response, Agent *agent) |
static int32_t | Cosmos::Support::Agent::req_utc (string &request, string &response, Agent *agent) |
static int32_t | Cosmos::Support::Agent::req_soh (string &, string &response, Agent *agent) |
static int32_t | Cosmos::Support::Agent::req_fullsoh (string &, string &response, Agent *agent) |
static int32_t | Cosmos::Support::Agent::req_jsondump (string &, string &response, Agent *agent) |
int32_t | Cosmos::Support::Agent::publish (NetworkType type, uint16_t port) |
Open COSMOS output channel. More... | |
vector< socket_channel > | Cosmos::Support::Agent::find_addresses (NetworkType ntype) |
Discover interfaces. More... | |
int32_t | Cosmos::Support::Agent::post (messstruc mess) |
Post a Cosmos::Agent::messstruc. More... | |
int32_t | Cosmos::Support::Agent::post (AgentMessage type, string message="") |
Post a JSON message. More... | |
int32_t | Cosmos::Support::Agent::post (AgentMessage type, vector< uint8_t > message) |
Post a binary message. More... | |
int32_t | Cosmos::Support::Agent::post_beat () |
int32_t | Cosmos::Support::Agent::post_soh () |
int32_t | Cosmos::Support::Agent::unpublish () |
Close COSMOS output channel. More... | |
int32_t | Cosmos::Support::Agent::subscribe (NetworkType type, const char *address, uint16_t port, uint32_t usectimeo) |
Open COSMOS channel for polling. More... | |
int32_t | Cosmos::Support::Agent::subscribe (NetworkType type, const char *address, uint16_t port) |
Open COSMOS channel for polling with 100 usec timeout. More... | |
int32_t | Cosmos::Support::Agent::unsubscribe () |
Close COSMOS subscription channel. More... | |
int32_t | Cosmos::Support::Agent::poll (messstruc &mess, AgentMessage type, float waitsec=1.) |
Listen for message. More... | |
int32_t | Cosmos::Support::Agent::readring (messstruc &message, AgentMessage type=Agent::AgentMessage::ALL, float waitsec=1., Where where=Where::TAIL, string proc="", string node="") |
Check Ring for message. More... | |
int32_t | Cosmos::Support::Agent::parsering (AgentMessage type=Agent::AgentMessage::ALL, float waitsec=1., Where where=Where::HEAD, string proc="", string node="") |
Parse next message from ring. More... | |
int32_t | Cosmos::Support::Agent::resizering (size_t newsize) |
int32_t | Cosmos::Support::Agent::clearring () |
string | Cosmos::Support::Agent::getNode () |
Listen for heartbeat. More... | |
string | Cosmos::Support::Agent::getAgent () |
int32_t | Cosmos::Support::Agent::getJson (string node, jsonnode &jnode) |
FILE * | Cosmos::Support::Agent::get_debug_fd (double mjd=0.) |
int32_t | Cosmos::Support::Agent::close_debug_fd () |
int32_t | Cosmos::Support::Agent::set_agent_time_producer (double(*source)()) |
int32_t | Cosmos::Support::Agent::get_agent_time (double &agent_time, double &epsilon, double &delta, string agent, string node="any", double wait_sec=2.) |
Cosmos::Support::Agent::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 |
||
) |
Add COSMOS awareness. Sets up minimum framework for COSMOS awareness. The minimum call makes a nodeless client, setting up the message ring buffer thread, and a main thread of execution. Additional parameters are related to making the program a true Agent by tieing it to a node, and starting the request and heartbeat threads.
ntype | Transport Layer protocol to be used, taken from NetworkType. Defaults to UDP Broadcast. |
node_name | Node name. Defaults to empty. |
agent_name | Agent name. Defaults to empty. If this is defined, the full Agent code will be started. |
bprd | Period, in seconds, for heartbeat. Defaults to 1. |
bsize | Size of interagent communication buffer. Defaults to AGENTMAXBUFFER. |
mflag | Boolean controlling whether or not multiple instances of the same Agent can start. If true, then Agent names will have an index number appended (eg: myname_001). If false, agent will listen for 5 seconds and terminate if it senses the Agent already running. |
portnum | The network port to listen on for requests. Defaults to 0 whereupon it will use whatever th OS assigns. |
dlevel | debug level. Defaults to 1 so that if there is an error the user can immediately see it. also initialized in the namespace variables |
Set up initial requests
Cosmos::Support::Agent::~Agent | ( | ) |
int32_t Cosmos::Support::Agent::add_request | ( | string | token, |
Agent::external_request_function | function, | ||
string | synopsis = "" , |
||
string | description = "" |
||
) |
Add internal request to Agent request list with description and synopsis.
Adds access to the indicated function by way of the given token. The provided function, internal to the agent, will be called with the request string as its argument. Any result will then be returned in the output pointer.
token | A string of maximum length COSMOS_MAX_NAME containing the token for the request. This should be the first word in the request. |
function | The user supplied function to parse the specified request. |
description | A brief description of the function performed. |
synopsis | A usage synopsis for the request. |
Adds access to the indicated function by way of the given token. The providedfunction, external to the agent, will be called with the request string as its argument. Any result will then be returned in the output pointer.
token | A string of maximum length COSMOS_MAX_NAME containing the token for the request. This should be the first word in the request. |
function | The user supplied function to parse the specified request. |
description | A brief description of the function performed. |
synopsis | A usage synopsis for the request. |
int32_t Cosmos::Support::Agent::start | ( | ) |
Start Agent Request and Heartbeat loops.
Starts the request and heartbeat threads for an Agent server initialized with Cosmos::Agent::Agent. The Agent will open its request and heartbeat channels using the address and port supplied in cinfo. The heartbeat will cycle with the period requested in cinfo.
int32_t Cosmos::Support::Agent::start_active_loop | ( | ) |
Begin Active Loop Initializes timer for active loop using ::aprd
int32_t Cosmos::Support::Agent::finish_active_loop | ( | ) |
Finish active loop Sleep for the remainder of this loops ::aprd as initialized in ::start_active_loop.
int32_t Cosmos::Support::Agent::shutdown | ( | ) |
Shutdown agent gracefully.
Waits for threads to stop running if we are a server, then releases everything.
uint16_t Cosmos::Support::Agent::running | ( | ) |
Check if we're supposed to be running.
Returns the value of the internal variable that indicates that the threads are running.
int32_t Cosmos::Support::Agent::wait | ( | State | state = State::RUN , |
double | waitsec = 10. |
||
) |
Wait on state Wait for up to waitsec seconds for Agent to enter requested state
state | Desired ::Agent::State. |
waitsec | Maximum number of seconds to wait. |
int32_t Cosmos::Support::Agent::last_error | ( | ) |
Last error value. Get value of last error returned by any function.
int32_t Cosmos::Support::Agent::send_request | ( | beatstruc | hbeat, |
string | request, | ||
string & | output, | ||
float | waitsec = 5. |
||
) |
Send a request over AGENT.
Send a request string to the process at the provided address
hbeat | The agent beatstruc |
request | the request and its arguments |
output | any output returned by the request |
waitsec | Maximum number of seconds to wait |
int32_t Cosmos::Support::Agent::send_request_jsonnode | ( | beatstruc | hbeat, |
jsonnode & | jnode, | ||
float | waitsec = 5. |
||
) |
Send request for Node JSON.
Send a set of requests to return the various JSON strings that make up a jsonnode.
hbeat | The agent beatstruc |
jnode | jsonnode cotaining Node information. |
waitsec | Maximum number of seconds to wait. |
int32_t Cosmos::Support::Agent::get_agent | ( | string | node, |
string | agent, | ||
double | waitsec, | ||
beatstruc & | rbeat | ||
) |
Get specific server.
Listen to the multicast/broadcast traffic for a set amount of time, waiting for a specific named server to appear, then return its heartbeat.
node | Node for the server. |
name | Name of the server. |
waitsec | Maximum number of seconds to wait |
rbeat | pointer to a location to store the heartbeat |
int32_t Cosmos::Support::Agent::check_agent | ( | string | node, |
string | agent, | ||
double | waitsec | ||
) |
Check agent.
Check the Cosmos::Agent::agent_list for the particular agent
agent | Name of agent. |
node | Node that agent is in. |
waitsec | Number of seconds to wait |
beatstruc Cosmos::Support::Agent::find_agent | ( | string | node, |
string | agent, | ||
double | waitsec = 0. |
||
) |
Find agent.
Check the Cosmos::Agent::agent_list for the particular agent, returning its heartbeat if found.
agent | Name of agent. |
node | Node that agent is in. |
vector< beatstruc > Cosmos::Support::Agent::find_agents | ( | double | waitsec = 0. | ) |
Find single server.
Listen to the local subnet for a set amount of time, collecting heartbeats, searching for a particular agent.
node | Node that agent is in. |
proc | Name of agent. |
waitsec | Maximum number of seconds to wait. |
Listen to the local subnet for a set amount of time,collecting heartbeats. Return a list of heartbeats collected.
waitsec | Maximum number of seconds to wait. |
Loop for waitsec seconds, filling list with any discovered heartbeats.
int32_t Cosmos::Support::Agent::set_sohstring | ( | string | list | ) |
Set Limited SOH string.
Set the Limited SOH string to a JSON list of JSON Name Space names. A proper JSON list will begin and end with matched curly braces, be comma separated, and have all strings in double quotes.
list | Properly formatted list of JSON names. |
int32_t Cosmos::Support::Agent::set_fullsohstring | ( | string | list | ) |
Set Full SOH string.
Set the Full SOH string to a JSON list of JSON Name Space names. A proper JSON list will begin and end with matched curly braces, be comma separated, and have all strings in double quotes.
list | Properly formatted list of JSON names. |
cosmosstruc * Cosmos::Support::Agent::get_cosmosstruc | ( | ) |
Return Agent cosmosstruc.
Return a pointer to the Agent's internal copy of the cosmosstruc.
|
private |
Heartbeat Loop.
This function is run as a thread to provide the Heartbeat for the Agent. The Heartbeat will consist of the contents of Agent::AGENT_MESSAG::BEAT in Cosmos::Agent::poll, plus the contents of the Cosmos::Agent::sohstring. It will come every beatstruc::bprd seconds.
|
privatenoexcept |
Request Loop.
This function is run as a thread to service requests to the Agent. It receives requests on it assigned port number, matches the first word of the request against its set of requests, and then either performs the matched function, or returns [NOK].
|
private |
|
private |
|
staticprivate |
Built-in Forward request.
Resends the received request, less count bytes, to all Publication channels of the Agent.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Echo request.
Returns the received packet, reaclculating the CRC, and adding the time.
request | Text of echo packet. |
output | Text of echoed packet. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
|
staticprivate |
|
staticprivate |
Built-in Set state to Run request.
Resends the received request, less count bytes, to all Publication channels of the Agent.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Set state to Init request.
Resends the received request, less count bytes, to all Publication channels of the Agent.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Set state to Idle request.
Resends the received request, less count bytes, to all Publication channels of the Agent.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Set state to Monitor request.
Resends the received request, less count bytes, to all Publication channels of the Agent.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Set state to Reset request.
Resends the received request, less count bytes, to all Publication channels of the Agent.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Set state to Shutdown request.
Resends the received request, less count bytes, to all Publication channels of the Agent.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Status request.
Returns agent status.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Get Debug Level request Returns or sets the debug_level value.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Get Internal Value request.
Returns the current value of the requested Name Space values. Names are expressed as a JSON object.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
Built-in Set Internal Value request.
Sets the current value of the requested Name Space values. Names and values are expressed as a JSON object.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
|
staticprivate |
Built-in List Name Space Names request.
Returns a list of all names in the JSON Name Space.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Return Node JSON request.
Returns a JSON string representing the Node description.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Return State Vector JSON request.
Returns a JSON string representing the State Vector.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Return UTC Start Time JSON request.
Returns a JSON string representing the UTC Start Time.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Return Pieces JSON request.
Returns a JSON string representing the Piece information.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Return Face JSON request.
Returns a JSON string representing the Face information.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Return Vertex JSON request.
Returns a JSON string representing the Vertex information.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Return devgen JSON request.
Returns a JSON string representing the generic device information.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Return devspec JSON request.
Returns a JSON string representing the special device information.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Return Ports JSON request.
Returns a JSON string representing the Port information.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Return Target JSON request.
Returns a JSON string representing the Target information.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
Built-in Send Heartbeat request.
Send a Heartbeat out of the regular time for heartbeats.
request | Text of request. |
output | Text of response to request. |
agent | Pointer to Cosmos::Agent to use. |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
int32_t Cosmos::Support::Agent::publish | ( | NetworkType | type, |
uint16_t | port | ||
) |
Open COSMOS output channel.
Establish a multicast socket for publishing COSMOS messages using the specified address and port.
type | One of NetworkType. |
port | Port number to publish on. |
vector< socket_channel > Cosmos::Support::Agent::find_addresses | ( | NetworkType | ntype | ) |
Discover interfaces.
Return a vector of socket_channel containing info on each valid interface. For IPV4 this will include the address and broadcast address, in both string sockaddr_in format.
ntype | Type of network (Multicast, Broadcast UDP, CSP) |
int32_t Cosmos::Support::Agent::post | ( | messstruc | mess | ) |
Post a Cosmos::Agent::messstruc.
Post an already defined message on the previously opened publication channel.
mess | Cosmos::Agent::messstruc containing everything necessary, including type, header and data. |
int32_t Cosmos::Support::Agent::post | ( | AgentMessage | type, |
string | message = "" |
||
) |
Post a JSON message.
Post a vector of bytes on the previously opened publication channel.
type | A byte indicating the type of message. |
message | A NULL terminated JSON text string to post. |
int32_t Cosmos::Support::Agent::post | ( | AgentMessage | type, |
vector< uint8_t > | message | ||
) |
Post a binary message.
Post a vector of bytes on the previously opened publication channel.
type | A byte indicating the type of message. |
message | An array of bytes to post. |
int32_t Cosmos::Support::Agent::post_beat | ( | ) |
int32_t Cosmos::Support::Agent::post_soh | ( | ) |
int32_t Cosmos::Support::Agent::unpublish | ( | ) |
Close COSMOS output channel.
Close previously opened publication channels and recover any allocated resources.
int32_t Cosmos::Support::Agent::subscribe | ( | NetworkType | type, |
const char * | address, | ||
uint16_t | port, | ||
uint32_t | usectimeo | ||
) |
Open COSMOS channel for polling.
This establishes a multicast channel for subscribing to COSMOS messages.
type | 0=Multicast, 1=Broadcast UDP, 2=Broadcast CSP. |
address | The IP Multicast address of the channel. |
port | The port to use for the channel. |
usectimeo | Blocking read timeout in micro seconds. |
int32_t Cosmos::Support::Agent::subscribe | ( | NetworkType | type, |
const char * | address, | ||
uint16_t | port | ||
) |
Open COSMOS channel for polling with 100 usec timeout.
This establishes a multicast channel for subscribing to COSMOS messages. The timeout is set to 100 usec.
type | 0=Multicast, 1=Broadcast UDP, 2=Broadcast CSP. |
address | The IP Multicast address of the channel. |
port | The port to use for the channel. |
int32_t Cosmos::Support::Agent::unsubscribe | ( | ) |
Close COSMOS subscription channel.
Close channel previously opened for polling for messages and recover resources.
int32_t Cosmos::Support::Agent::poll | ( | messstruc & | mess, |
AgentMessage | type, | ||
float | waitsec = 1. |
||
) |
Listen for message.
Poll the subscription channel for the requested amount of time. Return as soon as a single message comes in, or the timer runs out.
mess | Cosmos::Agent::messstruc for storing incoming message. |
type | Type of message to look for, taken from Cosmos::Agent::AgentMessage. |
waitsec | Number of seconds in timer. |
int32_t Cosmos::Support::Agent::readring | ( | messstruc & | message, |
AgentMessage | type = Agent::AgentMessage::ALL , |
||
float | waitsec = 1. , |
||
Where | where = Where::TAIL , |
||
string | proc = "" , |
||
string | node = "" |
||
) |
Check Ring for message.
Check the message ring for the requested amount of time. Return as soon as a message of the right type is available, or the timer runs out.
message | Vector for storing incoming message. |
type | Type of message to look for, taken from Cosmos::Agent::AgentMessage. |
waitsec | Number of seconds in timer. If 0, return last message in ring immediatelly. |
where | One of Where::HEAD or Where::TAIL, indicating whether to start at the head or tail of the ring. |
int32_t Cosmos::Support::Agent::parsering | ( | AgentMessage | type = Agent::AgentMessage::ALL , |
float | waitsec = 1. , |
||
Where | where = Where::HEAD , |
||
string | proc = "" , |
||
string | node = "" |
||
) |
Parse next message from ring.
int32_t Cosmos::Support::Agent::resizering | ( | size_t | newsize | ) |
Change size of message ring. Resize the message ring to hold a new maximum number of messages. Adjust the message pointers in the ring to be appropriate.
newsize | New maximum message count. |
int32_t Cosmos::Support::Agent::clearring | ( | ) |
Empty message ring. Set the internal pointers such that it appears that we have read any messages that are in the message ring. This has the effect of emptying the message ring as far as Cosmos::Agent::readring is concerned.
string Cosmos::Support::Agent::getNode | ( | ) |
Listen for heartbeat.
Poll the subscription channel until you receive a heartbeat message, or the timer runs out.
waitsec | Number of seconds to wait before timing out. |
Poll the subscription channel until you receive a time message, or the timer runs out.
waitsec | Number of seconds to wait before timing out. |
Poll the subscription channel until you receive a location message, or the timer runs out.
waitsec | Number of seconds to wait before timing out. |
Poll the subscription channel until you receive a info message, or the timer runs out.
waitsec | Number of seconds to wait before timing out. |
Poll the subscription channel until you receive a IMU device message, or the timer runs out.
waitsec | Number of seconds to wait before timing out. |
string Cosmos::Support::Agent::getAgent | ( | ) |
int32_t Cosmos::Support::Agent::getJson | ( | string | node, |
jsonnode & | jnode | ||
) |
FILE * Cosmos::Support::Agent::get_debug_fd | ( | double | mjd = 0. | ) |
int32_t Cosmos::Support::Agent::close_debug_fd | ( | ) |
int32_t Cosmos::Support::Agent::set_agent_time_producer | ( | double(*)() | source | ) |
int32_t Cosmos::Support::Agent::get_agent_time | ( | double & | agent_time, |
double & | epsilon, | ||
double & | delta, | ||
string | agent, | ||
string | node = "any" , |
||
double | wait_sec = 2. |
||
) |