Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed a wrong description of sysfsAdaptor in instructions
  • Loading branch information
Timo Rongas committed Jul 22, 2010
1 parent 21438c6 commit 5d69044
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions doc/PLUGIN-INSTRUCTIONS
Expand Up @@ -61,7 +61,7 @@ necessary, think BT connection)
## 3. Implementing a device adaptor using sysfsAdaptor, the (bit more) reasonable way
##

SysfsAdaptor is a generic class for adapting to sensors that provide a file (or file like) interface.
SysfsAdaptor is a generic class for adapting to sensors that provide a file (or file like) interface. You can see an example implementation (doing nothing) in examples/adaptorplugin. It could be used as a starting point.

1) Create a class that extends SysfsAdaptor. I'd say the easiest way is to pick one of the existing ones and just modify it. If this does not sound good for you, take a look at the previous section.

Expand All @@ -73,7 +73,7 @@ In SelectMode, epoll_wait() is used to wait for an interrupt on the handle.

3) Create buffer, introduce Buffer, set description, introduce DataRange options. See any other adaptor for reference and previous section for details.

4) Implement processSample(int pathId, int fd) function. PathId is the index number of the path where an event has been detected (0 for first added, 1 for next,...). fd is the file descriptor where the data can be read.
4) Implement processSample(int pathId, int fd) function. PathId is the id number of the path provided with the addPath() call (or 0 if omitted from a path provided via constructor). fd is the file descriptor where the data can be read.

This function should read the available data from the driver, and propagate it to the output buffer.

Expand Down
7 changes: 4 additions & 3 deletions examples/adaptorplugin/sampleadaptor.cpp
Expand Up @@ -67,9 +67,10 @@ SampleAdaptor::~SampleAdaptor()

void SampleAdaptor::processSample(int pathId, int fd)
{
// PathID (index of the path, depends on adding order). If only a
// a single file is monitored, can be ignored. If several files are
// monitored, can be used to detect which one should be read.
// PathID (provided with addPath(), or 0 if not given for a path set
// with constructor. If only a single file is monitored, can be
// ignored. If several files are monitored, can be used to detect
// which one should be read.
Q_UNUSED(pathId);

// Do whatever is needed to get values from the provided file
Expand Down

0 comments on commit 5d69044

Please sign in to comment.