add inject command
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
# next (tbd)
|
||||
## Bug Fixes
|
||||
* fix conditional messages not being sent to message definition in MQTT integration and not being used in KNX group association
|
||||
## Features
|
||||
* add "inject" command
|
||||
|
||||
|
||||
# 23.3 (2023-12-26)
|
||||
## Bug Fixes
|
||||
* fix MQTT topic string validation
|
||||
|
||||
+30
-1
@@ -477,6 +477,13 @@ result_t MainLoop::decodeRequest(Request* req, bool* connected, RequestMode* req
|
||||
*ostream << "ERR: command not enabled";
|
||||
return RESULT_OK;
|
||||
}
|
||||
if (cmd == "INJECT") {
|
||||
if (m_enableHex) {
|
||||
return executeInject(args, ostream);
|
||||
}
|
||||
*ostream << "ERR: command not enabled";
|
||||
return RESULT_OK;
|
||||
}
|
||||
if (cmd == "F" || cmd == "FIND") {
|
||||
return executeFind(args, getUserLevels(*user), ostream);
|
||||
}
|
||||
@@ -1155,6 +1162,27 @@ result_t MainLoop::executeHex(const vector<string>& args, ostringstream* ostream
|
||||
return RESULT_OK;
|
||||
}
|
||||
|
||||
result_t MainLoop::executeInject(const vector<string>& args, ostringstream* ostream) {
|
||||
size_t argPos = 1;
|
||||
if (argPos < args.size()) {
|
||||
MasterSymbolString master;
|
||||
SlaveSymbolString slave;
|
||||
if (!m_scanHelper->parseMessage(args[argPos++], false, &master, &slave)) {
|
||||
return RESULT_ERR_INVALID_ARG;
|
||||
}
|
||||
m_busHandler->notifyProtocolMessage(false, master, slave);
|
||||
return RESULT_OK;
|
||||
}
|
||||
*ostream << "usage: inject QQZZPBSBNN[DD]*/[NN[DD]*]\n"
|
||||
" Inject hex data (without sending to bus).\n"
|
||||
" QQ source address\n"
|
||||
" ZZ destination address\n"
|
||||
" PB SB primary/secondary command byte\n"
|
||||
" NN number of following data bytes\n"
|
||||
" DD data byte(s)";
|
||||
return RESULT_OK;
|
||||
}
|
||||
|
||||
result_t MainLoop::executeDirect(const vector<string>& args, RequestMode* reqMode, ostringstream* ostream) {
|
||||
if (reqMode->listenMode != lm_direct) {
|
||||
if (args.size() == 1) {
|
||||
@@ -1879,10 +1907,11 @@ result_t MainLoop::executeHelp(ostringstream* ostream) {
|
||||
" Write by new def.: write [-s QQ] [-d ZZ] -def DEFINITION [VALUE[;VALUE]*] (if enabled)\n"
|
||||
" Write hex message: write [-s QQ] [-c CIRCUIT] -h ZZPBSBNN[DD]*\n"
|
||||
" auth|a Authenticate user: auth USER SECRET\n"
|
||||
" hex Send hex data: hex [-s QQ] [-n] ZZPBSB[NN][DD]* (if enabled)\n"
|
||||
" find|f Find message(s): find [-v|-V] [-r] [-w] [-p] [-a] [-d] [-h] [-i ID] [-f] [-F COL[,COL]*] [-e]"
|
||||
" [-c CIRCUIT] [-l LEVEL] [NAME]\n"
|
||||
" listen|l Listen for updates: listen [-v|-V] [-n|-N] [-u|-U] [stop]\n"
|
||||
" hex Send hex data: hex [-s QQ] [-n] ZZPBSB[NN][DD]* (if enabled)\n"
|
||||
" inject Inject hex data: inject QQZZPBSBNN[DD]*/[NN[DD]*] (if enabled)\n"
|
||||
" direct Enter direct mode\n"
|
||||
" state|s Report bus state\n"
|
||||
" info|i Report information about the daemon, configuration, seen participants, and the device.\n"
|
||||
|
||||
@@ -207,6 +207,14 @@ class MainLoop : public Thread {
|
||||
*/
|
||||
result_t executeHex(const vector<string>& args, ostringstream* ostream);
|
||||
|
||||
/**
|
||||
* Execute the inject command.
|
||||
* @param args the arguments passed to the command (starting with the command itself), or empty for help.
|
||||
* @param ostream the @a ostringstream to format the result string to.
|
||||
* @return the result code.
|
||||
*/
|
||||
result_t executeInject(const vector<string>& args, ostringstream* ostream);
|
||||
|
||||
/**
|
||||
* Execute the direct command.
|
||||
* @param args the arguments passed to the command (starting with the command itself), or empty for help.
|
||||
|
||||
Reference in New Issue
Block a user