INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

hwdriver.h

00001 /*
00002  * Orca-Robotics Project: Components for robotics 
00003  *               http://orca-robotics.sf.net/
00004  * Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp
00005  *
00006  * This copy of Orca is licensed to you under the terms described in
00007  * the LICENSE file included in this distribution.
00008  *
00009  */
00010 
00011 #ifndef HARDWARE_DRIVER_H
00012 #define HARDWARE_DRIVER_H
00013 
00014 // #include <orcarobotdriverutil/ihwdriver.h>
00015 #include "types.h"
00016 
00017 namespace robot2d
00018 {
00019 
00020 //
00021 // Abstract interface class for something that talks to the
00022 // hardware (or a simulator).
00023 //
00024 // Member functions throw exceptions on error conditions.
00025 //
00026 // This class needn't be thread-safe.
00027 //
00028 class HwDriver
00029 {
00030 
00031 public: 
00032 
00033     virtual ~HwDriver() {}
00034 
00035     // Throws std::exceptions on failure.
00036     // It is not an error to call this repeatedly: repeated calls should
00037     // re-initialise the hardware.
00038     // (eg this will be called if the hardware reports an error condition)
00039     virtual void enable()=0;
00040 
00041     // Blocking read.
00042     // Returns: 
00043     //   true:  important change in internal state occured (details can be read with getStatus).
00044     //   false: no important change
00045     virtual bool read( Data &data )=0;
00046     
00047     // Writes command.
00048     virtual void write( const Command& command )=0;
00049 
00050     // Get information about the current status of the driver.
00051     // the string 'status' is a human-readable description.
00052     // Note that there are two ways for faults to be notified:
00053     //  - This function tells of hardware faults reported normally by the hardware.
00054     //  - Exceptions can be thrown from read/write for non-recoverable faults, such as inability to
00055     //    communicate with the hardware.
00056     virtual void getStatus( std::string &status, bool &isWarn, bool &isFault )=0;
00057 
00058 private: 
00059 
00060 };
00061 
00062 } // namespace
00063 
00064 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5