From 37f8d7098ae4d026b4aaeeed32ce1736a607f120 Mon Sep 17 00:00:00 2001 From: LukasMuellerILT Date: Wed, 25 May 2016 08:00:43 +0200 Subject: [PATCH] Release 2.0.2 --- SPI_Multidrop/ResourceProvider.cpp | 2 +- SPI_Multidrop/SpecificCore.cpp | 60 +++++++++++++++--------------- changelog.txt | 4 ++ 3 files changed, 35 insertions(+), 31 deletions(-) diff --git a/SPI_Multidrop/ResourceProvider.cpp b/SPI_Multidrop/ResourceProvider.cpp index 4774e8b..6bc29f6 100644 --- a/SPI_Multidrop/ResourceProvider.cpp +++ b/SPI_Multidrop/ResourceProvider.cpp @@ -4,7 +4,7 @@ Purpose: Implementation of the specific resource provider @author Lukas Mueller (ilt.hsr.ch) - @version 0.1 2015_10_07 + @version 0.2 2016_05_25 */ #include "ResourceProvider.h" diff --git a/SPI_Multidrop/SpecificCore.cpp b/SPI_Multidrop/SpecificCore.cpp index 4c55170..7b86e64 100644 --- a/SPI_Multidrop/SpecificCore.cpp +++ b/SPI_Multidrop/SpecificCore.cpp @@ -4,7 +4,7 @@ Purpose: Central class of a specific implemention. Usually used to communicate with the device. An instance is just deleted and new generated with the reset command. Every command can use it. @author Lukas Mueller (ilt.hsr.ch) - @version 0.1 2015_06_12 + @version 0.2 2016_05_25 */ #include "SpecificCore.h" @@ -2006,30 +2006,16 @@ namespace SPI } void SpecificCore::readedCallback(boost::system::error_code error, size_t size) { - std::lock_guard lockGuard(_processCoreMutex); - if(!error) + if(!_isClosing) { - for(unsigned int i = 0; i < size; i++) + std::lock_guard lockGuard(_processCoreMutex); + if(!error) { - if(_readBuffer[i] == 13 && size > i+1 && _readBuffer[i+1] == 10) - { - i++; - if(_nextReceivingLine.length() > 0) - { - _receivedLines.push(_nextReceivingLine); -#ifdef RS232_COM_DEBUG - std::cout << "RS232 read: " << _nextReceivingLine << std::endl; -#endif - _receivedLinesCount += 1; - _nextReceivingLine = ""; - } - } - else if(i == 0 && _readBuffer[0] == 10) + for(unsigned int i = 0; i < size; i++) { - int indexLast = _nextReceivingLine.length() - 1; - if(_nextReceivingLine.at(indexLast) == 13) + if(_readBuffer[i] == 13 && size > i+1 && _readBuffer[i+1] == 10) { - _nextReceivingLine.erase(indexLast); + i++; if(_nextReceivingLine.length() > 0) { _receivedLines.push(_nextReceivingLine); @@ -2040,17 +2026,31 @@ namespace SPI _nextReceivingLine = ""; } } + else if(i == 0 && _readBuffer[0] == 10) + { + int indexLast = _nextReceivingLine.length() - 1; + if(_nextReceivingLine.at(indexLast) == 13) + { + _nextReceivingLine.erase(indexLast); + if(_nextReceivingLine.length() > 0) + { + _receivedLines.push(_nextReceivingLine); +#ifdef RS232_COM_DEBUG + std::cout << "RS232 read: " << _nextReceivingLine << std::endl; +#endif + _receivedLinesCount += 1; + _nextReceivingLine = ""; + } + } + } + else + { + _nextReceivingLine += _readBuffer[i]; + } } - else - { - _nextReceivingLine += _readBuffer[i]; - } + _serial_port->async_read_some(boost::asio::buffer(_readBuffer, 1024), boost::bind(&SpecificCore::readedCallback, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); } - _serial_port->async_read_some(boost::asio::buffer(_readBuffer, 1024), boost::bind(&SpecificCore::readedCallback, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); - } - else - { - if(!_isClosing) + else { _connectionErrorMessage = error.message(); _connectionError = true; diff --git a/changelog.txt b/changelog.txt index 4dc7629..0e21753 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ SPI_Multidrop Changelog +--- 2.0.2 --- 2016_05_25 +- Update SPICE to 1.0.4 and POCO to 1.7.3 +- Fixing Bug: Deadlock during startup on Debian in specific case (Missing Multidrop, RS232-Adapter available) + --- 2.0.1 --- 2016_01_20 - Update SPICE from 1.0.0 to 1.0.1