-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_doSend.xml
87 lines (75 loc) · 2.12 KB
/
test_doSend.xml
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
<?xml version="1.0"?>
<!--
This XML is a simple test to validate the behaviour of the Softswitch surrounding
the doSend behaviour in the OnSend handler. This example verifies that doSend is
present and respected.
The supervisor will print a single string to the console of
"** SUPERVISOR** Received Index 10"
and then exit if the test completes successfully.
-->
<Graphs xmlns="" appname="test_doSend">
<GraphType id="test_doSend_type">
<SharedCode><![CDATA[
#include <stdlib.h>
]]></SharedCode>
<Properties><![CDATA[
uint32_t ignoreCnt = 10;
]]></Properties>
<MessageTypes>
<MessageType id="test">
<Message><![CDATA[
uint32_t idx;
]]></Message>
</MessageType>
</MessageTypes>
<DeviceTypes>
<DeviceType id="A">
<State><![CDATA[
uint8_t sCnt = 0;
]]></State>
<OnInit><![CDATA[
return 1; // Trigger RTS
]]></OnInit>
<ReadyToSend><![CDATA[
if (DEVICESTATE(sCnt) <= GRAPHPROPERTIES(ignoreCnt))
{
RTSSUP();
}
]]></ReadyToSend>
<SupervisorOutPin messageTypeId="test">
<OnSend><![CDATA[
PKT(idx) = DEVICESTATE(sCnt);
if (DEVICESTATE(sCnt) < GRAPHPROPERTIES(ignoreCnt))
{
*doSend = false;
}
DEVICESTATE(sCnt)++;
]]></OnSend>
</SupervisorOutPin>
</DeviceType>
<SupervisorType id="supervisorNode">
<Code><![CDATA[
#include <iostream>
#include <sstream>
#include <string>
#include <cstdio>
]]></Code>
<SupervisorInPin id="updateIn" messageTypeId="test">
<OnReceive><![CDATA[
std::cout << "** SUPERVISOR** Received Index " << PKT(idx) << std::endl;
if(PKT(idx) >= GRAPHPROPERTIES(ignoreCnt))
{
Super::stop_application();
}
]]></OnReceive>
</SupervisorInPin>
</SupervisorType>
</DeviceTypes>
</GraphType>
<GraphInstance id="test_doSend_instance"
graphTypeId="test_doSend_type">
<DeviceInstances>
<DevI id="0" type="A"/>
</DeviceInstances>
</GraphInstance>
</Graphs>