C# Client 0.0.0.7
C# Library to interface with Corelink
Loading...
Searching...
No Matches
ReceiverStreamParams.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using SimpleJSON;
3
4namespace CoreLink
5{
7 {
11 public List<uint> streamIDs;
12 public bool echo;
13 public uint receiverid;
14 public new List<string> type;
15 ReceiverStream receiverStream;
16
17 //workspace, type, proto, metadata, alert, echo, receiverid, streamIDs, receiverStream
18 public ReceiverStreamParams(string workspace, List<string> type, ReceiverStream receiverStream) :
19 this(workspace, type, "udp", JSON.Parse("{}"), false, false, 0, new List<uint>(), receiverStream) { }
20 public ReceiverStreamParams(string workspace, List<string> type, ReceiverStream receiverStream, bool alert) :
21 this(workspace, type, "udp", JSON.Parse("{}"), alert, false, 0, new List<uint>(), receiverStream)
22 { }
23 public ReceiverStreamParams(string workspace, List<string> type, ReceiverStream receiverStream, bool alert, bool echo) :
24 this(workspace, type, "udp", JSON.Parse("{}"), alert, echo, 0, new List<uint>(), receiverStream) { }
25 public ReceiverStreamParams(string workspace, List<string> type, string proto, ReceiverStream receiverStream) :
26 this(workspace, type, proto, JSON.Parse("{}"), false, false, 0, new List<uint>(), receiverStream) { }
27
28 public ReceiverStreamParams(string workspace, List<string> type, string proto,
29 JSONNode metadata, bool alert, bool echo, uint receiverid,
30 List<uint> streamIDs, ReceiverStream receiverStream) : base(workspace, type[0], proto, metadata, alert)
31 {
32 this.type = type;
33 this.echo = echo;
34 this.receiverid = receiverid;
35 this.streamIDs = streamIDs;
36 this.receiverStream = receiverStream;
37 }
38
39 public ReceiverStream ReceiverStream { set => receiverStream = value; get => receiverStream; }
40
45 override public JSONNode toJSON()
46 {
47 JSONNode jsonRequest = JSON.Parse("{}");
48 jsonRequest["function"] = "receiver";
49 jsonRequest["workspace"] = workspace;
50 if (receiverid != 0) jsonRequest["receiverid"] = receiverid;
51 for (int i = 0; i < streamIDs.Count; i++)
52 {
53 jsonRequest["streamIDs"][i] = streamIDs[i];
54 }
55 jsonRequest["proto"] = proto;
56 for (int i = 0; i < type.Count; i++)
57 {
58 jsonRequest["type"][i] = type[i];
59 }
60 jsonRequest["alert"] = alert;
61 jsonRequest["echo"] = echo;
62
63 jsonRequest["meta"] = metadata;
64 return jsonRequest;
65 }
66 }
67}