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
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.
static SimpleAgent* GetInstance();
Returns the instance of the SimpleAgent, or nullptr
if no agent was previously created
Agent* GetComplexAgent();
Returns the regular COSMOS agent
bool IsRunning();
Checks if the agent is running
void Shutdown();
Shuts down the agent
void SetLoopPeriod(double period);
Sets the interval in seconds between iterations of the main loop
bool StartLoop();
Marks the start of a main loop iteration. Returns true
if the loop should execute.
void DebugPrint();
Prints a table containing all devices, requests, and posted properties
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!
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.
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
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