Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes

JAUS::Microcontroller Class Reference

Service so that controlling components can interact with Microcontrollers on a subsystem. More...

#include <microcontroller.h>

Inheritance diagram for JAUS::Microcontroller:
JAUS::Management::Child JAUS::Sensor JAUS::AccessControl::Child JAUS::Events::Child JAUS::Service

List of all members.

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 MessageCreateMessage (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.

Detailed Description

Service so that controlling components can interact with Microcontrollers on a subsystem.

Definition at line 56 of file microcontroller.h.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

Microcontroller::Microcontroller (  )

Constructor.

Definition at line 55 of file microcontroller.cpp.

Microcontroller::~Microcontroller (  ) [virtual]

Destructor.

Definition at line 66 of file microcontroller.cpp.


Member Function Documentation

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.

Parameters:
[in]timeSinceLastCheckMsTime 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.

Message * Microcontroller::CreateMessage ( const UShort  messageCode ) const [virtual]

Attempts to create the message desired. Only message supported by this Service can be created by this Service.

Parameters:
[in]messageCodeMessage to create.
Returns:
Pointer to newly allocated Message data, NULL if message is not supported by the Service.

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.

Parameters:
[in]infoThe event information (ID, Sequence #, etc.) for generation.
Returns:
True if event generated, otherwise false.

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.

Parameters:
[in]nameName of the device to get value for.
Returns:
Value of the analog state. If not set, value returned is 0.0.

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.

Parameters:
[in]nameName of the device to get value for.
Returns:
True if state is on, false if off.

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.

Parameters:
[in]typeThe event type (Periodic/EveryChange).
[in]requestedPeriodicRateIf type == Periodic, then this is the desired update rate.
[in]queryMessageThe query message associated with the event.
[out]confirmedPeriodicRateThis is the confirmed periodic rate supported by the Service.
[out]errorMessageIf not supported, this is an optional error message.
Returns:
True if event supported, otherwise false.

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.

Parameters:
[in]messageMessage 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.

Parameters:
[in]nameName of the analog input that changed.
[in]valueThe 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.

Parameters:
[in]nameName of the digital input that changed.
[in]valueThe 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.

Parameters:
[in]digitalType of change (digital data = true, analog = false).
[in]nameThe 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.


Member Data Documentation

Analog state of pins.

Definition at line 119 of file microcontroller.h.

Digital State of pins.

Definition at line 118 of file microcontroller.h.

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.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines