nabaztag_hack_kit 0.1.0.beta3 → 0.1.0.beta8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -2
- data/.gitmodules +3 -0
- data/.travis.yml +2 -2
- data/CHANGELOG.md +17 -2
- data/LICENSE +21 -0
- data/README.md +115 -44
- data/Rakefile +2 -6
- data/bytecode/{Commands.md → _docs/commands.md} +0 -0
- data/bytecode/{Docs.md → _docs/grammar.md} +0 -0
- data/bytecode/_docs/grammar.pdf +0 -0
- data/bytecode/{src → _original}/README.md +0 -0
- data/bytecode/{src → _original}/lib/arp.mtl +0 -0
- data/bytecode/{src → _original}/lib/cfg.mtl +0 -0
- data/bytecode/{src → _original}/lib/choreos.mtl +0 -0
- data/bytecode/{src → _original}/lib/dhcp.mtl +0 -0
- data/bytecode/{src → _original}/lib/dns.mtl +0 -0
- data/bytecode/{src → _original}/lib/http.mtl +0 -0
- data/bytecode/{src → _original}/lib/tcp.mtl +0 -0
- data/bytecode/{src → _original}/lib/udp.mtl +0 -0
- data/bytecode/{src → _original}/lib/util.mtl +0 -0
- data/bytecode/{src → _original}/lib/var.mtl +0 -0
- data/bytecode/{src → _original}/lib/wav.mtl +0 -0
- data/bytecode/{src → _original}/lib/wifi.mtl +0 -0
- data/bytecode/{src → _original}/nominal-ping.mtl +0 -0
- data/bytecode/main.mtl +11 -11
- data/bytecode/test/test.mtl +8 -8
- data/examples/basic/Gemfile +1 -3
- data/examples/basic/config.ru +14 -4
- data/examples/record/Gemfile +0 -5
- data/examples/record/{config.ru.example → config.ru} +2 -2
- data/examples/record/server.rb +0 -2
- data/ext/Makefile +10 -0
- data/ext/bin/mtl_comp +29 -0
- data/{bytecode → ext}/bin/mtl_merge +0 -0
- data/ext/bin/mtl_simu +29 -0
- data/{bytecode/src/mtl → ext}/extconf.rb +0 -0
- data/ext/mtl_linux/.gitignore +7 -0
- data/ext/mtl_linux/LICENSE +21 -0
- data/ext/mtl_linux/Makefile +116 -0
- data/ext/mtl_linux/MetalC.project +196 -0
- data/ext/mtl_linux/conf.bin +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux}/conf.bin.sans_password +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux}/config.txt +0 -0
- data/ext/mtl_linux/inc/log.h +21 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/properties.h +0 -0
- data/{bytecode/src/mtl/linux_simuaudio.h → ext/mtl_linux/inc/simu/linux/simuaudio.h} +0 -0
- data/{bytecode/src/mtl/linux_simunet.h → ext/mtl_linux/inc/simu/linux/simunet.h} +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/simu/win}/simuaudio.h +18 -18
- data/{bytecode/src/mtl → ext/mtl_linux/inc/simu/win}/simunet.h +0 -0
- data/ext/mtl_linux/inc/vcomp/compiler.h +200 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/file.h +11 -11
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/filesystem.h +0 -0
- data/ext/mtl_linux/inc/vcomp/interpreter.h +121 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/memory.h +120 -92
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/param.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/parser.h +27 -27
- data/ext/mtl_linux/inc/vcomp/prodbuffer.h +42 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/resource.h +1 -1
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/terminal.h +8 -8
- data/{bytecode/src/mtl → ext/mtl_linux/inc}/vcomp/util.h +7 -7
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vaudio.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vbc.h +1 -1
- data/ext/mtl_linux/inc/vm/vbc_str.h +167 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vinterp.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vloader.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vlog.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vmem.h +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/inc/vm}/vnet.h +0 -0
- data/ext/mtl_linux/nominal.mtl +3959 -0
- data/ext/mtl_linux/src/comp/main.cpp +123 -0
- data/ext/mtl_linux/src/simu/dumpbc.c +2566 -0
- data/ext/mtl_linux/src/simu/linux/main.cpp +288 -0
- data/ext/mtl_linux/src/simu/linux/simu.c +309 -0
- data/ext/mtl_linux/src/simu/linux/simuaudio.c +44 -0
- data/ext/mtl_linux/src/simu/linux/simunet.c +707 -0
- data/ext/mtl_linux/src/simu/log.c +340 -0
- data/ext/mtl_linux/src/simu/properties.c +368 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/GTKANAL.H +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/LAYER3.C +0 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/TABINIT.C +0 -0
- data/ext/mtl_linux/src/simu/win/mp3/common.c +302 -0
- data/ext/mtl_linux/src/simu/win/mp3/dct64_i386.c +316 -0
- data/ext/mtl_linux/src/simu/win/mp3/decode_i386.c +160 -0
- data/ext/mtl_linux/src/simu/win/mp3/huffman.h +332 -0
- data/ext/mtl_linux/src/simu/win/mp3/interface.c +276 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src/simu/win}/mp3/mpg123.h +34 -30
- data/ext/mtl_linux/src/simu/win/mp3/mpglib.h +47 -0
- data/ext/mtl_linux/src/simu/win/simu.c +819 -0
- data/ext/mtl_linux/src/simu/win/simuaudio.c +787 -0
- data/ext/mtl_linux/src/simu/win/simunet.c +489 -0
- data/ext/mtl_linux/src/vcomp/bootstrap.cpp +95 -0
- data/ext/mtl_linux/src/vcomp/compiler.cpp +587 -0
- data/ext/mtl_linux/src/vcomp/compiler_file.cpp +1253 -0
- data/ext/mtl_linux/src/vcomp/compiler_prog.cpp +437 -0
- data/ext/mtl_linux/src/vcomp/compiler_term.cpp +1500 -0
- data/ext/mtl_linux/src/vcomp/compiler_type.cpp +1238 -0
- data/ext/mtl_linux/src/vcomp/compiler_var.cpp +502 -0
- data/ext/mtl_linux/src/vcomp/file.cpp +100 -0
- data/ext/mtl_linux/src/vcomp/interpreter.cpp +93 -0
- data/ext/mtl_linux/src/vcomp/memory.cpp +313 -0
- data/ext/mtl_linux/src/vcomp/parser.cpp +584 -0
- data/ext/mtl_linux/src/vcomp/parser_xml.cpp +137 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src}/vcomp/prodbuffer.cpp +57 -36
- data/ext/mtl_linux/src/vcomp/stdlib_core.cpp +130 -0
- data/ext/mtl_linux/src/vcomp/terminal.cpp +80 -0
- data/{bytecode/src/mtl → ext/mtl_linux/src}/vcomp/util.cpp +18 -11
- data/ext/mtl_linux/src/vm/vaudio.c +830 -0
- data/ext/mtl_linux/src/vm/vinterp.c +1780 -0
- data/ext/mtl_linux/src/vm/vloader.c +139 -0
- data/ext/mtl_linux/src/vm/vlog.c +782 -0
- data/ext/mtl_linux/src/vm/vmem.c +461 -0
- data/ext/mtl_linux/src/vm/vnet.c +298 -0
- data/{bytecode/src/mtl → ext/mtl_linux}/utils/correct_const.sh +0 -0
- data/lib/nabaztag_hack_kit/server.rb +4 -7
- data/lib/nabaztag_hack_kit/version.rb +1 -1
- data/lib/nabaztag_hack_kit.rb +2 -2
- data/nabaztag_hack_kit.gemspec +10 -11
- data/spec/integration/server_spec.rb +3 -3
- data/spec/spec_helper.rb +2 -0
- data/spec/unit/message_spec.rb +12 -18
- data/spec/unit/server_spec.rb +13 -10
- metadata +145 -137
- data/bytecode/bin/mtl_comp +0 -50
- data/bytecode/bin/mtl_simu +0 -49
- data/bytecode/src/mtl/Makefile +0 -42
- data/bytecode/src/mtl/README.md +0 -13
- data/bytecode/src/mtl/bc.cpp +0 -1891
- data/bytecode/src/mtl/dumpbc.c +0 -2566
- data/bytecode/src/mtl/linux_simu.c +0 -271
- data/bytecode/src/mtl/linux_simuaudio.c +0 -16
- data/bytecode/src/mtl/linux_simunet.c +0 -620
- data/bytecode/src/mtl/log.c +0 -297
- data/bytecode/src/mtl/log.h +0 -20
- data/bytecode/src/mtl/main_compiler.cpp +0 -104
- data/bytecode/src/mtl/main_simu.cpp +0 -221
- data/bytecode/src/mtl/mp3/common.c +0 -265
- data/bytecode/src/mtl/mp3/dct64_i386.c +0 -316
- data/bytecode/src/mtl/mp3/decode_i386.c +0 -155
- data/bytecode/src/mtl/mp3/huffman.h +0 -332
- data/bytecode/src/mtl/mp3/interface.c +0 -258
- data/bytecode/src/mtl/mp3/mpglib.h +0 -44
- data/bytecode/src/mtl/properties.c +0 -293
- data/bytecode/src/mtl/simu.c +0 -750
- data/bytecode/src/mtl/simuaudio.c +0 -662
- data/bytecode/src/mtl/simunet.c +0 -400
- data/bytecode/src/mtl/vaudio.c +0 -677
- data/bytecode/src/mtl/vbc_str.h +0 -166
- data/bytecode/src/mtl/vcomp/Makefile +0 -29
- data/bytecode/src/mtl/vcomp/bootstrap.cpp +0 -89
- data/bytecode/src/mtl/vcomp/compiler.cpp +0 -470
- data/bytecode/src/mtl/vcomp/compiler.h +0 -200
- data/bytecode/src/mtl/vcomp/compiler_file.cpp +0 -929
- data/bytecode/src/mtl/vcomp/compiler_prog.cpp +0 -250
- data/bytecode/src/mtl/vcomp/compiler_term.cpp +0 -1053
- data/bytecode/src/mtl/vcomp/compiler_type.cpp +0 -872
- data/bytecode/src/mtl/vcomp/compiler_var.cpp +0 -289
- data/bytecode/src/mtl/vcomp/file.cpp +0 -79
- data/bytecode/src/mtl/vcomp/interpreter.cpp +0 -85
- data/bytecode/src/mtl/vcomp/interpreter.h +0 -121
- data/bytecode/src/mtl/vcomp/memory.cpp +0 -241
- data/bytecode/src/mtl/vcomp/parser.cpp +0 -427
- data/bytecode/src/mtl/vcomp/parser_xml.cpp +0 -124
- data/bytecode/src/mtl/vcomp/prodbuffer.h +0 -42
- data/bytecode/src/mtl/vcomp/stdlib_core.cpp +0 -122
- data/bytecode/src/mtl/vcomp/terminal.cpp +0 -73
- data/bytecode/src/mtl/vinterp.c +0 -1349
- data/bytecode/src/mtl/vloader.c +0 -127
- data/bytecode/src/mtl/vlog.c +0 -589
- data/bytecode/src/mtl/vmem.c +0 -424
- data/bytecode/src/mtl/vnet.c +0 -255
- data/examples/basic/Procfile +0 -2
- data/examples/basic/server.rb +0 -14
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fd395348ad5c455b3587202f9fbf9782259cf829
|
4
|
+
data.tar.gz: e23d930933234912c081a5425003577a0db51fd2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 896a8d1f950033dfa49494747a982a3c58fa4ac92565e44725effbaecdce2c39ac46b73a12a8975eeab9f0c7f34df1550577e69705cdcbdc8c43eb953e6643be
|
7
|
+
data.tar.gz: 14abe18bd4b1502a7682aa5b5c24c579dfc51b36bcdc3d3bd290bd500407fb80fa686bfc47d4ee8d2beb2631b725d7b6af039c7b75e9bcf47a970721eb023c19
|
data/.gitignore
CHANGED
data/.gitmodules
ADDED
data/.travis.yml
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
rvm:
|
2
|
-
-
|
3
|
-
script: "bundle exec
|
2
|
+
- 2.2.2
|
3
|
+
script: "bundle exec rspec"
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,25 @@
|
|
1
1
|
# Changes
|
2
2
|
|
3
|
+
## v0.2.1 - 18-09-2016
|
4
|
+
|
5
|
+
* pulled in mac os x support by @ztalbot2000 28-06-2014
|
6
|
+
* fixed all compile warnings
|
7
|
+
* Added -m32 compile option
|
8
|
+
* fixed segfault when running mtl_comp with invalid args
|
9
|
+
* Changed output so size is CAPITAL hex value to make absolutely no
|
10
|
+
differences when comparing compiled .mtl file and original bc.jsp file
|
11
|
+
|
12
|
+
## v0.1.1 - 17-09-2016
|
13
|
+
|
14
|
+
* file cleanup fix spelling
|
15
|
+
* update readme on how to use/run examples
|
16
|
+
* proper usage of bundler
|
17
|
+
|
3
18
|
## v0.1.0 - xx-09-2012
|
4
19
|
|
5
|
-
* files restructured,
|
20
|
+
* files restructured, separation byte & ruby code
|
6
21
|
* update server for generic structure, added callback
|
7
|
-
* mtl
|
22
|
+
* mtl binaries respect defaults from local `.mtlrc` file
|
8
23
|
|
9
24
|
## v0.0.2 - 29-01-2012
|
10
25
|
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Tobias Bielohlawek
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,53 +1,112 @@
|
|
1
1
|
# Nabaztag Hack Kit
|
2
2
|
|
3
|
-
Everything you need to hack the Rabbit: a sinatra server including simple api framework to run custom bytecode on Nabaztag v1/v2. Includes original compiler sources for linux.
|
3
|
+
Everything you need to hack the Rabbit: a sinatra server including simple api framework to run custom bytecode on Nabaztag v1/v2. Includes original compiler sources for linux and a modified mac os x version.
|
4
4
|
|
5
|
-
![](http://
|
5
|
+
![](http://github.com/rngtng/NabaztagHackKit.png)
|
6
6
|
|
7
7
|
## Getting Started
|
8
8
|
|
9
|
-
###
|
9
|
+
### Installation
|
10
10
|
|
11
|
-
The
|
11
|
+
The Hack Kit is distributed as a ruby gem. It comes with a simple web server (based on sinatra) which runs out-of-the for connecting you rabbit and distributing the nabaztag bytecode. In addition it includes sinatra helpers/modules to communicate with the rabbit easily. Lastly it provides binaries to compile your own Nabaztag bytecode (see **Binaries** below).
|
12
12
|
|
13
|
-
|
13
|
+
### Simple Server
|
14
14
|
|
15
|
-
|
15
|
+
The Server is the communication endpoint for the rabbit. Its two main purposes are:
|
16
|
+
|
17
|
+
1. serving the bytecode on bootup
|
18
|
+
2. receive and respond to HTTP requests in a defined format.
|
19
|
+
|
20
|
+
### Setup
|
21
|
+
|
22
|
+
1. Install dependencies first:
|
23
|
+
|
24
|
+
```
|
25
|
+
gem install nabaztag_hack_kit
|
26
|
+
```
|
27
|
+
|
28
|
+
or if you have a `Gemfile`
|
29
|
+
|
30
|
+
```
|
31
|
+
bundle install --path=vendor/bundle
|
32
|
+
```
|
33
|
+
|
34
|
+
2. Then, create a `config.ru` file
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
require 'nabaztag_hack_kit/server'
|
38
|
+
|
39
|
+
run NabaztagHackKit::Server.new
|
40
|
+
```
|
41
|
+
|
42
|
+
3. Finally, to start and run the server, execute:
|
43
|
+
|
44
|
+
```
|
45
|
+
bundle exec rackup -p <portnumer>
|
46
|
+
```
|
47
|
+
|
48
|
+
See `examples/` folder for more sophisticated usage.
|
49
|
+
|
50
|
+
### Binaries
|
51
|
+
|
52
|
+
The kit comes with violet sources and binaries to compile custom Nabaztag bytecode. See folder `compiler/`. The linux sources are (more or less) the original ones by violet, the mac osx version was created by @ztalbot2000.
|
53
|
+
The compiler binaries are compiled on installation of the gem.
|
54
|
+
|
55
|
+
Following three binaries are available:
|
16
56
|
|
17
57
|
#### mtl_comp
|
18
58
|
|
19
|
-
Compiles a `*.mtl` file. It calls `mtl_merge` before
|
59
|
+
A wrapper around `mtl_comp`. Compiles a `*.mtl` file. It calls `mtl_merge` before
|
20
60
|
|
21
61
|
#### mtl_simu
|
22
62
|
|
23
|
-
Runs a `*.mtl` file. It calls `mtl_merge` before
|
63
|
+
A wrapper around `mtl_simu`. Runs a `*.mtl` file. It calls `mtl_merge` before
|
64
|
+
|
65
|
+
#### mtl_merge
|
24
66
|
|
67
|
+
Merges multiple `*.mtl` files into one. Files are included like in C: `#include "<relative path to file>"`. Output is temporary file `.tmp.mtl`.
|
25
68
|
|
26
|
-
|
69
|
+
## Development
|
27
70
|
|
28
|
-
|
71
|
+
Be sure to checkout `mtl_linux` submodule first:
|
72
|
+
|
73
|
+
```
|
74
|
+
git submodule update
|
75
|
+
```
|
76
|
+
|
77
|
+
To update the kit run:
|
78
|
+
|
79
|
+
```
|
80
|
+
bundle exec rake build && bundle exec gem install -V pkg/nabaztag_hack_kit-0.1.0.beta6.gem
|
81
|
+
```
|
82
|
+
|
83
|
+
## Understanding the Bytecode
|
84
|
+
|
85
|
+
The bytecode is written in a custom language by Sylvain Huet. It is referenced as _Metal_ and files end with `.mtl`. Unfortunately documentation is very poor (and in french). Check directory `bytecode/_original` which contains a basic overview & documentation as well as a list of (common) commands. A good reference is the original bytecode, included in the directory as well. Major parts got extracted into seperate files, found in `bytecode/lib/` directory and ready to be included in your code.
|
86
|
+
|
87
|
+
Grammar: https://docs.google.com/document/d/1KMg2wSyMKTmsilCpOByi_59uk5dD8XMfGAu20W63kZE/edit?hl=en_US
|
29
88
|
|
30
89
|
### Testing
|
31
90
|
|
32
|
-
The kit includes a simple test framework to test custom bytecode. See `
|
91
|
+
The kit includes a simple test framework to test custom bytecode. See `bytecode/test/test.mtl`. A typical test looks like this:
|
33
92
|
|
34
93
|
```c
|
35
|
-
let test "
|
94
|
+
let test "math operations" -> t in
|
36
95
|
(
|
37
96
|
//assertions
|
38
|
-
assert_equalI 0
|
97
|
+
assert_equalI 0 10 - (2 * 5);
|
39
98
|
0);
|
40
99
|
```
|
41
100
|
|
42
101
|
The framework offers assertions similar to [Ruby Test::Unit](http://ruby-doc.org/stdlib-1.9.3/libdoc/test/unit/rdoc/Test/Unit.html) style. Mind that the variable type has to be given
|
43
102
|
explicit. Convention is:
|
44
103
|
|
45
|
-
* I =
|
104
|
+
* I = integer
|
46
105
|
* S = string
|
47
106
|
* L = list
|
48
|
-
* T =
|
107
|
+
* T = table
|
49
108
|
|
50
|
-
Following assertions are available
|
109
|
+
Following assertions are available (see bytecode/test/helper.mtl)
|
51
110
|
|
52
111
|
* assert_equalI I I
|
53
112
|
* assert_equalI S S
|
@@ -56,32 +115,21 @@ Following assertions are available:
|
|
56
115
|
* assert_equalSL
|
57
116
|
* assert_equalTL
|
58
117
|
|
59
|
-
|
60
|
-
## Server
|
61
|
-
|
62
|
-
The Server is the communication endpoint for the rabbit. Its two main purposes are:
|
63
|
-
|
64
|
-
1. serving the bytecode on bootup
|
65
|
-
2. receive and respond to HTTP requests in a defined format.
|
66
|
-
|
67
|
-
To start the server, run shortcut `rake run` or, as it's based on rack, `rackup -p <portnumer>`.
|
68
|
-
|
69
|
-
|
70
118
|
## API
|
71
|
-
As example and for my own purposes I implemented a simple API to deal with RFID, LEDS, BUTTON and EARS easily.
|
119
|
+
As example and for my own purposes I implemented a simple API to deal with RFID, LEDS, BUTTON and EARS easily. (see bytecode/main.mtl)
|
72
120
|
|
73
121
|
### Input Devices
|
74
122
|
|
75
123
|
#### RFID
|
76
|
-
NabaztagInjector
|
124
|
+
see my other project *NabaztagInjector*
|
77
125
|
|
78
126
|
|
79
127
|
#### BUTTON
|
80
128
|
Current Button has very basic functionality: a short press send HTTP Request of type `Log` to server, a long
|
81
|
-
press
|
129
|
+
press forces the bunny to restart.
|
82
130
|
|
83
131
|
### Output Devices
|
84
|
-
Data for all output devices are stored in buffers. Each device has two: one for
|
132
|
+
Data for all output devices are stored in buffers. Each device has two: one for onetime, imediate playback, another for permanent loops.
|
85
133
|
|
86
134
|
#### LEDS
|
87
135
|
Buffers 0 - 9, where 0-4 are used for onetime, and 5-9 for loop playback.
|
@@ -90,30 +138,53 @@ Buffers 0 - 9, where 0-4 are used for onetime, and 5-9 for loop playback.
|
|
90
138
|
Buffers 10 - 13, where 10 & 11 are used for onetime, and 12 & 13 for loop playback.
|
91
139
|
|
92
140
|
|
93
|
-
|
94
141
|
## Disclamer
|
95
142
|
|
96
|
-
The server part was heavily inspired by [Trudy.rb](https://github.com/quimarche/trudy/blob/master/trudy.rb), compiler code copied from OpenJabNab.
|
97
|
-
|
143
|
+
The server part was heavily inspired by [Trudy.rb](https://github.com/quimarche/trudy/blob/master/trudy.rb), compiler code copied from [OpenJabNab](https://github.com/OpenJabNab/OpenJabNab). Thanks!
|
144
|
+
|
145
|
+
|
146
|
+
## Nabaztag Background
|
147
|
+
Read following posting for more background on Nabaztag Hacking (uses google translate:)
|
98
148
|
|
149
|
+
* [First class info from the creator himself](http://www.sylvain-huet.com/?lang=en#nabv2)
|
150
|
+
* [A good nabaztag Blog](https://www.journaldulapin.com/tag/nabaztag/)
|
151
|
+
* [A good introduction to understand Nabaztag Protocol](http://www.sis.uta.fi/~spi/jnabserver/documentation/index.html)
|
152
|
+
* [Les source bytecode et compilateur](http://translate.googleusercontent.com/translate_c?hl=en&rurl=translate.google.com&sl=fr&tl=en&twu=1&u=http://nabaztag.forumactif.fr/t13241p30-les-sources-bytecode-et-compilateur&usg=ALkJrhjLTbx1GMfSUgwhdjES1LzlE07HZQ#338060)
|
153
|
+
* [Mindscape donne une seconde vie a nabaztag](http://translate.google.com/translate?hl=en&sl=fr&tl=en&u=http%3A%2F%2Fwww.planete-domotique.com%2Fblog%2F2011%2F08%2F07%2Fmindscape-donne-une-seconde-vie-a-nabaztag%2F)
|
99
154
|
|
100
|
-
|
101
|
-
A good introduction to understand Nabaztag Protocol:
|
155
|
+
## Related Projects
|
102
156
|
|
103
|
-
|
157
|
+
New firmware with WPA2
|
158
|
+
1. https://github.com/ccarlo64/firmware_nabaztag
|
159
|
+
(see http://nabaztag.forumactif.fr/t15323-firmware-for-wpa-wpa2-test)
|
104
160
|
|
161
|
+
2. https://github.com/RedoXyde/nabgcc
|
162
|
+
https://github.com/RedoXyde/mtl_linux
|
163
|
+
(see http://nabaztag.forumactif.fr/t15280p25-nabaztagtag-en-wpa2)
|
105
164
|
|
106
|
-
|
107
|
-
|
165
|
+
ServerlessNabaztag
|
166
|
+
-> https://github.com/andreax79/ServerlessNabaztag
|
108
167
|
|
109
|
-
|
110
|
-
* [Mindscape donne une seconde vie a nabaztag](http://translate.google.com/translate?hl=en&sl=fr&tl=en&u=http%3A%2F%2Fwww.planete-domotique.com%2Fblog%2F2011%2F08%2F07%2Fmindscape-donne-une-seconde-vie-a-nabaztag%2F)
|
168
|
+
CloudServer replace: http://nabaztaglives.com/
|
111
169
|
|
170
|
+
Rebuild Nabaztag:
|
171
|
+
- https://www.hackster.io/bastiaan-slee/nabaztag-gets-a-new-life-with-google-aiy-e9f2c8
|
112
172
|
|
113
|
-
|
173
|
+
|
174
|
+
## Websocket
|
175
|
+
|
176
|
+
Websocket HowTo:
|
177
|
+
- https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers
|
178
|
+
|
179
|
+
- http://blog.honeybadger.io/building-a-simple-websockets-server-from-scratch-in-ruby/
|
180
|
+
- https://github.com/pusher/websockets-from-scratch-tutorial
|
181
|
+
|
182
|
+
|
183
|
+
## Future
|
114
184
|
I'd like to hack the Violet mir:ror too. Some starting points:
|
115
185
|
|
116
186
|
* https://github.com/leh/ruby-mirror
|
117
187
|
* http://reflektor.sourceforge.net/
|
118
|
-
|
119
|
-
|
188
|
+
* http://www.instructables.com/id/Kids-check-in-and-check-out-with-hacked-Mirror-an/
|
189
|
+
* http://svay.com/blog/hacking-rfid-with-nodejs/
|
190
|
+
* http://arduino-projects4u.com/violet-mirror/
|
data/Rakefile
CHANGED
File without changes
|
File without changes
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/bytecode/main.mtl
CHANGED
@@ -4,17 +4,17 @@ proto main 0;;
|
|
4
4
|
proto earsInit 0;;
|
5
5
|
proto evalTrame 1;;
|
6
6
|
|
7
|
-
#include "
|
8
|
-
#include "
|
9
|
-
#include "
|
10
|
-
#include "
|
11
|
-
#include "
|
12
|
-
#include "
|
13
|
-
#include "
|
14
|
-
#include "
|
15
|
-
#include "
|
16
|
-
#include "
|
17
|
-
#include "
|
7
|
+
#include "_original/lib/var"
|
8
|
+
#include "_original/lib/util"
|
9
|
+
#include "_original/lib/cfg"
|
10
|
+
#include "_original/lib/arp"
|
11
|
+
#include "_original/lib/udp"
|
12
|
+
#include "_original/lib/tcp"
|
13
|
+
#include "_original/lib/dns"
|
14
|
+
#include "_original/lib/http"
|
15
|
+
#include "_original/lib/dhcp"
|
16
|
+
#include "_original/lib/wav"
|
17
|
+
#include "_original/lib/wifi"
|
18
18
|
|
19
19
|
#include "lib/data_helper"
|
20
20
|
|
data/bytecode/test/test.mtl
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
proto main 0;;
|
2
2
|
|
3
|
-
#include "../
|
3
|
+
#include "../_original/lib/util"
|
4
4
|
#include "../lib/data_helper"
|
5
5
|
#include "../lib/buffer"
|
6
6
|
|
@@ -209,13 +209,13 @@ fun main=
|
|
209
209
|
assert_equalI 0xFFFFFF bufferRead 0;
|
210
210
|
0);
|
211
211
|
|
212
|
-
let test "log" -> t in
|
213
|
-
(
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
0);
|
212
|
+
//let test "log" -> t in
|
213
|
+
//(
|
214
|
+
// log "test" {1};
|
215
|
+
// assert_equalS "test,0,1,|" logs;
|
216
|
+
// log "test" {56 67 90};
|
217
|
+
// assert_equalS "test,0,1,|test,0,56,67,90,|" logs;
|
218
|
+
//0);
|
219
219
|
|
220
220
|
exit;
|
221
221
|
0;;
|
data/examples/basic/Gemfile
CHANGED
data/examples/basic/config.ru
CHANGED
@@ -1,10 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
$LOAD_PATH.unshift ::File.expand_path(::File.dirname(__FILE__) + '/lib')
|
4
|
-
require './server'
|
5
|
-
|
6
3
|
$stdout.sync = true
|
7
4
|
|
8
|
-
|
5
|
+
require 'bundler/setup'
|
6
|
+
require 'nabaztag_hack_kit/server'
|
7
|
+
require 'nabaztag_hack_kit/mods/callback'
|
8
|
+
# require 'nabaztag_hack_kit/mods/logger'
|
9
|
+
require 'nabaztag_hack_kit/mods/playground'
|
10
|
+
|
11
|
+
module Basic
|
12
|
+
class Server < NabaztagHackKit::Server
|
13
|
+
register NabaztagHackKit::Mods::Callback
|
14
|
+
# register Mods::Logger
|
15
|
+
register NabaztagHackKit::Mods::Playground
|
16
|
+
end
|
17
|
+
end
|
9
18
|
|
19
|
+
# use Rack::Reloader, 0
|
10
20
|
run Basic::Server.new
|
data/examples/record/Gemfile
CHANGED
data/examples/record/server.rb
CHANGED
data/ext/Makefile
ADDED
data/ext/bin/mtl_comp
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
BIN_NAME = 'mtl_compiler'
|
4
|
+
BIN_PATH = File.dirname(__FILE__)
|
5
|
+
BIN = File.join(File.expand_path("../mtl_linux", BIN_PATH), BIN_NAME)
|
6
|
+
FILE = ARGV.first
|
7
|
+
|
8
|
+
FILTER = ENV['FILTER'] || "| grep -v 'bytes' | grep -e'[a-z]'"
|
9
|
+
MERGE = File.join(BIN_PATH, 'mtl_merge')
|
10
|
+
TMP = ENV['TMP'] || '.tmp.mtl'
|
11
|
+
OUT = ENV['OUT'] || "bytecode.bin"
|
12
|
+
|
13
|
+
unless FILE
|
14
|
+
puts "usage: #{File.basename(__FILE__)} [filename]"
|
15
|
+
abort
|
16
|
+
end
|
17
|
+
|
18
|
+
# merge
|
19
|
+
`TMP='#{TMP}' #{MERGE} #{FILE}`
|
20
|
+
|
21
|
+
# compile
|
22
|
+
out = if File.exists?(BIN)
|
23
|
+
`#{BIN} -s #{TMP} #{OUT} 2>&1 #{FILTER}`
|
24
|
+
else
|
25
|
+
"local binary not found: #{BIN}"
|
26
|
+
end
|
27
|
+
|
28
|
+
puts out
|
29
|
+
`rm #{TMP}`
|
File without changes
|
data/ext/bin/mtl_simu
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
BIN_NAME = File.basename(__FILE__)
|
4
|
+
BIN_PATH = File.dirname(__FILE__)
|
5
|
+
BIN = File.join(File.expand_path("../mtl_linux", BIN_PATH), BIN_NAME)
|
6
|
+
FILE = ARGV.first
|
7
|
+
|
8
|
+
FILTER = ENV['FILTER'] || "| grep -v 'bytes' | grep -e'[a-z]'"
|
9
|
+
MERGE = File.join(BIN_PATH, 'mtl_merge')
|
10
|
+
TMP = ENV['TMP'] || '.tmp.mtl'
|
11
|
+
OUT = ENV['OUT'] || "bytecode.bin"
|
12
|
+
|
13
|
+
unless FILE
|
14
|
+
puts "usage: #{File.basename(__FILE__)} [filename]"
|
15
|
+
abort
|
16
|
+
end
|
17
|
+
|
18
|
+
# merge
|
19
|
+
`TMP='#{TMP}' #{MERGE} #{FILE}`
|
20
|
+
|
21
|
+
# simu
|
22
|
+
out = if File.exists?(BIN)
|
23
|
+
`#{BIN} --source #{TMP}`
|
24
|
+
else
|
25
|
+
"local binary not found: #{BIN}"
|
26
|
+
end
|
27
|
+
|
28
|
+
puts out
|
29
|
+
`rm #{TMP}`
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|