nabaztag_hack_kit 0.0.3 → 0.1.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +7 -1
- data/Rakefile +2 -17
- data/{ext/bytecode → bytecode}/Docs.md +2 -1
- data/bytecode/Rakefile +7 -0
- data/{bin → bytecode/bin}/mtl_comp +9 -0
- data/{bin → bytecode/bin}/mtl_merge +2 -2
- data/{bin → bytecode/bin}/mtl_simu +9 -0
- data/bytecode/lib/buffer.mtl +6 -0
- data/bytecode/lib/button.mtl +18 -12
- data/bytecode/lib/ear.mtl +3 -3
- data/bytecode/lib/led.mtl +1 -1
- data/bytecode/lib/ping.mtl +16 -0
- data/bytecode/lib/record.mtl +87 -0
- data/bytecode/lib/rfid.mtl +3 -21
- data/bytecode/main.mtl +86 -29
- data/{ext/bytecode → bytecode/src}/lib/http.mtl +15 -3
- data/{ext/bytecode → bytecode/src}/lib/udp.mtl +1 -1
- data/{ext/bytecode → bytecode/src}/lib/util.mtl +4 -1
- data/bytecode/src/lib/wav.mtl +223 -0
- data/{ext → bytecode/src}/mtl/README.md +2 -2
- data/{ext/bytecode → bytecode/src}/nominal-ping.mtl +123 -124
- data/{test/bytecode → bytecode/test}/native.mtl +11 -1
- data/{test/bytecode → bytecode/test}/test.mtl +3 -3
- data/examples/record/Gemfile +5 -0
- data/examples/record/config.ru.example +19 -0
- data/examples/record/server.rb +112 -0
- data/examples/simple/Gemfile +6 -0
- data/examples/simple/Procfile +3 -0
- data/{config.ru → examples/simple/config.ru} +3 -1
- data/lib/nabaztag_hack_kit/message/api.rb +8 -0
- data/lib/nabaztag_hack_kit/message/helper.rb +26 -2
- data/lib/nabaztag_hack_kit/message.rb +11 -5
- data/lib/nabaztag_hack_kit/public/index.html +5 -0
- data/lib/nabaztag_hack_kit/server.rb +54 -8
- data/lib/nabaztag_hack_kit/version.rb +1 -1
- data/nabaztag_hack_kit.gemspec +4 -3
- data/spec/integration/server_spec.rb +50 -0
- data/{test → spec}/spec_helper.rb +1 -1
- data/{test → spec}/unit/message_spec.rb +2 -2
- data/spec/unit/server_spec.rb +40 -0
- metadata +140 -119
- data/public/bytecode.bin +0 -0
- /data/{ext/bytecode → bytecode}/Commands.md +0 -0
- /data/{ext/bytecode → bytecode/src}/README.md +0 -0
- /data/{ext/bytecode → bytecode/src}/lib/arp.mtl +0 -0
- /data/{ext/bytecode → bytecode/src}/lib/cfg.mtl +0 -0
- /data/{ext/bytecode → bytecode/src}/lib/choreos.mtl +0 -0
- /data/{ext/bytecode → bytecode/src}/lib/dhcp.mtl +0 -0
- /data/{ext/bytecode → bytecode/src}/lib/dns.mtl +0 -0
- /data/{ext/bytecode → bytecode/src}/lib/tcp.mtl +0 -0
- /data/{ext/bytecode → bytecode/src}/lib/var.mtl +0 -0
- /data/{ext/bytecode → bytecode/src}/lib/wifi.mtl +0 -0
- /data/{ext → bytecode/src}/mtl/Makefile +0 -0
- /data/{ext → bytecode/src}/mtl/bc.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/conf.bin.sans_password +0 -0
- /data/{ext → bytecode/src}/mtl/config.txt +0 -0
- /data/{ext → bytecode/src}/mtl/dumpbc.c +0 -0
- /data/{ext → bytecode/src}/mtl/extconf.rb +0 -0
- /data/{ext → bytecode/src}/mtl/linux_simu.c +0 -0
- /data/{ext → bytecode/src}/mtl/linux_simuaudio.c +0 -0
- /data/{ext → bytecode/src}/mtl/linux_simuaudio.h +0 -0
- /data/{ext → bytecode/src}/mtl/linux_simunet.c +0 -0
- /data/{ext → bytecode/src}/mtl/linux_simunet.h +0 -0
- /data/{ext → bytecode/src}/mtl/log.c +0 -0
- /data/{ext → bytecode/src}/mtl/log.h +0 -0
- /data/{ext → bytecode/src}/mtl/main_compiler.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/main_simu.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/mp3/GTKANAL.H +0 -0
- /data/{ext → bytecode/src}/mtl/mp3/LAYER3.C +0 -0
- /data/{ext → bytecode/src}/mtl/mp3/TABINIT.C +0 -0
- /data/{ext → bytecode/src}/mtl/mp3/common.c +0 -0
- /data/{ext → bytecode/src}/mtl/mp3/dct64_i386.c +0 -0
- /data/{ext → bytecode/src}/mtl/mp3/decode_i386.c +0 -0
- /data/{ext → bytecode/src}/mtl/mp3/huffman.h +0 -0
- /data/{ext → bytecode/src}/mtl/mp3/interface.c +0 -0
- /data/{ext → bytecode/src}/mtl/mp3/mpg123.h +0 -0
- /data/{ext → bytecode/src}/mtl/mp3/mpglib.h +0 -0
- /data/{ext → bytecode/src}/mtl/properties.c +0 -0
- /data/{ext → bytecode/src}/mtl/properties.h +0 -0
- /data/{ext → bytecode/src}/mtl/simu.c +0 -0
- /data/{ext → bytecode/src}/mtl/simuaudio.c +0 -0
- /data/{ext → bytecode/src}/mtl/simuaudio.h +0 -0
- /data/{ext → bytecode/src}/mtl/simunet.c +0 -0
- /data/{ext → bytecode/src}/mtl/simunet.h +0 -0
- /data/{ext → bytecode/src}/mtl/utils/correct_const.sh +0 -0
- /data/{ext → bytecode/src}/mtl/vaudio.c +0 -0
- /data/{ext → bytecode/src}/mtl/vaudio.h +0 -0
- /data/{ext → bytecode/src}/mtl/vbc.h +0 -0
- /data/{ext → bytecode/src}/mtl/vbc_str.h +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/Makefile +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/bootstrap.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/compiler.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/compiler.h +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/compiler_file.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/compiler_prog.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/compiler_term.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/compiler_type.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/compiler_var.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/file.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/file.h +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/filesystem.h +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/interpreter.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/interpreter.h +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/memory.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/memory.h +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/param.h +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/parser.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/parser.h +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/parser_xml.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/prodbuffer.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/prodbuffer.h +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/resource.h +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/stdlib_core.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/terminal.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/terminal.h +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/util.cpp +0 -0
- /data/{ext → bytecode/src}/mtl/vcomp/util.h +0 -0
- /data/{ext → bytecode/src}/mtl/vinterp.c +0 -0
- /data/{ext → bytecode/src}/mtl/vinterp.h +0 -0
- /data/{ext → bytecode/src}/mtl/vloader.c +0 -0
- /data/{ext → bytecode/src}/mtl/vloader.h +0 -0
- /data/{ext → bytecode/src}/mtl/vlog.c +0 -0
- /data/{ext → bytecode/src}/mtl/vlog.h +0 -0
- /data/{ext → bytecode/src}/mtl/vmem.c +0 -0
- /data/{ext → bytecode/src}/mtl/vmem.h +0 -0
- /data/{ext → bytecode/src}/mtl/vnet.c +0 -0
- /data/{ext → bytecode/src}/mtl/vnet.h +0 -0
- /data/{test/bytecode → bytecode/test}/helper.mtl +0 -0
@@ -111,7 +111,7 @@ fun strreplace2 sn s p v i id=
|
|
111
111
|
if j!=nil then strcpy sn id+k-i v 0 nil;
|
112
112
|
strreplace2 sn s p v k+strlen p id+k-i+strlen v
|
113
113
|
);;
|
114
|
-
|
114
|
+
|
115
115
|
fun strreplace s p v=
|
116
116
|
let countpattern s p 0 -> i in
|
117
117
|
if !i then s
|
@@ -185,7 +185,7 @@ var tmp;;
|
|
185
185
|
var val;;
|
186
186
|
fun leftrotate val nb_rot =
|
187
187
|
let val.(0) -> valh in
|
188
|
-
let val.(1) -> vall in (
|
188
|
+
let val.(1) -> vall in (
|
189
189
|
if nb_rot == 16 then (
|
190
190
|
{vall valh}
|
191
191
|
) else (
|
@@ -195,7 +195,7 @@ fun leftrotate val nb_rot =
|
|
195
195
|
set valh = vall;
|
196
196
|
set vall = tmp;
|
197
197
|
set nb_rot = nb_rot - 16
|
198
|
-
);
|
198
|
+
);
|
199
199
|
{
|
200
200
|
(valh << nb_rot) & 0xFFFF | (vall >> (16 - nb_rot))
|
201
201
|
(vall << nb_rot) & 0xFFFF | (valh >> (16 - nb_rot))
|
@@ -216,11 +216,11 @@ fun leftrotate val nb_rot =
|
|
216
216
|
// http://fr.wikipedia.org/wiki/MD5
|
217
217
|
// Constantes
|
218
218
|
var md5r = { 7 12 17 22 7 12 17 22 7 12 17 22 7 12 17 22 5 9 14 20 5 9 14 20 5 9 14 20 5 9 14 20 4 11 16 23 4 11 16 23 4 11 16 23 4 11 16 23 6 10 15 21 6 10 15 21 6 10 15 21 6 10 15 21 };;
|
219
|
-
var md5k = { 0xd76a 0xa478 0xe8c7 0xb756 0x2420 0x70db 0xc1bd 0xceee
|
220
|
-
0xf57c 0x0faf 0x4787 0xc62a 0xa830 0x4613 0xfd46 0x9501
|
221
|
-
0x6980 0x98d8 0x8b44 0xf7af 0xffff 0x5bb1 0x895c 0xd7be
|
222
|
-
0x6b90 0x1122 0xfd98 0x7193 0xa679 0x438e 0x49b4 0x0821
|
223
|
-
0xf61e 0x2562 0xc040 0xb340 0x265e 0x5a51 0xe9b6 0xc7aa
|
219
|
+
var md5k = { 0xd76a 0xa478 0xe8c7 0xb756 0x2420 0x70db 0xc1bd 0xceee
|
220
|
+
0xf57c 0x0faf 0x4787 0xc62a 0xa830 0x4613 0xfd46 0x9501
|
221
|
+
0x6980 0x98d8 0x8b44 0xf7af 0xffff 0x5bb1 0x895c 0xd7be
|
222
|
+
0x6b90 0x1122 0xfd98 0x7193 0xa679 0x438e 0x49b4 0x0821
|
223
|
+
0xf61e 0x2562 0xc040 0xb340 0x265e 0x5a51 0xe9b6 0xc7aa
|
224
224
|
0xd62f 0x105d 0x0244 0x1453 0xd8a1 0xe681 0xe7d3 0xfbc8
|
225
225
|
0x21e1 0xcde6 0xc337 0x07d6 0xf4d5 0x0d87 0x455a 0x14ed
|
226
226
|
0xa9e3 0xe905 0xfcef 0xa3f8 0x676f 0x02d9 0x8d2a 0x4c8a
|
@@ -265,21 +265,21 @@ fun md5 strmd5=
|
|
265
265
|
set md5mult = md5len/64; // Reste de la division par 64octets(512bits)
|
266
266
|
if (md5reste > 55 && md5reste < 64) then set md5mult = md5mult + 1; // Si la taille de la chaine entre dans les 64Bits de fin (en comptant le bit de fin de message) on allonge de 512bits
|
267
267
|
set md5msglen = (md5mult+1)*64; // Taille du message apr�s preparation
|
268
|
-
|
268
|
+
|
269
269
|
// ### Preparation du message
|
270
270
|
set md5message = strnew md5msglen; // Allocation de la chaine
|
271
271
|
for i=0;i<md5msglen do strset md5message i 0; // Initialise la chaine
|
272
272
|
for i=0;i<md5len do strset md5message i (strget strmd5 i); // Copie le message
|
273
273
|
strset md5message md5len 0x80; // Ajout d'un bit 1 � la fin du message
|
274
|
-
|
274
|
+
|
275
275
|
// Puisque la chaine est de longueur de la chaine est max de 2^30 octect >> elle est de max (2^30) * 8 (01 FF FF FF F8)
|
276
276
|
set md5len64h = ((((0xFFFFFF000000&md5len)>>24)*8) + (((((0x000000FFFFFF&md5len)>>00)*8)>>24)&0x000000FFFFFF));
|
277
277
|
set md5len64l = ((((0x000000FFFFFF&md5len)>>00)*8)&0x000000FFFFFF);
|
278
|
-
|
278
|
+
|
279
279
|
// On copie la longueur de 64 bits
|
280
280
|
for i=0; i<3 do strset md5message (md5msglen-8+i) (((md5len64l)>>(i*8))&0xFF);
|
281
281
|
for i=3; i<6 do strset md5message (md5msglen-8+i) (((md5len64h)>>((i-3)*8))&0xFF);
|
282
|
-
|
282
|
+
|
283
283
|
// ### Calcul par blocs
|
284
284
|
for i=0; i<=md5mult do ( // Faire tous les blocs de md5message
|
285
285
|
// Preparation du bloc
|
@@ -289,11 +289,11 @@ fun md5 strmd5=
|
|
289
289
|
set md5bloc.(j*2+1) = (strget md5message ((i*64) + (j*4) + 1)) * 0x100;
|
290
290
|
set md5bloc.(j*2+1) = (strget md5message ((i*64) + (j*4) + 0)) + md5bloc.(j*2+1)
|
291
291
|
);
|
292
|
-
|
292
|
+
|
293
293
|
// Initialiser les valeurs de hachage
|
294
294
|
set md5ah = md5h0h; set md5al = md5h0l; set md5bh = md5h1h; set md5bl = md5h1l;
|
295
295
|
set md5ch = md5h2h; set md5cl = md5h2l; set md5dh = md5h3h; set md5dl = md5h3l;
|
296
|
-
|
296
|
+
|
297
297
|
// Op�rations de l'algo
|
298
298
|
for j=0; j<64 do (
|
299
299
|
if j < 16 then (
|
@@ -313,9 +313,9 @@ fun md5 strmd5=
|
|
313
313
|
set md5fl = md5cl^(md5bl|((~md5dl)&0xFFFF)); //f := c xor (b ou (non d))
|
314
314
|
set md5g = (7*j) %16
|
315
315
|
);
|
316
|
-
|
316
|
+
|
317
317
|
set md5tmp1h = md5dh; set md5tmp1l = md5dl; set md5dh = md5ch;
|
318
|
-
set md5dl = md5cl; set md5ch = md5bh; set md5cl = md5bl;
|
318
|
+
set md5dl = md5cl; set md5ch = md5bh; set md5cl = md5bl;
|
319
319
|
// ((a+f+g+k(i) + w(g)
|
320
320
|
set md5tmp2h = (md5ah + md5fh + md5k.(j*2 ) + md5bloc.(md5g*2 ));
|
321
321
|
set md5tmp2l = (md5al + md5fl + md5k.(j*2+1) + md5bloc.(md5g*2+1));
|
@@ -326,14 +326,14 @@ fun md5 strmd5=
|
|
326
326
|
let leftrotate { md5tmp2h md5tmp2l } nb_rot -> tmpr in (
|
327
327
|
set md5tmp2h = tmpr.(0);
|
328
328
|
set md5tmp2l = tmpr.(1)
|
329
|
-
);
|
329
|
+
);
|
330
330
|
set md5bh = ((md5tmp2h + md5bh) + ((md5tmp2l + md5bl) >> 16))&0xFFFF;
|
331
|
-
set md5bl = (md5tmp2l + md5bl)&0xFFFF;
|
331
|
+
set md5bl = (md5tmp2l + md5bl)&0xFFFF;
|
332
332
|
set md5ah = md5tmp1h;
|
333
333
|
set md5al = md5tmp1l
|
334
334
|
);
|
335
|
-
|
336
|
-
// Derni�re �tape pour le prochain bloc
|
335
|
+
|
336
|
+
// Derni�re �tape pour le prochain bloc
|
337
337
|
set md5h0h = (md5h0h + md5ah + ((md5h0l+md5al) >> 16)) & 0xFFFF;
|
338
338
|
set md5h0l = (md5h0l + md5al) & 0xFFFF;
|
339
339
|
set md5h1h = (md5h1h + md5bh + ((md5h1l+md5bl) >> 16)) & 0xFFFF;
|
@@ -342,9 +342,9 @@ fun md5 strmd5=
|
|
342
342
|
set md5h2l = (md5h2l + md5cl)&0xFFFF;
|
343
343
|
set md5h3h = (md5h3h + md5dh + ((md5h3l+md5dl) >> 16)) & 0xFFFF;
|
344
344
|
set md5h3l = (md5h3l + md5dl)&0xFFFF
|
345
|
-
|
345
|
+
|
346
346
|
);
|
347
|
-
|
347
|
+
|
348
348
|
// #### Concat�nation et cr�ation de la chaine de caract�re
|
349
349
|
set md5return = "";
|
350
350
|
for i=0; i<8 do (
|
@@ -361,7 +361,7 @@ fun md5 strmd5=
|
|
361
361
|
set md5return = strcat md5return "0";
|
362
362
|
set md5return = strcat md5return itoh((md5tmp2h>>(8*j))&0xFF)
|
363
363
|
)
|
364
|
-
);
|
364
|
+
);
|
365
365
|
md5return;;
|
366
366
|
|
367
367
|
fun MACecho src i0 ln=
|
@@ -548,7 +548,7 @@ fun filterarpip l src =
|
|
548
548
|
else (hd l)::filterarpip tl l src;;
|
549
549
|
|
550
550
|
fun checkarp l src=
|
551
|
-
if l!=nil then let hd l->[ip _ cb] in
|
551
|
+
if l!=nil then let hd l->[ip _ cb] in
|
552
552
|
(
|
553
553
|
if !vstrcmp src 8+14 ip 0 4 then
|
554
554
|
let strsub src 8+8 6 -> mac in
|
@@ -585,8 +585,8 @@ fun subnet_ ip i=
|
|
585
585
|
fun subnet ip=
|
586
586
|
Secho "test subnet "; IPecho ip 0 1;
|
587
587
|
Iecholn subnet_ ip 3;;
|
588
|
-
|
589
|
-
|
588
|
+
|
589
|
+
|
590
590
|
fun arpreq ip cb=
|
591
591
|
let IPecho (if subnet ip then ip else netgateway) 0 1 -> ip in
|
592
592
|
let listswitchstr larp ip -> mac in
|
@@ -619,7 +619,7 @@ fun resetarp=
|
|
619
619
|
|
620
620
|
// ------------- UDP debut
|
621
621
|
fun mkudp ipsrc ipdst portsrc portdst content=
|
622
|
-
let strcatlist
|
622
|
+
let strcatlist
|
623
623
|
"\$aa\$aa\$03\$00\$00\$00\$08\$00\$45\$00\$00\$00\$00\$00\$00\$00\100\17\0\0"::
|
624
624
|
ipsrc::
|
625
625
|
ipdst::
|
@@ -696,7 +696,7 @@ var TCPMAX=1024;;
|
|
696
696
|
type Tcp=[stateT locT dstT locpT dstpT seqT ackT cbT macT lastsentT retryT locksendT enableT];;
|
697
697
|
|
698
698
|
fun mktcp_ ipsrc ipdst portsrc portdst seq ack flag content=
|
699
|
-
let strcatlist
|
699
|
+
let strcatlist
|
700
700
|
"\$aa\$aa\$03\$00\$00\$00\$08\$00\$45\$00\$00\$00\$00\$00\$00\$00\100\6\0\0"::
|
701
701
|
ipsrc::
|
702
702
|
ipdst::
|
@@ -740,7 +740,7 @@ fun headerlen src=((strget src 8+32)>>4)<<2;;
|
|
740
740
|
fun datalength src=(strgetword src 10)-20-headerlen src;;
|
741
741
|
|
742
742
|
fun sendtcp t trame=
|
743
|
-
// Secholn "tcpSend"; dump trame;
|
743
|
+
// Secholn "tcpSend"; dump trame;
|
744
744
|
netSend trame 0 nil (/*MACecho*/ t.macT /*0 1*/) 0 1;
|
745
745
|
let strget trame 8+33 -> flag in
|
746
746
|
set t.seqT=netSeqAdd t.seqT (datalength trame)+(if flag&(TSYN|TFIN) then 1 else 0);
|
@@ -780,7 +780,7 @@ fun listentcp localp cb=
|
|
780
780
|
(
|
781
781
|
set ltcp=tcp::ltcp
|
782
782
|
);;
|
783
|
-
|
783
|
+
|
784
784
|
fun findtcp l localp dstp src=
|
785
785
|
if l!=nil then let hd l-> t in
|
786
786
|
if t.locpT==localp && t.dstpT==dstp && (!vstrcmp src 8+16 t.locT 0 4)&& (!vstrcmp src 8+12 t.dstT 0 4)
|
@@ -792,7 +792,7 @@ fun sendclose t=
|
|
792
792
|
Secholn "## sendclose";
|
793
793
|
sendtcp t mktcp t TFIN+TACK nil;
|
794
794
|
set t.stateT=STFIN;
|
795
|
-
0;;
|
795
|
+
0;;
|
796
796
|
|
797
797
|
fun cbnettcp src mac=
|
798
798
|
Secho "t";
|
@@ -1163,7 +1163,7 @@ fun tcpcb t cb=
|
|
1163
1163
|
|
1164
1164
|
fun listentcp port cb=
|
1165
1165
|
set ltcp=[tcpListen port cb]::ltcp;;
|
1166
|
-
|
1166
|
+
|
1167
1167
|
// ---- WE ARE IN TCP/UDP EMULATION !!
|
1168
1168
|
|
1169
1169
|
fun opentcp local localp dst dstp cb=
|
@@ -1233,7 +1233,7 @@ fun parseans s i n=
|
|
1233
1233
|
strcatlist (itoa strget s j+10)::"."::(itoa strget s j+11)::"."::
|
1234
1234
|
(itoa strget s j+12)::"."::(itoa strget s j+13)::nil
|
1235
1235
|
else parseans s (j+10+strgetword s j+8) n-1;;
|
1236
|
-
|
1236
|
+
|
1237
1237
|
fun parsemsg s=
|
1238
1238
|
let strgetword s 0 -> id in
|
1239
1239
|
let strgetword s 2 -> code in
|
@@ -1274,7 +1274,7 @@ fun dnsreq domain cb=
|
|
1274
1274
|
|
1275
1275
|
fun selectbyid d v= d.idD==v;;
|
1276
1276
|
|
1277
|
-
fun cbnetdns msg mac ipfrom=
|
1277
|
+
fun cbnetdns msg mac ipfrom=
|
1278
1278
|
let strgetword msg 0 -> id in
|
1279
1279
|
let parsemsg msg -> ip in
|
1280
1280
|
let hd select ldnsreq id #selectbyid -> x in
|
@@ -1359,8 +1359,8 @@ fun tcpread cnx input httpreq=
|
|
1359
1359
|
|
1360
1360
|
// callback d'�criture sur la socket d'une requ�te
|
1361
1361
|
fun tcpwrite cnx httpreq=
|
1362
|
-
set httpreq.stateH=HTTP_CONNECTED;
|
1363
|
-
set httpreq.aliveH=time_ms;
|
1362
|
+
set httpreq.stateH=HTTP_CONNECTED;
|
1363
|
+
set httpreq.aliveH=time_ms;
|
1364
1364
|
if httpreq.outputH!=nil then // s'il y a des choses � envoyer (notamment la premi�re fois)
|
1365
1365
|
(
|
1366
1366
|
set httpreq.indexH=writetcp cnx httpreq.outputH httpreq.indexH; // envoyer ce qui peut l'�tre
|
@@ -1456,7 +1456,7 @@ fun httpinactive httpreq = time_ms-httpreq.aliveH;;
|
|
1456
1456
|
|
1457
1457
|
var http_sep="\13\n\13\n";; // s�parateur entre l'en-t�te et le corps de la r�ponse � une requ�te
|
1458
1458
|
|
1459
|
-
|
1459
|
+
|
1460
1460
|
|
1461
1461
|
//##> retourne le header d'une r�ponse � une requ�te
|
1462
1462
|
fun httpgetheader res =
|
@@ -1649,7 +1649,7 @@ fun _wavplaycb i =
|
|
1649
1649
|
if !wav_buffering then
|
1650
1650
|
let hd wav_fifo -> sample in
|
1651
1651
|
let strlen sample -> len in
|
1652
|
-
(
|
1652
|
+
(
|
1653
1653
|
// push sample data
|
1654
1654
|
// wav_index is the index within the current sample.
|
1655
1655
|
if wav_index<len then (
|
@@ -1702,7 +1702,7 @@ fun itobin4 i=strcatlist (ctoa i)::(ctoa i>>8)::(ctoa i>>16)::(ctoa i>>24)::nil;
|
|
1702
1702
|
fun itobin2 i=strcatlist (ctoa i)::(ctoa i>>8)::nil;;
|
1703
1703
|
|
1704
1704
|
fun mkwav freq channel bps=
|
1705
|
-
let strcatlist
|
1705
|
+
let strcatlist
|
1706
1706
|
"WAVEfmt "::(itobin4 0x12)::
|
1707
1707
|
(itobin2 1)::(itobin2 channel)::
|
1708
1708
|
(itobin4 freq)::(itobin4 freq*channel*bps/8)::
|
@@ -1899,7 +1899,7 @@ fun earDetectRun=
|
|
1899
1899
|
set earsmode=EARSMODE_WAITANDDETECT
|
1900
1900
|
)
|
1901
1901
|
);;
|
1902
|
-
|
1902
|
+
|
1903
1903
|
fun earResetRun=
|
1904
1904
|
for i=0;i<2 do let ears.i -> e in
|
1905
1905
|
if e.dirE then
|
@@ -2029,12 +2029,12 @@ fun earGo i p d=
|
|
2029
2029
|
Secho "earGo ";Iecho i; Secholn " broken !";
|
2030
2030
|
nil
|
2031
2031
|
)
|
2032
|
-
else
|
2032
|
+
else
|
2033
2033
|
if p!=earTarget i then //v16 add start
|
2034
2034
|
(
|
2035
2035
|
Secho "earGo ";Iecho i; Secho " to ";Iecho p;Secho " dir ";Iecholn d;
|
2036
|
-
set e.targetE=earCheck p;
|
2037
|
-
set e.targetLoopE=earLoopCount p 0;
|
2036
|
+
set e.targetE=earCheck p;
|
2037
|
+
set e.targetLoopE=earLoopCount p 0;
|
2038
2038
|
Secho "targetE=";Iecho e.targetE; Secho " targetLoopE="; Iecholn e.targetLoopE;
|
2039
2039
|
if e.posE==e.targetE then
|
2040
2040
|
if e.targetLoopE==0 then
|
@@ -2231,7 +2231,7 @@ fun infoRun=
|
|
2231
2231
|
led 3 0; led 2 0; led 1 0
|
2232
2232
|
)
|
2233
2233
|
);;
|
2234
|
-
|
2234
|
+
|
2235
2235
|
// fonction de mise � jour de infosrc (appel� par la boucle de r�ception des messages du serveur '_pingcbhttp')
|
2236
2236
|
fun infoUpdate data=
|
2237
2237
|
let strlen data -> len in
|
@@ -2244,11 +2244,11 @@ fun infoGet_ i typ=
|
|
2244
2244
|
else infoGet_ i+1 typ;;
|
2245
2245
|
|
2246
2246
|
// Retourne la valeur du type de service donn�.
|
2247
|
-
// Attention : gestion sp�ciale du type taichi (TYPE_taichi). Il semble que le serveur permette au lapin de faire du taichi en donnant
|
2247
|
+
// Attention : gestion sp�ciale du type taichi (TYPE_taichi). Il semble que le serveur permette au lapin de faire du taichi en donnant
|
2248
2248
|
// une valeur non nulle au service TYPE_taichi (14).
|
2249
2249
|
// En fait, cette fonction est utilis�e uniquement pour le taichi...
|
2250
2250
|
fun infoGet typ=infoGet_ 0 typ;;
|
2251
|
-
|
2251
|
+
|
2252
2252
|
|
2253
2253
|
|
2254
2254
|
}
|
@@ -2504,14 +2504,14 @@ fun wifiConnected= match wifi with (stationW -> 1)|(_ -> 0);;
|
|
2504
2504
|
|
2505
2505
|
|
2506
2506
|
|
2507
|
-
ifdef NOMINAL {
|
2507
|
+
ifdef NOMINAL {
|
2508
2508
|
|
2509
2509
|
var TYPE_taichi=14;;
|
2510
2510
|
|
2511
2511
|
var tab_osc={
|
2512
|
-
0 0 0 0 0 0 1 1 2 3 3 4 5 6 7 8
|
2513
|
-
9 10 12 13 15 16 18 19 21 23 25 27 29 31 33 35
|
2514
|
-
37 39 42 44 46 49 51 54 56 59 62 64 67 70 73 76
|
2512
|
+
0 0 0 0 0 0 1 1 2 3 3 4 5 6 7 8
|
2513
|
+
9 10 12 13 15 16 18 19 21 23 25 27 29 31 33 35
|
2514
|
+
37 39 42 44 46 49 51 54 56 59 62 64 67 70 73 76
|
2515
2515
|
79 81 84 87 90 93 96 99 103 106 109 112 115 118 121 124
|
2516
2516
|
};;
|
2517
2517
|
|
@@ -4320,7 +4320,7 @@ fun rscfrommsg l=
|
|
4320
4320
|
if (!strcmp key "MU") || (!strcmp key "CH") then [val /*nil*/300000]::rscfrommsg tl l
|
4321
4321
|
else if (!strcmp key "MC") then [val SIGNCUTSIZE]::rscfrommsg tl l
|
4322
4322
|
else rscfrommsg tl l;;
|
4323
|
-
|
4323
|
+
|
4324
4324
|
|
4325
4325
|
|
4326
4326
|
var paletteselected = 0;;
|
@@ -4393,7 +4393,7 @@ fun msgInitialize messageList=
|
|
4393
4393
|
fun msgsStart=
|
4394
4394
|
// Starts playing the messages
|
4395
4395
|
// setleds 0xff0000;
|
4396
|
-
|
4396
|
+
|
4397
4397
|
// Si la palette est definie pour ce message, alors on ne met pas l'aleatoire
|
4398
4398
|
if(paletteselected==0) then
|
4399
4399
|
(
|
@@ -4436,7 +4436,7 @@ fun _rscLoadCBhttp http res maxsize=
|
|
4436
4436
|
let hd rsctoget ->[url _] in
|
4437
4437
|
// remember rsc loaded
|
4438
4438
|
set rscloaded=[url tl rev rsctmp nil]::rscloaded;
|
4439
|
-
|
4439
|
+
|
4440
4440
|
// load next rsc
|
4441
4441
|
set rsctoget=tl rsctoget;
|
4442
4442
|
set run=rscLoadNextRun;
|
@@ -4487,7 +4487,7 @@ fun callPingRequest aSenddata=
|
|
4487
4487
|
set run=pingRequestWaitRun httprequest "GET" Secholn pingurl nil #_pingcbhttp HTTP_NORMAL
|
4488
4488
|
);
|
4489
4489
|
0;;
|
4490
|
-
|
4490
|
+
|
4491
4491
|
fun runPingRequestWait http=
|
4492
4492
|
// Attente du retour de ping
|
4493
4493
|
// check timeout and retry
|
@@ -4603,8 +4603,7 @@ fun runrecord=
|
|
4603
4603
|
let recriff -> wavfile in
|
4604
4604
|
(
|
4605
4605
|
set recorddata=strcatlist wavfile;
|
4606
|
-
set recordretry=3;
|
4607
|
-
set recordplayend=time_ms+400;
|
4606
|
+
//set recordretry=3;
|
4608
4607
|
if (gInteractiveApp == nil) then (
|
4609
4608
|
set recordreq=httprequest "POST" Secholn recordurl recordmode recorddata #_cbrecordhttp HTTP_NORMAL;
|
4610
4609
|
set run=stdWaitRun time+recorddelay;0
|
@@ -4684,7 +4683,7 @@ fun msgendchor i0=
|
|
4684
4683
|
fun runmsgchor i0=
|
4685
4684
|
// Secho "runmsgchor i:";Iecho chorindex; Secho " t:";Iecholn chornexttime;
|
4686
4685
|
// Manage buffering and pauses
|
4687
|
-
|
4686
|
+
|
4688
4687
|
if (!chor_paused && wav_buffering) then (
|
4689
4688
|
// start pause
|
4690
4689
|
set chor_paused_since = time_ms;
|
@@ -4695,7 +4694,7 @@ fun runmsgchor i0=
|
|
4695
4694
|
// increment paused_dur
|
4696
4695
|
set chor_paused_dur = chor_paused_dur + (time_ms - chor_paused_since)
|
4697
4696
|
);
|
4698
|
-
|
4697
|
+
|
4699
4698
|
if (!chor_paused) then
|
4700
4699
|
if time_ms-chor_paused_dur >= chornexttime then
|
4701
4700
|
(
|
@@ -4750,7 +4749,7 @@ fun runmsgchor i0=
|
|
4750
4749
|
2
|
4751
4750
|
)
|
4752
4751
|
// v17
|
4753
|
-
else if code== CH_set_led_off then
|
4752
|
+
else if code== CH_set_led_off then
|
4754
4753
|
(
|
4755
4754
|
Secholn "CH_set_led_off ";
|
4756
4755
|
led 4-strget chordata chorindex+1 0;
|
@@ -4824,10 +4823,10 @@ fun _cbtaichiend unused=
|
|
4824
4823
|
0
|
4825
4824
|
)
|
4826
4825
|
;;
|
4827
|
-
|
4826
|
+
|
4828
4827
|
fun taichistart=
|
4829
4828
|
Secho "taichistart ";
|
4830
|
-
|
4829
|
+
|
4831
4830
|
set chorrandom=((Iecholn rand&255)*30)>>8;
|
4832
4831
|
Secho "chorrandom="; Iecholn chorrandom;
|
4833
4832
|
set chortaichimotordir={0 0};
|
@@ -4853,10 +4852,10 @@ fun interactiveStart application=
|
|
4853
4852
|
set gInteractiveApp = application;
|
4854
4853
|
|
4855
4854
|
reset_IC;
|
4856
|
-
|
4855
|
+
|
4857
4856
|
// oreilles vers l'avant
|
4858
4857
|
(earGo 0 3 0; earGo 1 3 0);
|
4859
|
-
|
4858
|
+
|
4860
4859
|
// jingle
|
4861
4860
|
controlsound midi_startInteractive;
|
4862
4861
|
msgchorstart chordef_startInteractive::nil #_cbContinueStartInteractive nil;
|
@@ -4864,13 +4863,13 @@ fun interactiveStart application=
|
|
4864
4863
|
0;;
|
4865
4864
|
|
4866
4865
|
fun _cbContinueStartInteractive unused=
|
4867
|
-
|
4866
|
+
|
4868
4867
|
// ask for instructions
|
4869
4868
|
set run=interactiveReqWaitRun (httprequest "GET" (interactifurl_start gInteractiveApp) nil #_interactiveReqCBhttp HTTP_NORMAL);
|
4870
|
-
|
4869
|
+
|
4871
4870
|
// forget currentTrameID so that the next ping does not send it
|
4872
4871
|
set currentTrameID = 0;
|
4873
|
-
|
4872
|
+
|
4874
4873
|
0;;
|
4875
4874
|
|
4876
4875
|
fun interactiveError=
|
@@ -4882,7 +4881,7 @@ fun interactiveError=
|
|
4882
4881
|
fun _cbContinueErrorInteractive unused=
|
4883
4882
|
interactiveStop;
|
4884
4883
|
0;;
|
4885
|
-
|
4884
|
+
|
4886
4885
|
fun interactiveStop=
|
4887
4886
|
// jingle de fin
|
4888
4887
|
controlsound midi_endInteractive;
|
@@ -4946,7 +4945,7 @@ fun earDeltaPosNormalized deltaPos=
|
|
4946
4945
|
if (deltaPos > EARS_HOLES>>1) then deltaPos - EARS_HOLES
|
4947
4946
|
else if (deltaPos < -EARS_HOLES>>1) then deltaPos + EARS_HOLES
|
4948
4947
|
else deltaPos;;
|
4949
|
-
|
4948
|
+
|
4950
4949
|
fun interactiveNoteEarTouched eari curPos deltaPos=
|
4951
4950
|
// right = 0, left = 1
|
4952
4951
|
if (eari == 0 && (g_int_mask & MASK_EAR_RIGHT == 0)) || (eari == 1 && (g_int_mask & MASK_EAR_LEFT == 0)) then // active
|
@@ -4958,12 +4957,12 @@ fun interactiveNoteEarTouched eari curPos deltaPos=
|
|
4958
4957
|
set et.refPos_ET = curPos;
|
4959
4958
|
if ((earDeltaPosNormalized deltaPos) > 0) then set et.moveDir_ET = 0 else set et.moveDir_ET = 1;
|
4960
4959
|
set et.lastDV_ET = 0
|
4961
|
-
|
4960
|
+
|
4962
4961
|
) else if !et.turned_ET then
|
4963
4962
|
// was already moving and not turned yet : test turned
|
4964
4963
|
let (earDeltaPosNormalized (curPos - et.refPos_ET)) -> normalizedDV in (
|
4965
4964
|
Secho "NDV="; Iecho normalizedDV; Secho ",";
|
4966
|
-
|
4965
|
+
|
4967
4966
|
// Test 1 tour or stopped
|
4968
4967
|
if (et.moveDir_ET == 0 && normalizedDV >= 0 && et.lastDV_ET < 0) then
|
4969
4968
|
// if more than one tour forward : ok
|
@@ -4971,9 +4970,9 @@ fun interactiveNoteEarTouched eari curPos deltaPos=
|
|
4971
4970
|
else if (et.moveDir_ET == 1 && normalizedDV <= 0 && et.lastDV_ET > 0) then
|
4972
4971
|
// if more than one tour backward : ok
|
4973
4972
|
set et.turned_ET = 1;
|
4974
|
-
|
4973
|
+
|
4975
4974
|
Secho "TOUCH="; Iecho et.turned_ET; Secho ",";
|
4976
|
-
|
4975
|
+
|
4977
4976
|
set et.lastDV_ET = normalizedDV
|
4978
4977
|
)
|
4979
4978
|
);;
|
@@ -4989,7 +4988,7 @@ fun interactiveSendEarTouched lefttouch righttouch=
|
|
4989
4988
|
let wav_curplayedbytes -> readBytes in // controlsound resets wav_curplayedbytes so we cache it
|
4990
4989
|
(
|
4991
4990
|
if (lefttouch) then controlsound midi_precedent;
|
4992
|
-
if (righttouch) then controlsound midi_suivant;
|
4991
|
+
if (righttouch) then controlsound midi_suivant;
|
4993
4992
|
set run=interactiveReqWaitRun (httprequest "GET" (interactifurl_ear gInteractiveApp readBytes gCurrentAudioMsgIndex righttouch lefttouch) nil #_interactiveReqCBhttp HTTP_NORMAL)
|
4994
4993
|
);
|
4995
4994
|
0;;
|
@@ -5023,7 +5022,7 @@ fun _interactiveReqCBhttp http res=
|
|
5023
5022
|
|
5024
5023
|
if !recording then
|
5025
5024
|
evalTrame res;
|
5026
|
-
|
5025
|
+
|
5027
5026
|
0;;
|
5028
5027
|
|
5029
5028
|
// Interactive request wait : timeout
|
@@ -5035,7 +5034,7 @@ fun runInteractiveReqWait http=
|
|
5035
5034
|
(
|
5036
5035
|
Secholn "##timeout on runInteractiveReqWait";
|
5037
5036
|
httpabort http;
|
5038
|
-
|
5037
|
+
|
5039
5038
|
// error
|
5040
5039
|
interactiveError
|
5041
5040
|
);
|
@@ -5081,12 +5080,12 @@ fun eval_IC_msg val=
|
|
5081
5080
|
if (!strcmp icval "true") then set g_streaming_chor_enabled = 1
|
5082
5081
|
else set g_streaming_chor_enabled = 0;
|
5083
5082
|
0
|
5084
|
-
|
5083
|
+
|
5085
5084
|
) else if !strcmp ickey "int.mask" then (
|
5086
5085
|
// int.mask -> masque d'interruption pour le mode interactif
|
5087
5086
|
set g_int_mask = (atoi icval);
|
5088
5087
|
0
|
5089
|
-
|
5088
|
+
|
5090
5089
|
) else if !strcmp ickey "cookie" then (
|
5091
5090
|
// cookie -> cookie envoy� au serveur
|
5092
5091
|
set g_cookie = strcatlist "&c="::icval::nil;
|
@@ -5114,7 +5113,7 @@ fun eval_IC_msg val=
|
|
5114
5113
|
// A chaque pas de danse : tirer 3 couleurs au hazard dans la palette courante : tete, ventre, pied
|
5115
5114
|
// Si palette al�atoire : la changer � toutes les s�quences
|
5116
5115
|
// sinon, fix�e par le serveur.
|
5117
|
-
//
|
5116
|
+
//
|
5118
5117
|
var chorst_pasdedanse;;
|
5119
5118
|
var chorst_index;;
|
5120
5119
|
var chorst_tempo;;
|
@@ -5126,7 +5125,7 @@ var chorst_palettecolors = {0 0 0};;
|
|
5126
5125
|
// = 0 : � chaque chgt de seq (en myenne toutes les 2,5 minutes)
|
5127
5126
|
// = 1 : une fois sur 2 (soit en moyenne ttes les 5 minutes)
|
5128
5127
|
// = 2 : une fois sur 3 (soit en moyenne ttes les 7,5 minutes), etc...
|
5129
|
-
var chorst_oreille_chance;;
|
5128
|
+
var chorst_oreille_chance;;
|
5130
5129
|
|
5131
5130
|
// mouvement des leds et oreilles
|
5132
5131
|
fun dochorstream=
|
@@ -5136,7 +5135,7 @@ fun dochorstream=
|
|
5136
5135
|
// Secho "Sequence suivante ";
|
5137
5136
|
|
5138
5137
|
// ears enabled ?
|
5139
|
-
if (g_streaming_chor_enabled) then
|
5138
|
+
if (g_streaming_chor_enabled) then
|
5140
5139
|
(
|
5141
5140
|
// movements moteur
|
5142
5141
|
// toutes les chorst_oreille_chance fois en moyenne
|
@@ -5145,7 +5144,7 @@ fun dochorstream=
|
|
5145
5144
|
(
|
5146
5145
|
// une des oreilles en haut, une autre en bas : radio...
|
5147
5146
|
if ((random 2) == 1) then (earGo 0 0 0; earGo 1 10 0) else (earGo 0 10 0; earGo 1 0 0);
|
5148
|
-
|
5147
|
+
|
5149
5148
|
// initialisation chorst_oreille_chance
|
5150
5149
|
set chorst_oreille_chance = 0
|
5151
5150
|
|
@@ -5157,12 +5156,12 @@ fun dochorstream=
|
|
5157
5156
|
let listnth ear4Positions rand&3 -> p in earGo 0 p 0;
|
5158
5157
|
let listnth ear4Positions rand&3 -> p in earGo 1 p 0
|
5159
5158
|
);
|
5160
|
-
|
5159
|
+
|
5161
5160
|
// de moins en moins souvent, puis de nouveau souvent, etc..
|
5162
5161
|
if ((set chorst_oreille_chance = chorst_oreille_chance + 1) > 4) then set chorst_oreille_chance = 0
|
5163
5162
|
)
|
5164
5163
|
);
|
5165
|
-
|
5164
|
+
|
5166
5165
|
// choix d'une s�quence = pas de danse (chorst_pasdedanse), tempo et nb de boucles
|
5167
5166
|
set chorst_pasdedanse = listnth chorstream_chorslist Iecholn rand&3;
|
5168
5167
|
|
@@ -5171,24 +5170,24 @@ fun dochorstream=
|
|
5171
5170
|
//Secho "tempo "; Iecholn chorst_tempo;
|
5172
5171
|
set chorst_loops=3+random 18; // entre 3 et 20 (inclus)
|
5173
5172
|
//Secho "loops "; Iecholn chorst_loops;
|
5174
|
-
|
5173
|
+
|
5175
5174
|
if (current_palette_is_random) then
|
5176
5175
|
// changer palette courante
|
5177
5176
|
set_current_palette random 7;
|
5178
|
-
|
5177
|
+
|
5179
5178
|
// choisir 3 couleurs au hasard dans la palette
|
5180
5179
|
set chorst_palettecolors={(random 7) (random 7) (random 7)};
|
5181
|
-
|
5180
|
+
|
5182
5181
|
set chorst_nexttime=time_ms
|
5183
|
-
|
5182
|
+
|
5184
5183
|
);
|
5185
|
-
|
5184
|
+
|
5186
5185
|
// continuer � jouer
|
5187
5186
|
while (chorst_index < strlen chorst_pasdedanse) && time_ms >= chorst_nexttime do
|
5188
5187
|
(
|
5189
5188
|
// interpr�te la choragraphie. Uniquement des set_led_palette et des set_led_off et des set_led_color
|
5190
|
-
|
5191
|
-
let strget chorst_pasdedanse chorst_index -> cmd in
|
5189
|
+
|
5190
|
+
let strget chorst_pasdedanse chorst_index -> cmd in
|
5192
5191
|
// avance l'index de...
|
5193
5192
|
set chorst_index=chorst_index+2+
|
5194
5193
|
if (cmd == CH_set_led_palette) then
|
@@ -5197,7 +5196,7 @@ fun dochorstream=
|
|
5197
5196
|
let strget chorst_pasdedanse chorst_index+1 -> iled in
|
5198
5197
|
let strget chorst_pasdedanse chorst_index+2 -> icol in
|
5199
5198
|
let chorst_palettecolors.(3&icol) -> palcol in
|
5200
|
-
// jouer la LED
|
5199
|
+
// jouer la LED
|
5201
5200
|
led iled current_palette.palcol;
|
5202
5201
|
|
5203
5202
|
// 2 bytes : led, color
|
@@ -5208,17 +5207,17 @@ fun dochorstream=
|
|
5208
5207
|
// off
|
5209
5208
|
let strget chorst_pasdedanse chorst_index+1 -> iled in
|
5210
5209
|
led iled 0;
|
5211
|
-
|
5210
|
+
|
5212
5211
|
// 1 byte : led
|
5213
5212
|
1
|
5214
5213
|
)
|
5215
5214
|
else if (cmd == CH_set_led_color) then
|
5216
5215
|
(
|
5217
5216
|
led strget chorst_pasdedanse chorst_index+1
|
5218
|
-
((strget chorst_pasdedanse chorst_index+2)<<16) +
|
5219
|
-
((strget chorst_pasdedanse chorst_index+3)<<8) +
|
5217
|
+
((strget chorst_pasdedanse chorst_index+2)<<16) +
|
5218
|
+
((strget chorst_pasdedanse chorst_index+3)<<8) +
|
5220
5219
|
((strget chorst_pasdedanse chorst_index+4));
|
5221
|
-
|
5220
|
+
|
5222
5221
|
// 6 bytes : 2 qui ne servent � rien
|
5223
5222
|
6
|
5224
5223
|
)
|
@@ -5233,8 +5232,8 @@ fun dochorstream=
|
|
5233
5232
|
// probl�me : commande inconnue : forcer � recommencer au d�but en incr�mentant beaucoup trop
|
5234
5233
|
Secho "dochorstream : unknown command, restarting dance"; Iecholn cmd;
|
5235
5234
|
strlen chorst_pasdedanse
|
5236
|
-
);
|
5237
|
-
|
5235
|
+
);
|
5236
|
+
|
5238
5237
|
// pas de danse fini ?
|
5239
5238
|
if (chorst_index>=strlen chorst_pasdedanse) then
|
5240
5239
|
(
|
@@ -5247,21 +5246,21 @@ fun dochorstream=
|
|
5247
5246
|
// recommencer pas de danse
|
5248
5247
|
set chorst_index=4+1; // on saute le header (4 bytes)
|
5249
5248
|
// tout de suite
|
5250
|
-
set chorst_nexttime=time_ms;
|
5251
|
-
|
5249
|
+
set chorst_nexttime=time_ms;
|
5250
|
+
|
5252
5251
|
0 // pour avoir le m�me type de return value que les autres branches du if...
|
5253
5252
|
|
5254
5253
|
) // sinon on laisse chorst_loops = 0 et chorst_index trop loin, ce qui force un passage � la s�q suivante
|
5255
|
-
|
5256
|
-
) else
|
5254
|
+
|
5255
|
+
) else
|
5257
5256
|
// date de la prochaine commande
|
5258
5257
|
// note : on repart de time_ms, histoire de se caler sur le temps pr�sent et non pas sur le temps de
|
5259
5258
|
// la chor�graphie, sinon, on a des coups de speed car cette fonction n'est pas toujours appel�e de mani�re r�guli�re.
|
5260
5259
|
let strget chorst_pasdedanse chorst_index-1 -> delay in
|
5261
5260
|
set chorst_nexttime = time_ms+delay*chorst_tempo
|
5262
|
-
|
5261
|
+
|
5263
5262
|
);
|
5264
|
-
|
5263
|
+
|
5265
5264
|
0;;
|
5266
5265
|
|
5267
5266
|
// Pour savoir si on passe en mode sleep.
|
@@ -5301,14 +5300,14 @@ fun runmsgchorstreaming iTimeTime=
|
|
5301
5300
|
if wavrunning==0 then
|
5302
5301
|
(
|
5303
5302
|
// Fin du stream
|
5304
|
-
|
5303
|
+
|
5305
5304
|
// oreilles en haut
|
5306
5305
|
earGo 0 0 0;
|
5307
5306
|
earGo 1 0 0;
|
5308
|
-
|
5307
|
+
|
5309
5308
|
// next message
|
5310
5309
|
set run=msgEvalOne i0+1;
|
5311
|
-
|
5310
|
+
|
5312
5311
|
nil
|
5313
5312
|
)
|
5314
5313
|
else
|
@@ -5318,7 +5317,7 @@ fun runmsgchorstreaming iTimeTime=
|
|
5318
5317
|
|
5319
5318
|
// ping sp�cial toutes les minutes pour v�rifier le sleep
|
5320
5319
|
// don't ping if interactive mode
|
5321
|
-
if (gInteractiveApp == nil) then
|
5320
|
+
if (gInteractiveApp == nil) then
|
5322
5321
|
if (time-ping0)>STREAMING_PING then
|
5323
5322
|
(
|
5324
5323
|
update iTimeTime with [_ _ time];
|
@@ -5346,7 +5345,7 @@ fun _cbWavError=
|
|
5346
5345
|
fun runEvalOneMsg i0=
|
5347
5346
|
// Secho "runEvalOneMsg ";Iecholn i0;
|
5348
5347
|
interactiveResetEarsTouched;
|
5349
|
-
|
5348
|
+
|
5350
5349
|
let listnth gCurrentMessageList i0 -> [key val] in
|
5351
5350
|
if (Secholn key)==nil then
|
5352
5351
|
(
|
@@ -5432,7 +5431,7 @@ fun runEvalOneMsg i0=
|
|
5432
5431
|
(
|
5433
5432
|
set AskR = 1;
|
5434
5433
|
wavstop;
|
5435
|
-
earStop;
|
5434
|
+
earStop;
|
5436
5435
|
_controlrecord 2;
|
5437
5436
|
0
|
5438
5437
|
)*/
|
@@ -5442,7 +5441,7 @@ fun runEvalOneMsg i0=
|
|
5442
5441
|
if !strcmp key "CL" then
|
5443
5442
|
let atoi val -> x in set_current_palette_color (x>>24) x&0xffffff;
|
5444
5443
|
if !strcmp key "IC" then eval_IC_msg val;
|
5445
|
-
|
5444
|
+
|
5446
5445
|
// and skip command
|
5447
5446
|
set run=msgEvalOne i0+1;
|
5448
5447
|
runEvalOneMsg i0+1
|
@@ -5510,10 +5509,10 @@ fun evalTrame res=
|
|
5510
5509
|
(
|
5511
5510
|
// analyse each trame
|
5512
5511
|
Iecho code; Secho " : ";
|
5513
|
-
|
5512
|
+
|
5514
5513
|
// ping delay
|
5515
5514
|
if code==3 then set pingdelay=Iecholn (strget val 0)*1;
|
5516
|
-
|
5515
|
+
|
5517
5516
|
// update sources (services) and ears desired positions
|
5518
5517
|
if code==4 then
|
5519
5518
|
(
|
@@ -5529,7 +5528,7 @@ fun evalTrame res=
|
|
5529
5528
|
set extright=newright
|
5530
5529
|
)
|
5531
5530
|
);
|
5532
|
-
|
5531
|
+
|
5533
5532
|
// messages (or IDLE or SLEEP)
|
5534
5533
|
if code==10 then
|
5535
5534
|
(
|
@@ -5537,7 +5536,7 @@ fun evalTrame res=
|
|
5537
5536
|
set messageList=dumpconfig filterconfig val 1;
|
5538
5537
|
0
|
5539
5538
|
);
|
5540
|
-
|
5539
|
+
|
5541
5540
|
// reboot
|
5542
5541
|
if code==9 then
|
5543
5542
|
(
|
@@ -5546,7 +5545,7 @@ fun evalTrame res=
|
|
5546
5545
|
);
|
5547
5546
|
0
|
5548
5547
|
); // for l=framelist
|
5549
|
-
|
5548
|
+
|
5550
5549
|
// post process : message or not ?
|
5551
5550
|
if messageList==nil then
|
5552
5551
|
(
|
@@ -5618,7 +5617,7 @@ var gWasNetActivity = 0;;
|
|
5618
5617
|
|
5619
5618
|
fun noseled=
|
5620
5619
|
if !earDetecting then
|
5621
|
-
// led tete clignote if netactivity or wav_buffering //
|
5620
|
+
// led tete clignote if netactivity or wav_buffering //
|
5622
5621
|
let uploading || (match run with (rscLoadWaitRun _-> 1)|(pingRequestWaitRun _-> 1)|(interactiveReqWaitRun _->1)|(_->0)) -> netactivity in
|
5623
5622
|
if (netactivity || wav_buffering) then (
|
5624
5623
|
let if netactivity then 256 else if wav_buffering then 128 else 0 -> speed in
|
@@ -5636,7 +5635,7 @@ fun bottomled=
|
|
5636
5635
|
if ((time-lasthttpevent)>LED_TIMEOUT) then led 4 0xff00ff // bloqu�
|
5637
5636
|
else (let osc time_ms>>4 -> v in led 4 v*0x10001); // pulse violet
|
5638
5637
|
0;;
|
5639
|
-
|
5638
|
+
|
5640
5639
|
|
5641
5640
|
// ********** RFID **********************
|
5642
5641
|
// v19 Am�lioration de la lecteure RFID
|
@@ -5648,7 +5647,7 @@ var RFIDchek = 0;; // v19
|
|
5648
5647
|
var RFIDlast = 0;; // v19
|
5649
5648
|
|
5650
5649
|
var tmptps = 0;;
|
5651
|
-
|
5650
|
+
|
5652
5651
|
fun _cbrfidhttp http res=
|
5653
5652
|
Secholn res;
|
5654
5653
|
set RFIDchek = 0;
|
@@ -5674,7 +5673,7 @@ fun ParseRfid id = // v19
|
|
5674
5673
|
fun controlrfid= //v19
|
5675
5674
|
// let hd dumprfid rfidGetList -> rfid in
|
5676
5675
|
if (gInteractiveApp == nil) then // disabled when interactive
|
5677
|
-
let rfidGet -> rfid in
|
5676
|
+
let rfidGet -> rfid in
|
5678
5677
|
if (strcmp rfid lastrfid) && (RFIDchek == 0) && (time_ms - RFIDlast > 750) then
|
5679
5678
|
(
|
5680
5679
|
if ((time_ms - RFIDlast) > 1000) then set lastrfid = "0000000";
|
@@ -5686,11 +5685,11 @@ fun controlrfid= //v19
|
|
5686
5685
|
set RFIDchek = 1;
|
5687
5686
|
set RFIDlast = time_ms;
|
5688
5687
|
controlsound midi_RFIDok;
|
5689
|
-
|
5688
|
+
|
5690
5689
|
// lancer l'animation (v19)
|
5691
5690
|
msgchorstart chor_RFIDok::nil nil nil;
|
5692
|
-
set chortimescale=10; // recopi� d'avant, mas pourquoi ? N�cessaire ? [AS 24oct07]
|
5693
|
-
|
5691
|
+
set chortimescale=10; // recopi� d'avant, mas pourquoi ? N�cessaire ? [AS 24oct07]
|
5692
|
+
|
5694
5693
|
httprequest "GET" rfidurl rfid nil #_cbrfidhttp HTTP_NORMAL
|
5695
5694
|
)
|
5696
5695
|
)
|
@@ -5733,7 +5732,7 @@ fun controlinteractif=
|
|
5733
5732
|
(
|
5734
5733
|
Secholn "controlinteractif";
|
5735
5734
|
if ev==BUTTON_CLIC || ev==BUTTON_DCLIC then (
|
5736
|
-
if (g_int_mask&MASK_BUTTON == 0) then interactiveSendBtn ev
|
5735
|
+
if (g_int_mask&MASK_BUTTON == 0) then interactiveSendBtn ev
|
5737
5736
|
|
5738
5737
|
) else if ev==BUTTON_LCLIC then (
|
5739
5738
|
if (g_record_enabled) then (
|
@@ -5743,7 +5742,7 @@ fun controlinteractif=
|
|
5743
5742
|
) else (
|
5744
5743
|
// like BUTTON_CLIC
|
5745
5744
|
set ev = BUTTON_CLIC;
|
5746
|
-
if (g_int_mask&MASK_BUTTON == 0) then interactiveSendBtn ev
|
5745
|
+
if (g_int_mask&MASK_BUTTON == 0) then interactiveSendBtn ev
|
5747
5746
|
)
|
5748
5747
|
)
|
5749
5748
|
)
|