Christian Heimke commited on 2011-07-15 09:03:25
Showing 13 changed files, with 76 additions and 18 deletions.
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.4 date 2005-07-02 |
|
| 2 |
+ * version 0.4.1 date 2005-12-05 |
|
| 3 | 3 |
* Copyright 2004-2005 Stefan Schuermans <1stein@schuermans.info> |
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| ... | ... |
@@ -21,7 +21,7 @@ int main( int argCnt, char * * args ) |
| 21 | 21 |
|
| 22 | 22 |
//print info |
| 23 | 23 |
printf( "BlinkenLib - BlinkenConv\n" |
| 24 |
- "version 0.4 date 2005-07-02\n" |
|
| 24 |
+ "version 0.4.1 date 2005-12-05\n" |
|
| 25 | 25 |
"Copyright 2004-2005 Stefan Schuermans <1stein@schuermans.info>\n" |
| 26 | 26 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" |
| 27 | 27 |
"a blinkenarea.org project\n" |
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.4 date 2005-07-02 |
|
| 2 |
+ * version 0.4.1 date 2005-12-05 |
|
| 3 | 3 |
* Copyright 2004-2005 Stefan Schuermans <1stein@schuermans.info> |
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| ... | ... |
@@ -26,7 +26,7 @@ int main( int argCnt, char * * args ) |
| 26 | 26 |
|
| 27 | 27 |
//print info |
| 28 | 28 |
printf( "BlinkenLib - BlinkenRecv\n" |
| 29 |
- "version 0.4 date 2005-07-02\n" |
|
| 29 |
+ "version 0.4.1 date 2005-12-05\n" |
|
| 30 | 30 |
"Copyright 2004-2005 Stefan Schuermans <1stein@schuermans.info>\n" |
| 31 | 31 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" |
| 32 | 32 |
"a blinkenarea.org project\n" |
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
/* BlinkenLib |
| 2 |
- * version 0.4 date 2005-07-02 |
|
| 2 |
+ * version 0.4.1 date 2005-12-05 |
|
| 3 | 3 |
* Copyright 2004-2005 Stefan Schuermans <1stein@schuermans.info> |
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| ... | ... |
@@ -20,6 +20,7 @@ int main( int argCnt, char * * args ) |
| 20 | 20 |
{
|
| 21 | 21 |
int i, udpSocket, connected; |
| 22 | 22 |
etBlinkenProto proto; |
| 23 |
+ unsigned int send_cnt, loop_cnt, loop, ui; |
|
| 23 | 24 |
char txt[64]; |
| 24 | 25 |
unsigned short port; |
| 25 | 26 |
struct sockaddr_in addr; |
| ... | ... |
@@ -27,7 +28,7 @@ int main( int argCnt, char * * args ) |
| 27 | 28 |
|
| 28 | 29 |
//print info |
| 29 | 30 |
printf( "BlinkenLib - BlinkenSend\n" |
| 30 |
- "version 0.4 date 2005-07-02\n" |
|
| 31 |
+ "version 0.4.1 date 2005-12-05\n" |
|
| 31 | 32 |
"Copyright 2004-2005 Stefan Schuermans <1stein@schuermans.info>\n" |
| 32 | 33 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" |
| 33 | 34 |
"a blinkenarea.org project\n" |
| ... | ... |
@@ -45,8 +46,12 @@ int main( int argCnt, char * * args ) |
| 45 | 46 |
" destination addess (defaults to 127.0.0.1:2323)\n" |
| 46 | 47 |
" -p [BLP|EBLP|MCUF]\n" |
| 47 | 48 |
" protocol to use (defaults to MCUF)\n" |
| 49 |
+ " -n <number>\n" |
|
| 50 |
+ " set number of times to send movies (defaults to 1)\n" |
|
| 48 | 51 |
" -i <file>\n" |
| 49 |
- " read movie from file (*.blm, *.bmm, *.bml, *.bbm) and send it\n\n", |
|
| 52 |
+ " read movie from file (*.blm, *.bmm, *.bml, *.bbm) and send it\n" |
|
| 53 |
+ " -l <number>\n" |
|
| 54 |
+ " loop number of times (defaults to 1, use 0 for forever)\n\n", |
|
| 50 | 55 |
args[0] ); |
| 51 | 56 |
return 0; |
| 52 | 57 |
} |
| ... | ... |
@@ -58,10 +63,22 @@ int main( int argCnt, char * * args ) |
| 58 | 63 |
printf( "cannot create UDP socket\n" ); |
| 59 | 64 |
return -1; |
| 60 | 65 |
} |
| 61 |
- connected = 0; |
|
| 66 |
+ |
|
| 67 |
+ //loop |
|
| 68 |
+ loop_cnt = 1; |
|
| 69 |
+ for( loop = 0; loop < loop_cnt || loop_cnt == 0; loop++ ) |
|
| 70 |
+ {
|
|
| 71 |
+ |
|
| 72 |
+ //print loop message |
|
| 73 |
+ if( loop_cnt > 1 ) |
|
| 74 |
+ printf( "--- loop %u/%u ---\n", loop + 1, loop_cnt ); |
|
| 75 |
+ if( loop_cnt == 0 ) |
|
| 76 |
+ printf( "--- loop %u ---\n", loop + 1 ); |
|
| 62 | 77 |
|
| 63 | 78 |
//process parameters |
| 79 |
+ connected = 0; |
|
| 64 | 80 |
proto = BlinkenProtoMcuf; |
| 81 |
+ send_cnt = 1; |
|
| 65 | 82 |
for( i = 1; i < argCnt; i++ ) |
| 66 | 83 |
{
|
| 67 | 84 |
|
| ... | ... |
@@ -146,6 +163,21 @@ int main( int argCnt, char * * args ) |
| 146 | 163 |
printf( "missing protocol for \"-p\"\n" ); |
| 147 | 164 |
} |
| 148 | 165 |
|
| 166 |
+ //number of times to send movies |
|
| 167 |
+ else if( strcmp( args[i], "-n" ) == 0 ) |
|
| 168 |
+ {
|
|
| 169 |
+ if( i + 1 < argCnt ) |
|
| 170 |
+ {
|
|
| 171 |
+ i++; |
|
| 172 |
+ if( sscanf( args[i], "%u", &ui ) == 1 && ui > 0 ) |
|
| 173 |
+ send_cnt = ui; |
|
| 174 |
+ else |
|
| 175 |
+ printf( "invalid number \"%s\"\n", args[i] ); |
|
| 176 |
+ } |
|
| 177 |
+ else |
|
| 178 |
+ printf( "missing number for \"-n\"\n" ); |
|
| 179 |
+ } |
|
| 180 |
+ |
|
| 149 | 181 |
//read movie and sent it |
| 150 | 182 |
else if( strcmp( args[i], "-i" ) == 0 ) |
| 151 | 183 |
{
|
| ... | ... |
@@ -171,9 +203,13 @@ int main( int argCnt, char * * args ) |
| 171 | 203 |
printf( "could not read movie \"%s\"\n", args[i] ); |
| 172 | 204 |
else |
| 173 | 205 |
{
|
| 174 |
- printf( "movie \"%s\" read - sending...\n", args[i] ); |
|
| 206 |
+ printf( "movie \"%s\" read\n", args[i] ); |
|
| 207 |
+ for( ui = 0; ui < send_cnt; ui++ ) |
|
| 208 |
+ {
|
|
| 209 |
+ printf( "sending movie \"%s\" (%u/%u)...\n", args[i], ui + 1, send_cnt ); |
|
| 175 | 210 |
BlinkenMovieSend( pMovie, udpSocket, proto ); |
| 176 | 211 |
printf( "movie \"%s\" sent\n", args[i] ); |
| 212 |
+ } |
|
| 177 | 213 |
BlinkenMovieFree( pMovie ); |
| 178 | 214 |
} |
| 179 | 215 |
} |
| ... | ... |
@@ -184,12 +220,29 @@ int main( int argCnt, char * * args ) |
| 184 | 220 |
printf( "missing input filename for \"-i\"\n" ); |
| 185 | 221 |
} |
| 186 | 222 |
|
| 223 |
+ //number of times to loop |
|
| 224 |
+ else if( strcmp( args[i], "-l" ) == 0 ) |
|
| 225 |
+ {
|
|
| 226 |
+ if( i + 1 < argCnt ) |
|
| 227 |
+ {
|
|
| 228 |
+ i++; |
|
| 229 |
+ if( sscanf( args[i], "%u", &ui ) == 1 ) |
|
| 230 |
+ loop_cnt = ui; |
|
| 231 |
+ else |
|
| 232 |
+ printf( "invalid number \"%s\"\n", args[i] ); |
|
| 233 |
+ } |
|
| 234 |
+ else |
|
| 235 |
+ printf( "missing number for \"-l\"\n" ); |
|
| 236 |
+ } |
|
| 237 |
+ |
|
| 187 | 238 |
//unknown parameter |
| 188 | 239 |
else |
| 189 | 240 |
printf( "unknown parameter \"%s\", call without parameters to get help\n", args[i] ); |
| 190 | 241 |
|
| 191 | 242 |
} //for( i ... |
| 192 | 243 |
|
| 244 |
+ } //for( loop ... |
|
| 245 |
+ |
|
| 193 | 246 |
//close socket |
| 194 | 247 |
close( udpSocket ); |
| 195 | 248 |
|