namespace 'libebus' removed.

This commit is contained in:
Roland Jax
2014-11-19 19:44:04 +01:00
parent 5b14d6dbec
commit a5605c40be
33 changed files with 10 additions and 184 deletions
-2
View File
@@ -30,8 +30,6 @@
#include <iomanip> #include <iomanip>
#include <unistd.h> #include <unistd.h>
using namespace libebus;
Appl& A = Appl::Instance(true); Appl& A = Appl::Instance(true);
void define_args() void define_args()
-3
View File
@@ -24,9 +24,6 @@
#include "network.h" #include "network.h"
#include "ebusloop.h" #include "ebusloop.h"
using namespace libebus;
class BaseLoop class BaseLoop
{ {
-2
View File
@@ -28,8 +28,6 @@
#include <csignal> #include <csignal>
#include <iostream> #include <iostream>
using namespace libebus;
Appl& A = Appl::Instance(); Appl& A = Appl::Instance();
Daemon& D = Daemon::Instance(); Daemon& D = Daemon::Instance();
Logger& L = Logger::Instance(); Logger& L = Logger::Instance();
-3
View File
@@ -30,9 +30,6 @@
/** the maximum time [us] allowed for retrieving a byte from an addressed slave */ /** the maximum time [us] allowed for retrieving a byte from an addressed slave */
#define RECV_TIMEOUT 10000 #define RECV_TIMEOUT 10000
using namespace libebus;
class EBusLoop : public Thread class EBusLoop : public Thread
{ {
-6
View File
@@ -19,9 +19,6 @@
#include "buscommand.h" #include "buscommand.h"
namespace libebus
{
BusCommand::BusCommand(const std::string commandStr, const bool poll, const bool scan) BusCommand::BusCommand(const std::string commandStr, const bool poll, const bool scan)
: m_poll(poll), m_scan(scan), m_command(commandStr), m_result(), m_resultCode(RESULT_OK) : m_poll(poll), m_scan(scan), m_command(commandStr), m_result(), m_resultCode(RESULT_OK)
{ {
@@ -64,6 +61,3 @@ const std::string BusCommand::getMessageStr()
return result; return result;
} }
} //namespace
+2 -9
View File
@@ -23,11 +23,6 @@
#include "symbol.h" #include "symbol.h"
#include "result.h" #include "result.h"
namespace libebus
{
enum CommandType { invalid, broadcast, masterMaster, masterSlave }; enum CommandType { invalid, broadcast, masterMaster, masterSlave };
class BusCommand class BusCommand
@@ -45,7 +40,7 @@ public:
SymbolString getResult() const { return m_result; } SymbolString getResult() const { return m_result; }
bool isErrorResult() const { return m_resultCode < 0; } bool isErrorResult() const { return m_resultCode < 0; }
const char* getResultCodeCStr() const { return libebus::getResultCodeCStr(m_resultCode); } const char* getResultCodeCStr() const { return getResultCode(m_resultCode); }
void setResult(const SymbolString result, const int resultCode) void setResult(const SymbolString result, const int resultCode)
{ m_result = result; m_resultCode = resultCode; } { m_result = result; m_resultCode = resultCode; }
@@ -66,7 +61,5 @@ private:
pthread_cond_t m_cond; pthread_cond_t m_cond;
}; };
} //namespace
#endif // LIBEBUS_BUSCOMMAND_H_ #endif // LIBEBUS_BUSCOMMAND_H_
-7
View File
@@ -27,10 +27,6 @@
#include <vector> #include <vector>
#include <cstring> #include <cstring>
namespace libebus
{
std::string Command::calcData() std::string Command::calcData()
{ {
// encode - only first entry will be encoded // encode - only first entry will be encoded
@@ -340,6 +336,3 @@ void Command::encode(const std::string& data, const std::string& type,
delete help; delete help;
} }
} //namespace
-7
View File
@@ -23,10 +23,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
namespace libebus
{
typedef std::vector<std::string> cmd_t; typedef std::vector<std::string> cmd_t;
typedef cmd_t::const_iterator cmdCI_t; typedef cmd_t::const_iterator cmdCI_t;
@@ -63,7 +59,4 @@ private:
}; };
} //namespace
#endif // LIBEBUS_COMMAND_H_ #endif // LIBEBUS_COMMAND_H_
-7
View File
@@ -25,10 +25,6 @@
#include <vector> #include <vector>
#include <cstring> #include <cstring>
namespace libebus
{
Commands::~Commands() Commands::~Commands()
{ {
for (mapCI_t iter = m_pollDB.begin(); iter != m_pollDB.end(); ++iter) for (mapCI_t iter = m_pollDB.begin(); iter != m_pollDB.end(); ++iter)
@@ -260,6 +256,3 @@ void Commands::printCommand(const cmd_t& command) const
std::cout << *i << ';'; std::cout << *i << ';';
} }
} //namespace
+1 -7
View File
@@ -25,10 +25,6 @@
#include <vector> #include <vector>
#include <map> #include <map>
namespace libebus
{
typedef std::vector<cmd_t> cmdDB_t; typedef std::vector<cmd_t> cmdDB_t;
typedef cmdDB_t::const_iterator cmdDBCI_t; typedef cmdDB_t::const_iterator cmdDBCI_t;
@@ -79,7 +75,5 @@ private:
}; };
} //namespace
#endif // LIBEBUS_COMMANDS_H_ #endif // LIBEBUS_COMMANDS_H_
-7
View File
@@ -22,10 +22,6 @@
#include <fstream> #include <fstream>
#include <dirent.h> #include <dirent.h>
namespace libebus
{
void ConfigFileCSV::parse(std::istream& is, Commands& commands) void ConfigFileCSV::parse(std::istream& is, Commands& commands)
{ {
std::string line; std::string line;
@@ -132,6 +128,3 @@ void ConfigCommands::addFiles(const std::string path, const std::string extensio
closedir(dir); closedir(dir);
}; };
} //namespace
+1 -6
View File
@@ -24,9 +24,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
namespace libebus
{
/** available file endings / types. */ /** available file endings / types. */
enum FileType { CSV, XML }; enum FileType { CSV, XML };
@@ -147,7 +144,5 @@ private:
}; };
} //namespace
#endif // LIBEBUS_CONFIGFILE_H_ #endif // LIBEBUS_CONFIGFILE_H_
-6
View File
@@ -27,9 +27,6 @@
#include <vector> #include <vector>
#include <cstring> #include <cstring>
namespace libebus
{
/** the known data field types. */ /** the known data field types. */
static const dataType_t dataTypes[] = { static const dataType_t dataTypes[] = {
{"STR", 16, bt_str, ADJ, ' ', 1, 16, 0}, // >= 1 byte character string filled up with space {"STR", 16, bt_str, ADJ, ' ', 1, 16, 0}, // >= 1 byte character string filled up with space
@@ -658,6 +655,3 @@ result_t ValueListDataField::writeSymbols(std::istringstream& input, SymbolStrin
return RESULT_ERR_INVALID_ARG; // value assignment not found return RESULT_ERR_INVALID_ARG; // value assignment not found
} }
} //namespace
-7
View File
@@ -26,10 +26,6 @@
#include <vector> #include <vector>
#include <map> #include <map>
namespace libebus
{
/** the message part in which a data field is stored. */ /** the message part in which a data field is stored. */
enum PartType { enum PartType {
pt_masterData, // stored in master data pt_masterData, // stored in master data
@@ -315,7 +311,4 @@ protected:
}; };
} //namespace
#endif // LIBEBUS_DATA_H_ #endif // LIBEBUS_DATA_H_
-7
View File
@@ -26,10 +26,6 @@
#include <vector> #include <vector>
#include <cstring> #include <cstring>
namespace libebus
{
Decode::Decode(const std::string& data, const std::string& factor) Decode::Decode(const std::string& data, const std::string& factor)
: m_data(data) : m_data(data)
{ {
@@ -347,6 +343,3 @@ std::string DecodeTTM::decode()
return result.str(); return result.str();
} }
} //namespace
-7
View File
@@ -22,10 +22,6 @@
#include <string> #include <string>
namespace libebus
{
class Decode class Decode
{ {
@@ -285,7 +281,4 @@ public:
}; };
} //namespace
#endif // LIBEBUS_DECODE_H_ #endif // LIBEBUS_DECODE_H_
-7
View File
@@ -21,9 +21,6 @@
#include <fstream> #include <fstream>
#include <cstdio> #include <cstdio>
namespace libebus
{
int Dump::write(const char* byte) int Dump::write(const char* byte)
{ {
int ret = 0; int ret = 0;
@@ -47,7 +44,3 @@ int Dump::write(const char* byte)
return ret; return ret;
} }
} //namespace
-6
View File
@@ -22,9 +22,6 @@
#include <string> #include <string>
namespace libebus
{
/** /**
* @brief Class for writing raw bytes to binary file. * @brief Class for writing raw bytes to binary file.
*/ */
@@ -68,7 +65,4 @@ private:
}; };
} //namespace
#endif // LIBEBUS_DUMP_H_ #endif // LIBEBUS_DUMP_H_
-7
View File
@@ -26,10 +26,6 @@
#include <vector> #include <vector>
#include <cstring> #include <cstring>
namespace libebus
{
Encode::Encode(const std::string& data, const std::string& factor) Encode::Encode(const std::string& data, const std::string& factor)
: m_data(data) : m_data(data)
{ {
@@ -364,6 +360,3 @@ std::string EncodeTTM::encode()
return result.str(); return result.str();
} }
} //namespace
-7
View File
@@ -22,10 +22,6 @@
#include <string> #include <string>
namespace libebus
{
class Encode class Encode
{ {
@@ -285,7 +281,4 @@ public:
}; };
} //namespace
#endif // LIBEBUS_ENCODE_H_ #endif // LIBEBUS_ENCODE_H_
-10
View File
@@ -26,11 +26,6 @@
#include <netdb.h> #include <netdb.h>
#include <poll.h> #include <poll.h>
namespace libebus
{
bool Device::isOpen() bool Device::isOpen()
{ {
if (isValid() == false) if (isValid() == false)
@@ -257,8 +252,3 @@ void Port::setType(const DeviceType type)
}; };
}; };
} //namespace
-6
View File
@@ -25,9 +25,6 @@
#include <termios.h> #include <termios.h>
#include <unistd.h> #include <unistd.h>
namespace libebus
{
/** available device types. */ /** available device types. */
enum DeviceType { SERIAL, NETWORK }; enum DeviceType { SERIAL, NETWORK };
@@ -267,7 +264,4 @@ private:
}; };
} //namespace
#endif // LIBEBUS_PORT_H_ #endif // LIBEBUS_PORT_H_
+1 -6
View File
@@ -19,10 +19,7 @@
#include "result.h" #include "result.h"
namespace libebus const char* getResultCode(result_t resultCode) {
{
const char* getResultCodeCStr(result_t resultCode) {
switch (resultCode) { switch (resultCode) {
case RESULT_ERR_SEND: return "ERR_SEND: send error"; case RESULT_ERR_SEND: return "ERR_SEND: send error";
case RESULT_ERR_EXTRA_DATA: return "ERR_EXTRA_DATA: received bytes > sent bytes"; 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_ #ifndef LIBEBUS_RESULT_H_
#define LIBEBUS_RESULT_H_ #define LIBEBUS_RESULT_H_
namespace libebus
{
static const int RESULT_OK = 0; static const int RESULT_OK = 0;
static const int RESULT_BUS_ACQUIRED = 1; // bus successfully acquired 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). * @param resultCode the result code (see RESULT_ constants).
* @return the string corresponding to the result code. * @return the string corresponding to the result code.
*/ */
const char* getResultCodeCStr(result_t resultCode); const char* getResultCode(result_t resultCode);
} //namespace
#endif // LIBEBUS_RESULT_H_ #endif // LIBEBUS_RESULT_H_
-4
View File
@@ -22,9 +22,6 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
namespace libebus
{
/** /**
* @brief CRC8 lookup table for the polynom 0x9b = x^8 + x^7 + x^4 + x^3 + x^1 + 1. * @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)); && ((addrLo == 0x0) || (addrLo == 0x1) || (addrLo == 0x3) || (addrLo == 0x7) || (addrLo == 0xF));
} }
} //namespace
-7
View File
@@ -25,10 +25,6 @@
#include <sstream> #include <sstream>
#include <queue> #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 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 SYN = 0xAA; // synchronization symbol
static const unsigned char ACK = 0x00; // positive acknowledge static const unsigned char ACK = 0x00; // positive acknowledge
@@ -139,7 +135,4 @@ private:
*/ */
bool isMaster(unsigned char addr); bool isMaster(unsigned char addr);
} //namespace
#endif // LIBEBUS_SYMBOL_H_ #endif // LIBEBUS_SYMBOL_H_
-2
View File
@@ -25,8 +25,6 @@
#include <sstream> #include <sstream>
#include <vector> #include <vector>
using namespace libebus;
// will be part of cfg csv class // will be part of cfg csv class
void readCSV(std::istream& is, Commands& commands){ void readCSV(std::istream& is, Commands& commands){
std::string line; std::string line;
-3
View File
@@ -24,9 +24,6 @@
#include <sstream> #include <sstream>
#include <vector> #include <vector>
using namespace libebus;
int main() { int main() {
std::string dir("test"); std::string dir("test");
+4 -6
View File
@@ -21,8 +21,6 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
using namespace libebus;
int main () int main ()
{ {
std::string checks[][4] = { std::string checks[][4] = {
@@ -72,7 +70,7 @@ int main ()
result_t result = DataField::create(mstr[1], false, it, entries.end(), predefined, fields, nextPos); result_t result = DataField::create(mstr[1], false, it, entries.end(), predefined, fields, nextPos);
if (result != RESULT_OK) { if (result != RESULT_OK) {
std::cout << "create \"" << checks[i][0] << "\" failed: " << getResultCodeCStr(result) << std::endl; std::cout << "create \"" << checks[i][0] << "\" failed: " << getResultCode(result) << std::endl;
continue; continue;
} }
if (fields.empty() == true) { if (fields.empty() == true) {
@@ -86,7 +84,7 @@ int main ()
std::ostringstream output; std::ostringstream output;
result = field->read(mstr, sstr, output); result = field->read(mstr, sstr, output);
if (result != RESULT_OK) { if (result != RESULT_OK) {
std::cout << "read \"" << checks[i][0] << "\" failed: " << getResultCodeCStr(result) << std::endl; std::cout << "read \"" << checks[i][0] << "\" failed: " << getResultCode(result) << std::endl;
} }
else { else {
std::string gotStr = output.str(); std::string gotStr = output.str();
@@ -101,12 +99,12 @@ int main ()
SymbolString writeSstr = SymbolString(sstr.getDataStr().substr(0, 2), false); SymbolString writeSstr = SymbolString(sstr.getDataStr().substr(0, 2), false);
if (result != RESULT_OK) { if (result != RESULT_OK) {
std::cout << "create \"" << checks[i][0] << "\" failed: " << getResultCodeCStr(result) << std::endl; std::cout << "create \"" << checks[i][0] << "\" failed: " << getResultCode(result) << std::endl;
return 1; return 1;
} }
result = field->write(gotStr, writeMstr, writeSstr); result = field->write(gotStr, writeMstr, writeSstr);
if (result != RESULT_OK) { if (result != RESULT_OK) {
std::cout << "write \"" << checks[i][0] << "\" failed: " << getResultCodeCStr(result) << std::endl; std::cout << "write \"" << checks[i][0] << "\" failed: " << getResultCode(result) << std::endl;
} }
else { else {
if (mstr == writeMstr && sstr == writeSstr) if (mstr == writeMstr && sstr == writeSstr)
-4
View File
@@ -21,10 +21,6 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
using namespace libebus;
int main() int main()
{ {
Decode* help_dec = NULL; Decode* help_dec = NULL;
-4
View File
@@ -21,10 +21,6 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
using namespace libebus;
int main() int main()
{ {
Encode* help_enc = NULL; Encode* help_enc = NULL;
-2
View File
@@ -21,8 +21,6 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
using namespace libebus;
int main () int main ()
{ {
std::string dev("/dev/ttyUSB20"); std::string dev("/dev/ttyUSB20");
-2
View File
@@ -21,8 +21,6 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
using namespace libebus;
int main () int main ()
{ {
SymbolString sstr = SymbolString("10feb5050427a915aa"); SymbolString sstr = SymbolString("10feb5050427a915aa");