C# Client 0.0.0.7
C# Library to interface with Corelink
Loading...
Searching...
No Matches
StreamParams.cs
Go to the documentation of this file.
1
8using System.Collections.Generic;
9using SimpleJSON;
10using UnityEditor;
11using UnityEngine;
12
13namespace CoreLink
14{
19 public class StreamParams
20 {
21
22 public string workspace;
23 public string proto;
24 public int port;
25 public string type;
26 public bool alert;
27 public JSONNode metadata;
28
29 // This is only slightly different from senderID/receiverid.
30 // Senderid/receiverid are sent as a JSON response to the server.
31 // The server then replies with the actual stream id, which gets placed here
32 public uint streamID;
33 public StreamParams(string workspace, string type) : this(workspace, type, "udp", JSON.Parse("{}"), false) { }
34 public StreamParams(string workspace, string type, string proto) : this(workspace, type, proto, JSON.Parse("{}"), false) { }
35
36 public StreamParams(string workspace, string type, string proto, JSONNode metadata, bool alert)
37 {
38 this.workspace = workspace;
39 this.type = type;
40 this.proto = proto;
41 this.metadata = metadata;
42 this.alert = alert;
43 }
44
45 // This function should never be called since it's overriden, but it's here just in case
46 virtual public JSONNode toJSON()
47 {
48 JSONNode jsonRequest = JSON.Parse("{}");
49 jsonRequest["function"] = "";
50 jsonRequest["workspace"] = this.workspace;
51 jsonRequest["proto"] = this.proto;
52 jsonRequest["meta"] = this.metadata;
53 jsonRequest["alert"] = this.alert;
54 jsonRequest["type"] = this.type;
55 return jsonRequest;
56 }
57
58 }
59}