26 #ifndef NIDAS_CORE_UNIXIODEVICE_H
27 #define NIDAS_CORE_UNIXIODEVICE_H
34 #include <sys/types.h>
37 #include <sys/ioctl.h>
44 namespace nidas {
namespace core {
98 if (errno == EAGAIN || errno == EWOULDBLOCK)
return 0;
118 if (errno == EAGAIN || errno == EWOULDBLOCK)
return 0;
130 void ioctl(
int request,
void* buf,
size_t) throw(nidas::util::IOException)
139 void close() throw(nidas::util::IOException)
143 if (fd >= 0 && ::
close(fd) < 0)
void ioctl(int request, void *buf, size_t)
Definition: UnixIODevice.h:130
virtual void setName(const std::string &val)
Set the device name to be opened for this sensor.
Definition: IODevice.h:52
void close()
close the device
Definition: UnixIODevice.h:139
UnixIODevice(const std::string &name)
Constructor, passing the name of the device.
Definition: UnixIODevice.h:62
size_t read(void *buf, size_t len)
Read from the device.
Definition: UnixIODevice.h:94
~UnixIODevice()
Destructor.
Definition: UnixIODevice.h:70
virtual const std::string & getName() const
Definition: IODevice.h:57
size_t write(const void *buf, size_t len)
Write to the device.
Definition: UnixIODevice.h:114
int _fd
Definition: UnixIODevice.h:149
An interface to an IO device.
Definition: IODevice.h:41
A basic Unix I/O device, such as a named pipe, or a watched file.
Definition: UnixIODevice.h:49
int len
Definition: sing.cc:934
int fd
Definition: twod.c:56
UnixIODevice()
Constructor.
Definition: UnixIODevice.h:56
Definition: IOException.h:37
int getReadFd() const
The file descriptor used when reading from this device.
Definition: UnixIODevice.h:75
int getWriteFd() const
The file descriptor used when writing to this device.
Definition: UnixIODevice.h:80
void open(int flags)
open the device.
Definition: UnixIODevice.h:85
Definition: EOFException.h:34