#include "pip.h"
void _() {
	
//! [0]
class SomeIO: public PIIODevice {
	PIIODEVICE(SomeIO, "myio")
public:
	SomeIO(): PIIODevice() {}
protected:
	bool openDevice() override {
		// open your device here
		return if_success;
	}
	ssize_t readDevice(void * read_to, ssize_t max_size) override {
		// read from your device here
		return readed_bytes;
	}
	ssize_t writeDevice(const void * data, ssize_t max_size) override {
		// write to your device here
		return written_bytes;
	}
	void configureFromFullPathDevice(const PIString & full_path) override {
		// parse full_path and configure device here
	}
};
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) override {
		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]

};
