Quick Details

Property Value
Class SimpleAgent
Namespace cubesat
Files SimpleAgent.h
SimpleAgent.cpp

Description

The SimpleAgent class is a wrapper for existing COSMOS capabilities. It provides a cleaner and more straightforward way of using COSMOS agents.

For details on supported devices, see SimpleAgent Devices.

Functions

Declaration:
SimpleAgent(string name, string node = "cubesat");


Constructs a new SimpleAgent with the given name, running on the given node. Will throw an exception if another agent has already been created in the same program.

Declaration:
static SimpleAgent* GetInstance();


Returns the instance of the SimpleAgent, or nullptr if no agent was previously created

Declaration:
Agent* GetComplexAgent();


Returns the regular COSMOS agent

Declaration:
bool IsRunning();


Checks if the agent is running

Declaration:
void Shutdown();


Shuts down the agent

Declaration:
void SetLoopPeriod(double period);


Sets the interval in seconds between iterations of the main loop

Declaration:
bool StartLoop();


Marks the start of a main loop iteration. Returns true if the loop should execute.

Declaration:
void DebugPrint();


Prints a table containing all devices, requests, and posted properties

Declaration:
template <typename T> T* NewDevice(string name);


Creates a new device with the given type T, and with the given name. Returns a pointer to the new device. Do not delete this pointer!

Declaration:
template <typename T> T* GetDevice(string name);


Retrieves a previously-added device with the given name and type T. If the device does not exist, nullptr is returned.

Declaration:
bool AddRequest(string name, ArgumentedRequest callback, string synopsis = \"\", string description = \"\");


Adds an argumented request to the agent with the given name and callback, using the given synopsis and detailed description strings. Returns true upon success

Declaration:
bool AddRequest(string name, NonArgumentedRequest callback, string synopsis = \"\", string description = \"\");


Adds a non-argumented request to the agent with the given name and callback, using the given synopsis and detailed description strings. Returns true upon success

Tags: