add rxloss to examples
parent
b997771fec
commit
8c9f0951ff
|
|
@ -183,6 +183,9 @@ class NormCaster
|
||||||
void SetTxLoss(double txloss)
|
void SetTxLoss(double txloss)
|
||||||
{NormSetTxLoss(norm_session, txloss);}
|
{NormSetTxLoss(norm_session, txloss);}
|
||||||
|
|
||||||
|
void SetRxLoss(double rxloss)
|
||||||
|
{NormSetRxLoss(norm_session, rxloss);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool is_running;
|
bool is_running;
|
||||||
NormSessionHandle norm_session;
|
NormSessionHandle norm_session;
|
||||||
|
|
@ -805,15 +808,15 @@ void NormCaster::HandleNormEvent(const NormEvent& event)
|
||||||
void Usage()
|
void Usage()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: normCast {send <file/dir list> &| recv <rxCacheDir>}\n"
|
fprintf(stderr, "Usage: normCast {send <file/dir list> &| recv <rxCacheDir>}\n"
|
||||||
" [repeat <interval> [updatesOnly]][id <nodeIdInteger>]\n"
|
" [repeat <interval> [updatesOnly]] [id <nodeIdInteger>]\n"
|
||||||
" [addr <addr>[/<port>]] [interface <name>] [loopback]\n"
|
" [addr <addr>[/<port>]] [interface <name>] [loopback]\n"
|
||||||
" [ack auto|<node1>[,<node2>,...]] [segment <bytes>]\n"
|
" [ack auto|<node1>[,<node2>,...]] [segment <bytes>]\n"
|
||||||
" [block <count>] [parity <count>] [auto <count>]\n"
|
" [block <count>] [parity <count>] [auto <count>] [ptos <value>]\n"
|
||||||
" [cc|cce|ccl|rate <bitsPerSecond>] [ptos <value>]\n"
|
" [cc|cce|ccl|rate <bitsPerSecond>] [rxloss <lossFraction>]\n"
|
||||||
" [flush {none|passive|active}] [silent] [txloss <lossFraction>]\n"
|
" [flush {none|passive|active}] [silent] [txloss <lossFraction>]\n"
|
||||||
|
" [processor <processorCmdLine>] [saveaborts]\n"
|
||||||
" [buffer <bytes>] [txsockbuffer <bytes>] [rxsockbuffer <bytes>]\n"
|
" [buffer <bytes>] [txsockbuffer <bytes>] [rxsockbuffer <bytes>]\n"
|
||||||
" [debug <level>] [trace] [log <logfile>]\n"
|
" [debug <level>] [trace] [log <logfile>]\n");
|
||||||
" [processor <processorCmdLine>] [saveaborts]\n");
|
|
||||||
} // end Usage()
|
} // end Usage()
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
|
|
@ -844,6 +847,7 @@ int main(int argc, char* argv[])
|
||||||
bool trace = false;
|
bool trace = false;
|
||||||
bool silentReceiver = false;
|
bool silentReceiver = false;
|
||||||
double txloss = 0.0;
|
double txloss = 0.0;
|
||||||
|
double rxloss = 0.0;
|
||||||
bool loopback = false;
|
bool loopback = false;
|
||||||
|
|
||||||
NormCaster normCast;
|
NormCaster normCast;
|
||||||
|
|
@ -1209,6 +1213,15 @@ int main(int argc, char* argv[])
|
||||||
return -1;
|
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))
|
else if (0 == strncmp(cmd, "debug", len))
|
||||||
{
|
{
|
||||||
if (i >= argc)
|
if (i >= argc)
|
||||||
|
|
@ -1308,6 +1321,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
if (silentReceiver) normCast.SetSilentReceiver(true);
|
if (silentReceiver) normCast.SetSilentReceiver(true);
|
||||||
if (txloss > 0.0) normCast.SetTxLoss(txloss);
|
if (txloss > 0.0) normCast.SetTxLoss(txloss);
|
||||||
|
if (rxloss > 0.0) normCast.SetRxLoss(rxloss);
|
||||||
|
|
||||||
|
|
||||||
if (autoAck)
|
if (autoAck)
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,8 @@ class NormMsgr
|
||||||
{NormSetSilentReceiver(norm_session, state);}
|
{NormSetSilentReceiver(norm_session, state);}
|
||||||
void SetTxLoss(double txloss)
|
void SetTxLoss(double txloss)
|
||||||
{NormSetTxLoss(norm_session, txloss);}
|
{NormSetTxLoss(norm_session, txloss);}
|
||||||
|
void SetRxLoss(double rxloss)
|
||||||
|
{NormSetRxLoss(norm_session, rxloss);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool is_running;
|
bool is_running;
|
||||||
|
|
@ -783,7 +785,8 @@ void Usage()
|
||||||
" [ack auto|<node1>[,<node2>,...]] [output <outFile>]\n"
|
" [ack auto|<node1>[,<node2>,...]] [output <outFile>]\n"
|
||||||
" [cc|cce|ccl|rate <bitsPerSecond>] [interface <name>] [loopback]\n"
|
" [cc|cce|ccl|rate <bitsPerSecond>] [interface <name>] [loopback]\n"
|
||||||
" [debug <level>] [trace] [log <logfile>] [silent]\n"
|
" [debug <level>] [trace] [log <logfile>] [silent]\n"
|
||||||
" [flush {none|passive|active}] [omit] [txloss <lossFraction>]\n");
|
" [flush {none|passive|active}] [omit] [txloss <lossFraction>]\n"
|
||||||
|
" [rxloss <lossFraction>]\n");
|
||||||
}
|
}
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
|
@ -811,6 +814,7 @@ int main(int argc, char* argv[])
|
||||||
bool omitHeaderOnOutput = false;
|
bool omitHeaderOnOutput = false;
|
||||||
bool silentReceiver = false;
|
bool silentReceiver = false;
|
||||||
double txloss = 0.0;
|
double txloss = 0.0;
|
||||||
|
double rxloss = 0.0;
|
||||||
bool loopback = false;
|
bool loopback = false;
|
||||||
|
|
||||||
NormMsgr normMsgr;
|
NormMsgr normMsgr;
|
||||||
|
|
@ -1003,6 +1007,15 @@ int main(int argc, char* argv[])
|
||||||
return -1;
|
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))
|
else if (0 == strncmp(cmd, "debug", len))
|
||||||
{
|
{
|
||||||
if (i >= argc)
|
if (i >= argc)
|
||||||
|
|
@ -1073,6 +1086,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
if (silentReceiver) normMsgr.SetSilentReceiver(true);
|
if (silentReceiver) normMsgr.SetSilentReceiver(true);
|
||||||
if (txloss > 0.0) normMsgr.SetTxLoss(txloss);
|
if (txloss > 0.0) normMsgr.SetTxLoss(txloss);
|
||||||
|
if (rxloss > 0.0) normMsgr.SetRxLoss(rxloss);
|
||||||
|
|
||||||
if (autoAck)
|
if (autoAck)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -256,6 +256,8 @@ class NormStreamer
|
||||||
{NormSetSilentReceiver(norm_session, state);}
|
{NormSetSilentReceiver(norm_session, state);}
|
||||||
void SetTxLoss(double txloss)
|
void SetTxLoss(double txloss)
|
||||||
{NormSetTxLoss(norm_session, txloss);}
|
{NormSetTxLoss(norm_session, txloss);}
|
||||||
|
void SetRxLoss(double rxloss)
|
||||||
|
{NormSetRxLoss(norm_session, rxloss);}
|
||||||
// Set the scheduler for running the app and norm threads.
|
// Set the scheduler for running the app and norm threads.
|
||||||
static bool BoostPriority();
|
static bool BoostPriority();
|
||||||
|
|
||||||
|
|
@ -1353,8 +1355,8 @@ void Usage()
|
||||||
" [insockbuffer <bytes>] [outsockbuffer <bytes>]\n"
|
" [insockbuffer <bytes>] [outsockbuffer <bytes>]\n"
|
||||||
" [txsockbuffer <bytes>] [rxsockbuffer <bytes>]\n"
|
" [txsockbuffer <bytes>] [rxsockbuffer <bytes>]\n"
|
||||||
" [streambuffer <bytes>]\n"
|
" [streambuffer <bytes>]\n"
|
||||||
" [check64 | check32]\n"
|
" [check64 | check32] [omit] [silent]\n"
|
||||||
" [omit] [silent] [txloss <lossFraction>]\n");
|
" [txloss <lossFraction>] [rxloss <lossFraction>]\n");
|
||||||
} // end Usage()
|
} // end Usage()
|
||||||
|
|
||||||
void PrintHelp()
|
void PrintHelp()
|
||||||
|
|
@ -1437,6 +1439,7 @@ int main(int argc, char* argv[])
|
||||||
bool omitHeaderOnOutput = false;
|
bool omitHeaderOnOutput = false;
|
||||||
bool silentReceiver = false;
|
bool silentReceiver = false;
|
||||||
double txloss = 0.0;
|
double txloss = 0.0;
|
||||||
|
double rxloss = 0.0;
|
||||||
bool boostPriority = false;
|
bool boostPriority = false;
|
||||||
unsigned int checkSequence = 0; // can set to 64 or 32
|
unsigned int checkSequence = 0; // can set to 64 or 32
|
||||||
// TBD - set these defaults to reasonable values or just use NormStreamer constructor defaults
|
// 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;
|
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))
|
else if (0 == strncmp(cmd, "debug", len))
|
||||||
{
|
{
|
||||||
if (i >= argc)
|
if (i >= argc)
|
||||||
|
|
@ -2069,6 +2081,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
if (silentReceiver) normStreamer.SetSilentReceiver(true);
|
if (silentReceiver) normStreamer.SetSilentReceiver(true);
|
||||||
if (txloss > 0.0) normStreamer.SetTxLoss(txloss);
|
if (txloss > 0.0) normStreamer.SetTxLoss(txloss);
|
||||||
|
if (rxloss > 0.0) normStreamer.SetRxLoss(rxloss);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < ackingNodeCount; i++)
|
for (unsigned int i = 0; i < ackingNodeCount; i++)
|
||||||
normStreamer.AddAckingNode(ackingNodeList[i]);
|
normStreamer.AddAckingNode(ackingNodeList[i]);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue