Skip to content

Commit

Permalink
new bluetoothgatt sample for BTLE devices
Browse files Browse the repository at this point in the history
fix to barcodereader with proper barcodedetector placement
fix to nitifications in placing the wav file in public folder for access
  • Loading branch information
CodeHoarder committed Apr 2, 2013
1 parent ebdfc37 commit 629b679
Show file tree
Hide file tree
Showing 56 changed files with 4,302 additions and 41 deletions.
8 changes: 4 additions & 4 deletions SensorDemo/bar-descriptor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@

<!-- The category where the application appears. Either core.games or core.media. -->
<category>core.games</category>
<icon>
<image>assets/images/rotation3d.png</image>
</icon>
<configuration id="com.qnx.qcc.toolChain.1914788226" name="Default">
<platformArchitecture>armle-v7</platformArchitecture>
<asset path="arm/o.le-v7-g/SensorDemo" entry="true" type="Qnx/Elf">SensorDemo</asset>
Expand All @@ -90,7 +87,10 @@
</configuration>

<!-- The icon for the application, which should be 86x86. -->

<icon>
<image>icon.png</image>
</icon>
<asset path="icon.png">icon.png</asset>
<asset path="assets">assets</asset>

<!-- Locale support -->
Expand Down
Binary file added SensorDemo/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 19 additions & 32 deletions barcodereader/assets/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,30 @@ Page {
camera.startViewfinder()
}

onViewfinderStarted: {
// Setup the barcode detector with the camera object now
barcodeDetector.camera = camera
}

//! [2]
attachedObjects: [
BarcodeDetector {
id: barcodeDetector
camera: camera
formats: BarcodeFormat.Any
onDetected: {
if (resultLabel.text != data) {
resultLabel.text = data;
resultArea.visible = true;
scannedSound.play()
}
}
},
SystemSound {
id: scannedSound

sound: SystemSound.GeneralNotification
},
CameraSettings {
id: cameraSettings
}
]
//! [2]
}
//! [0]

Expand Down Expand Up @@ -157,33 +171,6 @@ Page {
camera.open()
}
//! [1]

onEnded: {
// Work around a bug temporarily
camera.open()
}
}
}

//! [2]
attachedObjects: [
BarcodeDetector {
id: barcodeDetector

formats: BarcodeFormat.Any
onDetected: {
if (resultLabel.text != data) {
resultLabel.text = data;
resultArea.visible = true;
scannedSound.play()
}
}
},
SystemSound {
id: scannedSound

sound: SystemSound.GeneralNotification
}
]
//! [2]
}
231 changes: 231 additions & 0 deletions bluetoothgatt/.cproject

Large diffs are not rendered by default.

