fix stupid merge
This commit is contained in:
@@ -44,6 +44,7 @@ const char* getResultCode(result_t resultCode) {
|
||||
case RESULT_ERR_DUPLICATE: return "ERR: duplicate entry";
|
||||
case RESULT_ERR_DUPLICATE_NAME: return "ERR: duplicate name";
|
||||
case RESULT_ERR_BUS_LOST: return "ERR: arbitration lost";
|
||||
case RESULT_ERR_ARB_RUNNING: return "ERR: arbitration running";
|
||||
case RESULT_ERR_CRC: return "ERR: CRC error";
|
||||
case RESULT_ERR_ACK: return "ERR: ACK error";
|
||||
case RESULT_ERR_NAK: return "ERR: NAK received";
|
||||
|
||||
@@ -56,15 +56,16 @@ enum result_t {
|
||||
RESULT_ERR_DUPLICATE_NAME = -17, //!< duplicate entry (name)
|
||||
|
||||
RESULT_ERR_BUS_LOST = -18, //!< arbitration lost
|
||||
RESULT_ERR_CRC = -19, //!< CRC error
|
||||
RESULT_ERR_ACK = -20, //!< ACK error
|
||||
RESULT_ERR_NAK = -21, //!< NAK received
|
||||
RESULT_ERR_ARB_RUNNING = -19, //!< arbitration running
|
||||
RESULT_ERR_CRC = -20, //!< CRC error
|
||||
RESULT_ERR_ACK = -21, //!< ACK error
|
||||
RESULT_ERR_NAK = -22, //!< NAK received
|
||||
|
||||
RESULT_ERR_NO_SIGNAL = -22, //!< no signal found on the bus
|
||||
RESULT_ERR_SYN = -23, //!< SYN received instead of answer
|
||||
RESULT_ERR_SYMBOL = -24, //!< wrong symbol received instead of sent symbol
|
||||
RESULT_ERR_NO_SIGNAL = -23, //!< no signal found on the bus
|
||||
RESULT_ERR_SYN = -24, //!< SYN received instead of answer
|
||||
RESULT_ERR_SYMBOL = -25, //!< wrong symbol received instead of sent symbol
|
||||
|
||||
RESULT_ERR_NOTAUTHORIZED = -25 //!< not authorized for this action
|
||||
RESULT_ERR_NOTAUTHORIZED = -26 //!< not authorized for this action
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -72,19 +72,19 @@ using std::vector;
|
||||
typedef unsigned char symbol_t;
|
||||
|
||||
/** escape symbol, either followed by 0x00 for the value 0xA9, or 0x01 for the value 0xAA. */
|
||||
#define ESC 0xA9
|
||||
#define ESC ((symbol_t)0xA9)
|
||||
|
||||
/** synchronization symbol. */
|
||||
#define SYN 0xAA
|
||||
#define SYN ((symbol_t)0xAA)
|
||||
|
||||
/** positive acknowledge symbol. */
|
||||
#define ACK 0x00
|
||||
#define ACK ((symbol_t)0x00)
|
||||
|
||||
/** negative acknowledge symbol. */
|
||||
#define NAK 0xFF
|
||||
#define NAK ((symbol_t)0xFF)
|
||||
|
||||
/** the broadcast destination address. */
|
||||
#define BROADCAST 0xFE
|
||||
#define BROADCAST ((symbol_t)0xFE)
|
||||
|
||||
/**
|
||||
* Parse an unsigned int value.
|
||||
|
||||
@@ -11,10 +11,6 @@ add_executable(test_filereader test_filereader.cpp)
|
||||
target_link_libraries(test_filereader ebus pthread)
|
||||
add_test(filereader test_filereader)
|
||||
|
||||
add_executable(test_device test_device.cpp)
|
||||
target_link_libraries(test_device ebus pthread ${test_LIBS})
|
||||
add_test(device test_device)
|
||||
|
||||
add_executable(test_symbol test_symbol.cpp)
|
||||
target_link_libraries(test_symbol ebus pthread)
|
||||
add_test(symbol test_symbol)
|
||||
|
||||
@@ -3,7 +3,6 @@ AM_CXXFLAGS = -I$(top_srcdir)/src \
|
||||
-Wno-unused-parameter
|
||||
|
||||
noinst_PROGRAMS = test_filereader \
|
||||
test_device \
|
||||
test_symbol \
|
||||
test_data \
|
||||
test_message
|
||||
@@ -11,9 +10,6 @@ noinst_PROGRAMS = test_filereader \
|
||||
test_filereader_SOURCES = test_filereader.cpp
|
||||
test_filereader_LDADD = ../libebus.a -lpthread
|
||||
|
||||
test_device_SOURCES = test_device.cpp
|
||||
test_device_LDADD = ../libebus.a -lpthread
|
||||
|
||||
test_symbol_SOURCES = test_symbol.cpp
|
||||
test_symbol_LDADD = ../libebus.a -lpthread
|
||||
|
||||
@@ -24,7 +20,6 @@ test_message_SOURCES = test_message.cpp
|
||||
test_message_LDADD = ../libebus.a -lpthread
|
||||
|
||||
if CONTRIB
|
||||
test_device_LDADD += ../contrib/libebuscontrib.a
|
||||
test_data_LDADD += ../contrib/libebuscontrib.a
|
||||
test_message_LDADD += ../contrib/libebuscontrib.a
|
||||
endif
|
||||
|
||||
@@ -175,6 +175,9 @@ void closeLogFile() {
|
||||
}
|
||||
|
||||
bool needsLog(const LogFacility facility, const LogLevel level) {
|
||||
if (s_logFile == nullptr && !s_useSyslog) {
|
||||
return false;
|
||||
}
|
||||
return s_facilityLogLevel[facility] >= level;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,22 @@ bool RotateFile::setEnabled(bool enabled) {
|
||||
if (enabled) {
|
||||
m_stream = fopen(m_fileName.c_str(), m_textMode ? "w" : "wb");
|
||||
m_fileSize = 0;
|
||||
#ifdef FORWARD_RAW_TTY
|
||||
if (!m_textMode && isatty(fileno(m_stream)) == 1) {
|
||||
int fd = fileno(m_stream);
|
||||
struct termios newSettings;
|
||||
memset(&newSettings, 0, sizeof(newSettings));
|
||||
|
||||
cfsetspeed(&newSettings, B2400);
|
||||
newSettings.c_cflag |= (CS8 | CLOCAL);
|
||||
newSettings.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); // non-canonical mode
|
||||
newSettings.c_iflag |= IGNPAR; // ignore parity errors
|
||||
newSettings.c_oflag &= ~OPOST;
|
||||
|
||||
// activate new settings of serial device
|
||||
tcsetattr(fd, TCSANOW, &newSettings);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user