Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

OS version support for BtLeFindMe

  • Loading branch information...
commit 3038fd9388ce228da108dfbb6abed62fe8271ef6 1 parent 48c3e9d
@jcmurray authored
View
2  BtLeFindMe/BtLeFindMe.pro
@@ -1,6 +1,6 @@
APP_NAME = BtLeFindMe
CONFIG += qt warn_on cascades10
-LIBS += -lbtapi -lbbsystem
+LIBS += -lbtapi -lbbsystem -lbbplatform
include(config.pri)
View
4 BtLeFindMe/README.md
@@ -21,7 +21,8 @@ The sample code for this application is Open Source under the [Apache 2.0 Licens
**Release History**
-* **V1.0** - Initial release
+* **V1.0.0** - Initial release
+* **V1.0.1** - Compatibility with Device Software **10.1.***
**Dependencies**
@@ -48,6 +49,7 @@ Our use of these these devices for testing shouldn't be regarded as an endorseme
If you don't want to build this sample application yourself we've included a pre-built and signed BAR file. You can find it in the folder "**installable-bar-files**" as follows:
+* **BtLeFindMe-1\_0\_1\_445.bar** -- Signed BAR file for Version 1.0.1 (V1.0.1) of the application (requires BlackBerry 10 Software 10.0.9 or later).
* **BtLeFindMe-1\_0\_0\_442.bar** -- Signed BAR file for Version 1.0 (V1.0) of the application (requires BlackBerry 10 Software 10.0.9 or later).
**To contribute code to this repository you must be [signed up as an official contributor](http://blackberry.github.com/howToContribute.html).**
View
5 BtLeFindMe/assets/.assets.index
@@ -1,5 +1,5 @@
1
-16
+15
AboutSheet.qml
ImageLabel.qml
images/about.png
@@ -11,8 +11,7 @@ images/picture1.png
images/picture1br.png
images/picture1thumb.png
images/preferences_system_bluetooth.png
+images/scan.png
images/thumbDown.png
images/thumbUp.png
main.qml
-RemoteDeviceInfoSheet.qml
-TwoPartLabel.qml
View
2  BtLeFindMe/assets/AboutSheet.qml
@@ -34,7 +34,7 @@ Sheet {
}
Label {
id: lblHeading_version
- text: qsTr("V1.0.0")
+ text: qsTr("V1.0.1")
verticalAlignment: VerticalAlignment.Center
horizontalAlignment: HorizontalAlignment.Center
}
View
2  BtLeFindMe/bar-descriptor.xml
@@ -35,7 +35,7 @@
<!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.
Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
An updated version of application must have a versionNumber value higher than the previous version. Required. -->
- <versionNumber>1.0.0</versionNumber>
+ <versionNumber>1.0.1</versionNumber>
<buildIdFile>buildnum</buildIdFile>
<!-- Fourth digit segment of the package version. First three segments are taken from the
View
2  BtLeFindMe/buildnum
@@ -1 +1 @@
-443
+446
View
12 BtLeFindMe/config.pri
@@ -10,6 +10,7 @@ device {
$$quote($$BASEDIR/src/LocalDeviceInfo.cpp) \
$$quote($$BASEDIR/src/RemoteDeviceInfo.cpp) \
$$quote($$BASEDIR/src/Timer.cpp) \
+ $$quote($$BASEDIR/src/Utilities.cpp) \
$$quote($$BASEDIR/src/main.cpp)
HEADERS += $$quote($$BASEDIR/src/BluetoothLe.hpp) \
@@ -18,7 +19,8 @@ device {
$$quote($$BASEDIR/src/FindMeService.hpp) \
$$quote($$BASEDIR/src/LocalDeviceInfo.hpp) \
$$quote($$BASEDIR/src/RemoteDeviceInfo.hpp) \
- $$quote($$BASEDIR/src/Timer.hpp)
+ $$quote($$BASEDIR/src/Timer.hpp) \
+ $$quote($$BASEDIR/src/Utilities.hpp)
}
CONFIG(release, debug|release) {
@@ -29,6 +31,7 @@ device {
$$quote($$BASEDIR/src/LocalDeviceInfo.cpp) \
$$quote($$BASEDIR/src/RemoteDeviceInfo.cpp) \
$$quote($$BASEDIR/src/Timer.cpp) \
+ $$quote($$BASEDIR/src/Utilities.cpp) \
$$quote($$BASEDIR/src/main.cpp)
HEADERS += $$quote($$BASEDIR/src/BluetoothLe.hpp) \
@@ -37,7 +40,8 @@ device {
$$quote($$BASEDIR/src/FindMeService.hpp) \
$$quote($$BASEDIR/src/LocalDeviceInfo.hpp) \
$$quote($$BASEDIR/src/RemoteDeviceInfo.hpp) \
- $$quote($$BASEDIR/src/Timer.hpp)
+ $$quote($$BASEDIR/src/Timer.hpp) \
+ $$quote($$BASEDIR/src/Utilities.hpp)
}
}
@@ -50,6 +54,7 @@ simulator {
$$quote($$BASEDIR/src/LocalDeviceInfo.cpp) \
$$quote($$BASEDIR/src/RemoteDeviceInfo.cpp) \
$$quote($$BASEDIR/src/Timer.cpp) \
+ $$quote($$BASEDIR/src/Utilities.cpp) \
$$quote($$BASEDIR/src/main.cpp)
HEADERS += $$quote($$BASEDIR/src/BluetoothLe.hpp) \
@@ -58,7 +63,8 @@ simulator {
$$quote($$BASEDIR/src/FindMeService.hpp) \
$$quote($$BASEDIR/src/LocalDeviceInfo.hpp) \
$$quote($$BASEDIR/src/RemoteDeviceInfo.hpp) \
- $$quote($$BASEDIR/src/Timer.hpp)
+ $$quote($$BASEDIR/src/Timer.hpp) \
+ $$quote($$BASEDIR/src/Utilities.hpp)
}
}
View
BIN  BtLeFindMe/installable-bar-files/BtLeFindMe-1_0_1_445.bar
Binary file not shown
View
2  BtLeFindMe/src/BtLeFindMe.cpp
@@ -32,4 +32,6 @@ BtLeFindMe::BtLeFindMe(bb::cascades::Application *app)
AbstractPane *_root = _qml->createRootObject<AbstractPane>();
app->setScene(_root);
+
+ qDebug() << "XXXX running on OS version " << Utilities::getOSVersion();
}
View
1  BtLeFindMe/src/BtLeFindMe.hpp
@@ -23,6 +23,7 @@
#include <BluetoothLe.hpp>
#include "Timer.hpp"
+#include "Utilities.hpp"
using namespace bb::cascades;
View
4 BtLeFindMe/src/DeviceListing.cpp
@@ -22,6 +22,10 @@ DeviceListing::DeviceListing(QObject *parent)
{
_model->setSortingKeys(QStringList() << "deviceType");
_model->setGrouping(bb::cascades::ItemGrouping::ByFullValue);
+
+ if (!Utilities::getOSVersion().startsWith("10.0")) {
+ IMMEDIATE_ALERT_SERVICE_UUID.prepend("0x");
+ }
}
void DeviceListing::update()
View
4 BtLeFindMe/src/DeviceListing.hpp
@@ -26,6 +26,8 @@
#include <btapi/btdevice.h>
#include <btapi/btspp.h>
+#include "Utilities.hpp"
+
class DeviceListing : public QObject
{
Q_OBJECT
@@ -42,7 +44,7 @@ public Q_SLOTS:
bb::cascades::DataModel* model() const;
bb::cascades::GroupDataModel* _model;
bool isAnImmediateAlertDevice(bt_remote_device_t *remoteDevice);
- const QString IMMEDIATE_ALERT_SERVICE_UUID;
+ QString IMMEDIATE_ALERT_SERVICE_UUID;
};
#endif
View
7 BtLeFindMe/src/FindMeService.cpp
@@ -74,7 +74,12 @@ FindMeService::FindMeService(QObject *parent)
{
qDebug() << "XXXX FindMeService::FindMeService(QObject *parent)";
findMeServiceInstance = this;
- qRegisterMetaType<uint16_t>("uint16_t");
+
+ if (!Utilities::getOSVersion().startsWith("10.0")) {
+ IMMEDIATE_ALERT_SERVICE_UUID.prepend("0x");
+ }
+
+ qRegisterMetaType<uint16_t>("uint16_t");
QObject::connect(this, SIGNAL(gattServiceConnected(QString, QString, int, int, uint16_t, uint16_t, uint16_t, void *)),
this, SLOT(handleGattServiceConnected(QString, QString, int, int, uint16_t, uint16_t, uint16_t, void *)));
View
3  BtLeFindMe/src/FindMeService.hpp
@@ -26,6 +26,7 @@
#include <btapi/btspp.h>
#include <errno.h>
+#include "Utilities.hpp"
typedef struct {
int uuid;
@@ -63,7 +64,7 @@ class FindMeService : public QObject
private:
bool _serviceIsInitialised;
QString _remoteDeviceAddress;
- const QString IMMEDIATE_ALERT_SERVICE_UUID;
+ QString IMMEDIATE_ALERT_SERVICE_UUID;
const QString IMMEDIATE_ALERT_LEVEL_UUID;
AlertLevel _alertLevel;
int _serviceInstance;
View
71 BtLeFindMe/src/Utilities.cpp
@@ -0,0 +1,71 @@
+/* Copyright (c) 2013 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "Utilities.hpp"
+#include "stdint.h"
+#include <QChar>
+#include <QString>
+#include <QDateTime>
+#include <QDebug>
+#include <bb/system/SystemDialog>
+#include <sys/time.h>
+#include <bb/platform/PlatformInfo>
+
+using namespace bb::platform;
+
+const QString Utilities::HEX_CHARS = QString("0123456789ABCDEF");
+const PlatformInfo* m_platformInfo = new bb::platform::PlatformInfo();
+
+uint8_t Utilities::hexToInt(QChar c1, QChar c2) {
+ c1 = c1.toUpper();
+ c2 = c2.toUpper();
+ uint8_t result = 0;
+ result = HEX_CHARS.indexOf(c1) * 16;
+ result = result + HEX_CHARS.indexOf(c2);
+ return result;
+}
+
+void Utilities::hexToIntArray(QString hex_string, uint8_t* output) {
+ const size_t numdigits = hex_string.length() / 2;
+ for (size_t i = 0; i != numdigits; ++i) {
+ output[i] = hexToInt(hex_string.at(2 * i), hex_string.at(2 * i + 1));
+ }
+}
+
+QString Utilities::intToHex(int decimal) {
+ QString hexadecimal;
+ hexadecimal.setNum(decimal, 16);
+ return hexadecimal;
+}
+
+void Utilities::alert(QString msg) {
+ bb::system::SystemDialog *dial;
+ dial = new bb::system::SystemDialog("OK", NULL);
+ dial->setTitle("Alert");
+ dial->setBody(msg);
+ dial->setDismissAutomatically(true);
+ dial->show();
+}
+
+uint Utilities::getSysTimeSeconds() {
+ QDateTime now = QDateTime::currentDateTime();
+ return now.toTime_t();
+}
+
+QString Utilities::getOSVersion() {
+ if(m_platformInfo)
+ return m_platformInfo->osVersion();
+ else
+ return QString::null;
+}
View
38 BtLeFindMe/src/Utilities.hpp
@@ -0,0 +1,38 @@
+/* Copyright (c) 2013 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef Utilities_h
+#define Utilities_h
+
+#include "stdint.h"
+#include <QChar>
+#include "huctx.h"
+#include "sbdef.h"
+#include <bb/platform/PlatformInfo>
+
+class Utilities {
+
+public:
+ static uint8_t hexToInt(QChar c1, QChar c2);
+ static void hexToIntArray(QString hex_string,uint8_t* output);
+ static QString intToHex(int decimal);
+ static void alert(QString msg);
+ static uint getSysTimeSeconds();
+ static QString getOSVersion();
+
+private:
+ static const QString HEX_CHARS;
+};
+
+#endif // ifndef Utilities_h
View
20 BtLeFindMe/translations/BtLeFindMe.ts
@@ -9,11 +9,6 @@
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../assets/AboutSheet.qml" line="37"/>
- <source>V1.0.0</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<location filename="../assets/AboutSheet.qml" line="43"/>
<source>The BtLeFindMe application demonstrates how to cause a device that supports the Bluetooth 4.0 LE Find Me Profile to issue alerts</source>
<translation type="unfinished"></translation>
@@ -34,6 +29,11 @@
<translation type="unfinished"></translation>
</message>
<message>
+ <location filename="../assets/AboutSheet.qml" line="37"/>
+ <source>V1.0.1</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
<location filename="../assets/AboutSheet.qml" line="87"/>
<source>Close</source>
<translation type="unfinished"></translation>
@@ -42,22 +42,22 @@
<context>
<name>DeviceListing</name>
<message>
- <location filename="../src/DeviceListing.cpp" line="48"/>
+ <location filename="../src/DeviceListing.cpp" line="52"/>
<source>Paired Bluetooth Devices Capable of Immediate Alert</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../src/DeviceListing.cpp" line="62"/>
+ <location filename="../src/DeviceListing.cpp" line="66"/>
<source>Searching for Bluetooth devices ... please wait until search completed ...</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../src/DeviceListing.cpp" line="71"/>
+ <location filename="../src/DeviceListing.cpp" line="75"/>
<source>Search completed!</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../src/DeviceListing.cpp" line="91"/>
+ <location filename="../src/DeviceListing.cpp" line="95"/>
<source>Bluetooth Devices Nearby Capable of Immediate Alert</source>
<translation type="unfinished"></translation>
</message>
@@ -65,7 +65,7 @@
<context>
<name>FindMeService</name>
<message>
- <location filename="../src/FindMeService.cpp" line="143"/>
+ <location filename="../src/FindMeService.cpp" line="148"/>
<source>Connected to Find Me Service on Device</source>
<translation type="unfinished"></translation>
</message>
Please sign in to comment.
Something went wrong with that request. Please try again.