From 105f5e6e7d4a5fc31ff60edb2a9bec458191a36f Mon Sep 17 00:00:00 2001 From: Roland Jax Date: Mon, 15 Dec 2014 12:12:38 +0100 Subject: [PATCH] documentation for doxygen corrected. --- src/ebusd/baseloop.h | 2 +- src/ebusd/bushandler.h | 2 - src/lib/ebus/data.h | 109 +++++++++++++++++++++++++++++++---------- src/lib/ebus/message.h | 46 +++++++++++++++-- src/lib/ebus/port.h | 2 +- src/lib/ebus/result.h | 53 ++++++++++---------- src/lib/ebus/symbol.h | 35 ++++++++++--- src/lib/utils/logger.h | 8 +-- 8 files changed, 184 insertions(+), 73 deletions(-) diff --git a/src/ebusd/baseloop.h b/src/ebusd/baseloop.h index 0a486a10..0e6df458 100644 --- a/src/ebusd/baseloop.h +++ b/src/ebusd/baseloop.h @@ -85,7 +85,7 @@ public: /** * @brief Create a log message for a received/sent raw data byte. - * @param param byte the raw data byte. + * @param byte the raw data byte. * @param received true if the byte was received, false if it was sent. */ static void logRaw(const unsigned char byte, bool received); diff --git a/src/ebusd/bushandler.h b/src/ebusd/bushandler.h index b0d74bec..208f3088 100644 --- a/src/ebusd/bushandler.h +++ b/src/ebusd/bushandler.h @@ -114,7 +114,6 @@ public: /** * @brief Constructor. - * @param slave the slave data @a SymbolString received. * @param message the associated @a Message. */ PollRequest(Message* message) @@ -156,7 +155,6 @@ public: /** * @brief Constructor. - * @param slave the slave data @a SymbolString received. * @param message the primary query @a Message. * @param messages the optional secondary query @a Message instances (to be queried only when the primary was successful). * @param scanResults the map in which to store the formatted scan result by slave address. diff --git a/src/lib/ebus/data.h b/src/lib/ebus/data.h index 75d4e41e..7581c5ad 100644 --- a/src/lib/ebus/data.h +++ b/src/lib/ebus/data.h @@ -32,6 +32,8 @@ using namespace std; +/** \file data.h */ + /** the separator character used between multiple values (in CSV only). */ #define VALUE_SEPARATOR ';' @@ -46,41 +48,41 @@ using namespace std; /** the message part in which a data field is stored. */ enum PartType { - pt_any, // stored in any data (master or slave) - pt_masterData, // stored in master data - pt_slaveData, // stored in slave data + pt_any, /*!< stored in any data (master or slave) */ + pt_masterData, /*!< stored in master data */ + pt_slaveData, /*!< stored in slave data */ }; /** the available base data types. */ enum BaseType { - bt_str, // text string in a @a StringDataField - bt_hexstr, // hex digit string in a @a StringDataField - bt_dat, // date in a @a StringDataField - bt_tim, // time in a @a StringDataField - bt_num, // numeric value in a @a NumericDataField + bt_str, /*!< text string in a @a StringDataField */ + bt_hexstr, /*!< hex digit string in a @a StringDataField */ + bt_dat, /*!< date in a @a StringDataField */ + bt_tim, /*!< time in a @a StringDataField */ + bt_num, /*!< numeric value in a @a NumericDataField */ }; /** flags for dataType_t. */ -const unsigned int ADJ = 0x01; // adjustable length, numBits is maximum length -const unsigned int BCD = 0x02; // binary representation is BCD -const unsigned int REV = 0x04; // reverted binary representation (most significant byte first) -const unsigned int SIG = 0x08; // signed value -const unsigned int LST = 0x10; // value list is possible (without applied divisor) -const unsigned int DAY = 0x20; // forced value list defaulting to week days -const unsigned int IGN = 0x40; // ignore value during read and write -const unsigned int FIX = 0x80; // fixed width formatting +const unsigned int ADJ = 0x01; /*!< adjustable length, numBits is maximum length */ +const unsigned int BCD = 0x02; /*!< binary representation is BCD */ +const unsigned int REV = 0x04; /*!< reverted binary representation (most significant byte first) */ +const unsigned int SIG = 0x08; /*!< signed value */ +const unsigned int LST = 0x10; /*!< value list is possible (without applied divisor) */ +const unsigned int DAY = 0x20; /*!< forced value list defaulting to week days */ +const unsigned int IGN = 0x40; /*!< ignore value during read and write */ +const unsigned int FIX = 0x80; /*!< fixed width formatting */ /** the structure for defining field types with their properties. */ typedef struct { - const char* name; // field identifier - const unsigned int maxBits; // number of bits (maximum length if @a ADJ flag is set, must be multiple of 8 with flag @a BCD) - const BaseType type; // base data type - const unsigned int flags; // flags (e.g. @a BCD) - const unsigned int replacement; // replacement value (fill-up value for @a bt_str / @a bt_hexstr, no replacement if equal to @a minValueOrLength for @a bt_num) - const unsigned int minValueOrLength; // minimum binary value (minimum length of string for @a StringDataField) - const unsigned int maxValueOrLength; // maximum binary value (maximum length of string for @a StringDataField) - const unsigned int divisor; // @a bt_number: divisor - const unsigned char precisionOrFirstBit; // @a bt_number: precision for formatting or offset to first bit if (@a numBits%8)!=0 + const char* name; /*!< field identifier */ + const unsigned int maxBits; /*!< number of bits (maximum length if @a ADJ flag is set, must be multiple of 8 with flag @a BCD) */ + const BaseType type; /*!< base data type */ + const unsigned int flags; /*!< flags (e.g. @a BCD) */ + const unsigned int replacement; /*!< replacement value (fill-up value for @a bt_str / @a bt_hexstr, no replacement if equal to @a minValueOrLength for @a bt_num) */ + const unsigned int minValueOrLength; /*!< minimum binary value (minimum length of string for @a StringDataField) */ + const unsigned int maxValueOrLength; /*!< maximum binary value (maximum length of string for @a StringDataField) */ + const unsigned int divisor; /*!< @a bt_number: divisor */ + const unsigned char precisionOrFirstBit; /*!< @a bt_number: precision for formatting or offset to first bit if (@a numBits%8)!=0 */ } dataType_t; @@ -100,7 +102,6 @@ unsigned int parseInt(const char* str, int base, const unsigned int minValue, co * @param begin the iterator to the beginning of the items. * @param end the iterator to the end of the items. * @param pos the iterator with the erroneous position. - * @param separator the character to place between items. */ void printErrorPos(vector::iterator begin, const vector::iterator end, vector::iterator pos, string filename, size_t lineNo, result_t result); @@ -122,10 +123,12 @@ public: */ DataField(const string name, const string comment) : m_name(name), m_comment(comment) {} + /** * @brief Destructor. */ virtual ~DataField() {} + /** * @brief Factory method for creating new instances. * @param it the iterator to traverse for the definition parts. @@ -140,12 +143,14 @@ public: static result_t create(vector::iterator& it, const vector::iterator end, DataFieldTemplates* templates, DataField*& returnField, const bool isSetMessage=false, const unsigned char dstAddress=SYN); + /** * @brief Returns the length of this field (or contained fields) in bytes. * @param partType the message part of the contained fields to limit the length calculation to. * @return the length of this field (or contained fields) in bytes. */ virtual unsigned char getLength(PartType partType) = 0; + /** * @brief Derives a new DataField from this field. * @param name the field name. @@ -160,21 +165,25 @@ public: string unit, const PartType partType, unsigned int divisor, map values, vector& fields) = 0; + /** * @brief Get the field name. * @return the field name. */ string getName() const { return m_name; } + /** * @brief Get the field comment. * @return the field comment. */ string getComment() const { return m_comment; } + /** * @brief Dump the field settings to the output. * @param output the @a ostream to dump to. */ virtual void dump(ostream& output) = 0; + /** * @brief Reads the value from the @a SymbolString. * @param partType the @a PartType of the data. @@ -195,6 +204,7 @@ public: ostringstream& output, bool leadingSeparator=false, bool verbose=false, const char* filterName=NULL, char separator=UI_FIELD_SEPARATOR) = 0; + /** * @brief Writes the value to the master or slave @a SymbolString. * @param input the @a istringstream to parse the formatted value from. @@ -212,6 +222,7 @@ protected: /** the field name. */ const string m_name; + /** the field comment. */ const string m_comment; @@ -240,28 +251,34 @@ public: : DataField(name, comment), m_unit(unit), m_dataType(dataType), m_partType(partType), m_length(length) {} + /** * @brief Destructor. */ virtual ~SingleDataField() {} + /** * @brief Get the value unit. * @return the value unit. */ string getUnit() const { return m_unit; } + /** * @brief Get whether this field is ignored. * @return whether this field is ignored. */ bool isIgnored() const { return (m_dataType.flags & IGN) != 0; } + /** * @brief Get the message part in which the field is stored. * @return the message part in which the field is stored. */ PartType getPartType() const { return m_partType; } + // @copydoc virtual unsigned char getLength(PartType partType) { return partType == m_partType ? m_length : 0; }; // re-use same position as previous field as not all bits of fully consumed yet + /** * @brief Get whether this field uses a full byte offset. * @param after @p true to check after consuming the bits, false to check before. @@ -269,14 +286,17 @@ public: * only consumes a part of a byte and a subsequent field may re-use the same offset. */ virtual bool hasFullByteOffset(bool after) { return true; } + // @copydoc virtual void dump(ostream& output); + // @copydoc virtual result_t read(const PartType partType, SymbolString& data, unsigned char offset, ostringstream& output, bool leadingSeparator=false, bool verbose=false, const char* filterName=NULL, char separator=UI_FIELD_SEPARATOR); + // @copydoc virtual result_t write(istringstream& input, const PartType partType, SymbolString& data, @@ -292,6 +312,7 @@ protected: * @return @a RESULT_OK on success, or an error code. */ virtual result_t readSymbols(SymbolString& input, const unsigned char offset, ostringstream& output) = 0; + /** * @brief Internal method for writing the field to a @a SymbolString. * @param input the @a istringstream to parse the formatted value from. @@ -305,10 +326,13 @@ protected: /** the value unit. */ const string m_unit; + /** the data type definition. */ const dataType_t m_dataType; + /** the message part in which the field is stored. */ const PartType m_partType; + /** the number of symbols in the message part in which the field is stored. */ const unsigned char m_length; @@ -335,15 +359,18 @@ public: const string unit, const dataType_t dataType, const PartType partType, const unsigned char length) : SingleDataField(name, comment, unit, dataType, partType, length) {} + /** * @brief Destructor. */ virtual ~StringDataField() {} + // @copydoc virtual result_t derive(string name, string comment, string unit, const PartType partType, unsigned int divisor, map values, vector& fields); + // @copydoc virtual void dump(ostream& output); @@ -351,6 +378,7 @@ protected: // @copydoc virtual result_t readSymbols(SymbolString& input, const unsigned char offset, ostringstream& output); + // @copydoc virtual result_t writeSymbols(istringstream& input, const unsigned char offset, SymbolString& output); @@ -380,12 +408,15 @@ public: const unsigned char length, const unsigned char bitCount, const unsigned char bitOffset) : SingleDataField(name, comment, unit, dataType, partType, length), m_bitCount(bitCount), m_bitOffset(bitOffset) {} + /** * @brief Destructor. */ virtual ~NumericDataField() {} + // @copydoc virtual bool hasFullByteOffset(bool after); + // @copydoc virtual void dump(ostream& output); @@ -399,6 +430,7 @@ protected: * @return @a RESULT_OK on success, or an error code. */ result_t readRawValue(SymbolString& input, const unsigned char offset, unsigned int& value); + /** * @brief Internal method for writing the raw value to a @a SymbolString. * @param value the raw value to write. @@ -441,15 +473,18 @@ public: : NumericDataField(name, comment, unit, dataType, partType, length, bitCount, (dataType.maxBits < 8) ? dataType.precisionOrFirstBit : 0), m_divisor(divisor) {} + /** * @brief Destructor. */ virtual ~NumberDataField() {} + // @copydoc virtual result_t derive(string name, string comment, string unit, const PartType partType, unsigned int divisor, map values, vector& fields); + // @copydoc virtual void dump(ostream& output); @@ -457,6 +492,7 @@ protected: // @copydoc virtual result_t readSymbols(SymbolString& input, const unsigned char offset, ostringstream& output); + // @copydoc virtual result_t writeSymbols(istringstream& input, const unsigned char offset, SymbolString& output); @@ -492,15 +528,18 @@ public: : NumericDataField(name, comment, unit, dataType, partType, length, bitCount, (dataType.maxBits < 8) ? dataType.precisionOrFirstBit : 0), m_values(values) {} + /** * @brief Destructor. */ virtual ~ValueListDataField() {} + // @copydoc virtual result_t derive(string name, string comment, string unit, const PartType partType, unsigned int divisor, map values, vector& fields); + // @copydoc virtual void dump(ostream& output); @@ -508,6 +547,7 @@ protected: // @copydoc virtual result_t readSymbols(SymbolString& input, const unsigned char offset, ostringstream& output); + // @copydoc virtual result_t writeSymbols(istringstream& input, const unsigned char offset, SymbolString& output); @@ -531,6 +571,7 @@ public: * @return the @a DataFieldSet for parsing the identification message. */ static DataFieldSet* createIdentFields(); + /** * @brief Constructs a new instance. * @param name the field name. @@ -541,42 +582,51 @@ public: const vector fields) : DataField(name, comment), m_fields(fields) {} + /** * @brief Destructor. */ virtual ~DataFieldSet(); + // @copydoc virtual unsigned char getLength(PartType partType); + // @copydoc virtual result_t derive(string name, string comment, string unit, const PartType partType, unsigned int divisor, map values, vector& fields); + /** * @brief Returns the @a SingleDataField at the specified index. * @param index the index of the @a SingleDataField to return. * @return the @a SingleDataField at the specified index, or NULL. */ SingleDataField* operator[](const size_t index) { if (index >= m_fields.size()) return NULL; return m_fields[index]; } + /** * @brief Returns the @a SingleDataField at the specified index. * @param index the index of the @a SingleDataField to return. * @return the @a SingleDataField at the specified index, or NULL. */ const SingleDataField* operator[](const size_t index) const { if (index >= m_fields.size()) return NULL; return m_fields[index]; } + /** * @brief Returns the number of @a SingleDataFields instances in this set. * @return the number of available @a SingleDataField instances. */ size_t size() const { return m_fields.size(); } + // @copydoc virtual void dump(ostream& output); + // @copydoc virtual result_t read(const PartType partType, SymbolString& data, unsigned char offset, ostringstream& output, bool leadingSeparator=false, bool verbose=false, const char* filterName=NULL, char separator=UI_FIELD_SEPARATOR); + // @copydoc virtual result_t write(istringstream& input, const PartType partType, SymbolString& data, @@ -601,24 +651,29 @@ public: * @brief Constructs a new instance. */ DataFieldTemplates() : FileReader(false) {} + /** * @brief Destructor. */ virtual ~DataFieldTemplates() { clear(); } + /** * @brief Removes all @a DataField instances. */ void clear(); + /** * @brief Adds a template @a DataField instance to this map. - * @param field the @a DataField instance to add. + * @param message the @a DataField instance to add. * @param replace whether replacing an already stored instance is allowed. * @return @a RESULT_OK on success, or an error code. * Note: the caller may not free the added instance on success. */ result_t add(DataField* message, bool replace=false); + // @copydoc virtual result_t addFromFile(vector& row, void* arg, vector< vector >* defaults, const string& filename, unsigned int lineNo); + /** * @brief Gets the template @a DataField instance with the specified name. * @return the template @a DataField instance, or NULL. diff --git a/src/lib/ebus/message.h b/src/lib/ebus/message.h index 022c4684..23ed10f0 100644 --- a/src/lib/ebus/message.h +++ b/src/lib/ebus/message.h @@ -42,7 +42,7 @@ public: /** * @brief Construct a new instance. - * @param class the optional device class. + * @param clazz the optional device class. * @param name the message name (unique within the same class and type). * @param isSet whether this is a set message. * @param isPassive true if message can only be initiated by a participant other than us, @@ -59,6 +59,7 @@ public: const unsigned char srcAddress, const unsigned char dstAddress, const vector id, DataField* data, const unsigned int pollPriority); + /** * @brief Construct a new temporary instance. * @param isSet whether this is a set message. @@ -71,10 +72,12 @@ public: Message(const bool isSet, const bool isPassive, const unsigned char pb, const unsigned char sb, DataField* data); + /** * @brief Destructor. */ virtual ~Message() { delete m_data; } + /** * @brief Factory method for creating a new instance. * @param it the iterator to traverse for the definition parts. @@ -88,52 +91,62 @@ public: static result_t create(vector::iterator& it, const vector::iterator end, vector< vector >* defaultsRows, DataFieldTemplates* templates, Message*& returnValue); + /** * @brief Get the optional device class. * @return the optional device class. */ string getClass() const { return m_class; } + /** * @brief Get the message name (unique within the same class and type). * @return the message name (unique within the same class and type). */ string getName() const { return m_name; } + /** * @brief Get whether this is a set message. * @return whether this is a set message. */ bool isSet() const { return m_isSet; } + /** * @brief Get whether message can be initiated only by a participant other than us. * @return true if message can only be initiated by a participant other than us, * false if message can be initiated by any participant. */ bool isPassive() const { return m_isPassive; } + /** * @brief Get the comment. * @return the comment. */ string getComment() const { return m_comment; } + /** * @brief Get the source address. * @return the source address, or @a SYN for any. */ unsigned char getSrcAddress() const { return m_srcAddress; } + /** * @brief Get the destination address. * @return the destination address, or @a SYN for any. */ unsigned char getDstAddress() const { return m_dstAddress; } + /** * @brief Get the command ID bytes. * @return the primary, secondary, and optionally further command ID bytes. */ vector getId() const { return m_id; } + /** * @brief Return the key for storing in @a MessageSet. * @return the key for storing in @a MessageSet. */ unsigned long long getKey() { return m_key; } + /** * @brief Get the polling priority, or 0 for no polling at all. * @return the polling priority, or 0 for no polling at all. @@ -158,7 +171,7 @@ public: * @param slaveData the slave data @a SymbolString for writing symbols to. * @return @a RESULT_OK on success, or an error code. */ - result_t prepareSlave(SymbolString& masterData); + result_t prepareSlave(SymbolString& slaveData); /** * @brief Decode a received message. @@ -204,35 +217,49 @@ public: private: - /** the optional device class. */ + /** the optional device class. */ const string m_class; + /** the message name (unique within the same class and type). */ const string m_name; + /** whether this is a set message. */ const bool m_isSet; + /** true if message can only be initiated by a participant other than us, * false if message can be initiated by any participant. */ const bool m_isPassive; + /** the comment. */ const string m_comment; + /** the source address, or @a SYN for any (only relevant if passive). */ const unsigned char m_srcAddress; + /** the destination address. */ const unsigned char m_dstAddress; + /** the primary, secondary, and optionally further command ID bytes. */ vector m_id; + /** the key for storing in @a MessageSet. */ unsigned long long m_key; + /** the @a DataField for encoding/decoding the message. */ DataField* m_data; + /** the priority for polling, or 0 for no polling at all. */ const unsigned char m_pollPriority; + /** the last decoded value. */ string m_lastValue; + /** the system time when @a m_lastValue was updated, 0 for never. */ time_t m_lastUpdateTime; + /** the number of times this messages was already polled for. */ unsigned int m_pollCount; + /** the system time when this message was last polled for, 0 for never. */ time_t m_lastPollTime; @@ -258,10 +285,12 @@ public: * @brief Construct a new instance. */ MessageMap() : FileReader(true), m_minIdLength(4), m_maxIdLength(0), m_messageCount(0) {} + /** * @brief Destructor. */ virtual ~MessageMap() { clear(); } + /** * @brief Add a @a Message instance to this set. * @param message the @a Message instance to add. @@ -270,10 +299,11 @@ public: */ result_t add(Message* message); // @copydoc + virtual result_t addFromFile(vector& row, DataFieldTemplates* arg, vector< vector >* defaults, const string& filename, unsigned int lineNo); /** * @brief Find the @a Message instance for the specified class and name. - * @param class the optional device class. + * @param clazz the optional device class. * @param name the message name. * @param isSet whether this is a set message. * @param isPassive whether this is a passive message. @@ -281,15 +311,17 @@ public: * Note: the caller may not free the returned instance. */ Message* find(const string& clazz, const string& name, const bool isSet, const bool isPassive=false); + /** * @brief Find all active get @a Message instances for the specified class and name. - * @param class the device class, or empty for any. + * @param clazz the device class, or empty for any. * @param name the message name, or empty for any. * @param pb the primary ID byte, or -1 for any. * @return the found @a Message instances. * Note: the caller may not free the returned instances. */ deque findAll(const string& clazz, const string& name, const short pb); + /** * @brief Find the @a Message instance for the specified master data. * @param master the master @a SymbolString for identifying the @a Message. @@ -297,21 +329,25 @@ public: * Note: the caller may not free the returned instance. */ Message* find(SymbolString& master); + /** * @brief Removes all @a Message instances. */ void clear(); + /** * @brief Get the number of stored @a Message instances. * @param passiveOnly true to count only passive messages, false to count all messages. * @return the the number of stored @a Message instances. */ int size(const bool passiveOnly=false) { return passiveOnly ? m_passiveMessagesByKey.size() : m_messageCount; } + /** * @brief Get the number of stored @a Message instances with a poll priority. * @return the the number of stored @a Message instances with a poll priority. */ int sizePoll() { return m_pollMessages.size(); } + /** * @brief Get the next @a Message to poll. * @return the next @a Message to poll, or NULL. diff --git a/src/lib/ebus/port.h b/src/lib/ebus/port.h index 8d17f2b1..798797f8 100644 --- a/src/lib/ebus/port.h +++ b/src/lib/ebus/port.h @@ -271,7 +271,7 @@ public: /** * @brief Enable or disable logging of raw data. - * @param logRawData true to enable logging of raw data, false to disable it. + * @param logRaw true to enable logging of raw data, false to disable it. */ void setLogRaw(bool logRaw=true) { m_logRaw = logRaw; } diff --git a/src/lib/ebus/result.h b/src/lib/ebus/result.h index 4959d4f6..36817996 100644 --- a/src/lib/ebus/result.h +++ b/src/lib/ebus/result.h @@ -20,34 +20,33 @@ #ifndef LIBEBUS_RESULT_H_ #define LIBEBUS_RESULT_H_ -static const int RESULT_OK = 0; // success +/** \file result.h */ -static const int RESULT_IN_ESC = 1; // start of escape sequence received -static const int RESULT_SYN = 2; // regular SYN after message received -static const int RESULT_EMPTY = 3; // empty result - -static const int RESULT_ERR_GENERIC_IO = -1; // generic I/O error (usually fatal) -static const int RESULT_ERR_DEVICE = -2; // generic device error (usually fatal) -static const int RESULT_ERR_SEND = -3; // send error -static const int RESULT_ERR_ESC = -4; // invalid escape sequence -static const int RESULT_ERR_TIMEOUT = -5; // read timeout - -static const int RESULT_ERR_NOTFOUND = -6; // file/element not found or not readable -static const int RESULT_ERR_EOF = -7; // end of input reached -static const int RESULT_ERR_INVALID_ARG = -8; // invalid argument -static const int RESULT_ERR_INVALID_NUM = -9; // invalid numeric argument -static const int RESULT_ERR_INVALID_ADDR = -10; // invalid address -static const int RESULT_ERR_INVALID_POS = -11; // invalid position -static const int RESULT_ERR_OUT_OF_RANGE = -12; // argument value out of valid range -static const int RESULT_ERR_INVALID_PART = -13; // invalid part type value -static const int RESULT_ERR_MISSING_TYPE = -14; // missing data type -static const int RESULT_ERR_INVALID_LIST = -15; // invalid value list -static const int RESULT_ERR_DUPLICATE = -16; // duplicate entry - -static const int RESULT_ERR_BUS_LOST = -17; // arbitration lost -static const int RESULT_ERR_CRC = -18; // CRC error -static const int RESULT_ERR_ACK = -19; // ACK error -static const int RESULT_ERR_NAK = -20; // NAK received +/** types for result_t. */ +static const int RESULT_OK = 0; /*!< success */ +static const int RESULT_IN_ESC = 1; /*!< start of escape sequence received */ +static const int RESULT_SYN = 2; /*!< regular SYN after message received */ +static const int RESULT_EMPTY = 3; /*!< empty result */ +static const int RESULT_ERR_GENERIC_IO = -1; /*!< generic I/O error (usually fatal) */ +static const int RESULT_ERR_DEVICE = -2; /*!< generic device error (usually fatal) */ +static const int RESULT_ERR_SEND = -3; /*!< send error */ +static const int RESULT_ERR_ESC = -4; /*!< invalid escape sequence */ +static const int RESULT_ERR_TIMEOUT = -5; /*!< read timeout */ +static const int RESULT_ERR_NOTFOUND = -6; /*!< file/element not found or not readable */ +static const int RESULT_ERR_EOF = -7; /*!< end of input reached */ +static const int RESULT_ERR_INVALID_ARG = -8; /*!< invalid argument */ +static const int RESULT_ERR_INVALID_NUM = -9; /*!< invalid numeric argument */ +static const int RESULT_ERR_INVALID_ADDR = -10; /*!< invalid address */ +static const int RESULT_ERR_INVALID_POS = -11; /*!< invalid position */ +static const int RESULT_ERR_OUT_OF_RANGE = -12; /*!< argument value out of valid range */ +static const int RESULT_ERR_INVALID_PART = -13; /*!< invalid part type value */ +static const int RESULT_ERR_MISSING_TYPE = -14; /*!< missing data type */ +static const int RESULT_ERR_INVALID_LIST = -15; /*!< invalid value list */ +static const int RESULT_ERR_DUPLICATE = -16; /*!< duplicate entry */ +static const int RESULT_ERR_BUS_LOST = -17; /*!< arbitration lost */ +static const int RESULT_ERR_CRC = -18; /*!< CRC error */ +static const int RESULT_ERR_ACK = -19; /*!< ACK error */ +static const int RESULT_ERR_NAK = -20; /*!< NAK received */ /** type for result code. */ typedef int result_t; diff --git a/src/lib/ebus/symbol.h b/src/lib/ebus/symbol.h index 14c2d90d..754b3a6d 100644 --- a/src/lib/ebus/symbol.h +++ b/src/lib/ebus/symbol.h @@ -28,11 +28,21 @@ using namespace std; -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 -static const unsigned char NAK = 0xFF; // negative acknowledge -static const unsigned char BROADCAST = 0xFE; // the broadcast destination address + +/** escape symbol, either followed by 0x00 for the value 0xA9, or 0x01 for the value 0xAA */ +static const unsigned char ESC = 0xA9; + +/** synchronization symbol */ +static const unsigned char SYN = 0xAA; + +/** positive acknowledge */ +static const unsigned char ACK = 0x00; + +/** negative acknowledge */ +static const unsigned char NAK = 0xFF; + +/** the broadcast destination address */ +static const unsigned char BROADCAST = 0xFE; /** @@ -46,40 +56,47 @@ public: * @brief Creates a new unescaped empty instance. */ SymbolString() : m_unescapeState(1), m_crc(0) {} + /** * @brief Creates a new escaped instance from an unescaped hex string and adds the calculated CRC. * @param str the unescaped hex string. */ SymbolString(const string& str); + /** * @brief Creates a new escaped or unescaped instance from another @a SymbolString and adds the calculated CRC. * @param str the @a SymbolString top copy from. */ SymbolString(const SymbolString& str, const bool escape, const bool addCrc=true); + /** * @brief Creates a new unescaped instance from a hex string. * @param isEscaped whether the hex string is escaped and shall be unescaped. * @param str the hex string. */ SymbolString(const string& str, const bool isEscaped); + /** * @brief Returns the symbols as hex string. * @param unescape whether to unescape an escaped instance. * @return the symbols as hex string. */ const string getDataStr(const bool unescape=true); + /** * @brief Returns a reference to the symbol at the specified index. * @param index the index of the symbol to return. * @return the reference to the symbol at the specified index. */ unsigned char& operator[](const size_t index) { if (index >= m_data.size()) m_data.resize(index+1, 0); return m_data[index]; } + /** * @brief Returns the symbol at the specified index. * @param index the index of the symbol to return. * @return the symbol at the specified index. */ const unsigned char& operator[](const size_t index) const { return m_data[index]; } + /** * @brief Returns whether this instance is equal to the other instance. * @param other the other instance. @@ -99,26 +116,30 @@ public: cout<<"["<(other.m_unescapeState)<<"]"< m_data; + /** * @brief 0 if the symbols in @a m_data are escaped, * 1 if the symbols in @a m_data are unescaped and the last symbol passed to @a push_back was a normal symbol, * 2 if the symbols in @a m_data are unescaped and the last symbol passed to @a push_back was the escape symbol. */ int m_unescapeState; + /** * @brief the calculated CRC. */ diff --git a/src/lib/utils/logger.h b/src/lib/utils/logger.h index 18789e65..dde352e3 100644 --- a/src/lib/utils/logger.h +++ b/src/lib/utils/logger.h @@ -129,7 +129,7 @@ class LogSink : public Thread public: /** * @brief creates a virtual logging sink. - * @param areas the logging area mask. + * @param areaMask the logging area mask. * @param level the logging level. */ LogSink(const int areaMask, const int level) : m_areaMask(areaMask), m_level(level) {} @@ -153,7 +153,7 @@ public: /** * @brief set the logging area mask. - * @param areas the logging area mask. + * @param areaMask the logging area mask. */ void setAreaMask(const int& areaMask) { m_areaMask = areaMask; } @@ -197,7 +197,7 @@ class LogConsole : public LogSink public: /** * @brief creates a console logging sink. - * @param areas the logging area mask. + * @param areaMask the logging area mask. * @param level the logging level. * @param name the thread name for logging sink. */ @@ -222,7 +222,7 @@ class LogFile : public LogSink public: /** * @brief creates a log file logging sink. - * @param areas the logging area mask. + * @param areaMask the logging area mask. * @param level the logging level. * @param name the thread name for logging sink. * @param file the log file.