nabaztag_hack_kit 0.1.0.alpha6 → 0.1.0.alpha7
Sign up to get free protection for your applications and to get access to all the features.
- data/bytecode/lib/init.mtl +18 -0
- data/bytecode/lib/playback.mtl +77 -14
- data/bytecode/main.mtl +8 -8
- data/lib/nabaztag_hack_kit/message/helper.rb +1 -1
- data/lib/nabaztag_hack_kit/version.rb +1 -1
- metadata +11 -10
@@ -0,0 +1,18 @@
|
|
1
|
+
//###############################################
|
2
|
+
//------------------ INIT ----------------------
|
3
|
+
|
4
|
+
var inited = 0;;
|
5
|
+
|
6
|
+
fun initUrl =
|
7
|
+
strcatlist confGetServerUrl::apiPath::"/init.jsp?"::nil;;
|
8
|
+
|
9
|
+
//-------------------------------------------------------------
|
10
|
+
|
11
|
+
fun initCheck=
|
12
|
+
if inited == 0 then
|
13
|
+
(
|
14
|
+
httprequest "GET" initUrl "" #_cbHttp HTTP_NORMAL;
|
15
|
+
set inited = 1
|
16
|
+
)
|
17
|
+
;;
|
18
|
+
|
data/bytecode/lib/playback.mtl
CHANGED
@@ -10,24 +10,87 @@ fun playbackLoadFinishedUrl =
|
|
10
10
|
fun streamUrl filename=
|
11
11
|
strcatlist confGetServerUrl::"/streams/"::filename::nil;;
|
12
12
|
|
13
|
-
|
13
|
+
const PLAY_IDLE = 0;;
|
14
|
+
const PLAY_RUN = 1;;
|
15
|
+
//const WAV_EOF=2;;
|
14
16
|
|
15
|
-
//
|
16
|
-
|
17
|
+
//var wav_http;;
|
18
|
+
var playback_fifo = nil;;
|
19
|
+
var playback_load_fifo;;
|
20
|
+
var playback_state = 0;;
|
21
|
+
var play_index = 0;;
|
17
22
|
|
18
|
-
//
|
19
|
-
|
23
|
+
//wat is this for!??
|
24
|
+
var wav_zeros;;
|
25
|
+
fun wavgetzeros=
|
26
|
+
if wav_zeros==nil then
|
27
|
+
(
|
28
|
+
set wav_zeros=strnew 2048;
|
29
|
+
for i=0;i<2048 do strset wav_zeros i 0
|
30
|
+
);
|
31
|
+
wav_zeros;;
|
20
32
|
|
21
|
-
// fun _playbackLoadCB httpreq req=
|
22
|
-
// if req != nil then
|
23
|
-
// (
|
24
|
-
// set wav_fifo=conc playback_fifo req::nil;
|
25
|
-
// )
|
26
|
-
// ;;
|
27
33
|
|
34
|
+
fun playbackStop =
|
35
|
+
if playback_state != PLAY_IDLE then
|
36
|
+
(
|
37
|
+
playStop;
|
38
|
+
// if wav_http != nil then httpabort wav_http;
|
39
|
+
// set wav_http = nil;
|
40
|
+
// set wav_buffering = 0;
|
41
|
+
set playback_state = PLAY_IDLE
|
42
|
+
);
|
43
|
+
0;;
|
28
44
|
|
29
|
-
// fun
|
30
|
-
//
|
31
|
-
//
|
45
|
+
// fun _playbackStart =
|
46
|
+
// set wav_index = 0;
|
47
|
+
// set wav_buffering = 1;
|
48
|
+
// set wav_buffering_since = time_ms;
|
49
|
+
// playStart 1024 #_wavplaycb;
|
50
|
+
// 0;;
|
51
|
+
|
52
|
+
fun _playbackCB i=
|
53
|
+
let hd playback_fifo -> sample in
|
54
|
+
let strlen sample -> len in
|
55
|
+
(
|
56
|
+
if play_index < len then (
|
57
|
+
// send some bytes to the VM buffer.
|
58
|
+
let (playFeed sample play_index nil) -> pushedbytes in
|
59
|
+
(
|
60
|
+
// this is how many bytes we sent.
|
61
|
+
set play_index = play_index + pushedbytes
|
62
|
+
)
|
63
|
+
)
|
64
|
+
);
|
65
|
+
0;;
|
66
|
+
|
67
|
+
fun _playbackStart play_data=
|
68
|
+
playbackStop;
|
69
|
+
//set wav_end_timeout = timeout;
|
70
|
+
set playback_fifo = conc play_data wavgetzeros::nil;
|
71
|
+
playStart 1024 #_playbackCB;
|
72
|
+
// set playback_state = WAV_EOF;
|
73
|
+
// set wav_lasttime = time_ms;
|
74
|
+
// set wav_http = nil;
|
75
|
+
set play_index = 0;
|
76
|
+
// set wav_buffering=1;
|
77
|
+
// set wav_buffering_since = time_ms;
|
78
|
+
0;;
|
79
|
+
|
80
|
+
fun playbackStart =
|
81
|
+
_playbackStart playback_load_fifo;;
|
82
|
+
|
83
|
+
//-------------- LOAD
|
84
|
+
fun _playbackLoadCB httpreq req=
|
85
|
+
if req != nil then
|
86
|
+
(
|
87
|
+
set playback_load_fifo = conc playback_load_fifo req::nil
|
88
|
+
);
|
89
|
+
0;;
|
90
|
+
|
91
|
+
fun playbackLoad val=
|
92
|
+
set playback_load_fifo = nil;
|
93
|
+
httprequest "GET" (streamUrl val) nil #_playbackLoadCB HTTP_NORMAL;
|
94
|
+
0;;
|
32
95
|
|
33
96
|
// fun playbackStream val=
|
data/bytecode/main.mtl
CHANGED
@@ -107,25 +107,23 @@ fun evalTrame res=
|
|
107
107
|
// play start
|
108
108
|
else if code == 60 then
|
109
109
|
(
|
110
|
-
|
111
|
-
0
|
110
|
+
playbackStart
|
112
111
|
)
|
113
112
|
// play stop
|
114
113
|
else if code == 61 then
|
115
114
|
(
|
116
|
-
|
117
|
-
0
|
115
|
+
playbackStop
|
118
116
|
)
|
119
117
|
// play load
|
120
118
|
else if code == 62 then
|
121
119
|
(
|
122
|
-
|
123
|
-
0
|
120
|
+
playbackLoad val
|
124
121
|
)
|
125
122
|
// play stream
|
126
123
|
else if code == 63 then
|
127
124
|
(
|
128
|
-
// playbackStream val
|
125
|
+
// playbackStream val;
|
126
|
+
wavstarthttp (streamUrl val) nil;
|
129
127
|
0
|
130
128
|
)
|
131
129
|
)
|
@@ -135,6 +133,8 @@ fun evalTrame res=
|
|
135
133
|
//###############################################
|
136
134
|
//-------------------- LOOP ---------------------
|
137
135
|
fun loop=
|
136
|
+
initCheck;
|
137
|
+
|
138
138
|
wifiRun;
|
139
139
|
wifiCheck;
|
140
140
|
|
@@ -146,7 +146,7 @@ fun loop=
|
|
146
146
|
earRead 1;
|
147
147
|
|
148
148
|
pingCheck;
|
149
|
-
wavtime;
|
149
|
+
//wavtime;
|
150
150
|
|
151
151
|
recordingCheck;
|
152
152
|
0;;
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nabaztag_hack_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.alpha7
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bytecode/bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-24 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
16
|
-
requirement: &
|
16
|
+
requirement: &70148636637240 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70148636637240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70148636636700 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70148636636700
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70148636636240 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70148636636240
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rack-test
|
49
|
-
requirement: &
|
49
|
+
requirement: &70148636635780 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70148636635780
|
58
58
|
description: Sinatra server api framework to run custom bytecode on Nabaztag v1/v2.
|
59
59
|
Sources + Compiler included (linux only)
|
60
60
|
email:
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- bytecode/lib/button.mtl
|
84
84
|
- bytecode/lib/data_helper.mtl
|
85
85
|
- bytecode/lib/ear.mtl
|
86
|
+
- bytecode/lib/init.mtl
|
86
87
|
- bytecode/lib/led.mtl
|
87
88
|
- bytecode/lib/logger.mtl
|
88
89
|
- bytecode/lib/ping.mtl
|