Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Commit 46f0580

Browse files
dmitterbergerMartinBischoff
authored andcommitted
Update of Communication.cs
1 parent 6687c50 commit 46f0580

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

Libraries/RosBridgeClient/Communication.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
© Siemens AG, 2017-2018
33
Author: Dr. Martin Bischoff ([email protected])
44
@@ -18,8 +18,8 @@ namespace RosSharp.RosBridgeClient
1818
{
1919
internal abstract class Communication
2020
{
21-
public abstract string op { get; } // required
22-
public virtual string id { get; } // optional
21+
public string op; // required
22+
public string id; // optional
2323

2424
internal Communication(string id = null)
2525
{
@@ -29,44 +29,43 @@ internal Communication(string id = null)
2929

3030
internal class Advertisement : Communication
3131
{
32-
public override string op { get { return "advertise"; } } // required
3332
public string topic; // required
3433
public string type; // required
3534

3635
internal Advertisement(string id, string topic, string type) : base(id)
3736
{
37+
this.op = "advertise";
3838
this.topic = topic;
3939
this.type = type;
4040
}
4141
}
4242

4343
internal class Unadvertisement : Communication
4444
{
45-
public override string op { get { return "unadvertise"; } } // required
4645
public string topic; // required
4746

4847
internal Unadvertisement(string id, string topic) : base(id)
4948
{
49+
this.op = "unadvertise";
5050
this.topic = topic;
5151
}
5252
}
5353

5454
internal class Publication<T> : Communication where T: Message
5555
{
56-
public override string op { get { return "publish"; } } // required
5756
public string topic; // required
5857
public T msg; // required
5958

6059
internal Publication(string id, string topic, T msg) : base(id)
6160
{
61+
this.op = "publish";
6262
this.topic = topic;
6363
this.msg = msg;
6464
}
6565
}
6666

6767
internal class Subscription : Communication
6868
{
69-
public override string op { get { return "subscribe"; } } // required
7069
public string topic; // required
7170
public string type; // optional
7271
public int throttle_rate; // optional
@@ -76,6 +75,7 @@ internal class Subscription : Communication
7675

7776
internal Subscription(string id, string topic, string type, int throttle_rate = 0, int queue_length = 1, int fragment_size = int.MaxValue, string compression = "none") : base(id)
7877
{
78+
this.op = "subscribe";
7979
this.topic = topic;
8080
this.type = type;
8181
this.throttle_rate = throttle_rate;
@@ -87,25 +87,25 @@ internal Subscription(string id, string topic, string type, int throttle_rate =
8787

8888
internal class Unsubscription : Communication
8989
{
90-
public override string op { get { return "unsubscribe"; } } // required
9190
public string topic; // required
9291

9392
internal Unsubscription(string id, string topic) : base(id)
9493
{
94+
this.op = "unsubscribe";
9595
this.topic = topic;
9696
}
9797
}
9898

9999
internal class ServiceCall<T> : Communication where T : Message
100100
{
101-
public override string op { get { return "call_service"; } } // required
102101
public string service; // required
103102
public T args; // optional
104103
public int fragment_size; // optional
105104
public string compression; // optional
106105

107106
public ServiceCall(string id, string service, T args, int fragment_size = int.MaxValue, string compression = "none") : base(id)
108107
{
108+
this.op = "call_service";
109109
this.service = service;
110110
this.args = args;
111111
this.fragment_size = fragment_size;
@@ -115,37 +115,37 @@ public ServiceCall(string id, string service, T args, int fragment_size = int.Ma
115115

116116
internal class ServiceResponse<T> : Communication where T : Message
117117
{
118-
public override string op { get { return "service_response"; } } // required
119118
public string service; // required
120119
public T values; // optional
121120
public bool result; // required
122121

123122
internal ServiceResponse(string id, string service, T values, bool Result) : base(id)
124123
{
124+
this.op = "service_response";
125125
this.service = service;
126126
this.values = values;
127127
result = Result;
128128
}
129129
}
130130
internal class ServiceAdvertisement : Communication
131131
{
132-
public override string op { get { return "advertise_service"; } } // required
133132
public string type; // required
134133
public string service; // required
135134

136135
internal ServiceAdvertisement(string service, string type)
137136
{
137+
this.op = "advertise_service";
138138
this.service = service;
139139
this.type = type;
140140
}
141141
}
142142
internal class ServiceUnadvertisement : Communication
143143
{
144-
public override string op { get { return "unadvertise_service"; } } // required
145144
public string service; // required
146145

147146
internal ServiceUnadvertisement(string Service)
148-
{
147+
{
148+
this.op = "unadvertise_service";
149149
service = Service;
150150
}
151151
}

0 commit comments

Comments
 (0)