/// <summary>
/// If there is any uncached task in glucoseService, we register new one.
/// </summary>
/// <param name="e">Existing Link Loss Task
/// This is task is only registered through Proximity Monitor</param>
private GattDeviceService RetrieveLinkLossService(BackgroundTaskRegistration existingLinkLossTask)
{
GattDeviceService gattService = null;
KeyValuePair<GattDeviceService, BackgroundTaskRegistration> cachedTask;
if (LinkLossService.LinkLossServiceTaskRegistrations.TryGetValue(existingLinkLossTask.Name, out cachedTask))
{
LinkLossService.WriteAlertLevelCharacteristicAsync(AlertLevelEnum.HighAlert);
this.DeviceName = cachedTask.Key.Device.Name;
gattService = cachedTask.Key;
}
else
{
existingLinkLossTask.Unregister(true);
DeviceName = DEFAULT_DEVICE;
}
return gattService;
}