diff options
| author | Roy <roy.mail.net@gmail.com> | 2017-12-24 02:27:16 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2017-12-24 02:27:16 +0200 |
| commit | 53db041e636bb3802dbe3cb911de6ef6ef41446c (patch) | |
| tree | 9be0b0961a31fea4a60f5a9c1741363fa313a13b /Software | |
| parent | ceac40d058a8554638aa3fa39d4697f3fbfe62f8 (diff) | |
| download | Tango-53db041e636bb3802dbe3cb911de6ef6ef41446c.tar.gz Tango-53db041e636bb3802dbe3cb911de6ef6ef41446c.zip | |
Continue for last commit.
Diffstat (limited to 'Software')
95 files changed, 3988 insertions, 278 deletions
diff --git a/Software/Android_Studio/Tango.DAL/src/main/res/raw/tangodb b/Software/Android_Studio/Tango.DAL/src/main/res/raw/tangodb Binary files differindex 00c79da9c..0419b065c 100644 --- a/Software/Android_Studio/Tango.DAL/src/main/res/raw/tangodb +++ b/Software/Android_Studio/Tango.DAL/src/main/res/raw/tangodb diff --git a/Software/Android_Studio/Tango.Integration/build.gradle b/Software/Android_Studio/Tango.Integration/build.gradle index dc482d641..255fce0f6 100644 --- a/Software/Android_Studio/Tango.Integration/build.gradle +++ b/Software/Android_Studio/Tango.Integration/build.gradle @@ -43,4 +43,8 @@ dependencies { compile globalDependencies.dagger compile globalDependencies.daggerAndroid implementation project(':Tango.PMR') + implementation project(':Tango.Transport') + implementation project(':Tango.Core') + implementation project(':Tango.DAL') + implementation project(':Tango.Web') } diff --git a/Software/Android_Studio/Tango.Integration/src/main/AndroidManifest.xml b/Software/Android_Studio/Tango.Integration/src/main/AndroidManifest.xml index b57dcb665..81958ad3d 100644 --- a/Software/Android_Studio/Tango.Integration/src/main/AndroidManifest.xml +++ b/Software/Android_Studio/Tango.Integration/src/main/AndroidManifest.xml @@ -2,5 +2,6 @@ package="com.twine.tango.integration"> <uses-permission android:name="android.permission.INTERNET"/> + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> </manifest> diff --git a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/operators/IMachineOperator.java b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/operators/IMachineOperator.java index 7d69ce8ad..9963f295b 100644 --- a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/operators/IMachineOperator.java +++ b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/operators/IMachineOperator.java @@ -1,9 +1,12 @@ package com.twine.tango.integration.operators; +import com.twine.tango.transport.ITransporter; + /** * Created by Roy on 12/23/2017. */ -public interface IMachineOperator +public interface IMachineOperator extends ITransporter { + } diff --git a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/operators/MachineOperator.java b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/operators/MachineOperator.java index 0eb73cab3..f23c8c705 100644 --- a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/operators/MachineOperator.java +++ b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/operators/MachineOperator.java @@ -1,9 +1,20 @@ package com.twine.tango.integration.operators; +import com.twine.tango.transport.ITransportAdapter; +import com.twine.tango.transport.transporters.ProtoTransporter; + /** * Created by Roy on 12/23/2017. */ -public class MachineOperator +public class MachineOperator extends ProtoTransporter implements IMachineOperator { + public MachineOperator() + { + } + + public MachineOperator(ITransportAdapter adapter) + { + super(adapter); + } } diff --git a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/providers/IMachineIdentityProvider.java b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/providers/IMachineIdentityProvider.java index 3e35be9d0..547a17e50 100644 --- a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/providers/IMachineIdentityProvider.java +++ b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/providers/IMachineIdentityProvider.java @@ -1,4 +1,4 @@ -package com.twine.tango.integration; +package com.twine.tango.integration.providers; /** diff --git a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/providers/MachineIdentityProvider.java b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/providers/MachineIdentityProvider.java index 29cb0c30c..b4f2d3c4d 100644 --- a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/providers/MachineIdentityProvider.java +++ b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/providers/MachineIdentityProvider.java @@ -1,4 +1,4 @@ -package com.twine.tango.integration; +package com.twine.tango.integration.providers; /** diff --git a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/ExternalBridgeService.java b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/ExternalBridgeService.java index f1702ee9e..709d5a271 100644 --- a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/ExternalBridgeService.java +++ b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/ExternalBridgeService.java @@ -1,35 +1,60 @@ package com.twine.tango.integration.services; +import android.content.Context; +import android.net.DhcpInfo; +import android.net.wifi.WifiManager; +import android.os.StrictMode; import android.os.SystemClock; +import android.provider.SyncStateContract.Constants; +import android.util.Log; import com.elvishew.xlog.XLog; +import com.google.protobuf.GeneratedMessageV3; +import com.twine.tango.core.ContextHelper; import com.twine.tango.core.IEventHandler; +import com.twine.tango.integration.operators.IMachineOperator; +import com.twine.tango.integration.providers.IMachineIdentityProvider; import com.twine.tango.pmr.MessageFactory; +import com.twine.tango.pmr.TangoMessage; import com.twine.tango.pmr.common.MessageContainerOuterClass.MessageContainer; import com.twine.tango.pmr.common.MessageTypeOuterClass.MessageType; +import com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket; +import com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest; +import com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse; +import com.twine.tango.transport.ITransportAdapter; import com.twine.tango.transport.adapters.TcpTransportAdapter; import com.twine.tango.transport.transporters.ProtoTransporter; import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + import static br.com.zbra.androidlinq.Linq.stream; /** * Created by Roy on 12/22/2017. */ -public class TangoBridgeService extends ProtoTransporter implements ITangoBridgeService +public class ExternalBridgeService extends ProtoTransporter implements IExternalBridgeService { private ServerSocket listener; private boolean isStarted; private List<HandlerAndType> handlers; + private IMachineIdentityProvider identityProvider; + private IMachineOperator machineOperator; - public TangoBridgeService() + @Inject + public ExternalBridgeService(IMachineIdentityProvider identityProvider, IMachineOperator machineOperator) { + this.identityProvider = identityProvider; + this.machineOperator = machineOperator; handlers = new ArrayList<>(); } @@ -43,8 +68,63 @@ public class TangoBridgeService extends ProtoTransporter implements ITangoBridge public void start() throws IOException { listener = new ServerSocket(1984); + isStarted = true; Thread listenerThread = new Thread(this::listenerThreadMethod); + Thread discoveryThread = new Thread(this::discoveryThreadMethod); listenerThread.start(); + discoveryThread.start(); + } + + private void discoveryThreadMethod() + { + // Hack Prevent crash (sending should be done using an async task) + StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); + StrictMode.setThreadPolicy(policy); + + byte[] packet = ExternalBridgeUdpDiscoveryPacket.newBuilder().setSerialNumber(identityProvider.getSerialNumber()).build().toByteArray(); + + while (isStarted) + { + try + { + DatagramSocket socket = new DatagramSocket(); + socket.setBroadcast(true); + + //First try to send to emulator host... + DatagramPacket sendPacket = new DatagramPacket(packet, packet.length, InetAddress.getByName("10.0.2.2"), 8888); + socket.send(sendPacket); + + //This will not work on the emulator as far as I know. + //TODO: This needs to be tested on a real device! + sendPacket = new DatagramPacket(packet, packet.length, InetAddress.getByName("255.255.255.255"), 8888); + socket.send(sendPacket); + + } catch (IOException e) + { + XLog.e(e); + } + + SystemClock.sleep(5000); + } + } + + private InetAddress getBroadcastAddress() throws IOException + { + WifiManager wifi = (WifiManager) ContextHelper.getApplicationContext().getSystemService(Context.WIFI_SERVICE); + assert wifi != null; + DhcpInfo dhcp = wifi.getDhcpInfo(); + + if (dhcp != null) + { + int broadcast = (dhcp.ipAddress & dhcp.netmask) | ~dhcp.netmask; + byte[] quads = new byte[4]; + for (int k = 0; k < 4; k++) + quads[k] = (byte) ((broadcast >> k * 8) & 0xFF); + return InetAddress.getByAddress(quads); + } else + { + return null; + } } @Override @@ -86,37 +166,98 @@ public class TangoBridgeService extends ProtoTransporter implements ITangoBridge if (newSocket != null) { + for (ITransportAdapter adapter : getAdapters()) + { + adapter.disconnect().blockingAwait(); + } getAdapters().clear(); - getAdapters().add(new TcpTransportAdapter(newSocket)); - connect(); + TcpTransportAdapter adapter = new TcpTransportAdapter(newSocket); + adapter.setAuthenticated(false); + getAdapters().add(adapter); + connect().blockingAwait(); } } catch (IOException e) { - + XLog.e(e); } SystemClock.sleep(100); } + + disconnect().blockingAwait(); } @Override - protected void onRequestReceived(MessageContainer request) + protected void onRequestReceived(MessageContainer container) { - super.onRequestReceived(request); - + super.onRequestReceived(container); + try { - Object message = MessageFactory.parseMessageFromContainerAgnostic(request); - - List<HandlerAndType> receivers = stream(handlers).where((x) -> x.messageType == request.getType()).toList(); - - for (HandlerAndType receiver : receivers) + if (container.getType() == MessageType.ExternalClientLoginRequest) { - //noinspection unchecked - receiver.handler.invoke(this, message); + ExternalClientLoginRequest request = MessageFactory.parseMessageFromContainer(container); + if (request.getKey().equals("1234")) + { + getAdapters().get(0).setAuthenticated(true); + sendResponse(MessageFactory.createTangoMessage( + ExternalClientLoginResponse.class, + ExternalClientLoginResponse.newBuilder().setAuthenticated(true).build(), + container.getToken())); + } else + { + getAdapters().get(0).setAuthenticated(false); + sendResponse(MessageFactory.createTangoMessage( + ExternalClientLoginResponse.class, + ExternalClientLoginResponse.newBuilder().setAuthenticated(false).build(), + container.getToken())); + } + + return; } - + + if (getAdapters().get(0).isAuthenticated()) + { + GeneratedMessageV3 message = MessageFactory.parseMessageFromContainerAgnostic(container); + + List<HandlerAndType> receivers = stream(handlers).where((x) -> x.messageType == container.getType()).toList(); + + if (receivers.size() > 0) + { + for (HandlerAndType receiver : receivers) + { + //noinspection unchecked + receiver.handler.invoke(this, new MessageReceivedArgs(container, message)); + } + } else + { + //Route to machine... + if (container.getContinuous()) + { + machineOperator.sendContinuousRequest(MessageFactory.createTangoMessage(container, message)).subscribe((response) -> + { + sendResponse((TangoMessage<? extends GeneratedMessageV3>) response); + }, (ex) -> + { + + }); + } else + { + machineOperator.sendRequest(MessageFactory.createTangoMessage(container, message)).subscribe((response) -> + { + sendResponse((TangoMessage<? extends GeneratedMessageV3>) response); + }, (ex) -> + { + + }); + } + } + } else + { + XLog.w("Message received from an unauthorized adapter!"); + } + } catch (Exception e) { XLog.e(e); diff --git a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/IExternalBridgeService.java b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/IExternalBridgeService.java index 32abe3365..5a2aed9aa 100644 --- a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/IExternalBridgeService.java +++ b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/IExternalBridgeService.java @@ -11,7 +11,7 @@ import java.io.IOException; * Created by Roy on 12/22/2017. */ -public interface ITangoBridgeService extends ITransporter +public interface IExternalBridgeService extends ITransporter { boolean isStarted(); void start() throws IOException; diff --git a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/SynchronizationService.java b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/SynchronizationService.java index ed15c9b7b..0f3d98982 100644 --- a/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/SynchronizationService.java +++ b/Software/Android_Studio/Tango.Integration/src/main/java/com/twine/tango/integration/services/SynchronizationService.java @@ -29,7 +29,6 @@ public class SynchronizationService implements ISynchronizationService private IMachineIdentityProvider machineIdentityProvider; private IExternalBridgeService bridgeService; - /** * Instantiates a new Tango synchronizer. * @@ -40,7 +39,7 @@ public class SynchronizationService implements ISynchronizationService { this.machineIdentityProvider = machineIdentityProvider; this.bridgeService = bridgeService; - this.bridgeService.registerMessageHandler(this::handleCalculateRequest, MessageType.CalculateRequest); + //this.bridgeService.registerMessageHandler(this::handleCalculateRequest, MessageType.CalculateRequest); } private void handleCalculateRequest(Object o, MessageReceivedArgs<CalculateRequest> e) diff --git a/Software/Android_Studio/Tango.NativeBridge/build.gradle b/Software/Android_Studio/Tango.NativeBridge/build.gradle index 1454dd7ec..eaa5f5c3f 100644 --- a/Software/Android_Studio/Tango.NativeBridge/build.gradle +++ b/Software/Android_Studio/Tango.NativeBridge/build.gradle @@ -15,7 +15,6 @@ android { externalNativeBuild { cmake { cppFlags "-std=c++11 -frtti -fexceptions" - abiFilters "x86", "armeabi-v7a", "x86_64" } } } @@ -27,12 +26,6 @@ android { } } - sourceSets { - main { - jniLibs.srcDirs = ['libs'] - } - } - externalNativeBuild { cmake { path "CMakeLists.txt" diff --git a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/MessageFactory.java b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/MessageFactory.java index 55a0de4dd..413824e8d 100644 --- a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/MessageFactory.java +++ b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/MessageFactory.java @@ -1,6 +1,7 @@ package com.twine.tango.pmr; import com.elvishew.xlog.XLog; +import com.google.protobuf.GeneratedMessageV3; import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.Parser; import com.twine.tango.core.ReflectionsHelper; @@ -79,7 +80,7 @@ public class MessageFactory * @param typeName The inner message class. * @return New instance of {@link TangoMessage}. */ - public static <T extends com.google.protobuf.GeneratedMessageV3> TangoMessage<T> createTangoMessage(Class<T> typeName) + public static <T extends GeneratedMessageV3> TangoMessage<T> createTangoMessage(Class<T> typeName) { try { @@ -108,7 +109,7 @@ public class MessageFactory * @param message the message * @return the tango message */ - public static <T extends com.google.protobuf.GeneratedMessageV3> TangoMessage<T> createTangoMessage(Class<T> typeName, T message) + public static <T extends GeneratedMessageV3> TangoMessage<T> createTangoMessage(Class<T> typeName, T message) { TangoMessage<T> tangoMessage = createTangoMessage(typeName); tangoMessage.setMessage(message); @@ -123,7 +124,39 @@ public class MessageFactory * @param token the token * @return the tango message */ - public static <T extends com.google.protobuf.GeneratedMessageV3> TangoMessage<T> createTangoMessage(Class<T> typeName, String token) + public static <T extends GeneratedMessageV3> TangoMessage<T> createTangoMessage(Class<T> typeName, T message, String token) + { + TangoMessage<T> tangoMessage = createTangoMessage(typeName); + tangoMessage.setMessage(message); + tangoMessage.getContainer().setToken(token); + return tangoMessage; + } + + /** + * Creates a new tango message with the specified message token. + * + * @param <T> the type parameter + * @param typeName the type name + * @param token the token + * @return the tango message + */ + public static TangoMessage createTangoMessage(MessageContainer container, GeneratedMessageV3 message) + { + TangoMessage tangoMessage = new TangoMessage(message,container.getType()); + tangoMessage.setMessage(message); + tangoMessage.getContainer().setToken(container.getToken()); + return tangoMessage; + } + + /** + * Creates a new tango message with the specified message token. + * + * @param <T> the type parameter + * @param typeName the type name + * @param token the token + * @return the tango message + */ + public static <T extends GeneratedMessageV3> TangoMessage<T> createTangoMessage(Class<T> typeName, String token) { TangoMessage<T> tangoMessage = createTangoMessage(typeName); tangoMessage.getContainer().setToken(token); @@ -138,7 +171,7 @@ public class MessageFactory * @return New instance of {@link TangoMessage}. */ @SuppressWarnings("unchecked") - public static <T extends com.google.protobuf.GeneratedMessageV3> TangoMessage<T> parseTangoMessage(byte[] data) + public static <T extends GeneratedMessageV3> TangoMessage<T> parseTangoMessage(byte[] data) { try { @@ -167,7 +200,7 @@ public class MessageFactory * @throws IllegalAccessException the illegal access exception * @throws InvalidProtocolBufferException the invalid protocol buffer exception */ - public static <T extends com.google.protobuf.GeneratedMessageV3> T parseMessageFromContainer(MessageContainer container) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InvalidProtocolBufferException + public static <T extends GeneratedMessageV3> T parseMessageFromContainer(MessageContainer container) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InvalidProtocolBufferException { Class<?> type = getClassForName(container.getType().toString()); @@ -185,7 +218,7 @@ public class MessageFactory * @throws IllegalAccessException the illegal access exception * @throws InvalidProtocolBufferException the invalid protocol buffer exception */ - public static com.google.protobuf.GeneratedMessageV3 parseMessageFromContainerAgnostic(MessageContainer container) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InvalidProtocolBufferException + public static GeneratedMessageV3 parseMessageFromContainerAgnostic(MessageContainer container) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InvalidProtocolBufferException { Class<?> type = getClassForName(container.getType().toString()); Parser parser = (Parser) type.getMethod("parser").invoke(null); diff --git a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/common/MessageTypeOuterClass.java b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/common/MessageTypeOuterClass.java index eeced1c83..27d581c93 100644 --- a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/common/MessageTypeOuterClass.java +++ b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/common/MessageTypeOuterClass.java @@ -151,6 +151,18 @@ public final class MessageTypeOuterClass { * <code>StubValveResponse = 32;</code> */ StubValveResponse(32), + /** + * <code>ExternalBridgeUdpDiscoveryPacket = 33;</code> + */ + ExternalBridgeUdpDiscoveryPacket(33), + /** + * <code>ExternalClientLoginRequest = 34;</code> + */ + ExternalClientLoginRequest(34), + /** + * <code>ExternalClientLoginResponse = 35;</code> + */ + ExternalClientLoginResponse(35), UNRECOGNIZED(-1), ; @@ -286,6 +298,18 @@ public final class MessageTypeOuterClass { * <code>StubValveResponse = 32;</code> */ public static final int StubValveResponse_VALUE = 32; + /** + * <code>ExternalBridgeUdpDiscoveryPacket = 33;</code> + */ + public static final int ExternalBridgeUdpDiscoveryPacket_VALUE = 33; + /** + * <code>ExternalClientLoginRequest = 34;</code> + */ + public static final int ExternalClientLoginRequest_VALUE = 34; + /** + * <code>ExternalClientLoginResponse = 35;</code> + */ + public static final int ExternalClientLoginResponse_VALUE = 35; public final int getNumber() { @@ -339,6 +363,9 @@ public final class MessageTypeOuterClass { case 30: return StubSteperMotorResponse; case 31: return StubValveRequest; case 32: return StubValveResponse; + case 33: return ExternalBridgeUdpDiscoveryPacket; + case 34: return ExternalClientLoginRequest; + case 35: return ExternalClientLoginResponse; default: return null; } } @@ -400,7 +427,7 @@ public final class MessageTypeOuterClass { descriptor; static { java.lang.String[] descriptorData = { - "\n\021MessageType.proto\022\020Tango.PMR.Common*\357\006" + + "\n\021MessageType.proto\022\020Tango.PMR.Common*\326\007" + "\n\013MessageType\022\007\n\003RGB\020\000\022\007\n\003Job\020\001\022\013\n\007Segme" + "nt\020\002\022\024\n\020CalculateRequest\020\003\022\025\n\021CalculateR" + "esponse\020\004\022\023\n\017ProgressRequest\020\005\022\024\n\020Progre" + @@ -422,8 +449,11 @@ public final class MessageTypeOuterClass { "ubOptLimitSwitchRequest\020\033\022\036\n\032StubOptLimi", "tSwitchResponse\020\034\022\032\n\026StubSteperMotorRequ" + "est\020\035\022\033\n\027StubSteperMotorResponse\020\036\022\024\n\020St" + - "ubValveRequest\020\037\022\025\n\021StubValveResponse\020 B" + - "\034\n\032com.twine.tango.pmr.commonb\006proto3" + "ubValveRequest\020\037\022\025\n\021StubValveResponse\020 \022" + + "$\n ExternalBridgeUdpDiscoveryPacket\020!\022\036\n" + + "\032ExternalClientLoginRequest\020\"\022\037\n\033Externa" + + "lClientLoginResponse\020#B\034\n\032com.twine.tang" + + "o.pmr.commonb\006proto3" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { diff --git a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/ExternalBridgeUdpDiscoveryPacketOuterClass.java b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/ExternalBridgeUdpDiscoveryPacketOuterClass.java new file mode 100644 index 000000000..5b83561c0 --- /dev/null +++ b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/ExternalBridgeUdpDiscoveryPacketOuterClass.java @@ -0,0 +1,580 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ExternalBridgeUdpDiscoveryPacket.proto + +package com.twine.tango.pmr.integration; + +public final class ExternalBridgeUdpDiscoveryPacketOuterClass { + private ExternalBridgeUdpDiscoveryPacketOuterClass() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface ExternalBridgeUdpDiscoveryPacketOrBuilder extends + // @@protoc_insertion_point(interface_extends:Tango.PMR.Integration.ExternalBridgeUdpDiscoveryPacket) + com.google.protobuf.MessageOrBuilder { + + /** + * <code>string SerialNumber = 2;</code> + */ + java.lang.String getSerialNumber(); + /** + * <code>string SerialNumber = 2;</code> + */ + com.google.protobuf.ByteString + getSerialNumberBytes(); + } + /** + * Protobuf type {@code Tango.PMR.Integration.ExternalBridgeUdpDiscoveryPacket} + */ + public static final class ExternalBridgeUdpDiscoveryPacket extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:Tango.PMR.Integration.ExternalBridgeUdpDiscoveryPacket) + ExternalBridgeUdpDiscoveryPacketOrBuilder { + private static final long serialVersionUID = 0L; + // Use ExternalBridgeUdpDiscoveryPacket.newBuilder() to construct. + private ExternalBridgeUdpDiscoveryPacket(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { + super(builder); + } + private ExternalBridgeUdpDiscoveryPacket() { + serialNumber_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ExternalBridgeUdpDiscoveryPacket( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + serialNumber_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.internal_static_Tango_PMR_Integration_ExternalBridgeUdpDiscoveryPacket_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.internal_static_Tango_PMR_Integration_ExternalBridgeUdpDiscoveryPacket_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket.class, com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket.Builder.class); + } + + public static final int SERIALNUMBER_FIELD_NUMBER = 2; + private volatile java.lang.Object serialNumber_; + /** + * <code>string SerialNumber = 2;</code> + */ + public java.lang.String getSerialNumber() { + java.lang.Object ref = serialNumber_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serialNumber_ = s; + return s; + } + } + /** + * <code>string SerialNumber = 2;</code> + */ + public com.google.protobuf.ByteString + getSerialNumberBytes() { + java.lang.Object ref = serialNumber_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + serialNumber_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getSerialNumberBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, serialNumber_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getSerialNumberBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, serialNumber_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket)) { + return super.equals(obj); + } + com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket other = (com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket) obj; + + boolean result = true; + result = result && getSerialNumber() + .equals(other.getSerialNumber()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SERIALNUMBER_FIELD_NUMBER; + hash = (53 * hash) + getSerialNumber().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code Tango.PMR.Integration.ExternalBridgeUdpDiscoveryPacket} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements + // @@protoc_insertion_point(builder_implements:Tango.PMR.Integration.ExternalBridgeUdpDiscoveryPacket) + com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacketOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.internal_static_Tango_PMR_Integration_ExternalBridgeUdpDiscoveryPacket_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.internal_static_Tango_PMR_Integration_ExternalBridgeUdpDiscoveryPacket_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket.class, com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket.Builder.class); + } + + // Construct using com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + serialNumber_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.internal_static_Tango_PMR_Integration_ExternalBridgeUdpDiscoveryPacket_descriptor; + } + + public com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket getDefaultInstanceForType() { + return com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket.getDefaultInstance(); + } + + public com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket build() { + com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket buildPartial() { + com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket result = new com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket(this); + result.serialNumber_ = serialNumber_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket) { + return mergeFrom((com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket other) { + if (other == com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket.getDefaultInstance()) return this; + if (!other.getSerialNumber().isEmpty()) { + serialNumber_ = other.serialNumber_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object serialNumber_ = ""; + /** + * <code>string SerialNumber = 2;</code> + */ + public java.lang.String getSerialNumber() { + java.lang.Object ref = serialNumber_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serialNumber_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * <code>string SerialNumber = 2;</code> + */ + public com.google.protobuf.ByteString + getSerialNumberBytes() { + java.lang.Object ref = serialNumber_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + serialNumber_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * <code>string SerialNumber = 2;</code> + */ + public Builder setSerialNumber( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + serialNumber_ = value; + onChanged(); + return this; + } + /** + * <code>string SerialNumber = 2;</code> + */ + public Builder clearSerialNumber() { + + serialNumber_ = getDefaultInstance().getSerialNumber(); + onChanged(); + return this; + } + /** + * <code>string SerialNumber = 2;</code> + */ + public Builder setSerialNumberBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + serialNumber_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:Tango.PMR.Integration.ExternalBridgeUdpDiscoveryPacket) + } + + // @@protoc_insertion_point(class_scope:Tango.PMR.Integration.ExternalBridgeUdpDiscoveryPacket) + private static final com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket(); + } + + public static com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser<ExternalBridgeUdpDiscoveryPacket> + PARSER = new com.google.protobuf.AbstractParser<ExternalBridgeUdpDiscoveryPacket>() { + public ExternalBridgeUdpDiscoveryPacket parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ExternalBridgeUdpDiscoveryPacket(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser<ExternalBridgeUdpDiscoveryPacket> parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser<ExternalBridgeUdpDiscoveryPacket> getParserForType() { + return PARSER; + } + + public com.twine.tango.pmr.integration.ExternalBridgeUdpDiscoveryPacketOuterClass.ExternalBridgeUdpDiscoveryPacket getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_Tango_PMR_Integration_ExternalBridgeUdpDiscoveryPacket_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_Tango_PMR_Integration_ExternalBridgeUdpDiscoveryPacket_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n&ExternalBridgeUdpDiscoveryPacket.proto" + + "\022\025Tango.PMR.Integration\"8\n ExternalBridg" + + "eUdpDiscoveryPacket\022\024\n\014SerialNumber\030\002 \001(" + + "\tB!\n\037com.twine.tango.pmr.integrationb\006pr" + + "oto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + internal_static_Tango_PMR_Integration_ExternalBridgeUdpDiscoveryPacket_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_Tango_PMR_Integration_ExternalBridgeUdpDiscoveryPacket_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_Tango_PMR_Integration_ExternalBridgeUdpDiscoveryPacket_descriptor, + new java.lang.String[] { "SerialNumber", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/ExternalClientLoginRequestOuterClass.java b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/ExternalClientLoginRequestOuterClass.java new file mode 100644 index 000000000..9717c3d11 --- /dev/null +++ b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/ExternalClientLoginRequestOuterClass.java @@ -0,0 +1,579 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ExternalClientLoginRequest.proto + +package com.twine.tango.pmr.integration; + +public final class ExternalClientLoginRequestOuterClass { + private ExternalClientLoginRequestOuterClass() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface ExternalClientLoginRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:Tango.PMR.Integration.ExternalClientLoginRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * <code>string key = 1;</code> + */ + java.lang.String getKey(); + /** + * <code>string key = 1;</code> + */ + com.google.protobuf.ByteString + getKeyBytes(); + } + /** + * Protobuf type {@code Tango.PMR.Integration.ExternalClientLoginRequest} + */ + public static final class ExternalClientLoginRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:Tango.PMR.Integration.ExternalClientLoginRequest) + ExternalClientLoginRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ExternalClientLoginRequest.newBuilder() to construct. + private ExternalClientLoginRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { + super(builder); + } + private ExternalClientLoginRequest() { + key_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ExternalClientLoginRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + key_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.internal_static_Tango_PMR_Integration_ExternalClientLoginRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.internal_static_Tango_PMR_Integration_ExternalClientLoginRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest.class, com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest.Builder.class); + } + + public static final int KEY_FIELD_NUMBER = 1; + private volatile java.lang.Object key_; + /** + * <code>string key = 1;</code> + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } + } + /** + * <code>string key = 1;</code> + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getKeyBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getKeyBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest)) { + return super.equals(obj); + } + com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest other = (com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest) obj; + + boolean result = true; + result = result && getKey() + .equals(other.getKey()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code Tango.PMR.Integration.ExternalClientLoginRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements + // @@protoc_insertion_point(builder_implements:Tango.PMR.Integration.ExternalClientLoginRequest) + com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.internal_static_Tango_PMR_Integration_ExternalClientLoginRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.internal_static_Tango_PMR_Integration_ExternalClientLoginRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest.class, com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest.Builder.class); + } + + // Construct using com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + key_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.internal_static_Tango_PMR_Integration_ExternalClientLoginRequest_descriptor; + } + + public com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest getDefaultInstanceForType() { + return com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest.getDefaultInstance(); + } + + public com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest build() { + com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest buildPartial() { + com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest result = new com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest(this); + result.key_ = key_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest) { + return mergeFrom((com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest other) { + if (other == com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest.getDefaultInstance()) return this; + if (!other.getKey().isEmpty()) { + key_ = other.key_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object key_ = ""; + /** + * <code>string key = 1;</code> + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + key_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * <code>string key = 1;</code> + */ + public com.google.protobuf.ByteString + getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + key_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * <code>string key = 1;</code> + */ + public Builder setKey( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + key_ = value; + onChanged(); + return this; + } + /** + * <code>string key = 1;</code> + */ + public Builder clearKey() { + + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + /** + * <code>string key = 1;</code> + */ + public Builder setKeyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + key_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:Tango.PMR.Integration.ExternalClientLoginRequest) + } + + // @@protoc_insertion_point(class_scope:Tango.PMR.Integration.ExternalClientLoginRequest) + private static final com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest(); + } + + public static com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser<ExternalClientLoginRequest> + PARSER = new com.google.protobuf.AbstractParser<ExternalClientLoginRequest>() { + public ExternalClientLoginRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ExternalClientLoginRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser<ExternalClientLoginRequest> parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser<ExternalClientLoginRequest> getParserForType() { + return PARSER; + } + + public com.twine.tango.pmr.integration.ExternalClientLoginRequestOuterClass.ExternalClientLoginRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_Tango_PMR_Integration_ExternalClientLoginRequest_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_Tango_PMR_Integration_ExternalClientLoginRequest_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n ExternalClientLoginRequest.proto\022\025Tang" + + "o.PMR.Integration\")\n\032ExternalClientLogin" + + "Request\022\013\n\003key\030\001 \001(\tB!\n\037com.twine.tango." + + "pmr.integrationb\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + internal_static_Tango_PMR_Integration_ExternalClientLoginRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_Tango_PMR_Integration_ExternalClientLoginRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_Tango_PMR_Integration_ExternalClientLoginRequest_descriptor, + new java.lang.String[] { "Key", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/ExternalClientLoginResponseOuterClass.java b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/ExternalClientLoginResponseOuterClass.java new file mode 100644 index 000000000..57600bbc2 --- /dev/null +++ b/Software/Android_Studio/Tango.PMR/src/main/java/com/twine/tango/pmr/integration/ExternalClientLoginResponseOuterClass.java @@ -0,0 +1,644 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ExternalClientLoginResponse.proto + +package com.twine.tango.pmr.integration; + +public final class ExternalClientLoginResponseOuterClass { + private ExternalClientLoginResponseOuterClass() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface ExternalClientLoginResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:Tango.PMR.Integration.ExternalClientLoginResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * <code>bool Authenticated = 1;</code> + */ + boolean getAuthenticated(); + + /** + * <code>string SerialNumber = 2;</code> + */ + java.lang.String getSerialNumber(); + /** + * <code>string SerialNumber = 2;</code> + */ + com.google.protobuf.ByteString + getSerialNumberBytes(); + } + /** + * Protobuf type {@code Tango.PMR.Integration.ExternalClientLoginResponse} + */ + public static final class ExternalClientLoginResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:Tango.PMR.Integration.ExternalClientLoginResponse) + ExternalClientLoginResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ExternalClientLoginResponse.newBuilder() to construct. + private ExternalClientLoginResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { + super(builder); + } + private ExternalClientLoginResponse() { + authenticated_ = false; + serialNumber_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ExternalClientLoginResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 8: { + + authenticated_ = input.readBool(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + serialNumber_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.internal_static_Tango_PMR_Integration_ExternalClientLoginResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.internal_static_Tango_PMR_Integration_ExternalClientLoginResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse.class, com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse.Builder.class); + } + + public static final int AUTHENTICATED_FIELD_NUMBER = 1; + private boolean authenticated_; + /** + * <code>bool Authenticated = 1;</code> + */ + public boolean getAuthenticated() { + return authenticated_; + } + + public static final int SERIALNUMBER_FIELD_NUMBER = 2; + private volatile java.lang.Object serialNumber_; + /** + * <code>string SerialNumber = 2;</code> + */ + public java.lang.String getSerialNumber() { + java.lang.Object ref = serialNumber_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serialNumber_ = s; + return s; + } + } + /** + * <code>string SerialNumber = 2;</code> + */ + public com.google.protobuf.ByteString + getSerialNumberBytes() { + java.lang.Object ref = serialNumber_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + serialNumber_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (authenticated_ != false) { + output.writeBool(1, authenticated_); + } + if (!getSerialNumberBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, serialNumber_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (authenticated_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(1, authenticated_); + } + if (!getSerialNumberBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, serialNumber_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse)) { + return super.equals(obj); + } + com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse other = (com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse) obj; + + boolean result = true; + result = result && (getAuthenticated() + == other.getAuthenticated()); + result = result && getSerialNumber() + .equals(other.getSerialNumber()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + AUTHENTICATED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getAuthenticated()); + hash = (37 * hash) + SERIALNUMBER_FIELD_NUMBER; + hash = (53 * hash) + getSerialNumber().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code Tango.PMR.Integration.ExternalClientLoginResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements + // @@protoc_insertion_point(builder_implements:Tango.PMR.Integration.ExternalClientLoginResponse) + com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.internal_static_Tango_PMR_Integration_ExternalClientLoginResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.internal_static_Tango_PMR_Integration_ExternalClientLoginResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse.class, com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse.Builder.class); + } + + // Construct using com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + authenticated_ = false; + + serialNumber_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.internal_static_Tango_PMR_Integration_ExternalClientLoginResponse_descriptor; + } + + public com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse getDefaultInstanceForType() { + return com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse.getDefaultInstance(); + } + + public com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse build() { + com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse buildPartial() { + com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse result = new com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse(this); + result.authenticated_ = authenticated_; + result.serialNumber_ = serialNumber_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse) { + return mergeFrom((com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse other) { + if (other == com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse.getDefaultInstance()) return this; + if (other.getAuthenticated() != false) { + setAuthenticated(other.getAuthenticated()); + } + if (!other.getSerialNumber().isEmpty()) { + serialNumber_ = other.serialNumber_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private boolean authenticated_ ; + /** + * <code>bool Authenticated = 1;</code> + */ + public boolean getAuthenticated() { + return authenticated_; + } + /** + * <code>bool Authenticated = 1;</code> + */ + public Builder setAuthenticated(boolean value) { + + authenticated_ = value; + onChanged(); + return this; + } + /** + * <code>bool Authenticated = 1;</code> + */ + public Builder clearAuthenticated() { + + authenticated_ = false; + onChanged(); + return this; + } + + private java.lang.Object serialNumber_ = ""; + /** + * <code>string SerialNumber = 2;</code> + */ + public java.lang.String getSerialNumber() { + java.lang.Object ref = serialNumber_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serialNumber_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * <code>string SerialNumber = 2;</code> + */ + public com.google.protobuf.ByteString + getSerialNumberBytes() { + java.lang.Object ref = serialNumber_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + serialNumber_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * <code>string SerialNumber = 2;</code> + */ + public Builder setSerialNumber( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + serialNumber_ = value; + onChanged(); + return this; + } + /** + * <code>string SerialNumber = 2;</code> + */ + public Builder clearSerialNumber() { + + serialNumber_ = getDefaultInstance().getSerialNumber(); + onChanged(); + return this; + } + /** + * <code>string SerialNumber = 2;</code> + */ + public Builder setSerialNumberBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + serialNumber_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:Tango.PMR.Integration.ExternalClientLoginResponse) + } + + // @@protoc_insertion_point(class_scope:Tango.PMR.Integration.ExternalClientLoginResponse) + private static final com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse(); + } + + public static com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser<ExternalClientLoginResponse> + PARSER = new com.google.protobuf.AbstractParser<ExternalClientLoginResponse>() { + public ExternalClientLoginResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ExternalClientLoginResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser<ExternalClientLoginResponse> parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser<ExternalClientLoginResponse> getParserForType() { + return PARSER; + } + + public com.twine.tango.pmr.integration.ExternalClientLoginResponseOuterClass.ExternalClientLoginResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_Tango_PMR_Integration_ExternalClientLoginResponse_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_Tango_PMR_Integration_ExternalClientLoginResponse_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n!ExternalClientLoginResponse.proto\022\025Tan" + + "go.PMR.Integration\"J\n\033ExternalClientLogi" + + "nResponse\022\025\n\rAuthenticated\030\001 \001(\010\022\024\n\014Seri" + + "alNumber\030\002 \001(\tB!\n\037com.twine.tango.pmr.in" + + "tegrationb\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + internal_static_Tango_PMR_Integration_ExternalClientLoginResponse_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_Tango_PMR_Integration_ExternalClientLoginResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_Tango_PMR_Integration_ExternalClientLoginResponse_descriptor, + new java.lang.String[] { "Authenticated", "SerialNumber", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/Software/Android_Studio/Tango.PMR/src/main/res/raw/packages.txt b/Software/Android_Studio/Tango.PMR/src/main/res/raw/packages.txt index 803095d92..7dcb7e0f1 100644 --- a/Software/Android_Studio/Tango.PMR/src/main/res/raw/packages.txt +++ b/Software/Android_Studio/Tango.PMR/src/main/res/raw/packages.txt @@ -1,4 +1,5 @@ common +integration jobs stubs synchronization diff --git a/Software/Android_Studio/Tango.SharedUI/build.gradle b/Software/Android_Studio/Tango.SharedUI/build.gradle index 00bf0b351..832a8eb22 100644 --- a/Software/Android_Studio/Tango.SharedUI/build.gradle +++ b/Software/Android_Studio/Tango.SharedUI/build.gradle @@ -59,4 +59,8 @@ dependencies { compile globalDependencies.protobuf implementation project(':Tango.PMR') implementation project(':Tango.Web') + compile 'com.google.dagger:dagger:2.11' + implementation project(':Tango.Transport') + implementation project(':Tango.Integration') + compile 'com.squareup:otto:1.3.8' } diff --git a/Software/Android_Studio/Tango.Stubs.UI/build.gradle b/Software/Android_Studio/Tango.Stubs.UI/build.gradle index 42109f2a8..41853210a 100644 --- a/Software/Android_Studio/Tango.Stubs.UI/build.gradle +++ b/Software/Android_Studio/Tango.Stubs.UI/build.gradle @@ -12,7 +12,7 @@ android { versionCode 1 versionName "1.0" vectorDrawables.useSupportLibrary = true - + multiDexEnabled true testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } diff --git a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/App.java b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/App.java index d0437aaa1..96b5b490d 100644 --- a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/App.java +++ b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/App.java @@ -1,9 +1,5 @@ package com.twine.tango.stubs.ui; -import android.app.Application; -import android.content.Context; - -import com.elvishew.xlog.XLog; import com.twine.tango.sharedui.TangoApplication; import com.twine.tango.stubs.ui.dagger.ApplicationComponent; import com.twine.tango.stubs.ui.dagger.ApplicationModule; diff --git a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/ApplicationComponent.java b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/ApplicationComponent.java index ab0b84c25..cbd61f9ee 100644 --- a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/ApplicationComponent.java +++ b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/ApplicationComponent.java @@ -16,7 +16,7 @@ import dagger.Component; */ @Singleton -@Component(modules = {ApplicationModule.class, ViewModelsModule.class, EventBusModule.class, NotificationModule.class, TransportModule.class, NavigationModule.class}) +@Component(modules = {ApplicationModule.class, ViewModelsModule.class, EventBusModule.class, NotificationModule.class, NavigationModule.class, IntegrationModule.class}) public interface ApplicationComponent { diff --git a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/ApplicationModule.java b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/ApplicationModule.java new file mode 100644 index 000000000..ce664f835 --- /dev/null +++ b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/ApplicationModule.java @@ -0,0 +1,30 @@ +package com.twine.tango.stubs.ui.dagger; + +import android.app.Application; +import android.content.Context; + +import javax.inject.Singleton; + +import dagger.Module; +import dagger.Provides; + +/** + * Created by Roy on 11/6/2017. + */ + +@Module +public class ApplicationModule { + + private Application application; + + public ApplicationModule(Application application) { + this.application = application; + } + + @Provides + @Singleton + public Context provideContext() + { + return application; + } +} diff --git a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/EventBusModule.java b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/EventBusModule.java new file mode 100644 index 000000000..3aeb461f7 --- /dev/null +++ b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/EventBusModule.java @@ -0,0 +1,24 @@ +package com.twine.tango.stubs.ui.dagger; + +import com.squareup.otto.Bus; +import com.squareup.otto.ThreadEnforcer; + +import javax.inject.Singleton; + +import dagger.Module; +import dagger.Provides; + +/** + * Created by Roy on 11/6/2017. + */ + +@Module +public class EventBusModule { + + @Provides + @Singleton + public Bus provideEventBus() + { + return new Bus(ThreadEnforcer.MAIN); + } +} diff --git a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/IntegrationModule.java b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/IntegrationModule.java new file mode 100644 index 000000000..b06d9aa67 --- /dev/null +++ b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/IntegrationModule.java @@ -0,0 +1,50 @@ +package com.twine.tango.stubs.ui.dagger; + +import com.twine.tango.integration.operators.IMachineOperator; +import com.twine.tango.integration.operators.MachineOperator; +import com.twine.tango.integration.providers.IMachineIdentityProvider; +import com.twine.tango.integration.providers.MachineIdentityProvider; +import com.twine.tango.integration.services.IExternalBridgeService; +import com.twine.tango.integration.services.ISynchronizationService; +import com.twine.tango.integration.services.ExternalBridgeService; +import com.twine.tango.integration.services.SynchronizationService; +import com.twine.tango.transport.adapters.TcpTransportAdapter; + +import javax.inject.Singleton; +import dagger.Module; +import dagger.Provides; + +/** + * Created by Roy on 11/6/2017. + */ +@Module +public class IntegrationModule +{ + @Provides + @Singleton + public IExternalBridgeService provideBridgeService(IMachineIdentityProvider machineIdentityProvider,IMachineOperator machineOperator) + { + return new ExternalBridgeService(machineIdentityProvider,machineOperator); + } + + @Provides + @Singleton + public ISynchronizationService provideSynchronizationService(IMachineIdentityProvider machineIdentityProvider, IExternalBridgeService bridgeService) + { + return new SynchronizationService(machineIdentityProvider, bridgeService); + } + + @Provides + @Singleton + public IMachineIdentityProvider provideMachineIdentityProvider() + { + return new MachineIdentityProvider(); + } + + @Provides + @Singleton + public IMachineOperator providerMachineOperator() + { + return new MachineOperator(new TcpTransportAdapter("10.0.2.2", 9999)); + } +} diff --git a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/NavigationModule.java b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/NavigationModule.java new file mode 100644 index 000000000..674157858 --- /dev/null +++ b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/NavigationModule.java @@ -0,0 +1,20 @@ +package com.twine.tango.stubs.ui.dagger; + +import android.content.Context; +import com.twine.tango.sharedui.navigation.AndroidNavigationProvider; +import com.twine.tango.sharedui.navigation.INavigationProvider; +import javax.inject.Singleton; + +import dagger.Module; +import dagger.Provides; + +@Module +public class NavigationModule +{ + @Provides + @Singleton + public INavigationProvider provideNavigation() + { + return new AndroidNavigationProvider(); + } +} diff --git a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/NotificationModule.java b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/NotificationModule.java new file mode 100644 index 000000000..69d6d8f62 --- /dev/null +++ b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/NotificationModule.java @@ -0,0 +1,27 @@ +package com.twine.tango.stubs.ui.dagger; + +import android.content.Context; + +import com.twine.tango.sharedui.notifications.AndroidNotificationProvider; +import com.twine.tango.sharedui.notifications.INotificationProvider; + +import javax.inject.Singleton; + +import dagger.Module; +import dagger.Provides; + +/** + * Created by Roy on 11/6/2017. + */ + +@Module +public class NotificationModule { + + @Provides + @Singleton + public INotificationProvider provideNotificationProvider(Context context) + { + return new AndroidNotificationProvider(context); + } + +} diff --git a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/ViewModelsModule.java b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/ViewModelsModule.java index 927511efc..b7e494ecf 100644 --- a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/ViewModelsModule.java +++ b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/dagger/ViewModelsModule.java @@ -1,6 +1,9 @@ package com.twine.tango.stubs.ui.dagger; import com.squareup.otto.Bus; +import com.twine.tango.integration.operators.IMachineOperator; +import com.twine.tango.integration.services.IExternalBridgeService; +import com.twine.tango.integration.services.ISynchronizationService; import com.twine.tango.sharedui.navigation.INavigationProvider; import com.twine.tango.sharedui.notifications.INotificationProvider; import com.twine.tango.stubs.ui.views.login.LoginFragmentVM; @@ -26,9 +29,9 @@ public class ViewModelsModule @Provides @Singleton - public MainActivityVM provideMainActivityVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider, ITransporter transporter) + public MainActivityVM provideMainActivityVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider, IMachineOperator machineOperator, ISynchronizationService synchronizationService, IExternalBridgeService externalBridgeService) { - return new MainActivityVM(eventBus, notificationProvider, navigationProvider, transporter); + return new MainActivityVM(eventBus, notificationProvider, navigationProvider, machineOperator, externalBridgeService, synchronizationService); } @Provides @@ -54,8 +57,8 @@ public class ViewModelsModule @Provides @Singleton - public StubFragmentVM provideStubFragmentVM(Bus eventBus, INotificationProvider notificationProvider, ITransporter transporter) + public StubFragmentVM provideStubFragmentVM(Bus eventBus, INotificationProvider notificationProvider, IMachineOperator machineOperator) { - return new StubFragmentVM(eventBus, notificationProvider, transporter); + return new StubFragmentVM(eventBus, notificationProvider, machineOperator); } } diff --git a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/views/main/MainActivityVM.java b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/views/main/MainActivityVM.java index e77cc0810..64d69b0e6 100644 --- a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/views/main/MainActivityVM.java +++ b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/views/main/MainActivityVM.java @@ -2,6 +2,9 @@ package com.twine.tango.stubs.ui.views.main; import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; +import com.twine.tango.integration.operators.IMachineOperator; +import com.twine.tango.integration.services.IExternalBridgeService; +import com.twine.tango.integration.services.ISynchronizationService; import com.twine.tango.models.User; import com.twine.tango.sharedui.mvvm.DependencyProperty; import com.twine.tango.sharedui.mvvm.RelayCommand; @@ -10,9 +13,10 @@ import com.twine.tango.sharedui.navigation.INavigationProvider; import com.twine.tango.sharedui.notifications.INotificationProvider; import com.twine.tango.stubs.ui.Events.LoginEvent; import com.twine.tango.stubs.ui.views.main.IMainActivity.Navigation; -import com.twine.tango.transport.ITransporter; import com.twine.tango.transport.TransportComponentState; +import java.io.IOException; + import javax.inject.Inject; import io.reactivex.android.schedulers.AndroidSchedulers; @@ -24,7 +28,9 @@ public class MainActivityVM extends ViewModelBase<IMainActivity> private User currentUser; private INotificationProvider notificationProvider; private INavigationProvider navigationProvider; - private ITransporter transporter; + private IMachineOperator machineOperator; + private ISynchronizationService synchronizationService; + private IExternalBridgeService externalBridgeService; public DependencyProperty<Boolean> isConnected; @@ -34,33 +40,43 @@ public class MainActivityVM extends ViewModelBase<IMainActivity> @Inject - public MainActivityVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider,ITransporter transporter) + public MainActivityVM(Bus eventBus, INotificationProvider notificationProvider, INavigationProvider navigationProvider, IMachineOperator machineOperator, IExternalBridgeService externalBridgeService, ISynchronizationService synchronizationService) { this.eventBus = eventBus; this.notificationProvider = notificationProvider; this.navigationProvider = navigationProvider; - this.transporter = transporter; + this.machineOperator = machineOperator; + this.synchronizationService = synchronizationService; + this.externalBridgeService = externalBridgeService; this.eventBus.register(this); isConnected = new DependencyProperty<>(false); - connectCommand = new RelayCommand(this::connect,() -> this.transporter.getState() != TransportComponentState.Connected); - disconnectCommand = new RelayCommand(this::disconnect,() -> this.transporter.getState() == TransportComponentState.Connected); + connectCommand = new RelayCommand(this::connect,() -> this.machineOperator.getState() != TransportComponentState.Connected); + disconnectCommand = new RelayCommand(this::disconnect,() -> this.machineOperator.getState() == TransportComponentState.Connected); - this.transporter.addStateChangedListener((sender,e) -> - isConnected.set(this.transporter.getState() == TransportComponentState.Connected)); + this.machineOperator.addStateChangedListener((sender, e) -> + isConnected.set(this.machineOperator.getState() == TransportComponentState.Connected)); + + try + { + externalBridgeService.start(); + } catch (IOException e) + { + e.printStackTrace(); + } } private void connect() { - transporter.connect().observeOn(AndroidSchedulers.mainThread()).subscribe(() -> + machineOperator.connect().observeOn(AndroidSchedulers.mainThread()).subscribe(() -> invalidateCommands(),(ex) -> notificationProvider.showMessage(view,"Could not connect the Transporter.")); } private void disconnect() { - transporter.disconnect().observeOn(AndroidSchedulers.mainThread()).subscribe(() -> + machineOperator.disconnect().observeOn(AndroidSchedulers.mainThread()).subscribe(() -> invalidateCommands(),(ex) -> notificationProvider.showMessage(view,"Could not disconnect the Transporter.")); } diff --git a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/views/stub/StubFragmentVM.java b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/views/stub/StubFragmentVM.java index 8a052b38c..fe237bcd8 100644 --- a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/views/stub/StubFragmentVM.java +++ b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/views/stub/StubFragmentVM.java @@ -3,6 +3,7 @@ package com.twine.tango.stubs.ui.views.stub; import com.elvishew.xlog.XLog; import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; +import com.twine.tango.integration.operators.IMachineOperator; import com.twine.tango.sharedui.mvvm.RelayCommand; import com.twine.tango.sharedui.notifications.INotificationProvider; import com.twine.tango.stubs.AvailableStub; @@ -24,21 +25,21 @@ public class StubFragmentVM extends ViewModelBase<IStubFragment> { private Bus eventBus; private INotificationProvider notificationProvider; - private ITransporter transporter; + private IMachineOperator machineOperator; public DependencyProperty<AvailableStub> availableStub; public DependencyProperty<StubBase> stub; public DependencyProperty<String> response; public RelayCommand runCommand; @Inject - public StubFragmentVM(Bus eventBus, INotificationProvider notificationProvider, ITransporter transporter) + public StubFragmentVM(Bus eventBus, INotificationProvider notificationProvider, IMachineOperator machineOperator) { availableStub = new DependencyProperty<>(); stub = new DependencyProperty<>(); response = new DependencyProperty<>(""); this.eventBus = eventBus; - this.transporter = transporter; + this.machineOperator = machineOperator; this.notificationProvider = notificationProvider; this.eventBus.register(this); @@ -49,7 +50,7 @@ public class StubFragmentVM extends ViewModelBase<IStubFragment> public void handleStubSelectedEvent(StubSelectedEvent e) { availableStub.set(e.getStub()); - stub.set(availableStub.get().createInstance(transporter)); + stub.set(availableStub.get().createInstance(machineOperator)); } private void runSelectedStub() diff --git a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Calculate.java b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Calculate.java index 68c697b67..1e0d6f199 100644 --- a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Calculate.java +++ b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Calculate.java @@ -56,7 +56,7 @@ public class Calculate extends StubBase MessageFactory.createTangoMessage( CalculateRequest.class, CalculateRequest.newBuilder().setA(num1).setB(num2).build())).subscribe((response) -> - subject.onNext(String.valueOf(response.getSum())), subject::onError); + subject.onNext(String.valueOf(response.getMessage().getSum())), subject::onError); return subject; } diff --git a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Progress.java b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Progress.java index 0b4d656f9..e1838a34f 100644 --- a/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Progress.java +++ b/Software/Android_Studio/Tango.Stubs/src/main/java/com/twine/tango/stubs/stubs/Progress.java @@ -51,7 +51,7 @@ public class Progress extends StubBase MessageFactory.createTangoMessage( ProgressRequest.class, ProgressRequest.newBuilder().setAmount(amount.get().intValue()).setDelay(delay.get().intValue()).build())).subscribe((response) -> - subject.onNext(String.valueOf(response.getProgress()))); + subject.onNext(String.valueOf(response.getMessage().getProgress()))); return subject; } diff --git a/Software/Android_Studio/Tango.Synchronization/build.gradle b/Software/Android_Studio/Tango.Synchronization/build.gradle index 7134933aa..a8a33e319 100644 --- a/Software/Android_Studio/Tango.Synchronization/build.gradle +++ b/Software/Android_Studio/Tango.Synchronization/build.gradle @@ -43,7 +43,7 @@ dependencies { compile globalDependencies.daggerAndroid implementation project(':Tango.DAL') implementation project(':Tango.Integration') - compile globalDependencies.rxJava compile globalDependencies.rxJavaAndroid + implementation project(':Tango.Transport') } diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportAdapter.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportAdapter.java index 083ab60fd..abd12e0f0 100644 --- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportAdapter.java +++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransportAdapter.java @@ -9,33 +9,49 @@ import java.io.IOException; * Represents a transport adapter capable of connecting, writing and receiving data from a serial stream. */ public interface ITransportAdapter extends ITransportComponent { - + /** * Writes the specified data to the stream. * * @param data the data + * @throws ObjectDisposedException the object disposed exception + * @throws IOException the io exception */ void write(byte[] data) throws ObjectDisposedException, IOException; - + /** * Add data available listener. * * @param handler event handler */ void setDataAvailableListener(IEventHandler<byte[]> handler); - + /** * Gets the adapter address. * * @return the address */ String getAddress(); - + /** * Sets the adapter address. * * @param address the address */ void setAddress(String address); - + + + /** + * Gets whether this adapter is authenticated. + * + * @return the authenticated + */ + boolean isAuthenticated(); + + /** + * Sets whether this adapter is authenticated. + * + * @param authenticated the authenticated + */ + void setAuthenticated(boolean authenticated); } diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransporter.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransporter.java index ae5f6b5dc..9d2bce329 100644 --- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransporter.java +++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/ITransporter.java @@ -32,7 +32,7 @@ public interface ITransporter extends ITransportComponent { * @param request the request * @return the single */ - <Request extends GeneratedMessageV3,Response extends GeneratedMessageV3> Single<Response> sendRequest(TangoMessage<Request> request); + <Request extends GeneratedMessageV3,Response extends GeneratedMessageV3> Single<TangoMessage<Response>> sendRequest(TangoMessage<Request> request); /** * Sends a request on the specified adapter. @@ -43,7 +43,7 @@ public interface ITransporter extends ITransportComponent { * @param adapter the adapter * @return the single */ - <Request extends GeneratedMessageV3,Response extends GeneratedMessageV3> Single<Response> sendRequest(TangoMessage<Request> request,ITransportAdapter adapter); + <Request extends GeneratedMessageV3,Response extends GeneratedMessageV3> Single<TangoMessage<Response>> sendRequest(TangoMessage<Request> request,ITransportAdapter adapter); /** * Sends a continuous request on all adapters. @@ -53,7 +53,7 @@ public interface ITransporter extends ITransportComponent { * @param request the request * @return the observable */ - <Request extends GeneratedMessageV3,Response extends GeneratedMessageV3> Observable<Response> sendContinuousRequest(TangoMessage<Request> request); + <Request extends GeneratedMessageV3,Response extends GeneratedMessageV3> Observable<TangoMessage<Response>> sendContinuousRequest(TangoMessage<Request> request); /** * Sends a continuous request on the specified adapter. @@ -64,7 +64,7 @@ public interface ITransporter extends ITransportComponent { * @param adapter the adapter * @return the observable */ - <Request extends GeneratedMessageV3,Response extends GeneratedMessageV3> Observable<Response> sendContinuousRequest(TangoMessage<Request> request, ITransportAdapter adapter); + <Request extends GeneratedMessageV3,Response extends GeneratedMessageV3> Observable<TangoMessage<Response>> sendContinuousRequest(TangoMessage<Request> request, ITransportAdapter adapter); /** * Sends a response. diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportAdapterBase.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportAdapterBase.java index d5301296b..b9221ea27 100644 --- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportAdapterBase.java +++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransportAdapterBase.java @@ -13,8 +13,10 @@ import io.reactivex.Completable; /** * Represents an {@link ITransportAdapter} base class. */ -public abstract class TransportAdapterBase implements ITransportAdapter { - +public abstract class TransportAdapterBase implements ITransportAdapter +{ + + private boolean isAuthenticated; private String address; private Event<TransportComponentState> stateChangedEvent; private IEventHandler<byte[]> dataAvailableListener; @@ -26,31 +28,48 @@ public abstract class TransportAdapterBase implements ITransportAdapter { public TransportAdapterBase() { stateChangedEvent = new Event<>(); + setAuthenticated(true); } public abstract void write(byte[] data) throws ObjectDisposedException, IOException; - + public abstract Completable connect(); - + public abstract Completable disconnect(); - + @Override - public void setDataAvailableListener(IEventHandler<byte[]> handler) { + public void setDataAvailableListener(IEventHandler<byte[]> handler) + { dataAvailableListener = handler; } - + @Override - public String getAddress() { + public String getAddress() + { return this.address; } - + @Override - public void setAddress(String address) { + public void setAddress(String address) + { this.address = address; } - + @Override - public void addStateChangedListener(IEventHandler<TransportComponentState> listener) { + public boolean isAuthenticated() + { + return isAuthenticated; + } + + @Override + public void setAuthenticated(boolean authenticated) + { + isAuthenticated = authenticated; + } + + @Override + public void addStateChangedListener(IEventHandler<TransportComponentState> listener) + { stateChangedEvent.addListener(listener); } @@ -61,7 +80,8 @@ public abstract class TransportAdapterBase implements ITransportAdapter { } @Override - public TransportComponentState getState() { + public TransportComponentState getState() + { return state; } @@ -70,19 +90,24 @@ public abstract class TransportAdapterBase implements ITransportAdapter { * * @param state the state */ - protected void setState(TransportComponentState state) { + protected void setState(TransportComponentState state) + { this.state = state; - if (stateChangedEvent != null) { - try { + if (stateChangedEvent != null) + { + try + { stateChangedEvent.invoke(this, this.state); - } catch (Exception e) { + } catch (Exception e) + { e.printStackTrace(); } } } - + @Override - public void dispose() { + public void dispose() + { disconnect().blockingAwait(); setState(TransportComponentState.Disposed); } @@ -92,8 +117,10 @@ public abstract class TransportAdapterBase implements ITransportAdapter { * * @throws ObjectDisposedException the object disposed exception */ - protected void throwIfDisposed() throws ObjectDisposedException { - if (state == TransportComponentState.Disposed) { + protected void throwIfDisposed() throws ObjectDisposedException + { + if (state == TransportComponentState.Disposed) + { throw new ObjectDisposedException("The adapter is in a " + state + " state."); } } @@ -103,11 +130,15 @@ public abstract class TransportAdapterBase implements ITransportAdapter { * * @param data the data */ - protected void onDataAvailable(byte[] data) { - if (dataAvailableListener != null) { - try { + protected void onDataAvailable(byte[] data) + { + if (dataAvailableListener != null) + { + try + { dataAvailableListener.invoke(this, data); - } catch (Exception e) { + } catch (Exception e) + { e.printStackTrace(); } } @@ -118,7 +149,8 @@ public abstract class TransportAdapterBase implements ITransportAdapter { * * @param ex the ex */ - protected void onFailed(Exception ex) { + protected void onFailed(Exception ex) + { disconnect().blockingAwait(); setState(TransportComponentState.Failed); XLog.e(ex); diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransporterBase.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransporterBase.java index ca7f6ed92..51c4eedf8 100644 --- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransporterBase.java +++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/TransporterBase.java @@ -240,6 +240,13 @@ public abstract class TransporterBase implements ITransporter return MessageFactory.parseMessageFromContainerAgnostic(container); } + protected TangoMessage onParseTangoMessage(byte[] data) throws InvalidProtocolBufferException, NoSuchMethodException, IllegalAccessException, InvocationTargetException + { + MessageContainer container = onParseContainer(data); + GeneratedMessageV3 message = onParseMessage(container); + return MessageFactory.createTangoMessage(container,message); + } + //endregion //region Constructors @@ -336,9 +343,9 @@ public abstract class TransporterBase implements ITransporter { adapter.disconnect().blockingAwait(); } - + setState(TransportComponentState.Disconnected); - + XLog.i("Transporter disconnected..."); x.onComplete(); @@ -351,19 +358,19 @@ public abstract class TransporterBase implements ITransporter } @Override - public <Request extends GeneratedMessageV3, Response extends GeneratedMessageV3> Single<Response> sendRequest(TangoMessage<Request> request) + public <Request extends GeneratedMessageV3, Response extends GeneratedMessageV3> Single<TangoMessage<Response>> sendRequest(TangoMessage<Request> request) { return sendRequest(request, null); } @Override - public <Request extends GeneratedMessageV3, Response extends GeneratedMessageV3> Single<Response> sendRequest(TangoMessage<Request> request, ITransportAdapter adapter) + public <Request extends GeneratedMessageV3, Response extends GeneratedMessageV3> Single<TangoMessage<Response>> sendRequest(TangoMessage<Request> request, ITransportAdapter adapter) { XLog.i("Queuing request message: " + request.getClass().getSimpleName() + " Token: " + request.getContainer().getToken() + " on adapter: " + (adapter != null ? adapter.getAddress() : "ALL")); XLog.i("Expected response: " + Response.Builder.class.getSimpleName()); - PublishSubject<Response> subject = PublishSubject.create(); - TransportMessage<Response> message = new TransportMessage<>(adapter, request.getContainer().getToken(), request, TransportMessageDirection.Request, onSerializingMessage(request), subject); + PublishSubject<TangoMessage<Response>> subject = PublishSubject.create(); + TransportMessage<TangoMessage<Response>> message = new TransportMessage<>(adapter, request.getContainer().getToken(), request, TransportMessageDirection.Request, onSerializingMessage(request), subject); sendingQueue.add(message); Completable.timer(getRequestTimeout().getSeconds(), TimeUnit.SECONDS) @@ -382,13 +389,13 @@ public abstract class TransporterBase implements ITransporter } @Override - public <Request extends GeneratedMessageV3, Response extends GeneratedMessageV3> Observable<Response> sendContinuousRequest(TangoMessage<Request> request) + public <Request extends GeneratedMessageV3, Response extends GeneratedMessageV3> Observable<TangoMessage<Response>> sendContinuousRequest(TangoMessage<Request> request) { return sendContinuousRequest(request, null); } @Override - public <Request extends GeneratedMessageV3, Response extends GeneratedMessageV3> Observable<Response> sendContinuousRequest(TangoMessage<Request> request, ITransportAdapter adapter) + public <Request extends GeneratedMessageV3, Response extends GeneratedMessageV3> Observable<TangoMessage<Response>> sendContinuousRequest(TangoMessage<Request> request, ITransportAdapter adapter) { XLog.i("Queuing continuous response request message: " + request.getClass().getSimpleName() + " Token: " + request.getContainer().getToken() + " on adapter: " + (adapter != null ? adapter.getAddress() : "ALL")); XLog.i("Expected response: " + Response.Builder.class.getSimpleName()); @@ -396,8 +403,8 @@ public abstract class TransporterBase implements ITransporter request.getContainer().setContinuous(true); request.getContainer().setCompleted(false); - PublishSubject<Response> subject = PublishSubject.create(); - TransportMessage<Response> message = new TransportMessage<>(adapter, request.getContainer().getToken(), request, TransportMessageDirection.Request, onSerializingMessage(request), subject); + PublishSubject<TangoMessage<Response>> subject = PublishSubject.create(); + TransportMessage<TangoMessage<Response>> message = new TransportMessage<>(adapter, request.getContainer().getToken(), request, TransportMessageDirection.Request, onSerializingMessage(request), subject); message.setContinuous(true); sendingQueue.add(message); @@ -473,8 +480,10 @@ public abstract class TransporterBase implements ITransporter * * @throws ObjectDisposedException the object disposed exception */ - protected void throwIfDisposed() throws ObjectDisposedException { - if (state == TransportComponentState.Disposed) { + protected void throwIfDisposed() throws ObjectDisposedException + { + if (state == TransportComponentState.Disposed) + { throw new ObjectDisposedException("The transporter is in a " + state + " state."); } } @@ -568,13 +577,24 @@ public abstract class TransporterBase implements ITransporter { XLog.i("Message received on adapter: " + data.first.getAddress()); XLog.i("Parsing message container..."); - MessageContainer container = onParseContainer(data.second); + + MessageContainer container; + + try + { + container = onParseContainer(data.second); + } catch (Exception e) + { + XLog.e("Invalid message container received!", e); + continue; + } + XLog.i("Searching for pending request token: " + container.getToken()); TransportMessageBase request = stream(pendingRequests).singleOrDefault(x -> x.getToken().equals(container.getToken()), null); if (request != null) { - XLog.i("Found pending request: " + request.getMessage().getClass().getSimpleName()); + XLog.i("Found pending request: " + ((TangoMessage)request.getMessage()).getContainer().getType()); if (!request.isContinuous()) { @@ -585,7 +605,7 @@ public abstract class TransporterBase implements ITransporter try { XLog.i("Parsing inner response message and setting pending request task result..."); - request.setResult(onParseMessage(container), true); + request.setResult(onParseTangoMessage(data.second), true); } catch (Exception ex) { XLog.e("Error parsing inner message", ex); @@ -602,7 +622,7 @@ public abstract class TransporterBase implements ITransporter { XLog.i("Continuous sequence completed."); } - request.setResult(onParseMessage(container), container.getCompleted()); + request.setResult(onParseTangoMessage(data.second), container.getCompleted()); } catch (Exception ex) { XLog.e("Error parsing inner message", ex); diff --git a/Software/Android_Studio/Tango.UnitTesting/build.gradle b/Software/Android_Studio/Tango.UnitTesting/build.gradle index 3b9a730c8..3f58e3803 100644 --- a/Software/Android_Studio/Tango.UnitTesting/build.gradle +++ b/Software/Android_Studio/Tango.UnitTesting/build.gradle @@ -42,7 +42,6 @@ dependencies { implementation project(':Tango.Integration') implementation project(':Tango.SharedUI') implementation project(':Tango.Stubs') - implementation project(':Tango.Synchronization') implementation project(':Tango.Transport') implementation project(':Tango.Web') implementation project(':Tango.NativeBridge') diff --git a/Software/Android_Studio/Tango.UnitTesting/src/androidTest/java/com/twine/tango/unittesting/Synchronization_TST.java b/Software/Android_Studio/Tango.UnitTesting/src/androidTest/java/com/twine/tango/unittesting/Synchronization_TST.java index b162c2215..4713fb6cc 100644 --- a/Software/Android_Studio/Tango.UnitTesting/src/androidTest/java/com/twine/tango/unittesting/Synchronization_TST.java +++ b/Software/Android_Studio/Tango.UnitTesting/src/androidTest/java/com/twine/tango/unittesting/Synchronization_TST.java @@ -5,13 +5,11 @@ import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import com.elvishew.xlog.XLog; -import com.twine.tango.dal.TangoDB; import com.twine.tango.dal.dao.TangoDAO; import com.twine.tango.dal.entities.Organization; -import com.twine.tango.integration.MachineIdentityProvider; -import com.twine.tango.synchronization.ITangoSynchronizer; -import com.twine.tango.synchronization.TangoSynchronizer; -import com.twine.tango.web.WebApiFactory; +import com.twine.tango.integration.providers.MachineIdentityProvider; +import com.twine.tango.integration.services.ISynchronizationService; +import com.twine.tango.integration.services.SynchronizationService; import org.junit.Test; import org.junit.runner.RunWith; @@ -38,7 +36,7 @@ public class Synchronization_TST XLog.i(org.getName()); } - ITangoSynchronizer synchronizer = new TangoSynchronizer(new MachineIdentityProvider()); + ISynchronizationService synchronizer = new SynchronizationService(new MachineIdentityProvider()); synchronizer.synchronizeDB().subscribe(() -> { diff --git a/Software/Android_Studio/settings.gradle b/Software/Android_Studio/settings.gradle index 7a7daf836..15bb94e3b 100644 --- a/Software/Android_Studio/settings.gradle +++ b/Software/Android_Studio/settings.gradle @@ -1 +1 @@ -include ':Tango.BL', ':Tango.Stubs.UI', ':Tango.SharedUI', ':Tango.Models', ':Tango.Stubs', ':Tango.Integration', ':Tango.Transport', ':Tango.Core', ':Tango.PMR', ':Tango.DAL', ':Tango.Web', ':Tango.Synchronization', ':Tango.UnitTesting', ':Tango.NativeBridge' +include ':Tango.Stubs.UI', ':Tango.SharedUI', ':Tango.Models', ':Tango.Stubs', ':Tango.Integration', ':Tango.Transport', ':Tango.Core', ':Tango.PMR', ':Tango.DAL', ':Tango.Web', ':Tango.UnitTesting', ':Tango.NativeBridge' diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex 2123553a2..e1171e9f0 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex 74ecadd2d..61c3049d0 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf diff --git a/Software/PMR/Messages/Common/MessageType.proto b/Software/PMR/Messages/Common/MessageType.proto index 8a593b394..e77095809 100644 --- a/Software/PMR/Messages/Common/MessageType.proto +++ b/Software/PMR/Messages/Common/MessageType.proto @@ -38,4 +38,7 @@ enum MessageType StubSteperMotorResponse = 30; StubValveRequest = 31; StubValveResponse = 32; + ExternalBridgeUdpDiscoveryPacket = 33; + ExternalClientLoginRequest = 34; + ExternalClientLoginResponse = 35; } diff --git a/Software/PMR/Messages/Integration/ExternalBridgeUdpDiscoveryPacket.proto b/Software/PMR/Messages/Integration/ExternalBridgeUdpDiscoveryPacket.proto new file mode 100644 index 000000000..33c565bae --- /dev/null +++ b/Software/PMR/Messages/Integration/ExternalBridgeUdpDiscoveryPacket.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Integration; +option java_package = "com.twine.tango.pmr.integration"; + +message ExternalBridgeUdpDiscoveryPacket +{ + string SerialNumber = 2; +}
\ No newline at end of file diff --git a/Software/PMR/Messages/Integration/ExternalClientLoginRequest.proto b/Software/PMR/Messages/Integration/ExternalClientLoginRequest.proto new file mode 100644 index 000000000..3c7d701b5 --- /dev/null +++ b/Software/PMR/Messages/Integration/ExternalClientLoginRequest.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Integration; +option java_package = "com.twine.tango.pmr.integration"; + +message ExternalClientLoginRequest +{ + string key = 1; +}
\ No newline at end of file diff --git a/Software/PMR/Messages/Integration/ExternalClientLoginResponse.proto b/Software/PMR/Messages/Integration/ExternalClientLoginResponse.proto new file mode 100644 index 000000000..7d0ef89b5 --- /dev/null +++ b/Software/PMR/Messages/Integration/ExternalClientLoginResponse.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package Tango.PMR.Integration; +option java_package = "com.twine.tango.pmr.integration"; + +message ExternalClientLoginResponse +{ + bool Authenticated = 1; + string SerialNumber = 2; +}
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ExtensionMethods/INotificationProviderExtensions.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ExtensionMethods/INotificationProviderExtensions.cs deleted file mode 100644 index 8d95bb38e..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ExtensionMethods/INotificationProviderExtensions.cs +++ /dev/null @@ -1,30 +0,0 @@ -using MaterialDesignThemes.Wpf; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using Tango.DAL.Observables; -using Tango.MachineStudio.Common.Notifications; -using Tango.MachineStudio.DB.ViewModels; -using Tango.MachineStudio.DB.Views.DBViews; -using Tango.MachineStudio.DB.Windows; - -namespace Tango.MachineStudio.DB.ExtensionMethods -{ - public static class INotificationProviderExtensions - { - public static bool ShowDialog<T>(this INotificationProvider provider, DialogOpenMode mode, DbTableViewModel<T> context) where T : class, IObservableEntity - { - Type viewType = typeof(INotificationProviderExtensions).Assembly.GetType(typeof(OrganizationView).Namespace + "." + typeof(T).Name + "View"); - - DBDialogWindow window = new DBDialogWindow(Activator.CreateInstance(viewType) as FrameworkElement); - window.IconKind = (mode == DialogOpenMode.Editing ? PackIconKind.TableEdit : PackIconKind.Plus); - window.InnerTitle = (mode == DialogOpenMode.Editing ? "Edit " : "Add New ") + typeof(T).Name; - window.DataContext = context; - - return provider.ShowModalWindow(window).Value; - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj index b77d0daf9..bd6166b4f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj @@ -90,7 +90,6 @@ <Compile Include="Converters\EventTypeActionsToStringConverter.cs" /> <Compile Include="Converters\RolesPermissionsToStringConverter.cs" /> <Compile Include="DBModule.cs" /> - <Compile Include="ExtensionMethods\INotificationProviderExtensions.cs" /> <Compile Include="Messages\CloseEntityEditViewMessage.cs" /> <Compile Include="Messages\OpenEntityEditViewMessage.cs" /> <Compile Include="ViewModels\ActionTypesViewVM.cs" /> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs index 89759309b..e472e312a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs @@ -8,7 +8,6 @@ using Tango.DAL.Observables; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.DB.Managers; using Tango.SharedUI; -using Tango.MachineStudio.DB.ExtensionMethods; using System.Data.Entity.Infrastructure; using GalaSoft.MvvmLight.Messaging; using Tango.MachineStudio.DB.Messages; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Images/machine-trans.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Images/machine-trans.png Binary files differnew file mode 100644 index 000000000..a7cf65852 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Images/machine-trans.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Navigation/NavigationView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Navigation/NavigationView.cs index 8d38acb7c..d4212475c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Navigation/NavigationView.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Navigation/NavigationView.cs @@ -11,5 +11,6 @@ namespace Tango.MachineStudio.Synchronization.Navigation MenuView, LocalSynchronizationView, RemoteSynchronizationView, + DirectSynchronizationView, } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj index 12323ff91..19eecc2e1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj @@ -87,10 +87,14 @@ <Compile Include="Navigation\NavigationView.cs" /> <Compile Include="Navigation\SyncNavigationManager.cs" /> <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\DirectSynchronizationViewVM.cs" /> <Compile Include="ViewModels\LocalSynchronizationViewVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> <Compile Include="ViewModels\MenuViewVM.cs" /> <Compile Include="ViewModels\RemoteSynchronizationViewVM.cs" /> + <Compile Include="Views\DirectSynchronizationView.xaml.cs"> + <DependentUpon>DirectSynchronizationView.xaml</DependentUpon> + </Compile> <Compile Include="Views\RemoteSynchronizationView.xaml.cs"> <DependentUpon>RemoteSynchronizationView.xaml</DependentUpon> </Compile> @@ -107,6 +111,10 @@ <Link>GlobalVersionInfo.cs</Link> </Compile> <Compile Include="SynchronizationModule.cs" /> + <Page Include="Views\DirectSynchronizationView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\RemoteSynchronizationView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -170,6 +178,10 @@ <Project>{38197109-8610-4d3f-92b9-16d48df94d7c}</Project> <Name>Tango.DAL.Remote</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Integration\Tango.Integration.csproj"> + <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> + <Name>Tango.Integration</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj"> <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> <Name>Tango.Logging</Name> @@ -205,5 +217,8 @@ <ItemGroup> <Resource Include="Images\synch_big.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\machine-trans.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModelLocator.cs index a58ffe64b..090a323a2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModelLocator.cs @@ -22,6 +22,7 @@ namespace Tango.MachineStudio.Synchronization SimpleIoc.Default.Register<MenuViewVM>(); SimpleIoc.Default.Register<LocalSynchronizationViewVM>(); SimpleIoc.Default.Register<RemoteSynchronizationViewVM>(); + SimpleIoc.Default.Register<DirectSynchronizationViewVM>(); SimpleIoc.Default.Unregister<SyncNavigationManager>(); @@ -59,5 +60,13 @@ namespace Tango.MachineStudio.Synchronization return ServiceLocator.Current.GetInstance<RemoteSynchronizationViewVM>(); } } + + public static DirectSynchronizationViewVM DirectSynchronizationViewVM + { + get + { + return ServiceLocator.Current.GetInstance<DirectSynchronizationViewVM>(); + } + } } }
\ No newline at end of file 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 new file mode 100644 index 000000000..ba3521009 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/DirectSynchronizationViewVM.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.Services; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Synchronization.ViewModels +{ + public class DirectSynchronizationViewVM : ViewModel + { + public ExternalBridgeScanner Scanner { get; set; } + + public DirectSynchronizationViewVM(ExternalBridgeScanner scanner) + { + Scanner = scanner; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/MenuViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/MenuViewVM.cs index 8eb68a383..0fe510f36 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/MenuViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/MenuViewVM.cs @@ -19,10 +19,13 @@ namespace Tango.MachineStudio.Synchronization.ViewModels StartLocalSyncCommand = new RelayCommand(() => { _navigation.NavigateTo(NavigationView.LocalSynchronizationView); }); StartRemoteSyncCommand = new RelayCommand(() => { _navigation.NavigateTo(NavigationView.RemoteSynchronizationView); }); + StartDirectRemoteSyncCommand = new RelayCommand(() => { _navigation.NavigateTo(NavigationView.DirectSynchronizationView); }); } public RelayCommand StartLocalSyncCommand { get; set; } public RelayCommand StartRemoteSyncCommand { get; set; } + + public RelayCommand StartDirectRemoteSyncCommand { get; set; } } } 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 new file mode 100644 index 000000000..7dc0cdacc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/DirectSynchronizationView.xaml @@ -0,0 +1,33 @@ +<UserControl x:Class="Tango.MachineStudio.Synchronization.Views.DirectSynchronizationView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:synchronization="clr-namespace:Tango.Synchronization;assembly=Tango.Synchronization" + xmlns:global="clr-namespace:Tango.MachineStudio.Synchronization" + xmlns:local="clr-namespace:Tango.MachineStudio.Synchronization.Views" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.DirectSynchronizationViewVM}"> + <Grid> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="300"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + + <ListBox ItemsSource="{Binding Scanner.AvailableMachines}" SelectedItem="{Binding SelectedMachine}"> + <ListBox.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock Text="{Binding SerialNumber}"></TextBlock> + <TextBlock Text="{Binding Organization}"></TextBlock> + </StackPanel> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/DirectSynchronizationView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/DirectSynchronizationView.xaml.cs new file mode 100644 index 000000000..5a7c12646 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/DirectSynchronizationView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Synchronization.Views +{ + /// <summary> + /// Interaction logic for DirectSynchronizationView.xaml + /// </summary> + public partial class DirectSynchronizationView : UserControl + { + public DirectSynchronizationView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/MainView.xaml index bac530777..664dac229 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/MainView.xaml @@ -28,6 +28,9 @@ <ContentControl Tag="RemoteSynchronizationView"> <local:RemoteSynchronizationView></local:RemoteSynchronizationView> </ContentControl> + <ContentControl Tag="DirectSynchronizationView"> + <local:DirectSynchronizationView></local:DirectSynchronizationView> + </ContentControl> </controls:MultiTransitionControl.Controls> </controls:MultiTransitionControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/MenuView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/MenuView.xaml index 6210ca94c..67501743b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/MenuView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/MenuView.xaml @@ -10,17 +10,34 @@ d:DesignHeight="720" d:DesignWidth="1280" DataContext="{x:Static global:ViewModelLocator.MenuViewVM}"> <Grid> <Grid> - <Grid> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="1*"/> - <ColumnDefinition Width="1*"/> - </Grid.ColumnDefinitions> + <UniformGrid Columns="3"> + <Grid VerticalAlignment="Center"> + <StackPanel> + <StackPanel HorizontalAlignment="Center" Margin="0 0 0 30"> + <TextBlock TextAlignment="Center" FontSize="25">Local Synchronization</TextBlock> + <TextBlock TextAlignment="Center" FontSize="14" Foreground="#303030">Synchronize two SQLite local database files.</TextBlock> + </StackPanel> + <Viewbox RenderOptions.BitmapScalingMode="Fant" Width="400"> + <Grid Width="450"> + <StackPanel> + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/sqlite.png" Width="160"></Image> + <Image Source="../Images/arrow_right.png" Width="100" RenderTransformOrigin="0.5,0.5"></Image> + <Image Source="../Images/sqlite.png" Width="130"></Image> + </StackPanel> + + <Button Command="{Binding StartLocalSyncCommand}" Height="80" Margin="0 20 0 0" HorizontalAlignment="Center" Padding="10" FontSize="20" Width="200">START</Button> + </StackPanel> + </Grid> + </Viewbox> + </StackPanel> + </Grid> <Grid VerticalAlignment="Center"> <StackPanel> <StackPanel HorizontalAlignment="Center" Margin="0 0 0 30"> - <TextBlock TextAlignment="Center" FontSize="25">Remote Synchronization</TextBlock> - <TextBlock TextAlignment="Center" FontSize="14" Foreground="#303030">Synchronize local SQLite database file with the remote Twine database.</TextBlock> + <TextBlock TextAlignment="Center" FontSize="25">Direct Remote Synchronization</TextBlock> + <TextBlock TextAlignment="Center" FontSize="14" Foreground="#303030">Connect and synchronized a Tango machine over the network.</TextBlock> </StackPanel> <Viewbox RenderOptions.BitmapScalingMode="Fant" Width="400"> <Grid Width="450"> @@ -28,42 +45,39 @@ <StackPanel Orientation="Horizontal"> <Image Source="../Images/remote-db.png" Width="200"></Image> <Image Source="../Images/arrow_right.png" Width="100"></Image> - <Image Source="../Images/android-phone-color.png" Width="180"></Image> + <Image Source="../Images/machine-trans.png" Width="120"></Image> </StackPanel> - <Button Command="{Binding StartRemoteSyncCommand}" Height="80" Margin="20 20 10 0" HorizontalAlignment="Right" Padding="10" FontSize="20" Width="200">START</Button> + <Button Command="{Binding StartDirectRemoteSyncCommand}" Height="80" Margin="0 20 0 0" HorizontalAlignment="Center" Padding="10" FontSize="20" Width="200">START</Button> </StackPanel> </Grid> </Viewbox> </StackPanel> </Grid> - <Grid VerticalAlignment="Center" Grid.Column="1"> + <Grid VerticalAlignment="Center"> <StackPanel> <StackPanel HorizontalAlignment="Center" Margin="0 0 0 30"> - <TextBlock TextAlignment="Center" FontSize="25">Local Synchronization</TextBlock> - <TextBlock TextAlignment="Center" FontSize="14" Foreground="#303030">Synchronize two SQLite local database files.</TextBlock> + <TextBlock TextAlignment="Center" FontSize="25">Semi Remote Synchronization</TextBlock> + <TextBlock TextAlignment="Center" FontSize="14" Foreground="#303030">Synchronize local SQLite database file with the remote Twine database.</TextBlock> </StackPanel> <Viewbox RenderOptions.BitmapScalingMode="Fant" Width="400"> <Grid Width="450"> <StackPanel> <StackPanel Orientation="Horizontal"> - <Image Source="../Images/sqlite.png" Width="160"></Image> - <Image Source="../Images/arrow_right.png" Width="100" RenderTransformOrigin="0.5,0.5"> - <Image.RenderTransform> - <RotateTransform Angle="180"></RotateTransform> - </Image.RenderTransform> - </Image> - <Image Source="../Images/sqlite.png" Width="160"></Image> + <Image Source="../Images/remote-db.png" Width="200"></Image> + <Image Source="../Images/arrow_right.png" Width="100"></Image> + <Image Source="../Images/sqlite.png" Width="120"></Image> </StackPanel> - <Button Command="{Binding StartLocalSyncCommand}" Height="80" Margin="5 20 20 0" HorizontalAlignment="Left" Padding="10" FontSize="20" Width="200">START</Button> + <Button Command="{Binding StartRemoteSyncCommand}" Height="80" Margin="0 20 0 0" HorizontalAlignment="Center" Padding="10" FontSize="20" Width="200">START</Button> </StackPanel> </Grid> </Viewbox> </StackPanel> </Grid> - </Grid> + + </UniformGrid> </Grid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/DialogViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/DialogViewVM.cs new file mode 100644 index 000000000..e5e4cac78 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/DialogViewVM.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Common.Notifications +{ + public abstract class DialogViewVM : ViewModel + { + public event Action Accepted; + public event Action Canceled; + + public DialogViewVM() + { + CanClose = true; + CloseCommand = new RelayCommand(Cancel, (x) => CanClose); + } + + private bool _canClose; + + public bool CanClose + { + get { return _canClose; } + set { _canClose = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + public RelayCommand CloseCommand { get; set; } + + public virtual void OnShow() + { + + } + + protected virtual void Accept() + { + Accepted?.Invoke(); + } + + protected virtual void Cancel() + { + Canceled?.Invoke(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs index a45f9a847..937a39ec2 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs @@ -24,11 +24,11 @@ namespace Tango.MachineStudio.Common.Notifications void PopTaskItem(TaskItem taskItem); - bool? ShowModalWindow(Window window); + void ShowModalDialog<View, VM>(Action<VM> onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM; - bool ShowModalWindow<T>(PackIconKind icon, String title, object context) where T : FrameworkElement; + void ShowModalDialog<VM>(Action<VM> onAccept, Action onCancel) where VM : DialogViewVM; - bool ShowModalWindow(PackIconKind icon, String title, FrameworkElement content, object context); + void ShowModalDialog<VM>(Action<VM> onAccept) where VM : DialogViewVM; bool? ShowDialog(PackIconKind icon, Brush iconColor, String message, bool hasCancel); 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 740c257b9..3297f9374 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Integration.Services; namespace Tango.MachineStudio.Common.StudioApplication { @@ -10,5 +11,7 @@ namespace Tango.MachineStudio.Common.StudioApplication { bool IsShuttingDown { get;} void ShutDown(); + IExternalBridgeClient ConnectedMachine { get; set; } + bool IsMachineConnected { get; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index 32466e45a..5cf171090 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -71,6 +71,7 @@ <Reference Include="PresentationFramework" /> </ItemGroup> <ItemGroup> + <Compile Include="Notifications\DialogViewVM.cs" /> <Compile Include="StudioApplication\IStudioApplicationManager.cs" /> <Compile Include="StudioApplication\IShutdownRequestBlocker.cs" /> <Compile Include="ExtensionMethods\IStudioMessageExtensions.cs" /> @@ -142,6 +143,10 @@ <Project>{38197109-8610-4d3f-92b9-16d48df94d7c}</Project> <Name>Tango.DAL.Remote</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Integration\Tango.Integration.csproj"> + <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> + <Name>Tango.Integration</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.SharedUI\Tango.SharedUI.csproj"> <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> <Name>Tango.SharedUI</Name> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config index b31d56717..692b77528 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config @@ -21,4 +21,12 @@ <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /> </DbProviderFactories> </system.data> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> </configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs index 9193cfd3e..dfbc0eb77 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs @@ -14,6 +14,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.Core.Helpers; using Tango.MachineStudio.Common.StudioApplication; namespace Tango.MachineStudio.UI @@ -29,6 +30,7 @@ namespace Tango.MachineStudio.UI { InitializeComponent(); Instance = this; + ThreadsHelper.SetDisptacher(Dispatcher); this.Closing += MainWindow_Closing; } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs index b1ba03109..3c245510b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs @@ -35,48 +35,114 @@ namespace Tango.MachineStudio.UI.Notifications TaskItems = new ObservableCollection<TaskItem>(); } - public bool ShowModalWindow<T>(PackIconKind icon, string title, object context) where T : FrameworkElement - { - return ShowModalWindow(icon, title, Activator.CreateInstance<T>(), context); - } - - public bool? ShowModalWindow(Window window) + public bool? ShowDialog(PackIconKind icon, Brush iconColor, string message, bool hasCancel) { - window.Owner = Application.Current.MainWindow; MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; - bool result = window.ShowDialog().Value; + + var result = new MessageBoxWindow() + { + Owner = Application.Current.MainWindow, + Message = message, + IconKind = icon, + IconColor = iconColor, + HasCancel = hasCancel + + }.ShowDialog(); + MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; return result; } - public bool ShowModalWindow(PackIconKind icon, string title, FrameworkElement content, object context) + public void ShowModalDialog<View, VM>(Action<VM> onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM { - DialogWindow dialog = new DialogWindow(content); - dialog.DataContext = context; - dialog.InnerTitle = title; + var view = Activator.CreateInstance<View>(); + DialogWindow dialog = new DialogWindow(); dialog.Owner = Application.Current.MainWindow; + dialog.InnerContent = view; MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; - bool result = dialog.ShowDialog().Value; + view.Loaded += (x, y) => + { + VM context = view.DataContext as VM; + dialog.DataContext = context; + + Action onAcceptAction = null; + onAcceptAction = new Action(() => + { + dialog.Close(); + onAccept(context); + context.Accepted -= onAcceptAction; + }); + + Action onCancelAction = null; + onCancelAction = new Action(() => + { + dialog.Close(); + + if (onCancel != null) + { + onCancel(); + } + + context.Canceled -= onCancelAction; + }); + + context.Accepted += onAcceptAction; + context.Canceled += onCancelAction; + + context.OnShow(); + }; + dialog.ShowDialog(); MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; - return result; } - public bool? ShowDialog(PackIconKind icon, Brush iconColor, string message, bool hasCancel) + public void ShowModalDialog<VM>(Action<VM> onAccept, Action onCancel) where VM : DialogViewVM { - MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; + String viewName = typeof(VM).Name.Replace("VM", ""); - var result = new MessageBoxWindow() + var view = Activator.CreateInstance(AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes()).Single(x => x.Name == viewName)) as FrameworkElement; + DialogWindow dialog = new DialogWindow(); + dialog.Owner = Application.Current.MainWindow; + dialog.InnerContent = view; + MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; + view.Loaded += (x, y) => { - Owner = Application.Current.MainWindow, - Message = message, - IconKind = icon, - IconColor = iconColor, - HasCancel = hasCancel + VM context = view.DataContext as VM; + dialog.DataContext = context; - }.ShowDialog(); + Action onAcceptAction = null; + onAcceptAction = new Action(() => + { + dialog.Close(); + onAccept(context); + context.Accepted -= onAcceptAction; + }); + + Action onCancelAction = null; + onCancelAction = new Action(() => + { + dialog.Close(); + + if (onCancel != null) + { + onCancel(); + } + + context.Canceled -= onCancelAction; + }); + context.Accepted += onAcceptAction; + context.Canceled += onCancelAction; + + context.OnShow(); + }; + + dialog.ShowDialog(); MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; - return result; + } + + public void ShowModalDialog<VM>(Action<VM> onAccept) where VM : DialogViewVM + { + ShowModalDialog<VM>(onAccept, null); } public void ShowError(string message) diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml index 2a8dd9f28..c11e2e11b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml @@ -1,4 +1,4 @@ -<mahapps:MetroWindow x:Class="Tango.MachineStudio.UI.Windows.DialogWindow" +<Window x:Class="Tango.MachineStudio.UI.Windows.DialogWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" @@ -7,18 +7,22 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Windows" mc:Ignorable="d" - Title="Machine Studio" Height="450" Width="650" EnableDWMDropShadow="True" ShowCloseButton="False" WindowTransitionsEnabled="False" ShowMaxRestoreButton="False" ShowMinButton="False" TitleCaps="False" BorderThickness="1" WindowStartupLocation="CenterOwner"> + Title="Machine Studio" MinHeight="220" SizeToContent="WidthAndHeight" MinWidth="600" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterOwner" Background="Transparent"> <Grid> - <Border Margin="16"> - <DockPanel LastChildFill="True"> - <StackPanel Orientation="Horizontal" DockPanel.Dock="Top" VerticalAlignment="Top"> - <materialDesign:PackIcon Kind="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=IconKind}" VerticalAlignment="Center" Width="32" Height="32" Foreground="{StaticResource AccentColorBrush}" /> - <TextBlock Margin="10 0 0 0" Foreground="{StaticResource AccentColorBrush}" FontSize="16" Text="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=InnerTitle}"></TextBlock> - </StackPanel> - <ScrollViewer Margin="0 10 0 10" VerticalScrollBarVisibility="Auto" Padding="5"> - <ContentPresenter x:Name="presenter"></ContentPresenter> - </ScrollViewer> - </DockPanel> - </Border> + <Grid> + <Border Background="White" CornerRadius="10" Padding="10" Margin="20"> + <Border.Effect> + <DropShadowEffect ShadowDepth="0" BlurRadius="10"></DropShadowEffect> + </Border.Effect> + + <Grid> + <ContentPresenter x:Name="presenter" Content="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=InnerContent}"></ContentPresenter> + + <Button Command="{Binding CloseCommand}" HorizontalAlignment="Right" VerticalAlignment="Top" Width="20" Height="20" Margin="0 -6 -4 0" Padding="0" Style="{StaticResource MaterialDesignFlatButton}" Foreground="Black"> + <materialDesign:PackIcon Kind="Close" Width="16" Height="16"></materialDesign:PackIcon> + </Button> + </Grid> + </Border> + </Grid> </Grid> -</mahapps:MetroWindow> +</Window> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs index 31dd3d644..d1bc0564b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs @@ -20,51 +20,23 @@ namespace Tango.MachineStudio.UI.Windows /// <summary> /// Interaction logic for DialogWindow.xaml /// </summary> - public partial class DialogWindow : MetroWindow + public partial class DialogWindow : Window { public DialogWindow() { InitializeComponent(); } - - - public String InnerTitle - { - get { return (String)GetValue(InnerTitleProperty); } - set { SetValue(InnerTitleProperty, value); } - } - public static readonly DependencyProperty InnerTitleProperty = - DependencyProperty.Register("InnerTitle", typeof(String), typeof(DialogWindow), new PropertyMetadata(null)); - - - - public PackIconKind IconKind + public FrameworkElement InnerContent { - get { return (PackIconKind)GetValue(IconKindProperty); } - set { SetValue(IconKindProperty, value); } + get { return (FrameworkElement)GetValue(InnerContentProperty); } + set { SetValue(InnerContentProperty, value); } } - public static readonly DependencyProperty IconKindProperty = - DependencyProperty.Register("IconKind", typeof(PackIconKind), typeof(DialogWindow), new PropertyMetadata(PackIconKind.Information)); - + // Using a DependencyProperty as the backing store for InnerContent. This enables animation, styling, binding, etc... + public static readonly DependencyProperty InnerContentProperty = + DependencyProperty.Register("InnerContent", typeof(FrameworkElement), typeof(DialogWindow), new PropertyMetadata(null)); - public DialogWindow(FrameworkElement content) : this() - { - presenter.Content = content; - } - - private void OnOKClicked(object sender, RoutedEventArgs e) - { - DialogResult = true; - Close(); - } - - private void OnCancelClicked(object sender, RoutedEventArgs e) - { - DialogResult = false; - Close(); - } } } 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 ea4234fd8..b0315e633 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -11,10 +11,13 @@ using Tango.MachineStudio.Common.Navigation; using GalaSoft.MvvmLight.Ioc; using System.Reflection; using System.Collections; +using Tango.Integration.Services; +using Tango.Core; +using Tango.Logging; namespace Tango.MachineStudio.UI.StudioApplication { - public class DefaultStudioApplicationManager : IStudioApplicationManager + public class DefaultStudioApplicationManager : ExtendedObject, IStudioApplicationManager { private INavigationManager _navigationManager; @@ -25,6 +28,19 @@ namespace Tango.MachineStudio.UI.StudioApplication public bool IsShuttingDown { get; private set; } + private IExternalBridgeClient _connectedMachine; + + public IExternalBridgeClient ConnectedMachine + { + get { return _connectedMachine; } + set { _connectedMachine = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(IsMachineConnected)); } + } + + public bool IsMachineConnected + { + get { return ConnectedMachine != null; } + } + public async void ShutDown() { if (IsShuttingDown) return; @@ -33,6 +49,17 @@ namespace Tango.MachineStudio.UI.StudioApplication await Task.Factory.StartNew(async () => { + try + { + if (ConnectedMachine != null) + { + ConnectedMachine.Disconnect().Wait(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error disconnecting from machine."); + } //Do Shutdown Procedures... foreach (var vm in ServiceLocator.Current.GetAllInstancesByBase<IShutdownRequestBlocker>()) diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index fa04a1068..3becf0252 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -58,6 +58,9 @@ <Reference Include="GalaSoft.MvvmLight.Platform, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL"> <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath> </Reference> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> <Reference Include="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL"> <HintPath>..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath> </Reference> @@ -110,6 +113,7 @@ <Compile Include="SupervisingController\IMainView.cs" /> <Compile Include="ViewModels\LoadingViewVM.cs" /> <Compile Include="ViewModels\LoginViewVM.cs" /> + <Compile Include="ViewModels\MachineConnectionViewVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\ShutdownViewVM.cs" /> @@ -119,6 +123,9 @@ <Compile Include="Views\LoginView.xaml.cs"> <DependentUpon>LoginView.xaml</DependentUpon> </Compile> + <Compile Include="Views\MachineConnectionView.xaml.cs"> + <DependentUpon>MachineConnectionView.xaml</DependentUpon> + </Compile> <Compile Include="Views\MainView.xaml.cs"> <DependentUpon>MainView.xaml</DependentUpon> </Compile> @@ -159,6 +166,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\MachineConnectionView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\MainView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -216,10 +227,18 @@ <Project>{38197109-8610-4d3f-92b9-16d48df94d7c}</Project> <Name>Tango.DAL.Remote</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Integration\Tango.Integration.csproj"> + <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> + <Name>Tango.Integration</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.Logging\Tango.Logging.csproj"> <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> <Name>Tango.Logging</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.Settings\Tango.Settings.csproj"> <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> <Name>Tango.Settings</Name> @@ -228,6 +247,10 @@ <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> <Name>Tango.SharedUI</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> <ProjectReference Include="..\Modules\Tango.MachineStudio.DB\Tango.MachineStudio.DB.csproj"> <Project>{94f7acf8-55e1-4a02-b9bc-a818413fdbbf}</Project> <Name>Tango.MachineStudio.DB</Name> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index f4a7a7502..e40f589af 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -2,6 +2,7 @@ using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Ioc; using Microsoft.Practices.ServiceLocation; using System; +using Tango.Integration.Services; using Tango.Logging; using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.Modules; @@ -48,17 +49,23 @@ namespace Tango.MachineStudio.UI SimpleIoc.Default.Unregister<INavigationManager>(); SimpleIoc.Default.Unregister<IStudioModuleLoader>(); SimpleIoc.Default.Unregister<IStudioApplicationManager>(); + SimpleIoc.Default.Unregister<ExternalBridgeScanner>(); SimpleIoc.Default.Register<INotificationProvider, DefaultNotificationProvider>(); SimpleIoc.Default.Register<IAuthenticationProvider, DefaultAuthenticationProvider>(); SimpleIoc.Default.Register<INavigationManager, DefaultNavigationManager>(); SimpleIoc.Default.Register<IStudioModuleLoader, DefaultStudioModuleLoader>(); SimpleIoc.Default.Register<IStudioApplicationManager, DefaultStudioApplicationManager>(); + SimpleIoc.Default.Register<ExternalBridgeScanner, ExternalBridgeScanner>(); SimpleIoc.Default.Register<MainViewVM>(); SimpleIoc.Default.Register<LoadingViewVM>(); SimpleIoc.Default.Register<ShutdownViewVM>(); SimpleIoc.Default.Register<LoginViewVM>(); + SimpleIoc.Default.Register<MachineConnectionViewVM>(); + + LogManager.RegisterLogger(new VSOutputLogger()); + LogManager.RegisterLogger(new FileLogger()); //Register View (Supervising Controller Pattern). if (!ViewModelBase.IsInDesignModeStatic) @@ -99,5 +106,13 @@ namespace Tango.MachineStudio.UI return ServiceLocator.Current.GetInstance<LoginViewVM>(); } } + + public MachineConnectionViewVM MachineConnectionViewVM + { + get + { + return ServiceLocator.Current.GetInstance<MachineConnectionViewVM>(); + } + } } }
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs new file mode 100644 index 000000000..b8b888e86 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Integration.Services; +using Tango.MachineStudio.Common.Notifications; +using Tango.SharedUI; + +namespace Tango.MachineStudio.UI.ViewModels +{ + public class MachineConnectionViewVM : DialogViewVM + { + private ExternalBridgeScanner _scanner; + + public ExternalBridgeScanner Scanner + { + get { return _scanner; } + set { _scanner = value; RaisePropertyChangedAuto(); } + } + + private IExternalBridgeClient _selectedMachine; + + public IExternalBridgeClient SelectedMachine + { + get { return _selectedMachine; } + set { _selectedMachine = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + public RelayCommand ConnectCommand { get; set; } + + public MachineConnectionViewVM(ExternalBridgeScanner scanner) + { + Scanner = scanner; + ConnectCommand = new RelayCommand(Connect,(x) => SelectedMachine != null); + Scanner.Start(); + } + + private void Connect() + { + if (SelectedMachine != null) + { + Accept(); + } + } + + public override void OnShow() + { + base.OnShow(); + + Scanner.AvailableMachines.Clear(); + } + } +} 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 a12156d60..6c44c8480 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -7,18 +7,24 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; using Tango.Core.Commands; +using Tango.Logging; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.Modules; using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.Common.StudioApplication; using Tango.MachineStudio.UI.SupervisingController; +using Tango.MachineStudio.UI.Views; +using Tango.PMR.Stubs; using Tango.SharedUI; +using Tango.Transport.Adapters; namespace Tango.MachineStudio.UI.ViewModels { public class MainViewVM : ViewModel<IMainView> { private IStudioModule _currentModule; + private bool _isDisconnecting; public IStudioModule CurrentModule { @@ -47,6 +53,10 @@ namespace Tango.MachineStudio.UI.ViewModels public RelayCommand HomeCommand { get; set; } + public RelayCommand ConnectCommand { get; set; } + + public RelayCommand DisconnectCommand { get; set; } + private IAuthenticationProvider _authenticationProvider; public IAuthenticationProvider AuthenticationProvider { @@ -70,20 +80,81 @@ namespace Tango.MachineStudio.UI.ViewModels set { _notificationProvider = value; RaisePropertyChangedAuto(); } } + private IStudioApplicationManager _applicationManager; + + public IStudioApplicationManager ApplicationManager + { + get { return _applicationManager; } + set { _applicationManager = value; RaisePropertyChangedAuto(); } + } + + public MainViewVM( IMainView view, IAuthenticationProvider authenticationProvider, IStudioModuleLoader studioModuleLoader, - INotificationProvider notificationProvider) : base(view) + INotificationProvider notificationProvider, + IStudioApplicationManager applicationManager) : base(view) { AuthenticationProvider = authenticationProvider; StudioModuleLoader = studioModuleLoader; NotificationProvider = notificationProvider; + ApplicationManager = applicationManager; StartModuleCommand = new RelayCommand<IStudioModule>(StartModule); HomeCommand = new RelayCommand(Home); + ConnectCommand = new RelayCommand(ConnectToMachine); + DisconnectCommand = new RelayCommand(DisconnectFromMachine,(x) => ApplicationManager.IsMachineConnected && !_isDisconnecting); + } + + private async void DisconnectFromMachine() + { + using (_notificationProvider.PushTaskItem("Disconnecting from machine...")) + { + _isDisconnecting = true; + InvalidateRelayCommands(); + await ApplicationManager.ConnectedMachine.Disconnect(); + ApplicationManager.ConnectedMachine = null; + _isDisconnecting = false; + InvalidateRelayCommands(); + } + } + + private void ConnectToMachine() + { + _notificationProvider.ShowModalDialog<MachineConnectionViewVM>(async (x) => + { + if (x.SelectedMachine != null) + { + using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.SerialNumber + "...")) + { + try + { + await x.SelectedMachine.Connect(); + var authenticated = await x.SelectedMachine.Authenticate(); + if (!authenticated) + { + _notificationProvider.ShowError("It seems like you are not authorized to access the selected machine."); + } + else + { + ApplicationManager.ConnectedMachine = x.SelectedMachine; + var response = await x.SelectedMachine.SendRequest<CalculateRequest, CalculateResponse>(new CalculateRequest() { A = 10, B = 5 }); + _notificationProvider.ShowInfo(response.ToString()); + } + } + catch (Exception ex) + { + LogManager.Log(ex); + _notificationProvider.ShowError(ex.Message); + } + } + } + + InvalidateRelayCommands(); + }); } private void Home() diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml new file mode 100644 index 000000000..2d172837a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml @@ -0,0 +1,85 @@ +<UserControl x:Class="Tango.MachineStudio.UI.Views.MachineConnectionView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + 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:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + 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 MachineConnectionViewVM, Source={StaticResource Locator}}"> + + <UserControl.Resources> + <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></converters:BooleanToVisibilityConverter> + <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter"></converters:BooleanToVisibilityInverseConverter> + <converters:BooleanInverseConverter x:Key="BooleanInverseConverter"></converters:BooleanInverseConverter> + </UserControl.Resources> + + <Grid> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="80"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Grid> + <StackPanel Orientation="Horizontal" Margin="10"> + <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant"></Image> + <TextBlock Text="Machine Connection" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="20"></TextBlock> + </StackPanel> + </Grid> + + <Grid Grid.Row="1" Margin="10 0 10 10"> + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="50"/> + </Grid.RowDefinitions> + + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="30"/> + <RowDefinition Height="223*"/> + </Grid.RowDefinitions> + + <Grid> + <TextBlock VerticalAlignment="Center" Margin="0 0 0 0" Text="Scanning for machine on your local network..."></TextBlock> + + <!--<Button Command="{Binding ScanCommand}" HorizontalAlignment="Right" Width="40" Padding="0" Style="{StaticResource MaterialDesignFlatButton}" Foreground="Black" ToolTip="Scan"> + <materialDesign:PackIcon Kind="Refresh" Width="24" Height="24"></materialDesign:PackIcon> + </Button>--> + </Grid> + + <Grid Grid.Row="1"> + <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"> + <Run FontWeight="Bold">S/N:</Run> <Run Text="{Binding SerialNumber,Mode=OneWay}"></Run> + </TextBlock> + <TextBlock FontSize="11"> + <Run FontWeight="Bold">IP Address:</Run> <Run Text="{Binding IPAddress,Mode=OneWay}"></Run> + </TextBlock> + <TextBlock FontSize="11"> + <Run FontWeight="Bold">Organization:</Run> <Run Text="{Binding Organization,Mode=OneWay}"></Run> + </TextBlock> + </StackPanel> + </StackPanel> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + + <mahapps:MetroProgressBar VerticalAlignment="Bottom" Height="1" IsIndeterminate="True"></mahapps:MetroProgressBar> + </Grid> + </Grid> + + <Grid Grid.Row="1"> + <Button HorizontalAlignment="Right" Width="140" Command="{Binding ConnectCommand}" Click="OnConnectClicked">CONNECT</Button> + </Grid> + </Grid> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml.cs new file mode 100644 index 000000000..58cec1987 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.UI.Views +{ + /// <summary> + /// Interaction logic for MachineConnectionView.xaml + /// </summary> + public partial class MachineConnectionView : UserControl + { + public MachineConnectionView() + { + InitializeComponent(); + } + + private void OnConnectClicked(object sender, RoutedEventArgs e) + { + Window.GetWindow(this).DialogResult = true; + Window.GetWindow(this).Close(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index aad1189b8..fc9db8adc 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -26,7 +26,7 @@ </Style.Triggers> </Style> </Grid.Style> - + <materialDesign:DrawerHost IsLeftDrawerOpen="{Binding ElementName=MenuToggleButton, Path=IsChecked}"> <materialDesign:DrawerHost.LeftDrawerContent> <StackPanel MinWidth="300"> @@ -84,17 +84,49 @@ x:Name="MenuToggleButton"/> <materialDesign:PopupBox DockPanel.Dock="Right" PlacementMode="BottomAndAlignRightEdges" StaysOpen="False"> <StackPanel> - <Button Content="Home"/> - <Button Content="Nice Popup"/> - <Button Content="Can't Touch This" IsEnabled="False" /> + <Button Content="Machine Connection" Command="{Binding ConnectCommand}" /> + <Button Content="Disconnect Machine" Command="{Binding DisconnectCommand}" /> + <Button Content="Exit" /> <Separator/> <Button Content="Goodbye"/> </StackPanel> </materialDesign:PopupBox> - <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="60" HorizontalAlignment="Center"> - <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant"></Image> - <TextBlock Text="Machine Studio" VerticalAlignment="Center" Margin="20 0 0 0" FontSize="36"/> - </StackPanel> + <Grid> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="60" HorizontalAlignment="Center"> + <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant"></Image> + <TextBlock Text="Machine Studio" VerticalAlignment="Center" Margin="20 0 0 0" FontSize="36"/> + </StackPanel> + + <Grid HorizontalAlignment="Right"> + <StackPanel Orientation="Horizontal"> + <Button Margin="10 0 0 0" Style="{StaticResource MaterialDesignFlatButton}" FontSize="12" ToolTip="Connect to machine on the local network" BorderThickness="0" Command="{Binding ConnectCommand}"> + <!--<Button.Background> + <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> + <GradientStop Color="White" Offset="0.4" /> + <GradientStop Color="#75E0FA" Offset="1"/> + </LinearGradientBrush> + </Button.Background>--> + <StackPanel Orientation="Horizontal"> + <TextBlock Text="Machine Connection" VerticalAlignment="Center" Foreground="White"></TextBlock> + <materialDesign:PackIcon Margin="10 0 0 0" Width="16" Height="16"> + <materialDesign:PackIcon.Style> + <Style TargetType="materialDesign:PackIcon"> + <Setter Property="Foreground" Value="#FF6767"></Setter> + <Setter Property="Kind" Value="LanDisconnect"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ApplicationManager.IsMachineConnected,Mode=OneWay}" Value="True"> + <Setter Property="Foreground" Value="#03FF8E"></Setter> + <Setter Property="Kind" Value="LanConnect"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </materialDesign:PackIcon.Style> + </materialDesign:PackIcon> + </StackPanel> + </Button> + </StackPanel> + </Grid> + </Grid> </DockPanel> </materialDesign:ColorZone> @@ -189,7 +221,7 @@ </Style.Triggers> </Style> </Grid.Style> - <ContentPresenter Content="{Binding CurrentModule.MainView}"></ContentPresenter> + <ContentPresenter Content="{Binding CurrentModule.MainView}"/> </Grid> </Grid> @@ -204,16 +236,16 @@ <Style.Triggers> <DataTrigger Binding="{Binding NotificationProvider.HasTaskItems}" Value="True"> <DataTrigger.EnterActions> - <BeginStoryboard> + <BeginStoryboard HandoffBehavior="Compose"> <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:0.2"></DoubleAnimation> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" FillBehavior="HoldEnd" To="1" Duration="00:00:0.2"></DoubleAnimation> </Storyboard> </BeginStoryboard> </DataTrigger.EnterActions> <DataTrigger.ExitActions> - <BeginStoryboard> + <BeginStoryboard HandoffBehavior="Compose"> <Storyboard> - <DoubleAnimation BeginTime="00:00:01" Storyboard.TargetProperty="RenderTransform.ScaleY" To="0" From="1" Duration="00:00:0.5"></DoubleAnimation> + <DoubleAnimation BeginTime="00:00:02" FillBehavior="HoldEnd" Storyboard.TargetProperty="RenderTransform.ScaleY" To="0" From="1" Duration="00:00:0.5"></DoubleAnimation> </Storyboard> </BeginStoryboard> </DataTrigger.ExitActions> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs index 520b69741..f52393e1c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs @@ -1,4 +1,5 @@ -using System; +using Microsoft.Practices.ServiceLocation; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -9,9 +10,12 @@ using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; +using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.UI.Notifications; using Tango.MachineStudio.UI.SupervisingController; using Tango.SharedUI; using Tango.SharedUI.Controls; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config index 3a7265a72..25ad810bd 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config @@ -4,6 +4,7 @@ <package id="Dragablz" version="0.0.3.197" targetFramework="net46" /> <package id="EntityFramework" version="6.0.0" targetFramework="net46" /> <package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> <package id="MahApps.Metro" version="1.5.0" targetFramework="net46" /> <package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" /> <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" /> diff --git a/Software/Visual_Studio/Tango.Core/Helpers/ThreadsHelper.cs b/Software/Visual_Studio/Tango.Core/Helpers/ThreadsHelper.cs index 5f140d344..bd934747d 100644 --- a/Software/Visual_Studio/Tango.Core/Helpers/ThreadsHelper.cs +++ b/Software/Visual_Studio/Tango.Core/Helpers/ThreadsHelper.cs @@ -3,20 +3,28 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; using System.Windows.Threading; namespace Tango.Core.Helpers { public static class ThreadsHelper { + private static Dispatcher _dispatcher; + + public static void SetDisptacher(Dispatcher dispatcher) + { + _dispatcher = dispatcher; + } + public static void InvokeUI(Action action) { - Dispatcher.CurrentDispatcher.BeginInvoke(action); + _dispatcher.BeginInvoke(action); } public static void InvokeUINow(Action action) { - Dispatcher.CurrentDispatcher.Invoke(action); + _dispatcher.Invoke(action); } } } diff --git a/Software/Visual_Studio/Tango.Integration/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Integration/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..161c5a04e --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Properties/AssemblyInfo.cs @@ -0,0 +1,6 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Tango - Logging Library")] +[assembly: ComVisible(false)]
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs new file mode 100644 index 000000000..1cbb6982a --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeClient.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.PMR.Integration; +using Tango.Settings; +using Tango.Transport; +using Tango.Transport.Adapters; +using Tango.Transport.Transporters; + +namespace Tango.Integration.Services +{ + public class ExternalBridgeClient : ProtoTransporter, IExternalBridgeClient + { + private String _serialNumber; + + public String SerialNumber + { + get { return _serialNumber; } + internal set + { + _serialNumber = value; + RaisePropertyChangedAuto(); + + var org = ObservablesEntitiesAdapter.Instance.Organizations.SingleOrDefault(x => x.Machines.ToList().Exists(y => y.SerialNumber == SerialNumber)); + Organization = org != null ? org.Name : "Unknown"; + } + } + + private String _ipAddress; + + public String IPAddress + { + get { return _ipAddress; } + set { _ipAddress = value; RaisePropertyChangedAuto(); } + } + + private String _organization; + + public String Organization + { + get { return _organization; } + private set { _organization = value; RaisePropertyChangedAuto(); } + } + + public override async Task Connect() + { + await Disconnect(); + Adapters.Clear(); + Adapters.Add(new TcpTransportAdapter(IPAddress, SettingsManager.Default.Integration.ExternalBridgeServicePort)); + await base.Connect(); + } + + public async Task<bool> Authenticate() + { + var response = await SendRequest<ExternalClientLoginRequest, ExternalClientLoginResponse>(new ExternalClientLoginRequest() { Key = "1234" }); + return response.Authenticated; + } + + public ExternalBridgeClient(String serialNumber,String ipAddress) + { + SerialNumber = serialNumber; + IPAddress = ipAddress; + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs new file mode 100644 index 000000000..fe7260a02 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeScanner.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +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 +{ + public class ExternalBridgeScanner : ExtendedObject + { + private Thread _discoveryThread; + + private ObservableCollection<IExternalBridgeClient> _availableMachines; + /// <summary> + /// Gets or sets the available services. + /// </summary> + public ObservableCollection<IExternalBridgeClient> AvailableMachines + { + get { return _availableMachines; } + private set { _availableMachines = value; RaisePropertyChangedAuto(); } + } + + private bool _isStarted; + /// <summary> + /// Gets or sets a value indicating whether this instance is started. + /// </summary> + public bool IsStarted + { + get { return _isStarted; } + private set { _isStarted = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Initializes a new instance of the <see cref="ExternalBridgeScanner"/> class. + /// </summary> + public ExternalBridgeScanner() + { + AvailableMachines = new ObservableCollection<IExternalBridgeClient>(); + } + + /// <summary> + /// Starts this instance. + /// </summary> + public void Start() + { + if (!IsStarted) + { + _discoveryThread = new Thread(DiscoveryThreadMethod); + _discoveryThread.IsBackground = true; + _discoveryThread.Start(); + } + } + + private void DiscoveryThreadMethod() + { + var Server = new UdpClient(8888); + + while (!IsStarted) + { + var ClientEp = new IPEndPoint(IPAddress.Any, 0); + var ClientRequestData = Server.Receive(ref ClientEp); + + ExternalBridgeUdpDiscoveryPacket packet = ExternalBridgeUdpDiscoveryPacket.Parser.ParseFrom(ClientRequestData); + + ExternalBridgeClient newMachine = new ExternalBridgeClient(packet.SerialNumber, ClientEp.Address.ToString()); + if (!AvailableMachines.ToList().Exists(x => x.SerialNumber == packet.SerialNumber)) + { + ThreadsHelper.InvokeUINow(() => + { + AvailableMachines.Add(newMachine); + }); + } + + Thread.Sleep(1000); + } + + Server.Close(); + } + + /// <summary> + /// Stops this instance. + /// </summary> + public void Stop() + { + if (IsStarted) + { + IsStarted = false; + } + } + + private void Client_StateChanged(object sender, Transport.TransportComponentState e) + { + if (e == Transport.TransportComponentState.Failed || e == Transport.TransportComponentState.Disposed) + { + AvailableMachines.Remove(sender as IExternalBridgeClient); + } + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeClient.cs b/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeClient.cs new file mode 100644 index 000000000..6eb0ac5f9 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Services/IExternalBridgeClient.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport; +using Tango.Transport.Transporters; + +namespace Tango.Integration.Services +{ + public interface IExternalBridgeClient : ITransporter + { + String SerialNumber { get; } + + String Organization { get; } + + String IPAddress { get; set; } + + Task<bool> Authenticate(); + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj new file mode 100644 index 000000000..e07c5a90d --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{4206AC58-3B57-4699-8835-90BF6DB01A61}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Tango.Integration</RootNamespace> + <AssemblyName>Tango.Integration</AssemblyName> + <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\Build\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="Services\ExternalBridgeClient.cs" /> + <Compile Include="Services\ExternalBridgeScanner.cs" /> + <Compile Include="Services\IExternalBridgeClient.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\Tango.DAL.Observables\Tango.DAL.Observables.csproj"> + <Project>{0ecd6da8-7aa6-48d9-8b65-279d176ad9af}</Project> + <Name>Tango.DAL.Observables</Name> + </ProjectReference> + <ProjectReference Include="..\Tango.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\Tango.PMR\Tango.PMR.csproj"> + <Project>{E4927038-348D-4295-AAF4-861C58CB3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> + <ProjectReference Include="..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> + <ProjectReference Include="..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + <None Include="packages.config" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Integration/app.config b/Software/Visual_Studio/Tango.Integration/app.config new file mode 100644 index 000000000..cacd4cd77 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/app.config @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Integration/packages.config b/Software/Visual_Studio/Tango.Integration/packages.config new file mode 100644 index 000000000..6d9929c06 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> +</packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs index 51f9e0f52..07079271b 100644 --- a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs +++ b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs @@ -22,7 +22,7 @@ namespace Tango.PMR.Common { static MessageTypeReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbirvBgoLTWVz", + "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbirWBwoLTWVz", "c2FnZVR5cGUSBwoDUkdCEAASBwoDSm9iEAESCwoHU2VnbWVudBACEhQKEENh", "bGN1bGF0ZVJlcXVlc3QQAxIVChFDYWxjdWxhdGVSZXNwb25zZRAEEhMKD1By", "b2dyZXNzUmVxdWVzdBAFEhQKEFByb2dyZXNzUmVzcG9uc2UQBhIcChhTdHVi", @@ -42,8 +42,10 @@ namespace Tango.PMR.Common { "TGltaXRTd2l0Y2hSZXF1ZXN0EBsSHgoaU3R1Yk9wdExpbWl0U3dpdGNoUmVz", "cG9uc2UQHBIaChZTdHViU3RlcGVyTW90b3JSZXF1ZXN0EB0SGwoXU3R1YlN0", "ZXBlck1vdG9yUmVzcG9uc2UQHhIUChBTdHViVmFsdmVSZXF1ZXN0EB8SFQoR", - "U3R1YlZhbHZlUmVzcG9uc2UQIEIcChpjb20udHdpbmUudGFuZ28ucG1yLmNv", - "bW1vbmIGcHJvdG8z")); + "U3R1YlZhbHZlUmVzcG9uc2UQIBIkCiBFeHRlcm5hbEJyaWRnZVVkcERpc2Nv", + "dmVyeVBhY2tldBAhEh4KGkV4dGVybmFsQ2xpZW50TG9naW5SZXF1ZXN0ECIS", + "HwobRXh0ZXJuYWxDbGllbnRMb2dpblJlc3BvbnNlECNCHAoaY29tLnR3aW5l", + "LnRhbmdvLnBtci5jb21tb25iBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Common.MessageType), }, null)); @@ -86,6 +88,9 @@ namespace Tango.PMR.Common { [pbr::OriginalName("StubSteperMotorResponse")] StubSteperMotorResponse = 30, [pbr::OriginalName("StubValveRequest")] StubValveRequest = 31, [pbr::OriginalName("StubValveResponse")] StubValveResponse = 32, + [pbr::OriginalName("ExternalBridgeUdpDiscoveryPacket")] ExternalBridgeUdpDiscoveryPacket = 33, + [pbr::OriginalName("ExternalClientLoginRequest")] ExternalClientLoginRequest = 34, + [pbr::OriginalName("ExternalClientLoginResponse")] ExternalClientLoginResponse = 35, } #endregion diff --git a/Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeUdpDiscoveryPacket.cs b/Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeUdpDiscoveryPacket.cs new file mode 100644 index 000000000..163a753b7 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeUdpDiscoveryPacket.cs @@ -0,0 +1,160 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ExternalBridgeUdpDiscoveryPacket.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Integration { + + /// <summary>Holder for reflection information generated from ExternalBridgeUdpDiscoveryPacket.proto</summary> + public static partial class ExternalBridgeUdpDiscoveryPacketReflection { + + #region Descriptor + /// <summary>File descriptor for ExternalBridgeUdpDiscoveryPacket.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ExternalBridgeUdpDiscoveryPacketReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiZFeHRlcm5hbEJyaWRnZVVkcERpc2NvdmVyeVBhY2tldC5wcm90bxIVVGFu", + "Z28uUE1SLkludGVncmF0aW9uIjgKIEV4dGVybmFsQnJpZGdlVWRwRGlzY292", + "ZXJ5UGFja2V0EhQKDFNlcmlhbE51bWJlchgCIAEoCUIhCh9jb20udHdpbmUu", + "dGFuZ28ucG1yLmludGVncmF0aW9uYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Integration.ExternalBridgeUdpDiscoveryPacket), global::Tango.PMR.Integration.ExternalBridgeUdpDiscoveryPacket.Parser, new[]{ "SerialNumber" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class ExternalBridgeUdpDiscoveryPacket : pb::IMessage<ExternalBridgeUdpDiscoveryPacket> { + private static readonly pb::MessageParser<ExternalBridgeUdpDiscoveryPacket> _parser = new pb::MessageParser<ExternalBridgeUdpDiscoveryPacket>(() => new ExternalBridgeUdpDiscoveryPacket()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<ExternalBridgeUdpDiscoveryPacket> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Integration.ExternalBridgeUdpDiscoveryPacketReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalBridgeUdpDiscoveryPacket() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalBridgeUdpDiscoveryPacket(ExternalBridgeUdpDiscoveryPacket other) : this() { + serialNumber_ = other.serialNumber_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalBridgeUdpDiscoveryPacket Clone() { + return new ExternalBridgeUdpDiscoveryPacket(this); + } + + /// <summary>Field number for the "SerialNumber" field.</summary> + public const int SerialNumberFieldNumber = 2; + private string serialNumber_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string SerialNumber { + get { return serialNumber_; } + set { + serialNumber_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ExternalBridgeUdpDiscoveryPacket); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ExternalBridgeUdpDiscoveryPacket other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (SerialNumber != other.SerialNumber) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (SerialNumber.Length != 0) hash ^= SerialNumber.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (SerialNumber.Length != 0) { + output.WriteRawTag(18); + output.WriteString(SerialNumber); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (SerialNumber.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SerialNumber); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ExternalBridgeUdpDiscoveryPacket other) { + if (other == null) { + return; + } + if (other.SerialNumber.Length != 0) { + SerialNumber = other.SerialNumber; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 18: { + SerialNumber = input.ReadString(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginRequest.cs b/Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginRequest.cs new file mode 100644 index 000000000..2b614b2ed --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginRequest.cs @@ -0,0 +1,160 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ExternalClientLoginRequest.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Integration { + + /// <summary>Holder for reflection information generated from ExternalClientLoginRequest.proto</summary> + public static partial class ExternalClientLoginRequestReflection { + + #region Descriptor + /// <summary>File descriptor for ExternalClientLoginRequest.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ExternalClientLoginRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiBFeHRlcm5hbENsaWVudExvZ2luUmVxdWVzdC5wcm90bxIVVGFuZ28uUE1S", + "LkludGVncmF0aW9uIikKGkV4dGVybmFsQ2xpZW50TG9naW5SZXF1ZXN0EgsK", + "A2tleRgBIAEoCUIhCh9jb20udHdpbmUudGFuZ28ucG1yLmludGVncmF0aW9u", + "YgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Integration.ExternalClientLoginRequest), global::Tango.PMR.Integration.ExternalClientLoginRequest.Parser, new[]{ "Key" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class ExternalClientLoginRequest : pb::IMessage<ExternalClientLoginRequest> { + private static readonly pb::MessageParser<ExternalClientLoginRequest> _parser = new pb::MessageParser<ExternalClientLoginRequest>(() => new ExternalClientLoginRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<ExternalClientLoginRequest> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Integration.ExternalClientLoginRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalClientLoginRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalClientLoginRequest(ExternalClientLoginRequest other) : this() { + key_ = other.key_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalClientLoginRequest Clone() { + return new ExternalClientLoginRequest(this); + } + + /// <summary>Field number for the "key" field.</summary> + public const int KeyFieldNumber = 1; + private string key_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Key { + get { return key_; } + set { + key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ExternalClientLoginRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ExternalClientLoginRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Key != other.Key) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Key.Length != 0) hash ^= Key.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Key.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Key); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Key.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ExternalClientLoginRequest other) { + if (other == null) { + return; + } + if (other.Key.Length != 0) { + Key = other.Key; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Key = input.ReadString(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginResponse.cs b/Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginResponse.cs new file mode 100644 index 000000000..3d374024c --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginResponse.cs @@ -0,0 +1,188 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ExternalClientLoginResponse.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Integration { + + /// <summary>Holder for reflection information generated from ExternalClientLoginResponse.proto</summary> + public static partial class ExternalClientLoginResponseReflection { + + #region Descriptor + /// <summary>File descriptor for ExternalClientLoginResponse.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ExternalClientLoginResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiFFeHRlcm5hbENsaWVudExvZ2luUmVzcG9uc2UucHJvdG8SFVRhbmdvLlBN", + "Ui5JbnRlZ3JhdGlvbiJKChtFeHRlcm5hbENsaWVudExvZ2luUmVzcG9uc2US", + "FQoNQXV0aGVudGljYXRlZBgBIAEoCBIUCgxTZXJpYWxOdW1iZXIYAiABKAlC", + "IQofY29tLnR3aW5lLnRhbmdvLnBtci5pbnRlZ3JhdGlvbmIGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Integration.ExternalClientLoginResponse), global::Tango.PMR.Integration.ExternalClientLoginResponse.Parser, new[]{ "Authenticated", "SerialNumber" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class ExternalClientLoginResponse : pb::IMessage<ExternalClientLoginResponse> { + private static readonly pb::MessageParser<ExternalClientLoginResponse> _parser = new pb::MessageParser<ExternalClientLoginResponse>(() => new ExternalClientLoginResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<ExternalClientLoginResponse> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Integration.ExternalClientLoginResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalClientLoginResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalClientLoginResponse(ExternalClientLoginResponse other) : this() { + authenticated_ = other.authenticated_; + serialNumber_ = other.serialNumber_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalClientLoginResponse Clone() { + return new ExternalClientLoginResponse(this); + } + + /// <summary>Field number for the "Authenticated" field.</summary> + public const int AuthenticatedFieldNumber = 1; + private bool authenticated_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Authenticated { + get { return authenticated_; } + set { + authenticated_ = value; + } + } + + /// <summary>Field number for the "SerialNumber" field.</summary> + public const int SerialNumberFieldNumber = 2; + private string serialNumber_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string SerialNumber { + get { return serialNumber_; } + set { + serialNumber_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ExternalClientLoginResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ExternalClientLoginResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Authenticated != other.Authenticated) return false; + if (SerialNumber != other.SerialNumber) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Authenticated != false) hash ^= Authenticated.GetHashCode(); + if (SerialNumber.Length != 0) hash ^= SerialNumber.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Authenticated != false) { + output.WriteRawTag(8); + output.WriteBool(Authenticated); + } + if (SerialNumber.Length != 0) { + output.WriteRawTag(18); + output.WriteString(SerialNumber); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Authenticated != false) { + size += 1 + 1; + } + if (SerialNumber.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SerialNumber); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ExternalClientLoginResponse other) { + if (other == null) { + return; + } + if (other.Authenticated != false) { + Authenticated = other.Authenticated; + } + if (other.SerialNumber.Length != 0) { + SerialNumber = other.SerialNumber; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + Authenticated = input.ReadBool(); + break; + } + case 18: { + SerialNumber = input.ReadString(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index 08a809060..a720373ae 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -48,6 +48,9 @@ <Link>GlobalVersionInfo.cs</Link> </Compile> <Compile Include="ExtensionMethods.cs" /> + <Compile Include="Integration\ExternalBridgeUdpDiscoveryPacket.cs" /> + <Compile Include="Integration\ExternalClientLoginRequest.cs" /> + <Compile Include="Integration\ExternalClientLoginResponse.cs" /> <Compile Include="MessageFactory.cs" /> <Compile Include="NativePMR.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> diff --git a/Software/Visual_Studio/Tango.Settings/Integration.cs b/Software/Visual_Studio/Tango.Settings/Integration.cs new file mode 100644 index 000000000..8ca80176b --- /dev/null +++ b/Software/Visual_Studio/Tango.Settings/Integration.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Settings +{ + public class Integration + { + public int ExternalBridgeServicePort { get; set; } + + public Integration() + { + ExternalBridgeServicePort = 1984; + } + } +} diff --git a/Software/Visual_Studio/Tango.Settings/SettingsCollection.cs b/Software/Visual_Studio/Tango.Settings/SettingsCollection.cs index aae228b49..1deeac638 100644 --- a/Software/Visual_Studio/Tango.Settings/SettingsCollection.cs +++ b/Software/Visual_Studio/Tango.Settings/SettingsCollection.cs @@ -18,6 +18,8 @@ namespace Tango.Settings public StubsUI StubsUI { get; set; } + public Integration Integration { get; set; } + /// <summary> /// Initializes a new instance of the <see cref="SettingsCollection"/> class. /// </summary> @@ -26,6 +28,7 @@ namespace Tango.Settings DataBase = new DataBase(); MachineStudio = new MachineStudio(); StubsUI = new StubsUI(); + Integration = new Integration(); } } } diff --git a/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj b/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj index e85a5f1bd..edd0b1c25 100644 --- a/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj +++ b/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj @@ -44,6 +44,7 @@ <Link>GlobalVersionInfo.cs</Link> </Compile> <Compile Include="DataBase.cs" /> + <Compile Include="Integration.cs" /> <Compile Include="MachineStudioSettings\MachineStudio.cs" /> <Compile Include="MachineStudioSettings\SynchronizationModule.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs index bb3a95cbc..aeda918fa 100644 --- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs @@ -18,7 +18,7 @@ namespace Tango.Transport /// Represents an <see cref="ITransporter"/> base class. /// </summary> /// <seealso cref="Tango.Transport.ITransporter" /> - public abstract class TransporterBase : ITransporter + public abstract class TransporterBase : ExtendedObject, ITransporter { private ConcurrentQueue<TransportMessageBase> _sendingQueue; private List<TransportMessageBase> _pendingRequests; @@ -237,7 +237,7 @@ namespace Tango.Transport /// Connects the transport component. /// </summary> /// <returns></returns> - public async Task Connect() + public virtual async Task Connect() { State = TransportComponentState.Connected; StartThreads(); @@ -249,7 +249,7 @@ namespace Tango.Transport /// Disconnects the transport component. /// </summary> /// <returns></returns> - public async Task Disconnect() + public virtual async Task Disconnect() { State = TransportComponentState.Disconnected; await Task.WhenAll(Adapters.Select(x => x.Disconnect())); diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index 52f716bf8..f64a4cf59 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -101,6 +101,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tango.ColorLib", "Native\Ta EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.AutoComplete", "SideChains\Tango.AutoComplete\Tango.AutoComplete.csproj", "{BB2ABB74-BA58-4812-83AA-EC8171F42DF4}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.Integration", "Tango.Integration\Tango.Integration.csproj", "{4206AC58-3B57-4699-8835-90BF6DB01A61}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -861,6 +863,26 @@ Global {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Release|x64.Build.0 = Release|Any CPU {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Release|x86.ActiveCfg = Release|Any CPU {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Release|x86.Build.0 = Release|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Debug|ARM.ActiveCfg = Debug|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Debug|ARM.Build.0 = Debug|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Debug|ARM64.Build.0 = Debug|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Debug|x64.ActiveCfg = Debug|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Debug|x64.Build.0 = Debug|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Debug|x86.ActiveCfg = Debug|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Debug|x86.Build.0 = Debug|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Release|Any CPU.Build.0 = Release|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Release|ARM.ActiveCfg = Release|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Release|ARM.Build.0 = Release|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Release|ARM64.ActiveCfg = Release|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Release|ARM64.Build.0 = Release|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Release|x64.ActiveCfg = Release|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Release|x64.Build.0 = Release|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Release|x86.ActiveCfg = Release|Any CPU + {4206AC58-3B57-4699-8835-90BF6DB01A61}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE |
