From 6e095fe0b74ee090603fc25980fa0c71f61c6467 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 24 Dec 2017 16:44:46 +0200 Subject: Implemented UsbSerialAdapter for android. --- .../java/com/twine/tango/core/ContextHelper.java | 24 +++ .../Tango.Stubs.UI/src/main/AndroidManifest.xml | 8 + .../tango/stubs/ui/dagger/IntegrationModule.java | 4 +- .../tango/stubs/ui/views/main/MainActivity.java | 4 + .../Android_Studio/Tango.Transport/build.gradle | 1 + .../Tango.Transport/src/main/AndroidManifest.xml | 4 +- .../transport/adapters/UsbTransportAdapter.java | 173 ++++++++++++++++++++- Software/Android_Studio/build.gradle | 3 +- .../PMR/Common/MessageType.pb-c.c | 16 +- .../PMR/Common/MessageType.pb-c.h | 5 +- .../ExternalBridgeUdpDiscoveryPacket.pb-c.c | 92 +++++++++++ .../ExternalBridgeUdpDiscoveryPacket.pb-c.h | 71 +++++++++ .../Integration/ExternalClientLoginRequest.pb-c.c | 92 +++++++++++ .../Integration/ExternalClientLoginRequest.pb-c.h | 71 +++++++++ .../Integration/ExternalClientLoginResponse.pb-c.c | 105 +++++++++++++ .../Integration/ExternalClientLoginResponse.pb-c.h | 73 +++++++++ Software/DB/Tango.mdf | Bin 8388608 -> 8388608 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes 18 files changed, 736 insertions(+), 10 deletions(-) create mode 100644 Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalBridgeUdpDiscoveryPacket.pb-c.c create mode 100644 Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalBridgeUdpDiscoveryPacket.pb-c.h create mode 100644 Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalClientLoginRequest.pb-c.c create mode 100644 Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalClientLoginRequest.pb-c.h create mode 100644 Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalClientLoginResponse.pb-c.c create mode 100644 Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalClientLoginResponse.pb-c.h diff --git a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ContextHelper.java b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ContextHelper.java index 768376d9d..59151f896 100644 --- a/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ContextHelper.java +++ b/Software/Android_Studio/Tango.Core/src/main/java/com/twine/tango/core/ContextHelper.java @@ -1,6 +1,7 @@ package com.twine.tango.core; import android.content.Context; +import android.support.v7.app.AppCompatActivity; /** @@ -9,6 +10,7 @@ import android.content.Context; public class ContextHelper { private static Context appContext; + private static AppCompatActivity mainActivity; /** * Initializes the helper with the application context. @@ -21,6 +23,17 @@ public class ContextHelper appContext = context; } + + /** + * Register the application main activity. + * + * @param activity the activity + */ + public static void registerMainActivity(AppCompatActivity activity) + { + mainActivity = activity; + } + /** * Gets the application context. * @@ -30,4 +43,15 @@ public class ContextHelper { return appContext; } + + + /** + * Gets the application main activity. + * + * @return the main activity + */ + public static AppCompatActivity getMainActivity() + { + return mainActivity; + } } diff --git a/Software/Android_Studio/Tango.Stubs.UI/src/main/AndroidManifest.xml b/Software/Android_Studio/Tango.Stubs.UI/src/main/AndroidManifest.xml index e699ecbd3..ad99a3b57 100644 --- a/Software/Android_Studio/Tango.Stubs.UI/src/main/AndroidManifest.xml +++ b/Software/Android_Studio/Tango.Stubs.UI/src/main/AndroidManifest.xml @@ -3,6 +3,7 @@ package="com.twine.tango.stubs.ui"> + + + + + + 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 index b06d9aa67..7fd86f537 100644 --- 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 @@ -9,6 +9,7 @@ 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 com.twine.tango.transport.adapters.UsbTransportAdapter; import javax.inject.Singleton; import dagger.Module; @@ -45,6 +46,7 @@ public class IntegrationModule @Singleton public IMachineOperator providerMachineOperator() { - return new MachineOperator(new TcpTransportAdapter("10.0.2.2", 9999)); + //return new MachineOperator(new TcpTransportAdapter("10.0.2.2", 9999)); + return new MachineOperator(new UsbTransportAdapter()); } } diff --git a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/views/main/MainActivity.java b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/views/main/MainActivity.java index c2699c640..c1f85b971 100644 --- a/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/views/main/MainActivity.java +++ b/Software/Android_Studio/Tango.Stubs.UI/src/main/java/com/twine/tango/stubs/ui/views/main/MainActivity.java @@ -6,6 +6,8 @@ import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarDrawerToggle; import android.view.View; + +import com.twine.tango.core.ContextHelper; import com.twine.tango.sharedui.containers.ActivityBase; import com.twine.tango.sharedui.navigation.INavigationProvider; import com.twine.tango.stubs.ui.App; @@ -26,6 +28,8 @@ public class MainActivity extends ActivityBase + package="com.twine.tango.transport"> + + diff --git a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/adapters/UsbTransportAdapter.java b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/adapters/UsbTransportAdapter.java index 3699ebc76..8ad55708c 100644 --- a/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/adapters/UsbTransportAdapter.java +++ b/Software/Android_Studio/Tango.Transport/src/main/java/com/twine/tango/transport/adapters/UsbTransportAdapter.java @@ -1,9 +1,180 @@ package com.twine.tango.transport.adapters; +import android.app.PendingIntent; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.hardware.usb.UsbDevice; +import android.hardware.usb.UsbDeviceConnection; +import android.hardware.usb.UsbManager; + +import com.elvishew.xlog.XLog; +import com.felhr.usbserial.UsbSerialDevice; +import com.felhr.usbserial.UsbSerialInterface; +import com.twine.tango.core.ContextHelper; +import com.twine.tango.core.ObjectDisposedException; +import com.twine.tango.transport.TransportAdapterBase; +import com.twine.tango.transport.TransportComponentState; + +import java.io.IOException; +import java.util.Map; + +import io.reactivex.Completable; +import io.reactivex.schedulers.Schedulers; +import io.reactivex.subjects.PublishSubject; + /** * Created by Roy on 12/24/2017. */ -public class UsbTransportAdapter +public class UsbTransportAdapter extends TransportAdapterBase { + private static final String ACTION_USB_PERMISSION = "com.android.example.USB_PERMISSION"; + + private UsbSerialDevice serial; + private PendingIntent mPermissionIntent; + private UsbManager usbManager; + private boolean hasPermission; + private PublishSubject connectionSubject; + + public UsbTransportAdapter() + { + setAddress("0x1CBE"); + } + + public UsbTransportAdapter(String address) + { + setAddress(address); + } + + @Override + public void write(byte[] data) throws ObjectDisposedException, IOException + { + serial.write(data); + } + + @Override + public Completable connect() + { + connectionSubject = PublishSubject.create(); + + try + { + if (!hasPermission) + { + mPermissionIntent = PendingIntent.getBroadcast(ContextHelper.getMainActivity(), 0, new Intent(ACTION_USB_PERMISSION), 0); + IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION); + ContextHelper.getMainActivity().registerReceiver(mUsbReceiver, filter); + } + + usbManager = (UsbManager) ContextHelper.getMainActivity().getSystemService(Context.USB_SERVICE); + Map connectedDevices = usbManager.getDeviceList(); + + for (UsbDevice device : connectedDevices.values()) + { + if (device.getVendorId() == Integer.decode(getAddress())) + { + XLog.i("USB Device found: " + device.getManufacturerName()); + usbManager.requestPermission(device, mPermissionIntent); + break; + } + } + } catch (Exception ex) + { + notifyConnectionFailed(ex); + } + + return connectionSubject.subscribeOn(Schedulers.io()).singleOrError().toCompletable(); + } + + private void notifyConnectionSuccess() + { + setState(TransportComponentState.Connected); + //noinspection unchecked + connectionSubject.onNext(new Object()); + connectionSubject.onComplete(); + } + + private void notifyConnectionFailed(Exception ex) + { + connectionSubject.onError(ex); + } + + private void initConnection(UsbDevice device) + { + try + { + UsbDeviceConnection connection = usbManager.openDevice(device); + serial = UsbSerialDevice.createUsbSerialDevice(device, connection); + + if (serial != null && serial.open()) + { + serial.setBaudRate(9600); + serial.setDataBits(UsbSerialInterface.DATA_BITS_8); + serial.setStopBits(UsbSerialInterface.STOP_BITS_1); + serial.setParity(UsbSerialInterface.PARITY_NONE); + serial.setFlowControl(UsbSerialInterface.FLOW_CONTROL_OFF); + serial.read(this::onUsbReceiveData); + notifyConnectionSuccess(); + } + } catch (Exception ex) + { + notifyConnectionFailed(ex); + } + } + + private void onUsbReceiveData(byte[] data) + { + onDataAvailable(data); + } + + @Override + public Completable disconnect() + { + return Completable.create((x) -> + { + try + { + if (serial != null) + { + serial.close(); + setState(TransportComponentState.Disconnected); + x.onComplete(); + } + } catch (Exception ex) + { + x.onError(ex); + } + + }).subscribeOn(Schedulers.io()); + } + + private final BroadcastReceiver mUsbReceiver = new BroadcastReceiver() + { + + public void onReceive(Context context, Intent intent) + { + String action = intent.getAction(); + if (ACTION_USB_PERMISSION.equals(action)) + { + synchronized (this) + { + UsbDevice device = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE); + + if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) + { + if (device != null) + { + hasPermission = true; + initConnection(device); + } + } else + { + notifyConnectionFailed(new IllegalAccessException("Permission denied for device " + device.getDeviceName())); + } + } + } + } + }; } diff --git a/Software/Android_Studio/build.gradle b/Software/Android_Studio/build.gradle index 73b52173e..3152cdfc2 100644 --- a/Software/Android_Studio/build.gradle +++ b/Software/Android_Studio/build.gradle @@ -42,7 +42,8 @@ ext { storage: 'com.snatik:storage:2.1.0', retrofit: 'com.squareup.retrofit2:retrofit:2.3.0', retrofit_protobuf: 'com.squareup.retrofit2:converter-protobuf:2.3.0', - retrofit_rxJava: 'com.squareup.retrofit2:adapter-rxjava2:2.3.0' + retrofit_rxJava: 'com.squareup.retrofit2:adapter-rxjava2:2.3.0', + usb: 'com.github.felHR85:UsbSerial:4.5' ] } diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Common/MessageType.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Common/MessageType.pb-c.c index 6416e1fcd..e922ccf91 100644 --- a/Software/Code_Composer/twine_usblib_demo/PMR/Common/MessageType.pb-c.c +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Common/MessageType.pb-c.c @@ -7,7 +7,7 @@ #endif #include "MessageType.pb-c.h" -static const ProtobufCEnumValue message_type__enum_values_by_number[33] = +static const ProtobufCEnumValue message_type__enum_values_by_number[36] = { { "RGB", "MESSAGE_TYPE__RGB", 0 }, { "Job", "MESSAGE_TYPE__Job", 1 }, @@ -42,14 +42,20 @@ static const ProtobufCEnumValue message_type__enum_values_by_number[33] = { "StubSteperMotorResponse", "MESSAGE_TYPE__StubSteperMotorResponse", 30 }, { "StubValveRequest", "MESSAGE_TYPE__StubValveRequest", 31 }, { "StubValveResponse", "MESSAGE_TYPE__StubValveResponse", 32 }, + { "ExternalBridgeUdpDiscoveryPacket", "MESSAGE_TYPE__ExternalBridgeUdpDiscoveryPacket", 33 }, + { "ExternalClientLoginRequest", "MESSAGE_TYPE__ExternalClientLoginRequest", 34 }, + { "ExternalClientLoginResponse", "MESSAGE_TYPE__ExternalClientLoginResponse", 35 }, }; static const ProtobufCIntRange message_type__value_ranges[] = { -{0, 0},{0, 33} +{0, 0},{0, 36} }; -static const ProtobufCEnumValueIndex message_type__enum_values_by_name[33] = +static const ProtobufCEnumValueIndex message_type__enum_values_by_name[36] = { { "CalculateRequest", 3 }, { "CalculateResponse", 4 }, + { "ExternalBridgeUdpDiscoveryPacket", 33 }, + { "ExternalClientLoginRequest", 34 }, + { "ExternalClientLoginResponse", 35 }, { "Job", 1 }, { "ProgressRequest", 5 }, { "ProgressResponse", 6 }, @@ -89,9 +95,9 @@ const ProtobufCEnumDescriptor message_type__descriptor = "MessageType", "MessageType", "", - 33, + 36, message_type__enum_values_by_number, - 33, + 36, message_type__enum_values_by_name, 1, message_type__value_ranges, diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Common/MessageType.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Common/MessageType.pb-c.h index 56f9af6ca..fae795b73 100644 --- a/Software/Code_Composer/twine_usblib_demo/PMR/Common/MessageType.pb-c.h +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Common/MessageType.pb-c.h @@ -52,7 +52,10 @@ typedef enum _MessageType { MESSAGE_TYPE__StubSteperMotorRequest = 29, MESSAGE_TYPE__StubSteperMotorResponse = 30, MESSAGE_TYPE__StubValveRequest = 31, - MESSAGE_TYPE__StubValveResponse = 32 + MESSAGE_TYPE__StubValveResponse = 32, + MESSAGE_TYPE__ExternalBridgeUdpDiscoveryPacket = 33, + MESSAGE_TYPE__ExternalClientLoginRequest = 34, + MESSAGE_TYPE__ExternalClientLoginResponse = 35 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(MESSAGE_TYPE) } MessageType; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalBridgeUdpDiscoveryPacket.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalBridgeUdpDiscoveryPacket.pb-c.c new file mode 100644 index 000000000..b8a8d9c6e --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalBridgeUdpDiscoveryPacket.pb-c.c @@ -0,0 +1,92 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: ExternalBridgeUdpDiscoveryPacket.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "ExternalBridgeUdpDiscoveryPacket.pb-c.h" +void external_bridge_udp_discovery_packet__init + (ExternalBridgeUdpDiscoveryPacket *message) +{ + static const ExternalBridgeUdpDiscoveryPacket init_value = EXTERNAL_BRIDGE_UDP_DISCOVERY_PACKET__INIT; + *message = init_value; +} +size_t external_bridge_udp_discovery_packet__get_packed_size + (const ExternalBridgeUdpDiscoveryPacket *message) +{ + assert(message->base.descriptor == &external_bridge_udp_discovery_packet__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t external_bridge_udp_discovery_packet__pack + (const ExternalBridgeUdpDiscoveryPacket *message, + uint8_t *out) +{ + assert(message->base.descriptor == &external_bridge_udp_discovery_packet__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t external_bridge_udp_discovery_packet__pack_to_buffer + (const ExternalBridgeUdpDiscoveryPacket *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &external_bridge_udp_discovery_packet__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +ExternalBridgeUdpDiscoveryPacket * + external_bridge_udp_discovery_packet__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (ExternalBridgeUdpDiscoveryPacket *) + protobuf_c_message_unpack (&external_bridge_udp_discovery_packet__descriptor, + allocator, len, data); +} +void external_bridge_udp_discovery_packet__free_unpacked + (ExternalBridgeUdpDiscoveryPacket *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &external_bridge_udp_discovery_packet__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor external_bridge_udp_discovery_packet__field_descriptors[1] = +{ + { + "SerialNumber", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(ExternalBridgeUdpDiscoveryPacket, serialnumber), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned external_bridge_udp_discovery_packet__field_indices_by_name[] = { + 0, /* field[0] = SerialNumber */ +}; +static const ProtobufCIntRange external_bridge_udp_discovery_packet__number_ranges[1 + 1] = +{ + { 2, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor external_bridge_udp_discovery_packet__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "ExternalBridgeUdpDiscoveryPacket", + "ExternalBridgeUdpDiscoveryPacket", + "ExternalBridgeUdpDiscoveryPacket", + "", + sizeof(ExternalBridgeUdpDiscoveryPacket), + 1, + external_bridge_udp_discovery_packet__field_descriptors, + external_bridge_udp_discovery_packet__field_indices_by_name, + 1, external_bridge_udp_discovery_packet__number_ranges, + (ProtobufCMessageInit) external_bridge_udp_discovery_packet__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalBridgeUdpDiscoveryPacket.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalBridgeUdpDiscoveryPacket.pb-c.h new file mode 100644 index 000000000..f40ade127 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalBridgeUdpDiscoveryPacket.pb-c.h @@ -0,0 +1,71 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: ExternalBridgeUdpDiscoveryPacket.proto */ + +#ifndef PROTOBUF_C_ExternalBridgeUdpDiscoveryPacket_2eproto__INCLUDED +#define PROTOBUF_C_ExternalBridgeUdpDiscoveryPacket_2eproto__INCLUDED + +#include + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _ExternalBridgeUdpDiscoveryPacket ExternalBridgeUdpDiscoveryPacket; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _ExternalBridgeUdpDiscoveryPacket +{ + ProtobufCMessage base; + char *serialnumber; +}; +#define EXTERNAL_BRIDGE_UDP_DISCOVERY_PACKET__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&external_bridge_udp_discovery_packet__descriptor) \ + , NULL } + + +/* ExternalBridgeUdpDiscoveryPacket methods */ +void external_bridge_udp_discovery_packet__init + (ExternalBridgeUdpDiscoveryPacket *message); +size_t external_bridge_udp_discovery_packet__get_packed_size + (const ExternalBridgeUdpDiscoveryPacket *message); +size_t external_bridge_udp_discovery_packet__pack + (const ExternalBridgeUdpDiscoveryPacket *message, + uint8_t *out); +size_t external_bridge_udp_discovery_packet__pack_to_buffer + (const ExternalBridgeUdpDiscoveryPacket *message, + ProtobufCBuffer *buffer); +ExternalBridgeUdpDiscoveryPacket * + external_bridge_udp_discovery_packet__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void external_bridge_udp_discovery_packet__free_unpacked + (ExternalBridgeUdpDiscoveryPacket *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*ExternalBridgeUdpDiscoveryPacket_Closure) + (const ExternalBridgeUdpDiscoveryPacket *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor external_bridge_udp_discovery_packet__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_ExternalBridgeUdpDiscoveryPacket_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalClientLoginRequest.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalClientLoginRequest.pb-c.c new file mode 100644 index 000000000..a19339ec5 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalClientLoginRequest.pb-c.c @@ -0,0 +1,92 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: ExternalClientLoginRequest.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "ExternalClientLoginRequest.pb-c.h" +void external_client_login_request__init + (ExternalClientLoginRequest *message) +{ + static const ExternalClientLoginRequest init_value = EXTERNAL_CLIENT_LOGIN_REQUEST__INIT; + *message = init_value; +} +size_t external_client_login_request__get_packed_size + (const ExternalClientLoginRequest *message) +{ + assert(message->base.descriptor == &external_client_login_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t external_client_login_request__pack + (const ExternalClientLoginRequest *message, + uint8_t *out) +{ + assert(message->base.descriptor == &external_client_login_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t external_client_login_request__pack_to_buffer + (const ExternalClientLoginRequest *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &external_client_login_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +ExternalClientLoginRequest * + external_client_login_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (ExternalClientLoginRequest *) + protobuf_c_message_unpack (&external_client_login_request__descriptor, + allocator, len, data); +} +void external_client_login_request__free_unpacked + (ExternalClientLoginRequest *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &external_client_login_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor external_client_login_request__field_descriptors[1] = +{ + { + "key", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(ExternalClientLoginRequest, key), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned external_client_login_request__field_indices_by_name[] = { + 0, /* field[0] = key */ +}; +static const ProtobufCIntRange external_client_login_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor external_client_login_request__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "ExternalClientLoginRequest", + "ExternalClientLoginRequest", + "ExternalClientLoginRequest", + "", + sizeof(ExternalClientLoginRequest), + 1, + external_client_login_request__field_descriptors, + external_client_login_request__field_indices_by_name, + 1, external_client_login_request__number_ranges, + (ProtobufCMessageInit) external_client_login_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalClientLoginRequest.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalClientLoginRequest.pb-c.h new file mode 100644 index 000000000..b2ff576b0 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalClientLoginRequest.pb-c.h @@ -0,0 +1,71 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: ExternalClientLoginRequest.proto */ + +#ifndef PROTOBUF_C_ExternalClientLoginRequest_2eproto__INCLUDED +#define PROTOBUF_C_ExternalClientLoginRequest_2eproto__INCLUDED + +#include + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _ExternalClientLoginRequest ExternalClientLoginRequest; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _ExternalClientLoginRequest +{ + ProtobufCMessage base; + char *key; +}; +#define EXTERNAL_CLIENT_LOGIN_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&external_client_login_request__descriptor) \ + , NULL } + + +/* ExternalClientLoginRequest methods */ +void external_client_login_request__init + (ExternalClientLoginRequest *message); +size_t external_client_login_request__get_packed_size + (const ExternalClientLoginRequest *message); +size_t external_client_login_request__pack + (const ExternalClientLoginRequest *message, + uint8_t *out); +size_t external_client_login_request__pack_to_buffer + (const ExternalClientLoginRequest *message, + ProtobufCBuffer *buffer); +ExternalClientLoginRequest * + external_client_login_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void external_client_login_request__free_unpacked + (ExternalClientLoginRequest *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*ExternalClientLoginRequest_Closure) + (const ExternalClientLoginRequest *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor external_client_login_request__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_ExternalClientLoginRequest_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalClientLoginResponse.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalClientLoginResponse.pb-c.c new file mode 100644 index 000000000..6d8646415 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalClientLoginResponse.pb-c.c @@ -0,0 +1,105 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: ExternalClientLoginResponse.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "ExternalClientLoginResponse.pb-c.h" +void external_client_login_response__init + (ExternalClientLoginResponse *message) +{ + static const ExternalClientLoginResponse init_value = EXTERNAL_CLIENT_LOGIN_RESPONSE__INIT; + *message = init_value; +} +size_t external_client_login_response__get_packed_size + (const ExternalClientLoginResponse *message) +{ + assert(message->base.descriptor == &external_client_login_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t external_client_login_response__pack + (const ExternalClientLoginResponse *message, + uint8_t *out) +{ + assert(message->base.descriptor == &external_client_login_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t external_client_login_response__pack_to_buffer + (const ExternalClientLoginResponse *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &external_client_login_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +ExternalClientLoginResponse * + external_client_login_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (ExternalClientLoginResponse *) + protobuf_c_message_unpack (&external_client_login_response__descriptor, + allocator, len, data); +} +void external_client_login_response__free_unpacked + (ExternalClientLoginResponse *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &external_client_login_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor external_client_login_response__field_descriptors[2] = +{ + { + "Authenticated", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(ExternalClientLoginResponse, has_authenticated), + offsetof(ExternalClientLoginResponse, authenticated), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "SerialNumber", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(ExternalClientLoginResponse, serialnumber), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned external_client_login_response__field_indices_by_name[] = { + 0, /* field[0] = Authenticated */ + 1, /* field[1] = SerialNumber */ +}; +static const ProtobufCIntRange external_client_login_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor external_client_login_response__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "ExternalClientLoginResponse", + "ExternalClientLoginResponse", + "ExternalClientLoginResponse", + "", + sizeof(ExternalClientLoginResponse), + 2, + external_client_login_response__field_descriptors, + external_client_login_response__field_indices_by_name, + 1, external_client_login_response__number_ranges, + (ProtobufCMessageInit) external_client_login_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalClientLoginResponse.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalClientLoginResponse.pb-c.h new file mode 100644 index 000000000..46bdf15df --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Integration/ExternalClientLoginResponse.pb-c.h @@ -0,0 +1,73 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: ExternalClientLoginResponse.proto */ + +#ifndef PROTOBUF_C_ExternalClientLoginResponse_2eproto__INCLUDED +#define PROTOBUF_C_ExternalClientLoginResponse_2eproto__INCLUDED + +#include + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _ExternalClientLoginResponse ExternalClientLoginResponse; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _ExternalClientLoginResponse +{ + ProtobufCMessage base; + protobuf_c_boolean has_authenticated; + protobuf_c_boolean authenticated; + char *serialnumber; +}; +#define EXTERNAL_CLIENT_LOGIN_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&external_client_login_response__descriptor) \ + , 0, 0, NULL } + + +/* ExternalClientLoginResponse methods */ +void external_client_login_response__init + (ExternalClientLoginResponse *message); +size_t external_client_login_response__get_packed_size + (const ExternalClientLoginResponse *message); +size_t external_client_login_response__pack + (const ExternalClientLoginResponse *message, + uint8_t *out); +size_t external_client_login_response__pack_to_buffer + (const ExternalClientLoginResponse *message, + ProtobufCBuffer *buffer); +ExternalClientLoginResponse * + external_client_login_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void external_client_login_response__free_unpacked + (ExternalClientLoginResponse *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*ExternalClientLoginResponse_Closure) + (const ExternalClientLoginResponse *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor external_client_login_response__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_ExternalClientLoginResponse_2eproto__INCLUDED */ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index e1171e9f0..f3d6c1aa6 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 61c3049d0..0a80c5341 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ -- cgit v1.3.1