Libre 2 : compare bluetooth device name with sensor id received via NFC scan, if these two don't match then it means the user has connected to another (older?) Libre 2 with bluetooth than the one for which NFC scan was done, in that case, inform user
This commit is contained in:
parent
25f4b707a2
commit
e207c5a451
|
@ -150,8 +150,19 @@ class CGMLibre2Transmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
// set to nil so we don't send it again to the delegate when there's a new connect
|
||||
tempSensorSerialNumber = nil
|
||||
|
||||
// user should be informed not to scan with the Libre app
|
||||
bluetoothTransmitterDelegate?.error(message: TextsLibreNFC.donotusethelibrelinkapp)
|
||||
// for Libre 2, the device name includes the sensor id
|
||||
// if tempSensorSerialNumber != deviceName, then it means the user has connected to another (older?) Libre 2 with bluetooth than the one for which NFC scan was done, in that case, inform user
|
||||
// compare only the last 10 characters. Normally it should be 10, but for some reason, xDrip4iOS does not correctly decode the sensor uid, the first character is not correct
|
||||
if let deviceName = deviceName, sensorSerialNumber.serialNumber.suffix(9).uppercased() != deviceName.suffix(9) {
|
||||
|
||||
bluetoothTransmitterDelegate?.error(message: TextsLibreNFC.connectedLibre2DoesNotMatchScannedLibre2)
|
||||
|
||||
} else {
|
||||
|
||||
// user should be informed not to scan with the Libre app
|
||||
bluetoothTransmitterDelegate?.error(message: TextsLibreNFC.donotusethelibrelinkapp)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -206,7 +217,7 @@ class CGMLibre2Transmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
|
||||
UserDefaults.standard.libreActiveSensorUnlockCount += 1
|
||||
|
||||
trace("sensorid = %{public}@, patchinfo = %{public}@, unlockcode = %{public}@, unlockcount = %{public}@", log: log, category: ConstantsLog.categoryCGMLibre2, type: .info, libreSensorUID.toHexString(), librePatchInfo.toHexString(), UserDefaults.standard.libreActiveSensorUnlockCode.description, UserDefaults.standard.libreActiveSensorUnlockCount.description)
|
||||
trace("sensorid as data = %{public}@, patchinfo = %{public}@, unlockcode = %{public}@, unlockcount = %{public}@", log: log, category: ConstantsLog.categoryCGMLibre2, type: .info, libreSensorUID.toHexString(), librePatchInfo.toHexString(), UserDefaults.standard.libreActiveSensorUnlockCode.description, UserDefaults.standard.libreActiveSensorUnlockCount.description)
|
||||
|
||||
let unLockPayLoad = Data(Libre2BLEUtilities.streamingUnlockPayload(sensorUID: libreSensorUID, info: librePatchInfo, enableTime: UserDefaults.standard.libreActiveSensorUnlockCode, unlockCount: UserDefaults.standard.libreActiveSensorUnlockCount))
|
||||
|
||||
|
|
|
@ -760,6 +760,7 @@ class LibreNFC: NSObject, NFCTagReaderSessionDelegate {
|
|||
UInt8((unlockCode >> 16) & 0xFF),
|
||||
UInt8((unlockCode >> 24) & 0xFF)
|
||||
]
|
||||
|
||||
y = UInt16(patchInfo[4...5]) ^ UInt16(b[1], b[0])
|
||||
|
||||
} else {
|
||||
|
|
|
@ -251,7 +251,7 @@ extension UserDefaults {
|
|||
/// Libre Unlock count
|
||||
case libreActiveSensorUnlockCount = "activeSensorUnlockCount"
|
||||
|
||||
/// - Libre sensor id - used in Libre 2 setup - should be read first eg via bubble or mm and then used in Libre 2 communication
|
||||
/// - Libre sensor id - used in Libre 2 setup
|
||||
/// - stored as data as read from transmitter
|
||||
case libreSensorUID = "libreSensorUID"
|
||||
|
||||
|
|
|
@ -19,3 +19,10 @@
|
|||
|
||||
/// Device must support at least iOS 14.0
|
||||
"deviceMustSupportIOS14" = "To connect to Libre 2, this iPhone needs upgrading to iOS14";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///// Translation needed - remove this header after translation /////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// The user has connected to another (older?) Libre 2 with bluetooth than the one for which NFC scan was done, in that case, inform user that he/she should click 'disconnect', add a new CGM sensor and scan again.
|
||||
"connectedLibre2DoesNotMatchScannedLibre2" = "You seem to have scanned a new sensor, but xDrip4iOS is having the Bluetooth connection to the old sensor.\r\n\r\nTo solve this :\r\n- Click 'disconnect'\r\n- Go back to previous screen and add a new CGM of type Libre 2 and scan again.\r\n\r\nxDrip4iOS should now connect to the new sensor.";
|
||||
|
|
|
@ -18,3 +18,10 @@
|
|||
|
||||
/// Device must support at least iOS 14.0
|
||||
"deviceMustSupportIOS14" = "To connect to Libre 2, this iPhone needs upgrading to iOS14";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///// Translation needed - remove this header after translation /////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// The user has connected to another (older?) Libre 2 with bluetooth than the one for which NFC scan was done, in that case, inform user that he/she should click 'disconnect', add a new CGM sensor and scan again.
|
||||
"connectedLibre2DoesNotMatchScannedLibre2" = "You seem to have scanned a new sensor, but xDrip4iOS is having the Bluetooth connection to the old sensor.\r\n\r\nTo solve this :\r\n- Click 'disconnect'\r\n- Go back to previous screen and add a new CGM of type Libre 2 and scan again.\r\n\r\nxDrip4iOS should now connect to the new sensor.";
|
||||
|
|
|
@ -3,3 +3,4 @@
|
|||
"deviceMustSupportNFC" = "This iPhone does not support NFC";
|
||||
"deviceMustSupportIOS14" = "To connect to Libre 2, this iPhone needs upgrading to iOS14";
|
||||
"donotusethelibrelinkapp" = "Connected to Libre 2.\r\n\r\nIf you want to keeping scanning sometimes the Libre sensor with the official Libre app, then disallow bluetooth permission for the Libre app. \r\n\r\nOtherwise, scanning the NFC with the Libre app and with the bluetooth permission allowed will break the connection between xDrip4iOS and the Libre 2.";
|
||||
"connectedLibre2DoesNotMatchScannedLibre2" = "You seem to have scanned a new sensor, but xDrip4iOS is having the Bluetooth connection to the old sensor.\r\n\r\nTo solve this :\r\n- Click 'disconnect'\r\n- Go back to previous screen and add a new CGM of type Libre 2 and scan again.\r\n\r\nxDrip4iOS should now connect to the new sensor.";
|
||||
|
|
|
@ -3,3 +3,10 @@
|
|||
"deviceMustSupportNFC" = "Este iPhone no dispone de NFC";
|
||||
"deviceMustSupportIOS14" = "Para conectar a un sensor Libre 2, se debe actualizar este iPhone a iOS14";
|
||||
"donotusethelibrelinkapp" = "Conectado a Libre 2.\r\n\r\nSi quieres seguir escaneando con la app official del sensor Libre, es imprescindible deshabilitar el permiso de Bluetooth en la configuración de la app del Libre. \r\n\r\nSi no está deshabilitado el permiso de Bluetooth, al escanear con la app official, se perderá la conexión entre xDrip4iOS y el sensor Libre 2.";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///// Translation needed - remove this header after translation /////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// The user has connected to another (older?) Libre 2 with bluetooth than the one for which NFC scan was done, in that case, inform user that he/she should click 'disconnect', add a new CGM sensor and scan again.
|
||||
"connectedLibre2DoesNotMatchScannedLibre2" = "You seem to have scanned a new sensor, but xDrip4iOS is having the Bluetooth connection to the old sensor.\r\n\r\nTo solve this :\r\n- Click 'disconnect'\r\n- Go back to previous screen and add a new CGM of type Libre 2 and scan again.\r\n\r\nxDrip4iOS should now connect to the new sensor.";
|
||||
|
|
|
@ -3,3 +3,10 @@
|
|||
"deviceMustSupportNFC" = "NFC ei ole tuettu tässä iPhonessa";
|
||||
"deviceMustSupportIOS14" = "Yhteyden muodostamiseksi Libre2:een tämä iPhone on päivitettävä iOS14:een";
|
||||
"donotusethelibrelinkapp" = "Libre2 yhdistetty.\r\n\r\nJos aiot skannata myös virallisella Libre-sovelluksella, kiellä Libre-sovelluksen bluetooth käyttöoikeus. \r\n\r\nMuussa tapauksessa NFC skannaus Libre-sovelluksella ja sallitulla Bluetooth-luvalla katkaisee xDrip4iOS:n ja Libre2:n välisen yhteyden.";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///// Translation needed - remove this header after translation /////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// The user has connected to another (older?) Libre 2 with bluetooth than the one for which NFC scan was done, in that case, inform user that he/she should click 'disconnect', add a new CGM sensor and scan again.
|
||||
"connectedLibre2DoesNotMatchScannedLibre2" = "You seem to have scanned a new sensor, but xDrip4iOS is having the Bluetooth connection to the old sensor.\r\n\r\nTo solve this :\r\n- Click 'disconnect'\r\n- Go back to previous screen and add a new CGM of type Libre 2 and scan again.\r\n\r\nxDrip4iOS should now connect to the new sensor.";
|
||||
|
|
|
@ -17,3 +17,10 @@
|
|||
|
||||
/// After Libre NFC scanning, and after successful bluetooth connection, this message will be shown to explain that he or she should not allow bluetooth permission on the Libre app
|
||||
"donotusethelibrelinkapp" = "Connected to Libre 2.\r\n\r\nIf you want to keeping scanning sometimes the Libre sensor with the official Libre app, then disallow bluetooth permission for the Libre app. \r\n\r\nOtherwise, scanning the NFC with the Libre app and with the bluetooth permission allowed will break the connection between xDrip4iOS and the Libre 2.";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///// Translation needed - remove this header after translation /////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// The user has connected to another (older?) Libre 2 with bluetooth than the one for which NFC scan was done, in that case, inform user that he/she should click 'disconnect', add a new CGM sensor and scan again.
|
||||
"connectedLibre2DoesNotMatchScannedLibre2" = "You seem to have scanned a new sensor, but xDrip4iOS is having the Bluetooth connection to the old sensor.\r\n\r\nTo solve this :\r\n- Click 'disconnect'\r\n- Go back to previous screen and add a new CGM of type Libre 2 and scan again.\r\n\r\nxDrip4iOS should now connect to the new sensor.";
|
||||
|
|
|
@ -17,3 +17,10 @@
|
|||
|
||||
/// After Libre NFC scanning, and after successful bluetooth connection, this message will be shown to explain that he or she should not allow bluetooth permission on the Libre app
|
||||
"donotusethelibrelinkapp" = "Connected to Libre 2.\r\n\r\nIf you want to keeping scanning sometimes the Libre sensor with the official Libre app, then disallow bluetooth permission for the Libre app. \r\n\r\nOtherwise, scanning the NFC with the Libre app and with the bluetooth permission allowed will break the connection between xDrip4iOS and the Libre 2.";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///// Translation needed - remove this header after translation /////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// The user has connected to another (older?) Libre 2 with bluetooth than the one for which NFC scan was done, in that case, inform user that he/she should click 'disconnect', add a new CGM sensor and scan again.
|
||||
"connectedLibre2DoesNotMatchScannedLibre2" = "You seem to have scanned a new sensor, but xDrip4iOS is having the Bluetooth connection to the old sensor.\r\n\r\nTo solve this :\r\n- Click 'disconnect'\r\n- Go back to previous screen and add a new CGM of type Libre 2 and scan again.\r\n\r\nxDrip4iOS should now connect to the new sensor.";
|
||||
|
|
|
@ -3,3 +3,10 @@
|
|||
"deviceMustSupportNFC" = "Deze iPhone ondersteunt geen NFC";
|
||||
"deviceMustSupportIOS14" = "Om te verbinden met Libre 2 moet deze iPhone worden geüpgraded naar iOS 14";
|
||||
"donotusethelibrelinkapp" = "Verbonden met Libre 2.\r\n\r\nIndien je de Libre sensor wilt blijven scannen met de officiële Libre app, trek dan de toegang tot bluetooth in voor de Libre app. \r\n\r\nIndien de sensor wordt gescand met de Libre app terwijl deze nog toegang heeft tot bluetooth, verbreekt de verbinding tussen xDrip4iOS en de Libre 2.";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///// Translation needed - remove this header after translation /////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// The user has connected to another (older?) Libre 2 with bluetooth than the one for which NFC scan was done, in that case, inform user that he/she should click 'disconnect', add a new CGM sensor and scan again.
|
||||
"connectedLibre2DoesNotMatchScannedLibre2" = "You seem to have scanned a new sensor, but xDrip4iOS is having the Bluetooth connection to the old sensor.\r\n\r\nTo solve this :\r\n- Click 'disconnect'\r\n- Go back to previous screen and add a new CGM of type Libre 2 and scan again.\r\n\r\nxDrip4iOS should now connect to the new sensor.";
|
||||
|
|
|
@ -17,3 +17,10 @@
|
|||
|
||||
/// After Libre NFC scanning, and after successful bluetooth connection, this message will be shown to explain that he or she should not allow bluetooth permission on the Libre app
|
||||
"donotusethelibrelinkapp" = "Connected to Libre 2.\r\n\r\nIf you want to keeping scanning sometimes the Libre sensor with the official Libre app, then disallow bluetooth permission for the Libre app. \r\n\r\nOtherwise, scanning the NFC with the Libre app and with the bluetooth permission allowed will break the connection between xDrip4iOS and the Libre 2.";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///// Translation needed - remove this header after translation /////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// The user has connected to another (older?) Libre 2 with bluetooth than the one for which NFC scan was done, in that case, inform user that he/she should click 'disconnect', add a new CGM sensor and scan again.
|
||||
"connectedLibre2DoesNotMatchScannedLibre2" = "You seem to have scanned a new sensor, but xDrip4iOS is having the Bluetooth connection to the old sensor.\r\n\r\nTo solve this :\r\n- Click 'disconnect'\r\n- Go back to previous screen and add a new CGM of type Libre 2 and scan again.\r\n\r\nxDrip4iOS should now connect to the new sensor.";
|
||||
|
|
|
@ -3,3 +3,10 @@
|
|||
"deviceMustSupportNFC" = "Este iPhone não suporta NFC";
|
||||
"deviceMustSupportIOS14" = "Para ligar ao Libre 2, este iPhone precisa de ser actualizado para iOS14";
|
||||
"donotusethelibrelinkapp" = "Ligado ao Libre 2.\r\n\r\nSe quiser fazer leituras NFC com a app oficial do Libre, então desactive permissão Bluetooth para a app oficial do Libre. \r\n\r\nSenão, as leituras NFC com a app do Libre com a permissão do bluetooth activada vai romper a ligação entre xDrip4iOS e o Libre 2.";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///// Translation needed - remove this header after translation /////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// The user has connected to another (older?) Libre 2 with bluetooth than the one for which NFC scan was done, in that case, inform user that he/she should click 'disconnect', add a new CGM sensor and scan again.
|
||||
"connectedLibre2DoesNotMatchScannedLibre2" = "You seem to have scanned a new sensor, but xDrip4iOS is having the Bluetooth connection to the old sensor.\r\n\r\nTo solve this :\r\n- Click 'disconnect'\r\n- Go back to previous screen and add a new CGM of type Libre 2 and scan again.\r\n\r\nxDrip4iOS should now connect to the new sensor.";
|
||||
|
|
|
@ -160,3 +160,19 @@
|
|||
|
||||
/* Class = "UIButton"; normalTitle = "Transmitter"; ObjectID = "zWo-AR-qJE"; */
|
||||
"zWo-AR-qJE.normalTitle" = "Transmissor";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///// Translation needed - remove this header after translation /////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///
|
||||
"NDk-cv-Gan.text" = "Loaded by SecondViewController";
|
||||
|
||||
///
|
||||
"A5M-7J-77L.text" = "Loaded by FirstViewController";
|
||||
|
||||
///
|
||||
"KQZ-1w-vlD.text" = "First View";
|
||||
|
||||
///
|
||||
"zEq-FU-wV5.text" = "Second View";
|
||||
|
|
|
@ -17,3 +17,10 @@
|
|||
|
||||
/// After Libre NFC scanning, and after successful bluetooth connection, this message will be shown to explain that he or she should not allow bluetooth permission on the Libre app
|
||||
"donotusethelibrelinkapp" = "Connected to Libre 2.\r\n\r\nIf you want to keeping scanning sometimes the Libre sensor with the official Libre app, then disallow bluetooth permission for the Libre app. \r\n\r\nOtherwise, scanning the NFC with the Libre app and with the bluetooth permission allowed will break the connection between xDrip4iOS and the Libre 2.";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///// Translation needed - remove this header after translation /////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// The user has connected to another (older?) Libre 2 with bluetooth than the one for which NFC scan was done, in that case, inform user that he/she should click 'disconnect', add a new CGM sensor and scan again.
|
||||
"connectedLibre2DoesNotMatchScannedLibre2" = "You seem to have scanned a new sensor, but xDrip4iOS is having the Bluetooth connection to the old sensor.\r\n\r\nTo solve this :\r\n- Click 'disconnect'\r\n- Go back to previous screen and add a new CGM of type Libre 2 and scan again.\r\n\r\nxDrip4iOS should now connect to the new sensor.";
|
||||
|
|
|
@ -4,3 +4,10 @@
|
|||
"deviceMustSupportIOS14" = "This iPhone must be upgraded to at least iOS14";
|
||||
"donotusethelibrelinkapp" = "Connected to Libre 2.\r\n\r\nIf you want to keeping scanning sometimes the Libre sensor with the official Libre app, then disallow bluetooth permission for the Libre app. \r\n\r\nOtherwise, scanning the NFC with the Libre app and with the bluetooth permission allowed will break the connection between xDrip4iOS and the Libre 2";
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///// Translation needed - remove this header after translation /////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// The user has connected to another (older?) Libre 2 with bluetooth than the one for which NFC scan was done, in that case, inform user that he/she should click 'disconnect', add a new CGM sensor and scan again.
|
||||
"connectedLibre2DoesNotMatchScannedLibre2" = "You seem to have scanned a new sensor, but xDrip4iOS is having the Bluetooth connection to the old sensor.\r\n\r\nTo solve this :\r\n- Click 'disconnect'\r\n- Go back to previous screen and add a new CGM of type Libre 2 and scan again.\r\n\r\nxDrip4iOS should now connect to the new sensor.";
|
||||
|
|
|
@ -17,3 +17,10 @@
|
|||
|
||||
/// After Libre NFC scanning, and after successful bluetooth connection, this message will be shown to explain that he or she should not allow bluetooth permission on the Libre app
|
||||
"donotusethelibrelinkapp" = "Connected to Libre 2.\r\n\r\nIf you want to keeping scanning sometimes the Libre sensor with the official Libre app, then disallow bluetooth permission for the Libre app. \r\n\r\nOtherwise, scanning the NFC with the Libre app and with the bluetooth permission allowed will break the connection between xDrip4iOS and the Libre 2.";
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///// Translation needed - remove this header after translation /////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// The user has connected to another (older?) Libre 2 with bluetooth than the one for which NFC scan was done, in that case, inform user that he/she should click 'disconnect', add a new CGM sensor and scan again.
|
||||
"connectedLibre2DoesNotMatchScannedLibre2" = "You seem to have scanned a new sensor, but xDrip4iOS is having the Bluetooth connection to the old sensor.\r\n\r\nTo solve this :\r\n- Click 'disconnect'\r\n- Go back to previous screen and add a new CGM of type Libre 2 and scan again.\r\n\r\nxDrip4iOS should now connect to the new sensor.";
|
||||
|
|
|
@ -24,4 +24,8 @@ class TextsLibreNFC {
|
|||
return NSLocalizedString("donotusethelibrelinkapp", tableName: filename, bundle: Bundle.main, value: "Connected to Libre 2.\r\n\r\nIf you want to keeping scanning sometimes the Libre sensor with the official Libre app, then disallow bluetooth permission for the Libre app. \r\n\r\nOtherwise, scanning the NFC with the Libre app and with the bluetooth permission allowed will break the connection between xDrip4iOS and the Libre 2.", comment: "After Libre NFC scanning, and after successful bluetooth connection, this message will be shown to explain that he or she should not allow bluetooth permission on the Libre app")
|
||||
}()
|
||||
|
||||
static let connectedLibre2DoesNotMatchScannedLibre2: String = {
|
||||
return NSLocalizedString("connectedLibre2DoesNotMatchScannedLibre2", tableName: filename, bundle: Bundle.main, value: "You seem to have scanned a new sensor, but xDrip4iOS is having the Bluetooth connection to the old sensor.\r\n\r\nTo solve this :\r\n- Click 'disconnect'\r\n- Go back to previous screen and add a new CGM of type Libre 2 and scan again.\r\n\r\nxDrip4iOS should now connect to the new sensor.", comment: "The user has connected to another (older?) Libre 2 with bluetooth than the one for which NFC scan was done, in that case, inform user that he/she should click 'disconnect', add a new CGM sensor and scan again.")
|
||||
}()
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue