If the protocol is not valid, return TELLSTICK_ERROR_CONFIG_SYNTAX instead of TELLSTICK_ERROR_UNKNOWN. Closes #119
This commit is contained in:
parent
12eb097ce4
commit
8babf9913d
1 changed files with 43 additions and 42 deletions
|
@ -139,7 +139,10 @@ int Device::getType(){
|
|||
|
||||
int Device::doAction(int action, unsigned char data, Controller *controller) {
|
||||
Protocol *p = this->retrieveProtocol();
|
||||
if(p){
|
||||
if (!p) {
|
||||
//Syntax error in configuration, no such protocol
|
||||
return TELLSTICK_ERROR_CONFIG_SYNTAX;
|
||||
}
|
||||
//Try to determine if we need to call another method due to masking
|
||||
int methods = p->methods();
|
||||
if ((action & methods) == 0) {
|
||||
|
@ -180,8 +183,6 @@ int Device::doAction(int action, unsigned char data, Controller *controller) {
|
|||
}
|
||||
}
|
||||
return controller->send(code);
|
||||
}
|
||||
return TELLSTICK_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
Protocol* Device::retrieveProtocol() const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue