UartComIF check iter validity
This commit is contained in:
parent
90a1571707
commit
62873c3118
@ -453,10 +453,13 @@ ReturnValue_t UartComIF::flushUartRxBuffer(CookieIF *cookie) {
|
|||||||
}
|
}
|
||||||
deviceFile = uartCookie->getDeviceFile();
|
deviceFile = uartCookie->getDeviceFile();
|
||||||
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
|
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
|
||||||
|
if(uartDeviceMapIter != uartDeviceMap.end()) {
|
||||||
int fd = uartDeviceMapIter->second.fileDescriptor;
|
int fd = uartDeviceMapIter->second.fileDescriptor;
|
||||||
tcflush(fd, TCIFLUSH);
|
tcflush(fd, TCIFLUSH);
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t UartComIF::flushUartTxBuffer(CookieIF *cookie) {
|
ReturnValue_t UartComIF::flushUartTxBuffer(CookieIF *cookie) {
|
||||||
std::string deviceFile;
|
std::string deviceFile;
|
||||||
@ -468,10 +471,13 @@ ReturnValue_t UartComIF::flushUartTxBuffer(CookieIF *cookie) {
|
|||||||
}
|
}
|
||||||
deviceFile = uartCookie->getDeviceFile();
|
deviceFile = uartCookie->getDeviceFile();
|
||||||
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
|
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
|
||||||
|
if(uartDeviceMapIter != uartDeviceMap.end()) {
|
||||||
int fd = uartDeviceMapIter->second.fileDescriptor;
|
int fd = uartDeviceMapIter->second.fileDescriptor;
|
||||||
tcflush(fd, TCOFLUSH);
|
tcflush(fd, TCOFLUSH);
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t UartComIF::flushUartTxAndRxBuf(CookieIF *cookie) {
|
ReturnValue_t UartComIF::flushUartTxAndRxBuf(CookieIF *cookie) {
|
||||||
std::string deviceFile;
|
std::string deviceFile;
|
||||||
@ -483,10 +489,13 @@ ReturnValue_t UartComIF::flushUartTxAndRxBuf(CookieIF *cookie) {
|
|||||||
}
|
}
|
||||||
deviceFile = uartCookie->getDeviceFile();
|
deviceFile = uartCookie->getDeviceFile();
|
||||||
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
|
uartDeviceMapIter = uartDeviceMap.find(deviceFile);
|
||||||
|
if(uartDeviceMapIter != uartDeviceMap.end()) {
|
||||||
int fd = uartDeviceMapIter->second.fileDescriptor;
|
int fd = uartDeviceMapIter->second.fileDescriptor;
|
||||||
tcflush(fd, TCIOFLUSH);
|
tcflush(fd, TCIOFLUSH);
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
void UartComIF::setUartMode(struct termios *options, UartCookie &uartCookie) {
|
void UartComIF::setUartMode(struct termios *options, UartCookie &uartCookie) {
|
||||||
UartModes uartMode = uartCookie.getUartMode();
|
UartModes uartMode = uartCookie.getUartMode();
|
||||||
|
Loading…
Reference in New Issue
Block a user