20.10.2013 - Modified PIObject - virtual debugName() for macro piCoutObj, improved timer measurements and timers on Windows
This commit is contained in:
12
piiodevice.h
12
piiodevice.h
@@ -146,10 +146,10 @@ public:
|
||||
|
||||
|
||||
//! Reimplement this function to read from your device
|
||||
virtual int read(void * read_to, int max_size) {piCoutObj << "[PIIODevice] \"read\" not implemented!"; return -2;}
|
||||
virtual int read(void * read_to, int max_size) {piCoutObj << "\"read\" is not implemented!"; return -2;}
|
||||
|
||||
//! Reimplement this function to write to your device
|
||||
virtual int write(const void * data, int max_size) {piCoutObj << "[PIIODevice] \"write\" not implemented!"; return -2;}
|
||||
virtual int write(const void * data, int max_size) {piCoutObj << "\"write\" is not implemented!"; return -2;}
|
||||
|
||||
|
||||
//! Read from device maximum "max_size" bytes and return them as PIByteArray
|
||||
@@ -164,6 +164,10 @@ public:
|
||||
|
||||
//! Add task to threaded write queue and return task ID
|
||||
ullong writeThreaded(const PIByteArray & data);
|
||||
|
||||
|
||||
//! Configure device from section "section" of file "config_file", if "parent_section" parent section also will be read
|
||||
bool configure(const PIString & config_file, const PIString & section, bool parent_section = true);
|
||||
|
||||
|
||||
EVENT_HANDLER(bool, open) {if (!init_) init(); opened_ = openDevice(); if (opened_) opened(); return opened_;}
|
||||
@@ -230,6 +234,9 @@ protected:
|
||||
|
||||
//! Function executed before first \a openDevice() or from constructor
|
||||
virtual bool init() {return true;}
|
||||
|
||||
//! Reimplement to configure device from entries "e_main" and "e_parent", cast arguments to \a PIConfig::Entry*
|
||||
virtual bool configureDevice(const void * e_main, const void * e_parent = 0) {return true;}
|
||||
|
||||
//! Reimplement to open device, return value will be set to "opened_" variable
|
||||
virtual bool openDevice() = 0; // use path_, type_, opened_, init_ variables
|
||||
@@ -242,6 +249,7 @@ protected:
|
||||
|
||||
void terminate();
|
||||
|
||||
|
||||
PIString path_;
|
||||
DeviceMode mode_;
|
||||
ReadRetFunc ret_func_;
|
||||
|
||||
Reference in New Issue
Block a user