Skip to content

Commit

Permalink
examples/ola-streaming-client: Rename universe from STDIN option name…
Browse files Browse the repository at this point in the history
… and clarify usage
  • Loading branch information
shenghaoyang committed Nov 21, 2020
1 parent e42807c commit 6ff5ae1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
17 changes: 8 additions & 9 deletions examples/ola-streaming-client.cpp
Expand Up @@ -41,12 +41,11 @@ DEFINE_s_string(dmx, d, "", "Comma separated DMX values to send, e.g. "
DEFINE_s_uint32(universe, u, 1, "The universe to send data for");
DEFINE_uint8(priority, ola::dmx::SOURCE_PRIORITY_DEFAULT,
"The source priority to send data at");
DEFINE_s_default_bool(universe_from_source, s, false,
"Read universe number from source. Only allowed when "
"processing STDIN. The universe number must be formatted "
"in base 10, and be separated by at least one whitespace "
"character from the start and end of the sequence of "
"DMX values.");
DEFINE_s_default_bool(universe_from_stdin, s, false,
"Also read the destination universe number from STDIN "
"when reading DMX data from STDIN. The universe number "
"must precede the channel values, and be delimited "
"by whitespace. E.g. 1 0,255,128 2 0,255,127.");

bool terminate = false;

Expand Down Expand Up @@ -88,7 +87,7 @@ int main(int argc, char *argv[]) {
unsigned int read_universe = FLAGS_universe;

while (!terminate && std::cin >> input) {
if (!have_universe && FLAGS_universe_from_source) {
if (!have_universe && FLAGS_universe_from_stdin) {
if (!ola::StringToInt(input, &read_universe, true)) {
OLA_FATAL << "Could not convert universe number.";
exit(1);
Expand All @@ -98,13 +97,13 @@ int main(int argc, char *argv[]) {
continue;
}

if (have_universe || !FLAGS_universe_from_source) {
if (have_universe || !FLAGS_universe_from_stdin) {
SendDataFromString(&ola_client, read_universe, input);
have_universe = false;
}
}
} else {
if (FLAGS_universe_from_source) {
if (FLAGS_universe_from_stdin) {
OLA_FATAL << "Not reading from STDIN. Use -u to specify universe.";
exit(1);
}
Expand Down
4 changes: 2 additions & 2 deletions man/ola_streaming_client.1
Expand Up @@ -14,8 +14,8 @@ Display the help message.
Comma separated DMX values to send, e.g. 0,255,128 sets first channel to 0, second channel to 255 and third channel to 128.
.IP "-l, --log-level <int8_t>"
Set the logging level 0 .. 4.
.IP "-s, --universe-from-source"
Read universe number from source. Only allowed when processing STDIN. The universe number must be formatted in base 10, and be separated by at least one whitespace character from the start and end of the sequence of DMX values.
.IP "-s, --universe-from-stdin"
Also read the destination universe number from STDIN when reading DMX data from STDIN. The universe number must precede the channel values, and be delimited by whitespace. E.g. 1 0,255,128 2 0,255,127.
.IP "-u, --universe <universe-id>"
Id of the universe to send data for.
.IP "-v, --version"
Expand Down

0 comments on commit 6ff5ae1

Please sign in to comment.