summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsensortag2014-09-10 12:35:19 -0500
committersensortag2014-09-10 12:35:19 -0500
commit4e95e3aff5700cda639e14af14e066df46c4dca7 (patch)
tree101537e7a15387b303214cb6cb716b7b9b89426f
downloadsensortag-android-4e95e3aff5700cda639e14af14e066df46c4dca7.tar.gz
sensortag-android-4e95e3aff5700cda639e14af14e066df46c4dca7.tar.xz
sensortag-android-4e95e3aff5700cda639e14af14e066df46c4dca7.zip
Moving project code to new repo - first commit.
-rw-r--r--.classpath9
-rw-r--r--.gitignore27
-rw-r--r--.project33
-rw-r--r--AndroidManifest.xml65
-rw-r--r--assets/SensorTagImgA.binbin0 -> 126976 bytes
-rw-r--r--assets/SensorTagImgB.binbin0 -> 126976 bytes
-rw-r--r--assets/about.css39
-rw-r--r--assets/about.html19
-rw-r--r--assets/help.css54
-rw-r--r--assets/help_device.html36
-rw-r--r--assets/help_scan.html42
-rw-r--r--assets/license.css37
-rw-r--r--assets/license.html91
-rw-r--r--libs/android-support-v4.jarbin0 -> 621451 bytes
-rw-r--r--project.properties14
-rw-r--r--res/drawable-hdpi/bluetooth.pngbin0 -> 5033 bytes
-rw-r--r--res/drawable-hdpi/ic_action_about.pngbin0 -> 683 bytes
-rw-r--r--res/drawable-hdpi/ic_action_bluetooth.pngbin0 -> 606 bytes
-rw-r--r--res/drawable-hdpi/ic_action_cancel.pngbin0 -> 438 bytes
-rw-r--r--res/drawable-hdpi/ic_action_refresh.pngbin0 -> 678 bytes
-rw-r--r--res/drawable-hdpi/ic_action_settings.pngbin0 -> 953 bytes
-rw-r--r--res/drawable-hdpi/list_item_normal.xml23
-rw-r--r--res/drawable-hdpi/tible.pngbin0 -> 1671 bytes
-rw-r--r--res/drawable-mdpi/buttonsoffoff.pngbin0 -> 11917 bytes
-rw-r--r--res/drawable-mdpi/buttonsoffon.pngbin0 -> 11549 bytes
-rw-r--r--res/drawable-mdpi/buttonsonoff.pngbin0 -> 11273 bytes
-rw-r--r--res/drawable-mdpi/buttonsonon.pngbin0 -> 9476 bytes
-rw-r--r--res/drawable-mdpi/ic_action_about.pngbin0 -> 465 bytes
-rw-r--r--res/drawable-mdpi/ic_action_bluetooth.pngbin0 -> 471 bytes
-rw-r--r--res/drawable-mdpi/ic_action_cancel.pngbin0 -> 328 bytes
-rw-r--r--res/drawable-mdpi/ic_action_refresh.pngbin0 -> 507 bytes
-rw-r--r--res/drawable-mdpi/ic_action_settings.pngbin0 -> 594 bytes
-rw-r--r--res/drawable-mdpi/reed_closed.pngbin0 -> 651 bytes
-rw-r--r--res/drawable-mdpi/reed_open.pngbin0 -> 998 bytes
-rw-r--r--res/drawable-mdpi/ti_stk_2c_pos_rgb_png.pngbin0 -> 11153 bytes
-rw-r--r--res/drawable-mdpi/tible.pngbin0 -> 1042 bytes
-rw-r--r--res/drawable-xhdpi/accelerometer.pngbin0 -> 10558 bytes
-rw-r--r--res/drawable-xhdpi/barometer.pngbin0 -> 17215 bytes
-rw-r--r--res/drawable-xhdpi/gyroscope.pngbin0 -> 17493 bytes
-rw-r--r--res/drawable-xhdpi/humidity.pngbin0 -> 15854 bytes
-rw-r--r--res/drawable-xhdpi/ic_action_about.pngbin0 -> 860 bytes
-rw-r--r--res/drawable-xhdpi/ic_action_bluetooth.pngbin0 -> 746 bytes
-rw-r--r--res/drawable-xhdpi/ic_action_cancel.pngbin0 -> 513 bytes
-rw-r--r--res/drawable-xhdpi/ic_action_refresh.pngbin0 -> 901 bytes
-rw-r--r--res/drawable-xhdpi/ic_action_settings.pngbin0 -> 1231 bytes
-rw-r--r--res/drawable-xhdpi/irtemperature.pngbin0 -> 14885 bytes
-rw-r--r--res/drawable-xhdpi/lightsensor.pngbin0 -> 4016 bytes
-rw-r--r--res/drawable-xhdpi/reedrelay.pngbin0 -> 4279 bytes
-rw-r--r--res/drawable-xhdpi/sensortag.pngbin0 -> 18675 bytes
-rw-r--r--res/drawable-xhdpi/sensortag_magnetometer.pngbin0 -> 14584 bytes
-rw-r--r--res/drawable-xhdpi/sensortag_simplekeys.pngbin0 -> 14494 bytes
-rw-r--r--res/drawable-xhdpi/st2.pngbin0 -> 2696 bytes
-rw-r--r--res/drawable-xhdpi/temperature.pngbin0 -> 13681 bytes
-rw-r--r--res/drawable-xhdpi/tible.pngbin0 -> 3306 bytes
-rw-r--r--res/drawable-xhdpi/unknown.pngbin0 -> 4183 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_about.pngbin0 -> 1409 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_bluetooth.pngbin0 -> 1035 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_cancel.pngbin0 -> 567 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_refresh.pngbin0 -> 1274 bytes
-rw-r--r--res/drawable-xxhdpi/ic_action_settings.pngbin0 -> 1863 bytes
-rw-r--r--res/layout/activity_file.xml31
-rw-r--r--res/layout/activity_fwupdate.xml140
-rw-r--r--res/layout/dialog_about.xml49
-rw-r--r--res/layout/dialog_license.xml21
-rw-r--r--res/layout/element_characteristic.xml31
-rw-r--r--res/layout/element_device.xml42
-rw-r--r--res/layout/element_file.xml14
-rw-r--r--res/layout/fragment_help.xml12
-rw-r--r--res/layout/fragment_pager.xml5
-rw-r--r--res/layout/fragment_scan.xml64
-rw-r--r--res/layout/frame_progress.xml9
-rw-r--r--res/layout/services_browser.xml225
-rw-r--r--res/layout/services_browser2.xml230
-rw-r--r--res/menu/device_activity_actions.xml23
-rw-r--r--res/menu/main_activity_actions.xml34
-rw-r--r--res/values/strings.xml79
-rw-r--r--res/values/styles.xml167
-rw-r--r--res/xml/gatt_uuid.xml96
-rw-r--r--res/xml/list_gradient.xml6
-rw-r--r--res/xml/popup.xml5
-rw-r--r--res/xml/preferences.xml55
-rw-r--r--res/xml/preferences2.xml55
-rw-r--r--src/com/example/ti/ble/common/BleDeviceInfo.java81
-rw-r--r--src/com/example/ti/ble/common/BluetoothLeService.java548
-rw-r--r--src/com/example/ti/ble/common/GattInfo.java162
-rw-r--r--src/com/example/ti/ble/common/HelpView.java89
-rw-r--r--src/com/example/ti/ble/sensortag/AboutDialog.java148
-rw-r--r--src/com/example/ti/ble/sensortag/BarometerCalibrationCoefficients.java66
-rw-r--r--src/com/example/ti/ble/sensortag/DeviceActivity.java626
-rw-r--r--src/com/example/ti/ble/sensortag/DeviceView.java309
-rw-r--r--src/com/example/ti/ble/sensortag/FileActivity.java251
-rw-r--r--src/com/example/ti/ble/sensortag/FwUpdateActivity.java614
-rw-r--r--src/com/example/ti/ble/sensortag/LicenseDialog.java97
-rw-r--r--src/com/example/ti/ble/sensortag/MagnetometerCalibrationCoefficients.java66
-rw-r--r--src/com/example/ti/ble/sensortag/MainActivity.java661
-rw-r--r--src/com/example/ti/ble/sensortag/PreferencesActivity.java91
-rw-r--r--src/com/example/ti/ble/sensortag/PreferencesFragment.java99
-rw-r--r--src/com/example/ti/ble/sensortag/PreferencesListener.java169
-rw-r--r--src/com/example/ti/ble/sensortag/ScanView.java316
-rw-r--r--src/com/example/ti/ble/sensortag/Sensor.java378
-rw-r--r--src/com/example/ti/ble/sensortag/SensorTagGatt.java106
-rw-r--r--src/com/example/ti/ble/sensortag/SimpleKeysStatus.java60
-rw-r--r--src/com/example/ti/ble/sensortag/ViewPagerActivity.java251
-rw-r--r--src/com/example/ti/util/Conversion.java156
-rw-r--r--src/com/example/ti/util/CustomTimer.java103
-rw-r--r--src/com/example/ti/util/CustomTimerCallback.java62
-rw-r--r--src/com/example/ti/util/CustomToast.java70
-rw-r--r--src/com/example/ti/util/Point3D.java100
108 files changed, 7561 insertions, 0 deletions
diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..b76ec6c
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,9 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<classpath>
3 <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
4 <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
5 <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
6 <classpathentry kind="src" path="src"/>
7 <classpathentry kind="src" path="gen"/>
8 <classpathentry kind="output" path="bin/classes"/>
9</classpath>
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5228a85
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,27 @@
1# Packages #
2############
3# it's better to unpack these files and commit the raw source
4# git has its own built in compression methods
5*.7z
6*.dmg
7*.gz
8*.iso
9*.rar
10*.tar
11*.zip
12
13# OS generated files #
14######################
15.DS_Store
16.DS_Store?
17.hg
18.hgignore
19.hgtags
20._*
21.Spotlight-V100
22.Trashes
23Icon?
24ehthumbs.db
25Thumbs.db
26bin*
27tmp
diff --git a/.project b/.project
new file mode 100644
index 0000000..bc25a77
--- /dev/null
+++ b/.project
@@ -0,0 +1,33 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<projectDescription>
3 <name>BleSensorTag</name>
4 <comment></comment>
5 <projects>
6 </projects>
7 <buildSpec>
8 <buildCommand>
9 <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
10 <arguments>
11 </arguments>
12 </buildCommand>
13 <buildCommand>
14 <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
15 <arguments>
16 </arguments>
17 </buildCommand>
18 <buildCommand>
19 <name>org.eclipse.jdt.core.javabuilder</name>
20 <arguments>
21 </arguments>
22 </buildCommand>
23 <buildCommand>
24 <name>com.android.ide.eclipse.adt.ApkBuilder</name>
25 <arguments>
26 </arguments>
27 </buildCommand>
28 </buildSpec>
29 <natures>
30 <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
31 <nature>org.eclipse.jdt.core.javanature</nature>
32 </natures>
33</projectDescription>
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
new file mode 100644
index 0000000..9493444
--- /dev/null
+++ b/AndroidManifest.xml
@@ -0,0 +1,65 @@
1<?xml version="1.0" encoding="utf-8"?>
2<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 package="com.example.ti.ble.sensortag"
4 android:versionCode="2"
5 android:versionName="1.01" >
6
7 <uses-permission android:name="android.permission.BLUETOOTH" />
8 <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
9 <uses-permission android:name="android.permission.INTERNET" />
10 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
11
12 <uses-sdk
13 android:minSdkVersion="18"
14 android:targetSdkVersion="19" />
15
16 <uses-feature
17 android:name="android.hardware.bluetooth_le"
18 android:required="true" />
19
20 <application
21 android:allowBackup="false"
22 android:icon="@drawable/tible"
23 android:label="@string/app_name"
24 android:theme="@android:style/Theme.Holo.Light" >
25 <service
26 android:name="com.example.ti.ble.common.BluetoothLeService"
27 android:enabled="true" />
28
29 <activity
30 android:name="com.example.ti.ble.sensortag.MainActivity"
31 android:label="@string/app_name"
32 android:screenOrientation="portrait" >
33 <intent-filter>
34 <action android:name="android.intent.action.MAIN" />
35
36 <category android:name="android.intent.category.DEFAULT" />
37 <category android:name="android.intent.category.LAUNCHER" />
38 </intent-filter>
39 </activity>
40 <activity
41 android:name="com.example.ti.ble.sensortag.DeviceActivity"
42 android:parentActivityName="MainActivity"
43 android:screenOrientation="portrait" />
44 <activity
45 android:name="com.example.ti.ble.sensortag.ServiceActivity"
46 android:parentActivityName="DeviceActivity"
47 android:screenOrientation="portrait" />
48 <activity
49 android:name="com.example.ti.ble.sensortag.FwUpdateActivity"
50 android:parentActivityName="DeviceActivity"
51 android:screenOrientation="portrait" />
52 <activity
53 android:name="com.example.ti.ble.sensortag.FileActivity"
54 android:parentActivityName="FwUpdateActivity"
55 android:screenOrientation="portrait" />
56 <activity
57 android:name="com.example.ti.ble.sensortag.PreferencesActivity"
58 android:parentActivityName="DeviceActivity"
59 android:screenOrientation="portrait"
60 android:label="Preferences"/>
61
62 </application>
63
64
65</manifest>
diff --git a/assets/SensorTagImgA.bin b/assets/SensorTagImgA.bin
new file mode 100644
index 0000000..dc731f0
--- /dev/null
+++ b/assets/SensorTagImgA.bin
Binary files differ
diff --git a/assets/SensorTagImgB.bin b/assets/SensorTagImgB.bin
new file mode 100644
index 0000000..9eef0ec
--- /dev/null
+++ b/assets/SensorTagImgB.bin
Binary files differ
diff --git a/assets/about.css b/assets/about.css
new file mode 100644
index 0000000..4f72254
--- /dev/null
+++ b/assets/about.css
@@ -0,0 +1,39 @@
1/* ------------------------------------------------------------
2 *
3 * File : about.css
4 *
5 * Description : Styles for About Dialog
6 *
7 * ----------------------------------------------------------- */
8body
9{
10padding:0;
11background-color:white;
12}
13
14div.main
15{
16margin:0 auto;
17padding:0;
18color:black;
19text-align:justify;
20}
21
22p
23{
24font-size:16px;
25}
26
27p.info
28{
29text-align:center;
30color:red;
31}
32
33p.copy
34{
35text-align:center;
36color:red;
37}
38
39
diff --git a/assets/about.html b/assets/about.html
new file mode 100644
index 0000000..eaeba26
--- /dev/null
+++ b/assets/about.html
@@ -0,0 +1,19 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN"
3 "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">
4<html>
5<head>
6<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
8<meta name="Author" content="Texas Instruments" />
9<title>About BLE SensorTag</title>
10<link rel="stylesheet" type="text/css" href="about.css" />
11</head>
12<body>
13 <div class="main">
14 <p><b>BLE SensorTag application</b> from <b>Texas Instruments</b> displays converted values from each of the six sensors
15 in the SensorTag. It also visualizes button presses. Up to four sensors may be used simultaneously (including keys).</p><hr />
16 <p class="copy">&copy; 2013-2014 Texas Instruments</p>
17 </div>
18</body>
19</html>
diff --git a/assets/help.css b/assets/help.css
new file mode 100644
index 0000000..618cfb0
--- /dev/null
+++ b/assets/help.css
@@ -0,0 +1,54 @@
1/* ------------------------------------------------------------
2 *
3 * File : help.css
4 *
5 * Description : Styles for the BLE Device Monitor Help pages
6 *
7 * ----------------------------------------------------------- */
8body
9{
10 background-color:#eee;
11 padding:0;
12 color:black;
13}
14
15h1
16{
17 font-size:20px;
18 text-align:center;
19}
20
21h2
22{
23 font-size:18px;
24 text-align:center;
25}
26
27div.main
28{
29 margin:0 auto;
30 text-align:justify;
31}
32
33p
34{
35 font-size:16px;
36}
37
38p.info
39{
40 text-align:center;
41 color:red;
42}
43
44p.copy
45{
46 text-align:center;
47 color:red;
48}
49
50b
51{
52 color:#003;
53}
54
diff --git a/assets/help_device.html b/assets/help_device.html
new file mode 100644
index 0000000..5df5156
--- /dev/null
+++ b/assets/help_device.html
@@ -0,0 +1,36 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<!-- *********************************************************
3** File : help_device.html
4** Descr. : Help for device view
5**** ****************************************************** -->
6<html>
7<head>
8<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9<meta HTTP-EQUIV="Pragma" CONTENT="no-cache" />
10<meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache" />
11<meta HTTP-EQUIV="expires" CONTENT="0">
12<meta name="Author" content="Texas Instruments" />
13<title>BLE Device Monitor</title>
14<link rel="stylesheet" type="text/css" href="help.css">
15</head>
16
17<body>
18 <div class="main">
19 <h1>Sensor View Help</h1>
20 <p>When the view is started a <b>Service Discovery</b> is initiated. On <b>Service Discovery</b> completion (may take a few seconds),
21 sensor images appear and data is displayed next to them. The <b>Preferences</b> tab in the options menu can be used to select <i>which</i> sensors
22 to show. Note that a maximum of four sensors may be activated per connection instance due to a limitation in Android's Bluetooth low energy stack on the number of
23 notifications.</p>
24 <p>Note that magnetometer, gyroscope and height measurement (barometer) are calibrated by tapping on the respective entry in the sensor list. The measured height shown
25 is calculated based on the difference in air pressure between the current measurement and the pressure at the moment of calibration. Measurements are always calibrated
26 on connection (but may be re-calibrated any time).</p>
27 <p>The SensorTag firmware can be upgraded OTA (Over The Air) via <b>Firmware Update</b> in the Options Menu. The application will contain images for the latest firmware,
28 but it is also possible to download custom images from Android's 'Download' directory. There are
29 two FW images for each FW revision. These are labeled <q>A</q> and <q>B</q> and differ only by the destination address in the
30 SensorTag flash. Alternative images must always be used; if the current image in flash is of type <q>A</q> the new one must of type
31 <q>B</q> and vice versa.<hr />
32 <p class="copy">&copy; 2013-2014 Texas Instruments</p>
33 </div>
34</body>
35</html>
36
diff --git a/assets/help_scan.html b/assets/help_scan.html
new file mode 100644
index 0000000..0c678b2
--- /dev/null
+++ b/assets/help_scan.html
@@ -0,0 +1,42 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<!-- **********************************************************
3** File : help_scan.html
4** Descr. : Help view for scan activity
5**** ****************************************************** -->
6<html>
7<head>
8<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
9<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
10<meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
11<meta HTTP-EQUIV="expires" CONTENT="0">
12<meta name="Author" content="Texas Instruments">
13<title>BLE SensorTag</title>
14<link rel=stylesheet type="text/css" href="help.css">
15</head>
16
17<body>
18 <div class="main">
19 <h1>Scan View Help</h1>
20 <p>Provided that the <b>Bluetooth Adapter</b> is available and turned on and Bluetooth low energy supported on the device
21 (the application will request to turn the adapter on if detected off at start-up), the <b>BLE SensorTag App</b>
22 will start device discovery (scanning) automatically. Scanning will stop when any of the following conditions is met:</p>
23 <ul>
24 <li><b>Stop</b> button tapped</b>
25 <li>A <b>device</b> in the list tapped</li>
26 <li><b>Ten seconds</b> elapsed since scanning started</li>
27 </ul>
28 <p>Scanning can be restarted any time by tapping the <b>Scan</b> button. During scanning Received Signal Strength Indicator (RSSI) values are continuously updated. Note that
29 some devices do not provide continuous scan results (Nexus 4, Nexus 7 2013), on these devices the RSSI value will appear only once.
30 When a device in the list is selected by the user, the application will attempt to connect to it. If the connection succeeds,
31 the <u>Device View</u> will be launched, and this is where data from the enabled sensors are displayed. If connection times out an error message
32 is displayed. This will happen when the SensorTag doesn't advertise, so always make sure it is advertising by pushing the side button on the SensorTag
33 (this button toggles advertising).</p>
34 <p>The options menu gives direct access to the SensorTag web page, and to TI's e2e forum. The Bluetooth settings dialog can also
35 be accessed from here. There is also a brief About dialog with information about the SensorTag, the Android device name and the Android build.
36 </p>
37 <p class="copy"<hr>&copy; 2013-2014 Texas Instruments</p>
38</div>
39
40</body>
41</html>
42
diff --git a/assets/license.css b/assets/license.css
new file mode 100644
index 0000000..640ab31
--- /dev/null
+++ b/assets/license.css
@@ -0,0 +1,37 @@
1/* ------------------------------------------------------------
2 *
3 * File : license.css
4 *
5 * Description : Styles for License Dialog
6 *
7 * ----------------------------------------------------------- */
8body
9{
10 padding:0;
11 background-color:white;
12}
13
14div.main
15{
16 margin:0 auto;
17 padding:0;
18 color:black;
19 text-align:justify;
20}
21
22h2
23{
24 font-size:16px;
25 color:red;
26}
27
28h2
29{
30 font-size:15px;
31}
32
33p
34{
35 font-size:14px;
36}
37
diff --git a/assets/license.html b/assets/license.html
new file mode 100644
index 0000000..f7f2f41
--- /dev/null
+++ b/assets/license.html
@@ -0,0 +1,91 @@
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<!-- **********************************************************
3** File : license.html
4** Descr. : Content of License Dialog
5**** ****************************************************** -->
6<html>
7<head>
8<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
9<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
10<meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
11<meta HTTP-EQUIV="expires" CONTENT="0">
12<meta name="Author" content="Texas Instruments">
13<title>License</title>
14<link rel=stylesheet type="text/css" href="license.css">
15</head>
16
17<body>
18 <div class="main">
19 <h2>TEXAS INSTRUMENTS INCORPORATED PRIVACY POLICY</h2>
20 This application, and your use of this application, is subject to <b>TI’s Privacy Policy</b> available at <a href="http://www.ti.com/corp/docs/legal/privacy.shtml">http://www.ti.com/corp/docs/legal/privacy.shtml</a>. By downloading, installing, copying, or otherwise using this application, you consent to the use of your information as described above and as described in TI’s Privacy Policy.</p>
21 <h2>TEXAS INSTRUMENTS INCORPORATED LICENSED APPLICATION END USER LICENSE AGREEMENT</h2>
22 <p>You understand and agree that the <b>Licensed Application</b> is not recommended for consumer use, but is intended and targeted for applications developers’ use. You also understand and agree that the Licensed Application processes and displays any data that the user feeds into TI sensors with which the Licensed Application is designed to communicate. The Licensed Application is for demonstration and development purposes only; it is not for diagnostic or therapeutic use.</p>
23 <p>
24 This Licensed Application End User License Agreement (this “<u>Agreement</u>”) is a legal agreement between you and Texas Instruments Incorporated (“<u>TI</u>”). In this Agreement “You” means you personally if you will exercise the rights granted for your own benefit, but it means your company (or you on behalf of your company) if you will exercise the rights granted for your company’s benefit. The “<u>Licensed Application</u>” subject to this Agreement includes the software programs and any associated electronic documentation (in each case, in whole or in part) that accompany this Agreement and that you access online, as well as any updates to such software programs and documentation, if any, provided to you at TI’s sole discretion. By downloading, installing, copying, or otherwise using the Licensed Application you agree to abide by the provisions set forth herein. This Agreement is made available to or displayed for you to read prior to downloading, installing, or otherwise using the Licensed Application. If you choose not to accept or agree with these provisions, do not download, install, or use the Licensed Application.
25 </p>
26 <h3>a. Scope of license</h3>
27 <p>
28 i. This license granted to You for the Licensed Application by TI is limited to a non-transferable license to use the Licensed Application on a mobile device that You control, and, if applicable, as permitted by usage rules pertaining to the mobile operating system on which you download the Licensed Application (e.g., Android) (“Usage Rules”). This license does not allow You to use the Licensed Application on any mobile device that You do not own or control, and You may not distribute or make the Licensed Application available over a network where it could be used by multiple mobile devices at the same time. You may not rent, lease, lend, sell, redistribute or sublicense the Licensed Application. You will not, and will not permit any person or entity to, copy (except as expressly permitted by this license and the Usage Rules), decompile, reverse engineer, disassemble, attempt to derive the source code of, modify, or create derivative works of the Licensed Application, any updates, or any part thereof (except as and only to the extent any foregoing restriction is prohibited by applicable law or to the extent as may be permitted by the licensing terms governing use of any Open Source Software (defined below) included with the Licensed Application). You may use the Licensed Application with Open Source Software or with software developed using Open Source Software tools provided you do not incorporate, combine or distribute the Licensed Application in a manner that subjects the Licensed Application to any license obligations or any other intellectual property related terms of any license governing such Open Source Software. You will not remove, alter, cover, or obscure any confidentiality, trade secret, trade mark, patent, copyright or other proprietary notice or other identifying marks or designs from any component of the Licensed Application. Any attempt to do so is a violation of the rights of TI and its licensors. If You breach this restriction, You may be subject to prosecution and damages. The terms of the license will govern any upgrades provided by TI that replace and/or supplement the original product, unless such upgrade is accompanied by a separate license in which case the terms of that license will govern.
29 </p>
30 <p>ii. The Licensed Application may be bundled with software and associated electronic documentation, if any, licensed under terms other than the terms of this Agreement (in whole or in part, “Other Licensed Materials”), including, for example Open Source Software and/or TI-owned or third party Proprietary Software licensed under such other terms. “Open Source Software” means any software licensed under terms requiring that (A) other software (“Proprietary Software”) incorporated, combined, or distributed with such software or developed using such software: (i) be disclosed or distributed in source code form; or (ii) otherwise be licensed on terms inconsistent with the terms of this Agreement, including but not limited to permitting use of the Proprietary Software on or with applications other than the Licensed Application, or (B) the owner of Proprietary Software to license any of its patents to users of the Open Source Software and/or Proprietary Software incorporated, combined, or distributed with such Open Source Software or developed using such Open Source Software
31</p>
32<p>
33iii. If by accepting this Agreement, you gain access to Other Licensed Materials, they will be listed in the applicable software manifest. Your use of the Other Licensed Materials is subject to the applicable other licensing terms acknowledgements and disclaimers as specified in the applicable software manifest and/or identified or included with the Other Licensed Materials in the software bundle. For clarification, this Agreement does not limit your rights under, or grant you rights that supersede, the terms of any applicable Other Licensed Materials license agreement. If any of the Other Licensed Materials is Open Source Software that has been provided to you in object code only under terms that obligate TI to provide to you or show you where you can access the source code versions of such Open Source Software, TI will provide to you, or show you where you can access, such source code if you contact TI at Texas Instruments Incorporated, 12500 TI Boulevard, Mail Station 8725, Dallas, Texas 75243, Attention: Open Source Review Board. In the event you choose not to accept or agree with the terms in any applicable Other Licensed Materials license agreement, you must terminate this Agreement.
34</p>
35
36<p>iv. If the Licensed Application is designed to be used with a TI evaluation module for demonstration purposes, neither the Licensed Application nor the TI evaluation module may be used for diagnosing, curing, treating, mitigating, preventing diseases and health conditions, or for therapeutic purposes, and may only be used for research and development purposes.
37</p>
38
39<p>
40v. You understand and agree that the Licensed Application is not recommended for consumer use, but is intended and targeted for applications developers’ use. You also understand and agree that the Licensed Application processes and displays any data that the user feeds into TI sensors with which the Licensed Application is designed to communicate. This application is for demonstration and development purposes only; it is not for diagnostic or therapeutic use.
41</p>
42
43<h3>b. Ownership</h3>
44<p>
45The Licensed Application is licensed, not sold to you, and can only be used in accordance with the terms of this Agreement. Subject to the license granted to you pursuant to this Agreement, TI and its licensors own and shall continue to own all right, title and interest in and to the Licensed Application, including all copies thereof. You agree that all fixes, modifications, and improvements to the Licensed Application conceived of or made by TI that are based, either in whole or in part, on your feedback, suggestions, or recommendations are the exclusive property of TI and all right, title, and interest in and to such fixes, modifications or improvements to the Licensed Application will vest solely in TI. Moreover, you acknowledge and agree that when your independently developed software or hardware components are combined, in whole or in part, with the Licensed Application, your right to use the combined work that includes the Licensed Application remains subject to the terms and conditions of this Agreement.
46</p>
47
48<h3>c. Consent to Use of Data</h3>
49<p>
50You agree that TI may collect and use technical data and related information, including but not limited to technical information about Your device, system and application software, and peripherals, that is gathered periodically to facilitate the provision of software updates, product support and other services to You (if any) related to the Licensed Application. TI may use this information, as long as it is in a form that does not personally identify You, to improve its products or to provide services or technologies to You. The Licensed Application, and your use of the Licensed Application, is subject to TI’s Privacy Policy available at <a href="http://www.ti.com/corp/docs/legal/privacy.shtml">http://www.ti.com/corp/docs/legal/privacy.shtml</a>. By downloading, installing, copying, or otherwise using the Licensed Application, you consent to the use of your information as described above and as described in TI’s Privacy Policy.
51</p>
52
53<h3>d. Termination.</h3><p>The license is effective until terminated by You or TI. Your rights under this license will terminate automatically without notice from TI if You fail to comply with any term(s) of this Agreement. Upon termination of this Agreement, You shall cease all use of the Licensed Application, and destroy all copies, full or partial, of the Licensed Application.</p>
54
55<h3>e. Accessed Services; Third Party Materials.</h3><p>The Licensed Application may enable access to TI’s and third party services and web sites (collectively and individually, “Accessed Services”). Use of the Accessed Services may require internet access and You accept additional terms of service for the Accessed Services, and may also be subject to other privacy practices and policies.</p>
56<p>TI does not warrant or endorse and does not assume and will not have any liability or responsibility to You or any other person for any third-party content, data, information, applications, or materials from third parties (“Third Party Materials”), Accessed Services, web sites, or for any other materials, products, or services of third parties. Third Party Materials and links to other web sites are provided solely as a convenience to You. Neither TI, nor any of its content providers, guarantees the availability, accuracy, completeness, reliability, or timeliness of any information displayed by any Accessed Services. You agree to use the Accessed Services at Your sole risk and that TI shall not have any liability to You for content that may be found to be offensive, indecent, or objectionable.</p>
57<p>Third party Accessed Services and Third Party Materials that may be accessed from, displayed on or linked to from a mobile device are not available in all languages or in all countries. TI makes no representation that such Accessed Services and Third Party Materials are appropriate or available for use in any particular location. To the extent You choose to access such Accessed Services or Third Party Materials, You do so at Your own initiative and are responsible for compliance with any applicable laws. TI, and its licensors, reserve the right to change, suspend, remove, or disable access to any Accessed Services at any time without notice. In no event will TI be liable for the removal of or disabling of access to any such Accessed Services. TI may also impose limits on the use of or access to certain Accessed Services without notice or liability.</p>
58
59<h3>f. Intellectual Property Rights.</h3><p>The Licensed Application contains copyrighted material, trade secrets, and other proprietary information of TI and its licensors that are protected by copyright laws, international copyright treaties, and trade secret laws, as well as other intellectual property laws. To protect TI’s and its licensors’ rights in the Licensed Application, you agree to the restrictions contained in Section (a) above.</p>
60
61<h3>g. No Other License.</h3><p>TI reserves all rights not specifically granted under this Agreement. Nothing in this Agreement shall be construed as a license to any intellectual property rights of TI other than those rights embodied in the Licensed Application provided to you by TI. EXCEPT AS PROVIDED HEREIN, NO OTHER LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY OTHER TI INTELLECTUAL PROPERTY RIGHTS IS GRANTED HEREIN.</p>
62
63<h3>h. Covenant not to Sue.</h3><p>During the term of this Agreement, you agree not to assert a claim against TI or its licensees that the Licensed Application infringes your intellectual property rights.</p>
64
65<h3>i. NO WARRANTY:</h3><p>YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT USE OF THE LICENSED APPLICATION IS AT YOUR SOLE RISK AND THAT THE ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY AND EFFORT IS WITH YOU. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED APPLICATION AND ANY SERVICES PERFORMED OR PROVIDED BY THE LICENSED APPLICATION ("SERVICES") ARE PROVIDED "AS IS" AND “AS AVAILABLE”, WITH ALL FAULTS AND WITHOUT WARRANTY OF ANY KIND, AND TI HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS WITH RESPECT TO THE LICENSED APPLICATION AND ANY SERVICES, EITHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF MERCHANTABILITY, OF SATISFACTORY QUALITY, OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY, OF QUIET ENJOYMENT, AND NON-INFRINGEMENT OF ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADE SECRETS, OR OTHER INTELLECTUAL PROPERTY RIGHTS. TI DOES NOT WARRANT AGAINST INTERFERENCE WITH YOUR ENJOYMENT OF THE LICENSED APPLICATION, THAT THE FUNCTIONS CONTAINED IN, OR SERVICES PERFORMED OR PROVIDED BY, THE LICENSED APPLICATION WILL MEET YOUR REQUIREMENTS, THAT THE OPERATION OF THE LICENSED APPLICATION OR SERVICES WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT DEFECTS IN THE LICENSED APPLICATION OR SERVICES WILL BE CORRECTED. NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY TI OR ITS AUTHORIZED REPRESENTATIVE SHALL CREATE A WARRANTY. SHOULD THE LICENSED APPLICATION OR SERVICES PROVE DEFECTIVE, YOU ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES OR LIMITATIONS ON APPLICABLE STATUTORY RIGHTS OF A CONSUMER, SO THE ABOVE EXCLUSION AND LIMITATIONS MAY NOT APPLY TO YOU.</p>
66<p> FURTHERMORE, YOU ACKNOWLEDGE AND AGREE THAT THE LICENSED APPLICATION HAS NOT BEEN TESTED OR CERTIFIED BY ANY GOVERNMENT AGENCY OR INDUSTRY REGULATORY ORGANIZATION OR ANY OTHER THIRD PARTY ORGANIZATION.</p>
67<p>
68YOU AGREE TO USE YOUR INDEPENDENT JUDGMENT IN DEVELOPING YOUR PRODUCTS. NOTHING CONTAINED IN THIS AGREEMENT WILL BE CONSTRUED AS A WARRANTY OR REPRESENTATION BY TI TO MAINTAIN PRODUCTION OF ANY TI SEMICONDUCTOR DEVICE OR OTHER HARDWARE OR SOFTWARE WITH WHICH THE LICENSED APPLICATION MAY BE USED.</p>
69
70<h3>j. LIMITATION OF LIABILITY.</h3><p>TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT SHALL TI OR ITS LICENSORS BE LIABLE FOR PERSONAL INJURY, OR ANY INCIDENTAL, SPECIAL, INDIRECT, INCIDENTIAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES WHATSOEVER, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, COST OF REMOVAL OR REINSTALLATION, OUTSIDE COMPUTER TIME, LABOR COSTS, LOSS OF DATA, LOSS OF GOODWILL, LOSS OF SAVINGS, LOSS OF USE OR INTERRUPTION OF BUSINESS, OR ANY OTHER DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR INABILITY TO USE THE LICENSED APPLICATION, HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT, OR OTHERWISE) AND EVEN IF TI HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY FOR PERSONAL INJURY, OR OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY TO YOU. In no event shall TI’s or its licensors’ aggregate liability under this Agreement or arising out of your use of the Licensed Application total liability to you for all damages exceed the amount of fifty dollars ($50.00). The foregoing limitations will apply even if the above stated remedy fails of its essential purpose.</p>
71
72<h3>k. Indemnification Disclaimer.</h3><p>YOU ACKNOWLEDGE AND AGREE THAT TI SHALL NOT BE LIABLE FOR AND SHALL NOT DEFEND OR INDEMNIFY YOU AGAINST ANY THIRD PARTY CLAIM THAT RELATES TO OR IS BASED ON YOUR USE OF THE LICENSED APPLICATION.</p>
73
74<h3>l. Export Control.</h3><p>The Licensed Application is subject to export control under the U.S. Commerce Department’s Export Administration Regulations (“EAR”). Unless prior authorization is obtained from the U.S. Commerce Department, neither you nor your subsidiaries shall export, re-export, or release, directly or indirectly (including, without limitation, by permitting the Licensed Application to be downloaded), any technology, software, or software source code, received from TI, or export, directly or indirectly, any direct product of such technology, software, or software source code, to any person, destination or country to which the export, re-export, or release of the technology, software, or software source code, or direct product is prohibited by the EAR. You represent and warrant that you (i) are not located in, or under the control of, a national or resident of Cuba, Iran, North Korea, Sudan and Syria or any other country subject to a U.S. goods embargo; (ii) are not on the U.S. Treasury Department’s List of Specially Designated Nationals or the U.S. Commerce Department’s Denied Persons List or Entity List; and (iii) will not use the Licensed Application or transfer the Licensed Application for use in any military, nuclear, chemical or biological weapons, or missile technology end-uses. Any software export classification made by TI shall not be construed as a representation or warranty regarding the proper export classification for such software or whether an export license or other documentation is required for the exportation of such software.</p>
75
76<h3>m. PRC Provisions.</h3><p>If you are located in the People’s Republic of China (“PRC”) or if the Licensed Application will be sent to the PRC, the following provisions shall apply:</p><p>
77i. Registration Requirements. You shall be solely responsible for performing all acts and obtaining all approvals that may be required in connection with this Agreement by the government of the PRC, including but not limited to registering pursuant to, and otherwise complying with, the PRC Measures on the Administration of Software Products, Management Regulations on Technology Import-Export, and Technology Import and Export Contract Registration Management Rules. Upon receipt of such approvals from the government authorities, you shall forward evidence of all such approvals to TI for its records. In the event that you fail to obtain any such approval or registration, you shall be solely responsible for any and all losses, damages or costs resulting therefrom, and shall indemnify TI for all such losses, damages or costs.</p>
78<p>
79ii. Governing Language. This Agreement is written and executed in the English language and shall be authoritative and controlling, whether or not translated into a language other than English to comply with law or for reference purposes. If a translation of this Agreement is required for any purpose, including but not limited to registration of the Agreement pursuant to any governmental laws, regulations or rules, you shall be solely responsible for creating such translation.</p>
80
81<h3>n. No Technical Support.</h3><p>TI and its licensors are under no obligation to install, maintain, or support the Licensed Application.</p>
82
83<h3>o. Trademarks and Logos.</h3>This Agreement does not grant You any rights to use any trademarks, logos or service marks belonging to TI.
84
85<h3>p. Governing Law and Severability; Waiver.</h3><p>This Agreement will be governed by and interpreted in accordance with the laws of the State of Texas, without reference to conflict of laws principles. If for any reason a court of competent jurisdiction finds any provision of the Agreement to be unenforceable, that provision will be enforced to the maximum extent possible to effectuate the intent of the parties, and the remainder of the Agreement shall continue in full force and effect. This Agreement shall not be governed by the United Nations Convention on Contracts for the International Sale of Goods, or by the Uniform Computer Information Transactions Act (UCITA). The parties agree that non-exclusive jurisdiction for any dispute arising out of or relating to this Agreement lies within the courts located in the State of Texas. Notwithstanding the foregoing, any judgment may be enforced in any United States or foreign court, and either party may seek injunctive relief in any United States or foreign court. Failure by TI to enforce any provision of this Agreement shall not be deemed a waiver of future enforcement of that or any other provision in this Agreement or any other agreement that may be in place between the parties. Your use of the Licensed Application may also be subject to other local, state, national, or international laws.</p>
86
87<h3>q. Notices.</h3><p>Except as otherwise indicated, all notices to TI hereunder shall be delivered to Texas Instruments Incorporated, 12500 TI Boulevard, Dallas, Texas 75243, Attention: Internet Marketing, with a copy to Texas Instruments Incorporated, 13588 N. Central Expressway, Mail Station 3999, Dallas, Texas 75243, Attention: Law Department – Sales &amp; Marketing. All notices shall be deemed served when received by TI.
88</p>
89 </div>
90</body>
91</html>
diff --git a/libs/android-support-v4.jar b/libs/android-support-v4.jar
new file mode 100644
index 0000000..9056828
--- /dev/null
+++ b/libs/android-support-v4.jar
Binary files differ
diff --git a/project.properties b/project.properties
new file mode 100644
index 0000000..4ab1256
--- /dev/null
+++ b/project.properties
@@ -0,0 +1,14 @@
1# This file is automatically generated by Android Tools.
2# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3#
4# This file must be checked in Version Control Systems.
5#
6# To customize properties used by the Ant build system edit
7# "ant.properties", and override values to adapt the script to your
8# project structure.
9#
10# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12
13# Project target.
14target=android-19
diff --git a/res/drawable-hdpi/bluetooth.png b/res/drawable-hdpi/bluetooth.png
new file mode 100644
index 0000000..adc7b42
--- /dev/null
+++ b/res/drawable-hdpi/bluetooth.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_action_about.png b/res/drawable-hdpi/ic_action_about.png
new file mode 100644
index 0000000..077dcec
--- /dev/null
+++ b/res/drawable-hdpi/ic_action_about.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_action_bluetooth.png b/res/drawable-hdpi/ic_action_bluetooth.png
new file mode 100644
index 0000000..eec6adf
--- /dev/null
+++ b/res/drawable-hdpi/ic_action_bluetooth.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_action_cancel.png b/res/drawable-hdpi/ic_action_cancel.png
new file mode 100644
index 0000000..f889617
--- /dev/null
+++ b/res/drawable-hdpi/ic_action_cancel.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_action_refresh.png b/res/drawable-hdpi/ic_action_refresh.png
new file mode 100644
index 0000000..45b2228
--- /dev/null
+++ b/res/drawable-hdpi/ic_action_refresh.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_action_settings.png b/res/drawable-hdpi/ic_action_settings.png
new file mode 100644
index 0000000..0eb78f7
--- /dev/null
+++ b/res/drawable-hdpi/ic_action_settings.png
Binary files differ
diff --git a/res/drawable-hdpi/list_item_normal.xml b/res/drawable-hdpi/list_item_normal.xml
new file mode 100644
index 0000000..f8e8b46
--- /dev/null
+++ b/res/drawable-hdpi/list_item_normal.xml
@@ -0,0 +1,23 @@
1<?xml version="1.0" encoding="utf-8"?>
2<shape xmlns:android="http://schemas.android.com/apk/res/android"
3 android:shape="rectangle" >
4
5 <gradient
6 android:angle="270"
7 android:centerColor="#333"
8 android:endColor="#666"
9 android:startColor="#666" />
10
11 <stroke
12 android:width="2dp"
13 android:color="#A0000000" />
14
15 <padding
16 android:bottom="8dp"
17 android:left="5dp"
18 android:right="5dp"
19 android:top="8dp" />
20
21 <corners android:radius="12dp" />
22
23</shape> \ No newline at end of file
diff --git a/res/drawable-hdpi/tible.png b/res/drawable-hdpi/tible.png
new file mode 100644
index 0000000..385c985
--- /dev/null
+++ b/res/drawable-hdpi/tible.png
Binary files differ
diff --git a/res/drawable-mdpi/buttonsoffoff.png b/res/drawable-mdpi/buttonsoffoff.png
new file mode 100644
index 0000000..06aa7d3
--- /dev/null
+++ b/res/drawable-mdpi/buttonsoffoff.png
Binary files differ
diff --git a/res/drawable-mdpi/buttonsoffon.png b/res/drawable-mdpi/buttonsoffon.png
new file mode 100644
index 0000000..e83eb27
--- /dev/null
+++ b/res/drawable-mdpi/buttonsoffon.png
Binary files differ
diff --git a/res/drawable-mdpi/buttonsonoff.png b/res/drawable-mdpi/buttonsonoff.png
new file mode 100644
index 0000000..dfdcb6b
--- /dev/null
+++ b/res/drawable-mdpi/buttonsonoff.png
Binary files differ
diff --git a/res/drawable-mdpi/buttonsonon.png b/res/drawable-mdpi/buttonsonon.png
new file mode 100644
index 0000000..b48e688
--- /dev/null
+++ b/res/drawable-mdpi/buttonsonon.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_action_about.png b/res/drawable-mdpi/ic_action_about.png
new file mode 100644
index 0000000..624e745
--- /dev/null
+++ b/res/drawable-mdpi/ic_action_about.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_action_bluetooth.png b/res/drawable-mdpi/ic_action_bluetooth.png
new file mode 100644
index 0000000..e06e4f3
--- /dev/null
+++ b/res/drawable-mdpi/ic_action_bluetooth.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_action_cancel.png b/res/drawable-mdpi/ic_action_cancel.png
new file mode 100644
index 0000000..e84853e
--- /dev/null
+++ b/res/drawable-mdpi/ic_action_cancel.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_action_refresh.png b/res/drawable-mdpi/ic_action_refresh.png
new file mode 100644
index 0000000..de008e5
--- /dev/null
+++ b/res/drawable-mdpi/ic_action_refresh.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_action_settings.png b/res/drawable-mdpi/ic_action_settings.png
new file mode 100644
index 0000000..c290e59
--- /dev/null
+++ b/res/drawable-mdpi/ic_action_settings.png
Binary files differ
diff --git a/res/drawable-mdpi/reed_closed.png b/res/drawable-mdpi/reed_closed.png
new file mode 100644
index 0000000..ec48fdb
--- /dev/null
+++ b/res/drawable-mdpi/reed_closed.png
Binary files differ
diff --git a/res/drawable-mdpi/reed_open.png b/res/drawable-mdpi/reed_open.png
new file mode 100644
index 0000000..128f258
--- /dev/null
+++ b/res/drawable-mdpi/reed_open.png
Binary files differ
diff --git a/res/drawable-mdpi/ti_stk_2c_pos_rgb_png.png b/res/drawable-mdpi/ti_stk_2c_pos_rgb_png.png
new file mode 100644
index 0000000..14025a0
--- /dev/null
+++ b/res/drawable-mdpi/ti_stk_2c_pos_rgb_png.png
Binary files differ
diff --git a/res/drawable-mdpi/tible.png b/res/drawable-mdpi/tible.png
new file mode 100644
index 0000000..1ed972a
--- /dev/null
+++ b/res/drawable-mdpi/tible.png
Binary files differ
diff --git a/res/drawable-xhdpi/accelerometer.png b/res/drawable-xhdpi/accelerometer.png
new file mode 100644
index 0000000..6eca220
--- /dev/null
+++ b/res/drawable-xhdpi/accelerometer.png
Binary files differ
diff --git a/res/drawable-xhdpi/barometer.png b/res/drawable-xhdpi/barometer.png
new file mode 100644
index 0000000..06bedfc
--- /dev/null
+++ b/res/drawable-xhdpi/barometer.png
Binary files differ
diff --git a/res/drawable-xhdpi/gyroscope.png b/res/drawable-xhdpi/gyroscope.png
new file mode 100644
index 0000000..30cff8d
--- /dev/null
+++ b/res/drawable-xhdpi/gyroscope.png
Binary files differ
diff --git a/res/drawable-xhdpi/humidity.png b/res/drawable-xhdpi/humidity.png
new file mode 100644
index 0000000..40d04ce
--- /dev/null
+++ b/res/drawable-xhdpi/humidity.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_action_about.png b/res/drawable-xhdpi/ic_action_about.png
new file mode 100644
index 0000000..3be3152
--- /dev/null
+++ b/res/drawable-xhdpi/ic_action_about.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_action_bluetooth.png b/res/drawable-xhdpi/ic_action_bluetooth.png
new file mode 100644
index 0000000..f370b65
--- /dev/null
+++ b/res/drawable-xhdpi/ic_action_bluetooth.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_action_cancel.png b/res/drawable-xhdpi/ic_action_cancel.png
new file mode 100644
index 0000000..58e2e3b
--- /dev/null
+++ b/res/drawable-xhdpi/ic_action_cancel.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_action_refresh.png b/res/drawable-xhdpi/ic_action_refresh.png
new file mode 100644
index 0000000..cdc160d
--- /dev/null
+++ b/res/drawable-xhdpi/ic_action_refresh.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_action_settings.png b/res/drawable-xhdpi/ic_action_settings.png
new file mode 100644
index 0000000..999d0f0
--- /dev/null
+++ b/res/drawable-xhdpi/ic_action_settings.png
Binary files differ
diff --git a/res/drawable-xhdpi/irtemperature.png b/res/drawable-xhdpi/irtemperature.png
new file mode 100644
index 0000000..a38242b
--- /dev/null
+++ b/res/drawable-xhdpi/irtemperature.png
Binary files differ
diff --git a/res/drawable-xhdpi/lightsensor.png b/res/drawable-xhdpi/lightsensor.png
new file mode 100644
index 0000000..b671ac4
--- /dev/null
+++ b/res/drawable-xhdpi/lightsensor.png
Binary files differ
diff --git a/res/drawable-xhdpi/reedrelay.png b/res/drawable-xhdpi/reedrelay.png
new file mode 100644
index 0000000..7da2ffc
--- /dev/null
+++ b/res/drawable-xhdpi/reedrelay.png
Binary files differ
diff --git a/res/drawable-xhdpi/sensortag.png b/res/drawable-xhdpi/sensortag.png
new file mode 100644
index 0000000..e925fc0
--- /dev/null
+++ b/res/drawable-xhdpi/sensortag.png
Binary files differ
diff --git a/res/drawable-xhdpi/sensortag_magnetometer.png b/res/drawable-xhdpi/sensortag_magnetometer.png
new file mode 100644
index 0000000..e3123ed
--- /dev/null
+++ b/res/drawable-xhdpi/sensortag_magnetometer.png
Binary files differ
diff --git a/res/drawable-xhdpi/sensortag_simplekeys.png b/res/drawable-xhdpi/sensortag_simplekeys.png
new file mode 100644
index 0000000..adad73a
--- /dev/null
+++ b/res/drawable-xhdpi/sensortag_simplekeys.png
Binary files differ
diff --git a/res/drawable-xhdpi/st2.png b/res/drawable-xhdpi/st2.png
new file mode 100644
index 0000000..d3ba7e1
--- /dev/null
+++ b/res/drawable-xhdpi/st2.png
Binary files differ
diff --git a/res/drawable-xhdpi/temperature.png b/res/drawable-xhdpi/temperature.png
new file mode 100644
index 0000000..22648f1
--- /dev/null
+++ b/res/drawable-xhdpi/temperature.png
Binary files differ
diff --git a/res/drawable-xhdpi/tible.png b/res/drawable-xhdpi/tible.png
new file mode 100644
index 0000000..2f8a3c7
--- /dev/null
+++ b/res/drawable-xhdpi/tible.png
Binary files differ
diff --git a/res/drawable-xhdpi/unknown.png b/res/drawable-xhdpi/unknown.png
new file mode 100644
index 0000000..ba78c7f
--- /dev/null
+++ b/res/drawable-xhdpi/unknown.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_about.png b/res/drawable-xxhdpi/ic_action_about.png
new file mode 100644
index 0000000..0fe809b
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_about.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_bluetooth.png b/res/drawable-xxhdpi/ic_action_bluetooth.png
new file mode 100644
index 0000000..0c0f1ac
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_bluetooth.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_cancel.png b/res/drawable-xxhdpi/ic_action_cancel.png
new file mode 100644
index 0000000..a9bbcde
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_cancel.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_refresh.png b/res/drawable-xxhdpi/ic_action_refresh.png
new file mode 100644
index 0000000..cb847f3
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_refresh.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_settings.png b/res/drawable-xxhdpi/ic_action_settings.png
new file mode 100644
index 0000000..530227e
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_settings.png
Binary files differ
diff --git a/res/layout/activity_file.xml b/res/layout/activity_file.xml
new file mode 100644
index 0000000..9f150cf
--- /dev/null
+++ b/res/layout/activity_file.xml
@@ -0,0 +1,31 @@
1<?xml version="1.0" encoding="utf-8"?>
2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:tools="http://schemas.android.com/tools"
4 android:layout_width="match_parent"
5 android:layout_height="match_parent"
6 android:orientation="vertical"
7 tools:context=".FileActivity" >
8
9 <TextView
10 android:id="@+id/tw_directory"
11 style="@style/dirStyle"
12 android:layout_width="fill_parent"
13 android:layout_height="wrap_content" />
14
15 <ListView
16 android:id="@+id/lw_file"
17 style="@style/devlistStyle"
18 android:layout_width="fill_parent"
19 android:layout_height="0dp"
20 android:layout_weight="2"
21 android:choiceMode="singleChoice"
22 android:padding="3dp" />
23
24 <Button
25 android:id="@+id/btn_confirm"
26 android:layout_width="fill_parent"
27 android:layout_height="wrap_content"
28 android:onClick="onConfirm"
29 android:text="@string/btn_txt_confirm" />
30
31</LinearLayout> \ No newline at end of file
diff --git a/res/layout/activity_fwupdate.xml b/res/layout/activity_fwupdate.xml
new file mode 100644
index 0000000..856297b
--- /dev/null
+++ b/res/layout/activity_fwupdate.xml
@@ -0,0 +1,140 @@
1<?xml version="1.0" encoding="utf-8"?>
2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="fill_parent"
4 android:layout_height="fill_parent"
5 android:layout_margin="10dip"
6 android:orientation="vertical" >
7
8 <LinearLayout
9 android:layout_width="fill_parent"
10 android:layout_height="wrap_content"
11 android:gravity="left"
12 android:orientation="horizontal"
13 android:paddingBottom="10dp"
14 android:paddingTop="10dp" >
15
16 <TextView
17 style="@style/nameStyle"
18 android:layout_width="0dp"
19 android:layout_height="fill_parent"
20 android:layout_gravity="left|center_vertical"
21 android:layout_weight="1"
22 android:text="@string/cur_image" />
23
24 <TextView
25 android:id="@+id/tw_target"
26 style="@style/dataStyle1"
27 android:layout_width="0dp"
28 android:layout_height="fill_parent"
29 android:layout_weight="1.5"
30 android:text="@string/no_image" />
31 </LinearLayout>
32
33 <LinearLayout
34 android:layout_width="fill_parent"
35 android:layout_height="wrap_content"
36 android:gravity="left"
37 android:orientation="horizontal"
38 android:paddingBottom="10dp"
39 android:paddingTop="10dp" >
40
41 <TextView
42 style="@style/nameStyle"
43 android:layout_width="0dp"
44 android:layout_height="fill_parent"
45 android:layout_gravity="left|center_vertical"
46 android:layout_weight="1"
47 android:text="@string/new_image" />
48
49 <TextView
50 android:id="@+id/tw_file"
51 style="@style/dataStyle1"
52 android:layout_width="0dp"
53 android:layout_height="fill_parent"
54 android:layout_weight="1.5"
55 android:gravity="left"
56 android:text="@string/no_image_sel"
57 android:textAlignment="gravity" />
58 </LinearLayout>
59
60 <LinearLayout
61 android:layout_width="fill_parent"
62 android:layout_height="wrap_content"
63 android:gravity="center"
64 android:orientation="horizontal"
65 android:paddingBottom="5dp"
66 android:paddingTop="5dp" >
67
68 <Button
69 android:id="@+id/btn_load_a"
70 style="?android:attr/buttonStyle"
71 android:layout_width="wrap_content"
72 android:layout_height="fill_parent"
73 android:layout_gravity="center"
74 android:gravity="center"
75 android:onClick="onLoad"
76 android:text="@string/load_image_a" />
77
78 <Button
79 android:id="@+id/btn_load_b"
80 style="?android:attr/buttonStyle"
81 android:layout_width="wrap_content"
82 android:layout_height="fill_parent"
83 android:layout_gravity="center"
84 android:onClick="onLoad"
85 android:text="@string/load_image_b" />
86
87 <Button
88 android:id="@+id/btn_load_c"
89 style="?android:attr/buttonStyle"
90 android:layout_width="wrap_content"
91 android:layout_height="fill_parent"
92 android:layout_gravity="center"
93 android:onClick="onLoadCustom"
94 android:text="@string/load_image_c" />
95 </LinearLayout>
96
97 <TextView
98 android:id="@+id/tw_info"
99 style="@style/dataStyle"
100 android:layout_width="fill_parent"
101 android:layout_height="wrap_content"
102 android:layout_gravity="center"
103 android:layout_marginBottom="5dp"
104 android:layout_weight="0"
105 android:gravity="center_horizontal"
106 android:text="@string/idle"
107 android:textSize="14dp" />
108
109 <ProgressBar
110 android:id="@+id/pb_progress"
111 style="@android:style/Widget.ProgressBar.Horizontal"
112 android:layout_width="match_parent"
113 android:layout_height="wrap_content"
114 android:layout_marginBottom="5dp"
115 android:indeterminate="false"
116 android:max="100"
117 android:maxHeight="15dp"
118 android:minHeight="15dp"
119 android:progress="0" />
120
121 <TextView
122 android:id="@+id/tw_log"
123 style="@style/logStyle"
124 android:layout_width="fill_parent"
125 android:layout_height="wrap_content"
126 android:layout_gravity="bottom"
127 android:layout_weight="1"
128 android:lines="10"
129 android:padding="5dp" />
130
131 <Button
132 android:id="@+id/btn_start"
133 android:layout_width="fill_parent"
134 android:layout_height="wrap_content"
135 android:layout_gravity="bottom"
136 android:layout_weight="0"
137 android:onClick="onStart"
138 android:text="@string/start_prog" />
139
140</LinearLayout> \ No newline at end of file
diff --git a/res/layout/dialog_about.xml b/res/layout/dialog_about.xml
new file mode 100644
index 0000000..36f2198
--- /dev/null
+++ b/res/layout/dialog_about.xml
@@ -0,0 +1,49 @@
1<?xml version="1.0" encoding="utf-8"?>
2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="fill_parent"
4 android:layout_height="fill_parent"
5 android:fadingEdge="horizontal|vertical"
6 android:orientation="vertical" >
7
8 <TextView
9 android:id="@+id/title"
10 android:layout_width="fill_parent"
11 android:layout_height="wrap_content"
12 android:gravity="center_horizontal"
13 android:padding="5dp"
14 android:textAlignment="center"
15 android:textColor="#c00"
16 android:textSize="24dp" />
17
18 <TextView
19 android:id="@+id/header"
20 android:layout_width="fill_parent"
21 android:layout_height="wrap_content"
22 android:gravity="center_horizontal"
23 android:padding="3dp"
24 android:textAlignment="center"
25 android:textSize="16dp" />
26
27 <WebView
28 android:id="@+id/web_content"
29 android:layout_width="fill_parent"
30 android:layout_height="wrap_content"
31 android:layout_margin="5dp" />
32
33 <TextView
34 android:id="@+id/footer"
35 android:layout_width="fill_parent"
36 android:layout_height="wrap_content"
37 android:gravity="center_horizontal"
38 android:padding="10dp"
39 android:textAlignment="center"
40 android:textSize="16dp" />
41
42 <Button
43 android:id="@+id/buttonOK"
44 android:layout_width="fill_parent"
45 android:layout_height="wrap_content"
46 android:layout_margin="0dp"
47 android:text="@android:string/ok" />
48
49</LinearLayout> \ No newline at end of file
diff --git a/res/layout/dialog_license.xml b/res/layout/dialog_license.xml
new file mode 100644
index 0000000..0cb5864
--- /dev/null
+++ b/res/layout/dialog_license.xml
@@ -0,0 +1,21 @@
1<?xml version="1.0" encoding="utf-8"?>
2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="fill_parent"
4 android:layout_height="fill_parent"
5 android:fadingEdge="horizontal|vertical"
6 android:orientation="vertical" >
7
8 <Button
9 android:id="@+id/buttonOK"
10 android:layout_width="fill_parent"
11 android:layout_height="wrap_content"
12 android:layout_margin="0dp"
13 android:text="@string/agree" />
14
15 <WebView
16 android:id="@+id/webpage_license"
17 android:layout_width="wrap_content"
18 android:layout_height="fill_parent" />
19
20
21</LinearLayout> \ No newline at end of file
diff --git a/res/layout/element_characteristic.xml b/res/layout/element_characteristic.xml
new file mode 100644
index 0000000..67b3bf4
--- /dev/null
+++ b/res/layout/element_characteristic.xml
@@ -0,0 +1,31 @@
1<?xml version="1.0" encoding="utf-8"?>
2<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 style="@style/listItemStyle"
4 android:layout_width="fill_parent"
5 android:layout_height="fill_parent" >
6
7 <TextView
8 android:id="@+id/name"
9 style="@style/nameStyle"
10 android:layout_width="fill_parent"
11 android:layout_height="wrap_content"
12 android:layout_alignParentTop="true"
13 android:gravity="left" />
14
15 <TextView
16 android:id="@+id/uuid"
17 android:layout_width="wrap_content"
18 android:layout_height="wrap_content"
19 android:layout_alignParentBottom="true"
20 android:gravity="center" />
21
22 <TextView
23 android:id="@+id/info"
24 style="@style/infoStyle"
25 android:layout_width="wrap_content"
26 android:layout_height="wrap_content"
27 android:layout_alignParentRight="true"
28 android:layout_below="@id/name"
29 android:gravity="center" />
30
31</RelativeLayout>
diff --git a/res/layout/element_device.xml b/res/layout/element_device.xml
new file mode 100644
index 0000000..8276677
--- /dev/null
+++ b/res/layout/element_device.xml
@@ -0,0 +1,42 @@
1<?xml version="1.0" encoding="utf-8"?>
2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:tools="http://schemas.android.com/tools"
4 android:layout_width="match_parent"
5 android:layout_height="match_parent"
6 android:orientation="horizontal"
7 android:paddingBottom="5dp"
8 >
9
10 <ImageView
11 android:layout_width="80dp"
12 android:layout_height="wrap_content"
13 android:id="@+id/devImage"
14 android:layout_gravity="left|center_vertical"
15 android:layout_weight="0"
16 android:contentDescription="@string/image"
17 android:focusable="false"
18 android:paddingRight="5dp"
19 android:src="@drawable/sensortag" />
20
21 <TextView
22 android:id="@+id/descr"
23 style="@style/nameStyle"
24 android:layout_width="wrap_content"
25 android:layout_height="wrap_content"
26 android:layout_gravity="left|center_vertical"
27 android:layout_weight="4"
28 android:focusable="false"
29 android:gravity="left" />
30
31 <Button
32 android:id="@+id/btnConnect"
33 android:layout_width="wrap_content"
34 android:layout_height="wrap_content"
35 android:layout_gravity="center_vertical"
36 android:layout_weight="0"
37 android:clickable="false"
38 android:focusable="false"
39 android:gravity="center"
40 android:text="@string/connect" />
41
42</LinearLayout> \ No newline at end of file
diff --git a/res/layout/element_file.xml b/res/layout/element_file.xml
new file mode 100644
index 0000000..42c0ea9
--- /dev/null
+++ b/res/layout/element_file.xml
@@ -0,0 +1,14 @@
1<?xml version="1.0" encoding="utf-8"?>
2<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 style="@style/listItemStyle"
4 android:layout_width="fill_parent"
5 android:layout_height="fill_parent" >
6
7 <TextView
8 android:id="@+id/name"
9 android:layout_width="fill_parent"
10 android:layout_height="wrap_content"
11 android:layout_alignParentTop="true"
12 android:gravity="left" />
13
14</RelativeLayout>
diff --git a/res/layout/fragment_help.xml b/res/layout/fragment_help.xml
new file mode 100644
index 0000000..854eadf
--- /dev/null
+++ b/res/layout/fragment_help.xml
@@ -0,0 +1,12 @@
1<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:tools="http://schemas.android.com/tools"
3 android:layout_width="match_parent"
4 android:layout_height="match_parent"
5 tools:context=".MainActivity$HelpFragment" >
6
7 <WebView
8 android:id="@+id/webpage"
9 android:layout_width="wrap_content"
10 android:layout_height="fill_parent" />
11
12</RelativeLayout> \ No newline at end of file
diff --git a/res/layout/fragment_pager.xml b/res/layout/fragment_pager.xml
new file mode 100644
index 0000000..7fbce40
--- /dev/null
+++ b/res/layout/fragment_pager.xml
@@ -0,0 +1,5 @@
1<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:tools="http://schemas.android.com/tools"
3 android:id="@+id/pager"
4 android:layout_width="match_parent"
5 android:layout_height="match_parent" />
diff --git a/res/layout/fragment_scan.xml b/res/layout/fragment_scan.xml
new file mode 100644
index 0000000..f3e9c3e
--- /dev/null
+++ b/res/layout/fragment_scan.xml
@@ -0,0 +1,64 @@
1<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:tools="http://schemas.android.com/tools"
3 android:layout_width="match_parent"
4 android:layout_height="match_parent"
5 android:layout_margin="10dp"
6 android:clickable="false"
7 android:gravity="bottom"
8 android:longClickable="false"
9 android:orientation="vertical"
10 android:padding="0dp"
11 tools:context=".MainActivity" >
12
13 <ListView
14 android:id="@+id/device_list"
15 style="@style/devlistStyle"
16 android:layout_width="fill_parent"
17 android:layout_height="0dp"
18 android:layout_margin="10dp"
19 android:layout_weight="2"
20 android:choiceMode="singleChoice"
21 android:padding="3dp" />
22
23 <TextView
24 android:id="@+id/no_device"
25 android:layout_width="wrap_content"
26 android:layout_height="wrap_content"
27 android:layout_gravity="center_horizontal"
28 android:layout_margin="50dp"
29 android:gravity="center"
30 android:text="@string/nodevice"
31 android:textSize="14sp" />
32
33 <ImageView
34 android:layout_width="wrap_content"
35 android:layout_height="wrap_content"
36 android:layout_gravity="center_horizontal"
37 android:layout_marginBottom="50dp"
38 android:layout_marginLeft="20dp"
39 android:layout_marginRight="20dp"
40 android:layout_marginTop="20dp"
41 android:contentDescription="@string/image"
42 android:gravity="center"
43 android:src="@drawable/ti_stk_2c_pos_rgb_png" />
44
45 <TextView
46 android:id="@+id/status"
47 android:layout_width="match_parent"
48 android:layout_height="30dp"
49 android:gravity="center"
50 android:textSize="12sp" />
51
52 <Button
53 android:id="@+id/btn_scan"
54 android:drawableLeft="@drawable/ic_action_refresh"
55 android:layout_width="match_parent"
56 android:layout_height="wrap_content"
57 android:fadingEdge="vertical"
58 android:gravity="center_horizontal|center"
59 android:linksClickable="false"
60 android:onClick="onBtnScan"
61 android:padding="10dp"
62 android:text="@string/button_scan" />
63
64</LinearLayout> \ No newline at end of file
diff --git a/res/layout/frame_progress.xml b/res/layout/frame_progress.xml
new file mode 100644
index 0000000..f4c15b2
--- /dev/null
+++ b/res/layout/frame_progress.xml
@@ -0,0 +1,9 @@
1<?xml version="1.0" encoding="utf-8"?>
2<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_height="wrap_content"
4 android:layout_width="56dp"
5 android:minWidth="56dp">
6 <ProgressBar android:layout_width="32dp"
7 android:layout_height="32dp"
8 android:layout_gravity="center"/>
9</FrameLayout> \ No newline at end of file
diff --git a/res/layout/services_browser.xml b/res/layout/services_browser.xml
new file mode 100644
index 0000000..a04f1a9
--- /dev/null
+++ b/res/layout/services_browser.xml
@@ -0,0 +1,225 @@
1<?xml version="1.0" encoding="utf-8"?>
2<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent"
4 android:layout_height="fill_parent"
5 android:orientation="vertical" >
6
7 <TableLayout
8 android:id="@+id/services_browser_layout"
9 android:layout_width="wrap_content"
10 android:layout_height="wrap_content"
11 android:shrinkColumns="*"
12 android:stretchColumns="*" >
13
14 <TableRow style="@style/ServiceHeaderRow" >
15
16 <TextView
17 style="@style/ServiceHeaderItem"
18 android:text="@string/keys" />
19 </TableRow>
20
21 <TableRow
22 android:id="@+id/keyPanel"
23 style="@style/ServiceRow" >
24
25 <TextView android:drawableLeft="@drawable/sensortag_simplekeys" />
26
27 <ImageView
28 android:id="@+id/buttons"
29 android:layout_height="wrap_content"
30 android:layout_span="2"
31 android:contentDescription="@string/image"
32 android:src="@drawable/buttonsoffoff" />
33
34 <TextView android:layout_span="1" />
35 </TableRow>
36
37 <TableRow style="@style/ServiceHeaderRow" >
38
39 <TextView
40 style="@style/ServiceHeaderItem"
41 android:text="@string/acc" />
42 </TableRow>
43
44 <TableRow
45 android:id="@+id/accPanel"
46 style="@style/ServiceRow" >
47
48 <TextView android:drawableLeft="@drawable/accelerometer" />
49
50 <TextView
51 style="@style/ServiceItem"
52 android:text="@string/xyz3" />
53
54 <TextView
55 android:id="@+id/accelerometerTxt"
56 style="@style/ServiceItemValue"
57 android:text="@string/empty3" />
58
59 <TextView
60 style="@style/ServiceItem"
61 android:text="@string/unitG3" />
62 </TableRow>
63
64 <TableRow style="@style/ServiceHeaderRow" >
65
66 <TextView
67 style="@style/ServiceHeaderItem"
68 android:text="@string/mag" />
69 </TableRow>
70
71 <TableRow
72 android:id="@+id/magPanel"
73 style="@style/ServiceRow" >
74
75 <TextView android:drawableLeft="@drawable/sensortag_magnetometer" />
76
77 <TextView
78 style="@style/ServiceItem"
79 android:text="@string/xyz3" />
80
81 <TextView
82 android:id="@+id/magnetometerTxt"
83 style="@style/ServiceItemValue"
84 android:text="@string/empty3" />
85
86 <TextView
87 style="@style/ServiceItem"
88 android:text="@string/unitT3" />
89 </TableRow>
90
91 <TableRow style="@style/ServiceHeaderRow" >
92
93 <TextView
94 style="@style/ServiceHeaderItem"
95 android:text="@string/gyro" />
96 </TableRow>
97
98 <TableRow
99 android:id="@+id/gyrPanel"
100 style="@style/ServiceRow" >
101
102 <TextView android:drawableLeft="@drawable/gyroscope" />
103
104 <TextView
105 style="@style/ServiceItem"
106 android:text="@string/xyz3" />
107
108 <TextView
109 android:id="@+id/gyroscopeTxt"
110 style="@style/ServiceItemValue"
111 android:text="@string/empty3" />
112
113 <TextView
114 style="@style/ServiceItem"
115 android:text="@string/unitDegSec3" />
116 </TableRow>
117
118 <TableRow style="@style/ServiceHeaderRow" >
119
120 <TextView
121 style="@style/ServiceHeaderItem"
122 android:text="@string/tObj" />
123 </TableRow>
124
125 <TableRow
126 android:id="@+id/objPanel"
127 style="@style/ServiceRow" >
128
129 <TextView android:drawableLeft="@drawable/irtemperature" />
130
131 <TextView style="@style/ServiceItem" />
132
133 <TextView
134 android:id="@+id/objTemperatureText"
135 style="@style/ServiceItemValue"
136 android:text="@string/empty1" />
137
138 <TextView
139 style="@style/ServiceItem"
140 android:text="@string/unitDeg" />
141 </TableRow>
142
143 <TableRow style="@style/ServiceHeaderRow" >
144
145 <TextView
146 style="@style/ServiceHeaderItem"
147 android:text="@string/tAmb" />
148 </TableRow>
149
150 <TableRow
151 android:id="@+id/ambPanel"
152 style="@style/ServiceRow" >
153
154 <TextView android:drawableLeft="@drawable/temperature" />
155
156 <TextView
157 style="@style/ServiceItem"
158 android:text="" />
159
160 <TextView
161 android:id="@+id/ambientTemperatureTxt"
162 style="@style/ServiceItemValue"
163 android:text="@string/empty1" />
164
165 <TextView
166 style="@style/ServiceItem"
167 android:text="@string/unitDeg" />
168 </TableRow>
169
170 <TableRow style="@style/ServiceHeaderRow" >
171
172 <TextView
173 style="@style/ServiceHeaderItem"
174 android:text="@string/hum" />
175 </TableRow>
176
177 <TableRow
178 android:id="@+id/humPanel"
179 style="@style/ServiceRow" >
180
181 <TextView android:drawableLeft="@drawable/humidity" />
182
183 <TextView
184 style="@style/ServiceItem"
185 android:text="" />
186
187 <TextView
188 android:id="@+id/humidityTxt"
189 style="@style/ServiceItemValue"
190 android:text="@string/empty1" />
191
192 <TextView
193 style="@style/ServiceItem"
194 android:text="@string/unitRH" />
195 </TableRow>
196
197 <TableRow style="@style/ServiceHeaderRow" >
198
199 <TextView
200 style="@style/ServiceHeaderItem"
201 android:text="@string/bar" />
202 </TableRow>
203
204 <TableRow
205 android:id="@+id/barPanel"
206 style="@style/ServiceRow" >
207
208 <TextView android:drawableLeft="@drawable/barometer" />
209
210 <TextView
211 style="@style/ServiceItem"
212 android:text="" />
213
214 <TextView
215 android:id="@+id/barometerTxt"
216 style="@style/ServiceItemValue"
217 android:text="@string/empty1" />
218
219 <TextView
220 style="@style/ServiceItem"
221 android:text="@string/unitPA_Meter" />
222 </TableRow>
223
224 </TableLayout>
225</ScrollView> \ No newline at end of file
diff --git a/res/layout/services_browser2.xml b/res/layout/services_browser2.xml
new file mode 100644
index 0000000..2e5a23d
--- /dev/null
+++ b/res/layout/services_browser2.xml
@@ -0,0 +1,230 @@
1<?xml version="1.0" encoding="utf-8"?>
2<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent"
4 android:layout_height="fill_parent"
5 android:orientation="vertical" >
6
7 <TableLayout
8 android:id="@+id/services_browser_layout2"
9 android:layout_width="wrap_content"
10 android:layout_height="wrap_content"
11 android:shrinkColumns="*"
12 android:stretchColumns="*" >
13
14 <TableRow style="@style/ServiceHeaderRow" >
15
16 <TextView
17 style="@style/ServiceHeaderItem"
18 android:text="@string/keys" />
19 </TableRow>
20
21 <TableRow
22 android:id="@+id/keyPanel"
23 style="@style/ServiceRow" >
24
25 <!-- TextView android:drawableLeft="@drawable/sensortag_simplekeys" /> -->
26
27 <ImageView
28 android:id="@+id/buttons"
29 android:layout_span="2"
30 android:layout_height="wrap_content"
31 android:contentDescription="@string/image"
32 android:src="@drawable/buttonsoffoff" />
33
34 <ImageView
35 android:id="@+id/relay"
36 android:layout_span="2"
37 android:layout_height="wrap_content"
38 android:contentDescription="@string/image"
39 android:src="@drawable/reed_closed" />
40 </TableRow>
41
42 <TableRow style="@style/ServiceHeaderRow" >
43
44 <TextView
45 style="@style/ServiceHeaderItem"
46 android:text="@string/acc" />
47 </TableRow>
48
49 <TableRow
50 android:id="@+id/accPanel"
51 style="@style/ServiceRow" >
52
53 <TextView android:drawableLeft="@drawable/accelerometer" />
54
55 <TextView
56 style="@style/ServiceItem"
57 android:text="@string/xyz3" />
58
59 <TextView
60 android:id="@+id/accelerometerTxt"
61 style="@style/ServiceItemValue"
62 android:text="@string/empty3" />
63
64 <TextView
65 style="@style/ServiceItem"
66 android:text="@string/unitG3" />
67 </TableRow>
68
69 <TableRow style="@style/ServiceHeaderRow" >
70
71 <TextView
72 style="@style/ServiceHeaderItem"
73 android:text="@string/lux" />
74 </TableRow>
75
76 <TableRow
77 android:id="@+id/luxPanel"
78 style="@style/ServiceRow" >
79
80 <TextView android:drawableLeft="@drawable/lightsensor" />
81
82 <TextView
83 style="@style/ServiceItem"
84 android:text="" />
85
86 <TextView
87 android:id="@+id/luxometerTxt"
88 style="@style/ServiceItemValue"
89 android:text="@string/empty1" />
90
91 <TextView
92 style="@style/ServiceItem"
93 android:text="@string/unitLux" />
94 </TableRow>
95
96 <TableRow style="@style/ServiceHeaderRow" >
97 <TextView
98 style="@style/ServiceHeaderItem"
99 android:text="@string/gyro" />
100 </TableRow>
101
102 <TableRow
103 android:id="@+id/gyrPanel"
104 style="@style/ServiceRow" >
105
106 <TextView android:drawableLeft="@drawable/gyroscope" />
107
108 <TextView
109 style="@style/ServiceItem"
110 android:text="@string/xyz3" />
111
112 <TextView
113 android:id="@+id/gyroscopeTxt"
114 style="@style/ServiceItemValue"
115 android:text="@string/empty3" />
116
117 <TextView
118 style="@style/ServiceItem"
119 android:text="@string/unitDegSec3" />
120 </TableRow>
121
122 <TableRow style="@style/ServiceHeaderRow" >
123
124 <TextView
125 style="@style/ServiceHeaderItem"
126 android:text="@string/tObj" />
127 </TableRow>
128
129 <TableRow
130 android:id="@+id/objPanel"
131 style="@style/ServiceRow" >
132
133 <TextView android:drawableLeft="@drawable/irtemperature" />
134
135 <TextView style="@style/ServiceItem" />
136
137 <TextView
138 android:id="@+id/objTemperatureText"
139 style="@style/ServiceItemValue"
140 android:text="@string/empty1" />
141
142 <TextView
143 style="@style/ServiceItem"
144 android:text="@string/unitDeg" />
145 </TableRow>
146
147 <TableRow style="@style/ServiceHeaderRow" >
148
149 <TextView
150 style="@style/ServiceHeaderItem"
151 android:text="@string/tAmb" />
152 </TableRow>
153
154 <TableRow
155 android:id="@+id/ambPanel"
156 style="@style/ServiceRow" >
157
158 <TextView android:drawableLeft="@drawable/temperature" />
159
160 <TextView
161 style="@style/ServiceItem"
162 android:text="" />
163
164 <TextView
165 android:id="@+id/ambientTemperatureTxt"
166 style="@style/ServiceItemValue"
167 android:text="@string/empty1" />
168
169 <TextView
170 style="@style/ServiceItem"
171 android:text="@string/unitDeg" />
172 </TableRow>
173
174 <TableRow style="@style/ServiceHeaderRow" >
175
176 <TextView
177 style="@style/ServiceHeaderItem"
178 android:text="@string/hum" />
179 </TableRow>
180
181 <TableRow
182 android:id="@+id/humPanel"
183 style="@style/ServiceRow" >
184
185 <TextView android:drawableLeft="@drawable/humidity" />
186
187 <TextView
188 style="@style/ServiceItem"
189 android:text="" />
190
191 <TextView
192 android:id="@+id/humidityTxt"
193 style="@style/ServiceItemValue"
194 android:text="@string/empty1" />
195
196 <TextView
197 style="@style/ServiceItem"
198 android:text="@string/unitRH" />
199 </TableRow>
200
201 <TableRow style="@style/ServiceHeaderRow" >
202
203 <TextView
204 style="@style/ServiceHeaderItem"
205 android:text="@string/bar" />
206 </TableRow>
207
208 <TableRow
209 android:id="@+id/barPanel"
210 style="@style/ServiceRow" >
211
212 <TextView android:drawableLeft="@drawable/barometer" />
213
214 <TextView
215 style="@style/ServiceItem"
216 android:text="" />
217
218 <TextView
219 android:id="@+id/barometerTxt"
220 style="@style/ServiceItemValue"
221 android:text="@string/empty1" />
222
223 <TextView
224 style="@style/ServiceItem"
225 android:text="@string/unitPA_Meter" />
226 </TableRow>
227
228 </TableLayout>
229
230</ScrollView> \ No newline at end of file
diff --git a/res/menu/device_activity_actions.xml b/res/menu/device_activity_actions.xml
new file mode 100644
index 0000000..3dccce6
--- /dev/null
+++ b/res/menu/device_activity_actions.xml
@@ -0,0 +1,23 @@
1<menu xmlns:android="http://schemas.android.com/apk/res/android" >
2
3 <item
4 android:id="@+id/opt_progress"
5 android:showAsAction="always"
6 android:title="@string/progress"
7 android:visibility="invisible"
8 />
9 <item
10 android:id="@+id/opt_prefs"
11 android:orderInCategory="1"
12 android:showAsAction="ifRoom"
13 android:icon="@drawable/ic_action_settings"
14 android:title="@string/prefs"/>
15 <item
16 android:id="@+id/opt_fwupdate"
17 android:title="@string/fwupdate"/>
18 <item
19 android:id="@+id/opt_about"
20 android:icon="@drawable/ic_action_about"
21 android:title="@string/about"/>
22
23</menu> \ No newline at end of file
diff --git a/res/menu/main_activity_actions.xml b/res/menu/main_activity_actions.xml
new file mode 100644
index 0000000..0eefb1e
--- /dev/null
+++ b/res/menu/main_activity_actions.xml
@@ -0,0 +1,34 @@
1<menu xmlns:android="http://schemas.android.com/apk/res/android" >
2
3 <item
4 android:id="@+id/opt_progress"
5 android:showAsAction="always"
6 android:title="@string/progress"
7 android:visibility="invisible"
8 />
9 <item
10 android:id="@+id/opt_bt"
11 android:showAsAction="ifRoom"
12 android:orderInCategory="1"
13 android:icon="@drawable/ic_action_bluetooth"
14 android:title="@string/bt"
15 />
16 <item
17 android:id="@+id/opt_e2e"
18 android:title="@string/tie2e"/>
19 <item
20 android:id="@+id/opt_sthome"
21 android:title="@string/sthome"/>
22 <item
23 android:id="@+id/opt_license"
24 android:title="@string/license"/>
25 <item
26 android:id="@+id/opt_about"
27 android:icon="@drawable/ic_action_about"
28 android:title="@string/about"/>
29 <item
30 android:id="@+id/opt_exit"
31 android:title="@string/exit"/>
32
33
34</menu>
diff --git a/res/values/strings.xml b/res/values/strings.xml
new file mode 100644
index 0000000..2d98ea3
--- /dev/null
+++ b/res/values/strings.xml
@@ -0,0 +1,79 @@
1<?xml version="1.0" encoding="utf-8"?>
2<resources>
3
4 <!-- Main activity -->
5 <string name="app_name">BLE SensorTag</string>
6 <string name="button_scan">Scan</string>
7 <string name="connect">Connect</string>
8 <string name="title_device_list">Device List</string>
9 <string name="device">Device</string>
10 <string name="header">Available BLE Devices</string>
11 <string name="disconnected">Device is not connected</string>
12 <string name="control">Done</string>
13 <string name="bt_not_supported">Bluetooth is not supported</string>
14 <string name="ble_not_supported">BLE is not supported</string>
15 <string name="bt_on">Bluetooth was turned on</string>
16 <string name="bt_not_on">Bluetooth was not turned on</string>
17 <string name="app_closing">Exiting BLE SensorTag app</string>
18 <string-array name="device_filter"><item>SensorTag</item><item>SensorTag2</item></string-array>
19 <string name="nodevice">There are no SensorTags advertising within range. Please push the side button on the SensorTag to start advertising.</string>
20 <string name="scan_advice">The Android device is not scanning. Please tap \'Scan\' to scan for SensorTags.</string>
21 <string name="bt_adapter_disable">Disable Bluetooth adapter</string>
22 <string name="bt_adapter_reset">Reset Bluetooth adapter</string>
23
24 <!-- Options menu -->
25 <string name="prefs">Preferences</string>
26 <string name="progress"></string>
27 <string name="agree">I agree</string>
28 <string name="fwupdate">Firmware update</string>
29 <string name="bt">Bluetooth Adapter</string>
30 <string name="sthome">SensorTag Home</string>
31 <string name="tie2e">TI E2E Community</string>
32 <string name="license">License</string>
33 <string name="about">About</string>
34 <string name="exit">Exit</string>
35
36 <!-- Device activity -->
37 <string name="dev_addr">Device address</string>
38 <string name="image">Image</string>
39
40 <!-- Sensor names-->
41 <string name="keys">Keys</string>
42 <string name="acc">Accelerometer</string>
43 <string name="mag">Magnetometer</string>
44 <string name="lux">Luxometer</string>
45 <string name="gyro">Gyroscope</string>
46 <string name="hum">Humidity</string>
47 <string name="bar">Barometer</string>
48 <string name="tAmb">Ambience Temperature</string>
49 <string name="tObj">Object Temperature</string>
50
51 <!-- Sensor misc. -->
52 <string name="xyz3">x:\ny:\nz:\n</string>
53 <string name="empty3">*\n*\n*\n</string>
54 <string name="unitDegSec3">deg/s\ndeg/s\ndeg/s\n</string>
55 <string name="unitG3">g\ng\ng\n</string>
56 <string name="unitT3">uT\nuT\nuT\n</string>
57
58 <string name="empty1">*\n</string>
59 <string name="unitDeg">deg/C\n</string>
60 <string name="unitRH">%rH\n</string>
61 <string name="unitPA_Meter">nPA\nmeter</string>
62 <string name="unitLux">Lux\n</string>
63
64 <!-- FWUpdate activity -->
65 <string name="title_oad">Firmware Update (OAD)</string>
66 <string name="start_prog">Start Programming</string>
67 <string name="cancel">Cancel</string>
68 <string name="prog_ogoing">NB! Not permitted to close this view during OAD transfer</string>
69 <string name="load_image_a">Image A</string>
70 <string name="load_image_b">Image B</string>
71 <string name="load_image_c">Custom</string>
72 <string name="no_image">Not an OAD image</string>
73 <string name="no_image_sel">No image selected</string>
74 <string name="new_image">New image:</string>
75 <string name="cur_image">Current image:</string>
76 <string name="idle">idle</string>
77 <string name="btn_txt_confirm">Confirm</string>
78
79</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
new file mode 100644
index 0000000..13d72dc
--- /dev/null
+++ b/res/values/styles.xml
@@ -0,0 +1,167 @@
1<?xml version="1.0" encoding="utf-8"?>
2<resources>
3
4 <!--
5 Base application theme, dependent on API level. This theme is replaced
6 by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
7 -->
8 <style name="AppBaseTheme" parent="android:Theme.Light">
9 <!--
10 Theme customizations available in newer API levels can go in
11 res/values-vXX/styles.xml, while customizations related to
12 backward-compatibility can go here.
13 -->
14 </style>
15
16 <!-- Application theme. -->
17 <style name="AppTheme" parent="AppBaseTheme">
18 <!-- All customizations that are NOT specific to a particular API-level can go here. -->
19 </style>
20
21 <style name="aboutStyle">
22 <item name="android:background">@android:color/black</item>
23 <item name="android:textColor">#ff0</item>
24 <item name="android:textSize">14dp</item>
25 </style>
26
27 <style name="logStyle">
28 <item name="android:background">#dde</item>
29 <item name="android:textColor">@android:color/black</item>
30 <item name="android:textSize">18dp</item>
31 </style>
32
33 <style name="tabwidgetStyle">
34 <item name="android:background">#336</item>
35 </style>
36
37 <style name="devlistStyle">
38 <item name="android:dividerHeight">5dp</item>
39 </style>
40
41 <style name="listItemStyle">
42 <item name="android:background">#abc</item>
43 <item name="android:padding">18dp</item>
44 </style>
45
46 <style name="nameStyle">
47 <item name="android:textColor">#000</item>
48 <item name="android:textSize">18dp</item>
49 </style>
50
51 <style name="nameStyle.inactive">
52 <item name="android:textColor">#ccc</item>
53 </style>
54
55 <style name="nameStyleSelected">
56 <item name="android:textColor">#c33</item>
57 </style>
58
59 <style name="dirStyle">
60 <item name="android:textColor">#003</item>
61 <item name="android:textSize">20dp</item>
62 <item name="android:layout_margin">10dp</item>
63 <item name="android:gravity">center_horizontal</item>
64 </style>
65
66 <style name="dataStyle">
67 <item name="android:background">#fff</item>
68 <item name="android:textSize">16dp</item>
69 <item name="android:textColor">#030</item>
70 <item name="android:textColorHint">#fff</item>
71 <item name="android:layout_height">40dp</item>
72 <item name="android:padding">8dp</item>
73 </style>
74
75 <style name="dataStyle1">
76 <item name="android:textColor">#060</item>
77 <item name="android:textSize">16dp</item>
78 </style>
79
80 <style name="dataStyle2">
81 <item name="android:textColor">#f33</item>
82 <item name="android:textSize">16dp</item>
83 </style>
84
85 <style name="infoStyle">
86 <item name="android:textColor">#3f3</item>
87 <item name="android:textSize">14dp</item>
88 </style>
89
90 <style name="statusStyle">
91 <item name="android:layout_width">match_parent</item>
92 <item name="android:layout_height">wrap_content</item>
93 <item name="android:layout_marginTop">5dp</item>
94 <item name="android:layout_marginBottom">5dp</item>
95 <item name="android:gravity">right</item>
96 <item name="android:textSize">18dp</item>
97 <item name="android:background">#ccc</item>
98 </style>
99
100 <style name="statusStyleSmall">
101 <item name="android:layout_width">match_parent</item>
102 <item name="android:layout_height">wrap_content</item>
103 <item name="android:layout_marginBottom">10dp</item>
104 <item name="android:textSize">14dp</item>
105 </style>
106
107 <style name="statusStyle.Success" parent="statusStyle">
108 <item name="android:textColor">#336633</item>
109 </style>
110
111 <style name="statusStyle.Busy" parent="statusStyle">
112 <item name="android:textColor">#EEEEEE</item>
113 </style>
114
115 <style name="statusStyle.Failure" parent="statusStyle">
116 <item name="android:textColor">#FF0000</item>
117 </style>
118
119 <style name="statusStyle.Disabled" parent="statusStyle">
120 <item name="android:textColor">#999999</item>
121 <item name="android:gravity">right</item>
122 </style>
123
124 <style name="tbStartStyle">
125 <item name="android:textSize">16dp</item>
126 </style>
127
128
129 <style name="ServiceHeaderRow">
130 <item name="android:layout_width">match_parent</item>
131 <item name="android:layout_height">wrap_content</item>
132 <item name="android:gravity">center</item>
133 <item name="android:typeface">serif</item>
134 </style>
135
136 <style name="ServiceHeaderItem">
137 <item name="android:layout_span">4</item>
138 <item name="android:textSize">20dp</item>
139 <item name="android:textStyle">bold</item>
140 <item name="android:gravity">center</item>
141 </style>
142
143 <style name="ServiceRow">
144 <item name="android:layout_width">match_parent</item>
145 <item name="android:layout_height">wrap_content</item>
146 <item name="android:background">#def</item>
147 <item name="android:gravity">center</item>
148 </style>
149
150 <style name="ServiceItem">
151 <item name="android:layout_width">match_parent</item>
152 <item name="android:layout_height">wrap_content</item>
153 <item name="android:typeface">monospace</item>
154 <item name="android:layout_marginTop">10dp</item>
155 <item name="android:textSize">18dp</item>
156 </style>
157
158 <style name="ServiceItemValue">
159 <item name="android:layout_width">match_parent</item>
160 <item name="android:layout_height">wrap_content</item>
161 <item name="android:typeface">monospace</item>
162 <item name="android:gravity">right</item>
163 <item name="android:layout_marginTop">10dp</item>
164 <item name="android:layout_marginRight">30dp</item>
165 <item name="android:textSize">18dp</item>
166 </style>
167</resources>
diff --git a/res/xml/gatt_uuid.xml b/res/xml/gatt_uuid.xml
new file mode 100644
index 0000000..fb3d7dc
--- /dev/null
+++ b/res/xml/gatt_uuid.xml
@@ -0,0 +1,96 @@
1<?xml version="1.0" encoding="utf-8"?>
2<gattuuid>
3 <profile>
4 <name>Gatt</name>
5 <group>Descriptors<item uuid="0x2900">Characteristic Extended Properties</item><item uuid="0x2901">Characteristic User Description</item><item uuid="0x2902" descr="Write &quot;01:00&quot; to enable notifications, &quot;00:00&quot; to disable">Client Characteristic Configuration</item><item uuid="0x2903">Server Characteristic Configuration</item><item uuid="0x2904">Characteristic Presentation Format</item><item uuid="0x2905">Characteristic Aggregate Format</item><item uuid="0x2906">Valid Range</item><item uuid="0x2907">External Report Reference</item><item uuid="0x2908">Report Reference</item></group>
6 <group>Characteristics<item uuid="0x2A00">Device Name</item><item uuid="0x2A01">Appearance</item><item uuid="0x2A02">Peripheral Privacy Flag</item><item uuid="0x2A03">Reconnection Address</item><item uuid="0x2A04">Peripheral Preferred Connection Parameters</item><item uuid="0x2A05">Service Changed</item><item uuid="0x2A06">Alert Level</item><item uuid="0x2A07">Tx Power Level</item><item uuid="0x2A08">Date Time</item><item uuid="0x2A09">Day of Week</item><item uuid="0x2A0A">Day Date Time</item><item uuid="0x2A0C">Exact Time 256</item><item uuid="0x2A0D">DST Offset</item><item uuid="0x2A0E">Time Zone</item><item uuid="0x2A0F">Local Time Information</item><item uuid="0x2A11">Time with DST</item><item uuid="0x2A12">Time Accuracy</item><item uuid="0x2A13">Time Source</item><item uuid="0x2A14">Reference Time Information</item><item uuid="0x2A16">Time Update Control Point</item><item uuid="0x2A17">Time Update State</item><item uuid="0x2A18">Glucose Measurement</item><item uuid="0x2A19">Battery Level</item><item uuid="0x2A1C">Temperature Measurement</item><item uuid="0x2A1D">Temperature Type</item><item uuid="0x2A1E">Intermediate Temperature</item><item uuid="0x2A21">Measurement Interval</item><item uuid="0x2A22">Boot Keyboard Input Report</item><item uuid="0x2A23">System ID</item><item uuid="0x2A24">Model Number String</item><item uuid="0x2A25">Serial Number String</item><item uuid="0x2A26">Firmware Revision String</item><item uuid="0x2A27">Hardware Revision String</item><item uuid="0x2A28">Software Revision String</item><item uuid="0x2A29">Manufacturer Name String</item><item uuid="0x2A2A">IEEE 11073-20601 Regulatory Certification Data List</item><item uuid="0x2A2B">Current Time</item><item uuid="0x2A31">Scan Refresh</item><item uuid="0x2A32">Boot Keyboard Output Report</item><item uuid="0x2A33">Boot Mouse Input Report</item><item uuid="0x2A34">Glucose Measurement Context</item><item uuid="0x2A35">Blood Pressure Measurement</item><item uuid="0x2A36">Intermediate Cuff Pressure</item><item uuid="0x2A37">Heart Rate Measurement</item><item uuid="0x2A38">Body Sensor Location</item><item uuid="0x2A39">Heart Rate Control Point</item><item uuid="0x2A3F">Alert Status</item><item uuid="0x2A40">Ringer Control Point</item><item uuid="0x2A41">Ringer Setting</item><item uuid="0x2A42">Alert Category ID Bit Mask</item><item uuid="0x2A43">Alert Category ID</item><item uuid="0x2A44">Alert Notification Control Point</item><item uuid="0x2A45">Unread Alert Status</item><item uuid="0x2A46">New Alert</item><item uuid="0x2A47">Supported New Alert Category</item><item uuid="0x2A48">Supported Unread Alert Category</item><item uuid="0x2A49">Blood Pressure Feature</item><item uuid="0x2A4A">HID Information</item><item uuid="0x2A4B">Report Map</item><item uuid="0x2A4C">HID Control Point</item><item uuid="0x2A4D">Report</item><item uuid="0x2A4E">Protocol Mode</item><item uuid="0x2A4F">Scan Interval Window</item><item uuid="0x2A50">PnP ID</item><item uuid="0x2A51">Glucose Feature</item><item uuid="0x2A52">Record Access Control Point</item></group>
7 <group>Services<item uuid="0x1800">Generic Access Service</item><item uuid="0x1801">Generic Attribute Service</item><item uuid="0x1802">Immediate Alert Service</item><item uuid="0x1803">Link Loss Service</item><item uuid="0x1804">Tx Power Service</item><item uuid="0x1805">Current Time Service</item><item uuid="0x1806">Reference Time Update Service</item><item uuid="0x1807">Next DST Change Service</item><item uuid="0x1808">Glucose Service</item><item uuid="0x1809">Health Thermometer Service</item><item uuid="0x180A">Device Information Service</item><item uuid="0x180D">Heart Rate Service</item><item uuid="0x180E">Phone Alert Status Service</item><item uuid="0x180F">Battery Service</item><item uuid="0x1810">Blood Pressure Service</item><item uuid="0x1811">Alert Notification Service</item><item uuid="0x1812">Human Interface Device Service</item><item uuid="0x1813">Scan Parameters Service</item></group>
8 <group>Declarations<item uuid="0x2800">GATT Primary Service Declaration</item><item uuid="0x2801">GATT Secondary Service Declaration</item><item uuid="0x2802">GATT Include Declaration</item><item uuid="0x2803">GATT Characteristic Declaration</item></group>
9 </profile>
10 <profile>
11 <name>Sensor Tag</name>
12 <item uuid="0xAA00">IR Temperature Service</item>
13 <item uuid="0xAA01" descr="ObjectLSB:ObjectMSB:AmbientLSB:AmbientMSB">IR Temperature Data</item>
14 <item uuid="0xAA02" descr="Write &quot;01&quot; to start Sensor and Measurements, &quot;00&quot; to put to sleep">IR Temperature Config</item>
15 <item uuid="0xAA03" descr="Period = [Input*10] ms, (lower limit 300 ms), default 1000 ms">IR Temperature Period</item>
16 <item uuid="0xAA10">Accelerometer Service</item>
17 <item uuid="0xAA11" descr="X : Y : Z Coordinates">Accelerometer Data</item>
18 <item uuid="0xAA12" descr="Write &quot;01&quot; to select range 2G, &quot;02&quot; for 4G, &quot;03&quot; for 8G, &quot;00&quot; disable sensor">Accelerometer Config</item>
19 <item uuid="0xAA13" descr="Period = [Input*10] ms, (lower limit 100ms), default 1000 ms">Accelerometer Period</item>
20 <item uuid="0xAA20">Humidity Service</item>
21 <item uuid="0xAA21" descr="TempLSB:TempMSB:HumidityLSB:HumidityMSB">Humidity Data</item>
22 <item uuid="0xAA22" descr="Write &quot;01&quot; to start measurements, &quot;00&quot; to stop">Humidity Config</item>
23 <item uuid="0xAA23" descr="Period = [Input*10] ms, (lower limit 100 ms), default 1000 ms">Humidity Period</item>
24 <item uuid="0xAA30">Magnetometer Service</item>
25 <item uuid="0xAA31" descr="XLSB:XMSB:YLSB:YMSB: ZLSB:ZMSB Coordinates">Magnetometer Data</item>
26 <item uuid="0xAA32" descr="Write &quot;01&quot; to start Sensor and Measurements, &quot;00&quot; to put to sleep">Magnetometer Config</item>
27 <item uuid="0xAA33" descr="Period = [Input*10]ms (lower limit 100ms), default 2000ms">Magnetometer Period</item>
28 <item uuid="0xAA40">Barometer Service</item>
29 <item uuid="0xAA41" descr="TempLSB:TempMSB:PressureLSB:PressureMSB">Barometer Data</item>
30 <item uuid="0xAA42" descr="Write &quot;01&quot; to start Sensor and Measurements, &quot;00&quot; to put to sleep, &quot;02&quot; to read calibration values from sensor">Barometer Configuration</item>
31 <item descr="When write &quot;02&quot; to Barometer conf. has been issued, the calibration values is found here." uuid="0xAA43">Barometer Calibration</item>
32 <item uuid="0xAA44" descr="Period = [Input*10] ms, (lower limit 100 ms), default 1000 ms">Barometer Period</item>
33 <item uuid="0xAA50">Gyroscope Service</item>
34 <item uuid="0xAA51" descr="XLSB:XMSB:YLSB:YMSB: ZLSB:ZMSB">Gyroscope Data</item>
35 <item uuid="0xAA52" descr="Write 0 to turn off gyroscope, 1 to enable X axis only, 2 to enable Y axis only, 3 = X and Y, 4 = Z only, 5 = X and Z, 6 = Y and Z, 7 = X, Y and Z">Gyroscope Config</item>
36 <item uuid="0xAA53" descr="Period = [Input*10]ms (lower limit 100ms), default 2000ms">Gyroscope Period</item>
37 <item uuid="0xAA60">Test Service</item>
38 <item uuid="0xAA61" descr="Self-test results (high bit indicates PASSED): Bit 0:IR temp, 1:Humidity, 2:Magnetometer, 3:accelerometer, 4:Barometer, 5:Gyroscope">Test Data</item>
39 <item uuid="0xAA62" descr="bit 7: enable test mode; bit 0-1 LED bit mask">Test Config</item>
40 <item uuid="0xCCC0">Connection Control Service</item>
41 <item uuid="0xCCC1" descr="ConnInterval,SlaveLatency,SupervisionTimeout (2 bytes each)">Connection Parameters</item>
42 <item uuid="0xCCC2" descr="MinConnInterval,MaxConnInterval,SlaveLatency,SupervisionTimeout (2 bytes each)">Request Connection Parameters</item>
43 <item uuid="0xCCC3" descr="Change the value to disconnect">Disconnect request</item>
44 </profile>
45 <profile>
46 <name>Poly Tag</name>
47 <item uuid="0xAD10">Accelerometer Service</item>
48 <item uuid="0xAD11" descr="X : Y : Z Coordinates">Accelerometer Data</item>
49 <item uuid="0xAD12" descr="Write &quot;01&quot; to start Sensor and Measurements, &quot;00&quot; to put to sleep">Accelerometer Config</item>
50 <item uuid="0xAD13" descr="Period = [Input*10] ms, (lower limit 100ms), default 1000 ms">Accelerometer Period</item>
51 <item uuid="0xAD20">Polypower Service</item>
52 <item uuid="0xAD21">Polypower Data</item>
53 <item uuid="0xAD22" descr="Set bit 0 to enable input 0 etc. Write 0 to disable all inputs, 1F to enable all.">Polypower Config</item>
54 <item uuid="0xAD23" descr="Period = [Input*10] ms (range 100-1000 ms, default 250 ms)">Polypower Period</item>
55 <item uuid="0xAD24" descr="Threshold (raw unsigned 16-bit hex). Samples below this value are ignored.">Polypower Threshold</item>
56 <item uuid="0xAD30">Test Service</item>
57 <item uuid="0xAD31" descr="Self-test results (high bit indicates PASSED) 0:Accelerometer, 1:Polypower">Test Data</item>
58 <item uuid="0xAD32" descr="bit 7: enable test mode; bit 0 controls LED">Test Config</item>
59 </profile>
60 <profile>
61 <name>Accelerometer</name>
62 <item uuid="0xFFA0">Accelerometer Service</item>
63 <item uuid="0xFFA1" descr="Write &quot;01&quot; to enable, &quot;00&quot; to disable">Accererometer enable</item>
64 <item uuid="0xFFA2" descr="Range: 20=2G, 80=8G">Accelerometer range</item>
65 <item uuid="0xFFA3">Accelerometer X-coordinate</item>
66 <item uuid="0xFFA4">Accelerometer Y-coordinate</item>
67 <item uuid="0xFFA5">Accelerometer Z-coordinate</item>
68 </profile>
69 <profile>
70 <name>Simple Keys</name>
71 <item uuid="0xFFE0">Simple Keys Service</item>
72 <item uuid="0xFFE1">Key press state</item>
73 </profile>
74 <profile>
75 <name>Racing Car</name>
76 <item uuid="0xACC0">Racing Car Service</item>
77 <item uuid="0xACC1" descr="Range: 0xCE .. 0x32">Throttle</item>
78 <item uuid="0xACC2" descr="Range: 0xCE .. 0x32">Steering</item>
79 <item uuid="0xACC3" descr="Not implemented">Lights/Horn</item>
80 </profile>
81 <profile>
82 <name>OAD</name>
83 <item uuid="0xFFC0">OAD Service</item>
84 <item uuid="0xFFC1">OAD Image Identify</item>
85 <item uuid="0xFFC2">OAD Image Block</item>
86 </profile>
87 <profile>
88 <name>Simple BLE Peripheral</name>
89 <item uuid="0xFFF0">Simple Profile Service</item>
90 <item uuid="0xFFF1">Simple Profile Characteristic 1</item>
91 <item uuid="0xFFF2">Simple Profile Characteristic 2</item>
92 <item uuid="0xFFF3">Simple Profile Characteristic 3</item>
93 <item uuid="0xFFF4">Simple Profile Characteristic 4</item>
94 <item uuid="0xFFF5">Simple Profile Characteristic 5</item>
95 </profile>
96</gattuuid> \ No newline at end of file
diff --git a/res/xml/list_gradient.xml b/res/xml/list_gradient.xml
new file mode 100644
index 0000000..2e02bf0
--- /dev/null
+++ b/res/xml/list_gradient.xml
@@ -0,0 +1,6 @@
1<?xml version="1.0" encoding="utf-8"?>
2<selector xmlns:android="http://schemas.android.com/apk/res/android">
3
4 <item android:drawable="@drawable/list_item_normal" />
5
6</selector> \ No newline at end of file
diff --git a/res/xml/popup.xml b/res/xml/popup.xml
new file mode 100644
index 0000000..adba2dd
--- /dev/null
+++ b/res/xml/popup.xml
@@ -0,0 +1,5 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
3 android:keyWidth="10%p"
4 android:keyHeight="10%p">
5</Keyboard> \ No newline at end of file
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
new file mode 100644
index 0000000..b059584
--- /dev/null
+++ b/res/xml/preferences.xml
@@ -0,0 +1,55 @@
1<?xml version="1.0" encoding="utf-8"?>
2<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:example="http://schemas.android.com/apk/res/com.ti.sensortag" >
4
5 <PreferenceCategory android:title="Sensors online" >
6
7 <!--
8 Checkboxes have keys that match (with a simple transformation) the enum names in Sensor.java for easy
9 decoding/encoding between java code and xml.
10 -->
11 <CheckBoxPreference
12 android:key="pref_simple_keys_on"
13 android:summary="Turn the Simple keys service on or off."
14 android:defaultValue="true"
15 android:persistent="true"
16 android:title="Buttons" />
17 <CheckBoxPreference
18 android:key="pref_accelerometer_on"
19 android:summary="Turn the Accelerometer service on or off."
20 android:defaultValue="true"
21 android:persistent="true"
22 android:title="Accelerometer" />
23 <CheckBoxPreference
24 android:key="pref_magnetometer_on"
25 android:summary="Turn the Magnetometer service on or off."
26 android:defaultValue="true"
27 android:persistent="true"
28 android:title="Magnetometer" />
29 <CheckBoxPreference
30 android:key="pref_gyroscope_on"
31 android:summary="Turn the Gyroscope service on or off."
32 android:defaultValue="false"
33 android:persistent="true"
34 android:title="Gyroscope" />
35 <CheckBoxPreference
36 android:key="pref_ir_temperature_on"
37 android:summary="Turn the IR and Ambient Temperature service on or off."
38 android:defaultValue="false"
39 android:persistent="true"
40 android:title="IR and Ambient Temperature" />
41 <CheckBoxPreference
42 android:key="pref_humidity_on"
43 android:summary="Turn the Humidity service on or off."
44 android:defaultValue="false"
45 android:persistent="true"
46 android:title="Humidity" />
47 <CheckBoxPreference
48 android:key="pref_barometer_on"
49 android:summary="Turn the Barometer service on or off."
50 android:defaultValue="false"
51 android:persistent="true"
52 android:title="Barometer" />
53 </PreferenceCategory>
54
55</PreferenceScreen>
diff --git a/res/xml/preferences2.xml b/res/xml/preferences2.xml
new file mode 100644
index 0000000..9400812
--- /dev/null
+++ b/res/xml/preferences2.xml
@@ -0,0 +1,55 @@
1<?xml version="1.0" encoding="utf-8"?>
2<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:example="http://schemas.android.com/apk/res/com.ti.sensortag" >
4
5 <PreferenceCategory android:title="Sensors online" >
6
7 <!--
8 Checkboxes have keys that match (with a simple transformation) the enum names in Sensor.java for easy
9 decoding/encoding between java code and xml.
10 -->
11 <CheckBoxPreference
12 android:key="pref_simple_keys_on"
13 android:summary="Turn the Simple keys service on or off."
14 android:defaultValue="true"
15 android:persistent="true"
16 android:title="Buttons" />
17 <CheckBoxPreference
18 android:key="pref_accelerometer_on"
19 android:summary="Turn the Accelerometer service on or off."
20 android:defaultValue="true"
21 android:persistent="true"
22 android:title="Accelerometer" />
23 <CheckBoxPreference
24 android:key="pref_luxometer_on"
25 android:summary="Turn the Luxometer service on or off."
26 android:defaultValue="true"
27 android:persistent="true"
28 android:title="Luxometer" />
29 <CheckBoxPreference
30 android:key="pref_gyroscope_on"
31 android:summary="Turn the Gyroscope service on or off."
32 android:defaultValue="false"
33 android:persistent="true"
34 android:title="Gyroscope" />
35 <CheckBoxPreference
36 android:key="pref_ir_temperature_on"
37 android:summary="Turn the IR and Ambient Temperature service on or off."
38 android:defaultValue="false"
39 android:persistent="true"
40 android:title="IR and Ambient Temperature" />
41 <CheckBoxPreference
42 android:key="pref_humidity_on"
43 android:summary="Turn the Humidity service on or off."
44 android:defaultValue="false"
45 android:persistent="true"
46 android:title="Humidity" />
47 <CheckBoxPreference
48 android:key="pref_barometer_on"
49 android:summary="Turn the Barometer service on or off."
50 android:defaultValue="false"
51 android:persistent="true"
52 android:title="Barometer" />
53 </PreferenceCategory>
54
55</PreferenceScreen>
diff --git a/src/com/example/ti/ble/common/BleDeviceInfo.java b/src/com/example/ti/ble/common/BleDeviceInfo.java
new file mode 100644
index 0000000..ca4e486
--- /dev/null
+++ b/src/com/example/ti/ble/common/BleDeviceInfo.java
@@ -0,0 +1,81 @@
1/**************************************************************************************************
2 Filename: BleDeviceInfo.java
3 Revised: $Date: 2013-08-30 12:08:11 +0200 (fr, 30 aug 2013) $
4 Revision: $Revision: 27477 $
5
6 Copyright (c) 2013 - 2014 Texas Instruments Incorporated
7
8 All rights reserved not granted herein.
9 Limited License.
10
11 Texas Instruments Incorporated grants a world-wide, royalty-free,
12 non-exclusive license under copyrights and patents it now or hereafter
13 owns or controls to make, have made, use, import, offer to sell and sell ("Utilize")
14 this software subject to the terms herein. With respect to the foregoing patent
15 license, such license is granted solely to the extent that any such patent is necessary
16 to Utilize the software alone. The patent license shall not apply to any combinations which
17 include this software, other than combinations with devices manufactured by or for TI (TI Devices).
18 No hardware patent is licensed hereunder.
19
20 Redistributions must preserve existing copyright notices and reproduce this license (including the
21 above copyright notice and the disclaimer and (if applicable) source code license limitations below)
22 in the documentation and/or other materials provided with the distribution
23
24 Redistribution and use in binary form, without modification, are permitted provided that the following
25 conditions are met:
26
27 * No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any
28 software provided in binary form.
29 * any redistribution and use are licensed by TI for use only with TI Devices.
30 * Nothing shall obligate TI to provide you with source code for the software licensed and provided to you in object code.
31
32 If software source code is provided to you, modification and redistribution of the source code are permitted
33 provided that the following conditions are met:
34
35 * any redistribution and use of the source code, including any resulting derivative works, are licensed by
36 TI for use only with TI Devices.
37 * any redistribution and use of any object code compiled from the source code and any resulting derivative
38 works, are licensed by TI for use only with TI Devices.
39
40 Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or
41 promote products derived from this software without specific prior written permission.
42
43 DISCLAIMER.
44
45 THIS SOFTWARE IS PROVIDED BY TI AND TIS LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
46 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
47 IN NO EVENT SHALL TI AND TIS LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
48 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
49 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
51 POSSIBILITY OF SUCH DAMAGE.
52
53
54 **************************************************************************************************/
55package com.example.ti.ble.common;
56
57import android.bluetooth.BluetoothDevice;
58
59public class BleDeviceInfo {
60 // Data
61 private BluetoothDevice mBtDevice;
62 private int mRssi;
63
64 public BleDeviceInfo(BluetoothDevice device, int rssi) {
65 mBtDevice = device;
66 mRssi = rssi;
67 }
68
69 public BluetoothDevice getBluetoothDevice() {
70 return mBtDevice;
71 }
72
73 public int getRssi() {
74 return mRssi;
75 }
76
77 public void updateRssi(int rssiValue) {
78 mRssi = rssiValue;
79 }
80
81}
diff --git a/src/com/example/ti/ble/common/BluetoothLeService.java b/src/com/example/ti/ble/common/BluetoothLeService.java
new file mode 100644
index 0000000..896c0a4
--- /dev/null
+++ b/src/com/example/ti/ble/common/BluetoothLeService.java
@@ -0,0 +1,548 @@
1/**************************************************************************************************
2 Filename: BluetoothLeService.java
3 Revised: $Date: 2013-09-09 16:23:36 +0200 (ma, 09 sep 2013) $
4 Revision: $Revision: 27674 $
5
6 Copyright (c) 2013 - 2014 Texas Instruments Incorporated
7
8 All rights reserved not granted herein.
9 Limited License.
10
11 Texas Instruments Incorporated grants a world-wide, royalty-free,
12 non-exclusive license under copyrights and patents it now or hereafter
13 owns or controls to make, have made, use, import, offer to sell and sell ("Utilize")
14 this software subject to the terms herein. With respect to the foregoing patent
15 license, such license is granted solely to the extent that any such patent is necessary
16 to Utilize the software alone. The patent license shall not apply to any combinations which
17 include this software, other than combinations with devices manufactured by or for TI (TI Devices).
18 No hardware patent is licensed hereunder.
19
20 Redistributions must preserve existing copyright notices and reproduce this license (including the
21 above copyright notice and the disclaimer and (if applicable) source code license limitations below)
22 in the documentation and/or other materials provided with the distribution
23
24 Redistribution and use in binary form, without modification, are permitted provided that the following
25 conditions are met:
26
27 * No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any
28 software provided in binary form.
29 * any redistribution and use are licensed by TI for use only with TI Devices.
30 * Nothing shall obligate TI to provide you with source code for the software licensed and provided to you in object code.
31
32 If software source code is provided to you, modification and redistribution of the source code are permitted
33 provided that the following conditions are met:
34
35 * any redistribution and use of the source code, including any resulting derivative works, are licensed by
36 TI for use only with TI Devices.
37 * any redistribution and use of any object code compiled from the source code and any resulting derivative
38 works, are licensed by TI for use only with TI Devices.
39
40 Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or
41 promote products derived from this software without specific prior written permission.
42
43 DISCLAIMER.
44
45 THIS SOFTWARE IS PROVIDED BY TI AND TIS LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
46 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
47 IN NO EVENT SHALL TI AND TIS LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
48 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
49 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
51 POSSIBILITY OF SUCH DAMAGE.
52
53
54 **************************************************************************************************/
55package com.example.ti.ble.common;
56
57import java.util.List;
58import android.app.Service;
59import android.bluetooth.BluetoothAdapter;
60import android.bluetooth.BluetoothDevice;
61import android.bluetooth.BluetoothGatt;
62import android.bluetooth.BluetoothGattCallback;
63import android.bluetooth.BluetoothGattCharacteristic;
64import android.bluetooth.BluetoothGattDescriptor;
65import android.bluetooth.BluetoothGattService;
66import android.bluetooth.BluetoothManager;
67import android.bluetooth.BluetoothProfile;
68import android.content.Context;
69import android.content.Intent;
70import android.os.Binder;
71import android.os.IBinder;
72
73// import android.util.Log;
74
75/**
76 * Service for managing connection and data communication with a GATT server
77 * hosted on a given Bluetooth LE device.
78 */
79public class BluetoothLeService extends Service {
80 static final String TAG = "BluetoothLeService";
81
82 public final static String ACTION_GATT_CONNECTED = "com.example.ti.ble.common.ACTION_GATT_CONNECTED";
83 public final static String ACTION_GATT_DISCONNECTED = "com.example.ti.ble.common.ACTION_GATT_DISCONNECTED";
84 public final static String ACTION_GATT_SERVICES_DISCOVERED = "com.example.ti.ble.common.ACTION_GATT_SERVICES_DISCOVERED";
85 public final static String ACTION_DATA_READ = "com.example.ti.ble.common.ACTION_DATA_READ";
86 public final static String ACTION_DATA_NOTIFY = "com.example.ti.ble.common.ACTION_DATA_NOTIFY";
87 public final static String ACTION_DATA_WRITE = "com.example.ti.ble.common.ACTION_DATA_WRITE";
88 public final static String EXTRA_DATA = "com.example.ti.ble.common.EXTRA_DATA";
89 public final static String EXTRA_UUID = "com.example.ti.ble.common.EXTRA_UUID";
90 public final static String EXTRA_STATUS = "com.example.ti.ble.common.EXTRA_STATUS";
91 public final static String EXTRA_ADDRESS = "com.example.ti.ble.common.EXTRA_ADDRESS";
92
93 // BLE
94 private BluetoothManager mBluetoothManager = null;
95 private BluetoothAdapter mBtAdapter = null;
96 private BluetoothGatt mBluetoothGatt = null;
97 private static BluetoothLeService mThis = null;
98 private volatile boolean mBusy = false; // Write/read pending response
99 private String mBluetoothDeviceAddress;
100
101 /**
102 * GATT client callbacks
103 */
104 private BluetoothGattCallback mGattCallbacks = new BluetoothGattCallback() {
105
106 @Override
107 public void onConnectionStateChange(BluetoothGatt gatt, int status,
108 int newState) {
109 if (mBluetoothGatt == null) {
110 // Log.e(TAG, "mBluetoothGatt not created!");
111 return;
112 }
113
114 BluetoothDevice device = gatt.getDevice();
115 String address = device.getAddress();
116 // Log.d(TAG, "onConnectionStateChange (" + address + ") " + newState +
117 // " status: " + status);
118
119 try {
120 switch (newState) {
121 case BluetoothProfile.STATE_CONNECTED:
122 broadcastUpdate(ACTION_GATT_CONNECTED, address, status);
123 break;
124 case BluetoothProfile.STATE_DISCONNECTED:
125 broadcastUpdate(ACTION_GATT_DISCONNECTED, address, status);
126 break;
127 default:
128 // Log.e(TAG, "New state not processed: " + newState);
129 break;
130 }
131 } catch (NullPointerException e) {
132 e.printStackTrace();
133 }
134 }
135
136 @Override
137 public void onServicesDiscovered(BluetoothGatt gatt, int status) {
138 BluetoothDevice device = gatt.getDevice();
139 broadcastUpdate(ACTION_GATT_SERVICES_DISCOVERED, device.getAddress(),
140 status);
141 }
142
143 @Override
144 public void onCharacteristicChanged(BluetoothGatt gatt,
145 BluetoothGattCharacteristic characteristic) {
146 broadcastUpdate(ACTION_DATA_NOTIFY, characteristic,
147 BluetoothGatt.GATT_SUCCESS);
148 }
149
150 @Override
151 public void onCharacteristicRead(BluetoothGatt gatt,
152 BluetoothGattCharacteristic characteristic, int status) {
153 broadcastUpdate(ACTION_DATA_READ, characteristic, status);
154 }
155
156 @Override
157 public void onCharacteristicWrite(BluetoothGatt gatt,
158 BluetoothGattCharacteristic characteristic, int status) {
159 broadcastUpdate(ACTION_DATA_WRITE, characteristic, status);
160 }
161
162 @Override
163 public void onDescriptorRead(BluetoothGatt gatt,
164 BluetoothGattDescriptor descriptor, int status) {
165 mBusy = false;
166 }
167
168 @Override
169 public void onDescriptorWrite(BluetoothGatt gatt,
170 BluetoothGattDescriptor descriptor, int status) {
171 // Log.i(TAG, "onDescriptorWrite: " + descriptor.getUuid().toString());
172 mBusy = false;
173 }
174 };
175
176 private void broadcastUpdate(final String action, final String address,
177 final int status) {
178 final Intent intent = new Intent(action);
179 intent.putExtra(EXTRA_ADDRESS, address);
180 intent.putExtra(EXTRA_STATUS, status);
181 sendBroadcast(intent);
182 mBusy = false;
183 }
184
185 private void broadcastUpdate(final String action,
186 final BluetoothGattCharacteristic characteristic, final int status) {
187 final Intent intent = new Intent(action);
188 intent.putExtra(EXTRA_UUID, characteristic.getUuid().toString());
189 intent.putExtra(EXTRA_DATA, characteristic.getValue());
190 intent.putExtra(EXTRA_STATUS, status);
191 sendBroadcast(intent);
192 mBusy = false;
193 }
194
195 private boolean checkGatt() {
196 if (mBtAdapter == null) {
197 // Log.w(TAG, "BluetoothAdapter not initialized");
198 return false;
199 }
200 if (mBluetoothGatt == null) {
201 // Log.w(TAG, "BluetoothGatt not initialized");
202 return false;
203 }
204
205 if (mBusy) {
206 // Log.w(TAG, "LeService busy");
207 return false;
208 }
209 return true;
210
211 }
212
213 /**
214 * Manage the BLE service
215 */
216 public class LocalBinder extends Binder {
217 public BluetoothLeService getService() {
218 return BluetoothLeService.this;
219 }
220 }
221
222 @Override
223 public IBinder onBind(Intent intent) {
224 return binder;
225 }
226
227 @Override
228 public boolean onUnbind(Intent intent) {
229 // After using a given device, you should make sure that
230 // BluetoothGatt.close() is called
231 // such that resources are cleaned up properly. In this particular example,
232 // close() is
233 // invoked when the UI is disconnected from the Service.
234 close();
235 return super.onUnbind(intent);
236 }
237
238 private final IBinder binder = new LocalBinder();
239
240 /**
241 * Initializes a reference to the local Bluetooth adapter.
242 *
243 * @return Return true if the initialization is successful.
244 */
245 public boolean initialize() {
246 // For API level 18 and above, get a reference to BluetoothAdapter through
247 // BluetoothManager.
248 mThis = this;
249 if (mBluetoothManager == null) {
250 mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
251 if (mBluetoothManager == null) {
252 // Log.e(TAG, "Unable to initialize BluetoothManager.");
253 return false;
254 }
255 }
256
257 mBtAdapter = mBluetoothManager.getAdapter();
258 if (mBtAdapter == null) {
259 // Log.e(TAG, "Unable to obtain a BluetoothAdapter.");
260 return false;
261 }
262 return true;
263 }
264
265 @Override
266 public int onStartCommand(Intent intent, int flags, int startId) {
267 // Log.i(TAG, "Received start id " + startId + ": " + intent);
268 // We want this service to continue running until it is explicitly
269 // stopped, so return sticky.
270 return START_STICKY;
271 }
272
273 @Override
274 public void onDestroy() {
275 super.onDestroy();
276 if (mBluetoothGatt != null) {
277 mBluetoothGatt.close();
278 mBluetoothGatt = null;
279 }
280 }
281
282 //
283 // GATT API
284 //
285 /**
286 * Request a read on a given {@code BluetoothGattCharacteristic}. The read
287 * result is reported asynchronously through the
288 * {@code BluetoothGattCallback#onCharacteristicRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int)}
289 * callback.
290 *
291 * @param characteristic
292 * The characteristic to read from.
293 */
294 public void readCharacteristic(BluetoothGattCharacteristic characteristic) {
295 if (!checkGatt())
296 return;
297 mBusy = true;
298 mBluetoothGatt.readCharacteristic(characteristic);
299 }
300
301 public boolean writeCharacteristic(
302 BluetoothGattCharacteristic characteristic, byte b) {
303 if (!checkGatt())
304 return false;
305
306 byte[] val = new byte[1];
307 val[0] = b;
308 characteristic.setValue(val);
309
310 mBusy = true;
311 return mBluetoothGatt.writeCharacteristic(characteristic);
312 }
313
314 public boolean writeCharacteristic(
315 BluetoothGattCharacteristic characteristic, boolean b) {
316 if (!checkGatt())
317 return false;
318
319 byte[] val = new byte[1];
320
321 val[0] = (byte) (b ? 1 : 0);
322 characteristic.setValue(val);
323 mBusy = true;
324 return mBluetoothGatt.writeCharacteristic(characteristic);
325 }
326
327 public boolean writeCharacteristic(BluetoothGattCharacteristic characteristic) {
328 if (!checkGatt())
329 return false;
330
331 mBusy = true;
332 return mBluetoothGatt.writeCharacteristic(characteristic);
333 }
334
335 /**
336 * Retrieves the number of GATT services on the connected device. This should
337 * be invoked only after {@code BluetoothGatt#discoverServices()} completes
338 * successfully.
339 *
340 * @return A {@code integer} number of supported services.
341 */
342 public int getNumServices() {
343 if (mBluetoothGatt == null)
344 return 0;
345
346 return mBluetoothGatt.getServices().size();
347 }
348
349 /**
350 * Retrieves a list of supported GATT services on the connected device. This
351 * should be invoked only after {@code BluetoothGatt#discoverServices()}
352 * completes successfully.
353 *
354 * @return A {@code List} of supported services.
355 */
356 public List<BluetoothGattService> getSupportedGattServices() {
357 if (mBluetoothGatt == null)
358 return null;
359
360 return mBluetoothGatt.getServices();
361 }
362
363 /**
364 * Enables or disables notification on a give characteristic.
365 *
366 * @param characteristic
367 * Characteristic to act on.
368 * @param enabled
369 * If true, enable notification. False otherwise.
370 */
371 public boolean setCharacteristicNotification(
372 BluetoothGattCharacteristic characteristic, boolean enable) {
373 if (!checkGatt())
374 return false;
375
376 boolean ok = false;
377 if (mBluetoothGatt.setCharacteristicNotification(characteristic, enable)) {
378
379 BluetoothGattDescriptor clientConfig = characteristic
380 .getDescriptor(GattInfo.CLIENT_CHARACTERISTIC_CONFIG);
381 if (clientConfig != null) {
382
383 if (enable) {
384 // Log.i(TAG, "Enable notification: " +
385 // characteristic.getUuid().toString());
386 ok = clientConfig
387 .setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
388 } else {
389 // Log.i(TAG, "Disable notification: " +
390 // characteristic.getUuid().toString());
391 ok = clientConfig
392 .setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE);
393 }
394
395 if (ok) {
396 mBusy = true;
397 ok = mBluetoothGatt.writeDescriptor(clientConfig);
398 // Log.i(TAG, "writeDescriptor: " +
399 // characteristic.getUuid().toString());
400 }
401 }
402 }
403
404 return ok;
405 }
406
407 public boolean isNotificationEnabled(
408 BluetoothGattCharacteristic characteristic) {
409 if (!checkGatt())
410 return false;
411
412 BluetoothGattDescriptor clientConfig = characteristic
413 .getDescriptor(GattInfo.CLIENT_CHARACTERISTIC_CONFIG);
414 if (clientConfig == null)
415 return false;
416
417 return clientConfig.getValue() == BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE;
418 }
419
420 /**
421 * Connects to the GATT server hosted on the Bluetooth LE device.
422 *
423 * @param address
424 * The device address of the destination device.
425 *
426 * @return Return true if the connection is initiated successfully. The
427 * connection result is reported asynchronously through the
428 * {@code BluetoothGattCallback#onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int)}
429 * callback.
430 */
431 public boolean connect(final String address) {
432 if (mBtAdapter == null || address == null) {
433 // Log.w(TAG, "BluetoothAdapter not initialized or unspecified address.");
434 return false;
435 }
436 final BluetoothDevice device = mBtAdapter.getRemoteDevice(address);
437 int connectionState = mBluetoothManager.getConnectionState(device,
438 BluetoothProfile.GATT);
439
440 if (connectionState == BluetoothProfile.STATE_DISCONNECTED) {
441
442 // Previously connected device. Try to reconnect.
443 if (mBluetoothDeviceAddress != null
444 && address.equals(mBluetoothDeviceAddress) && mBluetoothGatt != null) {
445 // Log.d(TAG, "Re-use GATT connection");
446 if (mBluetoothGatt.connect()) {
447 return true;
448 } else {
449 // Log.w(TAG, "GATT re-connect failed.");
450 return false;
451 }
452 }
453
454 if (device == null) {
455 // Log.w(TAG, "Device not found. Unable to connect.");
456 return false;
457 }
458 // We want to directly connect to the device, so we are setting the
459 // autoConnect parameter to false.
460 // Log.d(TAG, "Create a new GATT connection.");
461 mBluetoothGatt = device.connectGatt(this, false, mGattCallbacks);
462 mBluetoothDeviceAddress = address;
463 } else {
464 // Log.w(TAG, "Attempt to connect in state: " + connectionState);
465 return false;
466 }
467 return true;
468 }
469
470 /**
471 * Disconnects an existing connection or cancel a pending connection. The
472 * disconnection result is reported asynchronously through the
473 * {@code BluetoothGattCallback#onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int)}
474 * callback.
475 */
476 public void disconnect(String address) {
477 if (mBtAdapter == null) {
478 // Log.w(TAG, "disconnect: BluetoothAdapter not initialized");
479 return;
480 }
481 final BluetoothDevice device = mBtAdapter.getRemoteDevice(address);
482 int connectionState = mBluetoothManager.getConnectionState(device,
483 BluetoothProfile.GATT);
484
485 if (mBluetoothGatt != null) {
486 if (connectionState != BluetoothProfile.STATE_DISCONNECTED) {
487 mBluetoothGatt.disconnect();
488 } else {
489 // Log.w(TAG, "Attempt to disconnect in state: " + connectionState);
490 }
491 }
492 }
493
494 /**
495 * After using a given BLE device, the app must call this method to ensure
496 * resources are released properly.
497 */
498 public void close() {
499 if (mBluetoothGatt != null) {
500 // Log.i(TAG, "close");
501 mBluetoothGatt.close();
502 mBluetoothGatt = null;
503 }
504 }
505
506 public int numConnectedDevices() {
507 int n = 0;
508
509 if (mBluetoothGatt != null) {
510 List<BluetoothDevice> devList;
511 devList = mBluetoothManager.getConnectedDevices(BluetoothProfile.GATT);
512 n = devList.size();
513 }
514 return n;
515 }
516
517 //
518 // Utility functions
519 //
520 public static BluetoothGatt getBtGatt() {
521 return mThis.mBluetoothGatt;
522 }
523
524 public static BluetoothManager getBtManager() {
525 return mThis.mBluetoothManager;
526 }
527
528 public static BluetoothLeService getInstance() {
529 return mThis;
530 }
531
532 public boolean waitIdle(int timeout) {
533 timeout /= 10;
534 while (--timeout > 0) {
535 if (mBusy)
536 try {
537 Thread.sleep(10);
538 } catch (InterruptedException e) {
539 e.printStackTrace();
540 }
541 else
542 break;
543 }
544
545 return timeout > 0;
546 }
547
548}
diff --git a/src/com/example/ti/ble/common/GattInfo.java b/src/com/example/ti/ble/common/GattInfo.java
new file mode 100644
index 0000000..10036d7
--- /dev/null
+++ b/src/com/example/ti/ble/common/GattInfo.java
@@ -0,0 +1,162 @@
1/**************************************************************************************************
2 Filename: GattInfo.java
3 Revised: $Date: 2013-08-30 12:02:37 +0200 (fr, 30 aug 2013) $
4 Revision: $Revision: 27470 $
5
6 Copyright (c) 2013 - 2014 Texas Instruments Incorporated
7
8 All rights reserved not granted herein.
9 Limited License.
10
11 Texas Instruments Incorporated grants a world-wide, royalty-free,
12 non-exclusive license under copyrights and patents it now or hereafter
13 owns or controls to make, have made, use, import, offer to sell and sell ("Utilize")
14 this software subject to the terms herein. With respect to the foregoing patent
15 license, such license is granted solely to the extent that any such patent is necessary
16 to Utilize the software alone. The patent license shall not apply to any combinations which
17 include this software, other than combinations with devices manufactured by or for TI (TI Devices).
18 No hardware patent is licensed hereunder.
19
20 Redistributions must preserve existing copyright notices and reproduce this license (including the
21 above copyright notice and the disclaimer and (if applicable) source code license limitations below)
22 in the documentation and/or other materials provided with the distribution
23
24 Redistribution and use in binary form, without modification, are permitted provided that the following
25 conditions are met:
26
27 * No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any
28 software provided in binary form.
29 * any redistribution and use are licensed by TI for use only with TI Devices.
30 * Nothing shall obligate TI to provide you with source code for the software licensed and provided to you in object code.
31
32 If software source code is provided to you, modification and redistribution of the source code are permitted
33 provided that the following conditions are met:
34
35 * any redistribution and use of the source code, including any resulting derivative works, are licensed by
36 TI for use only with TI Devices.
37 * any redistribution and use of any object code compiled from the source code and any resulting derivative
38 works, are licensed by TI for use only with TI Devices.
39
40 Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or
41 promote products derived from this software without specific prior written permission.
42
43 DISCLAIMER.
44
45 THIS SOFTWARE IS PROVIDED BY TI AND TIS LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
46 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
47 IN NO EVENT SHALL TI AND TIS LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
48 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
49 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
51 POSSIBILITY OF SUCH DAMAGE.
52
53
54 **************************************************************************************************/
55package com.example.ti.ble.common;
56
57import java.io.IOException;
58import java.util.HashMap;
59import java.util.Map;
60import java.util.UUID;
61
62import org.xmlpull.v1.XmlPullParser;
63import org.xmlpull.v1.XmlPullParserException;
64
65import android.content.res.XmlResourceParser;
66
67public class GattInfo {
68 // Bluetooth SIG identifiers
69 public static final UUID CLIENT_CHARACTERISTIC_CONFIG = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb");
70 private static final String uuidBtSigBase = "0000****-0000-1000-8000-00805f9b34fb";
71 private static final String uuidTiBase = "f000****-0451-4000-b000-000000000000";
72
73 public static final UUID OAD_SERVICE_UUID = UUID.fromString("f000ffc0-0451-4000-b000-000000000000");
74 public static final UUID CC_SERVICE_UUID = UUID.fromString("f000ccc0-0451-4000-b000-000000000000");
75
76 private static Map<String, String> mNameMap = new HashMap<String, String>();
77 private static Map<String, String> mDescrMap = new HashMap<String, String>();
78
79 public GattInfo(XmlResourceParser xpp) {
80 // XML data base
81 try {
82 readUuidData(xpp);
83 } catch (XmlPullParserException e) {
84 e.printStackTrace();
85 } catch (IOException e) {
86 e.printStackTrace();
87 }
88 }
89
90 public static String uuidToName(UUID uuid) {
91 String str = toShortUuidStr(uuid);
92 return uuidToName(str.toUpperCase());
93 }
94
95 public static String getDescription(UUID uuid) {
96 String str = toShortUuidStr(uuid);
97 return mDescrMap.get(str.toUpperCase());
98 }
99
100 static public boolean isTiUuid(UUID u) {
101 String us = u.toString();
102 String r = toShortUuidStr(u);
103 us = us.replace(r, "****");
104 return us.equals(uuidTiBase);
105 }
106
107 static public boolean isBtSigUuid(UUID u) {
108 String us = u.toString();
109 String r = toShortUuidStr(u);
110 us = us.replace(r, "****");
111 return us.equals(uuidBtSigBase);
112 }
113
114 static public String uuidToString(UUID u) {
115 String uuidStr;
116 if (isBtSigUuid(u))
117 uuidStr = GattInfo.toShortUuidStr(u);
118 else
119 uuidStr = u.toString();
120 return uuidStr.toUpperCase();
121 }
122
123 static private String toShortUuidStr(UUID u) {
124 return u.toString().substring(4, 8);
125 }
126
127 private static String uuidToName(String uuidStr16) {
128 return mNameMap.get(uuidStr16);
129 }
130
131 //
132 // XML loader
133 //
134 private void readUuidData(XmlResourceParser xpp) throws XmlPullParserException, IOException {
135 xpp.next();
136 String tagName = null;
137 String uuid = null;
138 String descr = null;
139 int eventType = xpp.getEventType();
140
141 while (eventType != XmlPullParser.END_DOCUMENT) {
142 if (eventType == XmlPullParser.START_DOCUMENT) {
143 // do nothing
144 } else if (eventType == XmlPullParser.START_TAG) {
145 tagName = xpp.getName();
146 uuid = xpp.getAttributeValue(null, "uuid");
147 descr = xpp.getAttributeValue(null, "descr");
148 } else if (eventType == XmlPullParser.END_TAG) {
149 // do nothing
150 } else if (eventType == XmlPullParser.TEXT) {
151 if (tagName.equalsIgnoreCase("item")) {
152 if (!uuid.isEmpty()) {
153 uuid = uuid.replace("0x", "");
154 mNameMap.put(uuid, xpp.getText());
155 mDescrMap.put(uuid, descr);
156 }
157 }
158 }
159 eventType = xpp.next();
160 }
161 }
162}
diff --git a/src/com/example/ti/ble/common/HelpView.java b/src/com/example/ti/ble/common/HelpView.java
new file mode 100644
index 0000000..adb17a9
--- /dev/null
+++ b/src/com/example/ti/ble/common/HelpView.java
@@ -0,0 +1,89 @@
1/**************************************************************************************************
2 Filename: HelpView.java
3 Revised: $Date: 2013-08-30 12:02:37 +0200 (fr, 30 aug 2013) $
4 Revision: $Revision: 27470 $
5
6 Copyright (c) 2013 - 2014 Texas Instruments Incorporated
7
8 All rights reserved not granted herein.
9 Limited License.
10
11 Texas Instruments Incorporated grants a world-wide, royalty-free,
12 non-exclusive license under copyrights and patents it now or hereafter
13 owns or controls to make, have made, use, import, offer to sell and sell ("Utilize")
14 this software subject to the terms herein. With respect to the foregoing patent
15 license, such license is granted solely to the extent that any such patent is necessary
16 to Utilize the software alone. The patent license shall not apply to any combinations which
17 include this software, other than combinations with devices manufactured by or for TI (TI Devices).
18 No hardware patent is licensed hereunder.
19
20 Redistributions must preserve existing copyright notices and reproduce this license (including the
21 above copyright notice and the disclaimer and (if applicable) source code license limitations below)
22 in the documentation and/or other materials provided with the distribution
23
24 Redistribution and use in binary form, without modification, are permitted provided that the following
25 conditions are met:
26
27 * No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any
28 software provided in binary form.
29 * any redistribution and use are licensed by TI for use only with TI Devices.
30 * Nothing shall obligate TI to provide you with source code for the software licensed and provided to you in object code.
31
32 If software source code is provided to you, modification and redistribution of the source code are permitted
33 provided that the following conditions are met:
34
35 * any redistribution and use of the source code, including any resulting derivative works, are licensed by
36 TI for use only with TI Devices.
37 * any redistribution and use of any object code compiled from the source code and any resulting derivative
38 works, are licensed by TI for use only with TI Devices.
39
40 Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or
41 promote products derived from this software without specific prior written permission.
42
43 DISCLAIMER.
44
45 THIS SOFTWARE IS PROVIDED BY TI AND TIS LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
46 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
47 IN NO EVENT SHALL TI AND TIS LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
48 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
49 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
51 POSSIBILITY OF SUCH DAMAGE.
52
53
54 **************************************************************************************************/
55package com.example.ti.ble.common;
56
57import android.os.Bundle;
58import android.support.v4.app.Fragment;
59import android.view.LayoutInflater;
60import android.view.View;
61import android.view.ViewGroup;
62import android.webkit.WebView;
63
64public class HelpView extends Fragment {
65 private String mFile = "about.html";
66 private int mIdFragment;
67 private int mIdWebPage;
68
69 public HelpView() {
70
71 }
72
73 public void setParameters(String file, int idFragment, int idWebPage) {
74 if (file != null)
75 mFile = file;
76 mIdFragment = idFragment;
77 mIdWebPage = idWebPage;
78 }
79
80 @Override
81 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
82 View rootView = inflater.inflate(mIdFragment, container, false);
83 WebView wv = (WebView) rootView.findViewById(mIdWebPage);
84
85 wv.loadUrl("file:///android_asset/" + mFile);
86 return rootView;
87 }
88
89}
diff --git a/src/com/example/ti/ble/sensortag/AboutDialog.java b/src/com/example/ti/ble/sensortag/AboutDialog.java
new file mode 100644
index 0000000..dda6966
--- /dev/null
+++ b/src/com/example/ti/ble/sensortag/AboutDialog.java
@@ -0,0 +1,148 @@
1/**************************************************************************************************
2 Filename: AboutDialog.java
3 Revised: $Date: 2013-08-30 12:02:37 +0200 (fr, 30 aug 2013) $
4 Revision: $Revision: 27470 $
5
6 Copyright (c) 2013 - 2014 Texas Instruments Incorporated
7
8 All rights reserved not granted herein.
9 Limited License.
10
11 Texas Instruments Incorporated grants a world-wide, royalty-free,
12 non-exclusive license under copyrights and patents it now or hereafter
13 owns or controls to make, have made, use, import, offer to sell and sell ("Utilize")
14 this software subject to the terms herein. With respect to the foregoing patent
15 license, such license is granted solely to the extent that any such patent is necessary
16 to Utilize the software alone. The patent license shall not apply to any combinations which
17 include this software, other than combinations with devices manufactured by or for TI (TI Devices).
18 No hardware patent is licensed hereunder.
19
20 Redistributions must preserve existing copyright notices and reproduce this license (including the
21 above copyright notice and the disclaimer and (if applicable) source code license limitations below)
22 in the documentation and/or other materials provided with the distribution
23
24 Redistribution and use in binary form, without modification, are permitted provided that the following
25 conditions are met:
26
27 * No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any
28 software provided in binary form.
29 * any redistribution and use are licensed by TI for use only with TI Devices.
30 * Nothing shall obligate TI to provide you with source code for the software licensed and provided to you in object code.
31
32 If software source code is provided to you, modification and redistribution of the source code are permitted
33 provided that the following conditions are met:
34
35 * any redistribution and use of the source code, including any resulting derivative works, are licensed by
36 TI for use only with TI Devices.
37 * any redistribution and use of any object code compiled from the source code and any resulting derivative
38 works, are licensed by TI for use only with TI Devices.
39
40 Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or
41 promote products derived from this software without specific prior written permission.
42
43 DISCLAIMER.
44
45 THIS SOFTWARE IS PROVIDED BY TI AND TIS LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
46 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
47 IN NO EVENT SHALL TI AND TIS LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
48 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
49 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
51 POSSIBILITY OF SUCH DAMAGE.
52
53
54 **************************************************************************************************/
55package com.example.ti.ble.sensortag;
56
57import android.app.Dialog;
58import android.content.Context;
59import android.content.pm.PackageManager.NameNotFoundException;
60import android.content.res.Resources;
61import android.os.Build;
62import android.os.Bundle;
63// import android.util.Log;
64import android.view.View;
65import android.view.Window;
66import android.webkit.WebView;
67import android.webkit.WebViewClient;
68import android.widget.Button;
69import android.widget.TextView;
70
71public class AboutDialog extends Dialog {
72 // Log
73 // private static final String TAG = "AboutDialog";
74
75 private Context mContext;
76 private static AboutDialog mDialog;
77 private static OkListener mOkListener;
78 private final String errorHTML = "<html><body><h1>Failed to load web page</h1></body></html>";
79
80 public AboutDialog(Context context) {
81 super(context);
82 mContext = context;
83 mDialog = this;
84 mOkListener = new OkListener();
85 }
86
87 @Override
88 public void onCreate(Bundle savedInstanceState) {
89 requestWindowFeature(Window.FEATURE_NO_TITLE);
90 setContentView(R.layout.dialog_about);
91
92 // From About.html web page
93 WebView webView = (WebView) findViewById(R.id.web_content);
94 webView.setWebViewClient(new WebViewClient(){
95
96 @Override
97 public boolean shouldOverrideUrlLoading(WebView view, String url) {
98 view.loadUrl(url);
99 return false;
100 }
101
102 @Override
103 public void onPageFinished(WebView view, final String url) {
104 // Log.i(TAG,"Web page loaded: " + url);
105 }
106
107 @Override
108 public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
109 // Do something
110 view.loadData(errorHTML, "text/html", "UTF-8");
111 // Log.e(TAG,"Failed to load web page");
112 }
113 });
114
115 // Header
116 Resources res = mContext.getResources();
117 String appName = res.getString(R.string.app_name);
118 TextView title = (TextView) findViewById(R.id.title);
119 title.setText("About " + appName);
120
121 // Application info
122 TextView head = (TextView) findViewById(R.id.header);
123 String appVersion = "Revision: ";
124 try {
125 appVersion += mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName;
126 } catch (NameNotFoundException e) {
127 // Log.v(TAG, e.getMessage());
128 }
129 head.setText(appVersion);
130
131 // Dismiss button
132 Button okButton = (Button) findViewById(R.id.buttonOK);
133 okButton.setOnClickListener(mOkListener);
134
135 // Device information
136 TextView foot = (TextView) findViewById(R.id.footer);
137 String txt = Build.MANUFACTURER.toUpperCase() + " " + Build.MODEL + " Android " + Build.VERSION.RELEASE + " " + Build.DISPLAY;
138
139 foot.setText(txt);
140 }
141
142 private class OkListener implements android.view.View.OnClickListener {
143 @Override
144 public void onClick(View v) {
145 mDialog.dismiss();
146 }
147 }
148}
diff --git a/src/com/example/ti/ble/sensortag/BarometerCalibrationCoefficients.java b/src/com/example/ti/ble/sensortag/BarometerCalibrationCoefficients.java
new file mode 100644
index 0000000..7112a4d
--- /dev/null
+++ b/src/com/example/ti/ble/sensortag/BarometerCalibrationCoefficients.java
@@ -0,0 +1,66 @@
1/**************************************************************************************************
2 Filename: BarometerCalibrationCoefficients.java
3 Revised: $Date: 2013-08-30 11:44:31 +0200 (fr, 30 aug 2013) $
4 Revision: $Revision: 27454 $
5
6 Copyright (c) 2013 - 2014 Texas Instruments Incorporated
7
8 All rights reserved not granted herein.
9 Limited License.
10
11 Texas Instruments Incorporated grants a world-wide, royalty-free,
12 non-exclusive license under copyrights and patents it now or hereafter
13 owns or controls to make, have made, use, import, offer to sell and sell ("Utilize")
14 this software subject to the terms herein. With respect to the foregoing patent
15 license, such license is granted solely to the extent that any such patent is necessary
16 to Utilize the software alone. The patent license shall not apply to any combinations which
17 include this software, other than combinations with devices manufactured by or for TI (TI Devices).
18 No hardware patent is licensed hereunder.
19
20 Redistributions must preserve existing copyright notices and reproduce this license (including the
21 above copyright notice and the disclaimer and (if applicable) source code license limitations below)
22 in the documentation and/or other materials provided with the distribution
23
24 Redistribution and use in binary form, without modification, are permitted provided that the following
25 conditions are met:
26
27 * No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any
28 software provided in binary form.
29 * any redistribution and use are licensed by TI for use only with TI Devices.
30 * Nothing shall obligate TI to provide you with source code for the software licensed and provided to you in object code.
31
32 If software source code is provided to you, modification and redistribution of the source code are permitted
33 provided that the following conditions are met:
34
35 * any redistribution and use of the source code, including any resulting derivative works, are licensed by
36 TI for use only with TI Devices.
37 * any redistribution and use of any object code compiled from the source code and any resulting derivative
38 works, are licensed by TI for use only with TI Devices.
39
40 Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or
41 promote products derived from this software without specific prior written permission.
42
43 DISCLAIMER.
44
45 THIS SOFTWARE IS PROVIDED BY TI AND TIS LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
46 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
47 IN NO EVENT SHALL TI AND TIS LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
48 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
49 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
51 POSSIBILITY OF SUCH DAMAGE.
52
53
54 **************************************************************************************************/
55package com.example.ti.ble.sensortag;
56
57import java.util.List;
58
59/**
60 * As a last-second hack i'm storing the barometer coefficients in a global.
61 */
62public enum BarometerCalibrationCoefficients {
63 INSTANCE;
64 volatile public List<Integer> barometerCalibrationCoefficients;
65 volatile public double heightCalibration;
66}
diff --git a/src/com/example/ti/ble/sensortag/DeviceActivity.java b/src/com/example/ti/ble/sensortag/DeviceActivity.java
new file mode 100644
index 0000000..868a0dc
--- /dev/null
+++ b/src/com/example/ti/ble/sensortag/DeviceActivity.java
@@ -0,0 +1,626 @@
1/**************************************************************************************************
2 Filename: DeviceActivity.java
3 Revised: $Date: 2013-09-05 07:58:48 +0200 (to, 05 sep 2013) $
4 Revision: $Revision: 27616 $
5
6 Copyright (c) 2013 - 2014 Texas Instruments Incorporated
7
8 All rights reserved not granted herein.
9 Limited License.
10
11 Texas Instruments Incorporated grants a world-wide, royalty-free,
12 non-exclusive license under copyrights and patents it now or hereafter
13 owns or controls to make, have made, use, import, offer to sell and sell ("Utilize")
14 this software subject to the terms herein. With respect to the foregoing patent
15 license, such license is granted solely to the extent that any such patent is necessary
16 to Utilize the software alone. The patent license shall not apply to any combinations which
17 include this software, other than combinations with devices manufactured by or for TI (TI Devices).
18 No hardware patent is licensed hereunder.
19
20 Redistributions must preserve existing copyright notices and reproduce this license (including the
21 above copyright notice and the disclaimer and (if applicable) source code license limitations below)
22 in the documentation and/or other materials provided with the distribution
23
24 Redistribution and use in binary form, without modification, are permitted provided that the following
25 conditions are met:
26
27 * No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any
28 software provided in binary form.
29 * any redistribution and use are licensed by TI for use only with TI Devices.
30 * Nothing shall obligate TI to provide you with source code for the software licensed and provided to you in object code.
31
32 If software source code is provided to you, modification and redistribution of the source code are permitted
33 provided that the following conditions are met:
34
35 * any redistribution and use of the source code, including any resulting derivative works, are licensed by
36 TI for use only with TI Devices.
37 * any redistribution and use of any object code compiled from the source code and any resulting derivative
38 works, are licensed by TI for use only with TI Devices.
39
40 Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or
41 promote products derived from this software without specific prior written permission.
42
43 DISCLAIMER.
44
45 THIS SOFTWARE IS PROVIDED BY TI AND TIS LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
46 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
47 IN NO EVENT SHALL TI AND TIS LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
48 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
49 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
51 POSSIBILITY OF SUCH DAMAGE.
52
53
54 **************************************************************************************************/
55package com.example.ti.ble.sensortag;
56
57import java.util.ArrayList;
58import java.util.List;
59import java.util.Locale;
60import java.util.UUID;
61
62import android.bluetooth.BluetoothDevice;
63import android.bluetooth.BluetoothGatt;
64import android.bluetooth.BluetoothGattCharacteristic;
65import android.bluetooth.BluetoothGattService;
66import android.content.BroadcastReceiver;
67import android.content.Context;
68import android.content.Intent;
69import android.content.IntentFilter;
70import android.content.SharedPreferences;
71import android.content.res.Resources;
72import android.content.res.XmlResourceParser;
73import android.os.Build;
74import android.os.Bundle;
75import android.preference.PreferenceManager;
76// import android.util.Log;
77import android.view.Menu;
78import android.view.MenuInflater;
79import android.view.MenuItem;
80import android.view.View;
81import android.view.Window;
82import android.widget.Toast;
83
84import com.example.ti.ble.common.BluetoothLeService;
85import com.example.ti.ble.common.GattInfo;
86import com.example.ti.ble.common.HelpView;
87import com.example.ti.ble.sensortag.R;
88import com.example.ti.util.Point3D;
89
90public class DeviceActivity extends ViewPagerActivity {
91 // Log
92 // private static String TAG = "DeviceActivity";
93
94 // Activity
95 public static final String EXTRA_DEVICE = "EXTRA_DEVICE";
96 private static final int PREF_ACT_REQ = 0;
97 private static final int FWUPDATE_ACT_REQ = 1;
98
99 private DeviceView mDeviceView = null;
100
101 // BLE
102 private BluetoothLeService mBtLeService = null;
103 private BluetoothDevice mBluetoothDevice = null;
104 private BluetoothGatt mBtGatt = null;
105 private List<BluetoothGattService> mServiceList = null;
106 private static final int GATT_TIMEOUT = 250; // milliseconds
107 private boolean mServicesRdy = false;
108 private boolean mIsReceiving = false;
109
110 // SensorTagGatt
111 private List<Sensor> mEnabledSensors = new ArrayList<Sensor>();
112 private BluetoothGattService mOadService = null;
113 private BluetoothGattService mConnControlService = null;
114 private boolean mMagCalibrateRequest = true;
115 private boolean mHeightCalibrateRequest = true;
116 private boolean mIsSensorTag2;
117 private String mFwRev;
118
119 public DeviceActivity() {
120 mResourceFragmentPager = R.layout.fragment_pager;
121 mResourceIdPager = R.id.pager;
122 mFwRev = new String("1.5"); // Assuming all SensorTags are up to date until actual FW revision is read
123 }
124
125 public static DeviceActivity getInstance() {
126 return (DeviceActivity) mThis;
127 }
128
129 @Override
130 public void onCreate(Bundle savedInstanceState) {
131 requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
132 super.onCreate(savedInstanceState);
133 Intent intent = getIntent();
134
135 // BLE
136 mBtLeService = BluetoothLeService.getInstance();
137 mBluetoothDevice = intent.getParcelableExtra(EXTRA_DEVICE);
138 mServiceList = new ArrayList<BluetoothGattService>();
139
140 // Determine type of SensorTagGatt
141 String deviceName = mBluetoothDevice.getName();
142 mIsSensorTag2 = deviceName.equals("SensorTag2");
143 if (mIsSensorTag2)
144 PreferenceManager.setDefaultValues(this, R.xml.preferences2, false);
145 else
146 PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
147 // Log.i(TAG, "Preferences for: " + deviceName);
148
149 // GUI
150 mDeviceView = new DeviceView();
151 mSectionsPagerAdapter.addSection(mDeviceView, "Sensors");
152 HelpView hw = new HelpView();