From e2ae3a8f203d149094aa48ef576f7f0bc241fc8e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 26 Jul 2018 14:08:27 +0300 Subject: Fixed several bugs with machine studio. --- .../Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index 7c2acfdbb..54a790cbe 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -1221,6 +1221,7 @@ namespace Tango.MachineStudio.Technician.ViewModels } catch (Exception ex) { + item.IsJobStarted = false; _notification.ShowError(ex.Message); } }; -- cgit v1.3.1 From 9283a0917dc29aba1e89bf40bc59f255f73cec48 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 26 Jul 2018 16:02:44 +0300 Subject: Refactored proto C compiler to enable cross directory messages. Refactored tech motors and dispensers to use types from hardware. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1835008 -> 1835008 bytes .../Diagnostics/DispenserAbortHomingRequest.proto | 2 +- .../Diagnostics/DispenserAbortJoggingRequest.proto | 2 +- .../DispenserAbortJoggingResponse.proto | 2 +- .../Diagnostics/DispenserHomingRequest.proto | 2 +- .../Diagnostics/DispenserJoggingRequest.proto | 2 +- .../Diagnostics/MotorAbortHomingRequest.proto | 4 +- .../Diagnostics/MotorAbortJoggingRequest.proto | 4 +- .../Messages/Diagnostics/MotorHomingRequest.proto | 4 +- .../Messages/Diagnostics/MotorJoggingRequest.proto | 3 +- .../ViewModels/MachineTechViewVM.cs | 32 +++++++------- .../Tango.Emulations/Emulators/MachineEmulator.cs | 36 ++++++++-------- .../Diagnostics/DispenserAbortHomingRequest.cs | 40 +++++++++--------- .../Diagnostics/DispenserAbortJoggingRequest.cs | 40 +++++++++--------- .../Diagnostics/DispenserAbortJoggingResponse.cs | 40 +++++++++--------- .../Diagnostics/DispenserHomingRequest.cs | 40 +++++++++--------- .../Diagnostics/DispenserJoggingRequest.cs | 42 +++++++++--------- .../Diagnostics/MotorAbortHomingRequest.cs | 43 ++++++++++--------- .../Diagnostics/MotorAbortJoggingRequest.cs | 47 +++++++++++---------- .../Tango.PMR/Diagnostics/MotorHomingRequest.cs | 43 ++++++++++--------- .../Tango.PMR/Diagnostics/MotorJoggingRequest.cs | 46 ++++++++++---------- .../Visual_Studio/Tango.PMR/ExtensionMethods.cs | 2 +- .../Tango.Protobuf/Compilers/CCompiler.cs | 24 +++++++++-- 24 files changed, 264 insertions(+), 236 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 9e5e297e4..63cd43949 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 6a6100d02..ced536d75 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/PMR/Messages/Diagnostics/DispenserAbortHomingRequest.proto b/Software/PMR/Messages/Diagnostics/DispenserAbortHomingRequest.proto index a50c64c76..06f21aee5 100644 --- a/Software/PMR/Messages/Diagnostics/DispenserAbortHomingRequest.proto +++ b/Software/PMR/Messages/Diagnostics/DispenserAbortHomingRequest.proto @@ -5,5 +5,5 @@ option java_package = "com.twine.tango.pmr.diagnostics"; message DispenserAbortHomingRequest { - int32 Code = 1; + int32 Index = 1; } \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/DispenserAbortJoggingRequest.proto b/Software/PMR/Messages/Diagnostics/DispenserAbortJoggingRequest.proto index 7767ea60f..c2398798c 100644 --- a/Software/PMR/Messages/Diagnostics/DispenserAbortJoggingRequest.proto +++ b/Software/PMR/Messages/Diagnostics/DispenserAbortJoggingRequest.proto @@ -5,5 +5,5 @@ option java_package = "com.twine.tango.pmr.diagnostics"; message DispenserAbortJoggingRequest { - int32 Code = 2; + int32 Index = 2; } \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/DispenserAbortJoggingResponse.proto b/Software/PMR/Messages/Diagnostics/DispenserAbortJoggingResponse.proto index df0fa3fad..5ce30c844 100644 --- a/Software/PMR/Messages/Diagnostics/DispenserAbortJoggingResponse.proto +++ b/Software/PMR/Messages/Diagnostics/DispenserAbortJoggingResponse.proto @@ -5,5 +5,5 @@ option java_package = "com.twine.tango.pmr.diagnostics"; message DispenserAbortJoggingResponse { - int32 Code = 2; + int32 Index = 2; } \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/DispenserHomingRequest.proto b/Software/PMR/Messages/Diagnostics/DispenserHomingRequest.proto index 6263b228c..a55392bc1 100644 --- a/Software/PMR/Messages/Diagnostics/DispenserHomingRequest.proto +++ b/Software/PMR/Messages/Diagnostics/DispenserHomingRequest.proto @@ -5,6 +5,6 @@ option java_package = "com.twine.tango.pmr.diagnostics"; message DispenserHomingRequest { - int32 Code = 1; + int32 Index = 1; double Speed = 2; } \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/DispenserJoggingRequest.proto b/Software/PMR/Messages/Diagnostics/DispenserJoggingRequest.proto index 2eba7cd1b..222157b3a 100644 --- a/Software/PMR/Messages/Diagnostics/DispenserJoggingRequest.proto +++ b/Software/PMR/Messages/Diagnostics/DispenserJoggingRequest.proto @@ -8,6 +8,6 @@ option java_package = "com.twine.tango.pmr.diagnostics"; message DispenserJoggingRequest { MotorDirection Direction = 1; - int32 Code = 2; + int32 Index = 2; double Speed = 3; } \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/MotorAbortHomingRequest.proto b/Software/PMR/Messages/Diagnostics/MotorAbortHomingRequest.proto index a06dde1ef..c31904449 100644 --- a/Software/PMR/Messages/Diagnostics/MotorAbortHomingRequest.proto +++ b/Software/PMR/Messages/Diagnostics/MotorAbortHomingRequest.proto @@ -1,9 +1,11 @@ syntax = "proto3"; +import "HardwareMotorType.proto"; + package Tango.PMR.Diagnostics; option java_package = "com.twine.tango.pmr.diagnostics"; message MotorAbortHomingRequest { - int32 Code = 1; + PMR.Hardware.HardwareMotorType MotorType = 1; } \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/MotorAbortJoggingRequest.proto b/Software/PMR/Messages/Diagnostics/MotorAbortJoggingRequest.proto index d568ea1ca..931a3380d 100644 --- a/Software/PMR/Messages/Diagnostics/MotorAbortJoggingRequest.proto +++ b/Software/PMR/Messages/Diagnostics/MotorAbortJoggingRequest.proto @@ -1,9 +1,11 @@ syntax = "proto3"; +import "HardwareMotorType.proto"; + package Tango.PMR.Diagnostics; option java_package = "com.twine.tango.pmr.diagnostics"; message MotorAbortJoggingRequest { - int32 Code = 2; + PMR.Hardware.HardwareMotorType MotorType = 1; } \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/MotorHomingRequest.proto b/Software/PMR/Messages/Diagnostics/MotorHomingRequest.proto index b5a1fcb9e..8de1bf5d2 100644 --- a/Software/PMR/Messages/Diagnostics/MotorHomingRequest.proto +++ b/Software/PMR/Messages/Diagnostics/MotorHomingRequest.proto @@ -1,10 +1,12 @@ syntax = "proto3"; +import "HardwareMotorType.proto"; + package Tango.PMR.Diagnostics; option java_package = "com.twine.tango.pmr.diagnostics"; message MotorHomingRequest { - int32 Code = 1; + PMR.Hardware.HardwareMotorType MotorType = 1; double Speed = 2; } \ No newline at end of file diff --git a/Software/PMR/Messages/Diagnostics/MotorJoggingRequest.proto b/Software/PMR/Messages/Diagnostics/MotorJoggingRequest.proto index 9a2e0a6c5..40349f919 100644 --- a/Software/PMR/Messages/Diagnostics/MotorJoggingRequest.proto +++ b/Software/PMR/Messages/Diagnostics/MotorJoggingRequest.proto @@ -1,6 +1,7 @@ syntax = "proto3"; import "MotorDirection.proto"; +import "HardwareMotorType.proto"; package Tango.PMR.Diagnostics; option java_package = "com.twine.tango.pmr.diagnostics"; @@ -8,6 +9,6 @@ option java_package = "com.twine.tango.pmr.diagnostics"; message MotorJoggingRequest { MotorDirection Direction = 1; - int32 Code = 2; + PMR.Hardware.HardwareMotorType MotorType = 2; double Speed = 3; } \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index 54a790cbe..0c09850c1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -794,7 +794,7 @@ namespace Tango.MachineStudio.Technician.ViewModels { await MachineOperator.StartMotorJogging(new MotorJoggingRequest() { - Code = item.HardwareMotorType.Code, + MotorType = (PMR.Hardware.HardwareMotorType)item.HardwareMotorType.Code, Direction = MotorDirection.Forward, }); } @@ -802,14 +802,14 @@ namespace Tango.MachineStudio.Technician.ViewModels { await MachineOperator.StopMotorJogging(new MotorAbortJoggingRequest() { - Code = item.HardwareMotorType.Code, + MotorType = (PMR.Hardware.HardwareMotorType)item.HardwareMotorType.Code, }); } else if (action == MotorActionType.BackwardPressed) { await MachineOperator.StartMotorJogging(new MotorJoggingRequest() { - Code = item.HardwareMotorType.Code, + MotorType = (PMR.Hardware.HardwareMotorType)item.HardwareMotorType.Code, Direction = MotorDirection.Backward, }); } @@ -817,7 +817,7 @@ namespace Tango.MachineStudio.Technician.ViewModels { await MachineOperator.StopMotorJogging(new MotorAbortJoggingRequest() { - Code = item.HardwareMotorType.Code, + MotorType = (PMR.Hardware.HardwareMotorType)item.HardwareMotorType.Code, }); } else if (action == MotorActionType.HomingStarted) @@ -828,7 +828,7 @@ namespace Tango.MachineStudio.Technician.ViewModels MachineOperator.StartMotorHoming(new MotorHomingRequest() { - Code = item.HardwareMotorType.Code + MotorType = (PMR.Hardware.HardwareMotorType)item.HardwareMotorType.Code, }) .Subscribe((response) => { @@ -848,7 +848,7 @@ namespace Tango.MachineStudio.Technician.ViewModels { await MachineOperator.StopMotorHoming(new MotorAbortHomingRequest() { - Code = item.HardwareMotorType.Code, + MotorType = (PMR.Hardware.HardwareMotorType)item.HardwareMotorType.Code, }); item.IsHoming = false; @@ -878,7 +878,7 @@ namespace Tango.MachineStudio.Technician.ViewModels { await MachineOperator.StartDispenserJogging(new DispenserJoggingRequest() { - Code = item.TechDispenser.Code, + Index = item.TechDispenser.Code, Direction = MotorDirection.Forward, }); } @@ -886,14 +886,14 @@ namespace Tango.MachineStudio.Technician.ViewModels { await MachineOperator.StopDispenserJogging(new DispenserAbortJoggingRequest() { - Code = item.TechDispenser.Code, + Index = item.TechDispenser.Code, }); } else if (action == MotorActionType.BackwardPressed) { await MachineOperator.StartDispenserJogging(new DispenserJoggingRequest() { - Code = item.TechDispenser.Code, + Index = item.TechDispenser.Code, Direction = MotorDirection.Backward, }); } @@ -901,7 +901,7 @@ namespace Tango.MachineStudio.Technician.ViewModels { await MachineOperator.StopDispenserJogging(new DispenserAbortJoggingRequest() { - Code = item.TechDispenser.Code, + Index = item.TechDispenser.Code, }); } else if (action == MotorActionType.HomingStarted) @@ -912,7 +912,7 @@ namespace Tango.MachineStudio.Technician.ViewModels MachineOperator.StartDispenserHoming(new DispenserHomingRequest() { - Code = item.TechDispenser.Code + Index = item.TechDispenser.Code }) .Subscribe((response) => { @@ -932,7 +932,7 @@ namespace Tango.MachineStudio.Technician.ViewModels { await MachineOperator.StopDispenserHoming(new DispenserAbortHomingRequest() { - Code = item.TechDispenser.Code, + Index = item.TechDispenser.Code, }); item.IsHoming = false; @@ -1044,7 +1044,7 @@ namespace Tango.MachineStudio.Technician.ViewModels { await Task.WhenAll(item.TechMotors.Select(motor => MachineOperator.StartMotorJogging(new MotorJoggingRequest() { - Code = motor.Code, + MotorType = (PMR.Hardware.HardwareMotorType)motor.Code, Direction = MotorDirection.Forward, }))); } @@ -1052,14 +1052,14 @@ namespace Tango.MachineStudio.Technician.ViewModels { await Task.WhenAll(item.TechMotors.Select(motor => MachineOperator.StopMotorJogging(new MotorAbortJoggingRequest() { - Code = motor.Code, + MotorType = (PMR.Hardware.HardwareMotorType)motor.Code, }))); } else if (action == MotorActionType.BackwardPressed) { await Task.WhenAll(item.TechMotors.Select(motor => MachineOperator.StartMotorJogging(new MotorJoggingRequest() { - Code = motor.Code, + MotorType = (PMR.Hardware.HardwareMotorType)motor.Code, Direction = MotorDirection.Backward, }))); } @@ -1067,7 +1067,7 @@ namespace Tango.MachineStudio.Technician.ViewModels { await Task.WhenAll(item.TechMotors.Select(motor => MachineOperator.StopMotorJogging(new MotorAbortJoggingRequest() { - Code = motor.Code, + MotorType = (PMR.Hardware.HardwareMotorType)motor.Code, }))); } //else if (action == MotorActionType.HomingStarted) diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index a3b7690ed..aec6e562b 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -44,8 +44,8 @@ namespace Tango.Emulations.Emulators private StartDiagnosticsRequest _diagnosticsRequest; private bool _cancelJob; - private List _motorJoggingRequestCodes; - private List _motorHomingRequestCodes; + private List _motorJoggingRequestTypes; + private List _motorHomingRequestCodes; private List _dispenserJoggingRequestCodes; private List _dispenserHomingRequestCodes; private double _graphAmplitude; @@ -108,8 +108,8 @@ namespace Tango.Emulations.Emulators EventsStates = MachineEventState.GetAllEventsStates(); _continousResponseTokens = new List(); - _motorJoggingRequestCodes = new List(); - _motorHomingRequestCodes = new List(); + _motorJoggingRequestTypes = new List(); + _motorHomingRequestCodes = new List(); _dispenserJoggingRequestCodes = new List(); _dispenserHomingRequestCodes = new List(); _digitalOutputPinsStates = new List(); @@ -456,12 +456,12 @@ namespace Tango.Emulations.Emulators { var jogRequest = request.Message; - _motorJoggingRequestCodes.Add(jogRequest.Code); + _motorJoggingRequestTypes.Add(jogRequest.MotorType); Task.Factory.StartNew(() => { - while (_motorJoggingRequestCodes.Contains(jogRequest.Code)) + while (_motorJoggingRequestTypes.Contains(jogRequest.MotorType)) { if (jogRequest.Direction == MotorDirection.Forward) { @@ -483,7 +483,7 @@ namespace Tango.Emulations.Emulators private void HandleAbortMotorJoggingRequest(TangoMessage request) { - _motorJoggingRequestCodes.RemoveAll(x => x == request.Message.Code); + _motorJoggingRequestTypes.RemoveAll(x => x == request.Message.MotorType); ResetGraphFactors(); Transporter.SendResponse(new MotorAbortJoggingResponse(), request.Container.Token); } @@ -492,7 +492,7 @@ namespace Tango.Emulations.Emulators { var homeRequest = request.Message; - _motorHomingRequestCodes.Add(homeRequest.Code); + _motorHomingRequestCodes.Add(homeRequest.MotorType); Task.Factory.StartNew(() => { @@ -509,7 +509,7 @@ namespace Tango.Emulations.Emulators Transporter.SendResponse(new MotorHomingResponse() { MaxProgress = 100, Progress = i }, request.Container.Token); - if (!_motorHomingRequestCodes.Contains(homeRequest.Code)) + if (!_motorHomingRequestCodes.Contains(homeRequest.MotorType)) { ResetGraphFactors(); return; @@ -519,14 +519,14 @@ namespace Tango.Emulations.Emulators } Transporter.SendResponse(new MotorHomingResponse() { MaxProgress = 100, Progress = 100 }, request.Container.Token, true); - _motorHomingRequestCodes.Remove(homeRequest.Code); + _motorHomingRequestCodes.Remove(homeRequest.MotorType); ResetGraphFactors(); }); } private void HandleAbortMotorHomingRequest(TangoMessage request) { - _motorHomingRequestCodes.RemoveAll(x => x == request.Message.Code); + _motorHomingRequestCodes.RemoveAll(x => x == request.Message.MotorType); ResetGraphFactors(); Transporter.SendResponse(new MotorAbortHomingResponse(), request.Container.Token); } @@ -535,11 +535,11 @@ namespace Tango.Emulations.Emulators { var jogRequest = request.Message; - _dispenserJoggingRequestCodes.Add(jogRequest.Code); + _dispenserJoggingRequestCodes.Add(jogRequest.Index); Task.Factory.StartNew(() => { - while (_dispenserJoggingRequestCodes.Contains(jogRequest.Code)) + while (_dispenserJoggingRequestCodes.Contains(jogRequest.Index)) { if (jogRequest.Direction == MotorDirection.Forward) { @@ -561,7 +561,7 @@ namespace Tango.Emulations.Emulators private void HandleAbortDispenserJoggingRequest(TangoMessage request) { - _dispenserJoggingRequestCodes.RemoveAll(x => x == request.Message.Code); + _dispenserJoggingRequestCodes.RemoveAll(x => x == request.Message.Index); ResetGraphFactors(); Transporter.SendResponse(new DispenserAbortJoggingResponse(), request.Container.Token); } @@ -570,7 +570,7 @@ namespace Tango.Emulations.Emulators { var homeRequest = request.Message; - _dispenserHomingRequestCodes.Add(homeRequest.Code); + _dispenserHomingRequestCodes.Add(homeRequest.Index); Task.Factory.StartNew(() => { @@ -580,7 +580,7 @@ namespace Tango.Emulations.Emulators { Transporter.SendResponse(new DispenserHomingResponse() { MaxProgress = 100, Progress = i }, request.Container.Token); - if (!_dispenserHomingRequestCodes.Contains(homeRequest.Code)) + if (!_dispenserHomingRequestCodes.Contains(homeRequest.Index)) { ResetGraphFactors(); return; @@ -590,14 +590,14 @@ namespace Tango.Emulations.Emulators } Transporter.SendResponse(new DispenserHomingResponse() { MaxProgress = 100, Progress = 100 }, request.Container.Token, true); - _dispenserHomingRequestCodes.Remove(homeRequest.Code); + _dispenserHomingRequestCodes.Remove(homeRequest.Index); ResetGraphFactors(); }); } private void HandleAbortDispenserHomingRequest(TangoMessage request) { - _dispenserHomingRequestCodes.RemoveAll(x => x == request.Message.Code); + _dispenserHomingRequestCodes.RemoveAll(x => x == request.Message.Index); ResetGraphFactors(); Transporter.SendResponse(new DispenserAbortHomingResponse(), request.Container.Token); } diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortHomingRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortHomingRequest.cs index 492f9bdaf..f76c46c8f 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortHomingRequest.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortHomingRequest.cs @@ -23,13 +23,13 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiFEaXNwZW5zZXJBYm9ydEhvbWluZ1JlcXVlc3QucHJvdG8SFVRhbmdvLlBN", - "Ui5EaWFnbm9zdGljcyIrChtEaXNwZW5zZXJBYm9ydEhvbWluZ1JlcXVlc3QS", - "DAoEQ29kZRgBIAEoBUIhCh9jb20udHdpbmUudGFuZ28ucG1yLmRpYWdub3N0", - "aWNzYgZwcm90bzM=")); + "Ui5EaWFnbm9zdGljcyIsChtEaXNwZW5zZXJBYm9ydEhvbWluZ1JlcXVlc3QS", + "DQoFSW5kZXgYASABKAVCIQofY29tLnR3aW5lLnRhbmdvLnBtci5kaWFnbm9z", + "dGljc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserAbortHomingRequest), global::Tango.PMR.Diagnostics.DispenserAbortHomingRequest.Parser, new[]{ "Code" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserAbortHomingRequest), global::Tango.PMR.Diagnostics.DispenserAbortHomingRequest.Parser, new[]{ "Index" }, null, null, null) })); } #endregion @@ -60,7 +60,7 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DispenserAbortHomingRequest(DispenserAbortHomingRequest other) : this() { - code_ = other.code_; + index_ = other.index_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -68,14 +68,14 @@ namespace Tango.PMR.Diagnostics { return new DispenserAbortHomingRequest(this); } - /// Field number for the "Code" field. - public const int CodeFieldNumber = 1; - private int code_; + /// Field number for the "Index" field. + public const int IndexFieldNumber = 1; + private int index_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Code { - get { return code_; } + public int Index { + get { return index_; } set { - code_ = value; + index_ = value; } } @@ -92,14 +92,14 @@ namespace Tango.PMR.Diagnostics { if (ReferenceEquals(other, this)) { return true; } - if (Code != other.Code) return false; + if (Index != other.Index) return false; return true; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Code != 0) hash ^= Code.GetHashCode(); + if (Index != 0) hash ^= Index.GetHashCode(); return hash; } @@ -110,17 +110,17 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Code != 0) { + if (Index != 0) { output.WriteRawTag(8); - output.WriteInt32(Code); + output.WriteInt32(Index); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Code != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + if (Index != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Index); } return size; } @@ -130,8 +130,8 @@ namespace Tango.PMR.Diagnostics { if (other == null) { return; } - if (other.Code != 0) { - Code = other.Code; + if (other.Index != 0) { + Index = other.Index; } } @@ -144,7 +144,7 @@ namespace Tango.PMR.Diagnostics { input.SkipLastField(); break; case 8: { - Code = input.ReadInt32(); + Index = input.ReadInt32(); break; } } diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortJoggingRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortJoggingRequest.cs index 4f879102b..c17a8a8b2 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortJoggingRequest.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortJoggingRequest.cs @@ -23,13 +23,13 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiJEaXNwZW5zZXJBYm9ydEpvZ2dpbmdSZXF1ZXN0LnByb3RvEhVUYW5nby5Q", - "TVIuRGlhZ25vc3RpY3MiLAocRGlzcGVuc2VyQWJvcnRKb2dnaW5nUmVxdWVz", - "dBIMCgRDb2RlGAIgASgFQiEKH2NvbS50d2luZS50YW5nby5wbXIuZGlhZ25v", - "c3RpY3NiBnByb3RvMw==")); + "TVIuRGlhZ25vc3RpY3MiLQocRGlzcGVuc2VyQWJvcnRKb2dnaW5nUmVxdWVz", + "dBINCgVJbmRleBgCIAEoBUIhCh9jb20udHdpbmUudGFuZ28ucG1yLmRpYWdu", + "b3N0aWNzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserAbortJoggingRequest), global::Tango.PMR.Diagnostics.DispenserAbortJoggingRequest.Parser, new[]{ "Code" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserAbortJoggingRequest), global::Tango.PMR.Diagnostics.DispenserAbortJoggingRequest.Parser, new[]{ "Index" }, null, null, null) })); } #endregion @@ -60,7 +60,7 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DispenserAbortJoggingRequest(DispenserAbortJoggingRequest other) : this() { - code_ = other.code_; + index_ = other.index_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -68,14 +68,14 @@ namespace Tango.PMR.Diagnostics { return new DispenserAbortJoggingRequest(this); } - /// Field number for the "Code" field. - public const int CodeFieldNumber = 2; - private int code_; + /// Field number for the "Index" field. + public const int IndexFieldNumber = 2; + private int index_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Code { - get { return code_; } + public int Index { + get { return index_; } set { - code_ = value; + index_ = value; } } @@ -92,14 +92,14 @@ namespace Tango.PMR.Diagnostics { if (ReferenceEquals(other, this)) { return true; } - if (Code != other.Code) return false; + if (Index != other.Index) return false; return true; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Code != 0) hash ^= Code.GetHashCode(); + if (Index != 0) hash ^= Index.GetHashCode(); return hash; } @@ -110,17 +110,17 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Code != 0) { + if (Index != 0) { output.WriteRawTag(16); - output.WriteInt32(Code); + output.WriteInt32(Index); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Code != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + if (Index != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Index); } return size; } @@ -130,8 +130,8 @@ namespace Tango.PMR.Diagnostics { if (other == null) { return; } - if (other.Code != 0) { - Code = other.Code; + if (other.Index != 0) { + Index = other.Index; } } @@ -144,7 +144,7 @@ namespace Tango.PMR.Diagnostics { input.SkipLastField(); break; case 16: { - Code = input.ReadInt32(); + Index = input.ReadInt32(); break; } } diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortJoggingResponse.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortJoggingResponse.cs index e8e2c8efe..8a254f0e4 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortJoggingResponse.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserAbortJoggingResponse.cs @@ -23,13 +23,13 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiNEaXNwZW5zZXJBYm9ydEpvZ2dpbmdSZXNwb25zZS5wcm90bxIVVGFuZ28u", - "UE1SLkRpYWdub3N0aWNzIi0KHURpc3BlbnNlckFib3J0Sm9nZ2luZ1Jlc3Bv", - "bnNlEgwKBENvZGUYAiABKAVCIQofY29tLnR3aW5lLnRhbmdvLnBtci5kaWFn", - "bm9zdGljc2IGcHJvdG8z")); + "UE1SLkRpYWdub3N0aWNzIi4KHURpc3BlbnNlckFib3J0Sm9nZ2luZ1Jlc3Bv", + "bnNlEg0KBUluZGV4GAIgASgFQiEKH2NvbS50d2luZS50YW5nby5wbXIuZGlh", + "Z25vc3RpY3NiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserAbortJoggingResponse), global::Tango.PMR.Diagnostics.DispenserAbortJoggingResponse.Parser, new[]{ "Code" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserAbortJoggingResponse), global::Tango.PMR.Diagnostics.DispenserAbortJoggingResponse.Parser, new[]{ "Index" }, null, null, null) })); } #endregion @@ -60,7 +60,7 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DispenserAbortJoggingResponse(DispenserAbortJoggingResponse other) : this() { - code_ = other.code_; + index_ = other.index_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -68,14 +68,14 @@ namespace Tango.PMR.Diagnostics { return new DispenserAbortJoggingResponse(this); } - /// Field number for the "Code" field. - public const int CodeFieldNumber = 2; - private int code_; + /// Field number for the "Index" field. + public const int IndexFieldNumber = 2; + private int index_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Code { - get { return code_; } + public int Index { + get { return index_; } set { - code_ = value; + index_ = value; } } @@ -92,14 +92,14 @@ namespace Tango.PMR.Diagnostics { if (ReferenceEquals(other, this)) { return true; } - if (Code != other.Code) return false; + if (Index != other.Index) return false; return true; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Code != 0) hash ^= Code.GetHashCode(); + if (Index != 0) hash ^= Index.GetHashCode(); return hash; } @@ -110,17 +110,17 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Code != 0) { + if (Index != 0) { output.WriteRawTag(16); - output.WriteInt32(Code); + output.WriteInt32(Index); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Code != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + if (Index != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Index); } return size; } @@ -130,8 +130,8 @@ namespace Tango.PMR.Diagnostics { if (other == null) { return; } - if (other.Code != 0) { - Code = other.Code; + if (other.Index != 0) { + Index = other.Index; } } @@ -144,7 +144,7 @@ namespace Tango.PMR.Diagnostics { input.SkipLastField(); break; case 16: { - Code = input.ReadInt32(); + Index = input.ReadInt32(); break; } } diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserHomingRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserHomingRequest.cs index f5b45c802..a760d7ece 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserHomingRequest.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserHomingRequest.cs @@ -23,13 +23,13 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChxEaXNwZW5zZXJIb21pbmdSZXF1ZXN0LnByb3RvEhVUYW5nby5QTVIuRGlh", - "Z25vc3RpY3MiNQoWRGlzcGVuc2VySG9taW5nUmVxdWVzdBIMCgRDb2RlGAEg", - "ASgFEg0KBVNwZWVkGAIgASgBQiEKH2NvbS50d2luZS50YW5nby5wbXIuZGlh", - "Z25vc3RpY3NiBnByb3RvMw==")); + "Z25vc3RpY3MiNgoWRGlzcGVuc2VySG9taW5nUmVxdWVzdBINCgVJbmRleBgB", + "IAEoBRINCgVTcGVlZBgCIAEoAUIhCh9jb20udHdpbmUudGFuZ28ucG1yLmRp", + "YWdub3N0aWNzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserHomingRequest), global::Tango.PMR.Diagnostics.DispenserHomingRequest.Parser, new[]{ "Code", "Speed" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserHomingRequest), global::Tango.PMR.Diagnostics.DispenserHomingRequest.Parser, new[]{ "Index", "Speed" }, null, null, null) })); } #endregion @@ -60,7 +60,7 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DispenserHomingRequest(DispenserHomingRequest other) : this() { - code_ = other.code_; + index_ = other.index_; speed_ = other.speed_; } @@ -69,14 +69,14 @@ namespace Tango.PMR.Diagnostics { return new DispenserHomingRequest(this); } - /// Field number for the "Code" field. - public const int CodeFieldNumber = 1; - private int code_; + /// Field number for the "Index" field. + public const int IndexFieldNumber = 1; + private int index_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Code { - get { return code_; } + public int Index { + get { return index_; } set { - code_ = value; + index_ = value; } } @@ -104,7 +104,7 @@ namespace Tango.PMR.Diagnostics { if (ReferenceEquals(other, this)) { return true; } - if (Code != other.Code) return false; + if (Index != other.Index) return false; if (Speed != other.Speed) return false; return true; } @@ -112,7 +112,7 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Code != 0) hash ^= Code.GetHashCode(); + if (Index != 0) hash ^= Index.GetHashCode(); if (Speed != 0D) hash ^= Speed.GetHashCode(); return hash; } @@ -124,9 +124,9 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Code != 0) { + if (Index != 0) { output.WriteRawTag(8); - output.WriteInt32(Code); + output.WriteInt32(Index); } if (Speed != 0D) { output.WriteRawTag(17); @@ -137,8 +137,8 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Code != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + if (Index != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Index); } if (Speed != 0D) { size += 1 + 8; @@ -151,8 +151,8 @@ namespace Tango.PMR.Diagnostics { if (other == null) { return; } - if (other.Code != 0) { - Code = other.Code; + if (other.Index != 0) { + Index = other.Index; } if (other.Speed != 0D) { Speed = other.Speed; @@ -168,7 +168,7 @@ namespace Tango.PMR.Diagnostics { input.SkipLastField(); break; case 8: { - Code = input.ReadInt32(); + Index = input.ReadInt32(); break; } case 17: { diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserJoggingRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserJoggingRequest.cs index 48894af8d..e4a3a9cb4 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserJoggingRequest.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/DispenserJoggingRequest.cs @@ -23,15 +23,15 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Ch1EaXNwZW5zZXJKb2dnaW5nUmVxdWVzdC5wcm90bxIVVGFuZ28uUE1SLkRp", - "YWdub3N0aWNzGhRNb3RvckRpcmVjdGlvbi5wcm90byJwChdEaXNwZW5zZXJK", + "YWdub3N0aWNzGhRNb3RvckRpcmVjdGlvbi5wcm90byJxChdEaXNwZW5zZXJK", "b2dnaW5nUmVxdWVzdBI4CglEaXJlY3Rpb24YASABKA4yJS5UYW5nby5QTVIu", - "RGlhZ25vc3RpY3MuTW90b3JEaXJlY3Rpb24SDAoEQ29kZRgCIAEoBRINCgVT", - "cGVlZBgDIAEoAUIhCh9jb20udHdpbmUudGFuZ28ucG1yLmRpYWdub3N0aWNz", - "YgZwcm90bzM=")); + "RGlhZ25vc3RpY3MuTW90b3JEaXJlY3Rpb24SDQoFSW5kZXgYAiABKAUSDQoF", + "U3BlZWQYAyABKAFCIQofY29tLnR3aW5lLnRhbmdvLnBtci5kaWFnbm9zdGlj", + "c2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.MotorDirectionReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserJoggingRequest), global::Tango.PMR.Diagnostics.DispenserJoggingRequest.Parser, new[]{ "Direction", "Code", "Speed" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.DispenserJoggingRequest), global::Tango.PMR.Diagnostics.DispenserJoggingRequest.Parser, new[]{ "Direction", "Index", "Speed" }, null, null, null) })); } #endregion @@ -63,7 +63,7 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DispenserJoggingRequest(DispenserJoggingRequest other) : this() { direction_ = other.direction_; - code_ = other.code_; + index_ = other.index_; speed_ = other.speed_; } @@ -83,14 +83,14 @@ namespace Tango.PMR.Diagnostics { } } - /// Field number for the "Code" field. - public const int CodeFieldNumber = 2; - private int code_; + /// Field number for the "Index" field. + public const int IndexFieldNumber = 2; + private int index_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Code { - get { return code_; } + public int Index { + get { return index_; } set { - code_ = value; + index_ = value; } } @@ -119,7 +119,7 @@ namespace Tango.PMR.Diagnostics { return true; } if (Direction != other.Direction) return false; - if (Code != other.Code) return false; + if (Index != other.Index) return false; if (Speed != other.Speed) return false; return true; } @@ -128,7 +128,7 @@ namespace Tango.PMR.Diagnostics { public override int GetHashCode() { int hash = 1; if (Direction != 0) hash ^= Direction.GetHashCode(); - if (Code != 0) hash ^= Code.GetHashCode(); + if (Index != 0) hash ^= Index.GetHashCode(); if (Speed != 0D) hash ^= Speed.GetHashCode(); return hash; } @@ -144,9 +144,9 @@ namespace Tango.PMR.Diagnostics { output.WriteRawTag(8); output.WriteEnum((int) Direction); } - if (Code != 0) { + if (Index != 0) { output.WriteRawTag(16); - output.WriteInt32(Code); + output.WriteInt32(Index); } if (Speed != 0D) { output.WriteRawTag(25); @@ -160,8 +160,8 @@ namespace Tango.PMR.Diagnostics { if (Direction != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Direction); } - if (Code != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + if (Index != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Index); } if (Speed != 0D) { size += 1 + 8; @@ -177,8 +177,8 @@ namespace Tango.PMR.Diagnostics { if (other.Direction != 0) { Direction = other.Direction; } - if (other.Code != 0) { - Code = other.Code; + if (other.Index != 0) { + Index = other.Index; } if (other.Speed != 0D) { Speed = other.Speed; @@ -198,7 +198,7 @@ namespace Tango.PMR.Diagnostics { break; } case 16: { - Code = input.ReadInt32(); + Index = input.ReadInt32(); break; } case 25: { diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorAbortHomingRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorAbortHomingRequest.cs index d5385333c..08a07c4bc 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorAbortHomingRequest.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorAbortHomingRequest.cs @@ -23,13 +23,14 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Ch1Nb3RvckFib3J0SG9taW5nUmVxdWVzdC5wcm90bxIVVGFuZ28uUE1SLkRp", - "YWdub3N0aWNzIicKF01vdG9yQWJvcnRIb21pbmdSZXF1ZXN0EgwKBENvZGUY", - "ASABKAVCIQofY29tLnR3aW5lLnRhbmdvLnBtci5kaWFnbm9zdGljc2IGcHJv", - "dG8z")); + "YWdub3N0aWNzGhdIYXJkd2FyZU1vdG9yVHlwZS5wcm90byJTChdNb3RvckFi", + "b3J0SG9taW5nUmVxdWVzdBI4CglNb3RvclR5cGUYASABKA4yJS5UYW5nby5Q", + "TVIuSGFyZHdhcmUuSGFyZHdhcmVNb3RvclR5cGVCIQofY29tLnR3aW5lLnRh", + "bmdvLnBtci5kaWFnbm9zdGljc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, + new pbr::FileDescriptor[] { global::Tango.PMR.Hardware.HardwareMotorTypeReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.MotorAbortHomingRequest), global::Tango.PMR.Diagnostics.MotorAbortHomingRequest.Parser, new[]{ "Code" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.MotorAbortHomingRequest), global::Tango.PMR.Diagnostics.MotorAbortHomingRequest.Parser, new[]{ "MotorType" }, null, null, null) })); } #endregion @@ -60,7 +61,7 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MotorAbortHomingRequest(MotorAbortHomingRequest other) : this() { - code_ = other.code_; + motorType_ = other.motorType_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -68,14 +69,14 @@ namespace Tango.PMR.Diagnostics { return new MotorAbortHomingRequest(this); } - /// Field number for the "Code" field. - public const int CodeFieldNumber = 1; - private int code_; + /// Field number for the "MotorType" field. + public const int MotorTypeFieldNumber = 1; + private global::Tango.PMR.Hardware.HardwareMotorType motorType_ = 0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Code { - get { return code_; } + public global::Tango.PMR.Hardware.HardwareMotorType MotorType { + get { return motorType_; } set { - code_ = value; + motorType_ = value; } } @@ -92,14 +93,14 @@ namespace Tango.PMR.Diagnostics { if (ReferenceEquals(other, this)) { return true; } - if (Code != other.Code) return false; + if (MotorType != other.MotorType) return false; return true; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Code != 0) hash ^= Code.GetHashCode(); + if (MotorType != 0) hash ^= MotorType.GetHashCode(); return hash; } @@ -110,17 +111,17 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Code != 0) { + if (MotorType != 0) { output.WriteRawTag(8); - output.WriteInt32(Code); + output.WriteEnum((int) MotorType); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Code != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + if (MotorType != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) MotorType); } return size; } @@ -130,8 +131,8 @@ namespace Tango.PMR.Diagnostics { if (other == null) { return; } - if (other.Code != 0) { - Code = other.Code; + if (other.MotorType != 0) { + MotorType = other.MotorType; } } @@ -144,7 +145,7 @@ namespace Tango.PMR.Diagnostics { input.SkipLastField(); break; case 8: { - Code = input.ReadInt32(); + motorType_ = (global::Tango.PMR.Hardware.HardwareMotorType) input.ReadEnum(); break; } } diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorAbortJoggingRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorAbortJoggingRequest.cs index cf9f015d3..889a29e5f 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorAbortJoggingRequest.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorAbortJoggingRequest.cs @@ -23,13 +23,14 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Ch5Nb3RvckFib3J0Sm9nZ2luZ1JlcXVlc3QucHJvdG8SFVRhbmdvLlBNUi5E", - "aWFnbm9zdGljcyIoChhNb3RvckFib3J0Sm9nZ2luZ1JlcXVlc3QSDAoEQ29k", - "ZRgCIAEoBUIhCh9jb20udHdpbmUudGFuZ28ucG1yLmRpYWdub3N0aWNzYgZw", - "cm90bzM=")); + "aWFnbm9zdGljcxoXSGFyZHdhcmVNb3RvclR5cGUucHJvdG8iVAoYTW90b3JB", + "Ym9ydEpvZ2dpbmdSZXF1ZXN0EjgKCU1vdG9yVHlwZRgBIAEoDjIlLlRhbmdv", + "LlBNUi5IYXJkd2FyZS5IYXJkd2FyZU1vdG9yVHlwZUIhCh9jb20udHdpbmUu", + "dGFuZ28ucG1yLmRpYWdub3N0aWNzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, + new pbr::FileDescriptor[] { global::Tango.PMR.Hardware.HardwareMotorTypeReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.MotorAbortJoggingRequest), global::Tango.PMR.Diagnostics.MotorAbortJoggingRequest.Parser, new[]{ "Code" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.MotorAbortJoggingRequest), global::Tango.PMR.Diagnostics.MotorAbortJoggingRequest.Parser, new[]{ "MotorType" }, null, null, null) })); } #endregion @@ -60,7 +61,7 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MotorAbortJoggingRequest(MotorAbortJoggingRequest other) : this() { - code_ = other.code_; + motorType_ = other.motorType_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -68,14 +69,14 @@ namespace Tango.PMR.Diagnostics { return new MotorAbortJoggingRequest(this); } - /// Field number for the "Code" field. - public const int CodeFieldNumber = 2; - private int code_; + /// Field number for the "MotorType" field. + public const int MotorTypeFieldNumber = 1; + private global::Tango.PMR.Hardware.HardwareMotorType motorType_ = 0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Code { - get { return code_; } + public global::Tango.PMR.Hardware.HardwareMotorType MotorType { + get { return motorType_; } set { - code_ = value; + motorType_ = value; } } @@ -92,14 +93,14 @@ namespace Tango.PMR.Diagnostics { if (ReferenceEquals(other, this)) { return true; } - if (Code != other.Code) return false; + if (MotorType != other.MotorType) return false; return true; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Code != 0) hash ^= Code.GetHashCode(); + if (MotorType != 0) hash ^= MotorType.GetHashCode(); return hash; } @@ -110,17 +111,17 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Code != 0) { - output.WriteRawTag(16); - output.WriteInt32(Code); + if (MotorType != 0) { + output.WriteRawTag(8); + output.WriteEnum((int) MotorType); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Code != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + if (MotorType != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) MotorType); } return size; } @@ -130,8 +131,8 @@ namespace Tango.PMR.Diagnostics { if (other == null) { return; } - if (other.Code != 0) { - Code = other.Code; + if (other.MotorType != 0) { + MotorType = other.MotorType; } } @@ -143,8 +144,8 @@ namespace Tango.PMR.Diagnostics { default: input.SkipLastField(); break; - case 16: { - Code = input.ReadInt32(); + case 8: { + motorType_ = (global::Tango.PMR.Hardware.HardwareMotorType) input.ReadEnum(); break; } } diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorHomingRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorHomingRequest.cs index 5044fa2ed..b3bd7765a 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorHomingRequest.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorHomingRequest.cs @@ -23,13 +23,14 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChhNb3RvckhvbWluZ1JlcXVlc3QucHJvdG8SFVRhbmdvLlBNUi5EaWFnbm9z", - "dGljcyIxChJNb3RvckhvbWluZ1JlcXVlc3QSDAoEQ29kZRgBIAEoBRINCgVT", - "cGVlZBgCIAEoAUIhCh9jb20udHdpbmUudGFuZ28ucG1yLmRpYWdub3N0aWNz", - "YgZwcm90bzM=")); + "dGljcxoXSGFyZHdhcmVNb3RvclR5cGUucHJvdG8iXQoSTW90b3JIb21pbmdS", + "ZXF1ZXN0EjgKCU1vdG9yVHlwZRgBIAEoDjIlLlRhbmdvLlBNUi5IYXJkd2Fy", + "ZS5IYXJkd2FyZU1vdG9yVHlwZRINCgVTcGVlZBgCIAEoAUIhCh9jb20udHdp", + "bmUudGFuZ28ucG1yLmRpYWdub3N0aWNzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, + new pbr::FileDescriptor[] { global::Tango.PMR.Hardware.HardwareMotorTypeReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.MotorHomingRequest), global::Tango.PMR.Diagnostics.MotorHomingRequest.Parser, new[]{ "Code", "Speed" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.MotorHomingRequest), global::Tango.PMR.Diagnostics.MotorHomingRequest.Parser, new[]{ "MotorType", "Speed" }, null, null, null) })); } #endregion @@ -60,7 +61,7 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MotorHomingRequest(MotorHomingRequest other) : this() { - code_ = other.code_; + motorType_ = other.motorType_; speed_ = other.speed_; } @@ -69,14 +70,14 @@ namespace Tango.PMR.Diagnostics { return new MotorHomingRequest(this); } - /// Field number for the "Code" field. - public const int CodeFieldNumber = 1; - private int code_; + /// Field number for the "MotorType" field. + public const int MotorTypeFieldNumber = 1; + private global::Tango.PMR.Hardware.HardwareMotorType motorType_ = 0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Code { - get { return code_; } + public global::Tango.PMR.Hardware.HardwareMotorType MotorType { + get { return motorType_; } set { - code_ = value; + motorType_ = value; } } @@ -104,7 +105,7 @@ namespace Tango.PMR.Diagnostics { if (ReferenceEquals(other, this)) { return true; } - if (Code != other.Code) return false; + if (MotorType != other.MotorType) return false; if (Speed != other.Speed) return false; return true; } @@ -112,7 +113,7 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; - if (Code != 0) hash ^= Code.GetHashCode(); + if (MotorType != 0) hash ^= MotorType.GetHashCode(); if (Speed != 0D) hash ^= Speed.GetHashCode(); return hash; } @@ -124,9 +125,9 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Code != 0) { + if (MotorType != 0) { output.WriteRawTag(8); - output.WriteInt32(Code); + output.WriteEnum((int) MotorType); } if (Speed != 0D) { output.WriteRawTag(17); @@ -137,8 +138,8 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; - if (Code != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + if (MotorType != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) MotorType); } if (Speed != 0D) { size += 1 + 8; @@ -151,8 +152,8 @@ namespace Tango.PMR.Diagnostics { if (other == null) { return; } - if (other.Code != 0) { - Code = other.Code; + if (other.MotorType != 0) { + MotorType = other.MotorType; } if (other.Speed != 0D) { Speed = other.Speed; @@ -168,7 +169,7 @@ namespace Tango.PMR.Diagnostics { input.SkipLastField(); break; case 8: { - Code = input.ReadInt32(); + motorType_ = (global::Tango.PMR.Hardware.HardwareMotorType) input.ReadEnum(); break; } case 17: { diff --git a/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorJoggingRequest.cs b/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorJoggingRequest.cs index 99f1a56c6..b25253961 100644 --- a/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorJoggingRequest.cs +++ b/Software/Visual_Studio/Tango.PMR/Diagnostics/MotorJoggingRequest.cs @@ -23,14 +23,16 @@ namespace Tango.PMR.Diagnostics { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChlNb3RvckpvZ2dpbmdSZXF1ZXN0LnByb3RvEhVUYW5nby5QTVIuRGlhZ25v", - "c3RpY3MaFE1vdG9yRGlyZWN0aW9uLnByb3RvImwKE01vdG9ySm9nZ2luZ1Jl", - "cXVlc3QSOAoJRGlyZWN0aW9uGAEgASgOMiUuVGFuZ28uUE1SLkRpYWdub3N0", - "aWNzLk1vdG9yRGlyZWN0aW9uEgwKBENvZGUYAiABKAUSDQoFU3BlZWQYAyAB", - "KAFCIQofY29tLnR3aW5lLnRhbmdvLnBtci5kaWFnbm9zdGljc2IGcHJvdG8z")); + "c3RpY3MaFE1vdG9yRGlyZWN0aW9uLnByb3RvGhdIYXJkd2FyZU1vdG9yVHlw", + "ZS5wcm90byKYAQoTTW90b3JKb2dnaW5nUmVxdWVzdBI4CglEaXJlY3Rpb24Y", + "ASABKA4yJS5UYW5nby5QTVIuRGlhZ25vc3RpY3MuTW90b3JEaXJlY3Rpb24S", + "OAoJTW90b3JUeXBlGAIgASgOMiUuVGFuZ28uUE1SLkhhcmR3YXJlLkhhcmR3", + "YXJlTW90b3JUeXBlEg0KBVNwZWVkGAMgASgBQiEKH2NvbS50d2luZS50YW5n", + "by5wbXIuZGlhZ25vc3RpY3NiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.MotorDirectionReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::Tango.PMR.Diagnostics.MotorDirectionReflection.Descriptor, global::Tango.PMR.Hardware.HardwareMotorTypeReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.MotorJoggingRequest), global::Tango.PMR.Diagnostics.MotorJoggingRequest.Parser, new[]{ "Direction", "Code", "Speed" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Diagnostics.MotorJoggingRequest), global::Tango.PMR.Diagnostics.MotorJoggingRequest.Parser, new[]{ "Direction", "MotorType", "Speed" }, null, null, null) })); } #endregion @@ -62,7 +64,7 @@ namespace Tango.PMR.Diagnostics { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MotorJoggingRequest(MotorJoggingRequest other) : this() { direction_ = other.direction_; - code_ = other.code_; + motorType_ = other.motorType_; speed_ = other.speed_; } @@ -82,14 +84,14 @@ namespace Tango.PMR.Diagnostics { } } - /// Field number for the "Code" field. - public const int CodeFieldNumber = 2; - private int code_; + /// Field number for the "MotorType" field. + public const int MotorTypeFieldNumber = 2; + private global::Tango.PMR.Hardware.HardwareMotorType motorType_ = 0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Code { - get { return code_; } + public global::Tango.PMR.Hardware.HardwareMotorType MotorType { + get { return motorType_; } set { - code_ = value; + motorType_ = value; } } @@ -118,7 +120,7 @@ namespace Tango.PMR.Diagnostics { return true; } if (Direction != other.Direction) return false; - if (Code != other.Code) return false; + if (MotorType != other.MotorType) return false; if (Speed != other.Speed) return false; return true; } @@ -127,7 +129,7 @@ namespace Tango.PMR.Diagnostics { public override int GetHashCode() { int hash = 1; if (Direction != 0) hash ^= Direction.GetHashCode(); - if (Code != 0) hash ^= Code.GetHashCode(); + if (MotorType != 0) hash ^= MotorType.GetHashCode(); if (Speed != 0D) hash ^= Speed.GetHashCode(); return hash; } @@ -143,9 +145,9 @@ namespace Tango.PMR.Diagnostics { output.WriteRawTag(8); output.WriteEnum((int) Direction); } - if (Code != 0) { + if (MotorType != 0) { output.WriteRawTag(16); - output.WriteInt32(Code); + output.WriteEnum((int) MotorType); } if (Speed != 0D) { output.WriteRawTag(25); @@ -159,8 +161,8 @@ namespace Tango.PMR.Diagnostics { if (Direction != 0) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Direction); } - if (Code != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); + if (MotorType != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) MotorType); } if (Speed != 0D) { size += 1 + 8; @@ -176,8 +178,8 @@ namespace Tango.PMR.Diagnostics { if (other.Direction != 0) { Direction = other.Direction; } - if (other.Code != 0) { - Code = other.Code; + if (other.MotorType != 0) { + MotorType = other.MotorType; } if (other.Speed != 0D) { Speed = other.Speed; @@ -197,7 +199,7 @@ namespace Tango.PMR.Diagnostics { break; } case 16: { - Code = input.ReadInt32(); + motorType_ = (global::Tango.PMR.Hardware.HardwareMotorType) input.ReadEnum(); break; } case 25: { diff --git a/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs b/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs index e021b66e4..c748cb5d3 100644 --- a/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs +++ b/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs @@ -12,7 +12,7 @@ using Tango.PMR.Common; /// /// Contains PMR extension methods. /// - public static class ExtensionMethods + public static class ExtensionMethods { /// /// Gets the protobuf attribute value from the message type. diff --git a/Software/Visual_Studio/Tango.Protobuf/Compilers/CCompiler.cs b/Software/Visual_Studio/Tango.Protobuf/Compilers/CCompiler.cs index 1a8dc632f..91f8d1502 100644 --- a/Software/Visual_Studio/Tango.Protobuf/Compilers/CCompiler.cs +++ b/Software/Visual_Studio/Tango.Protobuf/Compilers/CCompiler.cs @@ -67,13 +67,29 @@ namespace Tango.Protobuf.Compilers { String str = File.ReadAllText(file); - foreach (String dir in directories.Select(x => Path.GetFileName(x))) + var lines = str.ToLines(); + + lines.RemoveAll(x => x.Contains("package ")); + + for (int i = 0; i < lines.Count; i++) { - str = str.Replace(dir + ".", ""); + if (!lines[i].Contains("import ") || lines[i].StartsWith("//")) + { + string[] wordsAndComments = lines[i].Split('/'); + + string lineWords = wordsAndComments.FirstOrDefault(); + + string[] words = lineWords.Split(' '); + + for (int j = 0; j < words.Length; j++) + { + words[j] = words[j].Split('.').LastOrDefault(); + } + + lines[i] = String.Join(" ", words); + } } - var lines = str.ToLines(); - lines.RemoveAll(x => x.Contains("package ")); str = String.Join(Environment.NewLine, lines); File.WriteAllText(file, str); } -- cgit v1.3.1 From 1e3777f0813b2ac26ae0b52e89c171955a949563 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 29 Jul 2018 09:54:44 +0300 Subject: Moved external bridge classes to ExternalBridge namespace. --- .../ViewModels/MainViewVM.cs | 2 +- .../ViewModels/MainViewVM.cs | 2 +- .../ViewModels/DirectSynchronizationViewVM.cs | 2 +- .../ViewModels/MachineTechViewVM.cs | 2 +- .../Diagnostics/DefaultDiagnosticsFrameProvider.cs | 2 +- .../EventLogging/DefaultEventLogger.cs | 2 +- .../Messages/MachineConnectionChangedMessage.cs | 2 +- .../StudioApplication/IStudioApplicationManager.cs | 2 +- .../DefaultStudioApplicationManager.cs | 2 +- .../Tango.MachineStudio.UI/ViewModelLocator.cs | 2 +- .../ViewModels/MachineConnectionViewVM.cs | 2 +- .../ViewModels/MainViewVM.cs | 2 +- .../Views/ConnectedMachineView.xaml | 2 +- .../Views/MachineConnectionView.xaml | 2 +- .../Views/ReportIssueView.xaml | 2 +- .../Views/ResolvedIssuesView.xaml | 2 +- .../Application/IPPCApplicationManager.cs | 2 +- .../Connection/DefaultMachineProvider.cs | 2 +- .../Diagnostics/DefaultDiagnosticsFrameProvider.cs | 2 +- .../EventLogging/DefaultEventLogger.cs | 2 +- .../PPC/Tango.PPC.UI/ViewModelLocator.cs | 2 +- .../IExternalBridgeClientExtensions.cs | 2 +- .../ExternalBridge/ExternalBridgeScanner.cs | 166 +++++++++++++++++++++ .../ExternalBridge/ExternalBridgeService.cs | 119 +++++++++++++++ .../ExternalBridge/ExternalBridgeTcpClient.cs | 103 +++++++++++++ .../ExternalBridge/ExternalBridgeUsbClient.cs | 114 ++++++++++++++ .../ExternalBridge/IExternalBridgeClient.cs | 30 ++++ .../ExternalBridge/IExternalBridgeSecureClient.cs | 22 +++ .../ExternalBridge/IExternalBridgeService.cs | 21 +++ .../Services/ExternalBridgeScanner.cs | 166 --------------------- .../Services/ExternalBridgeService.cs | 119 --------------- .../Services/ExternalBridgeTcpClient.cs | 103 ------------- .../Services/ExternalBridgeUsbClient.cs | 114 -------------- .../Services/IExternalBridgeClient.cs | 30 ---- .../Services/IExternalBridgeSecureClient.cs | 22 --- .../Services/IExternalBridgeService.cs | 21 --- .../Tango.Integration/Tango.Integration.csproj | 14 +- 37 files changed, 604 insertions(+), 604 deletions(-) create mode 100644 Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeScanner.cs create mode 100644 Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs create mode 100644 Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs create mode 100644 Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeUsbClient.cs create mode 100644 Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeClient.cs create mode 100644 Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeSecureClient.cs create mode 100644 Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeService.cs delete mode 100644 Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs delete mode 100644 Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeService.cs delete mode 100644 Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeTcpClient.cs delete mode 100644 Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeUsbClient.cs delete mode 100644 Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeClient.cs delete mode 100644 Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeSecureClient.cs delete mode 100644 Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeService.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs index 5bd6ff809..9876dca9e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs @@ -14,7 +14,7 @@ using Tango.Core.Commands; using Tango.Core.Helpers; using Tango.Integration.Diagnostics; using Tango.Integration.Operation; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; using Tango.MachineStudio.Common.Diagnostics; using Tango.MachineStudio.Common.EventLogging; using Tango.MachineStudio.Common.Notifications; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 0a033b118..a58757633 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -10,7 +10,7 @@ using System.Windows.Media; using Tango.Core.Commands; using Tango.BL.Entities; using Tango.Integration.Operation; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; using Tango.Logging; using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.Controls; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/DirectSynchronizationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/DirectSynchronizationViewVM.cs index b2175b46c..a09e698e3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/DirectSynchronizationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/DirectSynchronizationViewVM.cs @@ -11,7 +11,7 @@ using System.Threading.Tasks; using Tango.Core.Commands; using Tango.Core.Helpers; using Tango.BL.Entities; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Common.StudioApplication; using Tango.MachineStudio.Synchronization.Navigation; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index 0c09850c1..d403223ec 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -25,7 +25,7 @@ using Tango.MachineStudio.Technician.TechItems; using Tango.PMR.Diagnostics; using Tango.Settings; using Tango.SharedUI; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; using Tango.BL.Enumerations; using Tango.BL; using Tango.MachineStudio.Common.EventLogging; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs index d34ef4b96..957648536 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs @@ -5,7 +5,7 @@ using System.Text; using System.Threading.Tasks; using Tango.Core; using Tango.Integration.Operation; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; using Tango.MachineStudio.Common.StudioApplication; using Tango.PMR.Diagnostics; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs index b33b771ae..c5b9c63cb 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs @@ -10,7 +10,7 @@ using Tango.BL; using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Core; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; using Tango.Logging; using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.Diagnostics; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Messages/MachineConnectionChangedMessage.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Messages/MachineConnectionChangedMessage.cs index 90820ed47..af36f2edf 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Messages/MachineConnectionChangedMessage.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Messages/MachineConnectionChangedMessage.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; namespace Tango.MachineStudio.Common.Messages { diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs index 00e67ff3b..464f932f6 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; namespace Tango.MachineStudio.Common.StudioApplication { diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index debeccded..d6a832c8a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -15,7 +15,7 @@ using Tango.MachineStudio.Common.Modules; using Tango.MachineStudio.Common; using Tango.Settings; using System.Windows; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; using Tango.MachineStudio.Common.EventLogging; using Tango.BL.Enumerations; using Tango.Core.DI; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index 8a5ce3d8b..2c816eb6c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -1,6 +1,6 @@ using System; using Tango.Core.DI; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; using Tango.Logging; using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.Diagnostics; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs index 3cd3fb5f9..60447f37a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core.Commands; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; using Tango.MachineStudio.Common.Notifications; using Tango.SharedUI; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index 278926de9..d209e3f27 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -13,7 +13,7 @@ using System.Windows.Media; using Tango.BL.Entities; using Tango.Core.Commands; using Tango.Core.DI; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; using Tango.Logging; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Authentication; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml index 39c42392d..bb8b65f6a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml @@ -4,7 +4,7 @@ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:integration="clr-namespace:Tango.Integration.Services;assembly=Tango.Integration" + xmlns:integration="clr-namespace:Tango.Integration.ExternalBridge;assembly=Tango.Integration" xmlns:integ="clr-namespace:Tango.Integration.Operation;assembly=Tango.Integration" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml index 6f0a74805..3a8baf7e5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml @@ -5,7 +5,7 @@ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:integration="clr-namespace:Tango.Integration.Services;assembly=Tango.Integration" + xmlns:integration="clr-namespace:Tango.Integration.ExternalBridge;assembly=Tango.Integration" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml index 37cd0b793..2a6228eda 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml @@ -6,7 +6,7 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" - xmlns:integration="clr-namespace:Tango.Integration.Services;assembly=Tango.Integration" + xmlns:integration="clr-namespace:Tango.Integration.ExternalBridge;assembly=Tango.Integration" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.MachineStudio.UI.ViewModels" xmlns:tfs="clr-namespace:Tango.TFS;assembly=Tango.TFS" diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml index 4fb457f87..3b5affbbf 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ResolvedIssuesView.xaml @@ -6,7 +6,7 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" - xmlns:integration="clr-namespace:Tango.Integration.Services;assembly=Tango.Integration" + xmlns:integration="clr-namespace:Tango.Integration.ExternalBridge;assembly=Tango.Integration" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.MachineStudio.UI.ViewModels" xmlns:tfs="clr-namespace:Tango.TFS;assembly=Tango.TFS" diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs index 1ac70c650..50bceb3e1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using System.Windows; using Tango.BL.Entities; using Tango.Integration.Operation; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; namespace Tango.PPC.Common.Application { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs index 160029222..8b0098eb8 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs @@ -7,7 +7,7 @@ using Tango.BL; using Tango.BL.Entities; using Tango.Core; using Tango.Integration.Operation; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; using Tango.PMR.Connection; using Tango.Transport.Adapters; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs index 28255820c..bff64feb7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs @@ -5,7 +5,7 @@ using System.Text; using System.Threading.Tasks; using Tango.Core; using Tango.Integration.Operation; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; using Tango.PMR.Diagnostics; using Tango.PPC.Common.Application; using Tango.PPC.Common.Connection; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs index da904b74e..d981723be 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs @@ -10,7 +10,7 @@ using Tango.BL; using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Core; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; using Tango.PMR.Diagnostics; using Tango.Integration.Operation; using Tango.PPC.Common.Application; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs index d396920ab..a56b9bd4c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs @@ -1,7 +1,7 @@ using System; using System.Windows; using Tango.Core.DI; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; using Tango.Logging; using Tango.PPC.Common.Application; using Tango.PPC.Common.Authentication; diff --git a/Software/Visual_Studio/Tango.Integration/ExtensionMethods/IExternalBridgeClientExtensions.cs b/Software/Visual_Studio/Tango.Integration/ExtensionMethods/IExternalBridgeClientExtensions.cs index 62a7c1523..3e9546983 100644 --- a/Software/Visual_Studio/Tango.Integration/ExtensionMethods/IExternalBridgeClientExtensions.cs +++ b/Software/Visual_Studio/Tango.Integration/ExtensionMethods/IExternalBridgeClientExtensions.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; /// /// Contains extension methods. diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeScanner.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeScanner.cs new file mode 100644 index 000000000..f9d103de2 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeScanner.cs @@ -0,0 +1,166 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO.Ports; +using System.Linq; +using System.Management; +using System.Net; +using System.Net.NetworkInformation; +using System.Net.Sockets; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Core.Helpers; +using Tango.Logging; +using Tango.PMR; +using Tango.PMR.Common; +using Tango.PMR.Integration; +using Tango.Settings; +using Tango.Transport.Adapters; + +namespace Tango.Integration.ExternalBridge +{ + /// + /// Scans for available machines on the local area network and physically connected via USB. + /// + /// + public class ExternalBridgeScanner : ExtendedObject + { + private Thread _tcpDiscoveryThread; + private Thread _usbDiscoveryThread; + private UdpClient _server; + private IntegrationSettings _settings; + + private ObservableCollection _availableMachines; + /// + /// Gets the available machines. + /// + public ObservableCollection AvailableMachines + { + get { return _availableMachines; } + private set { _availableMachines = value; RaisePropertyChangedAuto(); } + } + + private bool _isStarted; + /// + /// Gets or sets a value indicating whether this instance is started. + /// + public bool IsStarted + { + get { return _isStarted; } + private set { _isStarted = value; RaisePropertyChangedAuto(); } + } + + /// + /// Initializes a new instance of the class. + /// + public ExternalBridgeScanner() + { + _settings = SettingsManager.Default.GetOrCreate(); + _server = new UdpClient(_settings.ExternalBridgeServiceDiscoveryPort); + AvailableMachines = new ObservableCollection(); + } + + /// + /// Start scanning. (Results will be available through ). + /// + public void Start() + { + if (!IsStarted) + { + LogManager.Log("External bridge scanner started..."); + + IsStarted = true; + + _tcpDiscoveryThread = new Thread(TcpDiscoveryThreadMethod); + _tcpDiscoveryThread.IsBackground = true; + _tcpDiscoveryThread.Start(); + + _usbDiscoveryThread = new Thread(UsbDiscoveryThreadMethod); + _usbDiscoveryThread.IsBackground = true; + _usbDiscoveryThread.Start(); + } + } + + /// + /// Stops this instance. + /// + public void Stop() + { + if (IsStarted) + { + IsStarted = false; + LogManager.Log("External bridge scanner stopped."); + } + } + + /// + /// USB discovery thread method. + /// + private void UsbDiscoveryThreadMethod() + { + while (IsStarted) + { + foreach (var device in Transport.Components.ComPortEnumerator.EnumerateComPorts()) + { + if (device.Description.Contains(_settings.EmbeddedDeviceName) || !_settings.FilterExternalBridgeUsbMachines) + { + if (!AvailableMachines.OfType().ToList().Exists(x => x.ComPort == device.Port)) + { + LogManager.Log("Found a new machine via USB " + device.Description); + ThreadsHelper.InvokeUINow(() => + { + AvailableMachines.Add(new ExternalBridgeUsbClient(device.Port, device.Description, _settings.EmbeddedSerialBaudRate)); + }); + } + } + } + + Thread.Sleep(2000); + } + } + + /// + /// TCP discovery thread method. + /// + private void TcpDiscoveryThreadMethod() + { + while (IsStarted) + { + var ClientEp = new IPEndPoint(IPAddress.Any, 0); + var ClientRequestData = _server.Receive(ref ClientEp); + + ExternalBridgeUdpDiscoveryPacket packet = ExternalBridgeUdpDiscoveryPacket.Parser.ParseFrom(ClientRequestData); + + if (!AvailableMachines.OfType().ToList().Exists(x => x.SerialNumber == packet.SerialNumber)) + { + ExternalBridgeTcpClient newMachine = new ExternalBridgeTcpClient(packet.SerialNumber, ClientEp.Address.ToString()); + + LogManager.Log("Found a new machine via TCP " + newMachine.SerialNumber); + + ThreadsHelper.InvokeUINow(() => + { + AvailableMachines.Add(newMachine); + }); + } + + Thread.Sleep(1000); + } + } + + /// + /// Handles the available machines component state changed event. + /// + /// The sender. + /// The e. + private void Client_StateChanged(object sender, Transport.TransportComponentState e) + { + if (e == Transport.TransportComponentState.Failed || e == Transport.TransportComponentState.Disposed) + { + LogManager.Log("External bridge client failed or disposed. Removing from available machines..."); + AvailableMachines.Remove(sender as IExternalBridgeClient); + } + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs new file mode 100644 index 000000000..8408d33af --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Google.Protobuf; +using Tango.BL.Entities; +using Tango.Integration.Operation; +using Tango.PMR; +using Tango.PMR.Common; +using Tango.Transport; +using Tango.Transport.Transporters; +using Tango.PMR.Integration; +using Tango.Transport.Discovery; +using Tango.Transport.Servers; +using Tango.Transport.Adapters; + +namespace Tango.Integration.ExternalBridge +{ + public class ExternalBridgeService : BasicTransporter, IExternalBridgeService + { + private UdpDiscoveryService _discoverySevice; + private TcpServer _tcpServer; + + public IMachineOperator MachineOperator { get; private set; } + + public Machine Machine { get; private set; } + + public bool IsStarted { get; private set; } + + public ExternalBridgeService(IMachineOperator machineOperator, Machine machine) + { + Machine = machine; + MachineOperator = machineOperator; + + _tcpServer = new TcpServer(1984); + _tcpServer.ClientConnected += _tcpServer_ClientConnected; + + _discoverySevice = new UdpDiscoveryService(8888, new ExternalBridgeUdpDiscoveryPacket() + { + SerialNumber = Machine.SerialNumber, + }); + } + + private async void _tcpServer_ClientConnected(object sender, ClientConnectedEventArgs e) + { + Adapter = new TcpTransportAdapter(e.Socket); + await Connect(); + } + + public void Start() + { + if (!IsStarted) + { + _tcpServer.Start(); + _discoverySevice.Start(); + + IsStarted = true; + } + } + + public void Stop() + { + if (IsStarted) + { + _tcpServer.Stop(); + _discoverySevice.Stop(); + + IsStarted = false; + } + } + + protected async override void OnRequestReceived(MessageContainer container) + { + base.OnRequestReceived(container); + + if (container.Type == MessageType.ExternalClientLoginRequest) + { + var request = MessageFactory.ParseTangoMessageFromContainer(container); + + var response = new ExternalClientLoginResponse(); + response.Authenticated = false; + + if (request.Message.Password == "1234") + { + response.Authenticated = true; + response.SerialNumber = Machine.SerialNumber; + } + + await SendResponse(response, container.Token); + } + else + { + MachineOperator.RequestTimeout = TimeSpan.FromSeconds(60); + + if (!container.Continuous) + { + var response = await MachineOperator.SendRequest(container); + await SendResponse(response); + } + else + { + MachineOperator.SendContinuousRequest(container).Subscribe((response) => + { + + SendResponse(response); + + },(ex) => + { + if (ex is ResponseErrorException) + { + SendResponse((ex as ResponseErrorException).Container); + } + }); + } + } + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs new file mode 100644 index 000000000..a81e64c02 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.Integration.Operation; +using Tango.PMR.Integration; +using Tango.Settings; +using Tango.Transport.Adapters; +using Tango.Transport.Transporters; + +namespace Tango.Integration.ExternalBridge +{ + /// + /// Represents a secure external bridge TCP client. + /// + /// + /// + public class ExternalBridgeTcpClient : MachineOperator, IExternalBridgeSecureClient + { + private String _serialNumber; + /// + /// Gets the machine serial number. + /// + public String SerialNumber + { + get { return _serialNumber; } + set + { + _serialNumber = value; + RaisePropertyChangedAuto(); + + Machine = ObservablesEntitiesAdapter.Instance.Machines.SingleOrDefault(x => x.SerialNumber == _serialNumber); + } + } + + private String _ipAddress; + /// + /// Gets or sets the machine IP address. + /// + public String IPAddress + { + get { return _ipAddress; } + set { _ipAddress = value; RaisePropertyChangedAuto(); } + } + + /// + /// Gets a value indicating whether this client requires authentication. + /// + public bool RequiresAuthentication => true; + + /// + /// Connects the transport component. + /// + /// + public override async Task Connect() + { + await Disconnect(); + Adapter = new TcpTransportAdapter(IPAddress, SettingsManager.Default.GetOrCreate().ExternalBridgeServicePort); + await base.Connect(); + } + + /// + /// Authenticates with the service using the specified password. + /// + /// The password. + /// + public async Task Authenticate(String password) + { + var response = await SendRequest(new ExternalClientLoginRequest() + { + Password = password + }); + return response.Message.Authenticated; + } + + /// + /// Initializes a new instance of the class. + /// + /// The machine serial number. + /// The machine IP address. + public ExternalBridgeTcpClient(String serialNumber, String ipAddress) + { + SerialNumber = serialNumber; + IPAddress = ipAddress; + UseKeepAlive = true; + EnableDiagnostics = true; + } + + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// + public override string ToString() + { + return SerialNumber; + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeUsbClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeUsbClient.cs new file mode 100644 index 000000000..0e5dca2d0 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeUsbClient.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.Integration.Operation; +using Tango.PMR.Integration; +using Tango.Settings; +using Tango.Transport.Adapters; +using Tango.Transport.Transporters; + +namespace Tango.Integration.ExternalBridge +{ + /// + /// Represents an external bridge USB client. + /// + /// + /// This isn't really an external bridge client, but merely a transporter for communicating with a Tango machine embedded device. + /// + /// + /// + public class ExternalBridgeUsbClient : MachineOperator, IExternalBridgeClient + { + private String _serialNumber; + /// + /// Gets the machine serial number. + /// + public String SerialNumber + { + get { return _serialNumber; } + set + { + _serialNumber = value; + RaisePropertyChangedAuto(); + + Machine = ObservablesEntitiesAdapter.Instance.Machines.SingleOrDefault(x => x.SerialNumber == _serialNumber); + RaisePropertyChanged(nameof(Machine)); + } + } + + private String _comPort; + /// + /// Gets or sets the serial COM port. + /// + public String ComPort + { + get { return _comPort; } + set { _comPort = value; RaisePropertyChangedAuto(); } + } + + private UsbSerialBaudRates _baudRate; + /// + /// Gets or sets the baud rate. + /// + public UsbSerialBaudRates BaudRate + { + get { return _baudRate; } + set { _baudRate = value; RaisePropertyChangedAuto(); } + } + + private String _Device; + /// + /// Gets or sets the USB device name. + /// + public String Device + { + get { return _Device; } + set { _Device = value; RaisePropertyChangedAuto(); } + } + + /// + /// Connects the transport component. + /// + /// + public override async Task Connect() + { + await Disconnect(); + Adapter = new UsbTransportAdapter(ComPort) { BaudRate = BaudRate }; + await base.Connect(); + } + + /// + /// Gets a value indicating whether this client requires authentication. + /// + public bool RequiresAuthentication => false; + + /// + /// Initializes a new instance of the class. + /// + /// The COM port. + /// The device. + public ExternalBridgeUsbClient(String comPort, String device,UsbSerialBaudRates baudRate = UsbSerialBaudRates.BR_115200) + { + ComPort = comPort; + Device = device; + BaudRate = baudRate; + UseKeepAlive = false; + EnableDiagnostics = true; + } + + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// + public override string ToString() + { + return Device; + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeClient.cs new file mode 100644 index 000000000..b1d084cfa --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeClient.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Integration.Operation; +using Tango.Transport; +using Tango.Transport.Transporters; + +namespace Tango.Integration.ExternalBridge +{ + /// + /// Represents a Tango machine external bridge service client. + /// + /// + public interface IExternalBridgeClient : IMachineOperator + { + /// + /// Gets a value indicating whether this client requires authentication. + /// + bool RequiresAuthentication { get; } + + /// + /// Gets or sets the machine serial number. + /// + String SerialNumber { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeSecureClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeSecureClient.cs new file mode 100644 index 000000000..e109837fb --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeSecureClient.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Integration.ExternalBridge +{ + /// + /// Represents a secure external bridge client which requires authentication. + /// + /// + public interface IExternalBridgeSecureClient : IExternalBridgeClient + { + /// + /// Authenticates with the service using the specified password. + /// + /// The password. + /// + Task Authenticate(String password); + } +} diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeService.cs new file mode 100644 index 000000000..d8e106ac4 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeService.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Integration.Operation; +using Tango.Transport; +using Tango.Transport.Transporters; + +namespace Tango.Integration.ExternalBridge +{ + public interface IExternalBridgeService : ITransporter + { + IMachineOperator MachineOperator { get; } + Machine Machine { get; } + bool IsStarted { get; } + void Start(); + void Stop(); + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs deleted file mode 100644 index 8aca73e46..000000000 --- a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs +++ /dev/null @@ -1,166 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO.Ports; -using System.Linq; -using System.Management; -using System.Net; -using System.Net.NetworkInformation; -using System.Net.Sockets; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Tango.Core; -using Tango.Core.Helpers; -using Tango.Logging; -using Tango.PMR; -using Tango.PMR.Common; -using Tango.PMR.Integration; -using Tango.Settings; -using Tango.Transport.Adapters; - -namespace Tango.Integration.Services -{ - /// - /// Scans for available machines on the local area network and physically connected via USB. - /// - /// - public class ExternalBridgeScanner : ExtendedObject - { - private Thread _tcpDiscoveryThread; - private Thread _usbDiscoveryThread; - private UdpClient _server; - private IntegrationSettings _settings; - - private ObservableCollection _availableMachines; - /// - /// Gets the available machines. - /// - public ObservableCollection AvailableMachines - { - get { return _availableMachines; } - private set { _availableMachines = value; RaisePropertyChangedAuto(); } - } - - private bool _isStarted; - /// - /// Gets or sets a value indicating whether this instance is started. - /// - public bool IsStarted - { - get { return _isStarted; } - private set { _isStarted = value; RaisePropertyChangedAuto(); } - } - - /// - /// Initializes a new instance of the class. - /// - public ExternalBridgeScanner() - { - _settings = SettingsManager.Default.GetOrCreate(); - _server = new UdpClient(_settings.ExternalBridgeServiceDiscoveryPort); - AvailableMachines = new ObservableCollection(); - } - - /// - /// Start scanning. (Results will be available through ). - /// - public void Start() - { - if (!IsStarted) - { - LogManager.Log("External bridge scanner started..."); - - IsStarted = true; - - _tcpDiscoveryThread = new Thread(TcpDiscoveryThreadMethod); - _tcpDiscoveryThread.IsBackground = true; - _tcpDiscoveryThread.Start(); - - _usbDiscoveryThread = new Thread(UsbDiscoveryThreadMethod); - _usbDiscoveryThread.IsBackground = true; - _usbDiscoveryThread.Start(); - } - } - - /// - /// Stops this instance. - /// - public void Stop() - { - if (IsStarted) - { - IsStarted = false; - LogManager.Log("External bridge scanner stopped."); - } - } - - /// - /// USB discovery thread method. - /// - private void UsbDiscoveryThreadMethod() - { - while (IsStarted) - { - foreach (var device in Transport.Components.ComPortEnumerator.EnumerateComPorts()) - { - if (device.Description.Contains(_settings.EmbeddedDeviceName) || !_settings.FilterExternalBridgeUsbMachines) - { - if (!AvailableMachines.OfType().ToList().Exists(x => x.ComPort == device.Port)) - { - LogManager.Log("Found a new machine via USB " + device.Description); - ThreadsHelper.InvokeUINow(() => - { - AvailableMachines.Add(new ExternalBridgeUsbClient(device.Port, device.Description, _settings.EmbeddedSerialBaudRate)); - }); - } - } - } - - Thread.Sleep(2000); - } - } - - /// - /// TCP discovery thread method. - /// - private void TcpDiscoveryThreadMethod() - { - while (IsStarted) - { - var ClientEp = new IPEndPoint(IPAddress.Any, 0); - var ClientRequestData = _server.Receive(ref ClientEp); - - ExternalBridgeUdpDiscoveryPacket packet = ExternalBridgeUdpDiscoveryPacket.Parser.ParseFrom(ClientRequestData); - - if (!AvailableMachines.OfType().ToList().Exists(x => x.SerialNumber == packet.SerialNumber)) - { - ExternalBridgeTcpClient newMachine = new ExternalBridgeTcpClient(packet.SerialNumber, ClientEp.Address.ToString()); - - LogManager.Log("Found a new machine via TCP " + newMachine.SerialNumber); - - ThreadsHelper.InvokeUINow(() => - { - AvailableMachines.Add(newMachine); - }); - } - - Thread.Sleep(1000); - } - } - - /// - /// Handles the available machines component state changed event. - /// - /// The sender. - /// The e. - private void Client_StateChanged(object sender, Transport.TransportComponentState e) - { - if (e == Transport.TransportComponentState.Failed || e == Transport.TransportComponentState.Disposed) - { - LogManager.Log("External bridge client failed or disposed. Removing from available machines..."); - AvailableMachines.Remove(sender as IExternalBridgeClient); - } - } - } -} diff --git a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeService.cs deleted file mode 100644 index 408ec2822..000000000 --- a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeService.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Google.Protobuf; -using Tango.BL.Entities; -using Tango.Integration.Operation; -using Tango.PMR; -using Tango.PMR.Common; -using Tango.Transport; -using Tango.Transport.Transporters; -using Tango.PMR.Integration; -using Tango.Transport.Discovery; -using Tango.Transport.Servers; -using Tango.Transport.Adapters; - -namespace Tango.Integration.Services -{ - public class ExternalBridgeService : BasicTransporter, IExternalBridgeService - { - private UdpDiscoveryService _discoverySevice; - private TcpServer _tcpServer; - - public IMachineOperator MachineOperator { get; private set; } - - public Machine Machine { get; private set; } - - public bool IsStarted { get; private set; } - - public ExternalBridgeService(IMachineOperator machineOperator, Machine machine) - { - Machine = machine; - MachineOperator = machineOperator; - - _tcpServer = new TcpServer(1984); - _tcpServer.ClientConnected += _tcpServer_ClientConnected; - - _discoverySevice = new UdpDiscoveryService(8888, new ExternalBridgeUdpDiscoveryPacket() - { - SerialNumber = Machine.SerialNumber, - }); - } - - private async void _tcpServer_ClientConnected(object sender, ClientConnectedEventArgs e) - { - Adapter = new TcpTransportAdapter(e.Socket); - await Connect(); - } - - public void Start() - { - if (!IsStarted) - { - _tcpServer.Start(); - _discoverySevice.Start(); - - IsStarted = true; - } - } - - public void Stop() - { - if (IsStarted) - { - _tcpServer.Stop(); - _discoverySevice.Stop(); - - IsStarted = false; - } - } - - protected async override void OnRequestReceived(MessageContainer container) - { - base.OnRequestReceived(container); - - if (container.Type == MessageType.ExternalClientLoginRequest) - { - var request = MessageFactory.ParseTangoMessageFromContainer(container); - - var response = new ExternalClientLoginResponse(); - response.Authenticated = false; - - if (request.Message.Password == "1234") - { - response.Authenticated = true; - response.SerialNumber = Machine.SerialNumber; - } - - await SendResponse(response, container.Token); - } - else - { - MachineOperator.RequestTimeout = TimeSpan.FromSeconds(60); - - if (!container.Continuous) - { - var response = await MachineOperator.SendRequest(container); - await SendResponse(response); - } - else - { - MachineOperator.SendContinuousRequest(container).Subscribe((response) => - { - - SendResponse(response); - - },(ex) => - { - if (ex is ResponseErrorException) - { - SendResponse((ex as ResponseErrorException).Container); - } - }); - } - } - } - } -} diff --git a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeTcpClient.cs b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeTcpClient.cs deleted file mode 100644 index 9dc44dbf9..000000000 --- a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeTcpClient.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.BL; -using Tango.BL.Entities; -using Tango.Integration.Operation; -using Tango.PMR.Integration; -using Tango.Settings; -using Tango.Transport.Adapters; -using Tango.Transport.Transporters; - -namespace Tango.Integration.Services -{ - /// - /// Represents a secure external bridge TCP client. - /// - /// - /// - public class ExternalBridgeTcpClient : MachineOperator, IExternalBridgeSecureClient - { - private String _serialNumber; - /// - /// Gets the machine serial number. - /// - public String SerialNumber - { - get { return _serialNumber; } - set - { - _serialNumber = value; - RaisePropertyChangedAuto(); - - Machine = ObservablesEntitiesAdapter.Instance.Machines.SingleOrDefault(x => x.SerialNumber == _serialNumber); - } - } - - private String _ipAddress; - /// - /// Gets or sets the machine IP address. - /// - public String IPAddress - { - get { return _ipAddress; } - set { _ipAddress = value; RaisePropertyChangedAuto(); } - } - - /// - /// Gets a value indicating whether this client requires authentication. - /// - public bool RequiresAuthentication => true; - - /// - /// Connects the transport component. - /// - /// - public override async Task Connect() - { - await Disconnect(); - Adapter = new TcpTransportAdapter(IPAddress, SettingsManager.Default.GetOrCreate().ExternalBridgeServicePort); - await base.Connect(); - } - - /// - /// Authenticates with the service using the specified password. - /// - /// The password. - /// - public async Task Authenticate(String password) - { - var response = await SendRequest(new ExternalClientLoginRequest() - { - Password = password - }); - return response.Message.Authenticated; - } - - /// - /// Initializes a new instance of the class. - /// - /// The machine serial number. - /// The machine IP address. - public ExternalBridgeTcpClient(String serialNumber, String ipAddress) - { - SerialNumber = serialNumber; - IPAddress = ipAddress; - UseKeepAlive = true; - EnableDiagnostics = true; - } - - /// - /// Returns a that represents this instance. - /// - /// - /// A that represents this instance. - /// - public override string ToString() - { - return SerialNumber; - } - } -} diff --git a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeUsbClient.cs b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeUsbClient.cs deleted file mode 100644 index 7a901ccf2..000000000 --- a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeUsbClient.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.BL; -using Tango.BL.Entities; -using Tango.Integration.Operation; -using Tango.PMR.Integration; -using Tango.Settings; -using Tango.Transport.Adapters; -using Tango.Transport.Transporters; - -namespace Tango.Integration.Services -{ - /// - /// Represents an external bridge USB client. - /// - /// - /// This isn't really an external bridge client, but merely a transporter for communicating with a Tango machine embedded device. - /// - /// - /// - public class ExternalBridgeUsbClient : MachineOperator, IExternalBridgeClient - { - private String _serialNumber; - /// - /// Gets the machine serial number. - /// - public String SerialNumber - { - get { return _serialNumber; } - set - { - _serialNumber = value; - RaisePropertyChangedAuto(); - - Machine = ObservablesEntitiesAdapter.Instance.Machines.SingleOrDefault(x => x.SerialNumber == _serialNumber); - RaisePropertyChanged(nameof(Machine)); - } - } - - private String _comPort; - /// - /// Gets or sets the serial COM port. - /// - public String ComPort - { - get { return _comPort; } - set { _comPort = value; RaisePropertyChangedAuto(); } - } - - private UsbSerialBaudRates _baudRate; - /// - /// Gets or sets the baud rate. - /// - public UsbSerialBaudRates BaudRate - { - get { return _baudRate; } - set { _baudRate = value; RaisePropertyChangedAuto(); } - } - - private String _Device; - /// - /// Gets or sets the USB device name. - /// - public String Device - { - get { return _Device; } - set { _Device = value; RaisePropertyChangedAuto(); } - } - - /// - /// Connects the transport component. - /// - /// - public override async Task Connect() - { - await Disconnect(); - Adapter = new UsbTransportAdapter(ComPort) { BaudRate = BaudRate }; - await base.Connect(); - } - - /// - /// Gets a value indicating whether this client requires authentication. - /// - public bool RequiresAuthentication => false; - - /// - /// Initializes a new instance of the class. - /// - /// The COM port. - /// The device. - public ExternalBridgeUsbClient(String comPort, String device,UsbSerialBaudRates baudRate = UsbSerialBaudRates.BR_115200) - { - ComPort = comPort; - Device = device; - BaudRate = baudRate; - UseKeepAlive = false; - EnableDiagnostics = true; - } - - /// - /// Returns a that represents this instance. - /// - /// - /// A that represents this instance. - /// - public override string ToString() - { - return Device; - } - } -} diff --git a/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeClient.cs b/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeClient.cs deleted file mode 100644 index 00cfdeace..000000000 --- a/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeClient.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Sockets; -using System.Text; -using System.Threading.Tasks; -using Tango.BL.Entities; -using Tango.Integration.Operation; -using Tango.Transport; -using Tango.Transport.Transporters; - -namespace Tango.Integration.Services -{ - /// - /// Represents a Tango machine external bridge service client. - /// - /// - public interface IExternalBridgeClient : IMachineOperator - { - /// - /// Gets a value indicating whether this client requires authentication. - /// - bool RequiresAuthentication { get; } - - /// - /// Gets or sets the machine serial number. - /// - String SerialNumber { get; set; } - } -} diff --git a/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeSecureClient.cs b/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeSecureClient.cs deleted file mode 100644 index 56eb1976d..000000000 --- a/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeSecureClient.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.Integration.Services -{ - /// - /// Represents a secure external bridge client which requires authentication. - /// - /// - public interface IExternalBridgeSecureClient : IExternalBridgeClient - { - /// - /// Authenticates with the service using the specified password. - /// - /// The password. - /// - Task Authenticate(String password); - } -} diff --git a/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeService.cs deleted file mode 100644 index 66fab6fdc..000000000 --- a/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeService.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.BL.Entities; -using Tango.Integration.Operation; -using Tango.Transport; -using Tango.Transport.Transporters; - -namespace Tango.Integration.Services -{ - public interface IExternalBridgeService : ITransporter - { - IMachineOperator MachineOperator { get; } - Machine Machine { get; } - bool IsStarted { get; } - void Start(); - void Stop(); - } -} diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj index 9e386c9c2..f5d1c587f 100644 --- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj +++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj @@ -95,14 +95,14 @@ - - - - - + + + + + - - + + -- cgit v1.3.1 From 86919dc24020229cbd1d8c59f29a4a36895f5b7a Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 29 Jul 2018 13:03:22 +0300 Subject: Implemented diagnostics frame rate monitor on IDiagnosticsFrameProvider. Added diagnostics frame rate to connected machine dialog. Implemented dynamic graphs max points using frame rate on tech board!. Implemented speed control on DIagnosticsFilePlayer & Data Capture module. Implemented graphs duration control on tech board. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1835008 -> 1835008 bytes .../Tango.MachineStudio.DataCapture.csproj | 6 +- .../Views/MainView.xaml | 201 +++++++++++---------- .../Views/TimelineView.xaml.cs | 6 +- .../Helpers/GraphsHelper.cs | 2 +- .../TechnicianModuleSettings.cs | 4 +- .../ViewModels/MachineTechViewVM.cs | 98 +++++++++- .../Views/MachineTechView.xaml | 17 ++ .../Diagnostics/DefaultDiagnosticsFrameProvider.cs | 47 ++++- .../Diagnostics/IDiagnosticsFrameProvider.cs | 5 + .../ViewModels/ConnectedMachineViewVM.cs | 13 +- .../Views/ConnectedMachineView.xaml | 16 +- .../Diagnostics/DiagnosticsFilePlayer.cs | 27 ++- 14 files changed, 325 insertions(+), 117 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 163460bb9..4c31e0729 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 44c77937d..104f4ed58 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj index 24241bd14..7c7c8c272 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj @@ -154,6 +154,10 @@ {9652f972-2bd1-4283-99cb-fc6240434c17} Tango.Video + + {cf7c0ff4-9440-42cf-83b8-c060772792d4} + Tango.Visuals + {cb0b0aa2-bb24-4bca-a720-45e397684e12} Tango.MachineStudio.Common @@ -184,7 +188,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml index 37f92dea7..1ef3c1769 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml @@ -6,6 +6,7 @@ xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:visuals="clr-namespace:Tango.Visuals;assembly=Tango.Visuals" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.MachineStudio.DataCapture.ViewModels" xmlns:logging="clr-namespace:Tango.MachineStudio.Logging.Views;assembly=Tango.MachineStudio.Logging" @@ -182,110 +183,118 @@ - - - - - - - - - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Speed + + x + + - - + + Total Frames: - - + + File Size: - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -316,7 +325,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs index 8004ef154..92d176671 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs @@ -44,7 +44,11 @@ namespace Tango.MachineStudio.Logging.Views private void ItemsControl_SizeChanged(object sender, SizeChangedEventArgs e) { TimelineEventGroup group = (sender as FrameworkElement).DataContext as TimelineEventGroup; - group.Height = e.NewSize.Height; + + if (group != null) + { + group.Height = e.NewSize.Height; + } } private void scrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs index 0cd14f917..fa80f90dd 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs @@ -23,7 +23,7 @@ namespace Tango.MachineStudio.Technician.Helpers try { var settings = SettingsManager.Default.GetOrCreate(); - double seconds = settings.GraphsViewDurationSeconds; + double seconds = settings.GraphsDuration; double pullRate = settings.DiagnosticsResponseIntervalMilli; return (int)(((pullRate * pointsPerFrame * 10 * seconds) * (10 / pullRate)) * 0.65); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModuleSettings.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModuleSettings.cs index 12acaf3ee..65ff8d537 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModuleSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModuleSettings.cs @@ -12,7 +12,7 @@ namespace Tango.MachineStudio.Technician /// /// Gets or sets the graphs view duration in seconds. /// - public int GraphsViewDurationSeconds { get; set; } + public int GraphsDuration { get; set; } /// /// Gets or sets the diagnostics response interval in milliseconds. @@ -29,7 +29,7 @@ namespace Tango.MachineStudio.Technician /// public TechnicianModuleSettings() { - GraphsViewDurationSeconds = 10; + GraphsDuration = 10; DiagnosticsResponseIntervalMilli = 30; } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index d403223ec..3dff65fbc 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -43,6 +43,7 @@ namespace Tango.MachineStudio.Technician.ViewModels public class MachineTechViewVM : StudioViewModel { private List _diagnoticsMonitorsDataProperties; + private IDiagnosticsFrameProvider _diagnosticsFrameProvider; private Dictionary _singleControllers; private Dictionary _multiControllers; private static object _elementsLock = new object(); @@ -149,6 +150,28 @@ namespace Tango.MachineStudio.Technician.ViewModels set { _currentDiagnosticsResponseSize = value; RaisePropertyChanged(nameof(CurrentDiagnosticsResponseSize)); } } + private int _graphsDurationSeconds; + /// + /// Gets or sets the graphs duration seconds. + /// + public int GraphsDurationSeconds + { + get { return _graphsDurationSeconds; } + set { _graphsDurationSeconds = value; RaisePropertyChangedAuto(); } + } + + private int _tempGraphsDurationSeconds; + /// + /// Gets or sets the temporary graphs duration seconds. + /// + public int TempGraphsDurationSeconds + { + get { return _tempGraphsDurationSeconds; } + set { _tempGraphsDurationSeconds = value; RaisePropertyChangedAuto(); } + } + + + #endregion #region Commands @@ -183,6 +206,8 @@ namespace Tango.MachineStudio.Technician.ViewModels /// public RelayCommand ResetHardwareConfigurationCommand { get; set; } + public RelayCommand UpdateGraphsDurationCommand { get; set; } + #endregion #region Constructors @@ -192,10 +217,13 @@ namespace Tango.MachineStudio.Technician.ViewModels /// /// The application manager. /// The notification provider. - public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider _diagnosticsFrameProvider, IEventLogger eventLogger) + public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IEventLogger eventLogger) { _settings = SettingsManager.Default.GetOrCreate(); + GraphsDurationSeconds = _settings.GraphsDuration; + TempGraphsDurationSeconds = GraphsDurationSeconds; + _notification = notificationProvider; _eventLogger = eventLogger; _singleControllers = new Dictionary(); @@ -217,14 +245,28 @@ namespace Tango.MachineStudio.Technician.ViewModels if (File.Exists(_lastTechProjectFile)) { - OpenProjectFile(_lastTechProjectFile); + try + { + OpenProjectFile(_lastTechProjectFile); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading last project file."); + } } + _diagnosticsFrameProvider = diagnosticsFrameProvider; _diagnosticsFrameProvider.FrameReceived += DiagnosticsFrameProvider_FrameReceived; UploadHardwareConfigurationCommand = new RelayCommand(UploadHardwareConfiguration); SyncHardwareConfigurationCommand = new RelayCommand(SyncHardwareConfiguration); ResetHardwareConfigurationCommand = new RelayCommand(() => ResetHardwareConfiguration()); + UpdateGraphsDurationCommand = new RelayCommand(() => + { + GraphsDurationSeconds = TempGraphsDurationSeconds; + _settings.GraphsDuration = GraphsDurationSeconds; + ClearAllGraphs(); + }); } #endregion @@ -320,7 +362,16 @@ namespace Tango.MachineStudio.Technician.ViewModels if (_singleControllers.TryGetValue(graphItem, out controller)) { - controller.PushData(GetDataArray(graphItem.TechMonitor, prop.GetValue(data.Monitors))); + var points = GetDataArray(graphItem.TechMonitor, prop.GetValue(data.Monitors)); + + int maxPoints = (int)(_diagnosticsFrameProvider.FrameRate * GraphsDurationSeconds * points.Count); + + InvokeUI(() => + { + graphItem.Editor.InnerGraph.InnerGraph.MaxPoints = maxPoints; + }); + + controller.PushData(points); } } } @@ -336,7 +387,19 @@ namespace Tango.MachineStudio.Technician.ViewModels if (_multiControllers.TryGetValue(graphItem, out controller)) { - controller.PushData(GetDataMatrix(graphItem.TechMonitor, prop.GetValue(data.Monitors))); + var points = GetDataMatrix(graphItem.TechMonitor, prop.GetValue(data.Monitors)); + + if (points.Count > 0) + { + int maxPoints = (int)(_diagnosticsFrameProvider.FrameRate * GraphsDurationSeconds * points[0].Count); + + InvokeUI(() => + { + graphItem.Editor.InnerGraph.InnerGraph.MaxPoints = maxPoints; + }); + } + + controller.PushData(points); } } } @@ -1179,7 +1242,7 @@ namespace Tango.MachineStudio.Technician.ViewModels catch (Exception ex) { String msg = "Error uploading process parameters:" + Environment.NewLine + parameters.ToJsonString(); - _eventLogger.Log(ex,msg); + _eventLogger.Log(ex, msg); LogManager.Log(ex, msg); _notification.ShowError("Could not upload process parameters." + Environment.NewLine + ex.Message); } @@ -1199,7 +1262,7 @@ namespace Tango.MachineStudio.Technician.ViewModels /// private void InitJobRunnerItem(JobRunnerItem item) { - item.StartJob += () => + item.StartJob += () => { try { @@ -1209,12 +1272,12 @@ namespace Tango.MachineStudio.Technician.ViewModels item.JobHandler = handler; - handler.StatusChanged += (x, status) => + handler.StatusChanged += (x, status) => { item.RunningJobStatus = status; }; - handler.Stopped += (x,e) => + handler.Stopped += (x, e) => { item.IsJobStarted = false; }; @@ -1226,7 +1289,7 @@ namespace Tango.MachineStudio.Technician.ViewModels } }; - item.StopJob += () => + item.StopJob += () => { if (item.JobHandler != null) { @@ -1597,5 +1660,22 @@ namespace Tango.MachineStudio.Technician.ViewModels } #endregion + + #region Graphs + + public void ClearAllGraphs() + { + foreach (var controller in _singleControllers) + { + controller.Value.Clear(); + } + + foreach (var controller in _multiControllers) + { + controller.Value.Clear(); + } + } + + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml index 29ba98cd3..c11dbc525 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:vm="clr-namespace:Tango.MachineStudio.Technician.ViewModels" xmlns:global="clr-namespace:Tango.MachineStudio.Technician" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:fa="http://schemas.fontawesome.io/icons/" xmlns:editors="clr-namespace:Tango.Editors;assembly=Tango.Editors" @@ -176,6 +177,22 @@ + + + + GRAPHS DURATION: + + sec + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs index 957648536..477332ad9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs @@ -8,6 +8,7 @@ using Tango.Integration.Operation; using Tango.Integration.ExternalBridge; using Tango.MachineStudio.Common.StudioApplication; using Tango.PMR.Diagnostics; +using System.Diagnostics; namespace Tango.MachineStudio.Common.Diagnostics { @@ -18,6 +19,10 @@ namespace Tango.MachineStudio.Common.Diagnostics public class DefaultDiagnosticsFrameProvider : ExtendedObject, IDiagnosticsFrameProvider { private IStudioApplicationManager _application; + private Stopwatch _watch; + private List _rates; + private DateTime _last_measure; + private const int _min_rate_change = 4; private bool _disable; /// @@ -32,10 +37,27 @@ namespace Tango.MachineStudio.Common.Diagnostics } } + private double _frameRate; + /// + /// Gets the current diagnostics frame rate. + /// + public double FrameRate + { + get + { + return _frameRate; + } + private set + { + _frameRate = value; + RaisePropertyChangedAuto(); + } + } + /// /// Occurs when a new data frame is available. /// - public event EventHandler FrameReceived; + public event EventHandler FrameReceived; /// /// Initializes a new instance of the class. @@ -43,6 +65,8 @@ namespace Tango.MachineStudio.Common.Diagnostics /// The application manager. public DefaultDiagnosticsFrameProvider(IStudioApplicationManager applicationManager) { + _rates = new List(); + _watch = new Stopwatch(); _application = applicationManager; applicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; } @@ -56,6 +80,9 @@ namespace Tango.MachineStudio.Common.Diagnostics { if (machine != null) { + _last_measure = DateTime.Now; + _rates = new List(); + _watch = new Stopwatch(); machine.DiagnosticsDataAvailable += DefaultDiagnosticsFrameProvider_DiagnosticsDataAvailable; } } @@ -91,6 +118,24 @@ namespace Tango.MachineStudio.Common.Diagnostics /// The frame. protected virtual void OnFrameReceived(StartDiagnosticsResponse frame) { + if (DateTime.Now > _last_measure.AddSeconds(1) && _rates.Count > 0) + { + _last_measure = DateTime.Now; + + var rate = Math.Round(1000d / _rates.Average(), 2); + + if (rate > FrameRate + _min_rate_change || rate < FrameRate - _min_rate_change) + { + FrameRate = rate; + } + + _rates.Clear(); + } + + _rates.Add(_watch.ElapsedMilliseconds); + + _watch.Restart(); + FrameReceived?.Invoke(this, frame); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/IDiagnosticsFrameProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/IDiagnosticsFrameProvider.cs index 3944fe8cb..eb1033c29 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/IDiagnosticsFrameProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/IDiagnosticsFrameProvider.cs @@ -18,6 +18,11 @@ namespace Tango.MachineStudio.Common.Diagnostics /// event EventHandler FrameReceived; + /// + /// Gets the current diagnostics frame rate. + /// + double FrameRate { get; } + /// /// Disables the frame delivery from the current connected machine and enables the manual push frame method. /// diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs index 8034ceb69..35a4b0e9d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; using Tango.Core.Commands; +using Tango.MachineStudio.Common.Diagnostics; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Common.StudioApplication; using Tango.SharedUI; @@ -30,18 +31,28 @@ namespace Tango.MachineStudio.UI.ViewModels public ConnectedMachineVMResult Result { get; set; } + private IDiagnosticsFrameProvider _diagnosticsFrameProvider; + public IDiagnosticsFrameProvider DiagnosticsFrameProvider + { + get { return _diagnosticsFrameProvider; } + set { _diagnosticsFrameProvider = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand DisconnectCommand { get; set; } public RelayCommand UploadHardwareConfigurationCommand { get; set; } public RelayCommand ResetCommand { get; set; } - public ConnectedMachineViewVM(IStudioApplicationManager application) + public ConnectedMachineViewVM(IStudioApplicationManager application, IDiagnosticsFrameProvider frameProvider) { ApplicationManager = application; DisconnectCommand = new RelayCommand(Disconnect); UploadHardwareConfigurationCommand = new RelayCommand(UploadHardwareConfiguration); ResetCommand = new RelayCommand(Reset); + + DiagnosticsFrameProvider = frameProvider; } private void Reset() diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml index bb8b65f6a..aa2b014fe 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml @@ -11,7 +11,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="400" Background="White" DataContext="{Binding ConnectedMachineViewVM, Source={StaticResource Locator}}"> + d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="420" Background="White" DataContext="{Binding ConnectedMachineViewVM, Source={StaticResource Locator}}"> @@ -73,7 +73,12 @@ - + + + + + + @@ -103,7 +108,12 @@ - + + + + + + diff --git a/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs b/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs index 7b3cf9859..80a19c296 100644 --- a/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs +++ b/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs @@ -124,6 +124,28 @@ namespace Tango.Integration.Diagnostics set { _machineEvents = value; RaisePropertyChangedAuto(); } } + private double _speed; + /// + /// Gets or sets the player speed (default 1.0). + /// + public double Speed + { + get { return _speed; } + set { _speed = value; RaisePropertyChangedAuto(); } + } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public DiagnosticsFilePlayer() + { + Speed = 1.0; + } + #endregion #region Public Methods @@ -321,11 +343,12 @@ namespace Tango.Integration.Diagnostics if (CurrentFrame > 0) { - Thread.Sleep(_timeCodeChannel.Frames[CurrentFrame].Milliseconds - _timeCodeChannel.Frames[CurrentFrame - 1].Milliseconds); + double sleep = _timeCodeChannel.Frames[CurrentFrame].Milliseconds - _timeCodeChannel.Frames[CurrentFrame - 1].Milliseconds; + Thread.Sleep((int)(sleep / Speed)); } else { - Thread.Sleep(10); + Thread.Sleep((int)(10d / Speed)); } } -- cgit v1.3.1