/* * CommDevice.cpp * * Copyright (C) ST-Ericsson SA 2011 * Authors: Srimanta Panda , * Ola Borgelin , * Karin Hedlund , * Markus Andersson for ST-Ericsson. * License terms: 3-clause BSD license * */ #include "stdafx.h" #include "CommDevice.h" #include "AsyncCommunication.h" using namespace std; CommDevice::CommDevice(): isReadCanceled_(false) { async_ = new AsyncCommunication(this); } CommDevice::~CommDevice() { delete async_; } int CommDevice::readNoWait(void *buffer, size_t size, DataCallback_t cb, void *param) { return async_->readNoWait(buffer, size, cb, param); } int CommDevice::writeNoWait(void *buffer, size_t size, DataCallback_t cb, void *param) { return async_->writeNoWait(buffer, size, cb, param); } int CommDevice::cancel() { if (async_->isReadActive()) { isReadCanceled_ = true; async_->waitReadCanceled(); } return 0; }