MINT-core 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +22 -3
- data/Gemfile.lock +98 -22
- data/History.txt +262 -0
- data/LICENSE +30 -0
- data/MINT-core.gemspec +25 -80
- data/Manifest.txt +145 -30
- data/README.rdoc +6 -163
- data/Rakefile +16 -17
- data/bin/mint-aui +3 -3
- data/bin/mint-cui-gfx +3 -2
- data/bin/mint-juggernaut.sh +0 -0
- data/bin/mint-tuplespace +0 -0
- data/lib/MINT-core.rb +53 -15
- data/lib/MINT-core/agent/agent.rb +1 -1
- data/lib/MINT-core/agent/aui.rb +0 -14
- data/lib/MINT-core/agent/auicontrol.rb +91 -38
- data/lib/MINT-core/agent/cui-gfx.rb +3 -3
- data/lib/MINT-core/agent/cuicontrol.rb +94 -24
- data/lib/MINT-core/connector/redis_connector.rb +16 -0
- data/lib/MINT-core/manager/mapping_manager.rb +101 -0
- data/lib/MINT-core/manager/mapping_parser.rb +89 -0
- data/lib/MINT-core/manager/mapping_server.rb +99 -0
- data/lib/MINT-core/manager/position_updater.rb +33 -0
- data/lib/MINT-core/manager/scxml_client.rb +118 -0
- data/lib/MINT-core/manager/scxml_server.rb +86 -0
- data/lib/MINT-core/mapping/action/action.rb +32 -0
- data/lib/MINT-core/mapping/action/backend_action.rb +32 -0
- data/lib/MINT-core/mapping/action/bind_action.rb +88 -0
- data/lib/MINT-core/mapping/action/event_action.rb +40 -0
- data/lib/MINT-core/mapping/complementary_mapping.rb +31 -0
- data/lib/MINT-core/mapping/mapping.rb +170 -34
- data/lib/MINT-core/mapping/observation/negation_observation.rb +64 -0
- data/lib/MINT-core/mapping/observation/observation.rb +219 -0
- data/lib/MINT-core/mapping/sequential.rb +1 -2
- data/lib/MINT-core/mapping/sequential_mapping.rb +60 -0
- data/lib/MINT-core/model/aui/AIChoiceElement.rb +17 -0
- data/lib/MINT-core/model/aui/AICommand.rb +7 -0
- data/lib/MINT-core/model/aui/AIContainer.rb +73 -0
- data/lib/MINT-core/model/aui/AIContext.rb +12 -0
- data/lib/MINT-core/model/aui/AIIN.rb +8 -0
- data/lib/MINT-core/model/aui/AIINContinuous.rb +56 -0
- data/lib/MINT-core/model/aui/AIINDiscrete.rb +8 -0
- data/lib/MINT-core/model/aui/AIMultiChoice.rb +1 -2
- data/lib/MINT-core/model/aui/AIMultiChoiceElement.rb +4 -51
- data/lib/MINT-core/model/aui/AIO.rb +76 -123
- data/lib/MINT-core/model/aui/AIOUT.rb +8 -0
- data/lib/MINT-core/model/aui/AIOUTContinuous.rb +61 -0
- data/lib/MINT-core/model/aui/AIReference.rb +16 -0
- data/lib/MINT-core/model/aui/AISingleChoice.rb +18 -1
- data/lib/MINT-core/model/aui/AISingleChoiceElement.rb +10 -56
- data/lib/MINT-core/model/aui/AISinglePresence.rb +39 -71
- data/lib/MINT-core/model/aui/aicommand.scxml +47 -0
- data/lib/MINT-core/model/aui/aicontainer.scxml +41 -0
- data/lib/MINT-core/model/aui/aicontext.scxml +34 -0
- data/lib/MINT-core/model/aui/aiincontinuous.scxml +59 -0
- data/lib/MINT-core/model/aui/aiinrange.scxml +86 -0
- data/lib/MINT-core/model/aui/aimultichoice.scxml +67 -0
- data/lib/MINT-core/model/aui/aimultichoiceelement.scxml +51 -0
- data/lib/MINT-core/model/aui/aio.scxml +18 -27
- data/lib/MINT-core/model/aui/aioutcontinuous.scxml +66 -0
- data/lib/MINT-core/model/aui/aireference.scxml +28 -0
- data/lib/MINT-core/model/aui/aisinglechoice.scxml +60 -0
- data/lib/MINT-core/model/aui/aisinglechoiceelement.scxml +45 -60
- data/lib/MINT-core/model/aui/aisinglepresence.scxml +15 -24
- data/lib/MINT-core/model/aui/model.rb +15 -38
- data/lib/MINT-core/model/cui/gfx/CIC.rb +34 -10
- data/lib/MINT-core/model/cui/gfx/CIO.rb +66 -115
- data/lib/MINT-core/model/cui/gfx/CarouFredSel.scxml +58 -0
- data/lib/MINT-core/model/cui/gfx/MarkableRadioButton.rb +8 -0
- data/lib/MINT-core/model/cui/gfx/RadioButton.rb +8 -0
- data/lib/MINT-core/model/cui/gfx/RadioButtonGroup.rb +6 -0
- data/lib/MINT-core/model/cui/gfx/button.rb +16 -0
- data/lib/MINT-core/model/cui/gfx/button.scxml +58 -0
- data/lib/MINT-core/model/cui/gfx/caroufredsel.rb +48 -0
- data/lib/MINT-core/model/cui/gfx/cic.scxml +57 -0
- data/lib/MINT-core/model/cui/gfx/cio.scxml +54 -0
- data/lib/MINT-core/model/cui/gfx/markableradiobutton.scxml +67 -0
- data/lib/MINT-core/model/cui/gfx/model.rb +39 -176
- data/lib/MINT-core/model/cui/gfx/radiobutton.scxml +59 -0
- data/lib/MINT-core/model/interactor.rb +167 -46
- data/lib/MINT-core/model/interactor.scxml +3 -0
- data/lib/MINT-core/model/interactor_helpers.rb +25 -0
- data/lib/MINT-core/model/ir/body/OneHandPoseNavigation.rb +15 -0
- data/lib/MINT-core/model/ir/body/body.rb +5 -0
- data/lib/MINT-core/model/ir/body/fingertip.rb +114 -0
- data/lib/MINT-core/model/ir/body/fingertip.scxml +43 -0
- data/lib/MINT-core/model/{body → ir/body}/gesture_button.rb +0 -0
- data/lib/MINT-core/model/ir/body/hand.rb +5 -0
- data/lib/MINT-core/model/ir/body/head.rb +102 -0
- data/lib/MINT-core/model/ir/body/head.scxml +92 -0
- data/lib/MINT-core/model/ir/body/onehandposenavigation.scxml +53 -0
- data/lib/MINT-core/model/ir/body/pose.rb +99 -0
- data/lib/MINT-core/model/ir/browserscreen.rb +27 -0
- data/lib/MINT-core/model/ir/browserscreen.scxml +14 -0
- data/lib/MINT-core/model/{device → ir}/button.rb +1 -1
- data/lib/MINT-core/model/ir/ir.rb +5 -0
- data/lib/MINT-core/model/ir/irmedia.rb +5 -0
- data/lib/MINT-core/model/ir/irmode.rb +5 -0
- data/lib/MINT-core/model/{device → ir}/joypad.rb +1 -1
- data/lib/MINT-core/model/ir/mouse.rb +44 -0
- data/lib/MINT-core/model/ir/mouse.scxml +35 -0
- data/lib/MINT-core/model/{device/mouse.rb → ir/mouse_old.rb} +2 -2
- data/lib/MINT-core/model/{device → ir}/pointer.rb +20 -22
- data/lib/MINT-core/model/ir/pointer.scxml +19 -0
- data/lib/MINT-core/model/ir/screen.rb +5 -0
- data/lib/MINT-core/model/{device → ir}/wheel.rb +1 -1
- data/lib/MINT-core/model/mim/aicommand_activate_to_button_press.xml +13 -0
- data/lib/MINT-core/model/mim/aicommand_deactivate_to_button_release.xml +13 -0
- data/lib/MINT-core/model/mim/aio_defocus_to_cio_unhighlight.xml +13 -0
- data/lib/MINT-core/model/mim/aio_focus_to_cio_highlight.xml +14 -0
- data/lib/MINT-core/model/mim/aio_present_to_cio_display.xml +14 -0
- data/lib/MINT-core/model/mim/aio_suspend_to_cio_hide.xml +13 -0
- data/lib/MINT-core/model/mim/aisinglechoice_present_to_child_present.xml +14 -0
- data/lib/MINT-core/model/mim/aisinglechoiceelement_chosen_to_radiobutton_select.xml +13 -0
- data/lib/MINT-core/model/mim/aisinglechoiceelement_unchosen_to_radiobutton_unselect.xml +13 -0
- data/lib/MINT-core/model/mim/aisinglepresence_children_finished_to_caroufredsel_init_js.xml +14 -0
- data/lib/MINT-core/model/mim/aisinglepresence_present_to_child_present.xml +15 -0
- data/lib/MINT-core/model/mim/browserscreen_reload_to_cuicontrol_refresh_all.xml +12 -0
- data/lib/MINT-core/model/mim/button_press_to_aicommand_activate.xml +12 -0
- data/lib/MINT-core/model/mim/button_release_to_aicommand_deactivate.xml +12 -0
- data/lib/MINT-core/model/mim/caroufredsel_refreshing_to_caroufredsel_init_js.xml +14 -0
- data/lib/MINT-core/model/mim/cio_display_to_aio_defocus.xml +13 -0
- data/lib/MINT-core/model/mim/cio_display_to_aio_present.xml +12 -0
- data/lib/MINT-core/model/mim/cio_display_to_cio_display_cache_add.xml +11 -0
- data/lib/MINT-core/model/mim/cio_hide_to_aio_suspend.xml +12 -0
- data/lib/MINT-core/model/mim/cio_hide_to_cio_display_cache_remove.xml +12 -0
- data/lib/MINT-core/model/mim/cio_highlight_to_aio_focus.xml +13 -0
- data/lib/MINT-core/model/mim/head_looking_left_to_aisinglepresence_prev.xml +14 -0
- data/lib/MINT-core/model/mim/head_looking_right_to_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/head_nodding_to_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/head_tilting_left_to_aisinglepresence_prev.xml +14 -0
- data/lib/MINT-core/model/mim/head_tilting_right_to_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/left_button_aisinglepresence_enter.xml +15 -0
- data/lib/MINT-core/model/mim/left_button_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/mim_default.xml +52 -0
- data/lib/MINT-core/model/mim/mint-mappings.xsd +127 -0
- data/lib/MINT-core/model/mim/mouse_press_to_aicommand_activate.xml +17 -0
- data/lib/MINT-core/model/mim/mouse_press_to_aisinglechoiceelement_choose.xml +17 -0
- data/lib/MINT-core/model/mim/mouse_press_to_aisinglechoiceelement_unchoose.xml +17 -0
- data/lib/MINT-core/model/mim/mouse_release_to_aicommand_deactivate.xml +16 -0
- data/lib/MINT-core/model/mim/mouse_stop_to_cio_highlight.xml +13 -0
- data/lib/MINT-core/model/mim/onehandposnav_confirm_to_aichoiceelement_choose.xml +14 -0
- data/lib/MINT-core/model/mim/onehandposnav_next_to_aio_next.xml +14 -0
- data/lib/MINT-core/model/mim/onehandposnav_previous_to_aio_prev.xml +14 -0
- data/lib/MINT-core/model/mim/radiobutton_selected_to_aisinglechoiceelement_choose.xml +13 -0
- data/lib/MINT-core/model/mim/radiobutton_unselected_to_aisinglechoiceelement_unchoose.xml +13 -0
- data/lib/MINT-core/model/mim/right_button_aisinglepresence_prev.xml +15 -0
- data/lib/MINT-core/model/task.rb +6 -6
- data/script/console +0 -0
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/spec/AICommand_spec.rb +20 -0
- data/spec/AIContainer_spec.rb +161 -0
- data/spec/AIINContinuous_spec.rb +92 -0
- data/spec/AIOUTContinuous_spec.rb +93 -0
- data/spec/AIO_spec.rb +73 -0
- data/spec/AIReference_spec.rb +105 -0
- data/spec/AISinglePresence_spec.rb +204 -60
- data/spec/Button_spec.rb +114 -0
- data/spec/CIO_spec.rb +145 -0
- data/spec/Interactor_spec.rb +95 -0
- data/spec/MappingManager_spec.rb +126 -0
- data/spec/Spontaneous_spec.rb +53 -0
- data/spec/aio_agent_spec.rb +215 -186
- data/spec/aisinglechoice_spec.rb +147 -88
- data/spec/aisinglechoiceelement_spec.rb +154 -70
- data/spec/complementary_mapping_spec.rb +158 -0
- data/spec/core_spec.rb +27 -15
- data/spec/cui_helper.rb +100 -0
- data/spec/examples/browserscreen_reload_to_cuicontrol_refresh_all.xml +12 -0
- data/spec/examples/mim_streaming_example.xml +9 -0
- data/spec/examples/mouse_highlight.xml +22 -0
- data/spec/examples/performance_mapping.xml +15 -0
- data/spec/examples/reset_click.xml +24 -0
- data/spec/interactor_test.scxml +32 -0
- data/spec/interactor_test_2.scxml +16 -0
- data/spec/mapping_performance_spec.rb +118 -0
- data/spec/mapping_server_spec.rb +161 -0
- data/spec/mapping_spec.rb +307 -0
- data/spec/music_spec.rb +301 -135
- data/spec/performance_counter.scxml +9 -0
- data/spec/sequential_mappings_spec.rb +69 -0
- data/spec/shared/aio_shared.rb +144 -0
- data/spec/spec_helper.rb +22 -3
- data/spec/spontaneous.scxml +11 -0
- data/spec/support/connection_helper.rb +19 -0
- data/spec/support/redis_connector_monkey_patch.rb +1 -0
- data/spec/support/statemachine_helper.rb +84 -0
- data/spec/sync_mappings_spec.rb +96 -0
- metadata +219 -354
- data/lib/MINT-core/mapping/complementary.rb +0 -100
- data/lib/MINT-core/mapping/on_state_change.rb +0 -65
- data/lib/MINT-core/model/aui/AIC.rb +0 -86
- data/lib/MINT-core/model/aui/AIChoice.rb +0 -65
- data/lib/MINT-core/model/aui/AIINChoose.rb +0 -54
- data/lib/MINT-core/model/aui/AIOUTDiscrete.rb +0 -43
- data/lib/MINT-core/model/aui/aic.png +0 -0
- data/lib/MINT-core/model/aui/aic.scxml +0 -50
- data/lib/MINT-core/model/aui/aichoice.png +0 -0
- data/lib/MINT-core/model/aui/aichoice.scxml +0 -60
- data/lib/MINT-core/model/aui/aio.png +0 -0
- data/lib/MINT-core/model/aui/aisinglechoiceelement.png +0 -0
- data/lib/MINT-core/model/aui/aisinglepresence.png +0 -0
- data/lib/MINT-core/model/body/handgesture.rb +0 -279
- data/lib/MINT-core/model/body/head.png +0 -0
- data/lib/MINT-core/model/body/head.rb +0 -51
- data/lib/MINT-core/model/body/head.scxml +0 -28
- data/lib/MINT-core/model/cui/gfx/screen.rb +0 -18
- data/lib/MINT-core/overrides/rinda.rb +0 -34
- data/spec/AIC_spec.rb +0 -69
- data/spec/MINT-core_spec.rb +0 -11
- data/spec/aio_spec.rb +0 -144
- data/spec/cio_spec.rb +0 -369
- data/tasks/rspec.rake +0 -21
@@ -0,0 +1,56 @@
|
|
1
|
+
module MINT
|
2
|
+
|
3
|
+
|
4
|
+
class AIINContinuous < AIIN
|
5
|
+
|
6
|
+
property :data, Integer
|
7
|
+
property :min, Integer,:default => 0
|
8
|
+
property :max, Integer,:default => 100
|
9
|
+
|
10
|
+
def getSCXML
|
11
|
+
"#{File.dirname(__FILE__)}/aiincontinuous.scxml"
|
12
|
+
end
|
13
|
+
|
14
|
+
# functions called from scxml
|
15
|
+
|
16
|
+
def publish(attribute)
|
17
|
+
channel_name = create_attribute_channel_name(attribute)
|
18
|
+
|
19
|
+
redis = RedisConnector.redis
|
20
|
+
|
21
|
+
fiber = Fiber.current
|
22
|
+
|
23
|
+
redis.pubsub.psubscribe('in_channel:Interactor.AIO.AIIN.AIINContinuous.'+self.name.to_s+":*") { |key,message|
|
24
|
+
sync_states
|
25
|
+
if message.eql? "stop"
|
26
|
+
process_event("halt")
|
27
|
+
else
|
28
|
+
d = attribute_get(:data)
|
29
|
+
|
30
|
+
if d
|
31
|
+
if message.to_i > d and not (is_in?(:progressing) or is_in?(:max))# state comparison just for performance
|
32
|
+
process_event("progress")
|
33
|
+
elsif message.to_i < d and not (is_in?(:regressing) or is_in?(:min))
|
34
|
+
process_event("regress")
|
35
|
+
end
|
36
|
+
else
|
37
|
+
# @statemachine.process_event("progress") # default progress TODO improve default handling for first data
|
38
|
+
process_event("progress")
|
39
|
+
end
|
40
|
+
|
41
|
+
attribute_set(:data,message.to_i)
|
42
|
+
RedisConnector.redis.publish channel_name,MultiJson.encode({:name=>self.name,:data => data})
|
43
|
+
end
|
44
|
+
|
45
|
+
}.callback { fiber.resume}
|
46
|
+
Fiber.yield
|
47
|
+
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
def halt(id)
|
52
|
+
RedisConnector.sub.unsubscribe(self.class.create_channel_name+".#{id}")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -1,56 +1,9 @@
|
|
1
1
|
module MINT
|
2
|
-
class AIMultiChoiceElement <
|
3
|
-
def initialize_statemachine
|
4
|
-
if @statemachine.blank?
|
5
|
-
@statemachine = Statemachine.build do
|
2
|
+
class AIMultiChoiceElement < AIChoiceElement
|
6
3
|
|
7
|
-
|
8
|
-
|
9
|
-
trans :organized, :present, :p
|
10
|
-
trans :suspended,:present, :initialized
|
11
|
-
|
12
|
-
parallel :p do
|
13
|
-
statemachine :s1 do
|
14
|
-
superstate :presenting do
|
15
|
-
state :defocused do
|
16
|
-
on_entry :sync_cio_to_displayed
|
17
|
-
end
|
18
|
-
state :focused do
|
19
|
-
on_entry :sync_cio_to_highlighted
|
20
|
-
end
|
21
|
-
trans :defocused,:focus,:focused
|
22
|
-
trans :focused,:defocus, :defocused
|
23
|
-
trans :focused, :next, :defocused, :focus_next, Proc.new { exists_next}
|
24
|
-
trans :focused, :prev, :defocused, :focus_previous, Proc.new { exists_prev}
|
25
|
-
trans :focused, :parent, :defocused, :focus_parent
|
26
|
-
event :suspend, :suspended
|
27
|
-
end
|
28
|
-
end
|
29
|
-
statemachine :s2 do
|
30
|
-
superstate :choice do
|
31
|
-
trans :listed, :choose, :chosen
|
32
|
-
# trans :chosen, :drag, :dragging
|
33
|
-
# trans :dragging, :drop, :chosen
|
34
|
-
trans :chosen, :unchoose, :listed
|
35
|
-
|
36
|
-
trans :listed, :drag, :dragging
|
37
|
-
trans :dragging, :drop, :listed
|
38
|
-
|
39
|
-
state :chosen do
|
40
|
-
on_entry :sync_cio_to_selected
|
41
|
-
end
|
42
|
-
|
43
|
-
state :listed do
|
44
|
-
on_entry :sync_cio_to_listed
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
#end
|
51
|
-
end
|
52
|
-
end
|
4
|
+
def getSCXML
|
5
|
+
"#{File.dirname(__FILE__)}/aimultichoiceelement.scxml"
|
53
6
|
end
|
54
|
-
|
7
|
+
|
55
8
|
end
|
56
9
|
end
|
@@ -1,77 +1,78 @@
|
|
1
1
|
module MINT
|
2
|
+
DataMapper::Model.raise_on_save_failure = true
|
2
3
|
|
4
|
+
class AIO < Interactor
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
property :
|
7
|
-
property :
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
#else
|
61
|
-
#@statemachine.reset
|
6
|
+
# TODO Links are established without Datamapper's relations because of problems with cycles and self-references (AIContainer))
|
7
|
+
property :parent, String
|
8
|
+
property :previous, String
|
9
|
+
property :next, String
|
10
|
+
|
11
|
+
def self.getModel
|
12
|
+
"aui"
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def getSCXML
|
17
|
+
"#{File.dirname(__FILE__)}/aio.scxml"
|
18
|
+
end
|
19
|
+
|
20
|
+
def parent
|
21
|
+
p = super
|
22
|
+
if p
|
23
|
+
r = AIContainer.get("aui",p)
|
24
|
+
return r
|
25
|
+
else
|
26
|
+
nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def parent= (p)
|
31
|
+
if p.nil? or p.is_a? String
|
32
|
+
super(p)
|
33
|
+
else
|
34
|
+
super(p.name)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def parent2str
|
39
|
+
parent.name if self.parent
|
40
|
+
end
|
41
|
+
|
42
|
+
def next
|
43
|
+
p = super
|
44
|
+
if p
|
45
|
+
AIO.get("aui",p)
|
46
|
+
else
|
47
|
+
nil
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def next2str
|
52
|
+
self.next.name if self.next
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
def previous
|
57
|
+
p = super
|
58
|
+
if p
|
59
|
+
AIO.get("aui",p)
|
60
|
+
else
|
61
|
+
nil
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
+
def previous2str
|
66
|
+
previous.name if self.previous
|
67
|
+
end
|
68
|
+
|
69
|
+
|
65
70
|
# hook to inform parent about presenting state
|
66
71
|
def inform_parent_presenting
|
67
72
|
self.parent.child_to_presenting(self) if (self.parent)
|
68
73
|
true
|
69
74
|
end
|
70
75
|
|
71
|
-
def sync_event(event)
|
72
|
-
process_event(event, AIO_sync_callback.new)
|
73
|
-
end
|
74
|
-
|
75
76
|
# callbacks
|
76
77
|
|
77
78
|
def exists_next
|
@@ -82,19 +83,10 @@ module MINT
|
|
82
83
|
self.previous!=nil
|
83
84
|
end
|
84
85
|
|
85
|
-
def
|
86
|
-
|
87
|
-
if self.next.process_event("focus")
|
88
|
-
return true
|
89
|
-
else
|
90
|
-
puts "ERRROR #{self.next.name} could not execute focus event"
|
91
|
-
return false
|
86
|
+
def exists_parent
|
87
|
+
self.parent!=nil
|
92
88
|
end
|
93
|
-
|
94
|
-
puts "WARNING!! > no next element found!"
|
95
|
-
return false
|
96
|
-
end
|
97
|
-
end
|
89
|
+
|
98
90
|
|
99
91
|
def focus_previous
|
100
92
|
if (self.previous)
|
@@ -112,59 +104,20 @@ module MINT
|
|
112
104
|
end
|
113
105
|
end
|
114
106
|
|
115
|
-
def
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
# cio.states=[:highlighted]
|
120
|
-
end
|
121
|
-
true
|
122
|
-
end
|
123
|
-
|
124
|
-
def sync_cio_to_displayed
|
125
|
-
cio = MINT::CIO.first(:name=>self.name)
|
126
|
-
if (cio and not cio.is_in? :displayed)
|
127
|
-
if (cio.is_in? :suspended or cio.is_in? :positioned)
|
128
|
-
cio.sync_event(:display)
|
107
|
+
def focus_next
|
108
|
+
if (self.next)
|
109
|
+
if self.next.process_event("focus")
|
110
|
+
return true
|
129
111
|
else
|
130
|
-
|
112
|
+
puts "ERRROR #{self.next.name} could not execute focus event"
|
113
|
+
return false
|
131
114
|
end
|
132
|
-
|
115
|
+
else
|
116
|
+
puts "WARNING!! > no next element found!"
|
117
|
+
return false
|
133
118
|
end
|
134
|
-
true
|
135
119
|
end
|
136
120
|
|
137
|
-
def sync_cio_to_hidden
|
138
|
-
cio = MINT::CIO.first(:name=>self.name)
|
139
|
-
if (cio and not cio.is_in? :hidden)
|
140
|
-
cio.sync_event(:hide)
|
141
|
-
end
|
142
|
-
true
|
143
|
-
end
|
144
121
|
end
|
145
122
|
|
146
|
-
|
147
|
-
class AIO_sync_callback
|
148
|
-
def sync_cio_to_highlighted
|
149
|
-
true
|
150
|
-
end
|
151
|
-
|
152
|
-
def sync_cio_to_displayed
|
153
|
-
true
|
154
|
-
end
|
155
|
-
|
156
|
-
def sync_cio_to_suspended
|
157
|
-
true
|
158
|
-
end
|
159
|
-
def inform_parent_presenting
|
160
|
-
true
|
161
|
-
end
|
162
|
-
def present_first_child
|
163
|
-
true
|
164
|
-
end
|
165
|
-
|
166
|
-
def present_children
|
167
|
-
true
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
123
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module MINT
|
2
|
+
class AIOUTContinuous < AIOUT
|
3
|
+
|
4
|
+
property :data, Integer, :default => 0
|
5
|
+
property :min, Integer,:default => 0
|
6
|
+
property :max, Integer,:default => 100
|
7
|
+
|
8
|
+
def getSCXML
|
9
|
+
"#{File.dirname(__FILE__)}/aioutcontinuous.scxml"
|
10
|
+
end
|
11
|
+
|
12
|
+
PUBLISH_ATTRIBUTES += [:data]
|
13
|
+
|
14
|
+
# functions called from scxml
|
15
|
+
|
16
|
+
def data=(value)
|
17
|
+
super # use original method instead of accessing @ivar directly
|
18
|
+
publish_update_new
|
19
|
+
end
|
20
|
+
|
21
|
+
def publish_update_new
|
22
|
+
RedisConnector.redis.publish create_attribute_channel_name('data'), self.to_json(:only => self.class::PUBLISH_ATTRIBUTES)
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def consume(attribute)
|
27
|
+
@d = 0
|
28
|
+
|
29
|
+
channel_name = create_attribute_channel_name(attribute)
|
30
|
+
p "subscribed #{channel_name}"
|
31
|
+
|
32
|
+
redis = RedisConnector.redis
|
33
|
+
|
34
|
+
fiber = Fiber.current
|
35
|
+
|
36
|
+
redis.pubsub.subscribe(channel_name) { |message|
|
37
|
+
found=MultiJson.decode message
|
38
|
+
|
39
|
+
if self.name.eql? found['name']
|
40
|
+
if found['data']
|
41
|
+
@d = found['data'].to_i
|
42
|
+
@data = attribute_get(:data)
|
43
|
+
|
44
|
+
process_event "move"
|
45
|
+
restart_timeout(1,:halt)
|
46
|
+
|
47
|
+
attribute_set(:data,@d)
|
48
|
+
RedisConnector.redis.publish("out_channel:#{create_channel_w_name}:testuser",@data)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
}.callback { fiber.resume}
|
52
|
+
Fiber.yield
|
53
|
+
@d
|
54
|
+
end
|
55
|
+
|
56
|
+
def halt(id)
|
57
|
+
RedisConnector.sub.unsubscribe(self.class.create_channel_name+".#{id}")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|