blob: 0cf760400249f8ef63f9fa597accba568b07b6d7 (
plain) (
blame)
1
2
3
4
5
6
7
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd-->
<html xmlns="http://www.w3.org/1999/xhtml"
>
<head><title>Setup the model</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<!-- xhtml,3,next,html -->
<meta name="src" content="etrice-doc.tex" />
<meta name="date" content="2013-03-25 22:23:00" />
<link rel="stylesheet" type="text/css" href="etrice-doc.css" />
</head><body
>
<!--l. 25--><div class="crosslinks"><p class="noindent">[<a
href="etrice-docse31.html" >next</a>] [<a
href="etrice-docse29.html" >prev</a>] [<a
href="etrice-docse29.html#tailetrice-docse29.html" >prev-tail</a>] [<a
href="#tailetrice-docse30.html">tail</a>] [<a
href="etrice-docch8.html#etrice-docse30.html" >up</a>] </p></div>
<h3 class="sectionHead"><span class="titlemark">8.2 </span> <a
id="x40-560008.2"></a>Setup the model</h3>
<ul class="itemize1">
<li class="itemize">Use the <span
class="ecti-1000">New Model Wizzard </span>to create a new eTrice project and name it
<span
class="ecti-1000">PedLightsController</span>.
</li>
<li class="itemize">Copy the package <span
class="ecti-1000">org.eclipse.etrice.tutorials.PedLightGUI </span>to your <span
class="ecti-1000">src</span>
directory (see blinky tutorial).
</li>
<li class="itemize">In PedestrianLightWndNoTcp.jav uncomment line 15 (import), 36, 122
(usage) and 132-134 (registration). The error markers will disappear after
the code is generated from the model.
</li>
<li class="itemize">
<div class="flushleft"
>
<!--l. 31--><p class="noindent" >
Copy the model from /org.eclipse.etrice.tutorials/model/PedLightsController
to your model file, or run the model directly in the tutorial directory.</p></div>
</li>
<li class="itemize">Adapt the import statement to your path.</li></ul>
<div class="verbatim" id="verbatim-17">
import room.basic.service.timing.* from
 <br />"../../org.eclipse.etrice.modellib/models/TimingService.room"
</div>
<!--l. 39--><p class="nopar" >
</p>
<ul class="itemize1">
<li class="itemize">Generate the code from the model.
</li>
<li class="itemize">Add the org.eclipse.etrice.modellib to the Java Class Path of your project.
</li>
<li class="itemize">All error markers should be disappeared and the model should be operable.
</li>
<li class="itemize">Arrange the Structure and the Statemachines to understand the model</li></ul>
<!--l. 49--><p class="noindent" ><img
src="images/030-PedLights01.png" alt="PIC"
/> The <span
class="ecti-1000">GuiAdapter </span>represents the interface to the external code. It registers its
<span
class="ecti-1000">ControlPort </span>by the external code.
</p><!--l. 53--><p class="noindent" ><img
src="images/030-PedLights02.png" alt="PIC"
/> Visit the initial transition to understand the registration. The actor handles the
incoming messages as usual and controls the traffic lights as known from
blinky.
</p><!--l. 57--><p class="noindent" ><img
src="images/030-PedLights03.png" alt="PIC"
/> The <span
class="ecti-1000">Controller </span>receives the <span
class="ecti-1000">start </span>message and controls the timing of the lights.
Note that the <span
class="ecti-1000">start </span>message will be sent from the external code whenever the
<span
class="ecti-1000">REQUEST </span>button is pressed.
</p>
<ul class="itemize1">
<li class="itemize">Visit the model and take a closer look to the following elements:
<ol class="enumerate1" >
<li
class="enumerate" id="x40-56002x1">PedControlProtocol => notice that the start message is defined as
usual
</li>
<li
class="enumerate" id="x40-56004x2">Initial transition of the <span
class="ecti-1000">GuiAdapter </span>=> see the registration
</li>
<li
class="enumerate" id="x40-56006x3">The <span
class="ecti-1000">Controller </span>=> notice that the <span
class="ecti-1000">Controller </span>receives the external
message (not the <span
class="ecti-1000">GuiAdapter</span>). The <span
class="ecti-1000">GuiAdapter </span>just provides its port
and handles the incoming messages.
</li>
<li
class="enumerate" id="x40-56008x4">Visit the hand written code => see the import statement of the
protocol class and the usage of the port.</li></ol>
</li>
<li class="itemize">Generate and test the model
</li>
<li class="itemize">Take a look at the generated MSC => notice that the start message will shown
as if the <span
class="ecti-1000">GuiAdapter </span>had sent it.</li></ul>
<!--l. 73--><p class="noindent" ><img
src="images/030-PedLights04.png" alt="PIC"
/>
</p>
<!--l. 76--><div class="crosslinks"><p class="noindent">[<a
href="etrice-docse31.html" >next</a>] [<a
href="etrice-docse29.html" >prev</a>] [<a
href="etrice-docse29.html#tailetrice-docse29.html" >prev-tail</a>] [<a
href="etrice-docse30.html" >front</a>] [<a
href="etrice-docch8.html#etrice-docse30.html" >up</a>] </p></div>
<!--l. 76--><p class="noindent" ><a
id="tailetrice-docse30.html"></a> </p>
</body></html>
|