Index: sources/bluetooth/BluetoothInterface.h =================================================================== diff -u -rc447018bc6c50996f402e01f951d40b17a120705 -r1c97eebc80b33b429fa6e9489584ce3bf24f0bbc --- sources/bluetooth/BluetoothInterface.h (.../BluetoothInterface.h) (revision c447018bc6c50996f402e01f951d40b17a120705) +++ sources/bluetooth/BluetoothInterface.h (.../BluetoothInterface.h) (revision 1c97eebc80b33b429fa6e9489584ce3bf24f0bbc) @@ -60,8 +60,14 @@ bool _isValid = false ; - const QByteArray _bloodPressureNotifyValue = QByteArray::fromHex("0100"); - const char *_invalidLocalAddress = "00:00:00:00:00:00"; + const QByteArray _bloodPressureNotifyValue = QByteArray::fromHex("0100"); + const QString _devicePairingBondCharacteristicUuid = "{b305b680-aee7-11e1-a730-0002a5d5c51b}"; + const QString _vendorSpecificServiceUuid = "{ecbe3980-c9a2-11e1-b1bd-0002a5d5c51b}"; + const char *_invalidLocalAddress = "00:00:00:00:00:00"; + const char _deviceConfirmKeyWriteCodeSuccess = '\x82'; + const char *_devicePairingKeyString = "0x00EE020E"; + const char *_enableKeyProgrammingString = "0x200000000000000000000000000000000"; + QStringList _supportedDeviceKeywords { "BP7000", "BLEsmart", "BLESmart" }; // Regarding to Omron Documents. QBluetoothLocalDevice *_local = nullptr ; QBluetoothDeviceDiscoveryAgent *_agent = nullptr ; @@ -71,6 +77,7 @@ QLowEnergyService *_serviceCurrentTime = nullptr ; QLowEnergyService *_serviceBloodPressure = nullptr ; QLowEnergyService *_serviceBattery = nullptr ; + QLowEnergyService *_serviceVendorSpecific = nullptr ; QBluetoothDeviceInfo _temp ; quint8 _tempBatt = 0 ; @@ -79,6 +86,8 @@ bool _reconnectionActive = false ; const quint16 _interval = 1000 ; // the interface timer base interval in mSec + bool _isPairingKeyWritten = false; // indicate whether the pairing/bond key is written to the device + public: bool isValid( ) const { return _isValid ; } void valid(bool vValid) { _isValid = vValid; } @@ -169,8 +178,12 @@ void interpretBloodPressure (const QByteArray &vData); void interpretInformation (); void interpretBattery (const QByteArray &vData); - void requestDevicePairing (const QBluetoothAddress &vAddress); + void requestDevicePairing (const BluetoothDeviceData &vDevice); + void enableKeyProgramming(); + void writeDevicePairingKey(); + bool isVendorSpecificService (const QLowEnergyService *service ); + bool isDevicePairingCharacteristicUuid (const QLowEnergyCharacteristic &vCharacteristic); signals: void didStateChange (const BluetoothData &vData); void didActionReceive (const UIBloodPressureData &vData);