Skip to content

Commit

Permalink
RosBridgeClient Refactoring (cf. #59)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBischoff committed Jul 23, 2018
1 parent 672b428 commit 34fb2a8
Show file tree
Hide file tree
Showing 165 changed files with 22,803 additions and 18,544 deletions.
63 changes: 0 additions & 63 deletions .gitattributes

This file was deleted.

File renamed without changes.
16 changes: 16 additions & 0 deletions Libraries/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# [Libraries](https://github.com/siemens/ros-sharp/tree/master/Libraries) #
the .NET solution [RosSharp.sln](https://github.com/siemens/ros-sharp/tree/master/Libraries/RoRosSharp.sln) consists of the following projects:

* [RosBridgeClient](https://github.com/siemens/ros-sharp/tree/master/Libraries/RosBridgeClient): .NET API to [ROS](http://www.ros.org/) via [rosbridge_suite](http://wiki.ros.org/rosbridge_suite)
* [RosBridgeClientTest](https://github.com/siemens/ros-sharp/tree/master/Libraries/RosBridgeClientTest): NUnit and Console Application tests for RosBridgeClient
* [UrdfImporter](https://github.com/siemens/ros-sharp/tree/master/Libraries/UrdfImporter): URDF file parser for .NET applications

Both libraries `RosBridgeClient.dll` and `UrdfImporter.dll` are required [plugins](https://github.com/siemens/ros-sharp/Unity3D/Assets/RosSharp/Plugins/) for the Unity project [Unity3D](https://github.com/siemens/ros-sharp/tree/master/Unity3D).

__Please see the [Wiki](https://github.com/siemens/ros-sharp/wiki) for further info.__

---

© Siemens AG, 2017-2018

Author: Dr. Martin Bischoff ([email protected])
Original file line number Diff line number Diff line change
Expand Up @@ -5,67 +5,66 @@
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
<http://www.apache.org/licenses/LICENSE-2.0>.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/


namespace RosSharp.RosBridgeClient
{
public class Operation
internal abstract class Communication
{
public virtual string op { get { return "undefined"; } } // required
public string id; // optional
public abstract string op { get; } // required
public virtual string id { get; } // optional

public Operation(string Id=null)
internal Communication(string id = null)
{
id = Id;
this.id = id;
}
}

public class Adverisement : Operation
internal class Advertisement : Communication
{
public override string op { get { return "advertise"; } } // required
public string topic; // required
public string type; // required

public Adverisement(string Id, string Topic, string Type) : base(Id)
internal Advertisement(string id, string topic, string type) : base(id)
{
topic = Topic;
type = Type;
this.topic = topic;
this.type = type;
}
}

public class Unadverisement : Operation
internal class Unadverisement : Communication
{
public override string op { get { return "unadvertise"; } } // required
public string topic; // required

public Unadverisement(string Id, string Topic) : base(Id)
internal Unadverisement(string id, string topic) : base(id)
{
topic = Topic;
this.topic = topic;
}
}

public class Publication : Operation
internal class Publication<T> : Communication where T: Message
{
public override string op { get { return "publish"; } } // required
public string topic; // required
public Message msg; // required
public T msg; // required

public Publication(string Id, string Topic, Message MessageContents) : base(Id)
internal Publication(string id, string topic, T msg) : base(id)
{
topic = Topic;
msg = MessageContents;
this.topic = topic;
this.msg = msg;
}
}

public class Subscription : Operation
internal class Subscription : Communication
{
public override string op { get { return "subscribe"; } } // required
public string topic; // required
Expand All @@ -75,80 +74,78 @@ public class Subscription : Operation
public int fragment_size; // optional
public string compression; // optional

public 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)
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)
{
topic = Topic;
type = Type;
throttle_rate = Throttle_rate;
queue_length = Queue_length;
fragment_size = Fragment_size;
compression = Compression;
this.topic = topic;
this.type = type;
this.throttle_rate = throttle_rate;
this.queue_length = queue_length;
this.fragment_size = fragment_size;
this.compression = compression;
}
}

public class Unsubscription : Operation
internal class Unsubscription : Communication
{
public override string op { get { return "unsubscribe"; } } // required
public string topic; // required

public Unsubscription(string Id, string Topic) : base(Id)
internal Unsubscription(string id, string topic) : base(id)
{
topic = Topic;
this.topic = topic;
}
}

public class ServiceCall : Operation
internal class ServiceCall<T> : Communication where T : Message
{
public override string op { get { return "call_service"; } } // required
public string service; // required
public object args; // optional
public T args; // optional
public int fragment_size; // optional
public string compression; // optional

public ServiceCall(string Id, string Service, object Args = null, int Fragment_size = int.MaxValue, string Compression = "none") : base(Id)
public ServiceCall(string id, string service, T args, int fragment_size = int.MaxValue, string compression = "none") : base(id)
{
service = Service;
args = Args;
fragment_size = Fragment_size;
compression = Compression;
this.service = service;
this.args = args;
this.fragment_size = fragment_size;
this.compression = compression;
}
}

public class ServiceResponse : Operation
internal class ServiceResponse<T> : Communication where T : Message
{
public override string op { get { return "service_response"; } } // required
public string service; // required
public object values; // optional
public bool result;
public T values; // optional
public bool result; // required

public ServiceResponse(string Id, string Service, object Values, bool Result) : base(Id)
internal ServiceResponse(string id, string service, T values, bool Result) : base(id)
{
service = Service;
values = Values;
this.service = service;
this.values = values;
result = Result;
}
}
public class ServiceAdvertisement : Operation
internal class ServiceAdvertisement : Communication
{
public override string op { get { return "advertise_service"; } } // required
public string type; // required
public string service; // required


public ServiceAdvertisement(string Id, string Service, string Type) : base(Id)
internal ServiceAdvertisement(string service, string type)
{
service = Service;
type = Type;
Id = id;
this.service = service;
this.type = type;
}
}
public class ServiceUnadvertisement : Operation
internal class ServiceUnadvertisement : Communication
{
public override string op { get { return "unadvertise_service"; } } // required
public string service; // required

public ServiceUnadvertisement(string Id, string Service) : base(Id)
{
internal ServiceUnadvertisement(string Service)
{
service = Service;
}
}
Expand Down
Loading

0 comments on commit 34fb2a8

Please sign in to comment.