check answer command enabled more thoroughly, fix blank answer, more coverage
This commit is contained in:
@@ -485,7 +485,7 @@ result_t MainLoop::decodeRequest(Request* req, bool* connected, RequestMode* req
|
|||||||
return RESULT_OK;
|
return RESULT_OK;
|
||||||
}
|
}
|
||||||
if (cmd == "ANSWER") {
|
if (cmd == "ANSWER") {
|
||||||
if (m_enableHex && !m_protocol->isReadOnly()) {
|
if (m_enableHex && m_protocol->isAnswering()) {
|
||||||
return executeAnswer(args, ostream);
|
return executeAnswer(args, ostream);
|
||||||
}
|
}
|
||||||
*ostream << "ERR: command not enabled";
|
*ostream << "ERR: command not enabled";
|
||||||
@@ -1231,8 +1231,8 @@ result_t MainLoop::executeAnswer(const vector<string>& args, ostringstream* ostr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SlaveSymbolString answer;
|
SlaveSymbolString answer;
|
||||||
if (argPos > 0 && argPos < args.size()) {
|
|
||||||
answer.push_back(0); // room for length byte
|
answer.push_back(0); // room for length byte
|
||||||
|
if (argPos > 0 && argPos < args.size()) {
|
||||||
result_t ret = answer.parseHex(args[argPos++]);
|
result_t ret = answer.parseHex(args[argPos++]);
|
||||||
if (ret != RESULT_OK) {
|
if (ret != RESULT_OK) {
|
||||||
return ret;
|
return ret;
|
||||||
@@ -1240,8 +1240,8 @@ result_t MainLoop::executeAnswer(const vector<string>& args, ostringstream* ostr
|
|||||||
if (answer.size() > 16) {
|
if (answer.size() > 16) {
|
||||||
return RESULT_ERR_INVALID_POS;
|
return RESULT_ERR_INVALID_POS;
|
||||||
}
|
}
|
||||||
answer.adjustHeader();
|
|
||||||
}
|
}
|
||||||
|
answer.adjustHeader();
|
||||||
if (argPos < args.size()) {
|
if (argPos < args.size()) {
|
||||||
argPos = 0; // print usage
|
argPos = 0; // print usage
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-1
@@ -247,7 +247,7 @@ elif [[ -n "$1" ]]; then
|
|||||||
pid=$(ps -C ebusd -o pid=)
|
pid=$(ps -C ebusd -o pid=)
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
$ebusd -d tcp:127.0.0.1:8876 --initsend --latency 10 -n -c "$PWD/contrib/etc/ebusd" --pollinterval=10 -s --scanretries=0 -a 31 --acquireretries 3 --answer --generatesyn --receivetimeout 40000 --sendretries 1 --enablehex --htmlpath "$PWD/contrib/html" --httpport 8878 --pidfile "$PWD/ebusd.pid" --localhost -p 8877 -l "$PWD/ebusd.log" --logareas all --loglevel debug --lograwdata=bytes --lograwdatafile "$PWD/ebusd.raw" --lograwdatasize 1 --dumpfile "$PWD/ebusd.dump" --dumpsize 100 -D --scanconfig --aclfile="$PWD/acl.csv" --mqttport=1883 --enablehex --enabledefine
|
$ebusd -d tcp:127.0.0.1:8876 --initsend --latency 10 -n -c "$PWD/contrib/etc/ebusd" --pollinterval=10 -s --scanretries=0 -a 31 --acquireretries 3 --answer --generatesyn --receivetimeout 40000 --sendretries 1 --enablehex --htmlpath "$PWD/contrib/html" --httpport 8878 --pidfile "$PWD/ebusd.pid" --localhost -p 8877 -l "$PWD/ebusd.log" --logareas all --loglevel debug --lograwdata=bytes --lograwdatafile "$PWD/ebusd.raw" --lograwdatasize 1 --dumpfile "$PWD/ebusd.dump" --dumpsize 100 -D --scanconfig --aclfile="$PWD/acl.csv" --mqttport=1883 --enablehex --enabledefine --answer
|
||||||
sleep 3
|
sleep 3
|
||||||
pid=`head -n 1 "$PWD/ebusd.pid"`
|
pid=`head -n 1 "$PWD/ebusd.pid"`
|
||||||
fi
|
fi
|
||||||
@@ -336,6 +336,11 @@ a test testpass
|
|||||||
w -c mc.5 -d 53 installparam 123
|
w -c mc.5 -d 53 installparam 123
|
||||||
hex fe070400
|
hex fe070400
|
||||||
hex 53070400
|
hex 53070400
|
||||||
|
hex -s f0 -n fe07fe0102
|
||||||
|
inject 3115b509030d1e00/02a85b
|
||||||
|
answer -d 50 0704 b5454850303003277201
|
||||||
|
answer 0705 010203
|
||||||
|
answer -s ff -m 0706 ab
|
||||||
dump
|
dump
|
||||||
grab result
|
grab result
|
||||||
grab result all
|
grab result all
|
||||||
|
|||||||
Reference in New Issue
Block a user