diff --git a/examples/normCast.cpp b/examples/normCast.cpp index 3ea84f6..85355ad 100644 --- a/examples/normCast.cpp +++ b/examples/normCast.cpp @@ -183,6 +183,9 @@ class NormCaster void SetTxLoss(double txloss) {NormSetTxLoss(norm_session, txloss);} + void SetRxLoss(double rxloss) + {NormSetRxLoss(norm_session, rxloss);} + private: bool is_running; NormSessionHandle norm_session; @@ -805,15 +808,15 @@ void NormCaster::HandleNormEvent(const NormEvent& event) void Usage() { fprintf(stderr, "Usage: normCast {send &| recv }\n" - " [repeat [updatesOnly]][id ]\n" + " [repeat [updatesOnly]] [id ]\n" " [addr [/]] [interface ] [loopback]\n" " [ack auto|[,,...]] [segment ]\n" - " [block ] [parity ] [auto ]\n" - " [cc|cce|ccl|rate ] [ptos ]\n" + " [block ] [parity ] [auto ] [ptos ]\n" + " [cc|cce|ccl|rate ] [rxloss ]\n" " [flush {none|passive|active}] [silent] [txloss ]\n" + " [processor ] [saveaborts]\n" " [buffer ] [txsockbuffer ] [rxsockbuffer ]\n" - " [debug ] [trace] [log ]\n" - " [processor ] [saveaborts]\n"); + " [debug ] [trace] [log ]\n"); } // end Usage() int main(int argc, char* argv[]) @@ -844,6 +847,7 @@ int main(int argc, char* argv[]) bool trace = false; bool silentReceiver = false; double txloss = 0.0; + double rxloss = 0.0; bool loopback = false; NormCaster normCast; @@ -1209,6 +1213,15 @@ int main(int argc, char* argv[]) return -1; } } + else if (0 == strncmp(cmd, "rxloss", len)) + { + if (1 != sscanf(argv[i++], "%lf", &rxloss)) + { + fprintf(stderr, "normCast error: invalid 'rxloss' value!\n"); + Usage(); + return -1; + } + } else if (0 == strncmp(cmd, "debug", len)) { if (i >= argc) @@ -1308,6 +1321,7 @@ int main(int argc, char* argv[]) if (silentReceiver) normCast.SetSilentReceiver(true); if (txloss > 0.0) normCast.SetTxLoss(txloss); + if (rxloss > 0.0) normCast.SetRxLoss(rxloss); if (autoAck) diff --git a/examples/normMsgr.cpp b/examples/normMsgr.cpp index 7e20a08..e54775a 100644 --- a/examples/normMsgr.cpp +++ b/examples/normMsgr.cpp @@ -202,6 +202,8 @@ class NormMsgr {NormSetSilentReceiver(norm_session, state);} void SetTxLoss(double txloss) {NormSetTxLoss(norm_session, txloss);} + void SetRxLoss(double rxloss) + {NormSetRxLoss(norm_session, rxloss);} private: bool is_running; @@ -783,7 +785,8 @@ void Usage() " [ack auto|[,,...]] [output ]\n" " [cc|cce|ccl|rate ] [interface ] [loopback]\n" " [debug ] [trace] [log ] [silent]\n" - " [flush {none|passive|active}] [omit] [txloss ]\n"); + " [flush {none|passive|active}] [omit] [txloss ]\n" + " [rxloss ]\n"); } int main(int argc, char* argv[]) { @@ -811,6 +814,7 @@ int main(int argc, char* argv[]) bool omitHeaderOnOutput = false; bool silentReceiver = false; double txloss = 0.0; + double rxloss = 0.0; bool loopback = false; NormMsgr normMsgr; @@ -1003,6 +1007,15 @@ int main(int argc, char* argv[]) return -1; } } + else if (0 == strncmp(cmd, "rxloss", len)) + { + if (1 != sscanf(argv[i++], "%lf", &rxloss)) + { + fprintf(stderr, "nodeMsgr error: invalid 'rxloss' value!\n"); + Usage(); + return -1; + } + } else if (0 == strncmp(cmd, "debug", len)) { if (i >= argc) @@ -1073,6 +1086,7 @@ int main(int argc, char* argv[]) if (silentReceiver) normMsgr.SetSilentReceiver(true); if (txloss > 0.0) normMsgr.SetTxLoss(txloss); + if (rxloss > 0.0) normMsgr.SetRxLoss(rxloss); if (autoAck) { diff --git a/examples/normStreamer.cpp b/examples/normStreamer.cpp index 8e886e6..fb4f452 100644 --- a/examples/normStreamer.cpp +++ b/examples/normStreamer.cpp @@ -256,6 +256,8 @@ class NormStreamer {NormSetSilentReceiver(norm_session, state);} void SetTxLoss(double txloss) {NormSetTxLoss(norm_session, txloss);} + void SetRxLoss(double rxloss) + {NormSetRxLoss(norm_session, rxloss);} // Set the scheduler for running the app and norm threads. static bool BoostPriority(); @@ -1353,8 +1355,8 @@ void Usage() " [insockbuffer ] [outsockbuffer ]\n" " [txsockbuffer ] [rxsockbuffer ]\n" " [streambuffer ]\n" - " [check64 | check32]\n" - " [omit] [silent] [txloss ]\n"); + " [check64 | check32] [omit] [silent]\n" + " [txloss ] [rxloss ]\n"); } // end Usage() void PrintHelp() @@ -1437,6 +1439,7 @@ int main(int argc, char* argv[]) bool omitHeaderOnOutput = false; bool silentReceiver = false; double txloss = 0.0; + double rxloss = 0.0; bool boostPriority = false; unsigned int checkSequence = 0; // can set to 64 or 32 // TBD - set these defaults to reasonable values or just use NormStreamer constructor defaults @@ -1955,6 +1958,15 @@ int main(int argc, char* argv[]) return -1; } } + else if (0 == strncmp(cmd, "rxloss", len)) + { + if (1 != sscanf(argv[i++], "%lf", &rxloss)) + { + fprintf(stderr, "normStreamer error: invalid 'rxloss' value!\n"); + Usage(); + return -1; + } + } else if (0 == strncmp(cmd, "debug", len)) { if (i >= argc) @@ -2069,6 +2081,7 @@ int main(int argc, char* argv[]) if (silentReceiver) normStreamer.SetSilentReceiver(true); if (txloss > 0.0) normStreamer.SetTxLoss(txloss); + if (rxloss > 0.0) normStreamer.SetRxLoss(rxloss); for (unsigned int i = 0; i < ackingNodeCount; i++) normStreamer.AddAckingNode(ackingNodeList[i]);