diff --git a/Shimmer32FeetAPI/ShimmerLogAndStream32FeetBLE.cs b/Shimmer32FeetAPI/ShimmerLogAndStream32FeetBLE.cs index b51fa02..ed1f446 100644 --- a/Shimmer32FeetAPI/ShimmerLogAndStream32FeetBLE.cs +++ b/Shimmer32FeetAPI/ShimmerLogAndStream32FeetBLE.cs @@ -16,9 +16,16 @@ public class ShimmerLogAndStream32FeetBLE : ShimmerLogAndStream protected String macAddress { get; set; } ConcurrentQueue cq = new ConcurrentQueue(); private static bool Debug = false; - public ShimmerLogAndStream32FeetBLE(String devID, String bMacAddress) + /// + /// + /// + /// + /// for example 114f439f84aa + /// + public ShimmerLogAndStream32FeetBLE(String devID, String bMacAddress, ShimmerVersion hwVersion) : base(devID) { + HardwareVersion = (int)hwVersion; macAddress = bMacAddress; } @@ -75,6 +82,21 @@ protected override void OpenConnection() BluetoothUuid TxID = BluetoothUuid.FromGuid(new Guid("49535343-8841-43f4-a8d4-ecbe34729bb3")); BluetoothUuid RxID = BluetoothUuid.FromGuid(new Guid("49535343-1e4d-4bd9-ba61-23c647249616")); BluetoothUuid ServiceID = BluetoothUuid.FromGuid(new Guid("49535343-fe7d-4ae5-8fa9-9fafd205e455")); + + if (HardwareVersion == (int)ShimmerVersion.SHIMMER3R) + { + TxID = BluetoothUuid.FromGuid(new Guid("65333333-A115-11E2-9E9A-0800200CA102")); + RxID = BluetoothUuid.FromGuid(new Guid("65333333-A115-11E2-9E9A-0800200CA101")); + ServiceID = BluetoothUuid.FromGuid(new Guid("65333333-A115-11E2-9E9A-0800200CA100")); + } + else if (HardwareVersion == (int)ShimmerVersion.SHIMMER3) + { + TxID = BluetoothUuid.FromGuid(new Guid("49535343-8841-43f4-a8d4-ecbe34729bb3")); + RxID = BluetoothUuid.FromGuid(new Guid("49535343-1e4d-4bd9-ba61-23c647249616")); + ServiceID = BluetoothUuid.FromGuid(new Guid("49535343-fe7d-4ae5-8fa9-9fafd205e455")); + } + + ServiceTXRX = bluetoothDevice.Gatt.GetPrimaryServiceAsync(ServiceID).GetAwaiter().GetResult(); if (ServiceTXRX != null) { diff --git a/ShimmerAPI/ShimmerAPI/ShimmerLogAndStream.cs b/ShimmerAPI/ShimmerAPI/ShimmerLogAndStream.cs index 9638e2f..16b223c 100644 --- a/ShimmerAPI/ShimmerAPI/ShimmerLogAndStream.cs +++ b/ShimmerAPI/ShimmerAPI/ShimmerLogAndStream.cs @@ -718,8 +718,15 @@ private void readInfoMem() } else { - //ReadCalibDump(); - ReadCalibrationParameters("All"); + var t = this.GetType(); + if (HardwareVersion == (int)ShimmerBluetooth.ShimmerVersion.SHIMMER3 && t.Name.Equals("ShimmerLogAndStream32FeetBLE")) // temporary fix to get shimmer3 BLE working, not recommended for use + { + ReadCalibDump(); + } + else + { + ReadCalibrationParameters("All"); + } } status_text = "Acquiring EXG1 configure settings..."; diff --git a/ShimmerCapture/README.md b/ShimmerCapture/README.md index 374b944..84bcd4a 100644 --- a/ShimmerCapture/README.md +++ b/ShimmerCapture/README.md @@ -1,4 +1,4 @@ # This is a GUI Example showing the use of the API on Streaming/Configuring/Connecting to a Shimmer3 device -* Both Bluetooth Classic and BLE is supported +* Both Bluetooth Classic and BLE (only Shimmer3R) is supported * For Bluetooth Classic please pair the device first and use the com port to connect -* For BLE, the device does not require pairing, use the mac address to connect to the device +* For BLE, the device does not require pairing, use the mac address to connect to the device, the mac address should be in the form ffffffffffff diff --git a/ShimmerCapture/ShimmerCapture/Control.cs b/ShimmerCapture/ShimmerCapture/Control.cs index bb60d24..505f591 100644 --- a/ShimmerCapture/ShimmerCapture/Control.cs +++ b/ShimmerCapture/ShimmerCapture/Control.cs @@ -1267,7 +1267,7 @@ public void Connect() } else { - ShimmerDevice = new ShimmerLogAndStream32FeetBLE("Shimmer", comboBoxComPorts.Text); + ShimmerDevice = new ShimmerLogAndStream32FeetBLE("Shimmer", comboBoxComPorts.Text, ShimmerAPI.ShimmerDevice.ShimmerVersion.SHIMMER3R); } ShimmerDevice.UICallback += this.HandleEvent;