aboutsummaryrefslogtreecommitdiffstats
path: root/Software
diff options
context:
space:
mode:
Diffstat (limited to 'Software')
-rw-r--r--Software/Code_Composer/twine_usblib/usb_serial_adapter.c37
-rw-r--r--Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Job.pb-c.c114
-rw-r--r--Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Job.pb-c.h28
-rw-r--r--Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Segment.pb-c.c19
-rw-r--r--Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Segment.pb-c.h5
-rw-r--r--Software/Code_Composer/twine_usblib_demo/PMR/Jobs/dispenser.pb-c.c201
-rw-r--r--Software/Code_Composer/twine_usblib_demo/PMR/Jobs/dispenser.pb-c.h111
-rw-r--r--Software/Code_Composer/twine_usblib_demo/PMR/Jobs/motor.pb-c.c293
-rw-r--r--Software/Code_Composer/twine_usblib_demo/PMR/Jobs/motor.pb-c.h106
-rw-r--r--Software/DB/Tango.mdfbin75497472 -> 75497472 bytes
-rw-r--r--Software/DB/Tango_log.ldfbin8388608 -> 8388608 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/DirectSynchronizationView.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs6
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs44
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml54
-rw-r--r--Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs46
-rw-r--r--Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs39
-rw-r--r--Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeClient.cs6
-rw-r--r--Software/Visual_Studio/Tango.Transport/TransporterBase.cs4
21 files changed, 1067 insertions, 51 deletions
diff --git a/Software/Code_Composer/twine_usblib/usb_serial_adapter.c b/Software/Code_Composer/twine_usblib/usb_serial_adapter.c
index 9cf3ef3b4..3f7c43118 100644
--- a/Software/Code_Composer/twine_usblib/usb_serial_adapter.c
+++ b/Software/Code_Composer/twine_usblib/usb_serial_adapter.c
@@ -35,6 +35,8 @@
#include "usb_serial_adapter.h"
static SerialBuffer inBuffer;
+static int expected_message_size;
+static int current_message_size;
//*****************************************************************************
//
@@ -396,6 +398,24 @@ void handleRx(void)
{
uint32_t ui32Read;
uint8_t ui8Char;
+ uint8_t size[4];
+ int size_bar = 0;
+
+ if (expected_message_size == 0)
+ {
+ do
+ {
+ ui32Read = USBBufferRead((tUSBBuffer *)&g_sRxBuffer, &ui8Char, 1);
+
+ if(ui32Read)
+ {
+ size[size_bar++] = ui8Char;
+ }
+
+ } while(size_bar < 4);
+
+ expected_message_size = *(int *)size;
+ }
do
{
@@ -405,7 +425,15 @@ void handleRx(void)
if(ui32Read)
{
insertArray(&inBuffer, ui8Char);
- g_RxCount++;
+ current_message_size++;
+ }
+
+ if (current_message_size == expected_message_size)
+ {
+ g_RxCount += current_message_size;
+ expected_message_size = 0;
+ current_message_size = 0;
+ break;
}
} while(ui32Read);
@@ -469,6 +497,13 @@ void StartUSB(uint32_t ui32SysClock)
//Send a sequence of chars to PC.
uint32_t SendChars(char* buffer,size_t length)
{
+ uint8_t size[4];
+ size[3] = (length>>24) & 0xFF;
+ size[2] = (length>>16) & 0xFF;
+ size[1] = (length>>8) & 0xFF;
+ size[0] = length & 0xFF;
+
+ USBBufferWrite((tUSBBuffer *)&g_sTxBuffer, size, 4);
return USBBufferWrite((tUSBBuffer *)&g_sTxBuffer, (uint8_t*)buffer, length);
}
diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Job.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Job.pb-c.c
index 0213521e5..2602d5927 100644
--- a/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Job.pb-c.c
+++ b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Job.pb-c.c
@@ -52,7 +52,7 @@ void job__free_unpacked
assert(message->base.descriptor == &job__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
-static const ProtobufCFieldDescriptor job__field_descriptors[2] =
+static const ProtobufCFieldDescriptor job__field_descriptors[10] =
{
{
"Name",
@@ -67,8 +67,92 @@ static const ProtobufCFieldDescriptor job__field_descriptors[2] =
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
- "Segments",
+ "interSegEnable",
2,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_BOOL,
+ offsetof(Job, has_intersegenable),
+ offsetof(Job, intersegenable),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "distanseToSpoolEnable",
+ 3,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_BOOL,
+ offsetof(Job, has_distansetospoolenable),
+ offsetof(Job, distansetospoolenable),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "distanceToSpoolLength",
+ 4,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_UINT32,
+ offsetof(Job, has_distancetospoollength),
+ offsetof(Job, distancetospoollength),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "startOffsetPulses",
+ 5,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_UINT32,
+ offsetof(Job, has_startoffsetpulses),
+ offsetof(Job, startoffsetpulses),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "spoolBackingRate",
+ 6,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_UINT32,
+ offsetof(Job, has_spoolbackingrate),
+ offsetof(Job, spoolbackingrate),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "segmentOffsetPulses",
+ 7,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_UINT32,
+ offsetof(Job, has_segmentoffsetpulses),
+ offsetof(Job, segmentoffsetpulses),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "milimetersPerRotation",
+ 8,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_UINT32,
+ offsetof(Job, has_milimetersperrotation),
+ offsetof(Job, milimetersperrotation),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "Segments",
+ 9,
PROTOBUF_C_LABEL_REPEATED,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Job, n_segments),
@@ -78,15 +162,35 @@ static const ProtobufCFieldDescriptor job__field_descriptors[2] =
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
+ {
+ "Motors",
+ 10,
+ PROTOBUF_C_LABEL_REPEATED,
+ PROTOBUF_C_TYPE_MESSAGE,
+ offsetof(Job, n_motors),
+ offsetof(Job, motors),
+ &motor_config__descriptor,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
};
static const unsigned job__field_indices_by_name[] = {
+ 9, /* field[9] = Motors */
0, /* field[0] = Name */
- 1, /* field[1] = Segments */
+ 8, /* field[8] = Segments */
+ 3, /* field[3] = distanceToSpoolLength */
+ 2, /* field[2] = distanseToSpoolEnable */
+ 1, /* field[1] = interSegEnable */
+ 7, /* field[7] = milimetersPerRotation */
+ 6, /* field[6] = segmentOffsetPulses */
+ 5, /* field[5] = spoolBackingRate */
+ 4, /* field[4] = startOffsetPulses */
};
static const ProtobufCIntRange job__number_ranges[1 + 1] =
{
{ 1, 0 },
- { 0, 2 }
+ { 0, 10 }
};
const ProtobufCMessageDescriptor job__descriptor =
{
@@ -96,7 +200,7 @@ const ProtobufCMessageDescriptor job__descriptor =
"Job",
"",
sizeof(Job),
- 2,
+ 10,
job__field_descriptors,
job__field_indices_by_name,
1, job__number_ranges,
diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Job.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Job.pb-c.h
index c94f78bbb..dbb1f8046 100644
--- a/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Job.pb-c.h
+++ b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Job.pb-c.h
@@ -15,6 +15,7 @@ PROTOBUF_C__BEGIN_DECLS
#endif
#include "Segment.pb-c.h"
+#include "motor.pb-c.h"
typedef struct _Job Job;
@@ -28,12 +29,37 @@ struct _Job
{
ProtobufCMessage base;
char *name;
+ /*
+ *does user have chosen inter segment enable option
+ */
+ protobuf_c_boolean has_intersegenable;
+ protobuf_c_boolean intersegenable;
+ /*
+ *does user have chosen distanse to spool enable option
+ */
+ protobuf_c_boolean has_distansetospoolenable;
+ protobuf_c_boolean distansetospoolenable;
+ /*
+ *had distance to spool finished?
+ */
+ protobuf_c_boolean has_distancetospoollength;
+ uint32_t distancetospoollength;
+ protobuf_c_boolean has_startoffsetpulses;
+ uint32_t startoffsetpulses;
+ protobuf_c_boolean has_spoolbackingrate;
+ uint32_t spoolbackingrate;
+ protobuf_c_boolean has_segmentoffsetpulses;
+ uint32_t segmentoffsetpulses;
+ protobuf_c_boolean has_milimetersperrotation;
+ uint32_t milimetersperrotation;
size_t n_segments;
Segment **segments;
+ size_t n_motors;
+ MotorConfig **motors;
};
#define JOB__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&job__descriptor) \
- , NULL, 0,NULL }
+ , NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,NULL, 0,NULL }
/* Job methods */
diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Segment.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Segment.pb-c.c
index 764b6721b..77c858bc9 100644
--- a/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Segment.pb-c.c
+++ b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Segment.pb-c.c
@@ -52,7 +52,7 @@ void segment__free_unpacked
assert(message->base.descriptor == &segment__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
-static const ProtobufCFieldDescriptor segment__field_descriptors[3] =
+static const ProtobufCFieldDescriptor segment__field_descriptors[4] =
{
{
"Name",
@@ -90,16 +90,29 @@ static const ProtobufCFieldDescriptor segment__field_descriptors[3] =
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
+ {
+ "dispenser",
+ 4,
+ PROTOBUF_C_LABEL_REPEATED,
+ PROTOBUF_C_TYPE_MESSAGE,
+ offsetof(Segment, n_dispenser),
+ offsetof(Segment, dispenser),
+ &dispense__descriptor,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
};
static const unsigned segment__field_indices_by_name[] = {
2, /* field[2] = Color */
1, /* field[1] = Length */
0, /* field[0] = Name */
+ 3, /* field[3] = dispenser */
};
static const ProtobufCIntRange segment__number_ranges[1 + 1] =
{
{ 1, 0 },
- { 0, 3 }
+ { 0, 4 }
};
const ProtobufCMessageDescriptor segment__descriptor =
{
@@ -109,7 +122,7 @@ const ProtobufCMessageDescriptor segment__descriptor =
"Segment",
"",
sizeof(Segment),
- 3,
+ 4,
segment__field_descriptors,
segment__field_indices_by_name,
1, segment__number_ranges,
diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Segment.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Segment.pb-c.h
index 5991f3228..5b7172c58 100644
--- a/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Segment.pb-c.h
+++ b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Segment.pb-c.h
@@ -15,6 +15,7 @@ PROTOBUF_C__BEGIN_DECLS
#endif
#include "RGB.pb-c.h"
+#include "dispenser.pb-c.h"
typedef struct _Segment Segment;
@@ -31,10 +32,12 @@ struct _Segment
protobuf_c_boolean has_length;
int32_t length;
RGB *color;
+ size_t n_dispenser;
+ Dispense **dispenser;
};
#define SEGMENT__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&segment__descriptor) \
- , NULL, 0, 0, NULL }
+ , NULL, 0, 0, NULL, 0,NULL }
/* Segment methods */
diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/dispenser.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/dispenser.pb-c.c
new file mode 100644
index 000000000..165436be2
--- /dev/null
+++ b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/dispenser.pb-c.c
@@ -0,0 +1,201 @@
+/* Generated by the protocol buffer compiler. DO NOT EDIT! */
+/* Generated from: dispenser.proto */
+
+/* Do not generate deprecated warnings for self */
+#ifndef PROTOBUF_C__NO_DEPRECATED
+#define PROTOBUF_C__NO_DEPRECATED
+#endif
+
+#include "dispenser.pb-c.h"
+void gradient_flow__init
+ (GradientFlow *message)
+{
+ static const GradientFlow init_value = GRADIENT_FLOW__INIT;
+ *message = init_value;
+}
+size_t gradient_flow__get_packed_size
+ (const GradientFlow *message)
+{
+ assert(message->base.descriptor == &gradient_flow__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t gradient_flow__pack
+ (const GradientFlow *message,
+ uint8_t *out)
+{
+ assert(message->base.descriptor == &gradient_flow__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t gradient_flow__pack_to_buffer
+ (const GradientFlow *message,
+ ProtobufCBuffer *buffer)
+{
+ assert(message->base.descriptor == &gradient_flow__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+GradientFlow *
+ gradient_flow__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (GradientFlow *)
+ protobuf_c_message_unpack (&gradient_flow__descriptor,
+ allocator, len, data);
+}
+void gradient_flow__free_unpacked
+ (GradientFlow *message,
+ ProtobufCAllocator *allocator)
+{
+ if(!message)
+ return;
+ assert(message->base.descriptor == &gradient_flow__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void dispense__init
+ (Dispense *message)
+{
+ static const Dispense init_value = DISPENSE__INIT;
+ *message = init_value;
+}
+size_t dispense__get_packed_size
+ (const Dispense *message)
+{
+ assert(message->base.descriptor == &dispense__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t dispense__pack
+ (const Dispense *message,
+ uint8_t *out)
+{
+ assert(message->base.descriptor == &dispense__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t dispense__pack_to_buffer
+ (const Dispense *message,
+ ProtobufCBuffer *buffer)
+{
+ assert(message->base.descriptor == &dispense__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Dispense *
+ dispense__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (Dispense *)
+ protobuf_c_message_unpack (&dispense__descriptor,
+ allocator, len, data);
+}
+void dispense__free_unpacked
+ (Dispense *message,
+ ProtobufCAllocator *allocator)
+{
+ if(!message)
+ return;
+ assert(message->base.descriptor == &dispense__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+static const ProtobufCFieldDescriptor gradient_flow__field_descriptors[1] =
+{
+ {
+ "NLflow",
+ 1,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_DOUBLE,
+ offsetof(GradientFlow, has_nlflow),
+ offsetof(GradientFlow, nlflow),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned gradient_flow__field_indices_by_name[] = {
+ 0, /* field[0] = NLflow */
+};
+static const ProtobufCIntRange gradient_flow__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 1 }
+};
+const ProtobufCMessageDescriptor gradient_flow__descriptor =
+{
+ PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
+ "gradientFlow",
+ "GradientFlow",
+ "GradientFlow",
+ "",
+ sizeof(GradientFlow),
+ 1,
+ gradient_flow__field_descriptors,
+ gradient_flow__field_indices_by_name,
+ 1, gradient_flow__number_ranges,
+ (ProtobufCMessageInit) gradient_flow__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor dispense__field_descriptors[3] =
+{
+ {
+ "Id",
+ 1,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_INT32,
+ offsetof(Dispense, has_id),
+ offsetof(Dispense, id),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "startFlow",
+ 2,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_DOUBLE,
+ offsetof(Dispense, has_startflow),
+ offsetof(Dispense, startflow),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "gradient",
+ 3,
+ PROTOBUF_C_LABEL_REPEATED,
+ PROTOBUF_C_TYPE_MESSAGE,
+ offsetof(Dispense, n_gradient),
+ offsetof(Dispense, gradient),
+ &gradient_flow__descriptor,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned dispense__field_indices_by_name[] = {
+ 0, /* field[0] = Id */
+ 2, /* field[2] = gradient */
+ 1, /* field[1] = startFlow */
+};
+static const ProtobufCIntRange dispense__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 3 }
+};
+const ProtobufCMessageDescriptor dispense__descriptor =
+{
+ PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
+ "Dispense",
+ "Dispense",
+ "Dispense",
+ "",
+ sizeof(Dispense),
+ 3,
+ dispense__field_descriptors,
+ dispense__field_indices_by_name,
+ 1, dispense__number_ranges,
+ (ProtobufCMessageInit) dispense__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/dispenser.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/dispenser.pb-c.h
new file mode 100644
index 000000000..2027dace0
--- /dev/null
+++ b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/dispenser.pb-c.h
@@ -0,0 +1,111 @@
+/* Generated by the protocol buffer compiler. DO NOT EDIT! */
+/* Generated from: dispenser.proto */
+
+#ifndef PROTOBUF_C_dispenser_2eproto__INCLUDED
+#define PROTOBUF_C_dispenser_2eproto__INCLUDED
+
+#include <protobuf-c/protobuf-c.h>
+
+PROTOBUF_C__BEGIN_DECLS
+
+#if PROTOBUF_C_VERSION_NUMBER < 1003000
+# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
+#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION
+# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
+#endif
+
+
+typedef struct _GradientFlow GradientFlow;
+typedef struct _Dispense Dispense;
+
+
+/* --- enums --- */
+
+
+/* --- messages --- */
+
+struct _GradientFlow
+{
+ ProtobufCMessage base;
+ protobuf_c_boolean has_nlflow;
+ double nlflow;
+};
+#define GRADIENT_FLOW__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&gradient_flow__descriptor) \
+ , 0, 0 }
+
+
+struct _Dispense
+{
+ ProtobufCMessage base;
+ protobuf_c_boolean has_id;
+ int32_t id;
+ protobuf_c_boolean has_startflow;
+ double startflow;
+ size_t n_gradient;
+ GradientFlow **gradient;
+};
+#define DISPENSE__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&dispense__descriptor) \
+ , 0, 0, 0, 0, 0,NULL }
+
+
+/* GradientFlow methods */
+void gradient_flow__init
+ (GradientFlow *message);
+size_t gradient_flow__get_packed_size
+ (const GradientFlow *message);
+size_t gradient_flow__pack
+ (const GradientFlow *message,
+ uint8_t *out);
+size_t gradient_flow__pack_to_buffer
+ (const GradientFlow *message,
+ ProtobufCBuffer *buffer);
+GradientFlow *
+ gradient_flow__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void gradient_flow__free_unpacked
+ (GradientFlow *message,
+ ProtobufCAllocator *allocator);
+/* Dispense methods */
+void dispense__init
+ (Dispense *message);
+size_t dispense__get_packed_size
+ (const Dispense *message);
+size_t dispense__pack
+ (const Dispense *message,
+ uint8_t *out);
+size_t dispense__pack_to_buffer
+ (const Dispense *message,
+ ProtobufCBuffer *buffer);
+Dispense *
+ dispense__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void dispense__free_unpacked
+ (Dispense *message,
+ ProtobufCAllocator *allocator);
+/* --- per-message closures --- */
+
+typedef void (*GradientFlow_Closure)
+ (const GradientFlow *message,
+ void *closure_data);
+typedef void (*Dispense_Closure)
+ (const Dispense *message,
+ void *closure_data);
+
+/* --- services --- */
+
+
+/* --- descriptors --- */
+
+extern const ProtobufCMessageDescriptor gradient_flow__descriptor;
+extern const ProtobufCMessageDescriptor dispense__descriptor;
+
+PROTOBUF_C__END_DECLS
+
+
+#endif /* PROTOBUF_C_dispenser_2eproto__INCLUDED */
diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/motor.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/motor.pb-c.c
new file mode 100644
index 000000000..9c219010d
--- /dev/null
+++ b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/motor.pb-c.c
@@ -0,0 +1,293 @@
+/* Generated by the protocol buffer compiler. DO NOT EDIT! */
+/* Generated from: motor.proto */
+
+/* Do not generate deprecated warnings for self */
+#ifndef PROTOBUF_C__NO_DEPRECATED
+#define PROTOBUF_C__NO_DEPRECATED
+#endif
+
+#include "motor.pb-c.h"
+void motor_config__init
+ (MotorConfig *message)
+{
+ static const MotorConfig init_value = MOTOR_CONFIG__INIT;
+ *message = init_value;
+}
+size_t motor_config__get_packed_size
+ (const MotorConfig *message)
+{
+ assert(message->base.descriptor == &motor_config__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t motor_config__pack
+ (const MotorConfig *message,
+ uint8_t *out)
+{
+ assert(message->base.descriptor == &motor_config__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t motor_config__pack_to_buffer
+ (const MotorConfig *message,
+ ProtobufCBuffer *buffer)
+{
+ assert(message->base.descriptor == &motor_config__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+MotorConfig *
+ motor_config__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (MotorConfig *)
+ protobuf_c_message_unpack (&motor_config__descriptor,
+ allocator, len, data);
+}
+void motor_config__free_unpacked
+ (MotorConfig *message,
+ ProtobufCAllocator *allocator)
+{
+ if(!message)
+ return;
+ assert(message->base.descriptor == &motor_config__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+static const ProtobufCFieldDescriptor motor_config__field_descriptors[14] =
+{
+ {
+ "Id",
+ 1,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_ENUM,
+ offsetof(MotorConfig, has_id),
+ offsetof(MotorConfig, id),
+ &motor_id__descriptor,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "minfreq",
+ 2,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_UINT32,
+ offsetof(MotorConfig, has_minfreq),
+ offsetof(MotorConfig, minfreq),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "maxfreq",
+ 3,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_UINT32,
+ offsetof(MotorConfig, has_maxfreq),
+ offsetof(MotorConfig, maxfreq),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "minmicrostep",
+ 4,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_UINT32,
+ offsetof(MotorConfig, has_minmicrostep),
+ offsetof(MotorConfig, minmicrostep),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "maxmicrostep",
+ 5,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_UINT32,
+ offsetof(MotorConfig, has_maxmicrostep),
+ offsetof(MotorConfig, maxmicrostep),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "linearratio",
+ 6,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_DOUBLE,
+ offsetof(MotorConfig, has_linearratio),
+ offsetof(MotorConfig, linearratio),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "medianposition",
+ 7,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_UINT32,
+ offsetof(MotorConfig, has_medianposition),
+ offsetof(MotorConfig, medianposition),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "correctiongain",
+ 8,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_DOUBLE,
+ offsetof(MotorConfig, has_correctiongain),
+ offsetof(MotorConfig, correctiongain),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "ration2dryerspd",
+ 9,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_DOUBLE,
+ offsetof(MotorConfig, has_ration2dryerspd),
+ offsetof(MotorConfig, ration2dryerspd),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "Kp",
+ 10,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_DOUBLE,
+ offsetof(MotorConfig, has_kp),
+ offsetof(MotorConfig, kp),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "Ki",
+ 11,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_DOUBLE,
+ offsetof(MotorConfig, has_ki),
+ offsetof(MotorConfig, ki),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "Kd",
+ 12,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_DOUBLE,
+ offsetof(MotorConfig, has_kd),
+ offsetof(MotorConfig, kd),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "changeSlope",
+ 13,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_DOUBLE,
+ offsetof(MotorConfig, has_changeslope),
+ offsetof(MotorConfig, changeslope),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "hightimeoutmSec",
+ 14,
+ PROTOBUF_C_LABEL_OPTIONAL,
+ PROTOBUF_C_TYPE_DOUBLE,
+ offsetof(MotorConfig, has_hightimeoutmsec),
+ offsetof(MotorConfig, hightimeoutmsec),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned motor_config__field_indices_by_name[] = {
+ 0, /* field[0] = Id */
+ 11, /* field[11] = Kd */
+ 10, /* field[10] = Ki */
+ 9, /* field[9] = Kp */
+ 12, /* field[12] = changeSlope */
+ 7, /* field[7] = correctiongain */
+ 13, /* field[13] = hightimeoutmSec */
+ 5, /* field[5] = linearratio */
+ 2, /* field[2] = maxfreq */
+ 4, /* field[4] = maxmicrostep */
+ 6, /* field[6] = medianposition */
+ 1, /* field[1] = minfreq */
+ 3, /* field[3] = minmicrostep */
+ 8, /* field[8] = ration2dryerspd */
+};
+static const ProtobufCIntRange motor_config__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 14 }
+};
+const ProtobufCMessageDescriptor motor_config__descriptor =
+{
+ PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
+ "MotorConfig",
+ "MotorConfig",
+ "MotorConfig",
+ "",
+ sizeof(MotorConfig),
+ 14,
+ motor_config__field_descriptors,
+ motor_config__field_indices_by_name,
+ 1, motor_config__number_ranges,
+ (ProtobufCMessageInit) motor_config__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+static const ProtobufCEnumValue motor_id__enum_values_by_number[4] =
+{
+ { "Feeder", "MOTOR_ID__Feeder", 0 },
+ { "Dryer", "MOTOR_ID__Dryer", 1 },
+ { "Pooler", "MOTOR_ID__Pooler", 2 },
+ { "Winder", "MOTOR_ID__Winder", 3 },
+};
+static const ProtobufCIntRange motor_id__value_ranges[] = {
+{0, 0},{0, 4}
+};
+static const ProtobufCEnumValueIndex motor_id__enum_values_by_name[4] =
+{
+ { "Dryer", 1 },
+ { "Feeder", 0 },
+ { "Pooler", 2 },
+ { "Winder", 3 },
+};
+const ProtobufCEnumDescriptor motor_id__descriptor =
+{
+ PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC,
+ "MotorId",
+ "MotorId",
+ "MotorId",
+ "",
+ 4,
+ motor_id__enum_values_by_number,
+ 4,
+ motor_id__enum_values_by_name,
+ 1,
+ motor_id__value_ranges,
+ NULL,NULL,NULL,NULL /* reserved[1234] */
+};
diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/motor.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/motor.pb-c.h
new file mode 100644
index 000000000..1266d57d1
--- /dev/null
+++ b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/motor.pb-c.h
@@ -0,0 +1,106 @@
+/* Generated by the protocol buffer compiler. DO NOT EDIT! */
+/* Generated from: motor.proto */
+
+#ifndef PROTOBUF_C_motor_2eproto__INCLUDED
+#define PROTOBUF_C_motor_2eproto__INCLUDED
+
+#include <protobuf-c/protobuf-c.h>
+
+PROTOBUF_C__BEGIN_DECLS
+
+#if PROTOBUF_C_VERSION_NUMBER < 1003000
+# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
+#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION
+# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
+#endif
+
+
+typedef struct _MotorConfig MotorConfig;
+
+
+/* --- enums --- */
+
+typedef enum _MotorId {
+ MOTOR_ID__Feeder = 0,
+ MOTOR_ID__Dryer = 1,
+ MOTOR_ID__Pooler = 2,
+ MOTOR_ID__Winder = 3
+ PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(MOTOR_ID)
+} MotorId;
+
+/* --- messages --- */
+
+struct _MotorConfig
+{
+ ProtobufCMessage base;
+ protobuf_c_boolean has_id;
+ MotorId id;
+ protobuf_c_boolean has_minfreq;
+ uint32_t minfreq;
+ protobuf_c_boolean has_maxfreq;
+ uint32_t maxfreq;
+ protobuf_c_boolean has_minmicrostep;
+ uint32_t minmicrostep;
+ protobuf_c_boolean has_maxmicrostep;
+ uint32_t maxmicrostep;
+ protobuf_c_boolean has_linearratio;
+ double linearratio;
+ protobuf_c_boolean has_medianposition;
+ uint32_t medianposition;
+ protobuf_c_boolean has_correctiongain;
+ double correctiongain;
+ protobuf_c_boolean has_ration2dryerspd;
+ double ration2dryerspd;
+ protobuf_c_boolean has_kp;
+ double kp;
+ protobuf_c_boolean has_ki;
+ double ki;
+ protobuf_c_boolean has_kd;
+ double kd;
+ protobuf_c_boolean has_changeslope;
+ double changeslope;
+ protobuf_c_boolean has_hightimeoutmsec;
+ double hightimeoutmsec;
+};
+#define MOTOR_CONFIG__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&motor_config__descriptor) \
+ , 0, MOTOR_ID__Feeder, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+
+
+/* MotorConfig methods */
+void motor_config__init
+ (MotorConfig *message);
+size_t motor_config__get_packed_size
+ (const MotorConfig *message);
+size_t motor_config__pack
+ (const MotorConfig *message,
+ uint8_t *out);
+size_t motor_config__pack_to_buffer
+ (const MotorConfig *message,
+ ProtobufCBuffer *buffer);
+MotorConfig *
+ motor_config__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void motor_config__free_unpacked
+ (MotorConfig *message,
+ ProtobufCAllocator *allocator);
+/* --- per-message closures --- */
+
+typedef void (*MotorConfig_Closure)
+ (const MotorConfig *message,
+ void *closure_data);
+
+/* --- services --- */
+
+
+/* --- descriptors --- */
+
+extern const ProtobufCEnumDescriptor motor_id__descriptor;
+extern const ProtobufCMessageDescriptor motor_config__descriptor;
+
+PROTOBUF_C__END_DECLS
+
+
+#endif /* PROTOBUF_C_motor_2eproto__INCLUDED */
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf
index e53774152..49a95608c 100644
--- a/Software/DB/Tango.mdf
+++ b/Software/DB/Tango.mdf
Binary files differ
diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf
index 4321ccedd..0eade8be1 100644
--- a/Software/DB/Tango_log.ldf
+++ b/Software/DB/Tango_log.ldf
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/DirectSynchronizationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/DirectSynchronizationView.xaml
index ba0530ca6..39c21e3f5 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/DirectSynchronizationView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/DirectSynchronizationView.xaml
@@ -175,7 +175,7 @@
</GroupBox>
</Grid>
- <Grid Grid.Row="1" Visibility="{Binding ApplicationManager.IsMachineConnected,Converter={StaticResource BooleanToVisibilityInverseConverter}}">
+ <Grid Grid.Row="1" Visibility="{Binding ApplicationManager.IsMachineConnectedViaTCP,Converter={StaticResource BooleanToVisibilityInverseConverter}}">
<Grid.Background>
<SolidColorBrush Color="White" Opacity="0.8"></SolidColorBrush>
</Grid.Background>
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 3297f9374..42f4f7b65 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs
@@ -13,5 +13,6 @@ namespace Tango.MachineStudio.Common.StudioApplication
void ShutDown();
IExternalBridgeClient ConnectedMachine { get; set; }
bool IsMachineConnected { get; }
+ bool IsMachineConnectedViaTCP { get; }
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml
index 963b9eb8b..f07e7f476 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml
@@ -8,7 +8,7 @@
xmlns:views="clr-namespace:Tango.MachineStudio.UI.Views"
xmlns:sharedControls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
mc:Ignorable="d"
- Title="Tango" Height="720" Width="1280" WindowStartupLocation="CenterOwner" WindowState="Maximized">
+ Title="Tango" Height="720" Width="1280" WindowStartupLocation="CenterOwner" WindowState="Maximized" Foreground="#494949">
<Grid>
<sharedControls:MultiTransitionControl AlwaysFade="True" TransitionType="Zoom" x:Name="TransitionControl" x:FieldModifier="public">
<sharedControls:MultiTransitionControl.Controls>
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 336681801..de8649c13 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs
@@ -38,6 +38,7 @@ namespace Tango.MachineStudio.UI.StudioApplication
_connectedMachine = value;
RaisePropertyChangedAuto();
RaisePropertyChanged(nameof(IsMachineConnected));
+ RaisePropertyChanged(nameof(IsMachineConnectedViaTCP));
if (_connectedMachine != null)
{
@@ -47,6 +48,11 @@ namespace Tango.MachineStudio.UI.StudioApplication
}
}
+ public bool IsMachineConnectedViaTCP
+ {
+ get { return IsMachineConnected && ConnectedMachine.Type != ExternalBridgeClientType.USB; }
+ }
+
private void ConnectedMachine_StateChanged(object sender, Transport.TransportComponentState e)
{
if (e == Transport.TransportComponentState.Disconnected || e == Transport.TransportComponentState.Failed)
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 061420037..f2beb7113 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -139,26 +139,48 @@ namespace Tango.MachineStudio.UI.ViewModels
private void ConnectToMachine()
{
- _notificationProvider.ShowModalDialog<MachineConnectionViewVM>((x) =>
+ _notificationProvider.ShowModalDialog<MachineConnectionViewVM>(async (x) =>
{
if (x.SelectedMachine != null)
{
- _notificationProvider.ShowModalDialog<MachineLoginViewVM>(async (login) =>
+ if (x.SelectedMachine.Type != Integration.Services.ExternalBridgeClientType.USB)
{
- using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.SerialNumber + "..."))
+ _notificationProvider.ShowModalDialog<MachineLoginViewVM>(async (login) =>
{
- try
+ using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.SerialNumber + "..."))
{
- await x.SelectedMachine.Connect();
- var authenticated = await x.SelectedMachine.Authenticate(login.Password);
- if (!authenticated)
+ try
{
- _notificationProvider.ShowError("It seems like you are not authorized to access the selected machine.");
+ await x.SelectedMachine.Connect();
+
+ var authenticated = await x.SelectedMachine.Authenticate(login.Password);
+ if (!authenticated)
+ {
+ _notificationProvider.ShowError("It seems like you are not authorized to access the selected machine.");
+ }
+ else
+ {
+ ApplicationManager.ConnectedMachine = x.SelectedMachine;
+ }
}
- else
+ catch (Exception ex)
{
- ApplicationManager.ConnectedMachine = x.SelectedMachine;
+ LogManager.Log(ex);
+ _notificationProvider.ShowError(ex.Message);
}
+
+ InvalidateRelayCommands();
+ }
+ });
+ }
+ else
+ {
+ using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.Device + "..."))
+ {
+ try
+ {
+ await x.SelectedMachine.Connect();
+ ApplicationManager.ConnectedMachine = x.SelectedMachine;
}
catch (Exception ex)
{
@@ -168,7 +190,7 @@ namespace Tango.MachineStudio.UI.ViewModels
InvalidateRelayCommands();
}
- });
+ }
InvalidateRelayCommands();
}
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 32108c652..8f03202a1 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml
@@ -54,20 +54,54 @@
<ListBox ItemsSource="{Binding Scanner.AvailableMachines}" SelectedItem="{Binding SelectedMachine}" Margin="0 0 0 7" BorderThickness="1" BorderBrush="Gainsboro">
<ListBox.ItemTemplate>
<DataTemplate>
- <StackPanel Orientation="Horizontal">
- <Image Source="/Images/machine-trans.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image>
- <StackPanel Margin="10 0 0 0">
- <TextBlock FontSize="11">
+ <Grid>
+ <StackPanel Orientation="Horizontal">
+ <StackPanel.Style>
+ <Style TargetType="StackPanel">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Type}" Value="USB">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </StackPanel.Style>
+ <Image Source="/Images/machine-trans.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image>
+ <StackPanel Margin="10 0 0 0">
+ <TextBlock FontSize="11">
<Run FontWeight="Bold">S/N:</Run> <Run Text="{Binding SerialNumber,Mode=OneWay}"></Run>
- </TextBlock>
- <TextBlock FontSize="11">
+ </TextBlock>
+ <TextBlock FontSize="11">
<Run FontWeight="Bold">IP Address:</Run> <Run Text="{Binding IPAddress,Mode=OneWay}"></Run>
- </TextBlock>
- <TextBlock FontSize="11">
+ </TextBlock>
+ <TextBlock FontSize="11">
<Run FontWeight="Bold">Organization:</Run> <Run Text="{Binding Organization,Mode=OneWay}"></Run>
- </TextBlock>
+ </TextBlock>
+ </StackPanel>
</StackPanel>
- </StackPanel>
+
+ <StackPanel Orientation="Horizontal">
+ <StackPanel.Style>
+ <Style TargetType="StackPanel">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Type}" Value="USB">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </StackPanel.Style>
+ <Image Source="/Images/machine-trans.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image>
+ <StackPanel Margin="10 0 0 0">
+ <TextBlock FontSize="11">
+ <Run FontWeight="Bold">Port:</Run> <Run Text="{Binding ComPort,Mode=OneWay}"></Run>
+ </TextBlock>
+ <TextBlock FontSize="11">
+ <Run FontWeight="Bold">Device:</Run> <Run Text="{Binding Device,Mode=OneWay}"></Run>
+ </TextBlock>
+ </StackPanel>
+ </StackPanel>
+ </Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
diff --git a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs
index aec9c0db0..213ad7cb6 100644
--- a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs
+++ b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs
@@ -37,6 +37,22 @@ namespace Tango.Integration.Services
set { _ipAddress = value; RaisePropertyChangedAuto(); }
}
+ private String _comPort;
+
+ public String ComPort
+ {
+ get { return _comPort; }
+ set { _comPort = value; RaisePropertyChangedAuto(); }
+ }
+
+ private String _Device;
+
+ public String Device
+ {
+ get { return _Device; }
+ set { _Device = value; RaisePropertyChangedAuto(); }
+ }
+
private String _organization;
public String Organization
@@ -45,10 +61,27 @@ namespace Tango.Integration.Services
private set { _organization = value; RaisePropertyChangedAuto(); }
}
+ private ExternalBridgeClientType _type;
+
+ public ExternalBridgeClientType Type
+ {
+ get { return _type; }
+ internal set { _type = value; RaisePropertyChangedAuto(); }
+ }
+
+
public override async Task Connect()
{
await Disconnect();
- Adapter = new TcpTransportAdapter(IPAddress, SettingsManager.Default.Integration.ExternalBridgeServicePort);
+
+ if (Type == ExternalBridgeClientType.TCP)
+ {
+ Adapter = new TcpTransportAdapter(IPAddress, SettingsManager.Default.Integration.ExternalBridgeServicePort);
+ }
+ else if (Type == ExternalBridgeClientType.USB)
+ {
+ Adapter = new UsbTransportAdapter(ComPort);
+ }
await base.Connect();
}
@@ -58,11 +91,20 @@ namespace Tango.Integration.Services
return response.Message.Authenticated;
}
- public ExternalBridgeClient(String serialNumber,String ipAddress)
+ public ExternalBridgeClient(String serialNumber, String ipAddress)
{
SerialNumber = serialNumber;
IPAddress = ipAddress;
UseKeepAlive = true;
+ Type = ExternalBridgeClientType.TCP;
+ }
+
+ public ExternalBridgeClient(String comPort, String device, String putNull)
+ {
+ ComPort = comPort;
+ Device = device;
+ UseKeepAlive = false;
+ Type = ExternalBridgeClientType.USB;
}
}
}
diff --git a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs
index c17b64cfd..cf225265a 100644
--- a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs
+++ b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs
@@ -24,6 +24,7 @@ namespace Tango.Integration.Services
public class ExternalBridgeScanner : ExtendedObject
{
private Thread _discoveryThread;
+ private Thread _usbThread;
private ObservableCollection<IExternalBridgeClient> _availableMachines;
/// <summary>
@@ -63,27 +64,39 @@ namespace Tango.Integration.Services
_discoveryThread = new Thread(DiscoveryThreadMethod);
_discoveryThread.IsBackground = true;
_discoveryThread.Start();
+
+ _usbThread = new Thread(UsbThreadMethod);
+ _usbThread.IsBackground = true;
+ _usbThread.Start();
}
}
- /// <summary>
- /// Scans the USB.
- /// </summary>
- public void ScanUSB()
+ private void UsbThreadMethod()
{
- using (var searcher = new ManagementObjectSearcher("SELECT * FROM WIN32_SerialPort"))
+ while (!IsStarted)
{
- string[] portnames = SerialPort.GetPortNames();
- var ports = searcher.Get().Cast<ManagementBaseObject>().ToList();
+ using (var searcher = new ManagementObjectSearcher("SELECT * FROM WIN32_SerialPort"))
+ {
+ string[] portnames = SerialPort.GetPortNames();
+ var ports = searcher.Get().Cast<ManagementBaseObject>().ToList();
- var tList = (from n in portnames
- join p in ports on n equals p["DeviceID"].ToString()
- select n + " - " + p["Caption"]).ToList();
+ var devices = (from n in portnames
+ join p in ports on n equals p["DeviceID"].ToString()
+ select new KeyValuePair<String, String>(n, p["Caption"].ToStringSafe())).ToList();
- foreach (string s in tList)
- {
- AvailableMachines.Add(new ExternalBridgeClient(null, null));
+ foreach (var device in devices)
+ {
+ if (!AvailableMachines.ToList().Exists(x => x.ComPort == device.Key))
+ {
+ ThreadsHelper.InvokeUINow(() =>
+ {
+ AvailableMachines.Add(new ExternalBridgeClient(device.Key, device.Value, null));
+ });
+ }
+ }
}
+
+ Thread.Sleep(2000);
}
}
diff --git a/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeClient.cs b/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeClient.cs
index c5cb1d378..573a9d07c 100644
--- a/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeClient.cs
+++ b/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeClient.cs
@@ -17,6 +17,12 @@ namespace Tango.Integration.Services
String IPAddress { get; set; }
+ ExternalBridgeClientType Type { get; }
+
+ String ComPort { get; }
+
+ String Device { get; }
+
Task<bool> Authenticate(String password);
}
}
diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs
index 2e25d5bf1..a08bb1932 100644
--- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs
+++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs
@@ -428,7 +428,7 @@ namespace Tango.Transport
}
}
- Thread.Sleep(10);
+ Thread.Sleep(2);
}
}
catch (Exception ex)
@@ -547,7 +547,7 @@ namespace Tango.Transport
}
}
- Thread.Sleep(10);
+ Thread.Sleep(2);
}
}
catch (Exception ex)