source: uKadecot/trunk/tools/EcnlControllerUI/EcnlControllerUI/WampSerializer.cs@ 108

Last change on this file since 108 was 108, checked in by coas-nagasima, 9 years ago

MIMEプロパティの変更

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-csharp
File size: 15.1 KB
Line 
1// ------------------------------------------------------------------------------
2// <autogenerated>
3// This code was generated by a tool.
4// Mono Runtime Version: 4.0.30319.1
5//
6// Changes to this file may cause incorrect behavior and will be lost if
7// the code is regenerated.
8// </autogenerated>
9// ------------------------------------------------------------------------------
10using System;
11using System.Collections;
12using System.Collections.Generic;
13using System.Serialization;
14
15namespace Kadecot
16{
17 public class WampSerializer
18 {
19 public static string createHello(string realm, string details)
20 {
21 string data;
22
23 if (realm == null || realm.Equals("")) {
24 throw new ArgumentNullException();
25 }
26 if (details == null || details.Equals("")) {
27 throw new ArgumentNullException();
28 }
29 object detailJson = Json.Parse(details);
30
31 IList<object> list = new List<object>();
32 list.Add((int)WAMP_MSG_TYPE.HELLO);
33 list.Add(realm);
34 list.Add(detailJson);
35 data = Json.Stringify(list);
36 System.Diagnostics.Debug.WriteLine("[wamp][HELLO] " + data);
37 return data;
38 }
39
40
41 public static string createWelcome(int session, string details)
42 {
43 string data;
44
45 object detailJson = Json.Parse(details);
46
47 IList<object> list = new List<object>();
48 list.Add((int)WAMP_MSG_TYPE.WELCOME);
49 list.Add(session);
50 list.Add(detailJson);
51 data = Json.Stringify(list);
52 System.Diagnostics.Debug.WriteLine("[wamp][WELCOME] " + data);
53 return data;
54 }
55
56 public static string createAbort(string details, string reason)
57 {
58 string data;
59 if (details == null || details.Equals("")) {
60 throw new ArgumentNullException();
61 }
62 if (reason == null || reason.Equals("")) {
63 throw new ArgumentNullException();
64 }
65
66 object detailJson = Json.Parse(details);
67
68 IList<object> list = new List<object>();
69 list.Add((int)WAMP_MSG_TYPE.ABORT);
70 list.Add(detailJson);
71 list.Add(reason);
72 data = Json.Stringify(list);
73 System.Diagnostics.Debug.WriteLine("[wamp][ABORT] " + data);
74 return data;
75 }
76
77 public static string createChallenge(string authMethod, string extra)
78 {
79 string data;
80 if (authMethod == null || authMethod.Equals("")) {
81 throw new ArgumentNullException();
82 }
83 if (extra == null || extra.Equals("")) {
84 throw new ArgumentNullException();
85 }
86
87 object extraJson = Json.Parse(extra);
88
89 IList<object> list = new List<object>();
90 list.Add((int)WAMP_MSG_TYPE.CHALLENGE);
91 list.Add(authMethod);
92 list.Add(extraJson);
93 data = Json.Stringify(list);
94 System.Diagnostics.Debug.WriteLine("[wamp][CHALLENGE] " + data);
95 return data;
96 }
97
98 public static string createAuthenticate(string signature, string extra)
99 {
100 string data;
101 if (signature == null || signature.Equals("")) {
102 throw new ArgumentNullException();
103 }
104 if (extra == null || extra.Equals("")) {
105 throw new ArgumentNullException();
106 }
107
108 object extraJson = Json.Parse(extra);
109
110 IList<object> list = new List<object>();
111 list.Add((int)WAMP_MSG_TYPE.AUTHENTICATE);
112 list.Add(signature);
113 list.Add(extraJson);
114 data = Json.Stringify(list);
115 System.Diagnostics.Debug.WriteLine("[wamp][AUTHENTICATE] " + data);
116 return data;
117 }
118
119 public static string createGoodbye(string details, string reason)
120 {
121 string data;
122 if (details == null || details.Equals("")) {
123 throw new ArgumentNullException();
124 }
125 if (reason == null) {
126 throw new ArgumentNullException();
127 }
128
129 object detailJson = Json.Parse(details);
130
131 IList<object> list = new List<object>();
132 list.Add((int)WAMP_MSG_TYPE.GOODBYE);
133 list.Add(detailJson);
134 list.Add(reason);
135 data = Json.Stringify(list);
136 System.Diagnostics.Debug.WriteLine("[wamp][GOODBYE] " + data);
137 return data;
138 }
139
140 public static string createHeartbeat(int incomingSeq, int outgoingSeq, string discard)
141 {
142 string data;
143
144 IList<object> list = new List<object>();
145 if (discard == null || discard.Equals("")) {
146 list.Add((int)WAMP_MSG_TYPE.HEARTBEAT);
147 list.Add(incomingSeq);
148 list.Add(outgoingSeq);
149 data = Json.Stringify(list);
150 }
151 else {
152 list.Add((int)WAMP_MSG_TYPE.HEARTBEAT);
153 list.Add(incomingSeq);
154 list.Add(outgoingSeq);
155 list.Add(discard);
156 data = Json.Stringify(list);
157 }
158
159 System.Diagnostics.Debug.WriteLine("[wamp][HEARTBEAT] " + data);
160 return data;
161 }
162
163 public static string createError(int type, int request, string details, string error, string arguments, string argumentsKw)
164 {
165 string data;
166 if (details == null || details.Equals("")) {
167 throw new ArgumentNullException();
168 }
169 if (error == null || error.Equals("")) {
170 throw new ArgumentNullException();
171 }
172
173 object detailJson = Json.Parse(details);
174 object argsJson = Json.Parse(arguments);
175 object argsKwJson = Json.Parse(argumentsKw);
176
177 IList<object> list = new List<object>();
178 list.Add((int)WAMP_MSG_TYPE.ERROR);
179 list.Add(type);
180 list.Add(request);
181 list.Add(detailJson);
182 list.Add(error);
183 if (arguments != null && argumentsKw == null) {
184 list.Add(argsJson);
185 }
186 else if (arguments != null && argumentsKw != null) {
187 list.Add(argsJson);
188 list.Add(argsKwJson);
189 }
190 data = Json.Stringify(list);
191
192 System.Diagnostics.Debug.WriteLine("[wamp][ERROR] " + data);
193 return data;
194 }
195
196 public static string createPublish(int request, string options, string topic, string arguments, string argumentsKw)
197 {
198 string data;
199 if (options == null || options.Equals("")) {
200 throw new ArgumentNullException();
201 }
202 if (topic == null || topic.Equals("")) {
203 throw new ArgumentNullException();
204 }
205
206 object optJson = Json.Parse(options);
207 object argsJson = Json.Parse(arguments);
208 object argsKwJson = Json.Parse(argumentsKw);
209
210 IList<object> list = new List<object>();
211 list.Add((int)WAMP_MSG_TYPE.PUBLISH);
212 list.Add(request);
213 list.Add(optJson);
214 list.Add(topic);
215 if (arguments != null && argumentsKw == null) {
216 list.Add(argsJson);
217 }
218 else if (arguments != null && argumentsKw != null) {
219 list.Add(argsJson);
220 list.Add(argsKwJson);
221 }
222 data = Json.Stringify(list);
223
224 System.Diagnostics.Debug.WriteLine("[wamp][PUBLISH] " + data);
225 return data;
226 }
227
228 public static string createPublished(int request, int publication)
229 {
230 string data;
231
232 IList<object> list = new List<object>();
233 list.Add((int)WAMP_MSG_TYPE.PUBLISHED);
234 list.Add(request);
235 list.Add(publication);
236 data = Json.Stringify(list);
237 System.Diagnostics.Debug.WriteLine("[wamp][PUBLISHED] " + data);
238 return data;
239 }
240
241 public static string createSubscribe(int request, string options, string topic)
242 {
243 string data;
244 if (options == null || options.Equals("")) {
245 throw new ArgumentNullException();
246 }
247 if (topic == null || topic.Equals("")) {
248 throw new ArgumentNullException();
249 }
250
251 object optJson = Json.Parse(options);
252
253 IList<object> list = new List<object>();
254 list.Add((int)WAMP_MSG_TYPE.SUBSCRIBE);
255 list.Add(request);
256 list.Add(optJson);
257 list.Add(topic);
258 data = Json.Stringify(list);
259 System.Diagnostics.Debug.WriteLine("[wamp][SUBSCRIBE] " + data);
260 return data;
261 }
262
263 public static string createSubscribed(int request, int subscription)
264 {
265 string data;
266
267 IList<object> list = new List<object>();
268 list.Add((int)WAMP_MSG_TYPE.SUBSCRIBED);
269 list.Add(request);
270 list.Add(subscription);
271 data = Json.Stringify(list);
272 System.Diagnostics.Debug.WriteLine("[wamp][SUBSCRIBED] " + data);
273 return data;
274 }
275
276 public static string createUnsubscribe(int request, int subscription)
277 {
278 string data;
279
280 IList<object> list = new List<object>();
281 list.Add((int)WAMP_MSG_TYPE.UNSUBSCRIBE);
282 list.Add(request);
283 list.Add(subscription);
284 // list.Add ("com.sonycsl.kadecot.echonetlite.procedure.set.topic.HomeAirConditioner.OperationStatus");
285 data = Json.Stringify(list);
286 System.Diagnostics.Debug.WriteLine("[wamp][UNSUBSCRIBE] " + data);
287 return data;
288 }
289
290 public static string createUnsubscribed(int request)
291 {
292 string data;
293
294 IList<object> list = new List<object>();
295 list.Add((int)WAMP_MSG_TYPE.UNSUBSCRIBED);
296 list.Add(request);
297 data = Json.Stringify(list);
298 System.Diagnostics.Debug.WriteLine("[wamp][UNSUBSCRIBED] " + data);
299 return data;
300 }
301
302 public static string createEvent(int subscription, int publication, string details, string arguments, string argumentsKw)
303 {
304 string data;
305 if (details == null || details.Equals("")) {
306 throw new ArgumentNullException();
307 }
308
309 object detailJson = Json.Parse(details);
310 object argsJson = Json.Parse(arguments);
311 object argsKwJson = Json.Parse(argumentsKw);
312
313 IList<object> list = new List<object>();
314 list.Add((int)WAMP_MSG_TYPE.EVENT);
315 list.Add(subscription);
316 list.Add(publication);
317 list.Add(detailJson);
318 if (arguments != null && argumentsKw == null) {
319 list.Add(argsJson);
320 }
321 else if (arguments != null && argumentsKw != null) {
322 list.Add(argsJson);
323 list.Add(argsKwJson);
324 }
325 data = Json.Stringify(list);
326
327 System.Diagnostics.Debug.WriteLine("[wamp][EVENT] " + data);
328 return data;
329 }
330 /// <summary>
331 /// ƒNƒ‰ƒCƒAƒ“ƒg‚©‚ç‘—‚郁ƒbƒZ[ƒW‚ðì¬‚µ‚Ü‚·
332 /// </summary>
333 /// <param name="request">ƒŠƒNƒGƒXƒg”ԍ†</param>
334 /// <param name="options">ƒIƒvƒVƒ‡ƒ“</param>
335 /// <param name="procedure"></param>
336 /// <param name="arguments"></param>
337 /// <param name="argumentsKw"></param>
338 /// <returns></returns>
339 public static string createCall(int request, string options, string procedure, string arguments, string argumentsKw)
340 {
341 string data;
342 if (options == null || options.Equals("")) {
343 throw new ArgumentNullException();
344 }
345 if (procedure == null || procedure.Equals("")) {
346 throw new ArgumentNullException();
347 }
348
349 object optionJson = Json.Parse(options);
350 object argsJson = Json.Parse(arguments);
351 object argsKwJson = Json.Parse(argumentsKw);
352
353 IList<object> list = new List<object>();
354 list.Add((int)WAMP_MSG_TYPE.CALL);
355 list.Add(request);
356 list.Add(optionJson);
357 list.Add(procedure);
358 if (arguments != null && argumentsKw == null) {
359 list.Add(argsJson);
360 }
361 else if (arguments != null && argumentsKw != null) {
362 list.Add(argsJson);
363 list.Add(argsKwJson);
364 }
365 data = Json.Stringify(list);
366
367 System.Diagnostics.Debug.WriteLine("[wamp][CALL] " + data);
368 return data;
369 }
370
371 public static string createCancel(int request, string options)
372 {
373 string data;
374 if (options == null || options.Equals("")) {
375 throw new ArgumentNullException();
376 }
377
378 object optionJson = Json.Parse(options);
379
380 IList<object> list = new List<object>();
381 list.Add((int)WAMP_MSG_TYPE.CANCEL);
382 list.Add(request);
383 list.Add(optionJson);
384 data = Json.Stringify(list);
385 System.Diagnostics.Debug.WriteLine("[wamp][CANCEL] " + data);
386 return data;
387 }
388
389 public static string createResult(int request, string details, string arguments, string argumentsKw)
390 {
391 string data;
392 if (details == null || details.Equals("")) {
393 throw new ArgumentNullException();
394 }
395
396 object detailJson = Json.Parse(details);
397 object argsJson = Json.Parse(arguments);
398 object argsKwJson = Json.Parse(argumentsKw);
399
400 IList<object> list = new List<object>();
401 list.Add((int)WAMP_MSG_TYPE.RESULT);
402 list.Add(request);
403 list.Add(detailJson);
404 if (arguments != null && argumentsKw == null) {
405 list.Add(argsJson);
406 }
407 else if (arguments != null && argumentsKw != null) {
408 list.Add(argsJson);
409 list.Add(argsKwJson);
410 }
411 data = Json.Stringify(list);
412
413 System.Diagnostics.Debug.WriteLine("[wamp][RESULT] " + data);
414 return data;
415 }
416
417 public static string createRegister(int request, string options, string procedure)
418 {
419 string data;
420 if (options == null || options.Equals("")) {
421 throw new ArgumentNullException();
422 }
423 if (procedure == null || procedure.Equals("")) {
424 throw new ArgumentNullException();
425 }
426
427 object optJson = Json.Parse(options);
428
429 IList<object> list = new List<object>();
430 list.Add((int)WAMP_MSG_TYPE.REGISTER);
431 list.Add(request);
432 list.Add(optJson);
433 list.Add(procedure);
434 data = Json.Stringify(list);
435 System.Diagnostics.Debug.WriteLine("[wamp][REGISTER] " + data);
436 return data;
437 }
438
439 public static string createRegistered(int request, int registration)
440 {
441 string data;
442 IList<object> list = new List<object>();
443 list.Add((int)WAMP_MSG_TYPE.REGISTERED);
444 list.Add(request);
445 list.Add(registration);
446 data = Json.Stringify(list);
447 System.Diagnostics.Debug.WriteLine("[wamp][REGISTERED] " + data);
448 return data;
449 }
450
451 public static string createUnregister(int request, int registration)
452 {
453 string data;
454
455 IList<object> list = new List<object>();
456 list.Add((int)WAMP_MSG_TYPE.UNREGISTER);
457 list.Add(request);
458 list.Add(registration);
459 data = Json.Stringify(list);
460 System.Diagnostics.Debug.WriteLine("[wamp][UNREGISTER] " + data);
461 return data;
462 }
463
464 public static string createUnregistered(int request)
465 {
466 string data;
467
468 IList<object> list = new List<object>();
469 list.Add((int)WAMP_MSG_TYPE.UNREGISTERED);
470 list.Add(request);
471 data = Json.Stringify(list);
472 System.Diagnostics.Debug.WriteLine("[wamp][UNREGISTERED] " + data);
473 return data;
474 }
475
476 public static string createInvocation(int request, int registration, string details, string arguments, string argumentsKw)
477 {
478 string data;
479 if (details == null || details.Equals("")) {
480 throw new ArgumentNullException();
481 }
482
483 object detailJson = Json.Parse(details);
484 object argsJson = Json.Parse(arguments);
485 object argsKwJson = Json.Parse(argumentsKw);
486
487 IList<object> list = new List<object>();
488 list.Add((int)WAMP_MSG_TYPE.INVOCATION);
489 list.Add(request);
490 list.Add(registration);
491 list.Add(detailJson);
492 if (arguments != null && argumentsKw == null) {
493 list.Add(argsJson);
494 }
495 else if (arguments != null && argumentsKw != null) {
496 list.Add(argsJson);
497 list.Add(argsKwJson);
498 }
499 data = Json.Stringify(list);
500
501 System.Diagnostics.Debug.WriteLine("[wamp][INVOCATION] " + data);
502 return data;
503 }
504
505 public static string createInterrupt(int request, string options)
506 {
507 string data;
508 if (options == null || options.Equals("")) {
509 throw new ArgumentNullException();
510 }
511
512 object optJson = Json.Parse(options);
513 IList<object> list = new List<object>();
514 list.Add((int)WAMP_MSG_TYPE.INTERRUPT);
515 list.Add(request);
516 list.Add(optJson);
517 data = Json.Stringify(list);
518 System.Diagnostics.Debug.WriteLine("[wamp][INTERRUPT] " + data);
519 return data;
520 }
521
522 public static string createYield(int request, string options, string arguments, string argumentsKw)
523 {
524 string data;
525 if (options == null || options.Equals("")) {
526 throw new ArgumentNullException();
527 }
528
529 object optJson = Json.Parse(options);
530 object argsJson = Json.Parse(arguments);
531 object argsKwJson = Json.Parse(argumentsKw);
532
533 IList<object> list = new List<object>();
534 list.Add((int)WAMP_MSG_TYPE.YIELD);
535 list.Add(request);
536 list.Add(optJson);
537 if (arguments != null && argumentsKw == null) {
538 list.Add(argsJson);
539 }
540 else if (arguments != null && argumentsKw != null) {
541 list.Add(argsJson);
542 list.Add(argsKwJson);
543 }
544 data = Json.Stringify(list);
545 System.Diagnostics.Debug.WriteLine("[wamp][YIELD] " + data);
546 return data;
547 }
548
549 }
550}
Note: See TracBrowser for help on using the repository browser.