-
Notifications
You must be signed in to change notification settings - Fork 6
/
MessageProtocol.json
189 lines (184 loc) · 6.12 KB
/
MessageProtocol.json
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
{
"description": "schema for open messaging for System Analysis Simulation Coupling with EMRALD, and participating simulation codes",
"type": "object",
"required": [ "version", "pID", "msgType", "globalRunTime", "desc"],
"properties": {
"version": {
"description": "[major.minor.revision] Server and Client must operate on the same “Major” number for compatability",
"type": "string"
},
"pID": {
"description": "packet ID must be a GUID",
"type": "string"
},
"msgType": {
"description": "type of message in the oneOf. (ie - only must have an item named the same as the enum assigned minus the 'mt')",
"enum": ["mtOther", "mtRegister", "mtCompEv", "mtCompModify", "mtSimAction", "mtResponse"]
},
"globalRunTime": {
"description": "Time since beginning of main simulation. If sub simulation and unknown or can't calculate use '00:00:00'.",
"type": "string"
},
"desc": {
"description": "User readable info for message. Mainly for debug of model run.",
"type": "string"
},
"time": {
"description": "Optional - time of event or for action. For example when an event occured or future time when to execute an action.",
"type": "string"
}
},
"oneOf": [
{ "$ref": "#/definitions/mtRegister" },
{ "$ref": "#/definitions/mtOther" },
{ "$ref": "#/definitions/mtCompEv" },
{ "$ref": "#/definitions/mtCompModify" },
{ "$ref": "#/definitions/mtSimAction" },
{ "$ref": "#/definitions/mtResponse" }
],
"definitions": {
"compEvBase": {
"properties": {
"compID": {
"description": "The common identification id of the component between codes",
"type": "integer"
},
"info": {
"description": "string of data probably JSON, specific for external code data transfer and use by user defined scripts or custom code in EMRALD to drive decisions",
"type": "string"
}
}
},
"mtRegister": {
"properties": {
"register": {
"description": "pass this message affter connecting to XMPP server to register a simulation to be used by others",
"type": "object",
"required": ["clientName", "appName"],
"properties": {
"clientName": {
"description": "clent connection name should be the username for the XMPP connect. ClientName with appName must be unique for all connected to the server.",
"type": "string"
},
"appName": {
"description": "name of the application running. Multiple instances of an application can be connected, but each must generate a unique clientName",
"type": "string"
}
}
}
},
"required": [ "otherMsg" ]
},
"mtOther": {
"properties": {
"otherMsg": {
"description": "Other string being passed that both sided know what to do with",
"type": "object",
"required": ["evID"],
"allof" : [
{"$ref":"#definitions/compEvBase"},
{
"properties": {
"evID": {
"description": "id defined by the user or exteral code, unique by (XMPP client connection ID and evID)",
"type": "string"
}
}
}]
}
},
"required": [ "otherMsg" ]
},
"mtCompEv": {
"properties": {
"compEv": {
"description": "An event that occured to a component.",
"type": "object",
"required": ["compID", "evID"],
"allof" : [
{"$ref":"#definitions/compEvBase"},
{
"properties": {
"evID": {
"description": "id defined by the user or exteral code, unique by (XMPP client connection ID and evID)",
"type": "string"
}
}
}]
}
},
"required": [ "compEv" ]
},
"mtCompModify": {
"properties": {
"compModify": {
"description": "Modify the value of a component, use either field value pair or custom format (like JSON) in info",
"type": "object",
"oneOf":[
{"required": ["compID", "info"]},
{"required": ["compID", "field", "value"]}
],
"allof" : [
{"$ref":"#definitions/mtBase"},
{
"properties": {
"field": {
"description": "field to have the value changed",
"type": "string"
},
"value": {
"description": "new value for the field",
"type": "string"
}
}
}]
}
},
"required": ["compModify"]
},
"mtSimAction": {
"properties": {
"simAction": {
"description": "An action to be taken by child simulation",
"type": "object",
"required": ["actType", "reqResponse"],
"properties": {
"actType": {
"description": "type of action to be taken by child simulation",
"enum": ["atStartSim", "atCancelSim", "atContinue", "atTimer", "atReset", "atBackup", "atPing", "atStatus"]
},
"reqResponse": {
"description": "Is a response from reciver required",
"type": "boolean"
}
}
}
},
"required": [ "simAction" ]
},
"mtResponse": {
"properties": {
"resonse": {
"description": "A response message to one recieved",
"type": "object",
"required": ["parentMsgID", "responseType"],
"properties": {
"parentMsgID": {
"description": "pID of the message this is responding to",
"type": "string"
},
"responseType": {
"description": "response type",
"enum": ["rtReturnPing", "rtStatus"]
},
"info": {
"description": "custom data if needed preferably a JSON string",
"type": "string"
}
}
}
},
"required": [ "response" ]
}
}
}