From 9e996cf0e727adfda55d564ca5cb847af490f439 Mon Sep 17 00:00:00 2001 From: shernand <shernand@iri.upc.edu> Date: Sat, 6 Nov 2021 11:34:44 +0100 Subject: [PATCH] The read and write functions return 0 bytes read/written in case the device is not configured instead of throwing an exception. --- src/comm.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/comm.cpp b/src/comm.cpp index 0cb3c14..28450cc 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -128,7 +128,8 @@ int CComm::read(unsigned char *data,int len) } else { - throw CCommException(_HERE_,"The communication device is not configured yet.\n",this->comm_id); + return 0; +// throw CCommException(_HERE_,"The communication device is not configured yet.\n",this->comm_id); } } return len; @@ -165,7 +166,8 @@ int CComm::write(unsigned char *data,int len) else { this->access_comm.exit(); - throw CCommException(_HERE_,"The communication device is not configured yet.\n",this->comm_id); + return 0; +// throw CCommException(_HERE_,"The communication device is not configured yet.\n",this->comm_id); } this->access_comm.exit(); return len; -- GitLab