Skip to content

Commit

Permalink
add public sendCommand method
Browse files Browse the repository at this point in the history
  • Loading branch information
flash62au committed Jun 16, 2024
1 parent bad5fec commit f784c88
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=DCCEXProtocol
version=0.0.15
version=0.0.16
author=Peter Cole, Peter Akers <[email protected]>
maintainer=Peter Cole, Peter Akers <[email protected]>
sentence=DCC-EX Native Protocol implementation
Expand Down
5 changes: 5 additions & 0 deletions src/DCCEXProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ void DCCEXProtocol::check() {
}
}

void DCCEXProtocol::sendCommand(char *cmd) {
sprintf(_outboundCommand, "<%s>", cmd);
_sendCommand();
}

// sequentially request and get the required lists. To avoid overloading the buffer
void DCCEXProtocol::getLists(bool rosterRequired, bool turnoutListRequired, bool routeListRequired,
bool turntableListRequired) {
Expand Down
5 changes: 5 additions & 0 deletions src/DCCEXProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
/*
Version information:
0.0.16 - add public sendCommand method
0.0.15 - any acquired loco is now retained in the roster
0.0.14 - add getNumberSupportedLocos() used for the fake heartbeat
0.0.13 - Fix bug to allow compilation on AVR platforms, change ssize_t to int
Expand Down Expand Up @@ -220,6 +221,10 @@ class DCCEXProtocol {
/// @brief Check for incoming DCC-EX broadcasts/responses and parse them
void check();

/// @brief allows sending of an arbitray command
/// @param cmd Command to send
void sendCommand(char *cmd);

/// @brief Request DCC-EX object lists (Roster, Turnouts, Routes, Turntables)
/// @param rosterRequired Request the roster list (true|false)
/// @param turnoutListRequired Request the turnout list (true|false)
Expand Down

0 comments on commit f784c88

Please sign in to comment.