switched to autobrief

This commit is contained in:
john30
2015-01-18 12:40:54 +01:00
parent fb99ac55a1
commit 44957a6566
20 changed files with 335 additions and 335 deletions
+56 -56
View File
@@ -34,26 +34,26 @@
using namespace std;
/** @brief the separator character used between multiple values (in CSV only). */
/** the separator character used between multiple values (in CSV only). */
#define VALUE_SEPARATOR ';'
/** @brief the separator character used between base type name and length (in CSV only). */
/** the separator character used between base type name and length (in CSV only). */
#define LENGTH_SEPARATOR ':'
/** @brief the replacement string for undefined values (in UI and CSV). */
/** the replacement string for undefined values (in UI and CSV). */
#define NULL_VALUE "-"
/** @brief the separator character used between fields (in UI only). */
/** the separator character used between fields (in UI only). */
#define UI_FIELD_SEPARATOR ';'
/** @brief the message part in which a data field is stored. */
/** 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
};
/** @brief the available base data types. */
/** the available base data types. */
enum BaseType {
bt_str, //!< text string in a @a StringDataField
bt_hexstr, //!< hex digit string in a @a StringDataField
@@ -73,7 +73,7 @@ static const unsigned int IGN = 0x40; //!< ignore value during read and write
static const unsigned int FIX = 0x80; //!< fixed width formatting
static const unsigned int REQ = 0x100;//!< value may not be NULL
/** @brief The structure for defining field types with their properties. */
/** The structure for defining field types with their properties. */
typedef struct {
const char* name; //!< field identifier
//todo rename to bitCount
@@ -87,7 +87,7 @@ typedef struct {
} dataType_t;
/**
* @brief Parse an unsigned int value.
* Parse an unsigned int value.
* @param str the string to parse.
* @param base the numerical base.
* @param minValue the minimum resulting value.
@@ -99,7 +99,7 @@ typedef struct {
unsigned int parseInt(const char* str, int base, const unsigned int minValue, const unsigned int maxValue, result_t& result, unsigned int* length=NULL);
/**
* @brief Print the error position of the iterator to stdout.
* Print the error position of the iterator to stdout.
* @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.
@@ -114,14 +114,14 @@ class DataFieldTemplates;
class SingleDataField;
/**
* @brief Base class for all kinds of data fields.
* Base class for all kinds of data fields.
*/
class DataField
{
public:
/**
* @brief Constructs a new instance.
* Constructs a new instance.
* @param name the field name.
* @param comment the field comment.
*/
@@ -129,12 +129,12 @@ public:
: m_name(name), m_comment(comment) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~DataField() {}
/**
* @brief Factory method for creating new instances.
* Factory method for creating new instances.
* @param it the iterator to traverse for the definition parts.
* @param end the iterator pointing to the end of the definition parts.
* @param templates the @a DataFieldTemplates to be referenced by name, or NULL.
@@ -149,14 +149,14 @@ public:
const bool isWriteMessage=false, const unsigned char dstAddress=SYN);
/**
* @brief Returns the length of this field (or contained fields) in bytes.
* 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.
* Derives a new DataField from this field.
* @param name the field name.
* @param comment the field comment, or empty to use this fields comment.
* @param unit the value unit, or empty to use this fields unit (if applicable).
@@ -172,25 +172,25 @@ public:
vector<SingleDataField*>& fields) = 0;
/**
* @brief Get the field name.
* Get the field name.
* @return the field name.
*/
string getName() const { return m_name; }
/**
* @brief Get the field comment.
* Get the field comment.
* @return the field comment.
*/
string getComment() const { return m_comment; }
/**
* @brief Dump the field settings to the output.
* 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.
* Reads the value from the @a SymbolString.
* @param partType the @a PartType of the data.
* @param data the unescaped data @a SymbolString for reading binary data.
* @param offset the additional offset to add for reading binary data.
@@ -211,7 +211,7 @@ public:
char separator=UI_FIELD_SEPARATOR) = 0;
/**
* @brief Writes the value to the master or slave @a SymbolString.
* Writes the value to the master or slave @a SymbolString.
* @param input the @a istringstream to parse the formatted value from.
* @param partType the @a PartType of the data.
* @param data the unescaped data @a SymbolString for writing binary data.
@@ -235,14 +235,14 @@ protected:
/**
* @brief A single @a DataField holding a value.
* A single @a DataField holding a value.
*/
class SingleDataField : public DataField
{
public:
/**
* @brief Constructs a new instance.
* Constructs a new instance.
* @param name the field name.
* @param comment the field comment.
* @param unit the value unit.
@@ -258,24 +258,24 @@ public:
m_length(length) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~SingleDataField() {}
/**
* @brief Get the value unit.
* Get the value unit.
* @return the value unit.
*/
string getUnit() const { return m_unit; }
/**
* @brief Get whether this field is ignored.
* 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.
* 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; }
@@ -285,7 +285,7 @@ public:
// 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.
* Get whether this field uses a full byte offset.
* @param after @p true to check after consuming the bits, false to check before.
* @return true if this field uses a full byte offset, false if this field
* only consumes a part of a byte and a subsequent field may re-use the same offset.
@@ -310,7 +310,7 @@ public:
protected:
/**
* @brief Internal method for reading the field from a @a SymbolString.
* Internal method for reading the field from a @a SymbolString.
* @param input the unescaped @a SymbolString to read the binary value from.
* @param offset the offset in the @a SymbolString.
* @param output the ostringstream to append the formatted value to.
@@ -319,7 +319,7 @@ protected:
virtual result_t readSymbols(SymbolString& input, const unsigned char offset, ostringstream& output) = 0;
/**
* @brief Internal method for writing the field to a @a SymbolString.
* Internal method for writing the field to a @a SymbolString.
* @param input the @a istringstream to parse the formatted value from.
* @param offset the offset in the @a SymbolString.
* @param output the unescaped @a SymbolString to write the binary value to.
@@ -345,14 +345,14 @@ protected:
/**
* @brief Base class for all string based data fields.
* Base class for all string based data fields.
*/
class StringDataField : public SingleDataField
{
public:
/**
* @brief Constructs a new instance.
* Constructs a new instance.
* @param name the field name.
* @param comment the field comment.
* @param unit the value unit.
@@ -366,7 +366,7 @@ public:
: SingleDataField(name, comment, unit, dataType, partType, length) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~StringDataField() {}
@@ -391,14 +391,14 @@ protected:
/**
* @brief Base class for all numeric data fields.
* Base class for all numeric data fields.
*/
class NumericDataField : public SingleDataField
{
public:
/**
* @brief Constructs a new instance.
* Constructs a new instance.
* @param name the field name.
* @param comment the field comment.
* @param unit the value unit.
@@ -415,7 +415,7 @@ public:
m_bitCount(bitCount), m_bitOffset(bitOffset) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~NumericDataField() {}
@@ -428,7 +428,7 @@ public:
protected:
/**
* @brief Internal method for reading the raw value from a @a SymbolString.
* Internal method for reading the raw value from a @a SymbolString.
* @param input the unescaped @a SymbolString to read the binary value from.
* @param offset the offset in the @a SymbolString.
* @param value the variable in which to store the raw value.
@@ -437,7 +437,7 @@ protected:
result_t readRawValue(SymbolString& input, const unsigned char offset, unsigned int& value);
/**
* @brief Internal method for writing the raw value to a @a SymbolString.
* Internal method for writing the raw value to a @a SymbolString.
* @param value the raw value to write.
* @param offset the offset in the @a SymbolString.
* @param output the unescaped @a SymbolString to write the binary value to.
@@ -455,14 +455,14 @@ protected:
/**
* @brief Base class for all numeric data fields with a number representation.
* Base class for all numeric data fields with a number representation.
*/
class NumberDataField : public NumericDataField
{
public:
/**
* @brief Constructs a new instance.
* Constructs a new instance.
* @param name the field name.
* @param comment the field comment.
* @param unit the value unit.
@@ -478,7 +478,7 @@ public:
const unsigned int divisor);
/**
* @brief Destructor.
* Destructor.
*/
virtual ~NumberDataField() {}
@@ -511,14 +511,14 @@ private:
/**
* @brief A numeric data field with a list of value=text assignments and a string representation.
* A numeric data field with a list of value=text assignments and a string representation.
*/
class ValueListDataField : public NumericDataField
{
public:
/**
* @brief Constructs a new instance.
* Constructs a new instance.
* @param name the field name.
* @param comment the field comment.
* @param unit the value unit.
@@ -537,7 +537,7 @@ public:
m_values(values) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~ValueListDataField() {}
@@ -567,20 +567,20 @@ private:
/**
* @brief A set of @a DataField instances.
* A set of @a DataField instances.
*/
class DataFieldSet : public DataField
{
public:
/**
* @brief Create the @a DataFieldSet for parsing the identification message (service 0x07 0x04).
* Create the @a DataFieldSet for parsing the identification message (service 0x07 0x04).
* @return the @a DataFieldSet for parsing the identification message.
*/
static DataFieldSet* createIdentFields();
/**
* @brief Constructs a new instance.
* Constructs a new instance.
* @param name the field name.
* @param comment the field comment.
* @param fields the @a vector of @a SingleDataField instances part of this set.
@@ -591,7 +591,7 @@ public:
m_fields(fields) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~DataFieldSet();
@@ -605,21 +605,21 @@ public:
vector<SingleDataField*>& fields);
/**
* @brief Returns the @a SingleDataField at the specified index.
* 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.
* 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.
* 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(); }
@@ -648,29 +648,29 @@ private:
/**
* @brief A map of template @a DataField instances.
* A map of template @a DataField instances.
*/
class DataFieldTemplates : public FileReader<void*>
{
public:
/**
* @brief Constructs a new instance.
* Constructs a new instance.
*/
DataFieldTemplates() : FileReader<void*>::FileReader(false) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~DataFieldTemplates() { clear(); }
/**
* @brief Removes all @a DataField instances.
* Removes all @a DataField instances.
*/
void clear();
/**
* @brief Adds a template @a DataField instance to this map.
* Adds a template @a DataField instance to this map.
* @param field 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.
@@ -682,7 +682,7 @@ public:
virtual result_t addFromFile(vector<string>::iterator& begin, const vector<string>::iterator end, void* arg, vector< vector<string> >* defaults, const string& filename, unsigned int lineNo);
/**
* @brief Gets the template @a DataField instance with the specified name.
* Gets the template @a DataField instance with the specified name.
* @param name the name of the template to get.
* @return the template @a DataField instance, or NULL.
* Note: the caller may not free the returned instance.
+7 -7
View File
@@ -33,17 +33,17 @@
using namespace std;
/** @brief the separator character used between fields. */
/** the separator character used between fields. */
#define FIELD_SEPARATOR ','
/** @brief the separator character used to quote text having the @a FIELD_SEPARATOR in it. */
/** the separator character used to quote text having the @a FIELD_SEPARATOR in it. */
#define TEXT_SEPARATOR '"'
extern void printErrorPos(vector<string>::iterator begin, const vector<string>::iterator end, vector<string>::iterator pos, string filename, size_t lineNo, result_t result);
/**
* @brief An abstract class that support reading definitions from a file.
* An abstract class that support reading definitions from a file.
*/
template<typename T>
class FileReader
@@ -51,18 +51,18 @@ class FileReader
public:
/**
* @brief Construct a new instance.
* Construct a new instance.
*/
FileReader(bool supportsDefaults)
: m_supportsDefaults(supportsDefaults) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~FileReader() {}
/**
* @brief Read the definitions from a file.
* Read the definitions from a file.
* @param filename the name of the file being read.
* @param arg an argument to pass to @a addFromFile().
* @param verbose whether to verbosely log problems.
@@ -155,7 +155,7 @@ public:
}
/**
* @brief Add a definition that was read from a file.
* Add a definition that was read from a file.
* @param begin an iterator to the first column of the definition row to read.
* @param end the end iterator of the definition row to read.
* @param arg the argument passed to @a readFromFile().
+1 -1
View File
@@ -70,7 +70,7 @@ Message::Message(const bool isWrite, const bool isPassive,
}
/**
* @brief Helper method for getting a default if the value is empty.
* Helper method for getting a default if the value is empty.
* @param value the value to check.
* @param defaults a @a vector of defaults, or NULL.
* @param pos the position in defaults.
+37 -37
View File
@@ -35,7 +35,7 @@ using namespace std;
class MessageMap;
/**
* @brief Defines parameters of a message sent or received on the bus.
* Defines parameters of a message sent or received on the bus.
*/
class Message
{
@@ -43,7 +43,7 @@ class Message
public:
/**
* @brief Construct a new instance.
* Construct a new instance.
* @param clazz the optional device class.
* @param name the message name (unique within the same class and type).
* @param isWrite whether this is a write message.
@@ -63,7 +63,7 @@ public:
const unsigned int pollPriority);
/**
* @brief Construct a new temporary instance.
* Construct a new temporary instance.
* @param isWrite whether this is a write message.
* @param isPassive true if message can only be initiated by a participant other than us,
* false if message can be initiated by any participant.
@@ -76,12 +76,12 @@ public:
DataField* data);
/**
* @brief Destructor.
* Destructor.
*/
virtual ~Message() { delete m_data; }
/**
* @brief Factory method for creating a new instance.
* Factory method for creating a new instance.
* @param it the iterator to traverse for the definition parts.
* @param end the iterator pointing to the end of the definition parts.
* @param defaultsRows a @a vector with rows containing defaults, or NULL.
@@ -95,68 +95,68 @@ public:
DataFieldTemplates* templates, Message*& returnValue);
/**
* @brief Get the optional device class.
* 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).
* 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 write message.
* Get whether this is a write message.
* @return whether this is a write message.
*/
bool isWrite() const { return m_isWrite; }
/**
* @brief Get whether message can be initiated only by a participant other than us.
* 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.
* Get the comment.
* @return the comment.
*/
string getComment() const { return m_comment; }
/**
* @brief Get the source address.
* 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.
* 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.
* Get the command ID bytes.
* @return the primary, secondary, and optionally further command ID bytes.
*/
vector<unsigned char> getId() const { return m_id; }
/**
* @brief Return the key for storing in @a MessageMap.
* Return the key for storing in @a MessageMap.
* @return the key for storing in @a MessageMap.
*/
unsigned long long getKey() { return m_key; }
/**
* @brief Get the polling priority, or 0 for no polling at all.
* Get the polling priority, or 0 for no polling at all.
* @return the polling priority, or 0 for no polling at all.
*/
unsigned char getPollPriority() const { return m_pollPriority; }
/**
* @brief Prepare the master @a SymbolString for sending a query or command to the bus.
* Prepare the master @a SymbolString for sending a query or command to the bus.
* @param srcAddress the source address to set.
* @param masterData the master data @a SymbolString for writing symbols to.
* @param input the @a istringstream to parse the formatted value(s) from.
@@ -169,14 +169,14 @@ public:
const unsigned char dstAddress=SYN);
/**
* @brief Prepare the slave @a SymbolString for sending an answer to the bus.
* Prepare the slave @a SymbolString for sending an answer to the bus.
* @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& slaveData);
/**
* @brief Decode a singular part of a received message.
* Decode a singular part of a received message.
* @param partType the @a PartType of the data.
* @param data the unescaped data @a SymbolString for reading binary data.
* @param output the @a ostringstream to append the formatted value to.
@@ -193,7 +193,7 @@ public:
char separator=UI_FIELD_SEPARATOR);
/**
* @brief Decode all parts of a received message.
* Decode all parts of a received message.
* @param masterData the unescaped master data @a SymbolString to decode.
* @param slaveData the unescaped slave data @a SymbolString to decode.
* @param output the @a ostringstream to append the formatted value to.
@@ -210,31 +210,31 @@ public:
char separator=UI_FIELD_SEPARATOR);
/**
* @brief Get the last decoded value.
* Get the last decoded value.
* @return the last decoded value, or the empty string if it was not successful.
*/
string getLastValue() { return m_lastValue; }
/**
* @brief Get the time when @a m_lastValue was last stored.
* Get the time when @a m_lastValue was last stored.
* @return the time when @a m_lastValue was last stored, or 0 if this message was not decoded yet.
*/
time_t getLastUpdateTime() { return m_lastUpdateTime; }
/**
* @brief Get the time when @a m_lastValue was last changed.
* Get the time when @a m_lastValue was last changed.
* @return the time when @a m_lastValue was last changed, or 0 if this message was not decoded yet.
*/
time_t getLastChangeTime() { return m_lastChangeTime; }
/**
* @brief Get the time when this message was last polled for.
* Get the time when this message was last polled for.
* @return the time when this message was last polled for, or 0 for never.
*/
time_t getLastPollTime() { return m_lastPollTime; }
/**
* @brief Return whether this @a Message needs to be polled after the other one.
* Return whether this @a Message needs to be polled after the other one.
* @param other the other @a Message to compare with.
* @return true if this @a Message needs to be polled after the other one.
*/
@@ -295,11 +295,11 @@ private:
/**
* @brief A function that compares the weighted poll priority of two @a Message instances.
* A function that compares the weighted poll priority of two @a Message instances.
*/
struct compareMessagePriority : binary_function <Message*,Message*,bool> {
/**
* @brief Compare the weighted poll priority of the two @a Message instances.
* Compare the weighted poll priority of the two @a Message instances.
* @param x the first @a Message.
* @param y the second @a Message.
* @return whether @a x is smaller than @a y with regard to their weighted poll priority.
@@ -309,25 +309,25 @@ struct compareMessagePriority : binary_function <Message*,Message*,bool> {
/**
* @brief Holds a map of all known @a Message instances.
* Holds a map of all known @a Message instances.
*/
class MessageMap : public FileReader<DataFieldTemplates*>
{
public:
/**
* @brief Construct a new instance.
* Construct a new instance.
*/
MessageMap() : FileReader<DataFieldTemplates*>::FileReader(true),
m_minIdLength(4), m_maxIdLength(0), m_messageCount(0), m_passiveMessageCount(0) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~MessageMap() { clear(); }
/**
* @brief Add a @a Message instance to this set.
* Add a @a Message instance to this set.
* @param message the @a Message instance to add.
* @return @a RESULT_OK on success, or an error code.
* Note: the caller may not free the added instance on success.
@@ -338,7 +338,7 @@ public:
virtual result_t addFromFile(vector<string>::iterator& begin, const vector<string>::iterator end, DataFieldTemplates* arg, vector< vector<string> >* defaults, const string& filename, unsigned int lineNo);
/**
* @brief Find the @a Message instance for the specified class and name.
* Find the @a Message instance for the specified class and name.
* @param clazz the optional device class.
* @param name the message name.
* @param isWrite whether this is a write message.
@@ -349,7 +349,7 @@ public:
Message* find(const string& clazz, const string& name, const bool isWrite, const bool isPassive=false);
/**
* @brief Find all active get @a Message instances for the specified class and name.
* Find all active get @a Message instances for the specified class and name.
* @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 (default any).
@@ -364,7 +364,7 @@ public:
const bool withRead=true, const bool withWrite=false, const bool withPassive=false);
/**
* @brief Find the @a Message instance for the specified master data.
* Find the @a Message instance for the specified master data.
* @param master the master @a SymbolString for identifying the @a Message.
* @return the @a Message instance, or NULL.
* Note: the caller may not free the returned instance.
@@ -372,25 +372,25 @@ public:
Message* find(SymbolString& master);
/**
* @brief Removes all @a Message instances.
* Removes all @a Message instances.
*/
void clear();
/**
* @brief Get the number of stored @a Message instances.
* 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.
*/
size_t size(const bool passiveOnly=false) { return passiveOnly ? m_passiveMessageCount : m_messageCount; }
/**
* @brief Get the number of stored @a Message instances with a poll priority.
* 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.
*/
size_t sizePoll() { return m_pollMessages.size(); }
/**
* @brief Get the next @a Message to poll.
* Get the next @a Message to poll.
* @return the next @a Message to poll, or NULL.
* Note: the caller may not free the returned instance.
*/
+30 -30
View File
@@ -32,7 +32,7 @@
using namespace std;
/** @brief available device types. */
/** available device types. */
enum DeviceType {
dt_serial, /*!< serial device */
dt_network /*!< network device */
@@ -40,24 +40,24 @@ enum DeviceType {
/**
* @brief base class for input devices.
* base class for input devices.
*/
class Device
{
public:
/**
* @brief constructs a new instance.
* constructs a new instance.
*/
Device() : m_fd(-1), m_open(false), m_noDeviceCheck(false) {}
/**
* @brief destructor.
* destructor.
*/
virtual ~Device() {}
/**
* @brief virtual open function for opening file descriptor
* virtual open function for opening file descriptor
* @param deviceName to determine device type.
* @param noDeviceCheck en-/disable device check.
* @return the @a result_t code.
@@ -65,25 +65,25 @@ public:
virtual result_t openDevice(const string deviceName, const bool noDeviceCheck) = 0;
/**
* @brief virtual close function for closing opened file descriptor
* virtual close function for closing opened file descriptor
*/
virtual void closeDevice() = 0;
/**
* @brief connection state of device.
* connection state of device.
* @return true if device is open
*/
bool isOpen();
/**
* @brief Write a single byte to opened file descriptor.
* Write a single byte to opened file descriptor.
* @param value the value to send.
* @return the result_t code.
*/
result_t send(const unsigned char value);
/**
* @brief Read a single byte from opened file descriptor.
* Read a single byte from opened file descriptor.
* @param timeout max time out for new input data [usec], or 0 for infinite.
* @param value the reference in which the value is stored.
* @return the result_t code.
@@ -102,7 +102,7 @@ protected:
private:
/**
* @brief system check if opened file descriptor is valid
* system check if opened file descriptor is valid
* @return true if file descriptor is valid
*/
bool isValid();
@@ -110,14 +110,14 @@ private:
};
/**
* @brief class for serial input device.
* class for serial input device.
*/
class DeviceSerial : public Device
{
public:
/**
* @brief destructor.
* destructor.
*/
~DeviceSerial() { closeDevice(); }
@@ -134,14 +134,14 @@ private:
};
/**
* @brief class for network input device.
* class for network input device.
*/
class DeviceNetwork : public Device
{
public:
/**
* @brief destructor.
* destructor.
*/
~DeviceNetwork() { closeDevice(); }
@@ -156,14 +156,14 @@ private:
};
/**
* @brief wrapper class for class device.
* wrapper class for class device.
*/
class Port
{
public:
/**
* @brief constructs a new instance and determine device type.
* constructs a new instance and determine device type.
* @param deviceName to determine device type.
* @param noDeviceCheck en-/disable device check.
* @param logRaw whether logging of raw data is enabled.
@@ -177,35 +177,35 @@ public:
const bool dumpRaw, const char* dumpRawFile, const long dumpRawMaxSize);
/**
* @brief destructor.
* destructor.
*/
~Port() { delete m_device; m_dumpRawStream.close(); }
/**
* @brief open device
* open device
*/
result_t open() { return m_device->openDevice(m_deviceName, m_noDeviceCheck); }
/**
* @brief close device
* close device
*/
void close() { m_device->closeDevice(); }
/**
* @brief connection state of device.
* connection state of device.
* @return true if device is open
*/
bool isOpen() { return m_device->isOpen(); }
/**
* @brief Write a single byte to opened file descriptor.
* Write a single byte to opened file descriptor.
* @param value the value to send.
* @return the result_t code.
*/
result_t send(const unsigned char value);
/**
* @brief Read a single byte from opened file descriptor.
* Read a single byte from opened file descriptor.
* @param timeout max time out for new input data [usec], or 0 for infinite.
* @param value the reference in which the value is stored.
* @return the result_t code.
@@ -213,43 +213,43 @@ public:
result_t recv(const long timeout, unsigned char& value);
/**
* @brief Get whether logging of raw data is enabled.
* Get whether logging of raw data is enabled.
* @return whether logging of raw data is enabled.
*/
bool getLogRaw() { return m_logRaw; }
/**
* @brief Enable or disable logging of raw data.
* Enable or disable logging of raw data.
* @param logRaw true to enable logging of raw data, false to disable it.
*/
void setLogRaw(bool logRaw=true) { m_logRaw = logRaw; }
/**
* @brief Get whether dumping of raw data to a file is enabled.
* Get whether dumping of raw data to a file is enabled.
* @return whether dumping of raw data to a file is enabled.
*/
bool getDumpRaw() { return m_dumpRaw; }
/**
* @brief Enable or disable dumping of raw data to a file.
* Enable or disable dumping of raw data to a file.
* @param dumpRaw true to enable dumping of raw data to a file, false to disable it.
*/
void setDumpRaw(bool dumpRaw=true);
/**
* @brief Set the name of the file to dump raw data to.
* Set the name of the file to dump raw data to.
* @param dumpFile the name of the file to dump raw data to.
*/
void setDumpRawFile(const string& dumpFile);
/**
* @brief Set the maximum size of a file to dump raw data to.
* Set the maximum size of a file to dump raw data to.
* @param maxSize the maximum size of a file to dump raw data to.
*/
void setDumpRawMaxSize(const long maxSize) { m_dumpRawMaxSize = maxSize; }
/**
* @brief Return the device name.
* Return the device name.
* @return the device name.
*/
const char* getDeviceName() { return m_deviceName.c_str(); }
@@ -286,7 +286,7 @@ private:
long m_dumpRawFileSize;
/**
* @brief internal setter for device type.
* internal setter for device type.
* @param type of device
*/
void setType(const DeviceType type);
+1 -1
View File
@@ -57,7 +57,7 @@ static const int RESULT_ERR_NO_SIGNAL = -21; //!< no signal found on the bus
typedef int result_t;
/**
* @brief Return the string corresponding to the result code.
* Return the string corresponding to the result code.
* @param resultCode the result code (see RESULT_ constants).
* @return the string corresponding to the result code.
*/
+1 -1
View File
@@ -25,7 +25,7 @@
using namespace std;
/**
* @brief CRC8 lookup table for the polynom 0x9b = x^8 + x^7 + x^4 + x^3 + x^1 + 1.
* CRC8 lookup table for the polynom 0x9b = x^8 + x^7 + x^4 + x^3 + x^1 + 1.
*/
static const unsigned char CRC_LOOKUP_TABLE[] =
{
+21 -21
View File
@@ -38,25 +38,25 @@ static const unsigned char BROADCAST = 0xFE; //!< the broadcast destination addr
/**
* @brief A string of escaped or unescaped bus symbols.
* A string of escaped or unescaped bus symbols.
*/
class SymbolString
{
public:
/**
* @brief Creates a new unescaped empty instance.
* 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.
* 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.
* Creates a new escaped or unescaped instance from another @a SymbolString and adds the calculated CRC.
* @param str the @a SymbolString top copy from.
* @param escape true for an escaped instance, false for an unescaped instance.
* @param addCrc whether to add the calculated CRC as last symbol.
@@ -64,35 +64,35 @@ public:
SymbolString(const SymbolString& str, const bool escape, const bool addCrc=true);
/**
* @brief Creates a new unescaped instance from a hex string.
* 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.
* 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.
* 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.
* 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.
* Returns whether this instance is equal to the other instance.
* @param other the other instance.
* @return true if this instance is equal to the other instance (i.e. both escaped or both unescaped and same symbols).
*/
@@ -112,7 +112,7 @@ public:
}
/**
* @brief Appends a the symbol to the end of the symbol string and escapes/unescapes it if necessary.
* Appends a the symbol to the end of the symbol string and escapes/unescapes it if necessary.
* @param value the symbol to append.
* @param isEscaped whether the symbol is escaped.
* @param updateCRC whether to update the calculated CRC in @a m_crc.
@@ -123,72 +123,72 @@ public:
result_t push_back(const unsigned char value, const bool isEscaped=true, const bool updateCRC=true);
/**
* @brief Returns the number of symbols in this symbol string.
* Returns the number of symbols in this symbol string.
* @return the number of available symbols.
*/
unsigned char size() const { return (unsigned char)m_data.size(); }
/**
* @brief Returns the calculated CRC.
* Returns the calculated CRC.
* @return the calculated CRC.
*/
unsigned char getCRC() const { return m_crc; }
/**
* @brief Clears the symbols.
* Clears the symbols.
*/
void clear() { m_data.clear(); m_unescapeState = m_unescapeState==0 ? 0 : 1; m_crc = 0; }
private:
/**
* @brief Hidden copy constructor.
* Hidden copy constructor.
* @param str the @a SymbolString to copy from.
*/
SymbolString(const SymbolString& str)
: m_data(str.m_data), m_unescapeState(str.m_unescapeState), m_crc(str.m_crc) {}
/**
* @brief Updates the calculated CRC in @a m_crc by adding a value.
* Updates the calculated CRC in @a m_crc by adding a value.
* @param value the (escaped) value to add to the calculated CRC in @a m_crc.
*/
void addCRC(const unsigned char value);
/**
* @brief the string of bus symbols.
* the string of bus symbols.
*/
vector<unsigned char> m_data;
/**
* @brief 0 if the symbols in @a m_data are escaped,
* 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.
* the calculated CRC.
*/
unsigned char m_crc;
};
/**
* @brief Returns whether the address is one of the 25 master addresses.
* Returns whether the address is one of the 25 master addresses.
* @param addr the address to check.
* @return <code>true</code> if the specified address is a master address.
*/
bool isMaster(unsigned char addr);
/**
* @brief Returns the number of the master if the address is a valid bus address.
* Returns the number of the master if the address is a valid bus address.
* @param addr the bus address.
* @return the number of the master if the address is a valid bus address (1 to 25), or 0.
*/
unsigned char getMasterNumber(unsigned char addr);
/**
* @brief Returns whether the address is a valid bus address.
* Returns whether the address is a valid bus address.
* @param addr the address to check.
* @param allowBroadcast whether to also allow @a addr to be the broadcast address (default true).
* @return <code>true</code> if the specified address is a valid bus address.