Merge branch 'master' of git://github.com/yuhu-/ebusd

Conflicts:
	src/lib/ebus/data.cpp
	src/lib/ebus/data.h
	src/lib/ebus/test/test_data.cpp
This commit is contained in:
john30
2014-11-20 09:30:27 +01:00
59 changed files with 1906 additions and 1594 deletions
-4
View File
@@ -12,16 +12,12 @@ libebus_a_SOURCES = result.cpp \
data.h \
port.cpp \
port.h \
buscommand.cpp \
buscommand.h \
command.cpp \
command.h \
commands.cpp \
commands.h \
configfile.cpp \
configfile.h \
dump.cpp \
dump.h \
decode.cpp \
decode.h \
encode.cpp \
-69
View File
@@ -1,69 +0,0 @@
/*
* Copyright (C) Roland Jax 2012-2014 <ebusd@liwest.at>
*
* This file is part of ebusd.
*
* ebusd is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ebusd is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ebusd. If not, see http://www.gnu.org/licenses/.
*/
#include "buscommand.h"
namespace libebus
{
BusCommand::BusCommand(const std::string commandStr, const bool isPoll)
: m_isPoll(isPoll), m_command(commandStr), m_result(), m_resultCode(RESULT_OK)
{
unsigned char dstAddress = m_command[1];
if (dstAddress == BROADCAST)
m_type = broadcast;
else if (isMaster(dstAddress) == true)
m_type = masterMaster;
else
m_type = masterSlave;
pthread_mutex_init(&m_mutex, NULL);
pthread_cond_init(&m_cond, NULL);
}
BusCommand::~BusCommand()
{
pthread_mutex_destroy(&m_mutex);
pthread_cond_destroy(&m_cond);
}
const std::string BusCommand::getMessageStr()
{
std::string result;
if (m_resultCode >= 0) {
if (m_type == masterSlave) {
result = m_command.getDataStr();
result += "00";
result += m_result.getDataStr();
result += "00";
}
else
result = "success";
}
else
result = "error: "+std::string(getResultCodeCStr());
return result;
}
} //namespace
-70
View File
@@ -1,70 +0,0 @@
/*
* Copyright (C) Roland Jax 2012-2014 <ebusd@liwest.at>
*
* This file is part of ebusd.
*
* ebusd is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ebusd is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ebusd. If not, see http://www.gnu.org/licenses/.
*/
#ifndef LIBEBUS_BUSCOMMAND_H_
#define LIBEBUS_BUSCOMMAND_H_
#include "symbol.h"
#include "result.h"
namespace libebus
{
enum CommandType { invalid, broadcast, masterMaster, masterSlave };
class BusCommand
{
public:
BusCommand(const std::string command, const bool isPoll);
~BusCommand();
CommandType getType() const { return m_type; }
bool isPoll() const { return m_isPoll; }
SymbolString getCommand() const { return m_command; }
SymbolString getResult() const { return m_result; }
bool isErrorResult() const { return m_resultCode < 0; }
const char* getResultCodeCStr() const { return libebus::getResultCodeCStr(m_resultCode); }
void setResult(const SymbolString result, const int resultCode)
{ m_result = result; m_resultCode = resultCode; }
const std::string getMessageStr();
void waitSignal() { pthread_cond_wait(&m_cond, &m_mutex); } // TODO timeout
void sendSignal() { pthread_cond_signal(&m_cond); }
private:
CommandType m_type;
bool m_isPoll;
SymbolString m_command;
SymbolString m_result;
int m_resultCode;
pthread_mutex_t m_mutex;
pthread_cond_t m_cond;
};
} //namespace
#endif // LIBEBUS_BUSCOMMAND_H_
-7
View File
@@ -27,10 +27,6 @@
#include <vector>
#include <cstring>
namespace libebus
{
std::string Command::calcData()
{
// encode - only first entry will be encoded
@@ -340,6 +336,3 @@ void Command::encode(const std::string& data, const std::string& type,
delete help;
}
} //namespace
-7
View File
@@ -23,10 +23,6 @@
#include <string>
#include <vector>
namespace libebus
{
typedef std::vector<std::string> cmd_t;
typedef cmd_t::const_iterator cmdCI_t;
@@ -63,7 +59,4 @@ private:
};
} //namespace
#endif // LIBEBUS_COMMAND_H_
+33 -26
View File
@@ -25,16 +25,12 @@
#include <vector>
#include <cstring>
namespace libebus
{
Commands::~Commands()
{
for (mapCI_t iter = m_polDB.begin(); iter != m_polDB.end(); ++iter)
for (mapCI_t iter = m_pollDB.begin(); iter != m_pollDB.end(); ++iter)
delete iter->second;
m_polDB.clear();
m_pollDB.clear();
for (mapCI_t iter = m_cycDB.begin(); iter != m_cycDB.end(); ++iter)
delete iter->second;
@@ -55,7 +51,7 @@ void Commands::addCommand(const cmd_t& command)
if (strcasecmp(command[0].c_str(),"P") == 0) {
Command* cmd = new Command(m_cmdDB.size()-1, command);
m_polDB.insert(pair_t(m_cmdDB.size()-1, cmd));
m_pollDB.insert(pair_t(m_cmdDB.size()-1, cmd));
}
}
@@ -127,7 +123,7 @@ int Commands::findCommand(const std::string& data) const
return -1;
}
std::string Commands::getEbusCommand(const int index) const
std::string Commands::getBusCommand(const int index) const
{
cmd_t command = m_cmdDB.at(index);
std::string cmd;
@@ -163,7 +159,7 @@ int Commands::storeCycData(const std::string& data) const
// walk through commands
for (; iter != m_cycDB.end(); iter++) {
std::string command = getEbusCommand(iter->first);
std::string command = getBusCommand(iter->first);
// skip wrong search string length
if (command.length() > search.length())
@@ -188,35 +184,35 @@ std::string Commands::getCycData(int index) const
return "";
}
int Commands::nextPolCommand()
int Commands::nextPollCommand()
{
size_t index = 0;
m_polIndex++;
m_pollIndex++;
if (m_polIndex == m_polDB.size())
m_polIndex = 0;
if (m_pollIndex == m_pollDB.size())
m_pollIndex = 0;
mapCI_t iter = m_polDB.begin();
mapCI_t iter = m_pollDB.begin();
for (; iter != m_polDB.end(); iter++, index++)
if (index == m_polIndex)
for (; iter != m_pollDB.end(); iter++, index++)
if (index == m_pollIndex)
return iter->first;
return -1;
}
void Commands::storePolData(const std::string& data) const
void Commands::storePollData(const std::string& data) const
{
// prepare string for searching command
std::string search(data.substr(2, 8 + strtol(data.substr(8,2).c_str(), NULL, 16) * 2));
mapCI_t iter = m_polDB.begin();
mapCI_t iter = m_pollDB.begin();
// walk through commands
for (; iter != m_polDB.end(); iter++) {
for (; iter != m_pollDB.end(); iter++) {
std::string command = getEbusCommand(iter->first);
std::string command = getBusCommand(iter->first);
// skip wrong search string length
if (command.length() > search.length())
@@ -228,15 +224,29 @@ void Commands::storePolData(const std::string& data) const
}
}
std::string Commands::getPolData(int index) const
std::string Commands::getPollData(const int index) const
{
mapCI_t iter = m_polDB.find(index);
if (iter != m_polDB.end())
mapCI_t iter = m_pollDB.find(index);
if (iter != m_pollDB.end())
return iter->second->getData();
else
return "";
}
void Commands::storeScanData(const std::string& data)
{
std::vector<std::string>::const_iterator iter = m_scanDB.begin();
bool found = false;
// walk through scan data
for (; iter != m_scanDB.end(); iter++)
if (data == (*iter))
found = true;
if (found == false)
m_scanDB.push_back(data);
}
void Commands::printCommand(const cmd_t& command) const
{
if (command.size() == 0)
@@ -246,6 +256,3 @@ void Commands::printCommand(const cmd_t& command) const
std::cout << *i << ';';
}
} //namespace
+14 -15
View File
@@ -25,10 +25,6 @@
#include <vector>
#include <map>
namespace libebus
{
typedef std::vector<cmd_t> cmdDB_t;
typedef cmdDB_t::const_iterator cmdDBCI_t;
@@ -40,7 +36,7 @@ class Commands
{
public:
Commands() : m_polIndex(-1) {}
Commands() : m_pollIndex(-1) {}
~Commands();
void addCommand(const cmd_t& command);
@@ -48,33 +44,36 @@ public:
std::size_t sizeCmdDB() const { return m_cmdDB.size(); }
std::size_t sizeCycDB() const { return m_cycDB.size(); }
std::size_t sizePolDB() const { return m_polDB.size(); }
std::size_t sizePollDB() const { return m_pollDB.size(); }
std::size_t sizeScanDB() const { return m_scanDB.size(); }
cmd_t const& operator[](const std::size_t& index) const { return m_cmdDB[index]; }
int findCommand(const std::string& data) const;
std::string getCmdType(const int index) const { return std::string(m_cmdDB.at(index)[0]); }
std::string getEbusCommand(const int index) const;
std::string getBusCommand(const int index) const;
int storeCycData(const std::string& data) const;
std::string getCycData(int index) const;
int nextPolCommand();
void storePolData(const std::string& data) const;
std::string getPolData(int index) const;
int nextPollCommand();
void storePollData(const std::string& data) const;
std::string getPollData(const int index) const;
void storeScanData(const std::string& data);
std::string getScanData(const int index) const { return m_scanDB[index]; }
private:
cmdDB_t m_cmdDB;
map_t m_cycDB;
map_t m_polDB;
size_t m_polIndex;
map_t m_pollDB;
size_t m_pollIndex;
std::vector<std::string> m_scanDB;
void printCommand(const cmd_t& command) const;
};
} //namespace
#endif // LIBEBUS_COMMANDS_H_
-7
View File
@@ -22,10 +22,6 @@
#include <fstream>
#include <dirent.h>
namespace libebus
{
void ConfigFileCSV::parse(std::istream& is, Commands& commands)
{
std::string line;
@@ -132,6 +128,3 @@ void ConfigCommands::addFiles(const std::string path, const std::string extensio
closedir(dir);
};
} //namespace
+16 -18
View File
@@ -24,21 +24,18 @@
#include <string>
#include <vector>
namespace libebus
{
/** available file endings / types. */
enum FileType { CSV, XML };
/**
* @brief Base class for config files.
* @brief base class for config files.
*/
class ConfigFile
{
public:
/**
* @brief Destructor.
* @brief destructor.
*/
virtual ~ConfigFile() {}
@@ -52,14 +49,14 @@ public:
};
/**
* @brief Class for CSV config files.
* @brief class for CSV config files.
*/
class ConfigFileCSV : public ConfigFile
{
public:
/**
* @brief Destructor.
* @brief destructor.
*/
~ConfigFileCSV() {}
@@ -73,14 +70,14 @@ public:
};
/**
* @brief Class for XML config files.
* @brief class for XML config files.
*/
class ConfigFileXML : public ConfigFile
{
public:
/**
* @brief Destructor.
* @brief destructor.
*/
~ConfigFileXML() {}
@@ -95,32 +92,32 @@ public:
/**
* @brief Class for class Device.
* @brief class for class device.
*/
class ConfigCommands
{
public:
/**
* @brief Set file type and add recursive files from given path.
* @brief set file type and add recursive files from given path.
* @param path to configuration files.
* @param Filetype to parse.
* @param filetype to parse.
*/
ConfigCommands(const std::string path, const FileType type);
/**
* @brief Destructor.
* @brief destructor.
*/
~ConfigCommands() { delete m_configfile; }
/**
* @brief setter for file type.
* @param FileType of files.
* @param filetype of files.
*/
void setType(const FileType type);
/**
* @brief Parse files for commands and store them into commands instance.
* @brief parse files for commands and store them into commands instance.
* @return a commands instance
*/
Commands* getCommands();
@@ -128,10 +125,13 @@ public:
private:
/** the configfile instance */
ConfigFile* m_configfile;
/** main path for configuration files */
std::string m_path;
/** valid file extension */
std::string m_extension;
/** vector of configuration files */
std::vector<std::string> m_files;
@@ -144,7 +144,5 @@ private:
};
} //namespace
#endif // LIBEBUS_CONFIGFILE_H_
Regular → Executable
-7
View File
@@ -29,9 +29,6 @@
#include <typeinfo>
#include <math.h>
namespace libebus
{
/** the known data field types. */
static const dataType_t dataTypes[] = {
{"STR",16*8,bt_str, ADJ, ' ', 1, 16, 0, 0}, // >= 1 byte character string filled up with space
@@ -895,7 +892,6 @@ result_t ValueListDataField::writeSymbols(std::istringstream& input,
return RESULT_ERR_INVALID_ARG; // value assignment not found
}
DataFieldSet::~DataFieldSet()
{
while (m_fields.empty() == false) {
@@ -976,6 +972,3 @@ result_t DataFieldSet::write(std::istringstream& input, SymbolString& masterData
return RESULT_OK;
}
} //namespace
Regular → Executable
-6
View File
@@ -26,10 +26,6 @@
#include <vector>
#include <map>
namespace libebus
{
/** the message part in which a data field is stored. */
enum PartType {
pt_template, // special part type for templates (relative offset)
@@ -501,6 +497,4 @@ protected:
};
} //namespace
#endif // LIBEBUS_DATA_H_
-7
View File
@@ -26,10 +26,6 @@
#include <vector>
#include <cstring>
namespace libebus
{
Decode::Decode(const std::string& data, const std::string& factor)
: m_data(data)
{
@@ -347,6 +343,3 @@ std::string DecodeTTM::decode()
return result.str();
}
} //namespace
-7
View File
@@ -22,10 +22,6 @@
#include <string>
namespace libebus
{
class Decode
{
@@ -285,7 +281,4 @@ public:
};
} //namespace
#endif // LIBEBUS_DECODE_H_
-53
View File
@@ -1,53 +0,0 @@
/*
* Copyright (C) Roland Jax 2012-2014 <ebusd@liwest.at>
*
* This file is part of ebusd.
*
* ebusd is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ebusd is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ebusd. If not, see http://www.gnu.org/licenses/.
*/
#include "dump.h"
#include <fstream>
#include <cstdio>
namespace libebus
{
int Dump::write(const char* byte)
{
int ret = 0;
std::ofstream fs(m_filename.c_str(), std::ios::out | std::ios::binary | std::ios::app);
if (fs == 0)
return -1;
fs.write(byte, 1);
if (fs.tellp() >= m_filesize * 1024) {
std::string oldfile;
oldfile += m_filename;
oldfile += ".old";
ret = rename(m_filename.c_str(), oldfile.c_str());
}
fs.close();
return ret;
}
} //namespace
-73
View File
@@ -1,73 +0,0 @@
/*
* Copyright (C) Roland Jax 2012-2014 <ebusd@liwest.at>
*
* This file is part of ebusd.
*
* ebusd is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ebusd is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ebusd. If not, see http://www.gnu.org/licenses/.
*/
#ifndef LIBEBUS_DUMP_H_
#define LIBEBUS_DUMP_H_
#include <string>
namespace libebus
{
/**
* @brief Class for writing raw bytes to binary file.
*/
class Dump
{
public:
/**
* @brief Create a new instance to write dump files.
* @param filename which will be used for dumping raw bytes.
* @param filesize max. Size of the dump file, before switching.
*/
Dump(std::string filename, long filesize)
: m_filename(filename), m_filesize(filesize) {}
/**
* @brief write byte to dump file.
* @param byte to write
* @return -1 if dump file cannot opened or renaming of dump file failed.
*/
int write(const char* byte);
/**
* @brief setter for dump file name.
* @param filename which will be used for dumping raw bytes.
*/
void setFilename(const std::string& filename) { m_filename = filename; }
/**
* @brief setter for max size of dump file.
* @param filesize max. Size of the dump file, before switching.
*/
void setFilesize(const long filesize) { m_filesize = filesize; }
private:
/** the name of dump file*/
std::string m_filename;
/** max. size of dump file */
long m_filesize;
};
} //namespace
#endif // LIBEBUS_DUMP_H_
-7
View File
@@ -26,10 +26,6 @@
#include <vector>
#include <cstring>
namespace libebus
{
Encode::Encode(const std::string& data, const std::string& factor)
: m_data(data)
{
@@ -364,6 +360,3 @@ std::string EncodeTTM::encode()
return result.str();
}
} //namespace
-7
View File
@@ -22,10 +22,6 @@
#include <string>
namespace libebus
{
class Encode
{
@@ -285,7 +281,4 @@ public:
};
} //namespace
#endif // LIBEBUS_ENCODE_H_
+14 -22
View File
@@ -20,19 +20,11 @@
#include "port.h"
#include <cstdlib>
#include <cstring>
#include <termios.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
namespace libebus
{
#include <poll.h>
bool Device::isOpen()
{
@@ -72,18 +64,23 @@ ssize_t Device::recvBytes(const long timeout, size_t maxCount)
return -1; // TODO RESULT_ERR_DEVICE
if (timeout > 0) {
fd_set readfds;
struct timeval tdiff;
int ret, nfds = 1;
struct pollfd fds[nfds];
struct timespec tdiff;
// set select timeout
tdiff.tv_sec = 0;
tdiff.tv_usec = timeout;
tdiff.tv_nsec = timeout*1000;
FD_ZERO(&readfds);
FD_SET(m_fd, &readfds);
memset(fds, 0, sizeof(fds));
if (select(m_fd + 1, &readfds, NULL, NULL, &tdiff) != 1)
return -2; // TODO RESULT_ERR_TIMEOUT
fds[0].fd = m_fd;
fds[0].events = POLLIN;
ret = ppoll(fds, nfds, &tdiff, NULL);
if (ret == -1) return -1; // TODO RESULT_ERR_DEVICE
if (ret == 0) return -2; // TODO RESULT_ERR_TIMEOUT
}
if (maxCount > sizeof(m_buffer))
@@ -141,7 +138,7 @@ void DeviceSerial::openDevice(const std::string deviceName, const bool noDeviceC
newSettings.c_cc[VTIME] = 0;
// empty device buffer
tcflush(m_fd, TCIOFLUSH);
tcflush(m_fd, TCIFLUSH);
// activate new settings of serial device
tcsetattr(m_fd, TCSANOW, &newSettings);
@@ -255,8 +252,3 @@ void Port::setType(const DeviceType type)
};
};
} //namespace
+18 -18
View File
@@ -25,9 +25,6 @@
#include <termios.h>
#include <unistd.h>
namespace libebus
{
/** available device types. */
enum DeviceType { SERIAL, NETWORK };
@@ -39,19 +36,19 @@ enum DeviceType { SERIAL, NETWORK };
/**
* @brief Base class for input devices.
* @brief base class for input devices.
*/
class Device
{
public:
/**
* @brief Constructs a new instance.
* @brief constructs a new instance.
*/
Device() : m_fd(-1), m_open(false), m_noDeviceCheck(false) {}
/**
* @brief Destructor.
* @brief destructor.
*/
virtual ~Device() {}
@@ -74,7 +71,7 @@ public:
bool isOpen();
/**
* @brief sendBytes write bytes into opened file descriptor.
* @brief sendBytes write bytes to opened file descriptor.
* @param buffer data to send.
* @param nbytes number of bytes to send.
* @return number of written bytes or -1 if an error has occured.
@@ -83,7 +80,7 @@ public:
/**
* @brief recvBytes read bytes from opened file descriptor.
* @param timeout max time out for new input data.
* @param timeoutmax time for new input data [usec].
* @param maxCount max size of receive buffer.
* @return number of read bytes or -1 if an error has occured.
*/
@@ -104,12 +101,16 @@ public:
protected:
/** if of file descriptor */
int m_fd;
/** state of device*/
bool m_open;
/** state of device check */
bool m_noDeviceCheck;
/** queue for received bytes */
std::queue<unsigned char> m_recvBuffer;
/** receive buffer */
unsigned char m_buffer[MAX_READ_SIZE];
@@ -123,14 +124,14 @@ private:
};
/**
* @brief Class for serial input device.
* @brief class for serial input device.
*/
class DeviceSerial : public Device
{
public:
/**
* @brief Destructor.
* @brief destructor.
*/
~DeviceSerial() { closeDevice(); }
@@ -153,14 +154,14 @@ private:
};
/**
* @brief Class for network input device.
* @brief class for network input device.
*/
class DeviceNetwork : public Device
{
public:
/**
* @brief Destructor.
* @brief destructor.
*/
~DeviceNetwork() { closeDevice(); }
@@ -181,21 +182,21 @@ private:
};
/**
* @brief Wrapper class for class Device.
* @brief wrapper class for class device.
*/
class Port
{
public:
/**
* @brief Constructs a new instance and determine device type.
* @brief constructs a new instance and determine device type.
* @param deviceName to determine device type.
* @param noDeviceCheck en-/disable device check.
*/
Port(const std::string deviceName, const bool noDeviceCheck);
/**
* @brief Destructor.
* @brief destructor.
*/
~Port() { delete m_device; }
@@ -248,8 +249,10 @@ public:
private:
/** the device name */
std::string m_deviceName;
/** the device instance */
Device* m_device;
/** true if device check is disabled */
bool m_noDeviceCheck;
@@ -261,7 +264,4 @@ private:
};
} //namespace
#endif // LIBEBUS_PORT_H_
+1 -6
View File
@@ -19,10 +19,7 @@
#include "result.h"
namespace libebus
{
const char* getResultCodeCStr(result_t resultCode) {
const char* getResultCode(result_t resultCode) {
switch (resultCode) {
case RESULT_ERR_SEND: return "ERR_SEND: send error";
case RESULT_ERR_EXTRA_DATA: return "ERR_EXTRA_DATA: received bytes > sent bytes";
@@ -43,5 +40,3 @@ const char* getResultCodeCStr(result_t resultCode) {
}
}
} //namespace
+1 -8
View File
@@ -20,10 +20,6 @@
#ifndef LIBEBUS_RESULT_H_
#define LIBEBUS_RESULT_H_
namespace libebus
{
static const int RESULT_OK = 0;
static const int RESULT_BUS_ACQUIRED = 1; // bus successfully acquired
@@ -54,9 +50,6 @@ typedef int result_t;
* @param resultCode the result code (see RESULT_ constants).
* @return the string corresponding to the result code.
*/
const char* getResultCodeCStr(result_t resultCode);
} //namespace
const char* getResultCode(result_t resultCode);
#endif // LIBEBUS_RESULT_H_
-4
View File
@@ -22,9 +22,6 @@
#include <iostream>
#include <iomanip>
namespace libebus
{
/**
* @brief CRC8 lookup table for the polynom 0x9b = x^8 + x^7 + x^4 + x^3 + x^1 + 1.
*/
@@ -190,4 +187,3 @@ bool isMaster(unsigned char addr) {
&& ((addrLo == 0x0) || (addrLo == 0x1) || (addrLo == 0x3) || (addrLo == 0x7) || (addrLo == 0xF));
}
} //namespace
-7
View File
@@ -25,10 +25,6 @@
#include <sstream>
#include <queue>
namespace libebus
{
static const unsigned char ESC = 0xA9; // escape symbol, either followed by 0x00 for the value 0xA9, or 0x01 for the value 0xAA
static const unsigned char SYN = 0xAA; // synchronization symbol
static const unsigned char ACK = 0x00; // positive acknowledge
@@ -139,7 +135,4 @@ private:
*/
bool isMaster(unsigned char addr);
} //namespace
#endif // LIBEBUS_SYMBOL_H_
-2
View File
@@ -25,8 +25,6 @@
#include <sstream>
#include <vector>
using namespace libebus;
// will be part of cfg csv class
void readCSV(std::istream& is, Commands& commands){
std::string line;
-3
View File
@@ -24,9 +24,6 @@
#include <sstream>
#include <vector>
using namespace libebus;
int main() {
std::string dir("test");
Regular → Executable
+3 -5
View File
@@ -21,8 +21,6 @@
#include <iostream>
#include <iomanip>
using namespace libebus;
void verify(bool expectFailMatch, std::string type, std::string input,
bool match, std::string expectStr, std::string gotStr)
{
@@ -217,7 +215,7 @@ int main()
if (result != RESULT_OK) {
std::cout << "\"" << check[0] << "\": create error: "
<< getResultCodeCStr(result) << std::endl;
<< getResultCode(result) << std::endl;
continue;
}
if (fields == NULL) {
@@ -256,7 +254,7 @@ int main()
<< check[2] << "< OK" << std::endl;
else if (result != RESULT_OK) {
std::cout << " read " << fields->getName() << " >" << check[2] << "< error: "
<< getResultCodeCStr(result) << std::endl;
<< getResultCode(result) << std::endl;
}
else {
bool match = strcasecmp(output.str().c_str(), expectStr.c_str()) == 0;
@@ -276,7 +274,7 @@ int main()
}
else if (result != RESULT_OK) {
std::cout << " write " << fields->getName() << " >"
<< expectStr << "< error: " << getResultCodeCStr(result) << std::endl;
<< expectStr << "< error: " << getResultCode(result) << std::endl;
}
else {
bool match = mstr == writeMstr && sstr == writeSstr;
-4
View File
@@ -21,10 +21,6 @@
#include <iostream>
#include <iomanip>
using namespace libebus;
int main()
{
Decode* help_dec = NULL;
-4
View File
@@ -21,10 +21,6 @@
#include <iostream>
#include <iomanip>
using namespace libebus;
int main()
{
Encode* help_enc = NULL;
-2
View File
@@ -21,8 +21,6 @@
#include <iostream>
#include <iomanip>
using namespace libebus;
int main ()
{
std::string dev("/dev/ttyUSB20");
-2
View File
@@ -21,8 +21,6 @@
#include <iostream>
#include <iomanip>
using namespace libebus;
int main ()
{
SymbolString sstr = SymbolString("10feb5050427a915aa");