2012-01-10 14:19:56 -06:00
|
|
|
#include "serial/impl/unix.h"
|
|
|
|
|
|
|
|
|
|
using namespace serial;
|
|
|
|
|
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::Serial_pimpl (const std::string &port, int baudrate,
|
2012-01-10 14:19:56 -06:00
|
|
|
long timeout, bytesize_t bytesize,
|
|
|
|
|
parity_t parity, stopbits_t stopbits,
|
|
|
|
|
flowcontrol_t flowcontrol)
|
|
|
|
|
: port(port), baudrate(baudrate), timeout(timeout), bytesize(bytesize),
|
|
|
|
|
parity(parity), stopbits(stopbits), flowcontrol(flowcontrol)
|
|
|
|
|
{
|
2012-01-11 23:07:58 -06:00
|
|
|
this->fd = -1;
|
2012-01-10 14:19:56 -06:00
|
|
|
}
|
|
|
|
|
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::~Serial_pimpl () {
|
|
|
|
|
if (this->isOpen())
|
|
|
|
|
this->close();
|
2012-01-10 14:19:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::open () {
|
2012-01-10 14:19:56 -06:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::close () {
|
|
|
|
|
this->fd = -1;
|
2012-01-10 14:19:56 -06:00
|
|
|
}
|
|
|
|
|
bool
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::isOpen () {
|
|
|
|
|
return false;
|
2012-01-10 14:19:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::read (unsigned char* buffer, size_t size) {
|
|
|
|
|
return 0;
|
2012-01-10 14:19:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::read (size_t size) {
|
|
|
|
|
return "";
|
2012-01-10 14:19:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::read (std::string &buffer, size_t size) {
|
|
|
|
|
return 0;
|
2012-01-10 14:19:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::write (unsigned char* data, size_t length) {
|
|
|
|
|
return 0;
|
2012-01-10 14:19:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::write (const std::string &data) {
|
|
|
|
|
return 0;
|
2012-01-10 14:19:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::setPort (const std::string &port) {
|
2012-01-10 14:19:56 -06:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::getPort () const {
|
|
|
|
|
return this->port;
|
2012-01-10 14:19:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::setTimeout (long timeout) {
|
2012-01-10 14:19:56 -06:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::getTimeout () const {
|
|
|
|
|
return this->timeout;
|
2012-01-10 14:19:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::setBaudrate (int baudrate) {
|
2012-01-10 14:19:56 -06:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::getBaudrate () const {
|
|
|
|
|
return this->baudrate;
|
2012-01-10 14:19:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::setBytesize (bytesize_t bytesize) {
|
2012-01-10 14:19:56 -06:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bytesize_t
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::getBytesize () const {
|
|
|
|
|
return this->bytesize;
|
2012-01-10 14:19:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::setParity (parity_t parity) {
|
2012-01-10 14:19:56 -06:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
parity_t
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::getParity () const {
|
|
|
|
|
return this->parity;
|
2012-01-10 14:19:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::setStopbits (stopbits_t stopbits) {
|
2012-01-10 14:19:56 -06:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stopbits_t
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::getStopbits () const {
|
|
|
|
|
return this->stopbits;
|
2012-01-10 14:19:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::setFlowcontrol (flowcontrol_t flowcontrol) {
|
2012-01-10 14:19:56 -06:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
flowcontrol_t
|
2012-01-11 23:07:58 -06:00
|
|
|
Serial::Serial_pimpl::getFlowcontrol () const {
|
|
|
|
|
return this->flowcontrol;
|
2012-01-10 14:19:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|