#include "pip.h"
void _() {
	
//! [0]
class SomeIO: public PIIODevice {
	PIIODEVICE(SomeIO)
public:
	SomeIO(): PIIODevice() {}
protected:
	bool openDevice() {
		// open your device here
		return if_success;
	}
	int read(void * read_to, int max_size) {
		// read from your device here
		return readed_bytes;
	}
	int write(const void * data, int max_size) {
		// write to your device here
		return written_bytes;
	}
	PIString fullPathPrefix() const {return "myio";}
	void configureFromFullPath(const PIString & full_path) {
		// parse full_path and configure device there
	}
};
REGISTER_DEVICE(SomeIO)
//! [0]
//! [configure]
// file example.conf
dev.reopenEnabled = false
dev.device = /dev/ttyS0
dev.speed = 9600
// end example.conf
// code
PISerial ser;
ser.configure("example.conf", "dev");
//! [configure]
//! [configureDevice]
class SomeIO: public PIIODevice {
	...
	bool configureDevice(const void * e_main, const void * e_parent) {
		PIConfig::Entry * em = (PIConfig::Entry * )e_main;
		PIConfig::Entry * ep = (PIConfig::Entry * )e_parent;
		setStringParam(readDeviceSetting<PIString>("stringParam", stringParam(), em, ep));
		setIntParam(readDeviceSetting<int>("intParam", intParam(), em, ep));
		return true;
	}
	...
};
//! [configureDevice]

};
