From 365d56552ae7a0ecee1fa0bae50ec6416eb8b8ff Mon Sep 17 00:00:00 2001 From: Logan McKinley Date: Mon, 1 Apr 2019 14:50:34 -0400 Subject: [PATCH 1/4] updated nuget packages and added appcenter.setuserid for #712 --- .../AndroidSensusServiceHelper.cs | 2 + Sensus.Android/Sensus.Android.csproj | 38 +++++++++--------- Sensus.Android/packages.config | 6 +-- Sensus.iOS.Tests/Sensus.iOS.Tests.csproj | 40 +++++++++---------- Sensus.iOS.Tests/packages.config | 6 +-- Sensus.iOS/Sensus.iOS.csproj | 40 +++++++++---------- Sensus.iOS/iOSSensusServiceHelper.cs | 4 ++ Sensus.iOS/packages.config | 6 +-- 8 files changed, 74 insertions(+), 68 deletions(-) diff --git a/Sensus.Android.Shared/AndroidSensusServiceHelper.cs b/Sensus.Android.Shared/AndroidSensusServiceHelper.cs index 4ee67b35d..dada555be 100644 --- a/Sensus.Android.Shared/AndroidSensusServiceHelper.cs +++ b/Sensus.Android.Shared/AndroidSensusServiceHelper.cs @@ -238,6 +238,8 @@ public void SetService(AndroidSensusService service) _wakeLock = (_service.GetSystemService(global::Android.Content.Context.PowerService) as PowerManager).NewWakeLock(WakeLockFlags.Partial, "SENSUS"); _wakeLockAcquisitionCount = 0; _deviceId = Settings.Secure.GetString(_service.ContentResolver, Settings.Secure.AndroidId); + + Microsoft.AppCenter.AppCenter.SetUserId(_deviceId); } } diff --git a/Sensus.Android/Sensus.Android.csproj b/Sensus.Android/Sensus.Android.csproj index b2e22aa17..c1aaf7bf0 100644 --- a/Sensus.Android/Sensus.Android.csproj +++ b/Sensus.Android/Sensus.Android.csproj @@ -57,6 +57,24 @@ Store. It is possible to run and debug this project on physical and virtual Andr 2G + + ..\packages\Microsoft.AppCenter.1.13.2\lib\MonoAndroid403\Microsoft.AppCenter.dll + + + ..\packages\Microsoft.AppCenter.Analytics.1.13.2\lib\MonoAndroid403\Microsoft.AppCenter.Analytics.dll + + + ..\packages\Microsoft.AppCenter.Analytics.1.13.2\lib\MonoAndroid403\Microsoft.AppCenter.Analytics.Android.Bindings.dll + + + ..\packages\Microsoft.AppCenter.1.13.2\lib\MonoAndroid403\Microsoft.AppCenter.Android.Bindings.dll + + + ..\packages\Microsoft.AppCenter.Crashes.1.13.2\lib\MonoAndroid403\Microsoft.AppCenter.Crashes.dll + + + ..\packages\Microsoft.AppCenter.Crashes.1.13.2\lib\MonoAndroid403\Microsoft.AppCenter.Crashes.Android.Bindings.dll + @@ -301,24 +319,6 @@ Store. It is possible to run and debug this project on physical and virtual Andr ..\packages\Xamarin.Azure.NotificationHubs.Android.0.5.0\lib\MonoAndroid403\Xamarin.Azure.NotificationHubs.Android.dll - - ..\packages\Microsoft.AppCenter.1.11.0\lib\MonoAndroid403\Microsoft.AppCenter.Android.Bindings.dll - - - ..\packages\Microsoft.AppCenter.1.11.0\lib\MonoAndroid403\Microsoft.AppCenter.dll - - - ..\packages\Microsoft.AppCenter.Analytics.1.11.0\lib\MonoAndroid403\Microsoft.AppCenter.Analytics.Android.Bindings.dll - - - ..\packages\Microsoft.AppCenter.Analytics.1.11.0\lib\MonoAndroid403\Microsoft.AppCenter.Analytics.dll - - - ..\packages\Microsoft.AppCenter.Crashes.1.11.0\lib\MonoAndroid403\Microsoft.AppCenter.Crashes.Android.Bindings.dll - - - ..\packages\Microsoft.AppCenter.Crashes.1.11.0\lib\MonoAndroid403\Microsoft.AppCenter.Crashes.dll - ..\packages\Newtonsoft.Json.12.0.1\lib\netstandard2.0\Newtonsoft.Json.dll @@ -387,7 +387,7 @@ Store. It is possible to run and debug this project on physical and virtual Andr - + diff --git a/Sensus.Android/packages.config b/Sensus.Android/packages.config index a5a8192b3..5fc3f188e 100644 --- a/Sensus.Android/packages.config +++ b/Sensus.Android/packages.config @@ -9,9 +9,9 @@ - - - + + + diff --git a/Sensus.iOS.Tests/Sensus.iOS.Tests.csproj b/Sensus.iOS.Tests/Sensus.iOS.Tests.csproj index b8fb59181..156bd4157 100644 --- a/Sensus.iOS.Tests/Sensus.iOS.Tests.csproj +++ b/Sensus.iOS.Tests/Sensus.iOS.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -80,6 +80,24 @@ iPhone Developer + + ..\packages\Microsoft.AppCenter.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.dll + + + ..\packages\Microsoft.AppCenter.Analytics.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.Analytics.dll + + + ..\packages\Microsoft.AppCenter.Analytics.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.Analytics.iOS.Bindings.dll + + + ..\packages\Microsoft.AppCenter.Crashes.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.Crashes.dll + + + ..\packages\Microsoft.AppCenter.Crashes.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.Crashes.iOS.Bindings.dll + + + ..\packages\Microsoft.AppCenter.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.iOS.Bindings.dll + @@ -216,24 +234,6 @@ ..\packages\TTGSnackbar.1.3.5\lib\Xamarin.iOS10\TTGSnackbar.dll - - ..\packages\Microsoft.AppCenter.1.11.0\lib\Xamarin.iOS10\Microsoft.AppCenter.dll - - - ..\packages\Microsoft.AppCenter.1.11.0\lib\Xamarin.iOS10\Microsoft.AppCenter.iOS.Bindings.dll - - - ..\packages\Microsoft.AppCenter.Analytics.1.11.0\lib\Xamarin.iOS10\Microsoft.AppCenter.Analytics.dll - - - ..\packages\Microsoft.AppCenter.Analytics.1.11.0\lib\Xamarin.iOS10\Microsoft.AppCenter.Analytics.iOS.Bindings.dll - - - ..\packages\Microsoft.AppCenter.Crashes.1.11.0\lib\Xamarin.iOS10\Microsoft.AppCenter.Crashes.dll - - - ..\packages\Microsoft.AppCenter.Crashes.1.11.0\lib\Xamarin.iOS10\Microsoft.AppCenter.Crashes.iOS.Bindings.dll - ..\packages\Newtonsoft.Json.12.0.1\lib\netstandard2.0\Newtonsoft.Json.dll @@ -415,4 +415,4 @@ - + \ No newline at end of file diff --git a/Sensus.iOS.Tests/packages.config b/Sensus.iOS.Tests/packages.config index d5bd85226..4ed366e83 100644 --- a/Sensus.iOS.Tests/packages.config +++ b/Sensus.iOS.Tests/packages.config @@ -6,9 +6,9 @@ - - - + + + diff --git a/Sensus.iOS/Sensus.iOS.csproj b/Sensus.iOS/Sensus.iOS.csproj index 68cbe29ab..d311dbdd6 100644 --- a/Sensus.iOS/Sensus.iOS.csproj +++ b/Sensus.iOS/Sensus.iOS.csproj @@ -72,7 +72,7 @@ Store. It is possible to run and debug this project on physical and virtual iOS Sensus App Store false 1701 -true + true true @@ -94,6 +94,24 @@ Store. It is possible to run and debug this project on physical and virtual iOS iPhone Developer + + ..\packages\Microsoft.AppCenter.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.dll + + + ..\packages\Microsoft.AppCenter.Analytics.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.Analytics.dll + + + ..\packages\Microsoft.AppCenter.Analytics.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.Analytics.iOS.Bindings.dll + + + ..\packages\Microsoft.AppCenter.Crashes.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.Crashes.dll + + + ..\packages\Microsoft.AppCenter.Crashes.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.Crashes.iOS.Bindings.dll + + + ..\packages\Microsoft.AppCenter.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.iOS.Bindings.dll + ..\dependencies\msband\ios\Microsoft.Band.iOS.dll @@ -236,24 +254,6 @@ Store. It is possible to run and debug this project on physical and virtual iOS ..\packages\Estimote.iOS.Proximity.1.2.0\lib\xamarinios10\Estimote.iOS.Proximity.dll - - ..\packages\Microsoft.AppCenter.1.11.0\lib\Xamarin.iOS10\Microsoft.AppCenter.dll - - - ..\packages\Microsoft.AppCenter.1.11.0\lib\Xamarin.iOS10\Microsoft.AppCenter.iOS.Bindings.dll - - - ..\packages\Microsoft.AppCenter.Analytics.1.11.0\lib\Xamarin.iOS10\Microsoft.AppCenter.Analytics.dll - - - ..\packages\Microsoft.AppCenter.Analytics.1.11.0\lib\Xamarin.iOS10\Microsoft.AppCenter.Analytics.iOS.Bindings.dll - - - ..\packages\Microsoft.AppCenter.Crashes.1.11.0\lib\Xamarin.iOS10\Microsoft.AppCenter.Crashes.dll - - - ..\packages\Microsoft.AppCenter.Crashes.1.11.0\lib\Xamarin.iOS10\Microsoft.AppCenter.Crashes.iOS.Bindings.dll - ..\packages\Newtonsoft.Json.12.0.1\lib\netstandard2.0\Newtonsoft.Json.dll @@ -379,7 +379,7 @@ Store. It is possible to run and debug this project on physical and virtual iOS - + diff --git a/Sensus.iOS/iOSSensusServiceHelper.cs b/Sensus.iOS/iOSSensusServiceHelper.cs index 8dc574fc1..f800f9e92 100644 --- a/Sensus.iOS/iOSSensusServiceHelper.cs +++ b/Sensus.iOS/iOSSensusServiceHelper.cs @@ -148,6 +148,10 @@ public iOSSensusServiceHelper() // time the app is killed and restarted. but the NRE condition above should be very rare. _deviceId = Guid.NewGuid().ToString(); } + finally + { + Microsoft.AppCenter.AppCenter.SetUserId(_deviceId); + } try { diff --git a/Sensus.iOS/packages.config b/Sensus.iOS/packages.config index 4d6df00ed..bf17b66f6 100644 --- a/Sensus.iOS/packages.config +++ b/Sensus.iOS/packages.config @@ -8,9 +8,9 @@ - - - + + + From f6c8ce3c42cbb79d2311c3aa3fcbea4712de40c7 Mon Sep 17 00:00:00 2001 From: Charles McKinley Date: Tue, 2 Apr 2019 16:35:01 -0400 Subject: [PATCH 2/4] fixed merge problem --- .../AndroidSensusServiceHelper.cs | 24 ++--------- .../Sensus.Android.Tests.csproj | 40 +++++++++---------- Sensus.Android.Tests/packages.config | 6 +-- Sensus.Android/Sensus.Android.csproj | 12 +++--- Sensus.Android/packages.config | 6 +-- Sensus.iOS.Tests/Sensus.iOS.Tests.csproj | 12 +++--- Sensus.iOS.Tests/packages.config | 6 +-- Sensus.iOS/Sensus.iOS.csproj | 12 +++--- Sensus.iOS/packages.config | 6 +-- 9 files changed, 53 insertions(+), 71 deletions(-) diff --git a/Sensus.Android.Shared/AndroidSensusServiceHelper.cs b/Sensus.Android.Shared/AndroidSensusServiceHelper.cs index 43577910c..f0a2e409f 100644 --- a/Sensus.Android.Shared/AndroidSensusServiceHelper.cs +++ b/Sensus.Android.Shared/AndroidSensusServiceHelper.cs @@ -210,28 +210,10 @@ public AndroidSensusServiceHelper() { _actionsToRunUsingMainActivity = new List>(); _userDeniedBluetoothEnable = false; - } - - public void SetService(AndroidSensusService service) - { - _service = service; - - if (_service == null) - { - if (_wakeLock != null) - { - _wakeLock.Dispose(); - _wakeLock = null; - } - } - else - { - _wakeLock = (_service.GetSystemService(global::Android.Content.Context.PowerService) as PowerManager).NewWakeLock(WakeLockFlags.Partial, "SENSUS"); - _wakeLockAcquisitionCount = 0; - _deviceId = Settings.Secure.GetString(_service.ContentResolver, Settings.Secure.AndroidId); + _wakeLock = (Application.Context.GetSystemService(global::Android.Content.Context.PowerService) as PowerManager).NewWakeLock(WakeLockFlags.Partial, "SENSUS"); + _deviceId = Settings.Secure.GetString(Application.Context.ContentResolver, Settings.Secure.AndroidId); - Microsoft.AppCenter.AppCenter.SetUserId(_deviceId); - } + Microsoft.AppCenter.AppCenter.SetUserId(_deviceId); } #region main activity diff --git a/Sensus.Android.Tests/Sensus.Android.Tests.csproj b/Sensus.Android.Tests/Sensus.Android.Tests.csproj index a24047b8f..589e95356 100644 --- a/Sensus.Android.Tests/Sensus.Android.Tests.csproj +++ b/Sensus.Android.Tests/Sensus.Android.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -52,6 +52,24 @@ armeabi-v7a;arm64-v8a;x86 + + ..\packages\Microsoft.AppCenter.1.14.0\lib\MonoAndroid403\Microsoft.AppCenter.dll + + + ..\packages\Microsoft.AppCenter.Analytics.1.14.0\lib\MonoAndroid403\Microsoft.AppCenter.Analytics.dll + + + ..\packages\Microsoft.AppCenter.Analytics.1.14.0\lib\MonoAndroid403\Microsoft.AppCenter.Analytics.Android.Bindings.dll + + + ..\packages\Microsoft.AppCenter.1.14.0\lib\MonoAndroid403\Microsoft.AppCenter.Android.Bindings.dll + + + ..\packages\Microsoft.AppCenter.Crashes.1.14.0\lib\MonoAndroid403\Microsoft.AppCenter.Crashes.dll + + + ..\packages\Microsoft.AppCenter.Crashes.1.14.0\lib\MonoAndroid403\Microsoft.AppCenter.Crashes.Android.Bindings.dll + @@ -304,24 +322,6 @@ ..\packages\Xamarin.Azure.NotificationHubs.Android.0.4.0\lib\MonoAndroid403\Xamarin.Azure.NotificationHubs.Android.dll - - ..\packages\Microsoft.AppCenter.1.11.0\lib\MonoAndroid403\Microsoft.AppCenter.Android.Bindings.dll - - - ..\packages\Microsoft.AppCenter.1.11.0\lib\MonoAndroid403\Microsoft.AppCenter.dll - - - ..\packages\Microsoft.AppCenter.Analytics.1.11.0\lib\MonoAndroid403\Microsoft.AppCenter.Analytics.Android.Bindings.dll - - - ..\packages\Microsoft.AppCenter.Analytics.1.11.0\lib\MonoAndroid403\Microsoft.AppCenter.Analytics.dll - - - ..\packages\Microsoft.AppCenter.Crashes.1.11.0\lib\MonoAndroid403\Microsoft.AppCenter.Crashes.Android.Bindings.dll - - - ..\packages\Microsoft.AppCenter.Crashes.1.11.0\lib\MonoAndroid403\Microsoft.AppCenter.Crashes.dll - ..\packages\Newtonsoft.Json.12.0.1\lib\netstandard2.0\Newtonsoft.Json.dll @@ -378,7 +378,7 @@ - + diff --git a/Sensus.Android.Tests/packages.config b/Sensus.Android.Tests/packages.config index 69eed35db..e73a5a6f6 100644 --- a/Sensus.Android.Tests/packages.config +++ b/Sensus.Android.Tests/packages.config @@ -8,9 +8,9 @@ - - - + + + diff --git a/Sensus.Android/Sensus.Android.csproj b/Sensus.Android/Sensus.Android.csproj index 5b7d152aa..30ad1a7da 100644 --- a/Sensus.Android/Sensus.Android.csproj +++ b/Sensus.Android/Sensus.Android.csproj @@ -58,22 +58,22 @@ Store. It is possible to run and debug this project on physical and virtual Andr - ..\packages\Microsoft.AppCenter.1.13.2\lib\MonoAndroid403\Microsoft.AppCenter.dll + ..\packages\Microsoft.AppCenter.1.14.0\lib\MonoAndroid403\Microsoft.AppCenter.dll - ..\packages\Microsoft.AppCenter.Analytics.1.13.2\lib\MonoAndroid403\Microsoft.AppCenter.Analytics.dll + ..\packages\Microsoft.AppCenter.Analytics.1.14.0\lib\MonoAndroid403\Microsoft.AppCenter.Analytics.dll - ..\packages\Microsoft.AppCenter.Analytics.1.13.2\lib\MonoAndroid403\Microsoft.AppCenter.Analytics.Android.Bindings.dll + ..\packages\Microsoft.AppCenter.Analytics.1.14.0\lib\MonoAndroid403\Microsoft.AppCenter.Analytics.Android.Bindings.dll - ..\packages\Microsoft.AppCenter.1.13.2\lib\MonoAndroid403\Microsoft.AppCenter.Android.Bindings.dll + ..\packages\Microsoft.AppCenter.1.14.0\lib\MonoAndroid403\Microsoft.AppCenter.Android.Bindings.dll - ..\packages\Microsoft.AppCenter.Crashes.1.13.2\lib\MonoAndroid403\Microsoft.AppCenter.Crashes.dll + ..\packages\Microsoft.AppCenter.Crashes.1.14.0\lib\MonoAndroid403\Microsoft.AppCenter.Crashes.dll - ..\packages\Microsoft.AppCenter.Crashes.1.13.2\lib\MonoAndroid403\Microsoft.AppCenter.Crashes.Android.Bindings.dll + ..\packages\Microsoft.AppCenter.Crashes.1.14.0\lib\MonoAndroid403\Microsoft.AppCenter.Crashes.Android.Bindings.dll diff --git a/Sensus.Android/packages.config b/Sensus.Android/packages.config index dcd613809..d324b4684 100644 --- a/Sensus.Android/packages.config +++ b/Sensus.Android/packages.config @@ -9,9 +9,9 @@ - - - + + + diff --git a/Sensus.iOS.Tests/Sensus.iOS.Tests.csproj b/Sensus.iOS.Tests/Sensus.iOS.Tests.csproj index 1ae6be06d..808380bb3 100644 --- a/Sensus.iOS.Tests/Sensus.iOS.Tests.csproj +++ b/Sensus.iOS.Tests/Sensus.iOS.Tests.csproj @@ -81,22 +81,22 @@ - ..\packages\Microsoft.AppCenter.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.dll + ..\packages\Microsoft.AppCenter.1.14.0\lib\Xamarin.iOS10\Microsoft.AppCenter.dll - ..\packages\Microsoft.AppCenter.Analytics.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.Analytics.dll + ..\packages\Microsoft.AppCenter.Analytics.1.14.0\lib\Xamarin.iOS10\Microsoft.AppCenter.Analytics.dll - ..\packages\Microsoft.AppCenter.Analytics.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.Analytics.iOS.Bindings.dll + ..\packages\Microsoft.AppCenter.Analytics.1.14.0\lib\Xamarin.iOS10\Microsoft.AppCenter.Analytics.iOS.Bindings.dll - ..\packages\Microsoft.AppCenter.Crashes.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.Crashes.dll + ..\packages\Microsoft.AppCenter.Crashes.1.14.0\lib\Xamarin.iOS10\Microsoft.AppCenter.Crashes.dll - ..\packages\Microsoft.AppCenter.Crashes.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.Crashes.iOS.Bindings.dll + ..\packages\Microsoft.AppCenter.Crashes.1.14.0\lib\Xamarin.iOS10\Microsoft.AppCenter.Crashes.iOS.Bindings.dll - ..\packages\Microsoft.AppCenter.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.iOS.Bindings.dll + ..\packages\Microsoft.AppCenter.1.14.0\lib\Xamarin.iOS10\Microsoft.AppCenter.iOS.Bindings.dll diff --git a/Sensus.iOS.Tests/packages.config b/Sensus.iOS.Tests/packages.config index 8f350e591..480a7e089 100644 --- a/Sensus.iOS.Tests/packages.config +++ b/Sensus.iOS.Tests/packages.config @@ -6,9 +6,9 @@ - - - + + + diff --git a/Sensus.iOS/Sensus.iOS.csproj b/Sensus.iOS/Sensus.iOS.csproj index 2415601ee..eb8c0433d 100644 --- a/Sensus.iOS/Sensus.iOS.csproj +++ b/Sensus.iOS/Sensus.iOS.csproj @@ -95,22 +95,22 @@ Store. It is possible to run and debug this project on physical and virtual iOS - ..\packages\Microsoft.AppCenter.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.dll + ..\packages\Microsoft.AppCenter.1.14.0\lib\Xamarin.iOS10\Microsoft.AppCenter.dll - ..\packages\Microsoft.AppCenter.Analytics.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.Analytics.dll + ..\packages\Microsoft.AppCenter.Analytics.1.14.0\lib\Xamarin.iOS10\Microsoft.AppCenter.Analytics.dll - ..\packages\Microsoft.AppCenter.Analytics.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.Analytics.iOS.Bindings.dll + ..\packages\Microsoft.AppCenter.Analytics.1.14.0\lib\Xamarin.iOS10\Microsoft.AppCenter.Analytics.iOS.Bindings.dll - ..\packages\Microsoft.AppCenter.Crashes.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.Crashes.dll + ..\packages\Microsoft.AppCenter.Crashes.1.14.0\lib\Xamarin.iOS10\Microsoft.AppCenter.Crashes.dll - ..\packages\Microsoft.AppCenter.Crashes.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.Crashes.iOS.Bindings.dll + ..\packages\Microsoft.AppCenter.Crashes.1.14.0\lib\Xamarin.iOS10\Microsoft.AppCenter.Crashes.iOS.Bindings.dll - ..\packages\Microsoft.AppCenter.1.13.2\lib\Xamarin.iOS10\Microsoft.AppCenter.iOS.Bindings.dll + ..\packages\Microsoft.AppCenter.1.14.0\lib\Xamarin.iOS10\Microsoft.AppCenter.iOS.Bindings.dll ..\dependencies\msband\ios\Microsoft.Band.iOS.dll diff --git a/Sensus.iOS/packages.config b/Sensus.iOS/packages.config index b5adab120..d08f5eef4 100644 --- a/Sensus.iOS/packages.config +++ b/Sensus.iOS/packages.config @@ -8,9 +8,9 @@ - - - + + + From abb998d144f2db03c4d45c3341065a204fa6f997 Mon Sep 17 00:00:00 2001 From: Ryan Dagostino Date: Thu, 4 Apr 2019 14:00:33 -0400 Subject: [PATCH 3/4] working on BLE --- .../AndroidBluetoothDeviceProximityProbe.cs | 8 ++--- .../Context/BluetoothDeviceProximityProbe.cs | 34 ++++++++++++++++++- .../iOSBluetoothDeviceProximityProbe.cs | 2 +- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/Sensus.Android.Shared/Probes/Context/AndroidBluetoothDeviceProximityProbe.cs b/Sensus.Android.Shared/Probes/Context/AndroidBluetoothDeviceProximityProbe.cs index 3eaad1c8e..fe9b4278b 100644 --- a/Sensus.Android.Shared/Probes/Context/AndroidBluetoothDeviceProximityProbe.cs +++ b/Sensus.Android.Shared/Probes/Context/AndroidBluetoothDeviceProximityProbe.cs @@ -42,8 +42,8 @@ namespace Sensus.Android.Probes.Context /// * If the other device is an iOS device with Sensus running in the foreground, detection is possible. /// * If the other device is an iOS device with Sensus running in the background, detection is not possible. /// - /// NOTE: The value of running on the other device must equal the value of - /// running on the current device. When a Protocol is created from within the + /// NOTE: The value of running on the other device must equal the value of + /// running on the current device. When a Protocol is created from within the /// Sensus app, it is assigned a unique identifier. This value is maintained or changed depending on what you /// do: /// @@ -57,7 +57,7 @@ namespace Sensus.Android.Probes.Context /// your Protocols in one of the two following ways: /// /// * Create your Protocol on one platform (either Android or iOS) and then share it with a device from the other - /// platform for customization. The values of these Protocols will remain equal + /// platform for customization. The values of these Protocols will remain equal /// and this will detect encounters across platforms. /// /// * Create your Protocols separately on each platform and then set the field on @@ -93,7 +93,7 @@ protected override async Task InitializeAsync() _deviceIdCharacteristic = new BluetoothGattCharacteristic(UUID.FromString(DEVICE_ID_CHARACTERISTIC_UUID), GattProperty.Read, GattPermission.Read); _deviceIdCharacteristic.SetValue(Encoding.UTF8.GetBytes(SensusServiceHelper.Get().DeviceId)); - _deviceIdService = new BluetoothGattService(UUID.FromString(Protocol.Id), GattServiceType.Primary); + _deviceIdService = new BluetoothGattService(UUID.FromString(ServiceUUID), GattServiceType.Primary); _deviceIdService.AddCharacteristic(_deviceIdCharacteristic); _bluetoothAdvertiserCallback = new AndroidBluetoothServerAdvertisingCallback(_deviceIdService, _deviceIdCharacteristic); diff --git a/Sensus.Shared/Probes/Context/BluetoothDeviceProximityProbe.cs b/Sensus.Shared/Probes/Context/BluetoothDeviceProximityProbe.cs index 3cd58523a..5452bd284 100644 --- a/Sensus.Shared/Probes/Context/BluetoothDeviceProximityProbe.cs +++ b/Sensus.Shared/Probes/Context/BluetoothDeviceProximityProbe.cs @@ -59,6 +59,7 @@ public static async Task CompleteReadAsync(TaskCompletionSource private int _scanDurationMS; private int _readDurationMS; + private string _serviceUUID; /// /// The length of time to scan for devices in proximity (in milliseconds). The longer the scan, the @@ -115,6 +116,36 @@ public int ReadDurationMS } } + /// + /// The length of time to read identifiers from scanned devices (in milliseconds). The longer the read, the + /// more likely it is that all scanned devices will be read. However, note that, if the + /// is configured to use [push notifications](xref:push_notifications), then the combination of + /// and should not exceed 20 seconds, as there is + /// limited time to complete all background processing. It is difficult to recommend a "best" value, but + /// 10000ms seems like a reasonable read duration, all things considered. + /// + /// The read time ms. + [EntryIntegerUiProperty("Service ID", true, 6, true)] + public string ServiceUUID + { + get + { + return _serviceUUID; + } + set + { + if (Guid.TryParse(_serviceUUID, out Guid val) == false) + { + val = Guid.NewGuid(); + } + + _serviceUUID = val.ToString(); + + } + } + + + [JsonIgnore] public int ReadAttemptCount { get; set; } @@ -135,6 +166,7 @@ public BluetoothDeviceProximityProbe() { _scanDurationMS = (int)TimeSpan.FromSeconds(10).TotalMilliseconds; _readDurationMS = (int)TimeSpan.FromSeconds(10).TotalMilliseconds; + _serviceUUID = Protocol.Id; } protected override async Task InitializeAsync() @@ -162,7 +194,7 @@ protected sealed override async Task ProtectedStartAsync() SensusServiceHelper.Get().Logger.Log("Starting advertising.", LoggingLevel.Normal, GetType()); StartAdvertising(); } - catch(Exception ex) + catch (Exception ex) { SensusServiceHelper.Get().Logger.Log("Exception while starting advertising: " + ex, LoggingLevel.Normal, GetType()); } diff --git a/Sensus.iOS.Shared/Probes/Context/iOSBluetoothDeviceProximityProbe.cs b/Sensus.iOS.Shared/Probes/Context/iOSBluetoothDeviceProximityProbe.cs index 543267a76..536fbb4be 100644 --- a/Sensus.iOS.Shared/Probes/Context/iOSBluetoothDeviceProximityProbe.cs +++ b/Sensus.iOS.Shared/Probes/Context/iOSBluetoothDeviceProximityProbe.cs @@ -79,7 +79,7 @@ protected override async Task InitializeAsync() CBAttributePermissions.Readable); // create service with device id characteristic - _deviceIdService = new CBMutableService(CBUUID.FromString(Protocol.Id), true); + _deviceIdService = new CBMutableService(CBUUID.FromString(ServiceUUID), true); _deviceIdService.Characteristics = new CBCharacteristic[] { _deviceIdCharacteristic }; } From 5976571b3735998b435bc0c3f555eb252c899be8 Mon Sep 17 00:00:00 2001 From: Ryan Dagostino Date: Fri, 5 Apr 2019 10:37:41 -0400 Subject: [PATCH 4/4] #735 finished up BLE --- .../AndroidBluetoothDeviceProximityProbe.cs | 4 ---- .../Context/BluetoothDeviceProximityProbe.cs | 19 +++++++------------ .../iOSBluetoothDeviceProximityProbe.cs | 9 +++------ 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/Sensus.Android.Shared/Probes/Context/AndroidBluetoothDeviceProximityProbe.cs b/Sensus.Android.Shared/Probes/Context/AndroidBluetoothDeviceProximityProbe.cs index fe9b4278b..b91c322c4 100644 --- a/Sensus.Android.Shared/Probes/Context/AndroidBluetoothDeviceProximityProbe.cs +++ b/Sensus.Android.Shared/Probes/Context/AndroidBluetoothDeviceProximityProbe.cs @@ -60,10 +60,6 @@ namespace Sensus.Android.Probes.Context /// platform for customization. The values of these Protocols will remain equal /// and this will detect encounters across platforms. /// - /// * Create your Protocols separately on each platform and then set the field on - /// one platform (using the "Set Study Identifier" button) to match the value - /// of the other platform (obtained via "Copy Study Identifier"). - /// /// See the iOS subclass of for additional information. /// public class AndroidBluetoothDeviceProximityProbe : BluetoothDeviceProximityProbe diff --git a/Sensus.Shared/Probes/Context/BluetoothDeviceProximityProbe.cs b/Sensus.Shared/Probes/Context/BluetoothDeviceProximityProbe.cs index 5452bd284..0e9afebf8 100644 --- a/Sensus.Shared/Probes/Context/BluetoothDeviceProximityProbe.cs +++ b/Sensus.Shared/Probes/Context/BluetoothDeviceProximityProbe.cs @@ -117,15 +117,9 @@ public int ReadDurationMS } /// - /// The length of time to read identifiers from scanned devices (in milliseconds). The longer the read, the - /// more likely it is that all scanned devices will be read. However, note that, if the - /// is configured to use [push notifications](xref:push_notifications), then the combination of - /// and should not exceed 20 seconds, as there is - /// limited time to complete all background processing. It is difficult to recommend a "best" value, but - /// 10000ms seems like a reasonable read duration, all things considered. + /// The Service UUID is used to scan and advertise for other devices. The Service UUID on connecting devices should match /// - /// The read time ms. - [EntryIntegerUiProperty("Service ID", true, 6, true)] + [EntryStringUiProperty("Service UUID", true, 6, true)] public string ServiceUUID { get @@ -134,12 +128,13 @@ public string ServiceUUID } set { - if (Guid.TryParse(_serviceUUID, out Guid val) == false) + if (Guid.TryParse(value, out Guid val) == false) { - val = Guid.NewGuid(); + value = Guid.NewGuid().ToString(); + } - _serviceUUID = val.ToString(); + _serviceUUID = value; } } @@ -166,7 +161,7 @@ public BluetoothDeviceProximityProbe() { _scanDurationMS = (int)TimeSpan.FromSeconds(10).TotalMilliseconds; _readDurationMS = (int)TimeSpan.FromSeconds(10).TotalMilliseconds; - _serviceUUID = Protocol.Id; + _serviceUUID = Guid.NewGuid().ToString(); } protected override async Task InitializeAsync() diff --git a/Sensus.iOS.Shared/Probes/Context/iOSBluetoothDeviceProximityProbe.cs b/Sensus.iOS.Shared/Probes/Context/iOSBluetoothDeviceProximityProbe.cs index 536fbb4be..545c695d1 100644 --- a/Sensus.iOS.Shared/Probes/Context/iOSBluetoothDeviceProximityProbe.cs +++ b/Sensus.iOS.Shared/Probes/Context/iOSBluetoothDeviceProximityProbe.cs @@ -33,8 +33,8 @@ namespace Sensus.iOS.Probes.Context /// an iOS device running this Probe will detect another device. Detection is possible if the other device is /// Android or iOS and if Sensus is foregrounded or backgrounded on the other device. /// - /// NOTE: The value of running on the other device must equal the value of - /// running on the current device. When a Protocol is created from within the + /// NOTE: The value of running on the other device must equal the value of + /// running on the current device. When a Protocol is created from within the /// Sensus app, it is assigned a unique identifier. This value is maintained or changed depending on what you /// do: /// @@ -48,12 +48,9 @@ namespace Sensus.iOS.Probes.Context /// your Protocols in one of the two following ways: /// /// * Create your Protocol on one platform (either Android or iOS) and then share it with a device from the other - /// platform for customization. The values of these Protocols will remain equal + /// platform for customization. The values of these Protocols will remain equal /// and this will detect encounters across platforms. /// - /// * Create your Protocols separately on each platform and then set the field on - /// one platform (using the "Set Study Identifier" button) to match the value - /// of the other platform (obtained via "Copy Study Identifier"). /// /// See the Android subclass of for additional information. ///