ot::FastTrakModule Class Reference
[Device Input Classes]
developer level information and implementation specifics here
More...
#include <FastTrakModule.h>
Inheritance diagram for ot::FastTrakModule:


Public Member Functions | |
| FastTrakModule () | |
| virtual | ~FastTrakModule () |
| virtual void | init (StringTable &attributes, ConfigNode *localTree) |
| virtual Node * | createNode (const std::string &name, StringTable &attributes) |
| virtual void | start () |
| virtual void | close () |
| virtual void | pushEvent () |
Protected Member Functions | |
| virtual void | run () |
| int | initFastTrak () |
| int | parseRecordFT (char c, char *b) |
| int | parseRecordIT (char c, char *b) |
| void | setButtonIT (int stationNr, int button) |
| void | convert (int stationNr, char *b) |
Protected Attributes | |
| int | stop |
| tmpStationEvent * | stations |
| NodeVector | nodes |
| int | trackerType |
| SerialPort | port |
| int | numberOfStations |
| std::string | hemisphere |
| std::string | referenceFrame |
| std::string | initString |
Detailed Description
developer level information and implementation specifics here
- Author:
- Rainer Splechtna
Definition at line 101 of file FastTrakModule.h.
Constructor & Destructor Documentation
| ot::FastTrakModule::FastTrakModule | ( | ) |
| ot::FastTrakModule::~FastTrakModule | ( | ) | [virtual] |
Member Function Documentation
| void ot::FastTrakModule::close | ( | ) | [virtual] |
closes serial port
Reimplemented from ot::ThreadModule.
Definition at line 269 of file FastTrakModule.cxx.
References closeSerialPort(), ot::Module::isInitialized(), ot::ThreadModule::lock(), port, ot::Module::stop(), and ot::ThreadModule::unlock().
| void ot::FastTrakModule::convert | ( | int | stationNr, | |
| char * | b | |||
| ) | [protected] |
converts data record to OpenTracker event values and updates the event of the specified station.
- Parameters:
-
stationNr number of station the data record is associated with b pointer to array of characters, representing a whole data record
Definition at line 629 of file FastTrakModule.cxx.
References ot::buildPositionFT(), ot::buildPositionIT(), ot::buildQuaternionFT(), ot::buildQuaternionIT(), ot::FASTTRAK, ot::ISOTRAK, ot::tmpStationEvent::newVal, stations, and trackerType.
Referenced by run().
| Node * ot::FastTrakModule::createNode | ( | const std::string & | name, | |
| StringTable & | attributes | |||
| ) | [virtual] |
This method is called to construct a new Node.
It compares name to the FastTrakSource element name, and if it matches creates a new FastTrakSource node.
- Parameters:
-
name reference to string containing element name refenrence to StringTable containing attribute values
Implements ot::NodeFactory.
Definition at line 123 of file FastTrakModule.cxx.
References ot::StringTable::get(), nodes, and numberOfStations.
| void ot::FastTrakModule::init | ( | StringTable & | attributes, | |
| ConfigNode * | localTree | |||
| ) | [virtual] |
initializes the tracker module.
- Parameters:
-
attributes StringTable of elements attribute values. localTree pointer to root of configuration nodes tree
Reimplemented from ot::Module.
Definition at line 84 of file FastTrakModule.cxx.
References ot::FASTTRAK, ot::StringTable::get(), hemisphere, ot::Module::init(), initString, ot::ISOTRAK, LOG_ACE_ERROR(), LOG_ACE_INFO(), numberOfStations, SerialPort::pathname, port, referenceFrame, stations, and trackerType.
| int ot::FastTrakModule::initFastTrak | ( | ) | [protected] |
inits the whole fasttrak according to the parameters stored in the module.
It can be used to reset the flock after some communication failure.
- Returns:
- 0 if everything is ok, otherwise < 0
Definition at line 176 of file FastTrakModule.cxx.
References ot::FASTTRAK, hemisphere, initString, ot::ISOTRAK, numberOfStations, port, readfromSerialPort(), referenceFrame, ot::OSUtils::sleep(), trackerType, and writetoSerialPort().
Referenced by run().
| int ot::FastTrakModule::parseRecordFT | ( | char | c, | |
| char * | b | |||
| ) | [protected] |
parses the input stream from the FastTrak tracker
- Parameters:
-
c new charcter read from input stream b pointer to char array, where the actual data record of a station of the tracker is stored
- Returns:
- -1 if reading of one data record is not completed -2 if too much junk was read 0,1 number of station for which a whole data record was read
number of bytes of the tracker's output record
Definition at line 386 of file FastTrakModule.cxx.
References numberOfStations, ot::tsGetRec, ot::tsSpace, ot::tsStart, ot::tsStationNumber, and ot::tsSyncBit.
Referenced by run().
| int ot::FastTrakModule::parseRecordIT | ( | char | c, | |
| char * | b | |||
| ) | [protected] |
parses the input stream from the IsoTrak II tracker
- Parameters:
-
c new charcter read from input stream b pointer to char array, where the actual data record of a station of the tracker is stored
- Returns:
- -1 if reading of one data record is not completed -2 if too much junk was read 0,1 number of station for which a whole data record was read
Definition at line 455 of file FastTrakModule.cxx.
References numberOfStations, setButtonIT(), ot::tsGetRec, ot::tsSpace, ot::tsStart, and ot::tsStationNumber.
Referenced by run().
| void ot::FastTrakModule::pushEvent | ( | ) | [virtual] |
pushes events into the tracker tree.
Checks all stations for new data and fires the FastTrakSources, if new data is present.
Reimplemented from ot::Module.
Definition at line 354 of file FastTrakModule.cxx.
References ot::tmpStationEvent::event, ot::FastTrakSource::event, ot::Module::isInitialized(), ot::ThreadModule::lock(), ot::tmpStationEvent::newVal, nodes, ot::FastTrakSource::station, stations, ot::Event::timeStamp(), ot::ThreadModule::unlock(), and ot::Node::updateObservers().
| void ot::FastTrakModule::run | ( | ) | [protected, virtual] |
this method is the code executed in its own thread, it reads from the specified serial port, parses the incoming data and updates the event of the utilized stations
Reimplemented from ot::ThreadModule.
Definition at line 284 of file FastTrakModule.cxx.
References convert(), ot::FASTTRAK, initFastTrak(), ot::ISOTRAK, ot::ThreadModule::lock(), parseRecordFT(), parseRecordIT(), port, readfromSerialPort(), ot::OSUtils::sleep(), ot::Module::stop(), trackerType, and ot::ThreadModule::unlock().
| void ot::FastTrakModule::setButtonIT | ( | int | stationNr, | |
| int | button | |||
| ) | [protected] |
updates button event for specified station (only used for IsoTrak II)
- Parameters:
-
stationNr number of station the button is associated with button event of button
Definition at line 616 of file FastTrakModule.cxx.
References ot::tmpStationEvent::event, ot::Event::getButton(), ot::ThreadModule::lock(), ot::tmpStationEvent::newVal, stations, and ot::ThreadModule::unlock().
Referenced by parseRecordIT().
| void ot::FastTrakModule::start | ( | ) | [virtual] |
This method is called after initialisation is finished and before the main loop is started.
In this implementation it starts the thread. Be sure to call this method from your subclasses start method to start the thread !
Reimplemented from ot::ThreadModule.
Definition at line 149 of file FastTrakModule.cxx.
References SerialParams::baudrate, SerialParams::bits, SerialParams::blocking, SerialParams::hwflow, ot::Module::initialized, initSerialParams(), ot::Module::isInitialized(), openSerialPort(), SerialParams::parity, SerialPort::pathname, SerialParams::pathname, port, SerialParams::sbit, ot::ThreadModule::start(), and SerialParams::swflow.
Member Data Documentation
std::string ot::FastTrakModule::hemisphere [protected] |
the hemisphere the tracker should operate in ("1,0,0")
Definition at line 121 of file FastTrakModule.h.
Referenced by init(), and initFastTrak().
std::string ot::FastTrakModule::initString [protected] |
other global config strings sent to the tracker during init-phase
Definition at line 125 of file FastTrakModule.h.
Referenced by init(), and initFastTrak().
NodeVector ot::FastTrakModule::nodes [protected] |
vector of all created fasttrak source nodes
Definition at line 112 of file FastTrakModule.h.
Referenced by createNode(), pushEvent(), and ~FastTrakModule().
int ot::FastTrakModule::numberOfStations [protected] |
number of stations (sensors) connected to the tracker
Definition at line 119 of file FastTrakModule.h.
Referenced by createNode(), init(), initFastTrak(), parseRecordFT(), and parseRecordIT().
SerialPort ot::FastTrakModule::port [protected] |
port structure for the serial port data
Definition at line 117 of file FastTrakModule.h.
Referenced by close(), init(), initFastTrak(), run(), and start().
std::string ot::FastTrakModule::referenceFrame [protected] |
the reference frame of the tracker ("0,0,0,200,0,0,0,200,0")
Definition at line 123 of file FastTrakModule.h.
Referenced by init(), and initFastTrak().
tmpStationEvent* ot::FastTrakModule::stations [protected] |
pointer to array of tmpStationEvent storing the event of each station
Definition at line 110 of file FastTrakModule.h.
Referenced by convert(), init(), pushEvent(), setButtonIT(), and ~FastTrakModule().
int ot::FastTrakModule::stop [protected] |
int ot::FastTrakModule::trackerType [protected] |
stores which tracker
Definition at line 115 of file FastTrakModule.h.
Referenced by convert(), init(), initFastTrak(), and run().
The documentation for this class was generated from the following files: