added more filtering options to MessageMap::findAll
This commit is contained in:
@@ -106,9 +106,8 @@ result_t Message::create(vector<string>::iterator& it, const vector<string>::ite
|
||||
char last = str[len-1];
|
||||
if (last >= '0' && last <= '9') { // poll priority (=active get)
|
||||
pollPriority = last - '0';
|
||||
defaultName = string(str).substr(0, len-1); // cut off priority digit
|
||||
}
|
||||
else
|
||||
defaultName = string(str).substr(0, len - 1); // cut off priority digit
|
||||
} else
|
||||
defaultName = str;
|
||||
} else if (strncasecmp(str, "W", 1) == 0) { // active set
|
||||
isSet = true;
|
||||
@@ -425,7 +424,8 @@ Message* MessageMap::find(const string& clazz, const string& name, const bool is
|
||||
return NULL;
|
||||
}
|
||||
|
||||
deque<Message*> MessageMap::findAll(const string& clazz, const string& name, const short pb, const bool completeMatch)
|
||||
deque<Message*> MessageMap::findAll(const string& clazz, const string& name, const short pb, const bool completeMatch,
|
||||
const bool withRead, const bool withWrite, const bool withPassive)
|
||||
{
|
||||
deque<Message*> ret;
|
||||
|
||||
@@ -448,6 +448,16 @@ deque<Message*> MessageMap::findAll(const string& clazz, const string& name, con
|
||||
}
|
||||
if (checkPb == true && message->getId()[0] != pb)
|
||||
continue;
|
||||
if (message->isPassive() == true) {
|
||||
if (withPassive == false)
|
||||
continue;
|
||||
} else if (message->isSet() == true) {
|
||||
if (withWrite == false)
|
||||
continue;
|
||||
} else {
|
||||
if (withRead == false)
|
||||
continue;
|
||||
}
|
||||
ret.push_back(message);
|
||||
}
|
||||
|
||||
|
||||
@@ -326,12 +326,16 @@ public:
|
||||
* @brief 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.
|
||||
* @param completeMatch false to also include messages where the class and name matches only a part of the given class and name.
|
||||
* @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 withRead true to include read messages (default true).
|
||||
* @param withWrite true to include write messages (default false).
|
||||
* @param withPassive true to include passive messages (default false).
|
||||
* @return the found @a Message instances.
|
||||
* Note: the caller may not free the returned instances.
|
||||
*/
|
||||
deque<Message*> findAll(const string& clazz, const string& name, const short pb, const bool completeMatch=true);
|
||||
deque<Message*> findAll(const string& clazz, const string& name, const short pb=-1, const bool completeMatch=true,
|
||||
const bool withRead=true, const bool withWrite=false, const bool withPassive=false);
|
||||
|
||||
/**
|
||||
* @brief Find the @a Message instance for the specified master data.
|
||||
|
||||
Reference in New Issue
Block a user