07.01.2013 Views

Lecture Notes in Computer Science 3472

Lecture Notes in Computer Science 3472

Lecture Notes in Computer Science 3472

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

518 Zhen Ru Dai<br />

(1) /* test configuration function */<br />

function BluetoothSuite Configuration<br />

(<strong>in</strong>out SUT CType sut, <strong>in</strong>out TestCoord<strong>in</strong>ator CType mtc comp,<br />

<strong>in</strong>out SlaveApplication CType sa, <strong>in</strong>out Hardware CType hw,<br />

(5) <strong>in</strong>out Master CType m1, <strong>in</strong>out Master CType m2,<br />

<strong>in</strong>out Master CType m3, <strong>in</strong>out Master CType m4)<br />

runs on TestCoord<strong>in</strong>ator CType {<br />

// TestCoord<strong>in</strong>ator is assigned to MTC<br />

sa := SlaveApplication CType.create;<br />

(10) map (sut: p sa, sa: p sa);<br />

hw := Hardware CType.create;<br />

map (sut: p sh, hw: p sh);<br />

m1 := Master CType.create;<br />

connect (hw: p mh, m1: p mh);<br />

(15) connect (m1: p co, mtc comp: p co);<br />

m2 := Master CType.create;<br />

connect (hw: p mh, m2: p mh);<br />

connect (m2: p co, mtc comp: p co);<br />

m3 := Master CType.create;<br />

(20) connect (hw: p mh, m3: p mh);<br />

connect (m3: p co, mtc comp: p co);<br />

m4 := Master CType.create;<br />

connect (hw: p mh, m4: p mh);<br />

connect (m4: p co, mtc comp: p co);<br />

(25) }<br />

function NoWarn<strong>in</strong>g master (charstr<strong>in</strong>g master) runs on Master CType {<br />

var default master def := activate (Master Default ());<br />

if (master == ”M1”) {<br />

Connect to Master ma m1 ();<br />

(30) while (true) {<br />

p hm.receive (data); }<br />

}<br />

else if (master == ”M2”) {<br />

Connect to Master ma m1 ();<br />

(35) p hm.receive (con request); // failed request<br />

p co.send (con request);<br />

}<br />

else if (master == ”M3”) {<br />

Connect to Master ma m1 ();<br />

(40) p hm.receive (con request); // successful request<br />

p co.send (con request);<br />

p hm.send (con accept);<br />

p hm.receive (con confirm Type:{”M3”});<br />

p co.send (con confirm Type:{”M3”});<br />

(45) p co.receive (roam<strong>in</strong>gList Type:{”M1”,”M2”,”M4”});<br />

p hm.send (roam<strong>in</strong>gList Type:{”M1”,”M2”,”M4”});<br />

}<br />

deactivate (master def);<br />

}<br />

Fig. 17.16. Bluetooth Test Module (ctnd.): TTCN-3 Functions

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!