From 69343c64b63e2ae675332df10a8ad786cbda7094 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 3 Jun 2018 18:01:27 +0300 Subject: Implemented RemoteRunner! --- Software/Visual_Studio/Tango.UnitTesting/Helper.cs | 9 +++ .../Tango.UnitTesting/RemoteRunner_TST.cs | 92 ++++++++++++++++++++++ .../Tango.UnitTesting/Tango.UnitTesting.csproj | 5 ++ 3 files changed, 106 insertions(+) create mode 100644 Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/Visual_Studio/Tango.UnitTesting/Helper.cs b/Software/Visual_Studio/Tango.UnitTesting/Helper.cs index e09b17149..67252f914 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Helper.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/Helper.cs @@ -43,6 +43,15 @@ namespace Tango.UnitTesting return Path.GetFullPath(@"..\..\Build\Debug\Tango.MachineStudio.UI.exe"); } + /// + /// Gets the tango build path. + /// + /// + public static String GetBuildPath() + { + return Path.GetFullPath(@"..\..\Build\Debug"); + } + /// /// Gets the SQLite database file path in DB folder. /// diff --git a/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs new file mode 100644 index 000000000..6e59dde8a --- /dev/null +++ b/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs @@ -0,0 +1,92 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Tango.Transport; +using Tango.Transport.Transporters; +using Tango.Transport.Adapters; +using Tango.PMR.IO; +using Tango.PMR; +using Google.Protobuf; + +namespace Tango.UnitTesting +{ + [TestClass] + [TestCategory("Remote Runner")] + public class RemoteRunner_TST + { + [TestMethod] + public void Run_Remote_Runner_Connect_Upload_And_Execute_Process() + { + Process runner = Process.Start(Path.Combine(Helper.GetBuildPath(), "Tango.RemoteRunner.UI.exe")); + runner.WaitForInputIdle(); + + Thread.Sleep(2000); + + ITransportAdapter adapter = new TcpTransportAdapter("localhost", 9595); + ITransporter transporter = new BasicTransporter(adapter); + transporter.Connect().Wait(); + + Thread.Sleep(1000); + + String uploadFileName = "RemoteRunnerExeTest.zip"; + String executeFileName = "RemoteRunnerExeTest.exe"; + + FileInfo exeFile = new FileInfo(Helper.GetResourcePath(uploadFileName)); + + var uploadResponse = transporter.SendRequest(new FileUploadRequest() + { + FileName = uploadFileName, + Length = exeFile.Length, + }).Result.Message; + + int currentFilePosition = 0; + + do + { + using (FileStream fs = new FileStream(exeFile.FullName, FileMode.Open)) + { + fs.Position = currentFilePosition; + + FileChunkUploadRequest chunkRequest = new FileChunkUploadRequest(); + chunkRequest.UploadID = uploadResponse.UploadID; + + long remaining = exeFile.Length - currentFilePosition; + + byte[] buffer = new byte[uploadResponse.MaxChunkLength > remaining ? uploadResponse.MaxChunkLength : remaining]; + fs.Read(buffer, 0, buffer.Length); + chunkRequest.Buffer = ByteString.CopyFrom(buffer); + + transporter.SendRequest(chunkRequest).Wait(); + + currentFilePosition += buffer.Length; + } + + } while (currentFilePosition < exeFile.Length); + + Thread.Sleep(1000); + + var response = transporter.SendRequest(new ExecuteProcessRequest() + { + UploadID = uploadResponse.UploadID, + FileName = executeFileName, + }, TimeSpan.FromSeconds(30)).Result.Message; + + Thread.Sleep(5000); + + transporter.SendRequest(new KillProcessRequest() + { + ProcessID = response.ProcessID, + }).Wait(); + + transporter.Disconnect().Wait(); + + runner.Kill(); + } + } +} diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj index b01b6374b..9fbcc4d09 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj +++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj @@ -90,6 +90,7 @@ + @@ -168,6 +169,10 @@ {998f8471-dc1b-41b6-9d96-354e1b4e7a32} Tango.TFS + + {74e700b0-1156-4126-be40-ee450d3c3026} + Tango.Transport + {ebb7cb9f-6af2-456b-a5dd-1b136b605d90} Tango.DBObservablesGenerator.CLI -- cgit v1.3.1 From eb9ad775373160c754c590e0de1533e2b9644e38 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 3 Jun 2018 19:22:25 +0300 Subject: Implemented Discovery Components! --- .../Messages/Discovery/BasicDiscoveryMessage.proto | 9 ++ .../Tango.PMR/Discovery/BasicDiscoveryMessage.cs | 160 +++++++++++++++++++++ Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj | 1 + .../Tango.Transport/Discovery/DiscoveredService.cs | 44 ++++++ .../Tango.Transport/Discovery/IDiscoveryClient.cs | 33 +++++ .../Discovery/IDiscoveryComponent.cs | 34 +++++ .../Tango.Transport/Discovery/IDiscoveryService.cs | 21 +++ .../Discovery/UdpDiscoveryClient.cs | 156 ++++++++++++++++++++ .../Discovery/UdpDiscoveryService.cs | 109 ++++++++++++++ .../Tango.Transport/Tango.Transport.csproj | 6 + .../Tango.UnitTesting/RemoteRunner_TST.cs | 7 +- .../Tango.RemoteRunner.UI/MainWindowVM.cs | 6 + 12 files changed, 585 insertions(+), 1 deletion(-) create mode 100644 Software/PMR/Messages/Discovery/BasicDiscoveryMessage.proto create mode 100644 Software/Visual_Studio/Tango.PMR/Discovery/BasicDiscoveryMessage.cs create mode 100644 Software/Visual_Studio/Tango.Transport/Discovery/DiscoveredService.cs create mode 100644 Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryClient.cs create mode 100644 Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryComponent.cs create mode 100644 Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryService.cs create mode 100644 Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryClient.cs create mode 100644 Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/PMR/Messages/Discovery/BasicDiscoveryMessage.proto b/Software/PMR/Messages/Discovery/BasicDiscoveryMessage.proto new file mode 100644 index 000000000..e35ade4af --- /dev/null +++ b/Software/PMR/Messages/Discovery/BasicDiscoveryMessage.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Discovery; +option java_package = "com.twine.tango.pmr.discovery"; + +message BasicDiscoveryMessage +{ + string ServiceName = 1; +} \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.PMR/Discovery/BasicDiscoveryMessage.cs b/Software/Visual_Studio/Tango.PMR/Discovery/BasicDiscoveryMessage.cs new file mode 100644 index 000000000..e926a55c4 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Discovery/BasicDiscoveryMessage.cs @@ -0,0 +1,160 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: BasicDiscoveryMessage.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Discovery { + + /// Holder for reflection information generated from BasicDiscoveryMessage.proto + public static partial class BasicDiscoveryMessageReflection { + + #region Descriptor + /// File descriptor for BasicDiscoveryMessage.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static BasicDiscoveryMessageReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChtCYXNpY0Rpc2NvdmVyeU1lc3NhZ2UucHJvdG8SE1RhbmdvLlBNUi5EaXNj", + "b3ZlcnkiLAoVQmFzaWNEaXNjb3ZlcnlNZXNzYWdlEhMKC1NlcnZpY2VOYW1l", + "GAEgASgJQh8KHWNvbS50d2luZS50YW5nby5wbXIuZGlzY292ZXJ5YgZwcm90", + "bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Discovery.BasicDiscoveryMessage), global::Tango.PMR.Discovery.BasicDiscoveryMessage.Parser, new[]{ "ServiceName" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class BasicDiscoveryMessage : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BasicDiscoveryMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Discovery.BasicDiscoveryMessageReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public BasicDiscoveryMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public BasicDiscoveryMessage(BasicDiscoveryMessage other) : this() { + serviceName_ = other.serviceName_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public BasicDiscoveryMessage Clone() { + return new BasicDiscoveryMessage(this); + } + + /// Field number for the "ServiceName" field. + public const int ServiceNameFieldNumber = 1; + private string serviceName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ServiceName { + get { return serviceName_; } + set { + serviceName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as BasicDiscoveryMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(BasicDiscoveryMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ServiceName != other.ServiceName) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ServiceName.Length != 0) hash ^= ServiceName.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (ServiceName.Length != 0) { + output.WriteRawTag(10); + output.WriteString(ServiceName); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ServiceName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ServiceName); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(BasicDiscoveryMessage other) { + if (other == null) { + return; + } + if (other.ServiceName.Length != 0) { + ServiceName = other.ServiceName; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + ServiceName = input.ReadString(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index a85cde3c8..204286f60 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -109,6 +109,7 @@ + diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/DiscoveredService.cs b/Software/Visual_Studio/Tango.Transport/Discovery/DiscoveredService.cs new file mode 100644 index 000000000..f04623792 --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/Discovery/DiscoveredService.cs @@ -0,0 +1,44 @@ +using Google.Protobuf; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Transport.Discovery +{ + /// + /// Represents a discovery client + /// + /// + public class DiscoveredService : EventArgs where DiscoveryMessage : IMessage + { + /// + /// Gets or sets the discovery message. + /// + public DiscoveryMessage Message { get; set; } + + /// + /// Gets or sets the name of the service. + /// + public String ServiceName { get; set; } + + /// + /// Gets or sets the service IP address. + /// + public String Address { get; set; } + + /// + /// Initializes a new instance of the class. + /// + /// The address. + /// Name of the service. + /// The message. + public DiscoveredService(String address, String serviceName, DiscoveryMessage message) + { + Address = address; + ServiceName = serviceName; + Message = message; + } + } +} diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryClient.cs b/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryClient.cs new file mode 100644 index 000000000..bfbdca1fd --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryClient.cs @@ -0,0 +1,33 @@ +using Google.Protobuf; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Transport.Discovery +{ + /// + /// Represents a discovery service client. + /// + /// The type of the discovery message. + /// + public interface IDiscoveryClient : IDiscoveryComponent where DiscoveryMessage : IMessage + { + /// + /// Occurs when a matching service has been discovered. + /// + event EventHandler> ServiceDiscovered; + + /// + /// Gets or sets the name of the remote service to discover. + /// + String ServiceName { get; set; } + + /// + /// Asynchronous method for awaiting until the service will be discovered. + /// + /// + Task> Discover(TimeSpan? timeout = null); + } +} diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryComponent.cs b/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryComponent.cs new file mode 100644 index 000000000..bb64d4248 --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryComponent.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Transport.Discovery +{ + /// + /// Represents a discovery component. + /// + public interface IDiscoveryComponent + { + /// + /// Gets or sets the interval in which the discovery process will be triggered. + /// + TimeSpan Interval { get; set; } + + /// + /// Gets a value indicating whether this component has been started. + /// + bool IsStarted { get; } + + /// + /// Starts the discovery component. + /// + void Start(); + + /// + /// Stops the discovery component. + /// + void Stop(); + } +} diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryService.cs b/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryService.cs new file mode 100644 index 000000000..548bbedc0 --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryService.cs @@ -0,0 +1,21 @@ +using Google.Protobuf; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Transport.Discovery +{ + /// + /// Represents a discovery service broadcasting a predefined discovery message type. + /// + /// The type of the discovery message. + public interface IDiscoveryService : IDiscoveryComponent where DiscoveryMessage : IMessage + { + /// + /// Gets the name of the service. + /// + String ServiceName { get; } + } +} diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryClient.cs b/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryClient.cs new file mode 100644 index 000000000..a1086c0fa --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryClient.cs @@ -0,0 +1,156 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using System.Timers; +using Tango.PMR.Discovery; + +namespace Tango.Transport.Discovery +{ + public class UdpDiscoveryClient : IDiscoveryClient + { + private Timer _timer; + + /// + /// Occurs when a matching service has been discovered. + /// + public event EventHandler> ServiceDiscovered; + + /// + /// Gets or sets the interval in which the discovery message will be sent. + /// + public TimeSpan Interval { get; set; } + + /// + /// Gets a value indicating whether this service has been started. + /// + public bool IsStarted { get; private set; } + + /// + /// Gets the name of the service. + /// + public String ServiceName { get; set; } + + /// + /// Gets the UDP port number. + /// + public int Port { get; private set; } + + /// + /// Prevents a default instance of the class from being created. + /// + private UdpDiscoveryClient() + { + Interval = TimeSpan.FromSeconds(5); + } + + /// + /// Initializes a new instance of the class. + /// + /// The UDP port number. + public UdpDiscoveryClient(String serviceName, int port) : this() + { + Port = port; + ServiceName = serviceName; + } + + /// + /// Starts the discovery client. + /// + public void Start() + { + if (!IsStarted) + { + _timer = new Timer(); + _timer.Interval = Interval.TotalMilliseconds; + _timer.Elapsed += _timer_Elapsed; + _timer.Enabled = true; + _timer.Start(); + + IsStarted = true; + } + } + + /// + /// Stops the discovery client. + /// + public void Stop() + { + if (IsStarted) + { + _timer.Stop(); + IsStarted = false; + } + } + + + + /// + /// Handles the Elapsed event of the _timer control. + /// + /// The source of the event. + /// The instance containing the event data. + private void _timer_Elapsed(object sender, ElapsedEventArgs e) + { + UdpClient udpClient = new UdpClient(Port); + udpClient.Client.ReceiveTimeout = (int)_timer.Interval; + var endPoint = new IPEndPoint(IPAddress.Any, 0); + + try + { + var data = udpClient.Receive(ref endPoint); + udpClient.Close(); + BasicDiscoveryMessage message = BasicDiscoveryMessage.Parser.ParseFrom(data); + + if (message.ServiceName == ServiceName) + { + ServiceDiscovered?.Invoke(this, + new DiscoveredService( + endPoint.Address.ToString(), + ServiceName, + message)); + } + } + catch { } + finally + { + udpClient.Close(); + } + } + + /// + /// Asynchronous method for awaiting until the service will be discovered. + /// + /// + /// + public Task> Discover(TimeSpan? timeout = null) + { + Start(); + + TaskCompletionSource> source = new TaskCompletionSource>(); + + EventHandler> handler = null; + + handler = (sender, e) => + { + ServiceDiscovered -= handler; + source.SetResult(e); + }; + + ServiceDiscovered += handler; + + Task.Delay(timeout != null ? timeout.Value : TimeSpan.FromSeconds(10)).ContinueWith((x) => + { + if (!source.Task.IsCompleted) + { + source.SetException(new TimeoutException()); + } + }); + + return source.Task; + } + } +} diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs b/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs new file mode 100644 index 000000000..f33449607 --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using System.Timers; +using Tango.PMR.Discovery; + +namespace Tango.Transport.Discovery +{ + /// + /// Represents UDP discovery service broadcasting a discovery message of type . + /// + /// + public class UdpDiscoveryService : IDiscoveryService + { + private Timer _timer; + + /// + /// Gets or sets the interval in which the discovery message will be sent. + /// + public TimeSpan Interval { get; set; } + + /// + /// Gets a value indicating whether this service has been started. + /// + public bool IsStarted { get; private set; } + + /// + /// Gets the name of the service. + /// + public String ServiceName { get; set; } + + /// + /// Gets the UDP port number. + /// + public int Port { get; private set; } + + /// + /// Prevents a default instance of the class from being created. + /// + private UdpDiscoveryService() + { + Interval = TimeSpan.FromSeconds(5); + } + + /// + /// Initializes a new instance of the class. + /// + /// The UDP port number. + public UdpDiscoveryService(String serviceName, int port) : this() + { + Port = port; + ServiceName = serviceName; + } + + /// + /// Starts the discovery service. + /// + public void Start() + { + if (!IsStarted) + { + _timer = new Timer(); + _timer.Interval = Interval.TotalMilliseconds; + _timer.Elapsed += _timer_Elapsed; + _timer.Enabled = true; + _timer.Start(); + + IsStarted = true; + } + } + + /// + /// Stops the discovery service. + /// + public void Stop() + { + if (IsStarted) + { + _timer.Stop(); + IsStarted = false; + } + } + + /// + /// Handles the Elapsed event of the _timer control. + /// + /// The source of the event. + /// The instance containing the event data. + private void _timer_Elapsed(object sender, ElapsedEventArgs e) + { + UdpClient client = new UdpClient(); + + IPEndPoint endPoint = new IPEndPoint(IPAddress.Broadcast, Port); + + BasicDiscoveryMessage message = new BasicDiscoveryMessage(); + message.ServiceName = ServiceName; + + byte[] bytes = message.ToBytes(); + + client.Send(bytes, bytes.Length, endPoint); + + client.Close(); + } + } +} diff --git a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj index e7ae581f0..ce50f0311 100644 --- a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj +++ b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj @@ -67,6 +67,12 @@ + + + + + + diff --git a/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs index 6e59dde8a..37ade9688 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs @@ -13,6 +13,7 @@ using Tango.Transport.Adapters; using Tango.PMR.IO; using Tango.PMR; using Google.Protobuf; +using Tango.Transport.Discovery; namespace Tango.UnitTesting { @@ -28,7 +29,11 @@ namespace Tango.UnitTesting Thread.Sleep(2000); - ITransportAdapter adapter = new TcpTransportAdapter("localhost", 9595); + UdpDiscoveryClient discoveryClient = new UdpDiscoveryClient("Tango Remote Runner", 2018); + var service = discoveryClient.Discover().Result; + + + ITransportAdapter adapter = new TcpTransportAdapter(service.Address, 9595); ITransporter transporter = new BasicTransporter(adapter); transporter.Connect().Wait(); diff --git a/Software/Visual_Studio/Utilities/Tango.RemoteRunner.UI/MainWindowVM.cs b/Software/Visual_Studio/Utilities/Tango.RemoteRunner.UI/MainWindowVM.cs index d0108a499..2ba6aa4bb 100644 --- a/Software/Visual_Studio/Utilities/Tango.RemoteRunner.UI/MainWindowVM.cs +++ b/Software/Visual_Studio/Utilities/Tango.RemoteRunner.UI/MainWindowVM.cs @@ -15,6 +15,7 @@ using Tango.PMR.IO; using Tango.SharedUI; using Tango.Transport; using Tango.Transport.Adapters; +using Tango.Transport.Discovery; using Tango.Transport.Servers; using Tango.Transport.Transporters; @@ -24,6 +25,7 @@ namespace Tango.RemoteRunner.UI { private TcpServer _server; private ITransporter _transporter; + private UdpDiscoveryService _discoveryService; private const int PORT = 9595; private List _uploads; private const long MAX_CHUNK_LENGTH = 1024; @@ -68,6 +70,10 @@ namespace Tango.RemoteRunner.UI _transporter = new BasicTransporter(); _transporter.FailsWithAdapter = false; _transporter.RequestReceived += _transporter_RequestReceived; + + _discoveryService = new UdpDiscoveryService("Tango Remote Runner", 2018); + _discoveryService.Interval = TimeSpan.FromSeconds(1); + _discoveryService.Start(); } private void _transporter_RequestReceived(object sender, MessageContainer container) -- cgit v1.3.1 From bf67ff2291a5dbe41e65747b9071475cc4bb1124 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sun, 3 Jun 2018 23:27:32 +0300 Subject: Added VS Extensions to repository. --- .../Visual_Studio/Installers/Keyoti.Conveyor.vsix | Bin 838452 -> 0 bytes .../Installers/Surface SDK/ReadMe.txt | 6 ++++ .../Installers/Surface SDK/SurfaceRuntime.msi | Bin 0 -> 2793472 bytes .../Installers/Surface SDK/SurfaceSDK.msi | Bin 0 -> 46415872 bytes .../Installers/Surface SDK/xnafx40_redist.msi | Bin 0 -> 7054336 bytes .../GhostDoc.v5.9.18070.VS2017.Extension.vsix | Bin 0 -> 17833625 bytes .../VS Extensions/InlineColorPicker.vsix | Bin 0 -> 26231 bytes .../VS Extensions/InstallerProjects.vsix | Bin 0 -> 5292490 bytes .../Installers/VS Extensions/Keyoti.Conveyor.vsix | Bin 0 -> 838452 bytes .../VisualStudio.SpellChecker.VS2017AndLater.vsix | Bin 0 -> 8981707 bytes .../Installers/VS InstallerProjects 2017.vsix | Bin 4857334 -> 0 bytes .../Tango.UnitTesting/Tango.UnitTesting.csproj | 32 ++------------------- 12 files changed, 9 insertions(+), 29 deletions(-) delete mode 100644 Software/Visual_Studio/Installers/Keyoti.Conveyor.vsix create mode 100644 Software/Visual_Studio/Installers/Surface SDK/ReadMe.txt create mode 100644 Software/Visual_Studio/Installers/Surface SDK/SurfaceRuntime.msi create mode 100644 Software/Visual_Studio/Installers/Surface SDK/SurfaceSDK.msi create mode 100644 Software/Visual_Studio/Installers/Surface SDK/xnafx40_redist.msi create mode 100644 Software/Visual_Studio/Installers/VS Extensions/GhostDoc.v5.9.18070.VS2017.Extension.vsix create mode 100644 Software/Visual_Studio/Installers/VS Extensions/InlineColorPicker.vsix create mode 100644 Software/Visual_Studio/Installers/VS Extensions/InstallerProjects.vsix create mode 100644 Software/Visual_Studio/Installers/VS Extensions/Keyoti.Conveyor.vsix create mode 100644 Software/Visual_Studio/Installers/VS Extensions/VisualStudio.SpellChecker.VS2017AndLater.vsix delete mode 100644 Software/Visual_Studio/Installers/VS InstallerProjects 2017.vsix (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/Visual_Studio/Installers/Keyoti.Conveyor.vsix b/Software/Visual_Studio/Installers/Keyoti.Conveyor.vsix deleted file mode 100644 index 2a0b7a89a..000000000 Binary files a/Software/Visual_Studio/Installers/Keyoti.Conveyor.vsix and /dev/null differ diff --git a/Software/Visual_Studio/Installers/Surface SDK/ReadMe.txt b/Software/Visual_Studio/Installers/Surface SDK/ReadMe.txt new file mode 100644 index 000000000..417bcc959 --- /dev/null +++ b/Software/Visual_Studio/Installers/Surface SDK/ReadMe.txt @@ -0,0 +1,6 @@ +Contains the neccessary packages required to develop and run WPF application that contains Surface SDK controls. +The 'SurfaceSDK.msi' file is pre-patched using 'Orca MSI editor' in order to enable the installer to continue without VS 2010 installed on the host. + +1. Install 'xnafx40_redist.msi' (XNA framework 4.0) +2. Install 'SurfaceSDK.msi' +3. Install 'SurfaceRuntime.msi' \ No newline at end of file diff --git a/Software/Visual_Studio/Installers/Surface SDK/SurfaceRuntime.msi b/Software/Visual_Studio/Installers/Surface SDK/SurfaceRuntime.msi new file mode 100644 index 000000000..fb31ac35b Binary files /dev/null and b/Software/Visual_Studio/Installers/Surface SDK/SurfaceRuntime.msi differ diff --git a/Software/Visual_Studio/Installers/Surface SDK/SurfaceSDK.msi b/Software/Visual_Studio/Installers/Surface SDK/SurfaceSDK.msi new file mode 100644 index 000000000..a99ffccec Binary files /dev/null and b/Software/Visual_Studio/Installers/Surface SDK/SurfaceSDK.msi differ diff --git a/Software/Visual_Studio/Installers/Surface SDK/xnafx40_redist.msi b/Software/Visual_Studio/Installers/Surface SDK/xnafx40_redist.msi new file mode 100644 index 000000000..42bbb26c1 Binary files /dev/null and b/Software/Visual_Studio/Installers/Surface SDK/xnafx40_redist.msi differ diff --git a/Software/Visual_Studio/Installers/VS Extensions/GhostDoc.v5.9.18070.VS2017.Extension.vsix b/Software/Visual_Studio/Installers/VS Extensions/GhostDoc.v5.9.18070.VS2017.Extension.vsix new file mode 100644 index 000000000..45987a0d8 Binary files /dev/null and b/Software/Visual_Studio/Installers/VS Extensions/GhostDoc.v5.9.18070.VS2017.Extension.vsix differ diff --git a/Software/Visual_Studio/Installers/VS Extensions/InlineColorPicker.vsix b/Software/Visual_Studio/Installers/VS Extensions/InlineColorPicker.vsix new file mode 100644 index 000000000..e18df29e0 Binary files /dev/null and b/Software/Visual_Studio/Installers/VS Extensions/InlineColorPicker.vsix differ diff --git a/Software/Visual_Studio/Installers/VS Extensions/InstallerProjects.vsix b/Software/Visual_Studio/Installers/VS Extensions/InstallerProjects.vsix new file mode 100644 index 000000000..730901c68 Binary files /dev/null and b/Software/Visual_Studio/Installers/VS Extensions/InstallerProjects.vsix differ diff --git a/Software/Visual_Studio/Installers/VS Extensions/Keyoti.Conveyor.vsix b/Software/Visual_Studio/Installers/VS Extensions/Keyoti.Conveyor.vsix new file mode 100644 index 000000000..2a0b7a89a Binary files /dev/null and b/Software/Visual_Studio/Installers/VS Extensions/Keyoti.Conveyor.vsix differ diff --git a/Software/Visual_Studio/Installers/VS Extensions/VisualStudio.SpellChecker.VS2017AndLater.vsix b/Software/Visual_Studio/Installers/VS Extensions/VisualStudio.SpellChecker.VS2017AndLater.vsix new file mode 100644 index 000000000..093b2876c Binary files /dev/null and b/Software/Visual_Studio/Installers/VS Extensions/VisualStudio.SpellChecker.VS2017AndLater.vsix differ diff --git a/Software/Visual_Studio/Installers/VS InstallerProjects 2017.vsix b/Software/Visual_Studio/Installers/VS InstallerProjects 2017.vsix deleted file mode 100644 index 9b12022b1..000000000 Binary files a/Software/Visual_Studio/Installers/VS InstallerProjects 2017.vsix and /dev/null differ diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj index b01b6374b..32991286d 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj +++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj @@ -54,6 +54,9 @@ ..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll + + True + ..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll @@ -173,35 +176,6 @@ Tango.DBObservablesGenerator.CLI - - - {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52} - 2 - 8 - 0 - primary - False - True - - - {00062FFF-0000-0000-C000-000000000046} - 9 - 6 - 0 - primary - False - True - - - {00020430-0000-0000-C000-000000000046} - 2 - 0 - 0 - primary - False - True - - -- cgit v1.3.1 From acf120606f7495bd132c0250fccb1b975e9660da Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Mon, 4 Jun 2018 01:22:32 +0300 Subject: Added PMR_VS solution. Refactored discovery to be more generic. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1572864 -> 1572864 bytes .../Messages/Discovery/BasicDiscoveryMessage.proto | 1 + Software/PMR/PMR_VS.sln | 296 +++++++++++++++++++++ .../CeciliaSharp.FolderToSolutionFolder.vsix | Bin 0 -> 57817 bytes .../Installers/VS Extensions/Protobuf.vsix | Bin 0 -> 139785 bytes .../Tango.PMR/Discovery/BasicDiscoveryMessage.cs | 36 ++- .../Visual_Studio/Tango.PMR/ExtensionMethods.cs | 19 +- .../Tango.Transport/Discovery/DiscoveredService.cs | 9 +- .../Tango.Transport/Discovery/IDiscoveryClient.cs | 5 - .../Tango.Transport/Discovery/IDiscoveryService.cs | 4 +- .../Discovery/UdpDiscoveryClient.cs | 41 ++- .../Discovery/UdpDiscoveryService.cs | 40 +-- .../Tango.UnitTesting/RemoteRunner_TST.cs | 8 +- .../Tango.RemoteRunner.UI/MainWindowVM.cs | 10 +- 15 files changed, 399 insertions(+), 70 deletions(-) create mode 100644 Software/PMR/PMR_VS.sln create mode 100644 Software/Visual_Studio/Installers/VS Extensions/CeciliaSharp.FolderToSolutionFolder.vsix create mode 100644 Software/Visual_Studio/Installers/VS Extensions/Protobuf.vsix (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 0dd38d32a..7dc1cc6e6 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 636ef8a32..5b926aaf7 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/PMR/Messages/Discovery/BasicDiscoveryMessage.proto b/Software/PMR/Messages/Discovery/BasicDiscoveryMessage.proto index e35ade4af..02ba79eeb 100644 --- a/Software/PMR/Messages/Discovery/BasicDiscoveryMessage.proto +++ b/Software/PMR/Messages/Discovery/BasicDiscoveryMessage.proto @@ -6,4 +6,5 @@ option java_package = "com.twine.tango.pmr.discovery"; message BasicDiscoveryMessage { string ServiceName = 1; + int32 Port = 2; } \ No newline at end of file diff --git a/Software/PMR/PMR_VS.sln b/Software/PMR/PMR_VS.sln new file mode 100644 index 000000000..732fc017f --- /dev/null +++ b/Software/PMR/PMR_VS.sln @@ -0,0 +1,296 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2026 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Messages", "Messages", "{BB5CA06C-3A2F-4FEA-8E92-9BED942B3533}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ColorLab", "ColorLab", "{F918CE55-81A8-4A32-8A9B-0DF5B888E771}" + ProjectSection(SolutionItems) = preProject + Messages\ColorLab\CalibrationData.proto = Messages\ColorLab\CalibrationData.proto + Messages\ColorLab\CalibrationPoint.proto = Messages\ColorLab\CalibrationPoint.proto + Messages\ColorLab\ColorSpace.proto = Messages\ColorLab\ColorSpace.proto + Messages\ColorLab\ConversionInput.proto = Messages\ColorLab\ConversionInput.proto + Messages\ColorLab\ConversionOutput.proto = Messages\ColorLab\ConversionOutput.proto + Messages\ColorLab\InputCoordinates.proto = Messages\ColorLab\InputCoordinates.proto + Messages\ColorLab\InputLiquid.proto = Messages\ColorLab\InputLiquid.proto + Messages\ColorLab\LiquidType.proto = Messages\ColorLab\LiquidType.proto + Messages\ColorLab\OutputCoordinates.proto = Messages\ColorLab\OutputCoordinates.proto + Messages\ColorLab\OutputLiquid.proto = Messages\ColorLab\OutputLiquid.proto + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{8A927AAA-2D40-4A89-A544-B3168FEA624E}" + ProjectSection(SolutionItems) = preProject + Messages\Common\ErrorCode.proto = Messages\Common\ErrorCode.proto + Messages\Common\ErrorResponse.proto = Messages\Common\ErrorResponse.proto + Messages\Common\MessageContainer.proto = Messages\Common\MessageContainer.proto + Messages\Common\MessageType.proto = Messages\Common\MessageType.proto + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Connection", "Connection", "{110243EB-C0ED-40D6-871D-660C78B01DAB}" + ProjectSection(SolutionItems) = preProject + Messages\Connection\ConnectRequest.proto = Messages\Connection\ConnectRequest.proto + Messages\Connection\ConnectResponse.proto = Messages\Connection\ConnectResponse.proto + Messages\Connection\DeviceInformation.proto = Messages\Connection\DeviceInformation.proto + Messages\Connection\DisconnectRequest.proto = Messages\Connection\DisconnectRequest.proto + Messages\Connection\DisconnectResponse.proto = Messages\Connection\DisconnectResponse.proto + Messages\Connection\KeepAliveRequest.proto = Messages\Connection\KeepAliveRequest.proto + Messages\Connection\KeepAliveResponse.proto = Messages\Connection\KeepAliveResponse.proto + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debugging", "Debugging", "{42FBF337-7136-4265-BCE7-16FA02BD29C2}" + ProjectSection(SolutionItems) = preProject + Messages\Debugging\DebugLogCategory.proto = Messages\Debugging\DebugLogCategory.proto + Messages\Debugging\StartDebugLogRequest.proto = Messages\Debugging\StartDebugLogRequest.proto + Messages\Debugging\StartDebugLogResponse.proto = Messages\Debugging\StartDebugLogResponse.proto + Messages\Debugging\StopDebugLogRequest.proto = Messages\Debugging\StopDebugLogRequest.proto + Messages\Debugging\StopDebugLogResponse.proto = Messages\Debugging\StopDebugLogResponse.proto + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Diagnostics", "Diagnostics", "{4D783341-40E0-4A6C-9711-F257A9ACE44F}" + ProjectSection(SolutionItems) = preProject + Messages\Diagnostics\DataFileFrame.proto = Messages\Diagnostics\DataFileFrame.proto + Messages\Diagnostics\DiagnosticsMonitors.proto = Messages\Diagnostics\DiagnosticsMonitors.proto + Messages\Diagnostics\DigitalPin.proto = Messages\Diagnostics\DigitalPin.proto + Messages\Diagnostics\DispenserAbortHomingRequest.proto = Messages\Diagnostics\DispenserAbortHomingRequest.proto + Messages\Diagnostics\DispenserAbortHomingResponse.proto = Messages\Diagnostics\DispenserAbortHomingResponse.proto + Messages\Diagnostics\DispenserAbortJoggingRequest.proto = Messages\Diagnostics\DispenserAbortJoggingRequest.proto + Messages\Diagnostics\DispenserAbortJoggingResponse.proto = Messages\Diagnostics\DispenserAbortJoggingResponse.proto + Messages\Diagnostics\DispenserHomingRequest.proto = Messages\Diagnostics\DispenserHomingRequest.proto + Messages\Diagnostics\DispenserHomingResponse.proto = Messages\Diagnostics\DispenserHomingResponse.proto + Messages\Diagnostics\DispenserJoggingRequest.proto = Messages\Diagnostics\DispenserJoggingRequest.proto + Messages\Diagnostics\DispenserJoggingResponse.proto = Messages\Diagnostics\DispenserJoggingResponse.proto + Messages\Diagnostics\DoubleArray.proto = Messages\Diagnostics\DoubleArray.proto + Messages\Diagnostics\Event.proto = Messages\Diagnostics\Event.proto + Messages\Diagnostics\EventType.proto = Messages\Diagnostics\EventType.proto + Messages\Diagnostics\MotorAbortHomingRequest.proto = Messages\Diagnostics\MotorAbortHomingRequest.proto + Messages\Diagnostics\MotorAbortHomingResponse.proto = Messages\Diagnostics\MotorAbortHomingResponse.proto + Messages\Diagnostics\MotorAbortJoggingRequest.proto = Messages\Diagnostics\MotorAbortJoggingRequest.proto + Messages\Diagnostics\MotorAbortJoggingResponse.proto = Messages\Diagnostics\MotorAbortJoggingResponse.proto + Messages\Diagnostics\MotorDirection.proto = Messages\Diagnostics\MotorDirection.proto + Messages\Diagnostics\MotorHomingRequest.proto = Messages\Diagnostics\MotorHomingRequest.proto + Messages\Diagnostics\MotorHomingResponse.proto = Messages\Diagnostics\MotorHomingResponse.proto + Messages\Diagnostics\MotorJoggingRequest.proto = Messages\Diagnostics\MotorJoggingRequest.proto + Messages\Diagnostics\MotorJoggingResponse.proto = Messages\Diagnostics\MotorJoggingResponse.proto + Messages\Diagnostics\ResolveEventRequest.proto = Messages\Diagnostics\ResolveEventRequest.proto + Messages\Diagnostics\ResolveEventResponse.proto = Messages\Diagnostics\ResolveEventResponse.proto + Messages\Diagnostics\SetComponentValueRequest.proto = Messages\Diagnostics\SetComponentValueRequest.proto + Messages\Diagnostics\SetComponentValueResponse.proto = Messages\Diagnostics\SetComponentValueResponse.proto + Messages\Diagnostics\SetDigitalOutRequest.proto = Messages\Diagnostics\SetDigitalOutRequest.proto + Messages\Diagnostics\SetDigitalOutResponse.proto = Messages\Diagnostics\SetDigitalOutResponse.proto + Messages\Diagnostics\StartDiagnosticsRequest.proto = Messages\Diagnostics\StartDiagnosticsRequest.proto + Messages\Diagnostics\StartDiagnosticsResponse.proto = Messages\Diagnostics\StartDiagnosticsResponse.proto + Messages\Diagnostics\StopDiagnosticsRequest.proto = Messages\Diagnostics\StopDiagnosticsRequest.proto + Messages\Diagnostics\StopDiagnosticsResponse.proto = Messages\Diagnostics\StopDiagnosticsResponse.proto + Messages\Diagnostics\ThreadAbortJoggingRequest.proto = Messages\Diagnostics\ThreadAbortJoggingRequest.proto + Messages\Diagnostics\ThreadAbortJoggingResponse.proto = Messages\Diagnostics\ThreadAbortJoggingResponse.proto + Messages\Diagnostics\ThreadJoggingRequest.proto = Messages\Diagnostics\ThreadJoggingRequest.proto + Messages\Diagnostics\ThreadJoggingResponse.proto = Messages\Diagnostics\ThreadJoggingResponse.proto + Messages\Diagnostics\ValueComponent.proto = Messages\Diagnostics\ValueComponent.proto + Messages\Diagnostics\ValueComponentState.proto = Messages\Diagnostics\ValueComponentState.proto + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Discovery", "Discovery", "{07152FA5-7FE5-4C62-8BB1-A5128FAE7948}" + ProjectSection(SolutionItems) = preProject + Messages\Discovery\BasicDiscoveryMessage.proto = Messages\Discovery\BasicDiscoveryMessage.proto + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Embroidery", "Embroidery", "{773BBA4E-9412-404E-986E-F53AF1939207}" + ProjectSection(SolutionItems) = preProject + Messages\Embroidery\AnalyzeInput.proto = Messages\Embroidery\AnalyzeInput.proto + Messages\Embroidery\AnalyzeOutput.proto = Messages\Embroidery\AnalyzeOutput.proto + Messages\Embroidery\ConvertFileInput.proto = Messages\Embroidery\ConvertFileInput.proto + Messages\Embroidery\ConvertFileOutput.proto = Messages\Embroidery\ConvertFileOutput.proto + Messages\Embroidery\EmbroideryFile.proto = Messages\Embroidery\EmbroideryFile.proto + Messages\Embroidery\Extents.proto = Messages\Embroidery\Extents.proto + Messages\Embroidery\Stitch.proto = Messages\Embroidery\Stitch.proto + Messages\Embroidery\StitchColor.proto = Messages\Embroidery\StitchColor.proto + Messages\Embroidery\StitchFlag.proto = Messages\Embroidery\StitchFlag.proto + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Hardware", "Hardware", "{BC8D97EB-A1C9-4236-AA90-7CE42667AB0F}" + ProjectSection(SolutionItems) = preProject + Messages\Hardware\HardwareConfiguration.proto = Messages\Hardware\HardwareConfiguration.proto + Messages\Hardware\HardwareDancer.proto = Messages\Hardware\HardwareDancer.proto + Messages\Hardware\HardwareDancerType.proto = Messages\Hardware\HardwareDancerType.proto + Messages\Hardware\HardwareDispenser.proto = Messages\Hardware\HardwareDispenser.proto + Messages\Hardware\HardwareDispenserType.proto = Messages\Hardware\HardwareDispenserType.proto + Messages\Hardware\HardwareMotor.proto = Messages\Hardware\HardwareMotor.proto + Messages\Hardware\HardwareMotorType.proto = Messages\Hardware\HardwareMotorType.proto + Messages\Hardware\HardwarePidControl.proto = Messages\Hardware\HardwarePidControl.proto + Messages\Hardware\HardwarePidControlType.proto = Messages\Hardware\HardwarePidControlType.proto + Messages\Hardware\HardwareSpeedSensor.proto = Messages\Hardware\HardwareSpeedSensor.proto + Messages\Hardware\HardwareSpeedSensorType.proto = Messages\Hardware\HardwareSpeedSensorType.proto + Messages\Hardware\HardwareWinder.proto = Messages\Hardware\HardwareWinder.proto + Messages\Hardware\HardwareWinderType.proto = Messages\Hardware\HardwareWinderType.proto + Messages\Hardware\SystemResetRequest.proto = Messages\Hardware\SystemResetRequest.proto + Messages\Hardware\SystemResetResponse.proto = Messages\Hardware\SystemResetResponse.proto + Messages\Hardware\UploadHardwareConfigurationRequest.proto = Messages\Hardware\UploadHardwareConfigurationRequest.proto + Messages\Hardware\UploadHardwareConfigurationResponse.proto = Messages\Hardware\UploadHardwareConfigurationResponse.proto + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Integration", "Integration", "{77B923E6-9E1E-4EFF-939C-F5DDD7B741BA}" + ProjectSection(SolutionItems) = preProject + Messages\Integration\DirectSynchronizationRequest.proto = Messages\Integration\DirectSynchronizationRequest.proto + Messages\Integration\DirectSynchronizationResponse.proto = Messages\Integration\DirectSynchronizationResponse.proto + Messages\Integration\ExternalBridgeUdpDiscoveryPacket.proto = Messages\Integration\ExternalBridgeUdpDiscoveryPacket.proto + Messages\Integration\ExternalClientLoginRequest.proto = Messages\Integration\ExternalClientLoginRequest.proto + Messages\Integration\ExternalClientLoginResponse.proto = Messages\Integration\ExternalClientLoginResponse.proto + Messages\Integration\OverrideDataBaseRequest.proto = Messages\Integration\OverrideDataBaseRequest.proto + Messages\Integration\OverrideDataBaseResponse.proto = Messages\Integration\OverrideDataBaseResponse.proto + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IO", "IO", "{0A19C4ED-67A8-4FE0-9D2A-1B4B29E986A7}" + ProjectSection(SolutionItems) = preProject + Messages\IO\ExecuteProcessRequest.proto = Messages\IO\ExecuteProcessRequest.proto + Messages\IO\ExecuteProcessResponse.proto = Messages\IO\ExecuteProcessResponse.proto + Messages\IO\FileChunkUploadRequest.proto = Messages\IO\FileChunkUploadRequest.proto + Messages\IO\FileChunkUploadResponse.proto = Messages\IO\FileChunkUploadResponse.proto + Messages\IO\FileUploadRequest.proto = Messages\IO\FileUploadRequest.proto + Messages\IO\FileUploadResponse.proto = Messages\IO\FileUploadResponse.proto + Messages\IO\KillProcessRequest.proto = Messages\IO\KillProcessRequest.proto + Messages\IO\KillProcessResponse.proto = Messages\IO\KillProcessResponse.proto + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Printing", "Printing", "{2C879BEA-114C-4033-88B8-F2666A4C279E}" + ProjectSection(SolutionItems) = preProject + Messages\Printing\AbortJobRequest.proto = Messages\Printing\AbortJobRequest.proto + Messages\Printing\AbortJobResponse.proto = Messages\Printing\AbortJobResponse.proto + Messages\Printing\DispenserLiquidType.proto = Messages\Printing\DispenserLiquidType.proto + Messages\Printing\DispenserStepDivision.proto = Messages\Printing\DispenserStepDivision.proto + Messages\Printing\JobBrushStop.proto = Messages\Printing\JobBrushStop.proto + Messages\Printing\JobDispenser.proto = Messages\Printing\JobDispenser.proto + Messages\Printing\JobRequest.proto = Messages\Printing\JobRequest.proto + Messages\Printing\JobResponse.proto = Messages\Printing\JobResponse.proto + Messages\Printing\JobSegment.proto = Messages\Printing\JobSegment.proto + Messages\Printing\JobSpool.proto = Messages\Printing\JobSpool.proto + Messages\Printing\JobSpoolType.proto = Messages\Printing\JobSpoolType.proto + Messages\Printing\JobStatus.proto = Messages\Printing\JobStatus.proto + Messages\Printing\JobTicket.proto = Messages\Printing\JobTicket.proto + Messages\Printing\JobWindingMethod.proto = Messages\Printing\JobWindingMethod.proto + Messages\Printing\ProcessParameters.proto = Messages\Printing\ProcessParameters.proto + Messages\Printing\UploadProcessParametersRequest.proto = Messages\Printing\UploadProcessParametersRequest.proto + Messages\Printing\UploadProcessParametersResponse.proto = Messages\Printing\UploadProcessParametersResponse.proto + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Stubs", "Stubs", "{FC320061-5CF8-4677-B575-59146D82D79D}" + ProjectSection(SolutionItems) = preProject + Messages\Stubs\CalculateRequest.proto = Messages\Stubs\CalculateRequest.proto + Messages\Stubs\CalculateResponse.proto = Messages\Stubs\CalculateResponse.proto + Messages\Stubs\ProgressRequest.proto = Messages\Stubs\ProgressRequest.proto + Messages\Stubs\ProgressResponse.proto = Messages\Stubs\ProgressResponse.proto + Messages\Stubs\StubCartridgeReadRequest.proto = Messages\Stubs\StubCartridgeReadRequest.proto + Messages\Stubs\StubCartridgeReadResponse.proto = Messages\Stubs\StubCartridgeReadResponse.proto + Messages\Stubs\StubCartridgeWriteRequest.proto = Messages\Stubs\StubCartridgeWriteRequest.proto + Messages\Stubs\StubCartridgeWriteResponse.proto = Messages\Stubs\StubCartridgeWriteResponse.proto + Messages\Stubs\StubDancerPositionRequest.proto = Messages\Stubs\StubDancerPositionRequest.proto + Messages\Stubs\StubDancerPositionResponse.proto = Messages\Stubs\StubDancerPositionResponse.proto + Messages\Stubs\StubDispenserRequest.proto = Messages\Stubs\StubDispenserRequest.proto + Messages\Stubs\StubDispenserResponse.proto = Messages\Stubs\StubDispenserResponse.proto + Messages\Stubs\StubExtFlashReadRequest.proto = Messages\Stubs\StubExtFlashReadRequest.proto + Messages\Stubs\StubExtFlashReadResponse.proto = Messages\Stubs\StubExtFlashReadResponse.proto + Messages\Stubs\StubExtFlashWriteRequest.proto = Messages\Stubs\StubExtFlashWriteRequest.proto + Messages\Stubs\StubExtFlashWriteResponse.proto = Messages\Stubs\StubExtFlashWriteResponse.proto + Messages\Stubs\StubF3Gpo01WriteRequest.proto = Messages\Stubs\StubF3Gpo01WriteRequest.proto + Messages\Stubs\StubF3Gpo01WriteResponse.proto = Messages\Stubs\StubF3Gpo01WriteResponse.proto + Messages\Stubs\StubFPGAReadBackRegRequest.proto = Messages\Stubs\StubFPGAReadBackRegRequest.proto + Messages\Stubs\StubFPGAReadBackRegResponse.proto = Messages\Stubs\StubFPGAReadBackRegResponse.proto + Messages\Stubs\StubFpgaReadRegRequest.proto = Messages\Stubs\StubFpgaReadRegRequest.proto + Messages\Stubs\StubFpgaReadRegResponse.proto = Messages\Stubs\StubFpgaReadRegResponse.proto + Messages\Stubs\StubFPGAReadVersionRequest.proto = Messages\Stubs\StubFPGAReadVersionRequest.proto + Messages\Stubs\StubFPGAReadVersionResponse.proto = Messages\Stubs\StubFPGAReadVersionResponse.proto + Messages\Stubs\StubFpgaWriteRegRequest.proto = Messages\Stubs\StubFpgaWriteRegRequest.proto + Messages\Stubs\StubFpgaWriteRegResponse.proto = Messages\Stubs\StubFpgaWriteRegResponse.proto + Messages\Stubs\StubGPIOInputSetupRequest.proto = Messages\Stubs\StubGPIOInputSetupRequest.proto + Messages\Stubs\StubGPIOInputSetupResponse.proto = Messages\Stubs\StubGPIOInputSetupResponse.proto + Messages\Stubs\StubGPIOReadBitRequest.proto = Messages\Stubs\StubGPIOReadBitRequest.proto + Messages\Stubs\StubGPIOReadBitResponse.proto = Messages\Stubs\StubGPIOReadBitResponse.proto + Messages\Stubs\StubGPIOReadByteRequest.proto = Messages\Stubs\StubGPIOReadByteRequest.proto + Messages\Stubs\StubGPIOReadByteResponse.proto = Messages\Stubs\StubGPIOReadByteResponse.proto + Messages\Stubs\StubGPIOWriteBitRequest.proto = Messages\Stubs\StubGPIOWriteBitRequest.proto + Messages\Stubs\StubGPIOWriteBitResponse.proto = Messages\Stubs\StubGPIOWriteBitResponse.proto + Messages\Stubs\StubGPIOWriteByteRequest.proto = Messages\Stubs\StubGPIOWriteByteRequest.proto + Messages\Stubs\StubGPIOWriteByteResponse.proto = Messages\Stubs\StubGPIOWriteByteResponse.proto + Messages\Stubs\StubHeaterRequest.proto = Messages\Stubs\StubHeaterRequest.proto + Messages\Stubs\StubHeaterResponse.proto = Messages\Stubs\StubHeaterResponse.proto + Messages\Stubs\StubHeatingTestPollRequest.proto = Messages\Stubs\StubHeatingTestPollRequest.proto + Messages\Stubs\StubHeatingTestPollResponse.proto = Messages\Stubs\StubHeatingTestPollResponse.proto + Messages\Stubs\StubHeatingTestRequest.proto = Messages\Stubs\StubHeatingTestRequest.proto + Messages\Stubs\StubHeatingTestResponse.proto = Messages\Stubs\StubHeatingTestResponse.proto + Messages\Stubs\StubHWVersionRequest.proto = Messages\Stubs\StubHWVersionRequest.proto + Messages\Stubs\StubHWVersionResponse.proto = Messages\Stubs\StubHWVersionResponse.proto + Messages\Stubs\StubIntADCReadRequest.proto = Messages\Stubs\StubIntADCReadRequest.proto + Messages\Stubs\StubIntADCReadResponse.proto = Messages\Stubs\StubIntADCReadResponse.proto + Messages\Stubs\StubL6470DriverRequest.proto = Messages\Stubs\StubL6470DriverRequest.proto + Messages\Stubs\StubL6470DriverResponse.proto = Messages\Stubs\StubL6470DriverResponse.proto + Messages\Stubs\StubMotorEncoderRequest.proto = Messages\Stubs\StubMotorEncoderRequest.proto + Messages\Stubs\StubMotorEncoderResponse.proto = Messages\Stubs\StubMotorEncoderResponse.proto + Messages\Stubs\StubMotorHomeMarkRequest.proto = Messages\Stubs\StubMotorHomeMarkRequest.proto + Messages\Stubs\StubMotorHomeMarkResponse.proto = Messages\Stubs\StubMotorHomeMarkResponse.proto + Messages\Stubs\StubMotorInitRequest.proto = Messages\Stubs\StubMotorInitRequest.proto + Messages\Stubs\StubMotorInitResponse.proto = Messages\Stubs\StubMotorInitResponse.proto + Messages\Stubs\StubMotorMovRequest.proto = Messages\Stubs\StubMotorMovRequest.proto + Messages\Stubs\StubMotorMovResponse.proto = Messages\Stubs\StubMotorMovResponse.proto + Messages\Stubs\StubMotorPositionRequest.proto = Messages\Stubs\StubMotorPositionRequest.proto + Messages\Stubs\StubMotorPositionResponse.proto = Messages\Stubs\StubMotorPositionResponse.proto + Messages\Stubs\StubMotorRequest.proto = Messages\Stubs\StubMotorRequest.proto + Messages\Stubs\StubMotorResponse.proto = Messages\Stubs\StubMotorResponse.proto + Messages\Stubs\StubMotorRunRequest.proto = Messages\Stubs\StubMotorRunRequest.proto + Messages\Stubs\StubMotorRunResponse.proto = Messages\Stubs\StubMotorRunResponse.proto + Messages\Stubs\StubMotorRunStepTickRequest.proto = Messages\Stubs\StubMotorRunStepTickRequest.proto + Messages\Stubs\StubMotorRunStepTickResponse.proto = Messages\Stubs\StubMotorRunStepTickResponse.proto + Messages\Stubs\StubMotorSpeedRequest.proto = Messages\Stubs\StubMotorSpeedRequest.proto + Messages\Stubs\StubMotorSpeedResponse.proto = Messages\Stubs\StubMotorSpeedResponse.proto + Messages\Stubs\StubMotorStatusRequest.proto = Messages\Stubs\StubMotorStatusRequest.proto + Messages\Stubs\StubMotorStatusResponse.proto = Messages\Stubs\StubMotorStatusResponse.proto + Messages\Stubs\StubMotorStopRequest.proto = Messages\Stubs\StubMotorStopRequest.proto + Messages\Stubs\StubMotorStopResponse.proto = Messages\Stubs\StubMotorStopResponse.proto + Messages\Stubs\StubOptLimitSwitchRequest.proto = Messages\Stubs\StubOptLimitSwitchRequest.proto + Messages\Stubs\StubOptLimitSwitchResponse.proto = Messages\Stubs\StubOptLimitSwitchResponse.proto + Messages\Stubs\StubReadEmbeddedVersionRequest.proto = Messages\Stubs\StubReadEmbeddedVersionRequest.proto + Messages\Stubs\StubReadEmbeddedVersionResponse.proto = Messages\Stubs\StubReadEmbeddedVersionResponse.proto + Messages\Stubs\StubRealTimeUsageRequest.proto = Messages\Stubs\StubRealTimeUsageRequest.proto + Messages\Stubs\StubRealTimeUsageResponse.proto = Messages\Stubs\StubRealTimeUsageResponse.proto + Messages\Stubs\StubSpeedSensorRequest.proto = Messages\Stubs\StubSpeedSensorRequest.proto + Messages\Stubs\StubSpeedSensorResponse.proto = Messages\Stubs\StubSpeedSensorResponse.proto + Messages\Stubs\StubSteperMotorRequest.proto = Messages\Stubs\StubSteperMotorRequest.proto + Messages\Stubs\StubSteperMotorResponse.proto = Messages\Stubs\StubSteperMotorResponse.proto + Messages\Stubs\StubTempSensorRequest.proto = Messages\Stubs\StubTempSensorRequest.proto + Messages\Stubs\StubTempSensorResponse.proto = Messages\Stubs\StubTempSensorResponse.proto + Messages\Stubs\StubTivaReadRegRequest.proto = Messages\Stubs\StubTivaReadRegRequest.proto + Messages\Stubs\StubTivaReadRegResponse.proto = Messages\Stubs\StubTivaReadRegResponse.proto + Messages\Stubs\StubTivaWriteRegRequest.proto = Messages\Stubs\StubTivaWriteRegRequest.proto + Messages\Stubs\StubTivaWriteRegResponse.proto = Messages\Stubs\StubTivaWriteRegResponse.proto + Messages\Stubs\StubValveRequest.proto = Messages\Stubs\StubValveRequest.proto + Messages\Stubs\StubValveResponse.proto = Messages\Stubs\StubValveResponse.proto + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Synchronization", "Synchronization", "{E3A987DE-89ED-44B1-96AB-8AC6391D7F4D}" + ProjectSection(SolutionItems) = preProject + Messages\Synchronization\SynchronizeDBRequest.proto = Messages\Synchronization\SynchronizeDBRequest.proto + Messages\Synchronization\SynchronizeDBResponse.proto = Messages\Synchronization\SynchronizeDBResponse.proto + EndProjectSection +EndProject +Global + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {F918CE55-81A8-4A32-8A9B-0DF5B888E771} = {BB5CA06C-3A2F-4FEA-8E92-9BED942B3533} + {8A927AAA-2D40-4A89-A544-B3168FEA624E} = {BB5CA06C-3A2F-4FEA-8E92-9BED942B3533} + {110243EB-C0ED-40D6-871D-660C78B01DAB} = {BB5CA06C-3A2F-4FEA-8E92-9BED942B3533} + {42FBF337-7136-4265-BCE7-16FA02BD29C2} = {BB5CA06C-3A2F-4FEA-8E92-9BED942B3533} + {4D783341-40E0-4A6C-9711-F257A9ACE44F} = {BB5CA06C-3A2F-4FEA-8E92-9BED942B3533} + {07152FA5-7FE5-4C62-8BB1-A5128FAE7948} = {BB5CA06C-3A2F-4FEA-8E92-9BED942B3533} + {773BBA4E-9412-404E-986E-F53AF1939207} = {BB5CA06C-3A2F-4FEA-8E92-9BED942B3533} + {BC8D97EB-A1C9-4236-AA90-7CE42667AB0F} = {BB5CA06C-3A2F-4FEA-8E92-9BED942B3533} + {77B923E6-9E1E-4EFF-939C-F5DDD7B741BA} = {BB5CA06C-3A2F-4FEA-8E92-9BED942B3533} + {0A19C4ED-67A8-4FE0-9D2A-1B4B29E986A7} = {BB5CA06C-3A2F-4FEA-8E92-9BED942B3533} + {2C879BEA-114C-4033-88B8-F2666A4C279E} = {BB5CA06C-3A2F-4FEA-8E92-9BED942B3533} + {FC320061-5CF8-4677-B575-59146D82D79D} = {BB5CA06C-3A2F-4FEA-8E92-9BED942B3533} + {E3A987DE-89ED-44B1-96AB-8AC6391D7F4D} = {BB5CA06C-3A2F-4FEA-8E92-9BED942B3533} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ECAE5B53-2B71-4D92-9994-AB5752117730} + EndGlobalSection +EndGlobal diff --git a/Software/Visual_Studio/Installers/VS Extensions/CeciliaSharp.FolderToSolutionFolder.vsix b/Software/Visual_Studio/Installers/VS Extensions/CeciliaSharp.FolderToSolutionFolder.vsix new file mode 100644 index 000000000..7705e132e Binary files /dev/null and b/Software/Visual_Studio/Installers/VS Extensions/CeciliaSharp.FolderToSolutionFolder.vsix differ diff --git a/Software/Visual_Studio/Installers/VS Extensions/Protobuf.vsix b/Software/Visual_Studio/Installers/VS Extensions/Protobuf.vsix new file mode 100644 index 000000000..bc707bae6 Binary files /dev/null and b/Software/Visual_Studio/Installers/VS Extensions/Protobuf.vsix differ diff --git a/Software/Visual_Studio/Tango.PMR/Discovery/BasicDiscoveryMessage.cs b/Software/Visual_Studio/Tango.PMR/Discovery/BasicDiscoveryMessage.cs index e926a55c4..b3c3ec5d5 100644 --- a/Software/Visual_Studio/Tango.PMR/Discovery/BasicDiscoveryMessage.cs +++ b/Software/Visual_Studio/Tango.PMR/Discovery/BasicDiscoveryMessage.cs @@ -23,13 +23,13 @@ namespace Tango.PMR.Discovery { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChtCYXNpY0Rpc2NvdmVyeU1lc3NhZ2UucHJvdG8SE1RhbmdvLlBNUi5EaXNj", - "b3ZlcnkiLAoVQmFzaWNEaXNjb3ZlcnlNZXNzYWdlEhMKC1NlcnZpY2VOYW1l", - "GAEgASgJQh8KHWNvbS50d2luZS50YW5nby5wbXIuZGlzY292ZXJ5YgZwcm90", - "bzM=")); + "b3ZlcnkiOgoVQmFzaWNEaXNjb3ZlcnlNZXNzYWdlEhMKC1NlcnZpY2VOYW1l", + "GAEgASgJEgwKBFBvcnQYAiABKAVCHwodY29tLnR3aW5lLnRhbmdvLnBtci5k", + "aXNjb3ZlcnliBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Discovery.BasicDiscoveryMessage), global::Tango.PMR.Discovery.BasicDiscoveryMessage.Parser, new[]{ "ServiceName" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Discovery.BasicDiscoveryMessage), global::Tango.PMR.Discovery.BasicDiscoveryMessage.Parser, new[]{ "ServiceName", "Port" }, null, null, null) })); } #endregion @@ -61,6 +61,7 @@ namespace Tango.PMR.Discovery { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public BasicDiscoveryMessage(BasicDiscoveryMessage other) : this() { serviceName_ = other.serviceName_; + port_ = other.port_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -79,6 +80,17 @@ namespace Tango.PMR.Discovery { } } + /// Field number for the "Port" field. + public const int PortFieldNumber = 2; + private int port_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Port { + get { return port_; } + set { + port_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as BasicDiscoveryMessage); @@ -93,6 +105,7 @@ namespace Tango.PMR.Discovery { return true; } if (ServiceName != other.ServiceName) return false; + if (Port != other.Port) return false; return true; } @@ -100,6 +113,7 @@ namespace Tango.PMR.Discovery { public override int GetHashCode() { int hash = 1; if (ServiceName.Length != 0) hash ^= ServiceName.GetHashCode(); + if (Port != 0) hash ^= Port.GetHashCode(); return hash; } @@ -114,6 +128,10 @@ namespace Tango.PMR.Discovery { output.WriteRawTag(10); output.WriteString(ServiceName); } + if (Port != 0) { + output.WriteRawTag(16); + output.WriteInt32(Port); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -122,6 +140,9 @@ namespace Tango.PMR.Discovery { if (ServiceName.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(ServiceName); } + if (Port != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Port); + } return size; } @@ -133,6 +154,9 @@ namespace Tango.PMR.Discovery { if (other.ServiceName.Length != 0) { ServiceName = other.ServiceName; } + if (other.Port != 0) { + Port = other.Port; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -147,6 +171,10 @@ namespace Tango.PMR.Discovery { ServiceName = input.ReadString(); break; } + case 16: { + Port = input.ReadInt32(); + break; + } } } } diff --git a/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs b/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs index 096ed2bf4..3f01d07c8 100644 --- a/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs +++ b/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs @@ -1,4 +1,5 @@ -using Google.Protobuf.Reflection; +using Google.Protobuf; +using Google.Protobuf.Reflection; using System; using System.Collections.Generic; using System.ComponentModel; @@ -8,12 +9,10 @@ using System.Text; using System.Threading.Tasks; using Tango.PMR.Common; -namespace Tango.PMR -{ /// /// Contains PMR extension methods. /// - public static class ExtensionMethods + public static class ExtensionMethods { /// /// Gets the protobuf attribute value from the message type. @@ -32,5 +31,15 @@ namespace Tango.PMR else return value.ToString(); } + + /// + /// Gets the message parser. + /// + /// The message. + /// + public static MessageParser GetParser(this IMessage message) + { + MessageParser parser = message.GetType().GetProperty("Parser").GetValue(message) as MessageParser; + return parser; + } } -} diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/DiscoveredService.cs b/Software/Visual_Studio/Tango.Transport/Discovery/DiscoveredService.cs index f04623792..a9626284f 100644 --- a/Software/Visual_Studio/Tango.Transport/Discovery/DiscoveredService.cs +++ b/Software/Visual_Studio/Tango.Transport/Discovery/DiscoveredService.cs @@ -18,11 +18,6 @@ namespace Tango.Transport.Discovery /// public DiscoveryMessage Message { get; set; } - /// - /// Gets or sets the name of the service. - /// - public String ServiceName { get; set; } - /// /// Gets or sets the service IP address. /// @@ -32,12 +27,10 @@ namespace Tango.Transport.Discovery /// Initializes a new instance of the class. /// /// The address. - /// Name of the service. /// The message. - public DiscoveredService(String address, String serviceName, DiscoveryMessage message) + public DiscoveredService(String address, DiscoveryMessage message) { Address = address; - ServiceName = serviceName; Message = message; } } diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryClient.cs b/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryClient.cs index bfbdca1fd..4bc992d77 100644 --- a/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryClient.cs +++ b/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryClient.cs @@ -19,11 +19,6 @@ namespace Tango.Transport.Discovery /// event EventHandler> ServiceDiscovered; - /// - /// Gets or sets the name of the remote service to discover. - /// - String ServiceName { get; set; } - /// /// Asynchronous method for awaiting until the service will be discovered. /// diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryService.cs b/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryService.cs index 548bbedc0..9ec48ba47 100644 --- a/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryService.cs +++ b/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryService.cs @@ -14,8 +14,8 @@ namespace Tango.Transport.Discovery public interface IDiscoveryService : IDiscoveryComponent where DiscoveryMessage : IMessage { /// - /// Gets the name of the service. + /// Gets or sets the current discovery message. /// - String ServiceName { get; } + DiscoveryMessage CurrentDiscoveryMessage { get; set; } } } diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryClient.cs b/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryClient.cs index a1086c0fa..617aea61a 100644 --- a/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryClient.cs +++ b/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryClient.cs @@ -1,4 +1,5 @@ -using System; +using Google.Protobuf; +using System; using System.Collections.Generic; using System.Linq; using System.Net; @@ -10,14 +11,14 @@ using Tango.PMR.Discovery; namespace Tango.Transport.Discovery { - public class UdpDiscoveryClient : IDiscoveryClient + public class UdpDiscoveryClient : IDiscoveryClient where DiscoveryMessage : IMessage { private Timer _timer; /// /// Occurs when a matching service has been discovered. /// - public event EventHandler> ServiceDiscovered; + public event EventHandler> ServiceDiscovered; /// /// Gets or sets the interval in which the discovery message will be sent. @@ -29,11 +30,6 @@ namespace Tango.Transport.Discovery /// public bool IsStarted { get; private set; } - /// - /// Gets the name of the service. - /// - public String ServiceName { get; set; } - /// /// Gets the UDP port number. /// @@ -51,10 +47,9 @@ namespace Tango.Transport.Discovery /// Initializes a new instance of the class. /// /// The UDP port number. - public UdpDiscoveryClient(String serviceName, int port) : this() + public UdpDiscoveryClient(int port) : this() { Port = port; - ServiceName = serviceName; } /// @@ -86,8 +81,6 @@ namespace Tango.Transport.Discovery } } - - /// /// Handles the Elapsed event of the _timer control. /// @@ -103,16 +96,16 @@ namespace Tango.Transport.Discovery { var data = udpClient.Receive(ref endPoint); udpClient.Close(); - BasicDiscoveryMessage message = BasicDiscoveryMessage.Parser.ParseFrom(data); - if (message.ServiceName == ServiceName) - { - ServiceDiscovered?.Invoke(this, - new DiscoveredService( - endPoint.Address.ToString(), - ServiceName, - message)); - } + DiscoveryMessage message = Activator.CreateInstance(); + var parser = message.GetParser(); + + message = (DiscoveryMessage)parser.ParseFrom(data); + + ServiceDiscovered?.Invoke(this, + new DiscoveredService( + endPoint.Address.ToString(), + message)); } catch { } finally @@ -126,13 +119,13 @@ namespace Tango.Transport.Discovery /// /// /// - public Task> Discover(TimeSpan? timeout = null) + public Task> Discover(TimeSpan? timeout = null) { Start(); - TaskCompletionSource> source = new TaskCompletionSource>(); + TaskCompletionSource> source = new TaskCompletionSource>(); - EventHandler> handler = null; + EventHandler> handler = null; handler = (sender, e) => { diff --git a/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs b/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs index f33449607..76773a817 100644 --- a/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs +++ b/Software/Visual_Studio/Tango.Transport/Discovery/UdpDiscoveryService.cs @@ -1,4 +1,5 @@ -using System; +using Google.Protobuf; +using System; using System.Collections.Generic; using System.Linq; using System.Net; @@ -14,10 +15,15 @@ namespace Tango.Transport.Discovery /// Represents UDP discovery service broadcasting a discovery message of type . /// /// - public class UdpDiscoveryService : IDiscoveryService + public class UdpDiscoveryService : IDiscoveryService where DiscoveryMessage : IMessage { private Timer _timer; + /// + /// Gets or sets the current discovery message. + /// + public DiscoveryMessage CurrentDiscoveryMessage { get; set; } + /// /// Gets or sets the interval in which the discovery message will be sent. /// @@ -28,32 +34,37 @@ namespace Tango.Transport.Discovery /// public bool IsStarted { get; private set; } - /// - /// Gets the name of the service. - /// - public String ServiceName { get; set; } - /// /// Gets the UDP port number. /// public int Port { get; private set; } /// - /// Prevents a default instance of the class from being created. + /// Prevents a default instance of the class from being created. /// private UdpDiscoveryService() { Interval = TimeSpan.FromSeconds(5); + CurrentDiscoveryMessage = Activator.CreateInstance(); } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// The UDP port number. - public UdpDiscoveryService(String serviceName, int port) : this() + /// The port. + public UdpDiscoveryService(int port) : this() { Port = port; - ServiceName = serviceName; + } + + /// + /// Initializes a new instance of the class. + /// + /// The port. + /// The discovery message. + public UdpDiscoveryService(int port, DiscoveryMessage discoveryMessage) : this(port) + { + CurrentDiscoveryMessage = discoveryMessage; } /// @@ -96,10 +107,7 @@ namespace Tango.Transport.Discovery IPEndPoint endPoint = new IPEndPoint(IPAddress.Broadcast, Port); - BasicDiscoveryMessage message = new BasicDiscoveryMessage(); - message.ServiceName = ServiceName; - - byte[] bytes = message.ToBytes(); + byte[] bytes = CurrentDiscoveryMessage.ToByteArray(); client.Send(bytes, bytes.Length, endPoint); diff --git a/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs index 37ade9688..21bdf3295 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs @@ -14,6 +14,7 @@ using Tango.PMR.IO; using Tango.PMR; using Google.Protobuf; using Tango.Transport.Discovery; +using Tango.PMR.Discovery; namespace Tango.UnitTesting { @@ -29,11 +30,10 @@ namespace Tango.UnitTesting Thread.Sleep(2000); - UdpDiscoveryClient discoveryClient = new UdpDiscoveryClient("Tango Remote Runner", 2018); - var service = discoveryClient.Discover().Result; + UdpDiscoveryClient discoveryClient = new UdpDiscoveryClient(2018); + var discoveryResponse = discoveryClient.Discover().Result; - - ITransportAdapter adapter = new TcpTransportAdapter(service.Address, 9595); + ITransportAdapter adapter = new TcpTransportAdapter(discoveryResponse.Address, discoveryResponse.Message.Port); ITransporter transporter = new BasicTransporter(adapter); transporter.Connect().Wait(); diff --git a/Software/Visual_Studio/Utilities/Tango.RemoteRunner.UI/MainWindowVM.cs b/Software/Visual_Studio/Utilities/Tango.RemoteRunner.UI/MainWindowVM.cs index 2ba6aa4bb..fd1b05e15 100644 --- a/Software/Visual_Studio/Utilities/Tango.RemoteRunner.UI/MainWindowVM.cs +++ b/Software/Visual_Studio/Utilities/Tango.RemoteRunner.UI/MainWindowVM.cs @@ -11,6 +11,7 @@ using System.Windows; using Tango.Logging; using Tango.PMR; using Tango.PMR.Common; +using Tango.PMR.Discovery; using Tango.PMR.IO; using Tango.SharedUI; using Tango.Transport; @@ -25,7 +26,7 @@ namespace Tango.RemoteRunner.UI { private TcpServer _server; private ITransporter _transporter; - private UdpDiscoveryService _discoveryService; + private UdpDiscoveryService _discoveryService; private const int PORT = 9595; private List _uploads; private const long MAX_CHUNK_LENGTH = 1024; @@ -71,7 +72,12 @@ namespace Tango.RemoteRunner.UI _transporter.FailsWithAdapter = false; _transporter.RequestReceived += _transporter_RequestReceived; - _discoveryService = new UdpDiscoveryService("Tango Remote Runner", 2018); + _discoveryService = new UdpDiscoveryService(2018, new BasicDiscoveryMessage() + { + ServiceName = "Tango Remote Debugger", + Port = PORT, + }); + _discoveryService.Interval = TimeSpan.FromSeconds(1); _discoveryService.Start(); } -- cgit v1.3.1