renamed class in message definition and commands to circuit

This commit is contained in:
john30
2015-03-14 11:02:24 +01:00
parent 4d6ae8d926
commit 33c8776706
4 changed files with 80 additions and 80 deletions
+9 -9
View File
@@ -74,9 +74,9 @@ bool PollRequest::notify(result_t result, SymbolString& slave)
result = m_message->decode(pt_slaveData, slave, output); // decode data result = m_message->decode(pt_slaveData, slave, output); // decode data
} }
if (result < RESULT_OK) if (result < RESULT_OK)
logError(lf_bus, "poll %s %s failed: %s", m_message->getClass().c_str(), m_message->getName().c_str(), getResultCode(result)); logError(lf_bus, "poll %s %s failed: %s", m_message->getCircuit().c_str(), m_message->getName().c_str(), getResultCode(result));
else else
logNotice(lf_bus, "poll %s %s: %s", m_message->getClass().c_str(), m_message->getName().c_str(), output.str().c_str()); logNotice(lf_bus, "poll %s %s: %s", m_message->getCircuit().c_str(), m_message->getName().c_str(), output.str().c_str());
return false; return false;
} }
@@ -735,27 +735,27 @@ void BusHandler::receiveCompleted()
logNotice(lf_update, "unknown MS cmd: %s / %s", m_command.getDataStr().c_str(), m_response.getDataStr().c_str()); logNotice(lf_update, "unknown MS cmd: %s / %s", m_command.getDataStr().c_str(), m_response.getDataStr().c_str());
} }
else { else {
string clazz = message->getClass(); string circuit = message->getCircuit();
string name = message->getName(); string name = message->getName();
ostringstream output; ostringstream output;
result_t result = message->decode(m_command, m_response, output); result_t result = message->decode(m_command, m_response, output);
if (result < RESULT_OK) if (result < RESULT_OK)
logError(lf_update, "unable to parse %s %s from %s / %s: %s", clazz.c_str(), name.c_str(), m_command.getDataStr().c_str(), m_response.getDataStr().c_str(), getResultCode(result)); logError(lf_update, "unable to parse %s %s from %s / %s: %s", circuit.c_str(), name.c_str(), m_command.getDataStr().c_str(), m_response.getDataStr().c_str(), getResultCode(result));
else { else {
string data = output.str(); string data = output.str();
if (m_answer && dstAddress == (master ? m_ownMasterAddress : m_ownSlaveAddress)) { if (m_answer && dstAddress == (master ? m_ownMasterAddress : m_ownSlaveAddress)) {
logNotice(lf_update, "self-update %s %s QQ=%2.2x: %s", clazz.c_str(), name.c_str(), srcAddress, data.c_str()); // TODO store in database of internal variables logNotice(lf_update, "self-update %s %s QQ=%2.2x: %s", circuit.c_str(), name.c_str(), srcAddress, data.c_str()); // TODO store in database of internal variables
} }
else if (message->getDstAddress() == SYN) { // any destination else if (message->getDstAddress() == SYN) { // any destination
if (message->getSrcAddress() == SYN) // any destination and any source if (message->getSrcAddress() == SYN) // any destination and any source
logNotice(lf_update, "update %s %s QQ=%2.2x ZZ=%2.2x: %s", clazz.c_str(), name.c_str(), srcAddress, dstAddress, data.c_str()); logNotice(lf_update, "update %s %s QQ=%2.2x ZZ=%2.2x: %s", circuit.c_str(), name.c_str(), srcAddress, dstAddress, data.c_str());
else else
logNotice(lf_update, "update %s %s ZZ=%2.2x: %s", clazz.c_str(), name.c_str(), dstAddress, data.c_str()); logNotice(lf_update, "update %s %s ZZ=%2.2x: %s", circuit.c_str(), name.c_str(), dstAddress, data.c_str());
} }
else if (message->getSrcAddress() == SYN) // any source else if (message->getSrcAddress() == SYN) // any source
logNotice(lf_update, "update %s %s QQ=%2.2x: %s", clazz.c_str(), name.c_str(), srcAddress, data.c_str()); logNotice(lf_update, "update %s %s QQ=%2.2x: %s", circuit.c_str(), name.c_str(), srcAddress, data.c_str());
else else
logNotice(lf_update, "update %s %s: %s", clazz.c_str(), name.c_str(), data.c_str()); logNotice(lf_update, "update %s %s: %s", circuit.c_str(), name.c_str(), data.c_str());
} }
} }
} }
+27 -27
View File
@@ -192,7 +192,7 @@ string MainLoop::executeRead(vector<string> &args)
size_t argPos = 1; size_t argPos = 1;
time_t maxAge = 5*60; time_t maxAge = 5*60;
bool verbose = false; bool verbose = false;
string clazz; string circuit;
unsigned char dstAddress = SYN; unsigned char dstAddress = SYN;
while (args.size() > argPos && args[argPos][0] == '-') { while (args.size() > argPos && args[argPos][0] == '-') {
if (args[argPos] == "-f") { if (args[argPos] == "-f") {
@@ -222,7 +222,7 @@ string MainLoop::executeRead(vector<string> &args)
argPos = 0; // print usage argPos = 0; // print usage
break; break;
} }
clazz = args[argPos]; circuit = args[argPos];
} }
else if (args[argPos] == "-d") { else if (args[argPos] == "-d") {
argPos++; argPos++;
@@ -241,13 +241,13 @@ string MainLoop::executeRead(vector<string> &args)
argPos++; argPos++;
} }
if (argPos == 0 || args.size() < argPos + 1 || args.size() > argPos + 2) if (argPos == 0 || args.size() < argPos + 1 || args.size() > argPos + 2)
return "usage: read [-v] [-f] [-m SECONDS] [-d ZZ] [-c CLASS] NAME [FIELD[.N]]\n" return "usage: read [-v] [-f] [-m SECONDS] [-d ZZ] [-c CIRCUIT] NAME [FIELD[.N]]\n"
" Read value(s).\n" " Read value(s).\n"
" -v be verbose (include field names, units, and comments)\n" " -v be verbose (include field names, units, and comments)\n"
" -f force reading from the bus (same as '-m 0')\n" " -f force reading from the bus (same as '-m 0')\n"
" -m SECONDS only return cached value if age is less than SECONDS [300]\n" " -m SECONDS only return cached value if age is less than SECONDS [300]\n"
" -d ZZ override destination address ZZ\n" " -d ZZ override destination address ZZ\n"
" -c CLASS limit to messages of CLASS\n" " -c CIRCUIT limit to messages of CIRCUIT\n"
" NAME the NAME of the message to send\n" " NAME the NAME of the message to send\n"
" FIELD only retrieve the field named FIELD\n" " FIELD only retrieve the field named FIELD\n"
" N only retrieve the N'th field named FIELD (0-based)"; " N only retrieve the N'th field named FIELD (0-based)";
@@ -270,10 +270,10 @@ string MainLoop::executeRead(vector<string> &args)
time(&now); time(&now);
ostringstream result; ostringstream result;
Message* message = m_messages->find(clazz, args[argPos], false); Message* message = m_messages->find(circuit, args[argPos], false);
if (dstAddress==SYN && maxAge > 0) { if (dstAddress==SYN && maxAge > 0) {
Message* cacheMessage = m_messages->find(clazz, args[argPos], false, true); Message* cacheMessage = m_messages->find(circuit, args[argPos], false, true);
bool hasCache = cacheMessage != NULL; bool hasCache = cacheMessage != NULL;
if (!hasCache || (message != NULL && message->getLastUpdateTime() > cacheMessage->getLastUpdateTime())) if (!hasCache || (message != NULL && message->getLastUpdateTime() > cacheMessage->getLastUpdateTime()))
cacheMessage = message; // message is newer/better cacheMessage = message; // message is newer/better
@@ -374,10 +374,10 @@ string MainLoop::executeWrite(vector<string> &args)
argPos++; argPos++;
} }
if (argPos == 0 || (args.size() != argPos + 3 && args.size() != argPos + 2)) if (argPos == 0 || (args.size() != argPos + 3 && args.size() != argPos + 2))
return "usage: write [-c] CLASS NAME [VALUE[;VALUE]*]\n" return "usage: write [-c] CIRCUIT NAME [VALUE[;VALUE]*]\n"
" or: write -h ZZPBSBNNDx\n" " or: write -h ZZPBSBNNDx\n"
" Write value(s) or hex message.\n" " Write value(s) or hex message.\n"
" CLASS the CLASS of the message to send\n" " CIRCUIT the CIRCUIT of the message to send\n"
" NAME the NAME of the message to send\n" " NAME the NAME of the message to send\n"
" VALUE a single field VALUE\n" " VALUE a single field VALUE\n"
" -h directly write hex message:\n" " -h directly write hex message:\n"
@@ -424,7 +424,7 @@ string MainLoop::executeFind(vector<string> &args)
{ {
size_t argPos = 1; size_t argPos = 1;
bool verbose = false, configFormat = false, withRead = true, withWrite = false, withPassive = true, first = true, onlyWithData = false; bool verbose = false, configFormat = false, withRead = true, withWrite = false, withPassive = true, first = true, onlyWithData = false;
string clazz; string circuit;
short pb = -1; short pb = -1;
while (args.size() > argPos && args[argPos][0] == '-') { while (args.size() > argPos && args[argPos][0] == '-') {
if (args[argPos] == "-v") if (args[argPos] == "-v")
@@ -476,7 +476,7 @@ string MainLoop::executeFind(vector<string> &args)
argPos = 0; // print usage argPos = 0; // print usage
break; break;
} }
clazz = args[argPos]; circuit = args[argPos];
} }
else { else {
argPos = 0; // print usage argPos = 0; // print usage
@@ -485,23 +485,23 @@ string MainLoop::executeFind(vector<string> &args)
argPos++; argPos++;
} }
if (argPos == 0 || args.size() < argPos || args.size() > argPos + 1) if (argPos == 0 || args.size() < argPos || args.size() > argPos + 1)
return "usage: find [-v] [-r] [-w] [-p] [-d] [-i PB] [-f] [-c CLASS] [NAME]\n" return "usage: find [-v] [-r] [-w] [-p] [-d] [-i PB] [-f] [-c CIRCUIT] [NAME]\n"
" Find message(s).\n" " Find message(s).\n"
" -v be verbose (append destination address and update time)\n" " -v be verbose (append destination address and update time)\n"
" -r limit to active read messages (default: read + passive)\n" " -r limit to active read messages (default: read + passive)\n"
" -w limit to active write messages (default: read + passive)\n" " -w limit to active write messages (default: read + passive)\n"
" -p limit to passive messages (default: read + passive)\n" " -p limit to passive messages (default: read + passive)\n"
" -d only include messages with actual data\n" " -d only include messages with actual data\n"
" -i PB limit to messages with primary command byte PB ('0xPB' for hex)\n" " -i PB limit to messages with primary command byte PB ('0xPB' for hex)\n"
" -f list messages in CSV configuration file format\n" " -f list messages in CSV configuration file format\n"
" -c CLASS limit to messages of CLASS (or a part thereof)\n" " -c CIRCUIT limit to messages of CIRCUIT (or a part thereof)\n"
" NAME the NAME of the message to find (or a part thereof)"; " NAME the NAME of the messages to find (or a part thereof)";
deque<Message*> messages; deque<Message*> messages;
if (args.size() == argPos) if (args.size() == argPos)
messages = m_messages->findAll(clazz, "", pb, false, withRead, withWrite, withPassive); messages = m_messages->findAll(circuit, "", pb, false, withRead, withWrite, withPassive);
else else
messages = m_messages->findAll(clazz, args[argPos], pb, false, withRead, withWrite, withPassive); messages = m_messages->findAll(circuit, args[argPos], pb, false, withRead, withWrite, withPassive);
bool found = false; bool found = false;
ostringstream result; ostringstream result;
@@ -521,7 +521,7 @@ string MainLoop::executeFind(vector<string> &args)
continue; continue;
if (found) if (found)
result << endl; result << endl;
result << message->getClass() << " " << message->getName() << " = "; result << message->getCircuit() << " " << message->getName() << " = ";
if (lastup == 0) if (lastup == 0)
result << "no data stored"; result << "no data stored";
else else
@@ -699,10 +699,10 @@ string MainLoop::executeQuit(vector<string> &args, bool& connected)
string MainLoop::executeHelp() string MainLoop::executeHelp()
{ {
return "usage:\n" return "usage:\n"
" read|r Read value(s): read [-v] [-f] [-m SECONDS] [-d ZZ] [-c CLASS] NAME [FIELD[.N]]\n" " read|r Read value(s): read [-v] [-f] [-m SECONDS] [-d ZZ] [-c CIRCUIT] NAME [FIELD[.N]]\n"
" write|w Write value(s): write [-c] CLASS NAME [VALUE[;VALUE]*]\n" " write|w Write value(s): write [-c] CIRCUIT NAME [VALUE[;VALUE]*]\n"
" Write hex message: write -h ZZPBSBNNDx'\n" " Write hex message: write -h ZZPBSBNNDx'\n"
" find|f Find message(s): find [-v] [-r] [-w] [-p] [-d] [-i PB] [-f] [-c CLASS] [NAME]\n" " find|f Find message(s): find [-v] [-r] [-w] [-p] [-d] [-i PB] [-f] [-c CIRCUIT] [NAME]\n"
" listen|l Listen for updates: listen [stop]\n" " listen|l Listen for updates: listen [stop]\n"
" state|s Report bus state\n" " state|s Report bus state\n"
" scan Scan slaves: scan [full]\n" " scan Scan slaves: scan [full]\n"
@@ -734,7 +734,7 @@ string MainLoop::getUpdates(time_t since, time_t until)
time_t lastchg = message->getLastChangeTime(); time_t lastchg = message->getLastChangeTime();
if (lastchg < since || lastchg >= until) if (lastchg < since || lastchg >= until)
continue; continue;
result << message->getClass() << " " << message->getName() << " = "; result << message->getCircuit() << " " << message->getName() << " = ";
message->decodeLastData(result); message->decodeLastData(result);
result << endl; result << endl;
} }
+25 -25
View File
@@ -33,12 +33,12 @@ using namespace std;
/** the bit mask of the source master number in the message key. */ /** the bit mask of the source master number in the message key. */
#define ID_SOURCE_MASK (0x1fLL << (8 * 7)) #define ID_SOURCE_MASK (0x1fLL << (8 * 7))
Message::Message(const string clazz, const string name, const bool isWrite, Message::Message(const string circuit, const string name, const bool isWrite,
const bool isPassive, const string comment, const bool isPassive, const string comment,
const unsigned char srcAddress, const unsigned char dstAddress, const unsigned char srcAddress, const unsigned char dstAddress,
const vector<unsigned char> id, DataField* data, const bool deleteData, const vector<unsigned char> id, DataField* data, const bool deleteData,
const unsigned char pollPriority) const unsigned char pollPriority)
: m_class(clazz), m_name(name), m_isWrite(isWrite), : m_circuit(circuit), m_name(name), m_isWrite(isWrite),
m_isPassive(isPassive), m_comment(comment), m_isPassive(isPassive), m_comment(comment),
m_srcAddress(srcAddress), m_dstAddress(dstAddress), m_srcAddress(srcAddress), m_dstAddress(dstAddress),
m_id(id), m_data(data), m_deleteData(deleteData), m_id(id), m_data(data), m_deleteData(deleteData),
@@ -60,7 +60,7 @@ Message::Message(const string clazz, const string name, const bool isWrite,
Message::Message(const bool isWrite, const bool isPassive, Message::Message(const bool isWrite, const bool isPassive,
const unsigned char pb, const unsigned char sb, const unsigned char pb, const unsigned char sb,
DataField* data) DataField* data)
: m_class(), m_name(), m_isWrite(isWrite), : m_circuit(), m_name(), m_isWrite(isWrite),
m_isPassive(isPassive), m_comment(), m_isPassive(isPassive), m_comment(),
m_srcAddress(SYN), m_dstAddress(SYN), m_srcAddress(SYN), m_dstAddress(SYN),
m_data(data), m_deleteData(true), m_pollPriority(0), m_data(data), m_deleteData(true), m_pollPriority(0),
@@ -91,7 +91,7 @@ result_t Message::create(vector<string>::iterator& it, const vector<string>::ite
vector< vector<string> >* defaultsRows, vector< vector<string> >* defaultsRows,
DataFieldTemplates* templates, vector<Message*>& messages) DataFieldTemplates* templates, vector<Message*>& messages)
{ {
// [type],[class],name,[comment],[QQ],[ZZ],id,fields... // [type],[circuit],name,[comment],[QQ[;QQ]*],[ZZ],id,fields...
result_t result; result_t result;
bool isWrite = false, isPassive = false; bool isWrite = false, isPassive = false;
string defaultName; string defaultName;
@@ -136,7 +136,7 @@ result_t Message::create(vector<string>::iterator& it, const vector<string>::ite
} }
} }
string clazz = getDefault(*it++, defaults, defaultPos++); string circuit = getDefault(*it++, defaults, defaultPos++);
if (it == end) if (it == end)
return RESULT_ERR_EOF; return RESULT_ERR_EOF;
@@ -271,12 +271,12 @@ result_t Message::create(vector<string>::iterator& it, const vector<string>::ite
char num[10]; char num[10];
for (vector<unsigned char>::iterator it = dstAddresses.begin(); it != dstAddresses.end(); it++, index++) { for (vector<unsigned char>::iterator it = dstAddresses.begin(); it != dstAddresses.end(); it++, index++) {
unsigned char dstAddress = *it; unsigned char dstAddress = *it;
string useClass = clazz; string useCircuit = circuit;
if (multiple) { if (multiple) {
sprintf(num, ".%d", index); sprintf(num, ".%d", index);
useClass = useClass + num; useCircuit = useCircuit + num;
} }
messages.push_back(new Message(useClass, name, isWrite, isPassive, comment, srcAddress, dstAddress, id, data, index==0, pollPriority)); messages.push_back(new Message(useCircuit, name, isWrite, isPassive, comment, srcAddress, dstAddress, id, data, index==0, pollPriority));
} }
return RESULT_OK; return RESULT_OK;
} }
@@ -461,7 +461,7 @@ void Message::dump(ostream& output)
if (m_pollPriority>0) if (m_pollPriority>0)
output << static_cast<unsigned>(m_pollPriority); output << static_cast<unsigned>(m_pollPriority);
} }
DataField::dumpString(output, m_class); DataField::dumpString(output, m_circuit);
DataField::dumpString(output, m_name); DataField::dumpString(output, m_name);
DataField::dumpString(output, m_comment); DataField::dumpString(output, m_comment);
output << FIELD_SEPARATOR; output << FIELD_SEPARATOR;
@@ -500,9 +500,9 @@ result_t MessageMap::add(Message* message)
} }
bool isPassive = message->isPassive(); bool isPassive = message->isPassive();
bool isWrite = message->isWrite(); bool isWrite = message->isWrite();
string clazz = strtolower(message->getClass()); string circuit = strtolower(message->getCircuit());
string name = strtolower(message->getName()); string name = strtolower(message->getName());
string nameKey = string(isPassive ? "P" : (isWrite ? "W" : "R")) + clazz + FIELD_SEPARATOR + name; string nameKey = string(isPassive ? "P" : (isWrite ? "W" : "R")) + circuit + FIELD_SEPARATOR + name;
map<string, Message*>::iterator nameIt = m_messagesByName.find(nameKey); map<string, Message*>::iterator nameIt = m_messagesByName.find(nameKey);
if (nameIt != m_messagesByName.end()) { if (nameIt != m_messagesByName.end()) {
return RESULT_ERR_DUPLICATE; // duplicate key return RESULT_ERR_DUPLICATE; // duplicate key
@@ -513,10 +513,10 @@ result_t MessageMap::add(Message* message)
if (isPassive) if (isPassive)
m_passiveMessageCount++; m_passiveMessageCount++;
nameKey = string(isPassive ? "-P" : (isWrite ? "-W" : "-R")) + name; // also store without class nameKey = string(isPassive ? "-P" : (isWrite ? "-W" : "-R")) + name; // also store without circuit
nameIt = m_messagesByName.find(nameKey); nameIt = m_messagesByName.find(nameKey);
if (nameIt == m_messagesByName.end()) { if (nameIt == m_messagesByName.end()) {
m_messagesByName[nameKey] = message; // only store first key without class m_messagesByName[nameKey] = message; // only store first key without circuit
} }
unsigned char idLength = (unsigned char)(message->getId().size() - 2); unsigned char idLength = (unsigned char)(message->getId().size() - 2);
@@ -564,18 +564,18 @@ result_t MessageMap::addFromFile(vector<string>::iterator& begin, const vector<s
return result; return result;
} }
Message* MessageMap::find(const string& clazz, const string& name, const bool isWrite, const bool isPassive) Message* MessageMap::find(const string& circuit, const string& name, const bool isWrite, const bool isPassive)
{ {
string lclass = strtolower(clazz); string lcircuit = strtolower(circuit);
string lname = strtolower(name); string lname = strtolower(name);
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
string key; string key;
if (i == 0) if (i == 0)
key = string(isPassive ? "P" : (isWrite ? "W" : "R")) + lclass + FIELD_SEPARATOR + lname; key = string(isPassive ? "P" : (isWrite ? "W" : "R")) + lcircuit + FIELD_SEPARATOR + lname;
else if (clazz.length() == 0) else if (lcircuit.length() == 0)
key = string(isPassive ? "-P" : (isWrite ? "-W" : "-R")) + lname; // second try: without class key = string(isPassive ? "-P" : (isWrite ? "-W" : "-R")) + lname; // second try: without circuit
else else
continue; // not allowed without class continue; // not allowed without circuit
map<string, Message*>::iterator it = m_messagesByName.find(key); map<string, Message*>::iterator it = m_messagesByName.find(key);
if (it != m_messagesByName.end()) if (it != m_messagesByName.end())
return it->second; return it->second;
@@ -584,23 +584,23 @@ Message* MessageMap::find(const string& clazz, const string& name, const bool is
return NULL; return NULL;
} }
deque<Message*> MessageMap::findAll(const string& clazz, const string& name, const short pb, const bool completeMatch, deque<Message*> MessageMap::findAll(const string& circuit, const string& name, const short pb, const bool completeMatch,
const bool withRead, const bool withWrite, const bool withPassive) const bool withRead, const bool withWrite, const bool withPassive)
{ {
deque<Message*> ret; deque<Message*> ret;
string lclass = strtolower(clazz); string lcircuit = strtolower(circuit);
string lname = strtolower(name); string lname = strtolower(name);
bool checkClass = clazz.length() > 0; bool checkCircuit = lcircuit.length() > 0;
bool checkName = name.length() > 0; bool checkName = name.length() > 0;
bool checkPb = pb >= 0; bool checkPb = pb >= 0;
for (map<string, Message*>::iterator it = m_messagesByName.begin(); it != m_messagesByName.end(); it++) { for (map<string, Message*>::iterator it = m_messagesByName.begin(); it != m_messagesByName.end(); it++) {
if (it->first[0] == '-') // avoid duplicates: instances stored multiple times have a key starting with "-" if (it->first[0] == '-') // avoid duplicates: instances stored multiple times have a key starting with "-"
continue; continue;
Message* message = it->second; Message* message = it->second;
if (checkClass) { if (checkCircuit) {
string check = strtolower(message->getClass()); string check = strtolower(message->getCircuit());
if (completeMatch ? (check != lclass) : (check.find(lclass) == check.npos)) if (completeMatch ? (check != lcircuit) : (check.find(lcircuit) == check.npos))
continue; continue;
} }
if (checkName) { if (checkName) {
+19 -19
View File
@@ -44,8 +44,8 @@ public:
/** /**
* Construct a new instance. * Construct a new instance.
* @param clazz the optional device class. * @param circuit the optional circuit name.
* @param name the message name (unique within the same class and type). * @param name the message name (unique within the same circuit and type).
* @param isWrite whether this is a write message. * @param isWrite whether this is a write message.
* @param isPassive true if message can only be initiated by a participant other than us, * @param isPassive true if message can only be initiated by a participant other than us,
* false if message can be initiated by any participant. * false if message can be initiated by any participant.
@@ -57,7 +57,7 @@ public:
* @param deleteData whether to delete the @a DataField during destruction. * @param deleteData whether to delete the @a DataField during destruction.
* @param pollPriority the priority for polling, or 0 for no polling at all. * @param pollPriority the priority for polling, or 0 for no polling at all.
*/ */
Message(const string clazz, const string name, const bool isWrite, Message(const string circuit, const string name, const bool isWrite,
const bool isPassive, const string comment, const bool isPassive, const string comment,
const unsigned char srcAddress, const unsigned char dstAddress, const unsigned char srcAddress, const unsigned char dstAddress,
const vector<unsigned char> id, DataField* data, const bool deleteData, const vector<unsigned char> id, DataField* data, const bool deleteData,
@@ -96,14 +96,14 @@ public:
DataFieldTemplates* templates, vector<Message*>& messages); DataFieldTemplates* templates, vector<Message*>& messages);
/** /**
* Get the optional device class. * Get the optional circuit name.
* @return the optional device class. * @return the optional circuit name.
*/ */
string getClass() const { return m_class; } string getCircuit() const { return m_circuit; }
/** /**
* Get the message name (unique within the same class and type). * Get the message name (unique within the same circuit and type).
* @return the message name (unique within the same class and type). * @return the message name (unique within the same circuit and type).
*/ */
string getName() const { return m_name; } string getName() const { return m_name; }
@@ -256,10 +256,10 @@ public:
private: private:
/** the optional device class. */ /** the optional circuit name. */
const string m_class; const string m_circuit;
/** the message name (unique within the same class and type). */ /** the message name (unique within the same circuit and type). */
const string m_name; const string m_name;
/** whether this is a write message. */ /** whether this is a write message. */
@@ -358,29 +358,29 @@ 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); 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);
/** /**
* Find the @a Message instance for the specified class and name. * Find the @a Message instance for the specified circuit and name.
* @param clazz the optional device class. * @param circuit the optional circuit name.
* @param name the message name. * @param name the message name.
* @param isWrite whether this is a write message. * @param isWrite whether this is a write message.
* @param isPassive whether this is a passive message. * @param isPassive whether this is a passive message.
* @return the @a Message instance, or NULL. * @return the @a Message instance, or NULL.
* Note: the caller may not free the returned instance. * Note: the caller may not free the returned instance.
*/ */
Message* find(const string& clazz, const string& name, const bool isWrite, const bool isPassive=false); Message* find(const string& circuit, const string& name, const bool isWrite, const bool isPassive=false);
/** /**
* Find all active get @a Message instances for the specified class and name. * Find all active get @a Message instances for the specified circuit and name.
* @param clazz the device class, or empty for any. * @param circuit the circuit name, or empty for any.
* @param name the message name, 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). * @param pb the primary ID byte, or -1 for any (default any).
* @param completeMatch false to also include messages where the class and name matches only a part of the given class and name (default true). * @param completeMatch false to also include messages where the circuit and name matches only a part of the given circuit and name (default true).
* @param withRead true to include read messages (default true). * @param withRead true to include read messages (default true).
* @param withWrite true to include write messages (default false). * @param withWrite true to include write messages (default false).
* @param withPassive true to include passive messages (default false). * @param withPassive true to include passive messages (default false).
* @return the found @a Message instances. * @return the found @a Message instances.
* Note: the caller may not free the returned instances. * Note: the caller may not free the returned instances.
*/ */
deque<Message*> findAll(const string& clazz, const string& name, const short pb=-1, const bool completeMatch=true, deque<Message*> findAll(const string& circuit, const string& name, const short pb=-1, const bool completeMatch=true,
const bool withRead=true, const bool withWrite=false, const bool withPassive=false); const bool withRead=true, const bool withWrite=false, const bool withPassive=false);
/** /**
@@ -436,7 +436,7 @@ private:
/** the number of distinct passive @a Message instances stored in @a m_messagesByKey. */ /** the number of distinct passive @a Message instances stored in @a m_messagesByKey. */
size_t m_passiveMessageCount; size_t m_passiveMessageCount;
/** the known @a Message instances by lowercase class and name. */ /** the known @a Message instances by lowercase circuit and name. */
map<string, Message*> m_messagesByName; map<string, Message*> m_messagesByName;
/** the known @a Message instances by key. */ /** the known @a Message instances by key. */