MINT-core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. data/.gemtest +0 -0
  2. data/Gemfile +17 -0
  3. data/Gemfile.lock +69 -0
  4. data/History.txt +3 -0
  5. data/MINT-core.gemspec +58 -0
  6. data/Manifest.txt +77 -0
  7. data/PostInstall.txt +7 -0
  8. data/README.rdoc +63 -0
  9. data/Rakefile +29 -0
  10. data/bin/mint-aui +40 -0
  11. data/bin/mint-cui-gfx +47 -0
  12. data/bin/mint-juggernaut.sh +4 -0
  13. data/bin/mint-tuplespace +12 -0
  14. data/lib/MINT-core.rb +42 -0
  15. data/lib/MINT-core/agent/agent.rb +28 -0
  16. data/lib/MINT-core/agent/aui.rb +52 -0
  17. data/lib/MINT-core/agent/auicontrol.rb +135 -0
  18. data/lib/MINT-core/agent/cui-gfx.rb +160 -0
  19. data/lib/MINT-core/agent/cuicontrol.rb +46 -0
  20. data/lib/MINT-core/mapping/complementary.rb +100 -0
  21. data/lib/MINT-core/mapping/mapping.rb +47 -0
  22. data/lib/MINT-core/mapping/on_state_change.rb +65 -0
  23. data/lib/MINT-core/mapping/sequential.rb +87 -0
  24. data/lib/MINT-core/model/aui/AIC.rb +86 -0
  25. data/lib/MINT-core/model/aui/AIChoice.rb +65 -0
  26. data/lib/MINT-core/model/aui/AIINChoose.rb +54 -0
  27. data/lib/MINT-core/model/aui/AIMultiChoice.rb +5 -0
  28. data/lib/MINT-core/model/aui/AIMultiChoiceElement.rb +56 -0
  29. data/lib/MINT-core/model/aui/AIO.rb +170 -0
  30. data/lib/MINT-core/model/aui/AIOUTDiscrete.rb +43 -0
  31. data/lib/MINT-core/model/aui/AISingleChoice.rb +9 -0
  32. data/lib/MINT-core/model/aui/AISingleChoiceElement.rb +69 -0
  33. data/lib/MINT-core/model/aui/AISinglePresence.rb +100 -0
  34. data/lib/MINT-core/model/aui/aic.png +0 -0
  35. data/lib/MINT-core/model/aui/aic.scxml +50 -0
  36. data/lib/MINT-core/model/aui/aichoice.png +0 -0
  37. data/lib/MINT-core/model/aui/aichoice.scxml +60 -0
  38. data/lib/MINT-core/model/aui/aio.png +0 -0
  39. data/lib/MINT-core/model/aui/aio.scxml +43 -0
  40. data/lib/MINT-core/model/aui/aisinglechoiceelement.png +0 -0
  41. data/lib/MINT-core/model/aui/aisinglechoiceelement.scxml +71 -0
  42. data/lib/MINT-core/model/aui/aisinglepresence.png +0 -0
  43. data/lib/MINT-core/model/aui/aisinglepresence.scxml +58 -0
  44. data/lib/MINT-core/model/aui/model.rb +50 -0
  45. data/lib/MINT-core/model/body/gesture_button.rb +26 -0
  46. data/lib/MINT-core/model/body/handgesture.rb +279 -0
  47. data/lib/MINT-core/model/body/head.png +0 -0
  48. data/lib/MINT-core/model/body/head.rb +51 -0
  49. data/lib/MINT-core/model/body/head.scxml +28 -0
  50. data/lib/MINT-core/model/cui/gfx/CIC.rb +266 -0
  51. data/lib/MINT-core/model/cui/gfx/CIO.rb +381 -0
  52. data/lib/MINT-core/model/cui/gfx/model.rb +204 -0
  53. data/lib/MINT-core/model/cui/gfx/screen.rb +18 -0
  54. data/lib/MINT-core/model/device/button.rb +20 -0
  55. data/lib/MINT-core/model/device/joypad.rb +30 -0
  56. data/lib/MINT-core/model/device/mouse.rb +171 -0
  57. data/lib/MINT-core/model/device/pointer.rb +85 -0
  58. data/lib/MINT-core/model/device/wheel.rb +51 -0
  59. data/lib/MINT-core/model/interactor.rb +167 -0
  60. data/lib/MINT-core/model/task.rb +71 -0
  61. data/lib/MINT-core/overrides/rinda.rb +34 -0
  62. data/script/console +10 -0
  63. data/script/destroy +14 -0
  64. data/script/generate +14 -0
  65. data/spec/AIC_spec.rb +69 -0
  66. data/spec/AISinglePresence_spec.rb +94 -0
  67. data/spec/MINT-core_spec.rb +11 -0
  68. data/spec/aio_agent_spec.rb +234 -0
  69. data/spec/aio_spec.rb +144 -0
  70. data/spec/aisinglechoice_spec.rb +152 -0
  71. data/spec/aisinglechoiceelement_spec.rb +106 -0
  72. data/spec/cio_spec.rb +369 -0
  73. data/spec/core_spec.rb +29 -0
  74. data/spec/music_spec.rb +179 -0
  75. data/spec/rcov.opts +2 -0
  76. data/spec/spec.opts +4 -0
  77. data/spec/spec_helper.rb +7 -0
  78. data/tasks/rspec.rake +21 -0
  79. metadata +227 -0
