Skip to content
Browse files

initial submit of sensor demo sample

  • Loading branch information...
1 parent 390f62d commit b16368ebb251295b894608f58f5e9e19ef2f3184 @CodeHoarder CodeHoarder committed Oct 12, 2012
View
BIN SensorDemo/.DS_Store
Binary file not shown.
View
210 SensorDemo/.cproject
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.qnx.qcc.toolChain.1914788226">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.1914788226" moduleId="org.eclipse.cdt.core.settings" name="Default">
+ <externalSettings/>
+ <extensions>
+ <extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildProperties="" id="com.qnx.qcc.toolChain.1914788226" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="com.qnx.qcc.toolChain.1914788226.1567637013" name="/" resourcePath="">
+ <toolChain id="com.qnx.qcc.toolChain.268032704" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
+ <option id="com.qnx.qcc.option.os.614796125" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
+ <option id="com.qnx.qcc.option.cpu.1104539411" name="Target CPU:" superClass="com.qnx.qcc.option.cpu" value="com.qnx.qcc.option.gen.cpu.armle-v7" valueType="enumerated"/>
+ <option id="com.qnx.qcc.option.compiler.1463820271" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
+ <option id="com.qnx.qcc.option.runtime.2088679195" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
+ <targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.808042757" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
+ <builder autoBuildTarget="Device-Debug" enableAutoBuild="true" id="com.qnx.qcc.toolChain.1914788226.219412183" incrementalBuildTarget="Device-Debug" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+ <tool id="com.qnx.qcc.tool.compiler.317211679" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
+ <option id="com.qnx.qcc.option.compiler.optlevel.279694322" superClass="com.qnx.qcc.option.compiler.optlevel" value="com.qnx.qcc.option.compiler.optlevel.0" valueType="enumerated"/>
+ <option id="com.qnx.qcc.option.compiler.includePath.243892497" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/qt4"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/qt4/QtCore"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp/c"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp/embedded"/>
+ </option>
+ <inputType id="com.qnx.qcc.inputType.compiler.1401074275" superClass="com.qnx.qcc.inputType.compiler"/>
+ </tool>
+ <tool id="com.qnx.qcc.tool.assembler.1437556033" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
+ <inputType id="com.qnx.qcc.inputType.assembler.1559882478" superClass="com.qnx.qcc.inputType.assembler"/>
+ </tool>
+ <tool id="com.qnx.qcc.tool.linker.2076638193" name="QCC Linker" superClass="com.qnx.qcc.tool.linker"/>
+ <tool id="com.qnx.qcc.tool.archiver.340700028" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.qnx.qcc.toolChain.476274684">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.476274684" moduleId="org.eclipse.cdt.core.settings" name="Device-Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildProperties="" id="com.qnx.qcc.toolChain.476274684" name="Device-Debug" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="com.qnx.qcc.toolChain.476274684.1760474445" name="/" resourcePath="">
+ <toolChain id="com.qnx.qcc.toolChain.2110843187" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
+ <option id="com.qnx.qcc.option.os.2047695202" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
+ <option id="com.qnx.qcc.option.cpu.1827606980" name="Target CPU:" superClass="com.qnx.qcc.option.cpu" value="com.qnx.qcc.option.gen.cpu.armle-v7" valueType="enumerated"/>
+ <option id="com.qnx.qcc.option.compiler.1571334629" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
+ <option id="com.qnx.qcc.option.runtime.61587193" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
+ <targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.49205793" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
+ <builder autoBuildTarget="Device-Debug" enableAutoBuild="true" id="com.qnx.qcc.toolChain.476274684.50920412" incrementalBuildTarget="Device-Debug" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+ <tool id="com.qnx.qcc.tool.compiler.226507040" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
+ <option id="com.qnx.qcc.option.compiler.optlevel.1427219049" superClass="com.qnx.qcc.option.compiler.optlevel" value="com.qnx.qcc.option.compiler.optlevel.0" valueType="enumerated"/>
+ <option id="com.qnx.qcc.option.compiler.includePath.1591028044" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/qt4"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/qt4/QtCore"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp/c"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp/embedded"/>
+ </option>
+ <inputType id="com.qnx.qcc.inputType.compiler.1271660161" superClass="com.qnx.qcc.inputType.compiler"/>
+ </tool>
+ <tool id="com.qnx.qcc.tool.assembler.1271962789" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
+ <inputType id="com.qnx.qcc.inputType.assembler.1418060320" superClass="com.qnx.qcc.inputType.assembler"/>
+ </tool>
+ <tool id="com.qnx.qcc.tool.linker.1058273877" name="QCC Linker" superClass="com.qnx.qcc.tool.linker"/>
+ <tool id="com.qnx.qcc.tool.archiver.1208347870" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.qnx.qcc.toolChain.1999582179">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.1999582179" moduleId="org.eclipse.cdt.core.settings" name="Device-Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildProperties="" id="com.qnx.qcc.toolChain.1999582179" name="Device-Release" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="com.qnx.qcc.toolChain.1999582179.1400832950" name="/" resourcePath="">
+ <toolChain id="com.qnx.qcc.toolChain.5661841" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
+ <option id="com.qnx.qcc.option.os.1421273861" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
+ <option id="com.qnx.qcc.option.cpu.1223267367" name="Target CPU:" superClass="com.qnx.qcc.option.cpu" value="com.qnx.qcc.option.gen.cpu.armle-v7" valueType="enumerated"/>
+ <option id="com.qnx.qcc.option.compiler.641423607" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
+ <option id="com.qnx.qcc.option.runtime.925370516" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
+ <targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.637630960" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
+ <builder autoBuildTarget="Device-Release" enableAutoBuild="true" id="com.qnx.qcc.toolChain.1999582179.85953322" incrementalBuildTarget="Device-Release" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+ <tool id="com.qnx.qcc.tool.compiler.995955721" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
+ <option id="com.qnx.qcc.option.compiler.optlevel.1866448045" superClass="com.qnx.qcc.option.compiler.optlevel" value="com.qnx.qcc.option.compiler.optlevel.0" valueType="enumerated"/>
+ <option id="com.qnx.qcc.option.compiler.includePath.1870699532" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/qt4"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/qt4/QtCore"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp/c"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp/embedded"/>
+ </option>
+ <inputType id="com.qnx.qcc.inputType.compiler.1270728913" superClass="com.qnx.qcc.inputType.compiler"/>
+ </tool>
+ <tool id="com.qnx.qcc.tool.assembler.1697941996" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
+ <inputType id="com.qnx.qcc.inputType.assembler.1846885730" superClass="com.qnx.qcc.inputType.assembler"/>
+ </tool>
+ <tool id="com.qnx.qcc.tool.linker.601583937" name="QCC Linker" superClass="com.qnx.qcc.tool.linker"/>
+ <tool id="com.qnx.qcc.tool.archiver.1271569920" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.qnx.qcc.toolChain.1067285528">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.1067285528" moduleId="org.eclipse.cdt.core.settings" name="Simulator-Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactName="${ProjName}" buildProperties="" id="com.qnx.qcc.toolChain.1067285528" name="Simulator-Debug" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="com.qnx.qcc.toolChain.1067285528.842971467" name="/" resourcePath="">
+ <toolChain id="com.qnx.qcc.toolChain.832948659" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
+ <option id="com.qnx.qcc.option.os.1674504591" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
+ <option id="com.qnx.qcc.option.cpu.1524589052" name="Target CPU:" superClass="com.qnx.qcc.option.cpu"/>
+ <option id="com.qnx.qcc.option.compiler.183500169" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
+ <option id="com.qnx.qcc.option.runtime.1994343275" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
+ <targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.501098322" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
+ <builder autoBuildTarget="Simulator-Debug" enableAutoBuild="true" id="com.qnx.qcc.toolChain.1067285528.2143105166" incrementalBuildTarget="Simulator-Debug" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+ <tool id="com.qnx.qcc.tool.compiler.1842001003" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
+ <option id="com.qnx.qcc.option.compiler.optlevel.1605224816" superClass="com.qnx.qcc.option.compiler.optlevel" value="com.qnx.qcc.option.compiler.optlevel.0" valueType="enumerated"/>
+ <option id="com.qnx.qcc.option.compiler.includePath.1427586403" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/qt4"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/qt4/QtCore"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp/c"/>
+ <listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/cpp/embedded"/>
+ </option>
+ <inputType id="com.qnx.qcc.inputType.compiler.206509173" superClass="com.qnx.qcc.inputType.compiler"/>
+ </tool>
+ <tool id="com.qnx.qcc.tool.assembler.948301585" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
+ <inputType id="com.qnx.qcc.inputType.assembler.1330250333" superClass="com.qnx.qcc.inputType.assembler"/>
+ </tool>
+ <tool id="com.qnx.qcc.tool.linker.1128571542" name="QCC Linker" superClass="com.qnx.qcc.tool.linker"/>
+ <tool id="com.qnx.qcc.tool.archiver.1261018377" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="SensorDemo.null.2111163706" name="SensorDemo"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
+ <scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.1914788226">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.1999582179">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.1067285528">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
+ </scannerConfigBuildInfo>
+ <scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.476274684">
+ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
+ </scannerConfigBuildInfo>
+ </storageModule>
+ <storageModule moduleId="refreshScope"/>
+</cproject>
View
91 SensorDemo/.project
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>SensorDemo</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>
View
25 SensorDemo/.settings/org.eclipse.cdt.core.prefs
@@ -0,0 +1,25 @@
+eclipse.preferences.version=1
+environment/project/com.qnx.qcc.toolChain.1067285528/CPULIST/delimiter=,
+environment/project/com.qnx.qcc.toolChain.1067285528/CPULIST/operation=append
+environment/project/com.qnx.qcc.toolChain.1067285528/CPULIST/value=x86
+environment/project/com.qnx.qcc.toolChain.1067285528/VARIANTLIST/delimiter=,
+environment/project/com.qnx.qcc.toolChain.1067285528/VARIANTLIST/operation=append
+environment/project/com.qnx.qcc.toolChain.1067285528/VARIANTLIST/value=g
+environment/project/com.qnx.qcc.toolChain.1067285528/append=true
+environment/project/com.qnx.qcc.toolChain.1067285528/appendContributed=true
+environment/project/com.qnx.qcc.toolChain.1999582179/CPULIST/delimiter=,
+environment/project/com.qnx.qcc.toolChain.1999582179/CPULIST/operation=append
+environment/project/com.qnx.qcc.toolChain.1999582179/CPULIST/value=arm
+environment/project/com.qnx.qcc.toolChain.1999582179/EXCLUDE_VARIANTLIST/delimiter=,
+environment/project/com.qnx.qcc.toolChain.1999582179/EXCLUDE_VARIANTLIST/operation=append
+environment/project/com.qnx.qcc.toolChain.1999582179/EXCLUDE_VARIANTLIST/value=r
+environment/project/com.qnx.qcc.toolChain.1999582179/append=true
+environment/project/com.qnx.qcc.toolChain.1999582179/appendContributed=true
+environment/project/com.qnx.qcc.toolChain.476274684/CPULIST/delimiter=,
+environment/project/com.qnx.qcc.toolChain.476274684/CPULIST/operation=append
+environment/project/com.qnx.qcc.toolChain.476274684/CPULIST/value=arm
+environment/project/com.qnx.qcc.toolChain.476274684/VARIANTLIST/delimiter=,
+environment/project/com.qnx.qcc.toolChain.476274684/VARIANTLIST/operation=append
+environment/project/com.qnx.qcc.toolChain.476274684/VARIANTLIST/value=g
+environment/project/com.qnx.qcc.toolChain.476274684/append=true
+environment/project/com.qnx.qcc.toolChain.476274684/appendContributed=true
View
35 SensorDemo/Makefile
@@ -0,0 +1,35 @@
+QMAKE_TARGET = SensorDemo
+QMAKE = $(QNX_HOST)/usr/bin/qmake
+TARGET = $(QMAKE_TARGET)
+
+
+all: Makefile $(QMAKE_TARGET)
+
+clean:
+ $(MAKE) -C ./arm -f Makefile sureclean
+ $(MAKE) -C ./x86 -f Makefile sureclean
+
+
+Makefile: FORCE
+ $(QMAKE) -spec unsupported/blackberry-armv7le-g++ -o arm/Makefile $(QMAKE_TARGET).pro CONFIG+=device
+ $(QMAKE) -spec unsupported/blackberry-x86-g++ -o x86/Makefile $(QMAKE_TARGET).pro CONFIG+=simulator
+ $(MAKE) -C ./translations -f Makefile update release
+
+FORCE:
+
+$(QMAKE_TARGET): device simulator
+
+device:
+ $(MAKE) -C ./arm -f Makefile all
+
+Device-Debug: Makefile
+ $(MAKE) -C ./arm -f Makefile debug
+
+Device-Release: Makefile
+ $(MAKE) -C ./arm -f Makefile release
+
+simulator:
+ $(MAKE) -C ./x86 -f Makefile all
+
+Simulator-Debug: Makefile
+ $(MAKE) -C ./x86 -f Makefile debug
View
55 SensorDemo/SensorDemo.pro
@@ -0,0 +1,55 @@
+TEMPLATE = app
+TARGET = SensorDemo
+
+QT += declarative
+CONFIG += qt warn_on debug_and_release cascades mobility
+MOBILITY += sensors
+
+LIBS += -lbbdevice
+LIBS += -lcamapi
+
+INCLUDEPATH += ../src
+SOURCES += ../src/*.cpp
+HEADERS += ../src/*.hpp ../src/*.h
+
+lupdate_inclusion {
+ SOURCES += ../assets/*.qml
+}
+
+device {
+ CONFIG(release, debug|release) {
+ DESTDIR = o.le-v7
+ }
+ CONFIG(debug, debug|release) {
+ DESTDIR = o.le-v7-g
+ }
+}
+
+simulator {
+ CONFIG(release, debug|release) {
+ DESTDIR = o
+ }
+ CONFIG(debug, debug|release) {
+ DESTDIR = o-g
+ }
+}
+
+OBJECTS_DIR = $${DESTDIR}/.obj
+MOC_DIR = $${DESTDIR}/.moc
+RCC_DIR = $${DESTDIR}/.rcc
+UI_DIR = $${DESTDIR}/.ui
+
+suredelete.target = sureclean
+suredelete.commands = $(DEL_FILE) $${MOC_DIR}/*; $(DEL_FILE) $${RCC_DIR}/*; $(DEL_FILE) $${UI_DIR}/*
+suredelete.depends = distclean
+
+QMAKE_EXTRA_TARGETS += suredelete
+
+TRANSLATIONS = \
+ $${TARGET}_en_GB.ts \
+ $${TARGET}_fr.ts \
+ $${TARGET}_it.ts \
+ $${TARGET}_de.ts \
+ $${TARGET}_es.ts \
+ $${TARGET}.ts
+
View
0 SensorDemo/arm/.gitignore
No changes.
View
106 SensorDemo/assets/collisiondetector.qml
@@ -0,0 +1,106 @@
+/* Copyright (c) 2012 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
+import bb.multimedia 1.0
+import QtMobility.sensors 1.2
+
+Container {
+//! [0]
+ attachedObjects: [
+ SystemSound {
+ id: sound
+ sound: SystemSound.CameraBurstEvent
+ },
+
+ IRProximitySensor {
+ id: irProximity
+
+ // Create a variable to hold movement state
+ property real reflectance: 0
+
+ // Turn on the sensor
+ active: true
+
+ // Keep the sensor active when the app isn't visible or the screen is off (requires app permission in bar-descriptor)
+ alwaysOn: true
+
+ onReadingChanged: { // Called when a new IR proximity reading is available
+ reflectance = reading.reflectance
+ }
+ },
+
+ ProximitySensor {
+ id: proximity
+
+ // Create a variable to hold movement state
+ property bool close: false
+
+ // Turn on the sensor
+ active: true
+
+ // Keep the sensor active when the app isn't visible or the screen is off (requires app permission in bar-descriptor)
+ alwaysOn: true
+
+ onReadingChanged: { // Called when a new proximity reading is available
+ close = reading.close
+ if (close) {
+ sound.play();
+ anim.play();
+ }
+ }
+ }
+ ]
+//! [0]
+
+ layout: DockLayout {}
+
+ Label {
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Bottom
+
+ text: qsTr("Reflectance: %1%").arg((irProximity.reflectance * 100).toPrecision(4))
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ }
+ }
+
+//! [1]
+ Label {
+ id: alert
+
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Center
+
+ text: proximity.close ? qsTr("!! Mayday, Mayday !!") : qsTr("Cruising")
+ textStyle {
+ base: SystemDefaults.TextStyles.BigText
+ color: Color.Red
+ }
+
+ animations: [
+ FadeTransition {
+ id: anim
+ fromOpacity: 0.5
+ toOpacity: 1
+ duration: 300
+ easingCurve: StockCurve.BounceIn
+ }
+ ]
+ }
+//! [1]
+}
View
154 SensorDemo/assets/compass.qml
@@ -0,0 +1,154 @@
+/* Copyright (c) 2012 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
+import QtMobility.sensors 1.2
+import bb.vibrationController 1.0
+
+Container {
+//! [0]
+ attachedObjects: [
+ OrientationHandler {
+ onOrientationAboutToChange: { // Callend whenever the screen orientation changes
+
+ // Adapt the compass to current screen orientation
+ if (displayDirection == DisplayDirection.North) {
+ compass.userOrientation = 0;
+ } else if (displayDirection == DisplayDirection.South) {
+ compass.userOrientation = 180;
+ } else if (displayDirection == DisplayDirection.East) {
+ compass.userOrientation = 270;
+ } else if (displayDirection == DisplayDirection.West) {
+ compass.userOrientation = 90;
+ }
+ }
+ },
+
+ Compass {
+ id: compass
+
+ // Create a variable to hold azimuth
+ property double azimuth: 0
+
+ // Turn on the sensor
+ active: true
+
+ // Change sensor axis depending on 'userOrientation' property
+ axesOrientationMode: Compass.UserOrientation
+
+ onReadingChanged: { // Called when a new compass reading is available
+ compass.azimuth = reading.azimuth;
+ }
+ },
+
+ OrientationSensor {
+ id: orientation
+
+ // Create a variable to hold orientation
+ property bool face_down: false
+
+ // Turn on the sensor
+ active: true
+
+ onReadingChanged: { // Called when a new orientation reading is available
+ face_down = (reading.orientation == OrientationReading.FaceDown);
+ }
+ }
+ ]
+//! [0]
+
+ layout: DockLayout {}
+
+ // The compass in face-up device orientation
+ Container {
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Center
+
+ opacity: orientation.face_down ? 0 : 1
+
+//! [1]
+ Label {
+ horizontalAlignment: HorizontalAlignment.Center
+
+ text: qsTr("%1\u00B0").arg(compass.azimuth.toFixed())
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ }
+ }
+//! [1]
+
+//! [2]
+ ImageView {
+ imageSource: "images/MID-Dial.png"
+ rotationZ: - compass.azimuth
+ maxWidth: 500.0
+ maxHeight: 500.0
+ attachedObjects: [
+ ImplicitAnimationController {
+ // Disable animations to avoid jumps between 0 and 360 degree
+ enabled: false
+ }
+ ]
+ }
+//! [2]
+
+ attachedObjects: [
+ ImplicitAnimationController {
+ enabled: false
+ }
+ ]
+ }
+
+ // The compass in face-down device orientation
+ Container {
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Center
+
+ opacity: orientation.face_down ? 1 : 0
+
+ Label {
+ horizontalAlignment: HorizontalAlignment.Center
+
+ text: qsTr("%1\u00B0").arg(compass.azimuth.toFixed())
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ }
+ }
+
+ ImageView {
+ imageSource: "images/MID-Dial-reverse.png"
+ rotationZ: - compass.azimuth
+ maxWidth: 500.0
+ maxHeight: 500.0
+
+ attachedObjects: [
+ ImplicitAnimationController {
+ // Disable animations to avoid jumps between 0 and 360 degree
+ enabled: false
+ }
+ ]
+ }
+
+ attachedObjects: [
+ ImplicitAnimationController {
+ enabled: false
+ }
+ ]
+ }
+}
View
177 SensorDemo/assets/flashlight.qml
@@ -0,0 +1,177 @@
+/* Copyright (c) 2012 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
+import QtMobility.sensors 1.2
+import Flashlight 1.0
+
+Container {
+//! [0]
+ attachedObjects: [
+ Flashlight {
+ id: flashlight
+ },
+
+ Gyroscope {
+ id: accel
+
+ // Create a variable to count the number of sensor readings
+ property int count: 0
+
+ // Turn on the sensor
+ active: true
+
+ // Don't change sensor axis on screen rotation
+ axesOrientationMode: Gyroscope.FixedOrientation
+
+ // Keep the sensor active when the app isn't visible or the screen is off (requires app permission in bar-descriptor)
+ alwaysOn: true
+
+ // If the device isn't moving (x&y&z==0), don't send updates, saves power
+ skipDuplicates: true
+
+ onReadingChanged: { // Called when a gyroscope reading is available
+ // Check whether rotation on Z axis is above the configured threshold
+ if (reading.z > gyroSlider.value.toFixed() * 360 / (2 * 3.14)) {
+ if (count > 5 && ambLight.val < lightDropDown.selectedIndex) {
+ // If after 5 readings the ambient light is darker than the configured threshold, toggle the flash light
+ count = 0
+ flashlight.enabled = ! flashlight.enabled;
+ }
+ }
+ count ++;
+ }
+ },
+
+ AmbientLightSensor {
+ id: ambLight
+
+ // Create a variable to hold the ambient light value
+ property variant val: AmbientLightSensor.Undefined
+
+ // Turn on the sensor
+ active: true
+
+ // Keep the sensor active when the app isn't visible or the screen is off (requires app permission in bar-descriptor)
+ alwaysOn: true
+
+ // If the device isn't moving (x&y&z==0), don't send updates, saves power
+ skipDuplicates: true
+
+ onReadingChanged: { // Called when an ambient light reading is available
+ val = reading.lightLevel;
+ if (ambLight.val >= lightDropDown.selectedIndex && flashlight.enabled) {
+ // Switch off the flash light if current ambient light is brigther than configured threshold
+ flashlight.enabled = false;
+ }
+ }
+ },
+
+ LightSensor {
+ id: light
+
+ // Create a variable to hold the ambient light value
+ property real val: 0
+
+ // Turn on the sensor
+ active: true
+
+ // Keep the sensor active when the app isn't visible or the screen is off (requires app permission in bar-descriptor)
+ alwaysOn: true
+
+ // If the device isn't moving (x&y&z==0), don't send updates, saves power
+ skipDuplicates: true
+
+ onReadingChanged: { // Called when an light reading is available
+ val = reading.lux;
+ }
+ }
+ ]
+//! [0]
+
+ TextArea {
+ text: qsTr("To enable the flash light give the device a clockwise flick with an angular velocity greater then 'Gyro Threshold'. The flashlight is only enabled in environments darker then 'Light Threshold'. The flashlight will automatically turn off in enviroments brighter then 'Light Threshold'.")
+ }
+
+ Label {
+ text: {
+ if (light.val == AmbientLightReading.Dark) {
+ return qsTr("Light: Dark");
+ } else if (light.val == AmbientLightReading.Twilight) {
+ return qsTr("Light: Twilight");
+ } else if (light.val == AmbientLightReading.Light) {
+ return qsTr("Light: Light");
+ } else if (light.val == AmbientLightReading.Bright) {
+ return qsTr("Light: Bright");
+ } else if (light.val == AmbientLightReading.Sunny) {
+ return qsTr("Light: Sunny");
+ } else {
+ return qsTr("Light: Undefined");
+ }
+ }
+ }
+
+ DropDown {
+ id: lightDropDown
+ title: qsTr("Light Threshold")
+
+ Option {
+ text: qsTr("Undefined")
+ }
+ Option {
+ text: qsTr("Dark")
+ }
+ Option {
+ text: qsTr("Twilight")
+ selected: true
+ }
+ Option {
+ text: qsTr("Light")
+ }
+ Option {
+ text: qsTr("Bright")
+ }
+ Option {
+ text: qsTr("Sunny")
+ }
+ }
+
+ Divider {}
+
+ Label {
+ text: qsTr("Gyro Threshold: %1").arg(gyroSlider.value.toFixed())
+ }
+
+ Slider {
+ id: gyroSlider
+ value: 10
+ fromValue: 0
+ toValue: 50
+ }
+
+//! [1]
+ Label {
+ horizontalAlignment: HorizontalAlignment.Center
+
+ text: qsTr("Luminosity: %1 lux").arg(Math.round(light.val))
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ lineHeight: 2
+ }
+ }
+//! [1]
+}
View
BIN SensorDemo/assets/images/MID-Dial-reverse.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN SensorDemo/assets/images/MID-Dial.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN SensorDemo/assets/images/alarm.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN SensorDemo/assets/images/compass.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN SensorDemo/assets/images/crash.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN SensorDemo/assets/images/device.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN SensorDemo/assets/images/flashlight.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN SensorDemo/assets/images/magnet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN SensorDemo/assets/images/rotation3d.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
110 SensorDemo/assets/main.qml
@@ -0,0 +1,110 @@
+/* Copyright (c) 2012 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
+import QtMobility.sensors 1.2
+
+TabbedPane {
+ id: tabPane
+
+ showTabsOnActionBar: true
+
+//! [0]
+ onCreationCompleted: {
+ OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All;
+ tabPane.activeTab = compassTab;
+ }
+//! [0]
+
+//! [1]
+ Tab {
+ id: alarmTab
+ title: qsTr("Motion Alarm")
+ imageSource: "images/alarm.png"
+
+ Page {
+ ControlDelegate {
+ source: "motionalarm.qml"
+ delegateActive: (tabPane.activeTab == alarmTab)
+ }
+ }
+ }
+//! [1]
+
+ Tab {
+ id: compassTab
+ title: qsTr("Compass")
+ imageSource: "images/compass.png"
+
+ Page {
+ ControlDelegate {
+ source: "compass.qml"
+ delegateActive: (tabPane.activeTab == compassTab)
+ }
+ }
+ }
+
+ Tab {
+ id: metalFinderTab
+ title: qsTr("Metal Detector")
+ imageSource: "images/magnet.png"
+
+ Page {
+ ControlDelegate {
+ source: "metalfinder.qml"
+ delegateActive: (tabPane.activeTab == metalFinderTab)
+ }
+ }
+ }
+
+ Tab {
+ id: flashlightTab
+ title: qsTr("Flashlight")
+ imageSource: "images/flashlight.png"
+
+ Page {
+ ControlDelegate {
+ source: "flashlight.qml"
+ delegateActive: (tabPane.activeTab == flashlightTab)
+ }
+ }
+ }
+
+ Tab {
+ id: collisionDetectorTab
+ title: qsTr("Collision Detector")
+ imageSource: "images/crash.png"
+
+ Page {
+ ControlDelegate {
+ source: "collisiondetector.qml"
+ delegateActive: (tabPane.activeTab == collisionDetectorTab)
+ }
+ }
+ }
+
+ Tab {
+ id: rotation3DTab
+ title: qsTr("Rotation 3D")
+ imageSource: "images/rotation3d.png"
+
+ Page {
+ ControlDelegate {
+ source: "rotation3D.qml"
+ delegateActive: (tabPane.activeTab == rotation3DTab)
+ }
+ }
+ }
+}
View
114 SensorDemo/assets/metalfinder.qml
@@ -0,0 +1,114 @@
+/* Copyright (c) 2012 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
+import QtMobility.sensors 1.2
+import bb.vibrationController 1.0
+
+Container {
+//! [0]
+ attachedObjects: [
+ Magnetometer {
+ id: metalfinder
+
+ // Create various variables to hold values from magnetometer reading
+ property double baseline: 0
+ property double magnitude: 0
+ property double intensity: 0
+ property double x: 0
+ property double y: 0
+ property double z: 0
+
+ // Turn on the sensor
+ active: true
+
+ // Keep the sensor active when the app isn't visible or the screen is off (requires app permission in bar-descriptor)
+ alwaysOn: true
+
+ onReadingChanged: { // Called when a magnetometer reading is available
+ magnitude = Math.sqrt(reading.x * reading.x + reading.y * reading.y + reading.z * reading.z);
+ if (0 == baseline) {
+ baseline = magnitude;
+ }
+ intensity = ((magnitude - baseline) / magnitude) * 100;
+ if (intensity > 0) {
+ vib.start(intensity, 100);
+ }
+ x = reading.x;
+ y = reading.y;
+ z = reading.z;
+ }
+ },
+
+ VibrationController {
+ id: vib
+ }
+ ]
+//! [0]
+
+ layout: DockLayout {}
+
+//! [1]
+ Button {
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Center
+
+ text: qsTr("Calibrate Metal Finder")
+
+ onClicked: {
+ metalfinder.baseline = metalfinder.magnitude
+ }
+ }
+//! [1]
+
+//! [2]
+ Label {
+ horizontalAlignment: HorizontalAlignment.Left
+ verticalAlignment: VerticalAlignment.Bottom
+
+ text: qsTr("X: %1").arg((metalfinder.x * 1000000).toPrecision(5))
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ }
+ }
+//! [2]
+
+ Label {
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Bottom
+
+ text: qsTr("Y: %1").arg((metalfinder.y * 1000000).toPrecision(5))
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ }
+ }
+
+ Label {
+ horizontalAlignment: HorizontalAlignment.Right
+ verticalAlignment: VerticalAlignment.Bottom
+
+ text: qsTr("Z: %1").arg((metalfinder.z * 1000000).toPrecision(5))
+
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ }
+ }
+}
View
120 SensorDemo/assets/motionalarm.qml
@@ -0,0 +1,120 @@
+/* Copyright (c) 2012 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
+import bb.multimedia 1.0
+import QtMobility.sensors 1.2
+
+Container {
+//! [0]
+ attachedObjects: [
+ SystemSound {
+ id: sound
+ sound: SystemSound.InputKeypress
+ },
+
+ Accelerometer {
+ id: alarm
+
+ // Create variables to hold movement state and reading values
+ property double x: 0
+ property double y: 0
+ property double z: 0
+ property bool movement: false
+
+ // Turn on the sensor
+ active: true
+
+ // Don't change sensor axis on screen rotation
+ axesOrientationMode: Accelerometer.FixedOrientation
+
+ // Remove gravity, only interested in user movement
+ accelerationMode: Accelerometer.User
+
+ // Keep the sensor active when the app isn't visible or the screen is off (requires app permission in bar-descriptor)
+ alwaysOn: true
+
+ // If the device isn't moving (x&y&z==0), don't send updates, saves power
+ skipDuplicates: true
+
+ onReadingChanged: { // Called when a new user accel reading is available
+ x = reading.x;
+ y = reading.y;
+ z = reading.z;
+ movement = Math.sqrt(reading.x * reading.x + reading.y * reading.y + reading.z * reading.z) > .2;
+ if (movement) {
+ sound.play(); // Movement detected, play a sound
+ }
+ }
+ }
+ ]
+//! [0]
+
+ layout: DockLayout {}
+
+//! [1]
+ Label {
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Center
+
+ text: alarm.movement ? qsTr("ALARM: Movement Detected!") : qsTr("No Movement Detected")
+ textStyle {
+ base: SystemDefaults.TextStyles.BigText
+ color: alarm.movement ? Color.Red : Color.Green
+ }
+ }
+//! [1]
+
+//! [2]
+ Label {
+ horizontalAlignment: HorizontalAlignment.Left
+ verticalAlignment: VerticalAlignment.Bottom
+
+ text: qsTr("X: %1").arg((alarm.x).toPrecision(5))
+
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ }
+ }
+//! [2]
+
+ Label {
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Bottom
+
+ text: qsTr("Y: %1").arg((alarm.y).toPrecision(5))
+
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ }
+ }
+
+ Label {
+ horizontalAlignment: HorizontalAlignment.Right
+ verticalAlignment: VerticalAlignment.Bottom
+
+ text: qsTr("Z: %1").arg((alarm.z).toPrecision(5))
+
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ }
+ }
+}
View
105 SensorDemo/assets/rotation3D.qml
@@ -0,0 +1,105 @@
+/* Copyright (c) 2012 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
+import bb.multimedia 1.0
+import QtMobility.sensors 1.2
+
+Container {
+//! [0]
+ attachedObjects: [
+ RotationSensor {
+ id: rotation
+
+ // Create variables to hold rotation reading values
+ property real x: 0
+ property real y: 0
+ property real z: 0
+
+ // Turn on the sensor
+ active: true
+
+ // Keep the sensor active when the app isn't visible or the screen is off (requires app permission in bar-descriptor)
+ alwaysOn: true
+
+ // If the device isn't moving (x&y&z==0), don't send updates, saves power
+ skipDuplicates: true
+
+ onReadingChanged: { // Called when a new rotation reading is available
+ x = reading.x
+ y = reading.y
+ z = reading.z
+ }
+ }
+ ]
+//! [0]
+
+ layout: DockLayout {}
+
+ ImageView {
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Center
+
+ imageSource: "images/device.png"
+ }
+
+ Container {
+ layout: AbsoluteLayout {}
+
+//! [1]
+ Label {
+ layoutProperties: AbsoluteLayoutProperties {
+ positionX: 480
+ positionY: 685
+ }
+
+ text: qsTr("%1\u00B0").arg(rotation.x.toPrecision(4))
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ }
+ }
+//! [1]
+
+ Label {
+ layoutProperties: AbsoluteLayoutProperties {
+ positionX: 480
+ positionY: 460
+ }
+
+ text: qsTr("%1\u00B0").arg(rotation.y.toPrecision(4))
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ }
+ }
+
+ Label {
+ layoutProperties: AbsoluteLayoutProperties {
+ positionX: 335
+ positionY: 390
+ }
+
+ text: qsTr("%1\u00B0").arg(rotation.z.toPrecision(4))
+ textStyle {
+ base: SystemDefaults.TextStyles.BodyText
+ color: Color.Yellow
+ fontWeight: FontWeight.Bold
+ }
+ }
+ }
+}
View
109 SensorDemo/bar-descriptor.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<!--
+
+ Copyright (c) 2011, 2012 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.
+
+-->
+<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
+
+<!-- BlackBerry Tablet OS application descriptor file.
+
+ Specifies parameters for identifying, installing, and launching native applications on BlackBerry Tablet OS.
+
+-->
+
+ <!-- A universally unique application identifier. Must be unique across all BlackBerry Tablet OS applications.
+ Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
+ <id>com.example.SensorDemo</id>
+
+ <!-- The name that is displayed in the BlackBerry Tablet OS application installer.
+ May have multiple values for each language. See samples or xsd schema file. Optional. -->
+ <name>Sensor Demo</name>
+
+ <!-- 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>
+
+ <!-- Fourth digit segment of the package version. First three segments are taken from the
+ <versionNumber> element. Must be an integer from 0 to 2^16-1 -->
+ <buildId>1</buildId>
+
+ <!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->
+ <!-- <versionLabel></versionLabel> -->
+
+ <!-- Description, displayed in the BlackBerry Tablet OS application installer.
+ May have multiple values for each language. See samples or xsd schema file. Optional. -->
+ <description>The SensorDemo application</description>
+
+ <!-- Copyright information. Optional. -->
+ <!-- <copyright></copyright> -->
+
+ <!-- Name of author which is used for signing. Must match the developer name of your development certificate. -->
+ <author>Research In Motion</author>
+
+ <!-- Unique author ID assigned by signing authority. Required if using debug tokens. -->
+ <!-- <authorId>ABC1234YjsnUk235h</authorId> -->
+
+ <cascadesTheme>dark</cascadesTheme>
+
+ <initialWindow>
+ <autoOrients>true</autoOrients>
+ <systemChrome>none</systemChrome>
+ <transparent>false</transparent>
+ </initialWindow>
+
+ <!-- The category where the application appears. Either core.games or core.media. -->
+ <category>core.games</category>
+ <splashScreens>
+ <image>rotation3d.png</image>
+ </splashScreens>
+ <icon>
+ <image>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>
+ </configuration>
+ <configuration id="com.qnx.qcc.toolChain.476274684" name="Device-Debug">
+ <platformArchitecture>armle-v7</platformArchitecture>
+ <asset path="arm/o.le-v7-g/SensorDemo" entry="true" type="Qnx/Elf">SensorDemo</asset>
+ </configuration>
+ <configuration id="com.qnx.qcc.toolChain.1999582179" name="Device-Release">
+ <platformArchitecture>armle-v7</platformArchitecture>
+ <asset path="arm/o.le-v7/SensorDemo" entry="true" type="Qnx/Elf">SensorDemo</asset>
+ </configuration>
+ <configuration id="com.qnx.qcc.toolChain.1067285528" name="Simulator-Debug">
+ <platformArchitecture>x86</platformArchitecture>
+ <asset path="x86/o-g/SensorDemo" entry="true" type="Qnx/Elf">SensorDemo</asset>
+ </configuration>
+
+ <!-- The icon for the application, which should be 86x86. -->
+
+ <asset path="assets">assets</asset>
+
+ <!-- Locale support -->
+ <asset path="translations" dest="qm">
+ <include name="*.qm"/>
+ </asset>
+ <asset path="assets/images/rotation3d.png">rotation3d.png</asset>
+
+ <!-- Request permission to execute native code. Required for native applications. -->
+ <permission system="true">run_native</permission>
+ <permission>use_camera</permission>
+ <permission>run_when_backgrounded</permission>
+ <env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib"/>
+
+</qnx>
View
4 SensorDemo/device-assets.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<assets>
+ <target-device width="768" height="1280" ppi="356" class="phone"/>
+</assets>
View
57 SensorDemo/src/Flashlight.cpp
@@ -0,0 +1,57 @@
+/* Copyright (c) 2012 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 "Flashlight.hpp"
+
+#include <QDebug>
+
+Flashlight::Flashlight(QObject * parent)
+ : QObject(parent)
+ , m_enabled(false)
+{
+ // Acquire access to the camera hardware
+ const camera_error_t error = camera_open(CAMERA_UNIT_REAR, CAMERA_MODE_PREAD | CAMERA_MODE_PWRITE, &m_camera);
+ if (CAMERA_EOK != error) {
+ qDebug() << "Failed to open camera";
+ }
+}
+
+Flashlight::~Flashlight()
+{
+ // Release access to the camera hardware
+ camera_close(m_camera);
+}
+
+void Flashlight::setEnabled(bool enabled)
+{
+ if (m_enabled == enabled)
+ return;
+
+ m_enabled = enabled;
+
+ // Switch the flash light on/off depending on the value of the 'enabled' property
+ const camera_videolightmode_t mode = (m_enabled ? CAMERA_VIDEOLIGHT_ON : CAMERA_VIDEOLIGHT_OFF);
+ const camera_error_t error = camera_config_videolight(m_camera, mode);
+ if (CAMERA_EOK != error) {
+ qDebug() << "Failed to toggle the front camera video light";
+ }
+
+ emit enabledChanged(m_enabled);
+}
+
+bool Flashlight::enabled() const
+{
+ return m_enabled;
+}
View
48 SensorDemo/src/Flashlight.hpp
@@ -0,0 +1,48 @@
+/* Copyright (c) 2012 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 FLASHLIGHT_HPP
+#define FLASHLIGHT_HPP
+
+#include <QObject>
+
+#include <camera/camera_api.h>
+
+class Flashlight: public QObject
+{
+ Q_OBJECT
+
+ // Defines whether the flash light of the camera is enabled or not
+ Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
+
+public:
+ Flashlight(QObject *parent = 0);
+ ~Flashlight();
+
+ // The accessor methods for the property
+ void setEnabled(bool enabled);
+ bool enabled() const;
+
+Q_SIGNALS:
+ // The change notification signal of the property
+ void enabledChanged(bool);
+
+private:
+ // The
+ bool m_enabled;
+ camera_handle_t m_camera;
+};
+
+#endif
View
52 SensorDemo/src/main.cpp
@@ -0,0 +1,52 @@
+/* Copyright (c) 2012 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 "Flashlight.hpp"
+
+#include <bb/cascades/AbstractPane>
+#include <bb/cascades/Application>
+#include <bb/cascades/QmlDocument>
+#include <bb/device/VibrationController>
+
+#include <QLocale>
+#include <QTranslator>
+
+using namespace bb::cascades;
+using namespace bb::device;
+
+int main(int argc, char **argv)
+{
+ Application app(argc, argv);
+
+//! [0]
+ qmlRegisterType<VibrationController>("bb.vibrationController", 1, 0, "VibrationController");
+ qmlRegisterType<Flashlight>("Flashlight", 1, 0, "Flashlight");
+//! [0]
+
+ // localization support
+ QTranslator translator;
+ const QString locale_string = QLocale().name();
+ const QString filename = QString::fromLatin1("SensorDemo_%1").arg(locale_string);
+ if (translator.load(filename, "app/native/qm")) {
+ app.installTranslator(&translator);
+ }
+
+ QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(&app);
+ AbstractPane *root = qml->createRootObject<AbstractPane>();
+
+ app.setScene(root);
+
+ return Application::exec();
+}
View
12 SensorDemo/translations/Makefile
@@ -0,0 +1,12 @@
+QMAKE_TARGET = SensorDemo
+LUPDATE = $(QNX_HOST)/usr/bin/lupdate
+LRELEASE = $(QNX_HOST)/usr/bin/lrelease
+
+update: $(QMAKE_TARGET).pro FORCE
+ $(LUPDATE) $(QMAKE_TARGET).pro
+
+release: $(QMAKE_TARGET).pro $(QMAKE_TARGET).ts
+ $(LRELEASE) $(QMAKE_TARGET).pro
+
+FORCE:
+
View
1 SensorDemo/translations/SensorDemo.pro
@@ -0,0 +1 @@
+include (../SensorDemo.pro)
View
0 SensorDemo/x86/.gitignore
No changes.

0 comments on commit b16368e

Please sign in to comment.
Something went wrong with that request. Please try again.