| |
libFAUDES
Sections
Index
|
faudes::sDevice Class Reference |
Public Member Functions | |
sDevice (void) | |
Default constructor. | |
sDevice (const sDevice &rOtherDevice) | |
copy-constructor | |
virtual | ~sDevice (void) |
Explicit destructor. | |
virtual void | Clear (void) |
Clear all configuration. | |
virtual void | Compile (void) |
Build up internal data-structure(e.g. | |
int | MaxBitAddress (void) const |
Report max bit address. | |
virtual void | Start (void) |
Activate the device. | |
virtual void | Stop (void) |
Deactivate the device. | |
virtual void | Reset (void) |
Clear dynamic data and restart device. | |
virtual void | WriteActuator (Idx actuator) |
Run actuator command. | |
void | WriteSignal (int bitaddr, bool value) |
Set output signal. | |
bool | ReadSignal (int bitaddr) |
Get input signal. | |
virtual int | CycleTime () const |
Report cycle time. | |
virtual void | CycleTime (int cycleTime) |
Set cycle time. | |
Protected Member Functions | |
void | DoWritePreface (TokenWriter &rTw, const std::string &rLabel, const Type *pContext=0) const |
Writes non-event-configuration to TokenWriter. | |
virtual void | DoReadPreface (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
Reads non-event-configuration data from TokenReader. | |
virtual bool | DoReadSignalsPre (void) |
IO Hook, sensors. | |
virtual void | DoReadSignalsPost (void) |
IO Hook, sensors. | |
virtual bool | DoReadSignal (int bitaddr)=0 |
Sample input signal. | |
virtual bool | DoWriteSignalsPre (void) |
IO Hook, actuators. | |
virtual void | DoWriteSignalsPost (void) |
IO Hook, actuator. | |
virtual void | DoWriteSignal (int bitaddr, bool value)=0 |
Reimplement this function in a derived class for actual harware access to set or clear an output signal. | |
Protected Attributes | |
TaNameSet< AttributeSignalEvent > * | pConfiguration |
Overall configuration (with actual type). | |
std::map< int, EventSet > | mSensorPosEdgeIndexMap |
Reverse sensor map: map signal edges to logical event sets. | |
std::map< int, EventSet > | mSensorNegEdgeIndexMap |
Reverse sensor map: map signal edges to logical event sets. | |
int | mMaxBitAddress |
Address range. | |
Private Member Functions | |
void | ClrSensorSignals (void) |
clear all sensor states | |
void | ClrActuatorSignals (void) |
clear all actuator values | |
Private Attributes | |
pthread_mutex_t | mMutex |
Background: mutex for below shared variables. | |
pthread_t | mThreadSynchro |
Background: thread handle (global). | |
int | mCycleTime |
Cycle time of background thread in usecs (shared). | |
int | mCycleCount |
Background: cycle counter (shared). | |
int | mRecentCycleCount |
Background: cycle counte (global only). | |
Edges * | mpSensorEdges |
Background: accumulated edges (shared). | |
Edges * | mpRecentSensorEdges |
Background: recently accumulated edges (global only). | |
bool | mSensorReady |
Background: some sensor event did occur (shared). | |
bool | mCancelRequest |
Background: terminate-flag for endless-loop. | |
Friends | |
void * | SDeviceSynchro (void *) |
Classes | |
struct | Edges |
Background: type def for edge detection. More... |
faudes::sDevice::sDevice | ( | void | ) |
faudes::sDevice::sDevice | ( | const sDevice & | rOtherDevice | ) |
copy-constructor
faudes::sDevice::~sDevice | ( | void | ) | [virtual] |
void faudes::sDevice::Clear | ( | void | ) | [virtual] |
Clear all configuration.
This implies Stop().
Reimplemented from faudes::vDevice.
Definition at line 418 of file iop_sdevice.cpp.
void faudes::sDevice::Compile | ( | void | ) | [virtual] |
Build up internal data-structure(e.g.
signal-event - mapping)
Reimplemented from faudes::vDevice.
Definition at line 431 of file iop_sdevice.cpp.
int faudes::sDevice::MaxBitAddress | ( | void | ) | const [inline] |
Report max bit address.
Definition at line 324 of file iop_sdevice.h.
void faudes::sDevice::Start | ( | void | ) | [virtual] |
Activate the device.
This function enables actuator execution and sensor reading. It starts the background thread for edge detection and sensor event buffer.
Exception |
|
Reimplemented from faudes::vDevice.
Definition at line 356 of file iop_sdevice.cpp.
void faudes::sDevice::Stop | ( | void | ) | [virtual] |
Deactivate the device.
This function disables actuator execution and sensor reading. It stops the backhround thread and resets all actuator signals to 0.
Reimplemented from faudes::vDevice.
Definition at line 383 of file iop_sdevice.cpp.
void faudes::sDevice::Reset | ( | void | ) | [virtual] |
Clear dynamic data and restart device.
Reimplemented from faudes::vDevice.
Definition at line 406 of file iop_sdevice.cpp.
void faudes::sDevice::WriteActuator | ( | Idx | actuator | ) | [virtual] |
Run actuator command.
Exception |
|
Implements faudes::vDevice.
Definition at line 719 of file iop_sdevice.cpp.
void faudes::sDevice::WriteSignal | ( | int | bitaddr, | |
bool | value | |||
) |
Set output signal.
This function provides user level access to output signals. It executes the virtual pre and post hook methods and the likewise virtual actual harware access to set the signal level via DoWriteSignal(int,bool).
bitaddr | Abstract bit address | |
value | True for active/high/1/set; false for passive/low/0/clr; |
Definition at line 512 of file iop_sdevice.cpp.
bool faudes::sDevice::ReadSignal | ( | int | bitaddr | ) |
Get input signal.
This function provides user level access to input signals. It executes the virtual pre and post hook methods and the likewise virtual actual harware access to sample an input signal via DoReadSignal(int).
bitaddr | Abstract bit address |
Definition at line 492 of file iop_sdevice.cpp.
int faudes::sDevice::CycleTime | ( | void | ) | const [virtual] |
void faudes::sDevice::CycleTime | ( | int | cycleTime | ) | [virtual] |
Set cycle time.
cycleTime | Desired cycle time in ms |
Definition at line 479 of file iop_sdevice.cpp.
void faudes::sDevice::DoWritePreface | ( | TokenWriter & | rTw, | |
const std::string & | rLabel, | |||
const Type * | pContext = 0 | |||
) | const [protected, virtual] |
Writes non-event-configuration to TokenWriter.
This function is part of the non-event-configuration data output-system. Device data will be written w.r.t the class-hierarchy. Therefore first thing to do is to the base class. See vDevice::DoWritePreface for further information.
After base-class function returned the mMaxBitAdress and mCycleTime will be written to tokenwriter.
Note: in order to keep the outputfile-layout as easy as possible no label will be used to separate this data-section. Never the less a default-label ("SignalDevice") is specified.
rTw | TokenWriter to write | |
rLabel | Section to write | |
pContext | Context to provide contextual information |
Reimplemented from faudes::vDevice.
Definition at line 312 of file iop_sdevice.cpp.
void faudes::sDevice::DoReadPreface | ( | TokenReader & | rTr, | |
const std::string & | rLabel = "" , |
|||
const Type * | pContext = 0 | |||
) | [protected, virtual] |
Reads non-event-configuration data from TokenReader.
This function is part of the non-event-configuration data input-system. Device data will be read w.r.t the class-hierarchy. Therefore first thing to do is to call the base class. See vDevice::DoReadPreface for further information.
After base-class returned the mMaxBitAddress and mCycleTime will be read. The max. bit-address depends on the IO-card used while the cycle-time should be chosen depending on the physical plant to control.
Note: in order to keep the inputfile-layout as easy as possible no label will be used to separate this data-section. Never the less a default-label ("SignalDevice") is specified.
rTr | TokenReader to read from | |
rLabel | Section to read | |
pContext | Read context to provide contextual information |
Reimplemented from faudes::vDevice.
Definition at line 323 of file iop_sdevice.cpp.
virtual bool faudes::sDevice::DoReadSignalsPre | ( | void | ) | [inline, protected, virtual] |
IO Hook, sensors.
The background thread calls this hook before reading sensor signals. You may reimplement this method to e.g. prepare a process image.
Definition at line 472 of file iop_sdevice.h.
virtual void faudes::sDevice::DoReadSignalsPost | ( | void | ) | [inline, protected, virtual] |
IO Hook, sensors.
The background thread calls this hook after reading sensor signals. You may reimplement this method to e.g. release a process image.
Definition at line 482 of file iop_sdevice.h.
virtual bool faudes::sDevice::DoReadSignal | ( | int | bitaddr | ) | [protected, pure virtual] |
Sample input signal.
Reimplement this function to implements actual harware access to sample an input signal. This function gets called from the periodic background thread to sense edges. It is guaranteed that the pre and post hook is executed before/afterwards.
bitaddr | Abstract bit address |
virtual bool faudes::sDevice::DoWriteSignalsPre | ( | void | ) | [inline, protected, virtual] |
IO Hook, actuators.
The background thread calls this hook before reading sensor signals. You may reimplement this method to e.g. prepare a process image.
Definition at line 508 of file iop_sdevice.h.
virtual void faudes::sDevice::DoWriteSignalsPost | ( | void | ) | [inline, protected, virtual] |
IO Hook, actuator.
The background thread calls this hook after reading sensor signals. You may reimplement this method to e.g. release a process image.
Definition at line 518 of file iop_sdevice.h.
virtual void faudes::sDevice::DoWriteSignal | ( | int | bitaddr, | |
bool | value | |||
) | [protected, pure virtual] |
Reimplement this function in a derived class for actual harware access to set or clear an output signal.
Hooks are executoed appropriately.
bitaddr | Abstract bit address | |
value | True for active/high/1/set; false for passive/low/0/clr; |
void faudes::sDevice::ClrSensorSignals | ( | void | ) | [private] |
void faudes::sDevice::ClrActuatorSignals | ( | void | ) | [private] |
void* SDeviceSynchro | ( | void * | ) | [friend] |
Definition at line 531 of file iop_sdevice.cpp.
TaNameSet<AttributeSignalEvent>* faudes::sDevice::pConfiguration [protected] |
std::map<int, EventSet> faudes::sDevice::mSensorPosEdgeIndexMap [protected] |
Reverse sensor map: map signal edges to logical event sets.
Definition at line 410 of file iop_sdevice.h.
std::map<int, EventSet> faudes::sDevice::mSensorNegEdgeIndexMap [protected] |
Reverse sensor map: map signal edges to logical event sets.
Definition at line 413 of file iop_sdevice.h.
int faudes::sDevice::mMaxBitAddress [protected] |
pthread_mutex_t faudes::sDevice::mMutex [private] |
pthread_t faudes::sDevice::mThreadSynchro [private] |
int faudes::sDevice::mCycleTime [private] |
int faudes::sDevice::mCycleCount [private] |
int faudes::sDevice::mRecentCycleCount [private] |
Edges* faudes::sDevice::mpSensorEdges [private] |
Edges* faudes::sDevice::mpRecentSensorEdges [private] |
bool faudes::sDevice::mSensorReady [private] |
bool faudes::sDevice::mCancelRequest [private] |
libFAUDES 2.14g --- 2009-12-3 --- c++ source docu by doxygen 1.5.6