91 changes: 91 additions & 0 deletions bluetoothgatt/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>bluetoothgatt</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>Device-Debug</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>Device-Debug</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.rim.tad.tools.qml.core.qmlFileBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.qnx.tools.bbt.xml.core.bbtXMLValidationBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.rim.tad.tools.wst.jsdt.core.jsNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>com.qnx.tools.ide.bbt.core.bbtnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>com.rim.tad.tools.qml.core.qmlNature</nature>
</natures>
</projectDescription>
41 changes: 41 additions & 0 deletions bluetoothgatt/.settings/org.eclipse.cdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
eclipse.preferences.version=1
environment/project/com.qnx.qcc.toolChain.1463103834/CPULIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.1463103834/CPULIST/operation=append
environment/project/com.qnx.qcc.toolChain.1463103834/CPULIST/value=arm
environment/project/com.qnx.qcc.toolChain.1463103834/EXCLUDE_VARIANTLIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.1463103834/EXCLUDE_VARIANTLIST/operation=append
environment/project/com.qnx.qcc.toolChain.1463103834/EXCLUDE_VARIANTLIST/value=p
environment/project/com.qnx.qcc.toolChain.1463103834/append=true
environment/project/com.qnx.qcc.toolChain.1463103834/appendContributed=true
environment/project/com.qnx.qcc.toolChain.2009111304.396709099/CPULIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.2009111304.396709099/CPULIST/operation=append
environment/project/com.qnx.qcc.toolChain.2009111304.396709099/CPULIST/value=arm
environment/project/com.qnx.qcc.toolChain.2009111304.396709099/VARIANTLIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.2009111304.396709099/VARIANTLIST/operation=append
environment/project/com.qnx.qcc.toolChain.2009111304.396709099/VARIANTLIST/value=g
environment/project/com.qnx.qcc.toolChain.2009111304.396709099/append=true
environment/project/com.qnx.qcc.toolChain.2009111304.396709099/appendContributed=true
environment/project/com.qnx.qcc.toolChain.2009111304/CPULIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.2009111304/CPULIST/operation=append
environment/project/com.qnx.qcc.toolChain.2009111304/CPULIST/value=arm
environment/project/com.qnx.qcc.toolChain.2009111304/VARIANTLIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.2009111304/VARIANTLIST/operation=append
environment/project/com.qnx.qcc.toolChain.2009111304/VARIANTLIST/value=g
environment/project/com.qnx.qcc.toolChain.2009111304/append=true
environment/project/com.qnx.qcc.toolChain.2009111304/appendContributed=true
environment/project/com.qnx.qcc.toolChain.2011221255/CPULIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.2011221255/CPULIST/operation=append
environment/project/com.qnx.qcc.toolChain.2011221255/CPULIST/value=x86
environment/project/com.qnx.qcc.toolChain.2011221255/VARIANTLIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.2011221255/VARIANTLIST/operation=append
environment/project/com.qnx.qcc.toolChain.2011221255/VARIANTLIST/value=g
environment/project/com.qnx.qcc.toolChain.2011221255/append=true
environment/project/com.qnx.qcc.toolChain.2011221255/appendContributed=true
environment/project/com.qnx.qcc.toolChain.255995933/CPULIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.255995933/CPULIST/operation=append
environment/project/com.qnx.qcc.toolChain.255995933/CPULIST/value=arm
environment/project/com.qnx.qcc.toolChain.255995933/EXCLUDE_VARIANTLIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.255995933/EXCLUDE_VARIANTLIST/operation=append
environment/project/com.qnx.qcc.toolChain.255995933/EXCLUDE_VARIANTLIST/value=r
environment/project/com.qnx.qcc.toolChain.255995933/append=true
environment/project/com.qnx.qcc.toolChain.255995933/appendContributed=true
6 changes: 6 additions & 0 deletions bluetoothgatt/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
QMAKE_TARGET = bluetoothgatt
PROJECT_DIR := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
I18N_DIR := $(PROJECT_DIR)/translations

include mk/cs-base.mk

24 changes: 24 additions & 0 deletions bluetoothgatt/assets/720x720/ScrollArea.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* 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.
*/
import bb.cascades 1.0

// For the 720x720 resolution a ScrollView is used, for the standard
// resolution this would lead to rubberbanding of a full screen UI
// which we do not want.
ScrollView {
scrollViewProperties {
scrollMode: ScrollMode.Vertical
}
}
70 changes: 70 additions & 0 deletions bluetoothgatt/assets/Characteristics.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/* 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.
*/

import bb.cascades 1.0

Page {
objectName: "CharacteristicsPage"

titleBar: TitleBar {
title: qsTr("Characteristics")
}

//! [0]
attachedObjects: [
ComponentDefinition {
id: characteristicsEditorPage
source: "CharacteristicsEditor.qml"
}
]
//! [0]

Container {
//! [1]
ListView {
dataModel: _bluetoothGatt.characteristicsModel

onTriggered: {
if (indexPath.length > 0) {
_bluetoothGatt.viewCharacteristicsEditor(indexPath[0]);
navigationPane.push(characteristicsEditorPage.createObject())
}
}

listItemComponents: [
ListItemComponent {
type: "item"
Container {
topPadding: 10
leftPadding: 10
rightPadding: 10

Label {
text: ListItemData.uuid
}

Label {
text: ListItemData.name
}

Divider {
}
}
}
]
}
//! [1]
}
}
Loading

0 comments on commit 629b679

Please sign in to comment.