The Discovery Service implementation of the Core Service Set library. More...
#include <discovery.h>
Classes | |
class | Callback |
Callback class used to be notified when a Subsystem is discovered, updated, or disconnects from system. More... | |
Public Types | |
typedef std::map< UShort, std::string > | List |
List of discovered subsystems. | |
Public Member Functions | |
Discovery () | |
Constructor. | |
~Discovery () | |
Destructor. | |
virtual bool | LoadSettings (const std::string &filename) |
Loads UDP configuration values from an XML file. Only loads values if transport has not been initialized. | |
virtual void | Initialize () |
Called on initialization. | |
virtual void | Shutdown () |
Shutsdown 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. | |
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. | |
virtual void | CheckServiceStatus (const unsigned int timeSinceLastCheckMs) |
Method called periodically by external classes and is used to verify subscriptions are still valid. | |
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. | |
void | SetComponentIdentification (const std::string &identification) |
void | SetNodeIdentification (const std::string &identification) |
void | SetSubsystemIdentification (const Subsystem::Type type, const std::string &identification) |
Sets the identification information for the subsystem. If this data is not set, then Subsystem Discovery won't work correctly. | |
bool | SetDiscoveryFrequency (const double frequencyHz) |
Sets how often the service to send a query to identify new components through the discovery process. | |
void | DiscoverSubsystems (const bool enable=true) |
Subsystem::Type | GetSubsystemType () const |
std::string | GetSubsystemIdentification () const |
std::string | GetNodeIdentification () const |
std::string | GetComponentIdentification () const |
List | GetSubsystemList () const |
List | GetVehicleList () const |
Address::List | GetComponentsWithService (const std::string &serviceName) const |
Subsystem::Ptr | GetSubsystem (const UShort id) |
Gets a pointer to the subsystem information if available. This pointer returned is thread safe. | |
Subsystem::Ptr | GetSubsystem (const Address &id) |
const Subsystem::Ptr | GetSubsystem (const UShort id) const |
Gets a pointer to the subsystem information if available. This pointer returned is thread safe. | |
const Subsystem::Ptr | GetSubsystem (const Address &id) const |
Vehicle::Ptr | GetVehicle (const UShort id) |
Gets a pointer to the vehicle information if available. This pointer returned is thread safe. Vehicle data is similar to a Subsystem, except it contains additional information such as position and orientation which is set by other services. | |
Vehicle::Ptr | GetVehicle (const Address &id) |
const Vehicle::Ptr | GetVehicle (const UShort id) const |
Gets a pointer to the vehicle information if available. This pointer returned is thread safe. Vehicle data is similar to a Subsystem, except it contains additional information such as position and orientation which is set by other services. | |
const Vehicle::Ptr | GetVehicle (const Address &id) const |
void | GetSubsystems (Subsystem::Map &subsystems) const |
Gets a copy of the subsystem data, you must delete this data. | |
void | GetVehicles (Vehicle::Map &vehicles) const |
Gets a copy of the subsystem data, you must delete this data. | |
void | RegisterCallback (Callback *callback, const bool add=true) |
Method to register a callback to receive Discovery Events. | |
void | PrintSystemConfiguration () const |
Prints system information to the console. | |
virtual void | PrintStatus () const |
Prints status info about the Service to the console. | |
void | TriggerDiscoveryCallbacks () |
Triggers Discovery callbacks. Only use if you are updating subsystem data externally from Discovery service. | |
void | SetSubsystemsToDiscover (const std::set< UShort > &toDiscover) |
By default, all subsystems are discovered. Use this method to filter out to only a specific set of subsystems you are interested in. | |
std::set< UShort > | GetSubsystemsToDiscover () const |
Static Public Attributes | |
static const std::string | Name = "urn:jaus:jss:core:Discovery" |
String name of the Service. |
The Discovery Service implementation of the Core Service Set library.
The process of discovery is conducted at both the node level and the subsystem level. This service supports the discovery of both legacy components defined the JAUS Reference Architecture 3.2+, and new components. The Component IDs of legacy components were fixed at specification time (Primitive Driver == 33 for example) and could only contain one service beyond the core service support. New components may use any component ID that is not used in the Reference Architecture for legacy component definitions. New components can also contain two or more services beyond the core service support.
Definition at line 75 of file discovery.h.
typedef std::map<UShort, std::string> JAUS::Discovery::List |
List of discovered subsystems.
Definition at line 94 of file discovery.h.
Discovery::Discovery | ( | ) |
Constructor.
Definition at line 68 of file discovery.cpp.
Discovery::~Discovery | ( | ) |
Destructor.
Definition at line 84 of file discovery.cpp.
void Discovery::CheckServiceStatus | ( | const unsigned int | timeSinceLastCheckMs ) | [virtual] |
Method called periodically by external classes and is used to verify subscriptions are still valid.
[in] | timeSinceLastCheckMs | Number of milliseconds since the last time this method was called. |
Reimplemented from JAUS::Service.
Definition at line 740 of file discovery.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 691 of file discovery.cpp.
void JAUS::Discovery::DiscoverSubsystems | ( | const bool | enable = true ) |
[inline] |
Definition at line 129 of file discovery.h.
bool Discovery::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 883 of file discovery.cpp.
std::string JAUS::Discovery::GetComponentIdentification | ( | ) | const [inline] |
Definition at line 137 of file discovery.h.
Address::List Discovery::GetComponentsWithService | ( | const std::string & | serviceName ) | const |
Definition at line 1075 of file discovery.cpp.
std::string JAUS::Discovery::GetNodeIdentification | ( | ) | const [inline] |
Definition at line 135 of file discovery.h.
Subsystem::Ptr Discovery::GetSubsystem | ( | const UShort | id ) |
Gets a pointer to the subsystem information if available. This pointer returned is thread safe.
[in] | id | The subsystem ID number of the subsystem. |
Definition at line 1129 of file discovery.cpp.
Subsystem::Ptr JAUS::Discovery::GetSubsystem | ( | const Address & | id ) | [inline] |
Definition at line 147 of file discovery.h.
const Subsystem::Ptr Discovery::GetSubsystem | ( | const UShort | id ) | const |
Gets a pointer to the subsystem information if available. This pointer returned is thread safe.
[in] | id | The subsystem ID number of the subsystem. |
Definition at line 1163 of file discovery.cpp.
const Subsystem::Ptr JAUS::Discovery::GetSubsystem | ( | const Address & | id ) | const [inline] |
Definition at line 151 of file discovery.h.
std::string JAUS::Discovery::GetSubsystemIdentification | ( | ) | const [inline] |
Definition at line 133 of file discovery.h.
Discovery::List Discovery::GetSubsystemList | ( | ) | const |
Definition at line 1018 of file discovery.cpp.
void Discovery::GetSubsystems | ( | Subsystem::Map & | subsystems ) | const |
Gets a copy of the subsystem data, you must delete this data.
An easy way to delete the data is with the Subsystem::DeleteSubsystemMap method.
[in] | subsystems | Where to save the system configuration to. |
Definition at line 1276 of file discovery.cpp.
std::set< UShort > Discovery::GetSubsystemsToDiscover | ( | ) | const |
Definition at line 1511 of file discovery.cpp.
Subsystem::Type JAUS::Discovery::GetSubsystemType | ( | ) | const [inline] |
Definition at line 131 of file discovery.h.
Vehicle::Ptr JAUS::Discovery::GetVehicle | ( | const Address & | id ) | [inline] |
Definition at line 155 of file discovery.h.
const Vehicle::Ptr JAUS::Discovery::GetVehicle | ( | const Address & | id ) | const [inline] |
Definition at line 159 of file discovery.h.
Vehicle::Ptr Discovery::GetVehicle | ( | const UShort | id ) |
Gets a pointer to the vehicle information if available. This pointer returned is thread safe. Vehicle data is similar to a Subsystem, except it contains additional information such as position and orientation which is set by other services.
[in] | id | The subsystem ID number of the vehicle. |
Definition at line 1199 of file discovery.cpp.
const Vehicle::Ptr Discovery::GetVehicle | ( | const UShort | id ) | const |
Gets a pointer to the vehicle information if available. This pointer returned is thread safe. Vehicle data is similar to a Subsystem, except it contains additional information such as position and orientation which is set by other services.
[in] | id | The subsystem ID number of the vehicle. |
Definition at line 1239 of file discovery.cpp.
Discovery::List Discovery::GetVehicleList | ( | ) | const |
Definition at line 1045 of file discovery.cpp.
void Discovery::GetVehicles | ( | Vehicle::Map & | vehicles ) | const |
Gets a copy of the subsystem data, you must delete this data.
An easy way to delete the data is with the Subsystem::DeleteSubsystemMap method.
[in] | vehicles | Where to save the system configuration to. |
Definition at line 1312 of file discovery.cpp.
void Discovery::Initialize | ( | ) | [virtual] |
Called on initialization.
Reimplemented from JAUS::Service.
Definition at line 152 of file discovery.cpp.
virtual bool JAUS::Discovery::IsDiscoverable | ( | ) | const [inline, virtual] |
Implements JAUS::Service.
Definition at line 104 of file discovery.h.
bool Discovery::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 953 of file discovery.cpp.
bool Discovery::LoadSettings | ( | const std::string & | filename ) | [virtual] |
Loads UDP configuration values from an XML file. Only loads values if transport has not been initialized.
[in] | filename | File containing Service settings data. |
Reimplemented from JAUS::Service.
Definition at line 106 of file discovery.cpp.
void Discovery::PrintStatus | ( | ) | const [virtual] |
Prints status info about the Service to the console.
Reimplemented from JAUS::Service.
Definition at line 1434 of file discovery.cpp.
void Discovery::PrintSystemConfiguration | ( | ) | const |
Prints system information to the console.
Definition at line 1369 of file discovery.cpp.
void Discovery::Receive | ( | const Message * | message ) | [virtual] |
Processes message received by the Service. If not supported, then message is passed to inheriting services.
This Service supports Discovery related messages only.
[in] | message | Message data to process. |
Reimplemented from JAUS::Service.
Definition at line 200 of file discovery.cpp.
void Discovery::RegisterCallback | ( | Callback * | callback, |
const bool | add = true |
||
) |
Method to register a callback to receive Discovery Events.
Discovery events include changes in configuration, identification, etc. to a subsystem.
[in] | callback | Pointer to callback to add/remove. |
[in] | add | If true, callback is added, if false, it is removed. |
Definition at line 1345 of file discovery.cpp.
void JAUS::Discovery::SetComponentIdentification | ( | const std::string & | identification ) | [inline] |
Definition at line 120 of file discovery.h.
bool Discovery::SetDiscoveryFrequency | ( | const double | frequencyHz ) |
Sets how often the service to send a query to identify new components through the discovery process.
[in] | frequencyHz | The frequency to broadcast a query message in Hz. |
Definition at line 1002 of file discovery.cpp.
void JAUS::Discovery::SetNodeIdentification | ( | const std::string & | identification ) | [inline] |
Definition at line 122 of file discovery.h.
void Discovery::SetSubsystemIdentification | ( | const Subsystem::Type | type, |
const std::string & | identification | ||
) |
Sets the identification information for the subsystem. If this data is not set, then Subsystem Discovery won't work correctly.
[in] | type | Type of subsystem. |
[in] | identification | Subsystem identification string [255 char max]. |
Definition at line 984 of file discovery.cpp.
void Discovery::SetSubsystemsToDiscover | ( | const std::set< UShort > & | toDiscover ) |
By default, all subsystems are discovered. Use this method to filter out to only a specific set of subsystems you are interested in.
[in] | toDiscover | Subsystems to discovery. |
Definition at line 1498 of file discovery.cpp.
void Discovery::Shutdown | ( | ) | [virtual] |
Shutsdown the service.
Reimplemented from JAUS::Service.
Definition at line 181 of file discovery.cpp.
void Discovery::TriggerDiscoveryCallbacks | ( | ) |
Triggers Discovery callbacks. Only use if you are updating subsystem data externally from Discovery service.
Definition at line 1451 of file discovery.cpp.
const std::string Discovery::Name = "urn:jaus:jss:core:Discovery" [static] |
String name of the Service.
Definition at line 78 of file discovery.h.