Service so that controlling components can interact with Microcontrollers on a subsystem. More...
#include <microcontroller.h>
Public Types | |
typedef std::map< std::string, bool > | DigitalStates |
typedef std::map< std::string, double > | AnalogStates |
Public Member Functions | |
Microcontroller () | |
Constructor. | |
virtual | ~Microcontroller () |
Destructor. | |
virtual bool | IsDiscoverable () const |
virtual void | SetDigitalOut (const std::string &name, const bool value)=0 |
virtual void | SetAnalogOut (const std::string &name, const double value)=0 |
virtual void | SetDigitalInput (const std::string &name, const bool value) |
Use this method to set the current value of a digital input of the Microcontroller. | |
virtual void | SetAnalogInput (const std::string &name, const double value) |
Use this method to set the current value of a analog input of the Microcontroller. | |
virtual bool | GetDigitalState (const std::string &name) const |
Returns the value of the state by name. Values for these states are set usin gthe SetDigitalInput method. | |
virtual double | GetAnalogState (const std::string &name) const |
Returns the value of the state by name. Values for these states are set usin gthe SetAnalogInput method. | |
DigitalStates | GetDigitalStates () const |
AnalogStates | GetAnalogStates () const |
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 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 | Receive (const Message *message) |
Processes message received by the Service. If not supported, then message is passed to inheriting services. | |
virtual bool | Resume () |
virtual bool | Reset () |
virtual bool | Standby () |
virtual bool | SetEmergency () |
virtual bool | ClearEmergency () |
virtual bool | ReleaseControl () |
Method called whenever control of the parent component has been released. | |
virtual void | PrintStatus () const |
Prints the status of the Primitive Driver. | |
Static Public Attributes | |
static const std::string | Name = "urn:jaus:jss:jpp:extras:Microcontroller" |
Name of service (string). | |
Protected Member Functions | |
virtual void | CheckServiceSynchronization (const unsigned int timeSinceLastCheckMs) |
If synchronization is enabled, then this method is used to subscribe to sensor data from the component we are synchronizing with. | |
virtual void | SignalEvent (const bool digital, const std::string &name) |
Method used to signal an event has occured. | |
Protected Attributes | |
Mutex | mMcuMutex |
Mutex for thread protection of data. | |
DigitalStates | mDigitalStates |
Digital State of pins. | |
AnalogStates | mAnalogStates |
Analog state of pins. |
Service so that controlling components can interact with Microcontrollers on a subsystem.
Definition at line 56 of file microcontroller.h.
typedef std::map<std::string, double> JAUS::Microcontroller::AnalogStates |
Definition at line 61 of file microcontroller.h.
typedef std::map<std::string, bool> JAUS::Microcontroller::DigitalStates |
Definition at line 60 of file microcontroller.h.
Microcontroller::Microcontroller | ( | ) |
Constructor.
Definition at line 55 of file microcontroller.cpp.
Microcontroller::~Microcontroller | ( | ) | [virtual] |
Destructor.
Definition at line 66 of file microcontroller.cpp.
void Microcontroller::CheckServiceSynchronization | ( | const unsigned int | timeSinceLastCheckMs ) | [protected, virtual] |
If synchronization is enabled, then this method is used to subscribe to sensor data from the component we are synchronizing with.
[in] | timeSinceLastCheckMs | Time since last update in ms. |
Implements JAUS::Sensor.
Definition at line 523 of file microcontroller.cpp.
virtual bool JAUS::Microcontroller::ClearEmergency | ( | ) | [inline, virtual] |
Reimplemented from JAUS::Management::Child.
Definition at line 107 of file microcontroller.h.
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 337 of file microcontroller.cpp.
bool Microcontroller::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 198 of file microcontroller.cpp.
double Microcontroller::GetAnalogState | ( | const std::string & | name ) | const [virtual] |
Returns the value of the state by name. Values for these states are set usin gthe SetAnalogInput method.
[in] | name | Name of the device to get value for. |
Definition at line 177 of file microcontroller.cpp.
AnalogStates JAUS::Microcontroller::GetAnalogStates | ( | ) | const [inline] |
Definition at line 85 of file microcontroller.h.
bool Microcontroller::GetDigitalState | ( | const std::string & | name ) | const [virtual] |
Returns the value of the state by name. Values for these states are set usin gthe SetDigitalInput method.
[in] | name | Name of the device to get value for. |
Definition at line 155 of file microcontroller.cpp.
DigitalStates JAUS::Microcontroller::GetDigitalStates | ( | ) | const [inline] |
Definition at line 83 of file microcontroller.h.
virtual bool JAUS::Microcontroller::IsDiscoverable | ( | ) | const [inline, virtual] |
Implements JAUS::Service.
Definition at line 65 of file microcontroller.h.
bool Microcontroller::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 271 of file microcontroller.cpp.
void Microcontroller::PrintStatus | ( | ) | const [virtual] |
Prints the status of the Primitive Driver.
Reimplemented from JAUS::Service.
Definition at line 481 of file microcontroller.cpp.
void Microcontroller::Receive | ( | const Message * | message ) | [virtual] |
Processes message received by the Service. If not supported, then message is passed to inheriting services.
[in] | message | Message data to process. |
Reimplemented from JAUS::Service.
Definition at line 367 of file microcontroller.cpp.
virtual bool JAUS::Microcontroller::ReleaseControl | ( | ) | [inline, virtual] |
Method called whenever control of the parent component has been released.
Reimplemented from JAUS::Management::Child.
Definition at line 109 of file microcontroller.h.
virtual bool JAUS::Microcontroller::Reset | ( | ) | [inline, virtual] |
Implements JAUS::Management::Child.
Definition at line 101 of file microcontroller.h.
virtual bool JAUS::Microcontroller::Resume | ( | ) | [inline, virtual] |
Implements JAUS::Management::Child.
Definition at line 99 of file microcontroller.h.
void Microcontroller::SetAnalogInput | ( | const std::string & | name, |
const double | value | ||
) | [virtual] |
Use this method to set the current value of a analog input of the Microcontroller.
If this analog input is set for the first time, or the value changes events will be generated automatically.
[in] | name | Name of the analog input that changed. |
[in] | value | The current value of the input [-100, 100]%. |
Definition at line 117 of file microcontroller.cpp.
virtual void JAUS::Microcontroller::SetAnalogOut | ( | const std::string & | name, |
const double | value | ||
) | [pure virtual] |
void Microcontroller::SetDigitalInput | ( | const std::string & | name, |
const bool | value | ||
) | [virtual] |
Use this method to set the current value of a digital input of the Microcontroller.
If this digital input is set for the first time, or the value changes events will be generated automatically.
[in] | name | Name of the digital input that changed. |
[in] | value | The current value of the input. |
Definition at line 83 of file microcontroller.cpp.
virtual void JAUS::Microcontroller::SetDigitalOut | ( | const std::string & | name, |
const bool | value | ||
) | [pure virtual] |
virtual bool JAUS::Microcontroller::SetEmergency | ( | ) | [inline, virtual] |
Reimplemented from JAUS::Management::Child.
Definition at line 105 of file microcontroller.h.
void Microcontroller::SignalEvent | ( | const bool | digital, |
const std::string & | name | ||
) | [protected, virtual] |
Method used to signal an event has occured.
[in] | digital | Type of change (digital data = true, analog = false). |
[in] | name | The name of the device/pin that changed. |
Definition at line 547 of file microcontroller.cpp.
virtual bool JAUS::Microcontroller::Standby | ( | ) | [inline, virtual] |
Implements JAUS::Management::Child.
Definition at line 103 of file microcontroller.h.
AnalogStates JAUS::Microcontroller::mAnalogStates [protected] |
Analog state of pins.
Definition at line 119 of file microcontroller.h.
DigitalStates JAUS::Microcontroller::mDigitalStates [protected] |
Digital State of pins.
Definition at line 118 of file microcontroller.h.
Mutex JAUS::Microcontroller::mMcuMutex [protected] |
Mutex for thread protection of data.
Definition at line 117 of file microcontroller.h.
const std::string Microcontroller::Name = "urn:jaus:jss:jpp:extras:Microcontroller" [static] |
Name of service (string).
Definition at line 59 of file microcontroller.h.