Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 277d92051f8e5e5582c96efda00b687d4d4ebcdb (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
package trafficlight.example;

import org.eclipse.etrice.runtime.java.messaging.MessageService;
import org.eclipse.etrice.runtime.java.messaging.RTServices;
import org.eclipse.etrice.runtime.java.messaging.Address;
import org.eclipse.etrice.runtime.java.messaging.IRTObject;
import org.eclipse.etrice.runtime.java.messaging.RTSystemServicesProtocol.*;
import org.eclipse.etrice.runtime.java.modelbase.ActorClassBase;
import org.eclipse.etrice.runtime.java.modelbase.SubSystemClassBase;
import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase;

import room.basic.service.tcp.*;import room.basic.service.timing.*;



public class SSTraffic extends SubSystemClassBase{

	
	public SSTraffic(String name) {
		super(name);
	}
	
	@Override
	public void receiveEvent(InterfaceItemBase ifitem, int evt, Object data){
	}
	
	@Override	
	public void instantiateMessageServices(){
	
		RTServices.getInstance().getMsgSvcCtrl().addMsgSvc(new MessageService(this, new Address(0, 0, 0),"MessageService_Main"));
		}

	@Override
	public void instantiateActors(){
		
		// all addresses
		// Addresses for the Subsystem Systemport
		Address addr_item_SystemPort_0 = new Address(0,0,130);
		Address addr_item_SystemPort_1 = new Address(0,0,131);
		Address addr_item_SystemPort_2 = new Address(0,0,132);
		Address addr_item_SystemPort_3 = new Address(0,0,133);
		Address addr_item_SystemPort_4 = new Address(0,0,134);
		Address addr_item_SystemPort_5 = new Address(0,0,135);
		Address addr_item_SystemPort_6 = new Address(0,0,136);
		
		// actor instance /SSTraffic/application itself => Systemport Address
		// TODOTJ: For each Actor, multiple addresses should be generated (actor?, systemport, debugport)
		Address addr_item__SSTraffic_application = new Address(0,0,101);
		// interface items of /SSTraffic/application
		// actor instance /SSTraffic/application/light1 itself => Systemport Address
		// TODOTJ: For each Actor, multiple addresses should be generated (actor?, systemport, debugport)
		Address addr_item__SSTraffic_application_light1 = new Address(0,0,102);
		// interface items of /SSTraffic/application/light1
		Address addr_item__SSTraffic_application_light1_controller = new Address(0,0,103);
		Address addr_item__SSTraffic_application_light1_tcpCtrl = new Address(0,0,104);
		Address addr_item__SSTraffic_application_light1_tcpPayload = new Address(0,0,105);
		Address addr_item__SSTraffic_application_light1_timeout = new Address(0,0,106);
		Address addr_item__SSTraffic_application_light1_blinkerTimeout = new Address(0,0,107);
		// actor instance /SSTraffic/application/light1/trafficLightSocket itself => Systemport Address
		// TODOTJ: For each Actor, multiple addresses should be generated (actor?, systemport, debugport)
		Address addr_item__SSTraffic_application_light1_trafficLightSocket = new Address(0,0,108);
		// interface items of /SSTraffic/application/light1/trafficLightSocket
		Address addr_item__SSTraffic_application_light1_trafficLightSocket_ControlPort = new Address(0,0,109);
		Address addr_item__SSTraffic_application_light1_trafficLightSocket_PayloadPort = new Address(0,0,110);
		// actor instance /SSTraffic/application/light2 itself => Systemport Address
		// TODOTJ: For each Actor, multiple addresses should be generated (actor?, systemport, debugport)
		Address addr_item__SSTraffic_application_light2 = new Address(0,0,111);
		// interface items of /SSTraffic/application/light2
		Address addr_item__SSTraffic_application_light2_controller = new Address(0,0,112);
		Address addr_item__SSTraffic_application_light2_tcpCtrl = new Address(0,0,113);
		Address addr_item__SSTraffic_application_light2_tcpPayload = new Address(0,0,114);
		Address addr_item__SSTraffic_application_light2_timeout = new Address(0,0,115);
		Address addr_item__SSTraffic_application_light2_blinkerTimeout = new Address(0,0,116);
		// actor instance /SSTraffic/application/light2/trafficLightSocket itself => Systemport Address
		// TODOTJ: For each Actor, multiple addresses should be generated (actor?, systemport, debugport)
		Address addr_item__SSTraffic_application_light2_trafficLightSocket = new Address(0,0,117);
		// interface items of /SSTraffic/application/light2/trafficLightSocket
		Address addr_item__SSTraffic_application_light2_trafficLightSocket_ControlPort = new Address(0,0,118);
		Address addr_item__SSTraffic_application_light2_trafficLightSocket_PayloadPort = new Address(0,0,119);
		// actor instance /SSTraffic/application/controller itself => Systemport Address
		// TODOTJ: For each Actor, multiple addresses should be generated (actor?, systemport, debugport)
		Address addr_item__SSTraffic_application_controller = new Address(0,0,120);
		// interface items of /SSTraffic/application/controller
		Address addr_item__SSTraffic_application_controller_light1 = new Address(0,0,121);
		Address addr_item__SSTraffic_application_controller_light2 = new Address(0,0,122);
		Address addr_item__SSTraffic_application_controller_timeout = new Address(0,0,123);
		// actor instance /SSTraffic/TimingService itself => Systemport Address
		// TODOTJ: For each Actor, multiple addresses should be generated (actor?, systemport, debugport)
		Address addr_item__SSTraffic_TimingService = new Address(0,0,124);
		// interface items of /SSTraffic/TimingService
		Address addr_item__SSTraffic_TimingService_timer_0 = new Address(0,0,125);
		Address addr_item__SSTraffic_TimingService_timer_1 = new Address(0,0,126);
		Address addr_item__SSTraffic_TimingService_timer_2 = new Address(0,0,127);
		Address addr_item__SSTraffic_TimingService_timer_3 = new Address(0,0,128);
		Address addr_item__SSTraffic_TimingService_timer_4 = new Address(0,0,129);

		// instantiate all actor instances
		instances = new ActorClassBase[7];
		instances[0] = new Application(
			this,
			"application",
			// own interface item addresses
			new Address[][] {{addr_item__SSTraffic_application}
			},
			// peer interface item addresses
			new Address[][] {{addr_item_SystemPort_0}
			}
		); 
		instances[1] = new TrafficLight(
			instances[0],
			"light1",
			// own interface item addresses
			new Address[][] {{addr_item__SSTraffic_application_light1},
				{
					addr_item__SSTraffic_application_light1_controller
				},
				{
					addr_item__SSTraffic_application_light1_tcpCtrl
				},
				{
					addr_item__SSTraffic_application_light1_tcpPayload
				},
				{
					addr_item__SSTraffic_application_light1_timeout
				},
				{
					addr_item__SSTraffic_application_light1_blinkerTimeout
				}
			},
			// peer interface item addresses
			new Address[][] {{addr_item_SystemPort_1},
				{
					addr_item__SSTraffic_application_controller_light1
				},
				{
					addr_item__SSTraffic_application_light1_trafficLightSocket_ControlPort
				},
				{
					addr_item__SSTraffic_application_light1_trafficLightSocket_PayloadPort
				},
				{
					addr_item__SSTraffic_TimingService_timer_0
				},
				{
					addr_item__SSTraffic_TimingService_timer_1
				}
			}
		); 
		instances[2] = new ATcpClient(
			instances[1],
			"trafficLightSocket",
			// own interface item addresses
			new Address[][] {{addr_item__SSTraffic_application_light1_trafficLightSocket},
				{
					addr_item__SSTraffic_application_light1_trafficLightSocket_ControlPort
				},
				{
					addr_item__SSTraffic_application_light1_trafficLightSocket_PayloadPort
				}
			},
			// peer interface item addresses
			new Address[][] {{addr_item_SystemPort_2},
				{
					addr_item__SSTraffic_application_light1_tcpCtrl
				},
				{
					addr_item__SSTraffic_application_light1_tcpPayload
				}
			}
		); 
		instances[3] = new TrafficLight(
			instances[0],
			"light2",
			// own interface item addresses
			new Address[][] {{addr_item__SSTraffic_application_light2},
				{
					addr_item__SSTraffic_application_light2_controller
				},
				{
					addr_item__SSTraffic_application_light2_tcpCtrl
				},
				{
					addr_item__SSTraffic_application_light2_tcpPayload
				},
				{
					addr_item__SSTraffic_application_light2_timeout
				},
				{
					addr_item__SSTraffic_application_light2_blinkerTimeout
				}
			},
			// peer interface item addresses
			new Address[][] {{addr_item_SystemPort_3},
				{
					addr_item__SSTraffic_application_controller_light2
				},
				{
					addr_item__SSTraffic_application_light2_trafficLightSocket_ControlPort
				},
				{
					addr_item__SSTraffic_application_light2_trafficLightSocket_PayloadPort
				},
				{
					addr_item__SSTraffic_TimingService_timer_2
				},
				{
					addr_item__SSTraffic_TimingService_timer_3
				}
			}
		); 
		instances[4] = new ATcpClient(
			instances[3],
			"trafficLightSocket",
			// own interface item addresses
			new Address[][] {{addr_item__SSTraffic_application_light2_trafficLightSocket},
				{
					addr_item__SSTraffic_application_light2_trafficLightSocket_ControlPort
				},
				{
					addr_item__SSTraffic_application_light2_trafficLightSocket_PayloadPort
				}
			},
			// peer interface item addresses
			new Address[][] {{addr_item_SystemPort_4},
				{
					addr_item__SSTraffic_application_light2_tcpCtrl
				},
				{
					addr_item__SSTraffic_application_light2_tcpPayload
				}
			}
		); 
		instances[5] = new TrafficController(
			instances[0],
			"controller",
			// own interface item addresses
			new Address[][] {{addr_item__SSTraffic_application_controller},
				{
					addr_item__SSTraffic_application_controller_light1
				},
				{
					addr_item__SSTraffic_application_controller_light2
				},
				{
					addr_item__SSTraffic_application_controller_timeout
				}
			},
			// peer interface item addresses
			new Address[][] {{addr_item_SystemPort_5},
				{
					addr_item__SSTraffic_application_light1_controller
				},
				{
					addr_item__SSTraffic_application_light2_controller
				},
				{
					addr_item__SSTraffic_TimingService_timer_4
				}
			}
		); 
		instances[6] = new ATimingService(
			this,
			"TimingService",
			// own interface item addresses
			new Address[][] {{addr_item__SSTraffic_TimingService},
				{
					addr_item__SSTraffic_TimingService_timer_0,
					addr_item__SSTraffic_TimingService_timer_1,
					addr_item__SSTraffic_TimingService_timer_2,
					addr_item__SSTraffic_TimingService_timer_3,
					addr_item__SSTraffic_TimingService_timer_4
				}
			},
			// peer interface item addresses
			new Address[][] {{addr_item_SystemPort_6},
				{
					addr_item__SSTraffic_application_light1_timeout,
					addr_item__SSTraffic_application_light1_blinkerTimeout,
					addr_item__SSTraffic_application_light2_timeout,
					addr_item__SSTraffic_application_light2_blinkerTimeout,
					addr_item__SSTraffic_application_controller_timeout
				}
			}
		); 
		
		// apply instance attribute configurations
		{
			TrafficLight inst = (TrafficLight) instances[1];
			inst.getIpConfig().setIPAddr("127.0.0.1");
			inst.getIpConfig().setTcpPort(4441);
		}
		{
			TrafficLight inst = (TrafficLight) instances[3];
			inst.getIpConfig().setIPAddr("127.0.0.1");
			inst.getIpConfig().setTcpPort(4442);
		}

		// create the subsystem system port	
		RTSystemPort = new RTSystemServicesProtocolConjPortRepl(this, "RTSystemPort",
				0, //local ID
				// own addresses
				new Address[]{
					addr_item_SystemPort_0,
					addr_item_SystemPort_1,
					addr_item_SystemPort_2,
					addr_item_SystemPort_3,
					addr_item_SystemPort_4,
					addr_item_SystemPort_5,
					addr_item_SystemPort_6
				},
				// peer addresses
				new Address[]{
					addr_item__SSTraffic_application,
					addr_item__SSTraffic_application_light1,
					addr_item__SSTraffic_application_light1_trafficLightSocket,
					addr_item__SSTraffic_application_light2,
					addr_item__SSTraffic_application_light2_trafficLightSocket,
					addr_item__SSTraffic_application_controller,
					addr_item__SSTraffic_TimingService
				});
		}
	
		
		@Override
		public void init(){
			super.init();
		}
			
		@Override
		public void stop(){
			super.stop();
		}
		
};

Back to the top