Inheritance diagram for ev3_control::H4REv3Port:
[legend]
Collaboration diagram for ev3_control::H4REv3Port:
[legend]

Classes

class  OpenFile
 

Public Types

enum  H4Ev3IoPortType { H4REV3PORT_OUT, H4REV3PORT_IN }
 

Public Member Functions

 H4REv3Port (const std::string &port_name, H4Ev3IoPortType port_type)
 
bool isConnected ()
 
bool readInt (const char *filename, int &value, OpenFile &openFile, bool device_dir=true)
 
bool writeInt (const char *filename, int value, OpenFile &openFile, bool device_dir=true)
 
const std::string & getPortName () const
 
H4Ev3IoPortType getPortType () const
 
bool getDriverName (Ev3Strings::Ev3DriverName &drvname)
 
template<typename T >
bool writeKey (const char *filename, const StringEnum< T > &strmap, T key, OpenFile &openFile, bool device_dir=true)
 
template<typename T >
bool readKey (const char *filename, const StringEnum< T > &strmap, T &key, OpenFile &openFile, bool device_dir=true)
 

Protected Member Functions

FILE * get_fileptr_ (const char *filename, OpenFile::FileMode mode, OpenFile &file, bool device_dir=true)
 
bool getDeviceDirectory ()
 
bool getPortDirectory ()
 

Protected Attributes

OpenFile f_driver_name
 
Ev3Strings::Ev3DriverName last_driver_
 
int last_driver_check_connected_id_
 
const std::string port_name_
 
bool connected_
 
int connect_id_
 
H4Ev3IoPortType port_type_
 
FileNameBuffer sys_port_directory_
 
FileNameBuffer sys_device_directory_
 

Constructor & Destructor Documentation

ev3_control::H4REv3Port::H4REv3Port ( const std::string &  port_name,
H4Ev3IoPortType  port_type 
)

The constructor

Parameters
port_nameport_name
port_typeinput or output port

Member Function Documentation

bool ev3_control::H4REv3Port::getDriverName ( Ev3Strings::Ev3DriverName &  drvname)
inline

get driver name from current device

Parameters
[out]drvnameDriver name enum type
Returns
True if successful, false otherwise (false normally means, nothing is connected)

Here is the call graph for this function:

const std::string& ev3_control::H4REv3Port::getPortName ( ) const
inline
Returns
The name of the port
H4Ev3IoPortType ev3_control::H4REv3Port::getPortType ( ) const
inline
Returns
The ports type
bool ev3_control::H4REv3Port::isConnected ( )

Check if a device is connected to the port

Returns
True if connected

Here is the call graph for this function:

Here is the caller graph for this function:

bool ev3_control::H4REv3Port::readInt ( const char *  filename,
int &  value,
OpenFile openFile,
bool  device_dir = true 
)

Reads a integer string from a sys file

Parameters
filenameThe sys file to be read from (only filename without directory)
[out]valueoutput variable for the value only valid on return true
device_dirTrue if it should open the file in the device_directory, false it will search the port directory for the file
openFileStorage for file pointer
Returns
True if read successful, false otherwise

Here is the caller graph for this function:

template<typename T >
bool ev3_control::H4REv3Port::readKey ( const char *  filename,
const StringEnum< T > &  strmap,
T &  key,
OpenFile openFile,
bool  device_dir = true 
)
inline

Reads a /sys string file and compares the read string with a given map of strings and gets it's number from the map

Parameters
filenameThe sys file to be read
strmapThe string map
keyThe key of the string (if return TRUE!)
device_dirTrue if it should search in the device_directory, false it will search the port directory for the file
openFileStorage for file pointer
Returns
True if read successful, false otherwise

Here is the caller graph for this function:

bool ev3_control::H4REv3Port::writeInt ( const char *  filename,
int  value,
OpenFile openFile,
bool  device_dir = true 
)

Writes a integer string from a sys file

Parameters
filenameThe sys file to be read from (only filename without directory)
valueThe value to be written to the file
device_dirTrue if it should open the file in the device_directory, false it will search the port directory for the file
openFileStorage for file pointer
Returns
True if read successful, false otherwise

Here is the caller graph for this function:

template<typename T >
bool ev3_control::H4REv3Port::writeKey ( const char *  filename,
const StringEnum< T > &  strmap,
key,
OpenFile openFile,
bool  device_dir = true 
)
inline

Writes a string file from a map into a /sys file according to the given key.

Parameters
filenameThe sys file to be written to (only filename without directory)
strmapThe string map
keyThe key of the string (if return TRUE!)
device_dirTrue if it should open the file in the device_directory, false it will search the port directory for the file
openFileStorage for file pointer
Returns
True if read successful, false otherwise

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
  • /data/Daten/Entwicklung/ros_workspaces/h4r_ev3_ws/src/h4r_ev3/h4r_ev3_control/include/h4r_ev3_control/H4REv3Port.h
  • /data/Daten/Entwicklung/ros_workspaces/h4r_ev3_ws/src/h4r_ev3/h4r_ev3_control/src/h4r_ev3_control/H4REv3Port.cpp