Binary file
@@ -0,0 +1,50 @@
1
+ <scxml initial="initialized" name="AIC" version="0.9" xmlns="http://www.w3.org/2005/07/scxml"><!-- node-size-and-position x=0.0 y=0.0 w=370.0 h=270.0 -->
2
+ <state id="organized"><!-- node-size-and-position x=10.0 y=100.0 w=70.0 h=20.0 -->
3
+ <transition event="suspend" target="suspended"><!-- edge-path [suspended] x=134.0 y=97.0 --></transition>
4
+ <transition event="present" target="presenting"><!-- edge-path [presenting] x=50.0 y=160.0 --></transition>
5
+ </state>
6
+ <state id="presenting" initial="defocused"><!-- node-size-and-position x=80.0 y=130.0 w=280.0 h=130.0 -->
7
+ <onentry>
8
+ <invoke src="inform_parent_presenting" type="x-mint"></invoke>
9
+ <invoke src="present_children" type="x-mint"></invoke>
10
+ </onentry>
11
+ <onexit>
12
+ <invoke src="hide_children" type="x-mint"></invoke>
13
+ </onexit>
14
+ <transition event="suspend" target="suspended"><!-- edge-path [suspended] x=184.0 y=107.0 --></transition>
15
+ <state id="focused"><!-- node-size-and-position x=210.0 y=50.0 w=60.0 h=20.0 -->
16
+ <onentry>
17
+ <invoke src="sync_cio_to_highlighted" type="x-mint"></invoke>
18
+ </onentry>
19
+ <transition event="defocus" target="defocused"><!-- edge-path [defocused] x=240.0 y=40.0 x=50.0 y=40.0 pointx=0.0 pointy=0.0 offsetx=-5.0 offsety=0.0 --></transition>
20
+ <transition cond="exists_next" event="next" target="defocused">
21
+ <invoke src="focus_next" type="x-mint"></invoke>
22
+ <!-- edge-path [defocused] x=240.0 y=90.0 x=50.0 y=90.0 --></transition>
23
+ <transition cond="exists_prev" event="prev" target="defocused">
24
+ <invoke src="focus_previous" type="x-mint"></invoke>
25
+ <!-- edge-path [defocused] x=240.0 y=100.0 x=50.0 y=100.0 --></transition>
26
+ <transition event="parent" target="defocused">
27
+ <invoke src="focus_parent" type="x-mint"></invoke>
28
+ <!-- edge-path [defocused] x=240.0 y=120.0 x=50.0 y=120.0 --></transition>
29
+ <transition event="child" target="defocused">
30
+ <invoke src="focus_child" type="x-mint"></invoke>
31
+ <!-- edge-path [defocused] x=240.0 y=110.0 x=50.0 y=110.0 --></transition>
32
+ </state>
33
+ <state id="defocused"><!-- node-size-and-position x=20.5 y=50.0 w=60.0 h=20.0 -->
34
+ <onentry>
35
+ <invoke src="sync_cio_to_displayed" type="x-mint"></invoke>
36
+ </onentry>
37
+ <transition event="focus" target="focused"><!-- edge-path [focused] x=140.0 y=60.0 --></transition>
38
+ </state>
39
+ </state>
40
+ <state id="suspended"><!-- node-size-and-position x=194.5 y=47.0 w=60.0 h=20.0 -->
41
+ <onentry>
42
+ <invoke src="sync_cio_to_hidden" type="x-mint"></invoke>
43
+ </onentry>
44
+ <transition event="present" target="presenting"><!-- edge-path [presenting] x=254.0 y=107.0 --></transition>
45
+ <transition event="organize" target="organized"><!-- edge-path [organized] x=114.0 y=67.0 --></transition>
46
+ </state>
47
+ <state id="initialized"><!-- node-size-and-position x=10.5 y=30.0 w=70.0 h=20.0 -->
48
+ <transition event="organize" target="organized"></transition>
49
+ </state>
50
+ </scxml>
@@ -0,0 +1,60 @@
1
+ <scxml initial="initialized" name="AIChoice" version="0.9" xmlns="http://www.w3.org/2005/07/scxml"><!-- node-size-and-position x=0.0 y=0.0 w=420.0 h=390.0 -->
2
+ <state id="initialized"><!-- node-size-and-position x=10.0 y=30.0 w=80.0 h=20.0 -->
3
+ <transition event="organize" target="organized"></transition>
4
+ </state>
5
+ <state id="organized"><!-- node-size-and-position x=10.0 y=80.0 w=80.0 h=20.0 -->
6
+ <transition event="present" target="p_t"><!-- edge-path [p_t] x=60.0 y=160.0 pointx=0.0 pointy=0.0 offsetx=0.0 offsety=-5.0 --></transition>
7
+ <transition event="suspend" target="suspended"></transition>
8
+ </state>
9
+ <state id="p_t"><!-- node-size-and-position x=100.0 y=100.0 w=310.0 h=280.0 -->
10
+ <transition event="suspend" target="suspended"><!-- edge-path [suspended] x=170.0 y=100.0 --></transition>
11
+ <parallel id="p"><!-- node-size-and-position x=10.0 y=30.0 w=290.0 h=243.0 -->
12
+ <state id="presenting" initial="defocused"><!-- node-size-and-position x=10.0 y=30.0 w=270.0 h=140.0 -->
13
+ <onentry>
14
+ <invoke src="present_children" type="x-mint"></invoke>
15
+ </onentry>
16
+ <onexit>
17
+ <invoke src="hide_children" type="x-mint"></invoke>
18
+ </onexit>
19
+ <state id="focused"><!-- node-size-and-position x=200.0 y=50.0 w=60.0 h=20.0 -->
20
+ <onentry>
21
+ <invoke src="sync_cio_to_highlighted" type="x-mint"></invoke>
22
+ </onentry>
23
+ <transition event="defocus" target="defocused"><!-- edge-path [defocused] x=130.0 y=77.0 --></transition>
24
+ <transition event="parent" target="defocused">
25
+ <invoke src="focus_parent" type="x-mint"></invoke>
26
+ <!-- edge-path [defocused] x=230.0 y=117.0 x=40.0 y=117.0 --></transition>
27
+ <transition cond="exists_prev" event="prev" target="defocused">
28
+ <invoke src="focus_previous" type="x-mint"></invoke>
29
+ <!-- edge-path [defocused] x=230.0 y=107.0 x=40.0 y=107.0 --></transition>
30
+ <transition cond="exists_next" event="next" target="defocused">
31
+ <invoke src="focus_next" type="x-mint"></invoke>
32
+ <!-- edge-path [defocused] x=230.0 y=97.0 x=40.0 y=97.0 --></transition>
33
+ <transition event="child" target="defocused">
34
+ <invoke src="focus_child" type="x-mint"></invoke>
35
+ <!-- edge-path [defocused] x=230.0 y=130.0 x=40.0 y=130.0 --></transition>
36
+ </state>
37
+ <state id="defocused"><!-- node-size-and-position x=10.0 y=50.0 w=60.0 h=20.0 -->
38
+ <onentry>
39
+ <invoke src="sync_cio_to_displayed" type="x-mint"></invoke>
40
+ </onentry>
41
+ <transition event="focus" target="focused"><!-- edge-path [focused] x=130.0 y=37.0 --></transition>
42
+ </state>
43
+ </state>
44
+ <state id="l" initial="listing"><!-- node-size-and-position x=90.0 y=180.0 w=110.0 h=60.0 -->
45
+ <state id="listing"><!-- node-size-and-position x=20.0 y=30.0 w=50.0 h=20.0 -->
46
+ <transition cond="In(:focused)" event="drop" target="listing">
47
+ <invoke src="add_element" type="x-mint"></invoke>
48
+ </transition>
49
+ </state>
50
+ </state>
51
+ </parallel>
52
+ </state>
53
+ <state id="suspended"><!-- node-size-and-position x=210.25 y=40.0 w=60.0 h=20.0 -->
54
+ <onentry>
55
+ <invoke src="sync_cio_to_hidden" type="x-mint"></invoke>
56
+ </onentry>
57
+ <transition event="present" target="p_t"><!-- edge-path [p_t] x=290.0 y=80.0 --></transition>
58
+ <transition event="organize" target="organized"><!-- edge-path [organized] x=130.0 y=40.0 --></transition>
59
+ </state>
60
+ </scxml>
Binary file
@@ -0,0 +1,43 @@
1
+ <scxml initial="initialized" name="AIO" version="0.9" xmlns="http://www.w3.org/2005/07/scxml"><!-- node-size-and-position x=0.0 y=0.0 w=410.0 h=350.0 -->
2
+ <state id="organized"><!-- node-size-and-position x=10.0 y=130.0 w=80.0 h=30.0 -->
3
+ <transition event="suspend" target="suspended"><!-- edge-path [suspended] x=160.0 y=160.0 pointx=0.0 pointy=4.0 offsetx=-4.0 offsety=2.0 --></transition>
4
+ <transition event="present" target="presenting"><!-- edge-path [presenting] x=50.0 y=260.0 --></transition>
5
+ </state>
6
+ <state id="initialized"><!-- node-size-and-position x=10.0 y=40.0 w=80.0 h=30.0 -->
7
+ <transition event="organize" target="organized"></transition>
8
+ </state>
9
+ <state id="presenting" initial="defocused"><!-- node-size-and-position x=80.0 y=180.0 w=320.0 h=160.0 -->
10
+ <onentry>
11
+ <invoke src="inform_parent_presenting" type="x-mint"></invoke>
12
+ </onentry>
13
+ <transition event="suspend" target="suspended"></transition>
14
+ <state id="defocused"><!-- node-size-and-position x=10.0 y=50.0 w=80.0 h=30.0 -->
15
+ <onentry>
16
+ <invoke src="sync_cio_to_displayed" type="x-mint"></invoke>
17
+ </onentry>
18
+ <transition event="focus" target="focused"><!-- edge-path [focused] x=160.0 y=90.0 --></transition>
19
+ </state>
20
+ <state id="focused"><!-- node-size-and-position x=230.0 y=50.0 w=80.0 h=30.0 -->
21
+ <onentry>
22
+ <invoke src="sync_cio_to_highlighted" type="x-mint"></invoke>
23
+ </onentry>
24
+ <transition cond="exists_next" event="next" target="defocused">
25
+ <invoke src="focus_next" type="x-mint"></invoke>
26
+ <!-- edge-path [defocused] x=270.0 y=110.0 x=50.0 y=110.0 --></transition>
27
+ <transition cond="exists_prev" event="prev" target="defocused">
28
+ <invoke src="focus_previous" type="x-mint"></invoke>
29
+ <!-- edge-path [defocused] x=270.0 y=130.0 x=50.0 y=130.0 --></transition>
30
+ <transition event="parent" target="defocused">
31
+ <invoke src="focus_parent" type="x-mint"></invoke>
32
+ <!-- edge-path [defocused] x=270.0 y=150.0 x=50.0 y=150.0 --></transition>
33
+ <transition event="defocus" target="defocused"><!-- edge-path [defocused] x=160.0 y=40.0 --></transition>
34
+ </state>
35
+ </state>
36
+ <state id="suspended"><!-- node-size-and-position x=190.0 y=60.0 w=80.0 h=30.0 -->
37
+ <onentry>
38
+ <invoke src="sync_cio_to_hidden" type="x-mint"></invoke>
39
+ </onentry>
40
+ <transition event="present" target="presenting"><!-- edge-path [presenting] x=290.0 y=140.0 --></transition>
41
+ <transition event="organize" target="organized"><!-- edge-path [organized] pointx=0.0 pointy=11.0 offsetx=2.0 offsety=-1.0 --></transition>
42
+ </state>
43
+ </scxml>
@@ -0,0 +1,71 @@
1
+ <scxml initial="initialized" name="AISingleChoiceElement" version="0.9" xmlns="http://www.w3.org/2005/07/scxml"><!-- node-size-and-position x=0.0 y=0.0 w=420.0 h=450.0 -->
2
+ <state id="initialized"><!-- node-size-and-position x=10.0 y=30.0 w=80.0 h=20.0 -->
3
+ <transition event="organize" target="organized"></transition>
4
+ </state>
5
+ <state id="organized"><!-- node-size-and-position x=10.0 y=80.0 w=80.0 h=20.0 -->
6
+ <transition event="present" target="p_t"><!-- edge-path [p_t] x=60.0 y=160.0 pointx=0.0 pointy=0.0 offsetx=0.0 offsety=-5.0 --></transition>
7
+ <transition event="suspend" target="suspended"></transition>
8
+ </state>
9
+ <state id="p_t"><!-- node-size-and-position x=100.0 y=100.0 w=310.0 h=340.0 -->
10
+ <transition event="suspend" target="suspended"><!-- edge-path [suspended] x=170.0 y=100.0 --></transition>
11
+ <parallel id="p"><!-- node-size-and-position x=10.0 y=30.0 w=290.0 h=300.0 -->
12
+ <state id="presenting" initial="defocused"><!-- node-size-and-position x=10.0 y=30.0 w=270.0 h=160.0 -->
13
+ <state id="focused"><!-- node-size-and-position x=200.0 y=50.0 w=60.0 h=20.0 -->
14
+ <onentry>
15
+ <invoke src="sync_cio_to_highlighted" type="x-mint"></invoke>
16
+ </onentry>
17
+ <transition event="defocus" target="defocused"><!-- edge-path [defocused] x=130.0 y=77.0 --></transition>
18
+ <transition event="parent" target="defocused">
19
+ <invoke src="focus_parent" type="x-mint"></invoke>
20
+ <!-- edge-path [defocused] x=230.0 y=117.0 x=40.0 y=117.0 --></transition>
21
+ <transition cond="exists_prev" event="prev" target="defocused">
22
+ <invoke src="focus_previous" type="x-mint"></invoke>
23
+ <!-- edge-path [defocused] x=230.0 y=107.0 x=40.0 y=107.0 --></transition>
24
+ <transition cond="exists_next" event="next" target="defocused">
25
+ <invoke src="focus_next" type="x-mint"></invoke>
26
+ <!-- edge-path [defocused] x=230.0 y=97.0 x=40.0 y=97.0 --></transition>
27
+ <transition event="drag" target="dragging">
28
+ <invoke src="choose" type="x-mint"></invoke>
29
+ <!-- edge-path [dragging] x=230.0 y=140.0 --></transition>
30
+ </state>
31
+ <state id="defocused"><!-- node-size-and-position x=10.0 y=50.0 w=60.0 h=20.0 -->
32
+ <onentry>
33
+ <invoke src="sync_cio_to_displayed" type="x-mint"></invoke>
34
+ </onentry>
35
+ <transition event="focus" target="focused"><!-- edge-path [focused] x=130.0 y=37.0 --></transition>
36
+ </state>
37
+ <state id="dragging"><!-- node-size-and-position x=110.0 y=130.0 w=60.0 h=20.0 -->
38
+ <onentry>
39
+ <invoke src="sync_cio_to_highlighted" type="x-mint"></invoke>
40
+ </onentry>
41
+ <transition event="drop" target="defocused"><!-- edge-path [defocused] x=40.0 y=140.0 pointx=0.0 pointy=0.0 offsetx=30.0 offsety=0.0 --></transition>
42
+ </state>
43
+ </state>
44
+ <state id="selection" initial="unchosen"><!-- node-size-and-position x=10.0 y=200.0 w=270.0 h=90.0 -->
45
+ <state id="unchosen"><!-- node-size-and-position x=30.0 y=60.0 w=60.0 h=20.0 -->
46
+ <onentry>
47
+ <invoke src="sync_cio_to_listed" type="x-mint"></invoke>
48
+ </onentry>
49
+ <transition event="choose" target="chosen"><!-- edge-path [chosen] x=60.0 y=50.0 x=230.0 y=50.0 --></transition>
50
+ </state>
51
+ <state id="chosen"><!-- node-size-and-position x=200.0 y=60.0 w=60.0 h=20.0 -->
52
+ <onentry>
53
+ <invoke src="sync_cio_to_selected" type="x-mint"></invoke>
54
+ <invoke src="unchoose_others" type="x-mint"></invoke>
55
+ </onentry>
56
+ <transition event="unchoose" target="unchosen"></transition>
57
+ </state>
58
+ <history id="H" type="deep"><!-- node-size-and-position x=10.0 y=30.0 w=20.0 h=20.0 -->
59
+ <transition target="unchosen"></transition>
60
+ </history>
61
+ </state>
62
+ </parallel>
63
+ </state>
64
+ <state id="suspended"><!-- node-size-and-position x=210.25 y=40.0 w=60.0 h=20.0 -->
65
+ <onentry>
66
+ <invoke src="sync_cio_to_hidden" type="x-mint"></invoke>
67
+ </onentry>
68
+ <transition event="present" target="p_t"><!-- edge-path [p_t] x=290.0 y=80.0 --></transition>
69
+ <transition event="organize" target="organized"><!-- edge-path [organized] x=140.0 y=50.0 --></transition>
70
+ </state>
71
+ </scxml>
@@ -0,0 +1,58 @@
1
+ <scxml initial="initialized" name="AISinglePresence" version="0.9" xmlns="http://www.w3.org/2005/07/scxml"><!-- node-size-and-position x=0.0 y=0.0 w=370.0 h=420.0 -->
2
+ <state id="initialized"><!-- node-size-and-position x=10.0 y=30.0 w=100.0 h=30.0 -->
3
+ <transition event="organize" target="organized"></transition>
4
+ </state>
5
+ <state id="organized"><!-- node-size-and-position x=10.0 y=100.0 w=100.0 h=30.0 -->
6
+ <transition event="present" target="presenting"><!-- edge-path [presenting] x=60.0 y=270.0 --></transition>
7
+ <transition event="suspend" target="suspended"></transition>
8
+ </state>
9
+ <state id="suspended"><!-- node-size-and-position x=230.0 y=30.0 w=100.0 h=30.0 -->
10
+ <onentry>
11
+ <invoke src="sync_cio_to_hidden" type="x-mint"></invoke>
12
+ </onentry>
13
+ <transition event="present" target="presenting"><!-- edge-path [presenting] x=220.0 y=90.0 pointx=0.0 pointy=-5.0 offsetx=0.0 offsety=0.0 --></transition>
14
+ <transition event="organize" target="organized"><!-- edge-path [organized] x=150.0 y=60.0 --></transition>
15
+ </state>
16
+ <state id="presenting" initial="defocused"><!-- node-size-and-position x=130.0 y=120.0 w=230.0 h=290.0 -->
17
+ <onentry>
18
+ <invoke src="present_first_child" type="x-mint"></invoke>
19
+ </onentry>
20
+ <onexit>
21
+ <invoke src="hide_children" type="x-mint"></invoke>
22
+ </onexit>
23
+ <transition event="suspend" target="suspended"><!-- edge-path [suspended] x=330.0 y=90.0 --></transition>
24
+ <state id="defocused"><!-- node-size-and-position x=10.0 y=30.0 w=100.0 h=30.0 -->
25
+ <onentry>
26
+ <invoke src="sync_cio_to_displayed" type="x-mint"></invoke>
27
+ </onentry>
28
+ <transition event="focus" target="focused"><!-- edge-path [focused] x=20.0 y=90.0 --></transition>
29
+ </state>
30
+ <state id="focused" initial="waiting"><!-- node-size-and-position x=10.0 y=120.0 w=180.0 h=160.0 -->
31
+ <transition event="defocus" target="defocused"><!-- edge-path [defocused] x=93.0 y=93.0 --></transition>
32
+ <state id="waiting"><!-- node-size-and-position x=10.0 y=30.0 w=100.0 h=30.0 -->
33
+ <onentry>
34
+ <invoke src="sync_cio_to_highlighted" type="x-mint"></invoke>
35
+ </onentry>
36
+ <transition event="enter" target="entered"><!-- edge-path [entered] x=20.0 y=90.0 --></transition>
37
+ <transition cond="exists_next" event="next" target="defocused">
38
+ <invoke src="focus_next" type="x-mint"></invoke>
39
+ <!-- edge-path [defocused] x=150.0 y=170.0 x=150.0 y=40.0 --></transition>
40
+ <transition cond="exists_prev" event="prev" target="defocused">
41
+ <invoke src="focus_previous" type="x-mint"></invoke>
42
+ <!-- edge-path [defocused] x=180.0 y=170.0 x=180.0 y=40.0 --></transition>
43
+ <transition event="parent" target="defocused">
44
+ <invoke src="focus_parent" type="x-mint"></invoke>
45
+ <!-- edge-path [defocused] x=210.0 y=170.0 x=210.0 y=40.0 --></transition>
46
+ </state>
47
+ <state id="entered"><!-- node-size-and-position x=10.0 y=110.0 w=100.0 h=30.0 -->
48
+ <transition event="leave" target="waiting"><!-- edge-path [waiting] x=100.0 y=90.0 --></transition>
49
+ <transition cond="exists_next_child" event="next" target="entered">
50
+ <invoke src="present_next_child" type="x-mint"></invoke>
51
+ </transition>
52
+ <transition cond="exists_prev_child" event="prev" target="entered">
53
+ <invoke src="present_previous_child" type="x-mint"></invoke>
54
+ <!-- edge-path [entered] x=150.0 y=40.0 --></transition>
55
+ </state>
56
+ </state>
57
+ </state>
58
+ </scxml>
@@ -0,0 +1,50 @@
1
+ # AUI MODEL
2
+ module MINT
3
+
4
+
5
+
6
+ require "MINT-core/model/aui/AIO"
7
+
8
+ class AIIN < AIO
9
+ end
10
+
11
+ class AIINContinous < AIIN
12
+ end
13
+
14
+ class AIINDiscrete <AIIN
15
+ end
16
+
17
+ class AIINReference < AIINDiscrete
18
+ end
19
+
20
+ class AICommand <AIINDiscrete
21
+ end
22
+
23
+
24
+ require "MINT-core/model/aui/AIINChoose"
25
+
26
+ class AIOUT <AIO
27
+ end
28
+
29
+ require "MINT-core/model/aui/AIOUTDiscrete"
30
+
31
+ class AIOUTContext < AIOUTDiscrete
32
+ property :text, String
33
+ end
34
+
35
+ class AIOUTContinous < AIOUT
36
+ end
37
+
38
+ require "MINT-core/model/aui/AIC"
39
+
40
+ end
41
+
42
+ require "MINT-core/model/aui/AIChoice"
43
+
44
+ require "MINT-core/model/aui/AISingleChoiceElement"
45
+ require "MINT-core/model/aui/AISingleChoice"
46
+
47
+ require "MINT-core/model/aui/AIMultiChoiceElement"
48
+ require "MINT-core/model/aui/AIMultiChoice"
49
+
50
+ require "MINT-core/model/aui/AISinglePresence"
@@ -0,0 +1,26 @@
1
+ module MINT
2
+
3
+ class GestureButton< HWButton
4
+ attr_reader :statemachine
5
+
6
+ def activate(state,abstract_states, atomic_states)
7
+ puts "activate #{state} #{abstract_states.join "|"} #{atomic_states.join "|"}"
8
+ end
9
+
10
+ def initialize_statemachine
11
+ if @statemachine.blank?
12
+ @statemachine = Statemachine.build do
13
+
14
+ trans :disconnected,:right_appeared, :connected
15
+ trans :connected, :right_disappeared, :disconnected
16
+
17
+ superstate :connected do
18
+ trans :initialized, :select, :released
19
+ trans :released, :confirm, :pressed
20
+ trans :pressed, :select, :released
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,279 @@
1
+ module MINT
2
+
3
+ class HandGesture < IN
4
+
5
+ attr_accessor :command_timeout
6
+ attr_accessor :confirm_timeout
7
+
8
+ def initialize(attributes = {}, &block)
9
+ super(attributes, &block)
10
+
11
+ @issued_next = 0
12
+ @issued_prev = 0
13
+ @command_timeout = 60
14
+ @confirm_timeout = 0
15
+ @timer = nil
16
+ @counter=0
17
+
18
+ end
19
+
20
+ def initialize_statemachine
21
+ if @statemachine.blank?
22
+ @statemachine = Statemachine.build do
23
+ superstate :HandGesture do
24
+ trans :NoHands, :two_hands, :TwoHands
25
+ trans :NoHands, :one_hand, :OneHand
26
+ trans :TwoHands, :one_hand, :OneHand
27
+ trans :TwoHands, :no_hands, :NoHands
28
+
29
+
30
+ superstate :OneHand do
31
+
32
+ superstate :Command do
33
+ trans :wait_one, :select, :selected
34
+ trans :selected, :confirm, :confirmed
35
+ trans :confirmed, :tick, :wait_one # tick will be triggered in on_enter(confirmed)
36
+
37
+ state :confirmed do
38
+ on_entry Proc.new {@statemachine.tick }
39
+ end
40
+
41
+ event :widen, :w, :print_distance
42
+ event :narrow, :n, :print_distance
43
+ event :prev_gesture, :previous
44
+ event :next_gesture, :next
45
+ end
46
+
47
+ superstate :Navigation do
48
+
49
+ superstate :Parental do
50
+
51
+ superstate :n do
52
+ trans :narrowing, :confirm, :narrowed
53
+ trans :narrowing, :narrow, :narrowing, :reset_confirm_ticker
54
+ trans :narrowed, :narrow, :narrowing, :print_distance
55
+ event :widen, :w, :print_distance
56
+
57
+ state :narrowing do
58
+ on_entry :start_confirm_timeout
59
+ on_exit :stop_confirm_timeout
60
+ end
61
+ end
62
+
63
+ superstate :w do
64
+ trans :widening, :confirm, :widened
65
+ trans :widening, :widen, :widening, :reset_confirm_ticker
66
+ trans :widened, :widen, :widening, :print_distance
67
+ event :narrow, :n, :print_distance
68
+
69
+ state :widening do
70
+ on_entry :start_confirm_timeout
71
+ on_exit :stop_confirm_timeout
72
+ end
73
+ end
74
+
75
+ event :prev_gesture, :previous
76
+ event :next_gesture, :next
77
+ end
78
+
79
+ superstate :Neighbour do
80
+
81
+ trans :next, :next, :next_tick, :issued_next
82
+ trans :next_tick, :tick, :next
83
+ trans :next, :prev_gesture, :previous
84
+
85
+ trans :previous, :previous, :previous_tick, :issued_prev
86
+ trans :previous_tick, :tick, :previous
87
+ trans :previous, :next_gesture, :next
88
+
89
+ state :next do
90
+ on_entry :command_timeout_start_next
91
+ on_exit :command_timeout_stop
92
+ end
93
+
94
+ state :next_tick do
95
+ on_entry :tick
96
+ end
97
+
98
+ state :previous_tick do
99
+ on_entry :tick
100
+ end
101
+
102
+ state :previous do
103
+ on_entry :command_timeout_start_prev
104
+ on_exit :command_timeout_stop
105
+ end
106
+
107
+ end
108
+
109
+ event :select, :selected
110
+ end
111
+
112
+ event :two_hands, :TwoHands
113
+ event :no_hands, :NoHands
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
119
+
120
+
121
+ def command_timeout_start_next
122
+ # puts "entering timeout ticker next"
123
+
124
+ @timer = EM::PeriodicTimer.new(@command_timeout) {
125
+ process_event :next
126
+ puts "next:#{@issued_next}"
127
+
128
+ }
129
+ end
130
+
131
+ def command_timeout_start_prev
132
+ # puts "entering timeout ticker prev"
133
+
134
+ @timer = EM::PeriodicTimer.new(@command_timeout) {
135
+ process_event :previous
136
+ puts "previous:#{@issued_prev}"
137
+ }
138
+ end
139
+
140
+ def command_timeout_stop
141
+ # puts "leaving timeout ticker"
142
+
143
+ @timer.cancel if @timer # if gestureserver is restarted and was set to next before timer could be nil
144
+ @issued_next = 0
145
+ @issued_prev = 0
146
+ end
147
+
148
+ def start_confirm_timeout
149
+ # puts "entering confirm timeout ticker"
150
+ @timer = EM::Timer.new(@confirm_timeout) {
151
+ process_event :confirm
152
+ # puts "zoom confirmed"
153
+ }
154
+ end
155
+
156
+ def stop_confirm_timeout
157
+ #puts "stoped confirm timeout ticker"
158
+ @timer.cancel
159
+ end
160
+
161
+ def print_distance(d)
162
+ puts "Distance:#{d}"
163
+ end
164
+
165
+ def reset_confirm_ticker(d)
166
+ print_distance d
167
+ #puts "reseted confirm ticker"
168
+ stop_confirm_timeout
169
+ start_confirm_timeout
170
+ end
171
+
172
+ def issued_next
173
+ @issued_next+=1
174
+ puts "next #{@issued_next}"
175
+ true
176
+ end
177
+
178
+ def issued_prev
179
+ @issued_prev+=1
180
+ puts "prev #{@issued_prev}"
181
+ true
182
+ end
183
+
184
+ def tick
185
+ save_statemachine
186
+ process_event :tick
187
+ true
188
+ end
189
+
190
+ end
191
+
192
+ class OneHand < HandGesture
193
+ property :amount, Integer, :default => -1
194
+
195
+
196
+
197
+
198
+
199
+ # overwritten process event method to not save state - this will be done by activation callback
200
+ def process_event(event, callback=nil)
201
+ process_event!(event,callback)
202
+
203
+ end
204
+
205
+ def activate(state,abstract_states, atomic_states)
206
+ @counter += 1
207
+ puts "saved on activation #{state} #{abstract_states.join "|"} #{atomic_states}"
208
+ #update(:states =>atomic_states.join('|'),:abstract_states=> abstract_states.join('|'),:amount=>@counter)
209
+ attribute_set(:new_states, state)
210
+
211
+ attribute_set(:states, atomic_states.join('|'))
212
+ attribute_set(:abstract_states, abstract_states.join('|'))
213
+ attribute_set(:amount, @counter)
214
+ save
215
+ end
216
+
217
+ def start_ticker
218
+ @timer = EM::PeriodicTimer.new(@command_timeout) {
219
+ self.process_event :tick
220
+ }
221
+ end
222
+
223
+ def stop_ticker
224
+ @timer.cancel
225
+ end
226
+
227
+ def restart_ticker
228
+ stop_ticker
229
+ start_ticker
230
+ end
231
+
232
+ def start_timeout
233
+ p "Timeout started 60 s"
234
+ @timeout = EM::Timer.new(60) {
235
+ p "timeout60s fired"
236
+ process_event :to_clock
237
+ }
238
+ end
239
+
240
+ def stop_timeout
241
+ @timeout.cancel if @timeout
242
+ end
243
+
244
+ def restart_timeout
245
+ stop_timeout
246
+ start_timeout
247
+ end
248
+ end
249
+
250
+ class TwoHands < HandGesture
251
+ end
252
+
253
+ class NoHands < HandGesture
254
+ end
255
+
256
+ class Speed < Element
257
+ property :value, Integer, :default => -1
258
+
259
+ def initialize_statemachine
260
+ if @statemachine.blank?
261
+ @statemachine = Statemachine.build do
262
+ trans :set,:faster,:fast
263
+ trans :set,:slower, :slow
264
+ trans :fast,:tick,:set
265
+ trans :slow,:tick,:set
266
+
267
+ state :slow do
268
+ on_entry Proc.new {process_event :tick }
269
+ end
270
+ state :fast do
271
+ on_entry Proc.new {process_event :tick }
272
+ end
273
+ end
274
+ end
275
+ end
276
+ end
277
+
278
+ end
279
+