The Management Service provides a state machine for the component life-cycle maangement to help clients understand how the component will react to commands and queries. More...
#include <management.h>
Classes | |
class | Child |
Class that all direct child Services of Management must inherit from to support state transitions. More... | |
class | Status |
Namespace for different states the Services can be in. More... | |
Public Member Functions | |
Management () | |
Constructor. | |
~Management () | |
Destructor. | |
virtual bool | Resume (const Address &id, const unsigned int waitTimeMs=Service::DefaultWaitMs) |
Sends a Resume command and then if desired confirms the state transition by sending a Query Status message. | |
virtual bool | Standby (const Address &id, const unsigned int waitTimeMs=0) |
Sends a Standby command and then if desired confirms the state transition by sending a Query Status message. | |
virtual bool | SetEmergency (const Address &id, const unsigned int waitTimeMs=Service::DefaultWaitMs) |
Sends a Set Emergency command and then if desired confirms the state transition by sending a Query Status message. | |
virtual bool | ClearEmergency (const Address &id, const unsigned int waitTimeMs=Service::DefaultWaitMs) |
Sends a Clear Emergency command and then if desired confirms the state transition by sending a Query Status message. | |
virtual bool | Shutdown (const Address &id) |
Sends a Shutdown command to a component. | |
virtual void | Initialize () |
Initializes the service. | |
virtual void | Shutdown () |
Shutsdown the service. | |
virtual bool | GenerateEvent (const Events::Subscription &info) const |
Generates an event for the given information. | |
virtual bool | IsEventSupported (const Events::Type type, const double requestedPeriodicRate, const Message *queryMessage, double &confirmedPeriodicRate, std::string &errorMessage) const |
Checks if the event is supported by the Service. | |
virtual bool | IsDiscoverable () const |
virtual void | Receive (const Message *message) |
Processes message received by the Service. If not supported, then message is passed to inheriting services depending on what type of control has been established for the component. | |
virtual Message * | CreateMessage (const UShort messageCode) const |
Attempts to create the message desired. Only message supported by this Service can be created by this Service. | |
bool | SetStatus (const Byte state) |
Sets the status of the Service. | |
Byte | GetStatus () const |
int | GetComponentStatus (const Address &id, const unsigned int waitTimeMs=Service::DefaultWaitMs) const |
Gets the status of a component. | |
virtual bool | RequestControl () |
This method is called whenever control of the parent component for your services has been requested. | |
virtual bool | ReleaseControl () |
Whenever control is released, revert back to a Standby state because we cannot be in Ready state. | |
virtual void | PrintStatus () const |
Prints status info about the Service to the console. | |
virtual void | PrintStatus (const bool allData) const |
Prints status info about the Service to the console. | |
void | CheckServiceStatus (const unsigned int timeSinceLastCheckMs) |
Method called periodically by external classes and is used to verify control of components. | |
Static Public Attributes | |
static const std::string | Name = "urn:jaus:jss:core:Management" |
String name of the Service. | |
Protected Attributes | |
Time::Stamp | mCheckStatusTimeMs |
The last time status was checked for subsystem. | |
volatile Byte | mStatus |
Status of the service (what state are we in). | |
Mutex | mStatesMutex |
Mutex for states information. | |
std::map< Address, int > | mSubsystemStates |
States/Status of components for this subsystem. |
The Management Service provides a state machine for the component life-cycle maangement to help clients understand how the component will react to commands and queries.
This implementation controls that status of the Component (e.g. ready, standby) and has method to change the state of components.
Definition at line 66 of file management.h.
Management::Management | ( | ) |
Constructor.
Definition at line 140 of file management.cpp.
Management::~Management | ( | ) |
Destructor.
Definition at line 152 of file management.cpp.
void Management::CheckServiceStatus | ( | const unsigned int | timeSinceLastCheckMs ) | [virtual] |
Method called periodically by external classes and is used to verify control of components.
[in] | timeSinceLastCheckMs | Number of milliseconds since the last time this method was called. |
Reimplemented from JAUS::Service.
Definition at line 921 of file management.cpp.
bool Management::ClearEmergency | ( | const Address & | id, |
const unsigned int | waitTimeMs = Service::DefaultWaitMs |
||
) | [virtual] |
Sends a Clear Emergency command and then if desired confirms the state transition by sending a Query Status message.
[in] | id | ID of the component to send command to. |
[in] | waitTimeMs | If greater than 0, how long to wait for a Report Status response to confirm state transition. If value is 0, then no confirmation is made. |
Definition at line 323 of file management.cpp.
Attempts to create the message desired. Only message supported by this Service can be created by this Service.
[in] | messageCode | Message to create. |
Implements JAUS::Service.
Definition at line 646 of file management.cpp.
bool Management::GenerateEvent | ( | const Events::Subscription & | info ) | const [virtual] |
Generates an event for the given information.
[in] | info | The event information (ID, Sequence #, etc.) for generation. |
Implements JAUS::Events::Child.
Definition at line 414 of file management.cpp.
int Management::GetComponentStatus | ( | const Address & | id, |
const unsigned int | waitTimeMs = Service::DefaultWaitMs |
||
) | const |
Gets the status of a component.
If the component is part of the same subsystem, then waitTimeMs is usually ignored because in JAUS++ the Management Service automatically keeps track of the state of other components on the same subsystem. Only if the state hasn't been found yet is a message sent to componentID.
[in] | id | ID of the component to get status of. |
[in] | waitTimeMs | How long to wait for response from component. |
Definition at line 776 of file management.cpp.
Byte JAUS::Management::GetStatus | ( | ) | const [inline] |
Definition at line 166 of file management.h.
void Management::Initialize | ( | ) | [virtual] |
Initializes the service.
Reimplemented from JAUS::Service.
Definition at line 387 of file management.cpp.
virtual bool JAUS::Management::IsDiscoverable | ( | ) | const [inline, virtual] |
Implements JAUS::Service.
Definition at line 158 of file management.h.
bool Management::IsEventSupported | ( | const Events::Type | type, |
const double | requestedPeriodicRate, | ||
const Message * | queryMessage, | ||
double & | confirmedPeriodicRate, | ||
std::string & | errorMessage | ||
) | const [virtual] |
Checks if the event is supported by the Service.
[in] | type | The event type (Periodic/EveryChange). |
[in] | requestedPeriodicRate | If type == Periodic, then this is the desired update rate. |
[in] | queryMessage | The query message associated with the event. |
[out] | confirmedPeriodicRate | This is the confirmed periodic rate supported by the Service. |
[out] | errorMessage | If not supported, this is an optional error message. |
Implements JAUS::Events::Child.
Definition at line 442 of file management.cpp.
void Management::PrintStatus | ( | ) | const [virtual] |
Prints status info about the Service to the console.
Reimplemented from JAUS::Service.
Definition at line 816 of file management.cpp.
void Management::PrintStatus | ( | const bool | allData ) | const [virtual] |
Prints status info about the Service to the console.
[in] | allData | If true, state information for all components on this subsystem are displayed also. |
Definition at line 851 of file management.cpp.
void Management::Receive | ( | const Message * | message ) | [virtual] |
Processes message received by the Service. If not supported, then message is passed to inheriting services depending on what type of control has been established for the component.
This Service supports Management related messages only.
[in] | message | Message data to process. |
Reimplemented from JAUS::Service.
Definition at line 474 of file management.cpp.
bool Management::ReleaseControl | ( | ) | [virtual] |
Whenever control is released, revert back to a Standby state because we cannot be in Ready state.
Reimplemented from JAUS::AccessControl::Child.
Definition at line 754 of file management.cpp.
virtual bool JAUS::Management::RequestControl | ( | ) | [inline, virtual] |
This method is called whenever control of the parent component for your services has been requested.
Reimplemented from JAUS::AccessControl::Child.
Definition at line 170 of file management.h.
bool Management::Resume | ( | const Address & | id, |
const unsigned int | waitTimeMs = Service::DefaultWaitMs |
||
) | [virtual] |
Sends a Resume command and then if desired confirms the state transition by sending a Query Status message.
[in] | id | ID of the component to send command to. |
[in] | waitTimeMs | If greater than 0, how long to wait for a Report Status response to confirm state transition. If value is 0, then no confirmation is made. |
Definition at line 171 of file management.cpp.
bool Management::SetEmergency | ( | const Address & | id, |
const unsigned int | waitTimeMs = Service::DefaultWaitMs |
||
) | [virtual] |
Sends a Set Emergency command and then if desired confirms the state transition by sending a Query Status message.
[in] | id | ID of the component to send command to. |
[in] | waitTimeMs | If greater than 0, how long to wait for a Report Status response to confirm state transition. If value is 0, then no confirmation is made. |
Definition at line 284 of file management.cpp.
bool Management::SetStatus | ( | const Byte | state ) |
Sets the status of the Service.
[in] | state | Desired state. |
Definition at line 692 of file management.cpp.
void Management::Shutdown | ( | ) | [virtual] |
Shutsdown the service.
Reimplemented from JAUS::Service.
Definition at line 399 of file management.cpp.
bool Management::Shutdown | ( | const Address & | id ) | [virtual] |
Sends a Shutdown command to a component.
[in] | id | ID of the component to send command to.If ID is invalid (i.e. 0.0.0), then all components we have control of are sent the command. |
Definition at line 359 of file management.cpp.
bool Management::Standby | ( | const Address & | id, |
const unsigned int | waitTimeMs = 0 |
||
) | [virtual] |
Sends a Standby command and then if desired confirms the state transition by sending a Query Status message.
[in] | id | ID of the component to send command to. If ID is invalid (i.e. 0.0.0), then all components we have control of are sent the command. |
[in] | waitTimeMs | If greater than 0, how long to wait for a Report Status response to confirm state transition. If value is 0, then no confirmation of state change is made (default). |
Definition at line 226 of file management.cpp.
Time::Stamp JAUS::Management::mCheckStatusTimeMs [protected] |
The last time status was checked for subsystem.
Definition at line 180 of file management.h.
Mutex JAUS::Management::mStatesMutex [protected] |
Mutex for states information.
Definition at line 182 of file management.h.
volatile Byte JAUS::Management::mStatus [protected] |
Status of the service (what state are we in).
Definition at line 181 of file management.h.
std::map<Address, int> JAUS::Management::mSubsystemStates [protected] |
States/Status of components for this subsystem.
Definition at line 183 of file management.h.
const std::string Management::Name = "urn:jaus:jss:core:Management" [static] |
String name of the Service.
Definition at line 126 of file management.h.