├── .gitignore
├── README.md
├── Sensorium
├── .classpath
├── .gitignore
├── .idea
│ └── gradle.xml
├── .project
├── AndroidManifest.xml
├── COPYING
├── COPYING.LESSER
├── Sensorium.iml
├── assets
│ ├── icon.png
│ ├── icon.svg
│ ├── icon512.png
│ └── o3gmpreferences.json
├── build.gradle
├── build.xml
├── ic_launcher-web.png
├── libs
│ ├── LICENSE
│ ├── android-support-v4.jar
│ ├── apache-mime4j-core-0.7.2.jar
│ ├── apache-mime4j-dom-0.7.2.jar
│ ├── apache-mime4j-storage-0.7.2.jar
│ ├── commons-codec-1.6.jar
│ ├── commons-logging-1.1.1.jar
│ ├── fluent-hc-4.2.3.jar
│ ├── gson-2.2.4-javadoc.jar
│ ├── gson-2.2.4-sources.jar
│ ├── gson-2.2.4.jar
│ ├── httpclient-4.2.3.jar
│ ├── httpclient-cache-4.2.3.jar
│ ├── httpcore-4.2.2.jar
│ └── httpmime-4.2.3.jar
├── lint.xml
├── proguard-project.txt
├── project.properties
├── res
│ ├── drawable-hdpi
│ │ ├── ic_action_search.png
│ │ └── ic_launcher.png
│ ├── drawable-ldpi
│ │ └── ic_launcher.png
│ ├── drawable-mdpi
│ │ ├── ic_action_search.png
│ │ └── ic_launcher.png
│ ├── drawable-xhdpi
│ │ ├── ic_action_search.png
│ │ └── ic_launcher.png
│ ├── layout
│ │ ├── activity_sensor_debug.xml
│ │ ├── seattle_sensors_main.xml
│ │ ├── sensor_preference_item.xml
│ │ ├── sensor_view_item.xml
│ │ └── upload_dialogpreference.xml
│ ├── menu
│ │ ├── activity_main.xml
│ │ ├── activity_sensor_debug.xml
│ │ └── activity_sensors_view.xml
│ ├── raw
│ │ └── defaultpreferences.json
│ ├── values-pt-rBR
│ │ └── strings.xml
│ ├── values-v11
│ │ └── styles.xml
│ ├── values-v14
│ │ └── styles.xml
│ └── values
│ │ ├── dimens.xml
│ │ ├── sensors.xml
│ │ ├── strings.xml
│ │ ├── styles.xml
│ │ └── upload_interval_strings.xml
└── src
│ ├── at
│ └── univie
│ │ └── sensorium
│ │ ├── SensorBootCompletedReceiver.java
│ │ ├── SensorDebugActivity.java
│ │ ├── SensorRegistry.java
│ │ ├── SensorService.java
│ │ ├── SensorViewArrayAdapter.java
│ │ ├── SensorViewItem.java
│ │ ├── SensoriumActivity.java
│ │ ├── SensoriumApplication.java
│ │ ├── extinterfaces
│ │ ├── HTTPSUploader.java
│ │ └── XMLRPCSensorServerThread.java
│ │ ├── logging
│ │ └── JSONLogger.java
│ │ ├── preferences
│ │ ├── CampaignTrackingBroadcastReceiver.java
│ │ ├── HTTPSUploaderDialogPreference.java
│ │ ├── Preferences.java
│ │ ├── SensorPreference.java
│ │ └── SensorPreferenceActivity.java
│ │ ├── privacy
│ │ ├── HashingPrivacy.java
│ │ ├── LocationPrivacy.java
│ │ ├── Privacy.java
│ │ └── SignalstrengthPrivacy.java
│ │ └── sensors
│ │ ├── AbstractSensor.java
│ │ ├── BatterySensor.java
│ │ ├── BluetoothSensor.java
│ │ ├── DeviceInfoSensor.java
│ │ ├── FusedLocationSensor.java
│ │ ├── GPSLocationSensor.java
│ │ ├── NestedSensorValue.java
│ │ ├── NetworkLocationSensor.java
│ │ ├── PressureSensor.java
│ │ ├── RadioSensor.java
│ │ ├── SIMSensor.java
│ │ ├── SensorChangeListener.java
│ │ ├── SensorException.java
│ │ ├── SensorValue.java
│ │ ├── WifiConnectionSensor.java
│ │ └── WifiSensor.java
│ └── org
│ └── xmlrpc
│ └── android
│ ├── Base64Coder.java
│ ├── IXMLRPCSerializer.java
│ ├── MethodCall.java
│ ├── Tag.java
│ ├── XMLRPCClient.java
│ ├── XMLRPCCommon.java
│ ├── XMLRPCException.java
│ ├── XMLRPCFault.java
│ ├── XMLRPCSerializable.java
│ ├── XMLRPCSerializer.java
│ └── XMLRPCServer.java
└── netsys.md
/.gitignore:
--------------------------------------------------------------------------------
1 | # built application files
2 | *.apk
3 | *.ap_
4 |
5 | # files for the dex VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # generated files
12 | bin/
13 | gen/
14 | build/
15 |
16 | # Local configuration file (sdk path, etc)
17 | local.properties
18 |
19 | # Eclipse project files
20 | .classpath
21 | .project
22 | .settings/
23 |
24 | # Android Studio
25 | .gradle/
26 | gradle/
27 | .idea/
28 | /*/local.properties
29 | /*/out
30 | /*/*/build
31 | /*/*/production
32 | *.iws
33 | *.ipr
34 | *~
35 | *.swp
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Sensorium #
2 |
3 | Sensorium is an Android Application that collects "sensor" information from your device ("Sensor data") and provides external interfaces to gather and process the data for scientific experiments. This is done in a privacy-preserving way. Only the data and only in the level of detail you allow will be made available.
4 |
5 | Sensorium can be remotely pre-configured to suite the needs for your experiment campaign. If you want to implement further sensors or interfaces, please do so.
6 |
7 | We are using some of the sensor values for [Open 3G Map][6].
8 |
9 | All our code is available under the GNU Lesser GPL 3.0. We would appreciate it if you contributed back to the Sensorium project.
10 |
11 | ### Currently Available Sensors ###
12 |
13 | * Radio Cell Coverage Information Sensor
14 | * Network Location Sensor determines location based on availability of cellular
15 | tower and Wifi access points.
16 | * GPS Location Sensor determines location using satellites.
17 | * Wifi Scan Sensor periodically scans the current 802.11 network for all the
18 | access points nearby.
19 | * Wifi Connection Sensor displays the current active Wifi connection status.
20 | * Bluetooth Sensor displays local Bluetooth chip information, list of bonded
21 | and (periodically) scanned device.
22 |
23 | ### External Interfaces ###
24 |
25 | * Local XMLRPC. You could use this to talk to programs running outside of the Android Framework, e.g. we use this to talk to the [Seattle Testbed][1]
26 | * automatic JSON log generation and upload to HTTPS sites
27 |
28 | ### Sensor, Interfaces and Privacy Configuration ###
29 |
30 | Users can also configure each sensor individually to suite their privacy needs. Also, can prevent Sensorium from running at boot or disable individual interfaces,
31 |
32 | * Full privacy: the sensor will not share any information on the external interfaces
33 | * High-Low privacy: Depending on the exact level of privacy, some information might not be shared at all, some data points might be rounded (e.g. longitude/latitude, i.e. only your coarse location will be seen), or salted and hashed (so you only can compare these hashes against each other).
34 | * No privacy: All information available to the sensor will be shared.
35 |
36 | ## Develop ##
37 |
38 | Apart from improving the core Sensorium code, you are probably mostly interesting in writing your own Sensor or Interface classes. The following might help you with that.
39 |
40 | ### Implementing New Sensors ###
41 |
42 | 1. Extend the AbstractSensor class
43 | 2. Implement your sensor reading stuff, putting all values to be published in SensorValue objects
44 | 3. Call notifyListeners() whenever your Sensors wants to have its values updated
45 | 4. Put your class name into the res/values/sensors.xml to get it loaded
46 |
47 | ### Implementing New External Interfaces ###
48 |
49 | Currently, we either talk through XMLRPC to your locally running code or we push JSON data to Web Servers.
50 |
51 | Have better ways of communicating your sensors? Implement it! At the moment, it would be best if you read the code to understand what you would need to do. We are still working on a small tutorial to get you started.
52 |
53 |
54 | ## Third Party Libraries ##
55 |
56 | * An adapted version of [android-xmlrpc][2] is used to provide XMLRPC. It's available under the APL 2.0.
57 | * Uses [google-gson][3] (APL 2.0) to provide JSON logging support for Android 2.3.x support.
58 | * Apache [HTTPClient][4] and related libs (APL 2.0) for Multipart Entity HTTP POST support in 2.3.x.
59 |
60 |
61 | (Note: If you were looking for information on our NetSys2013 demonstration, please look [here][5].)
62 |
63 |
64 | [1]: https://seattle.cs.washington.edu/html/
65 | [2]: https://code.google.com/p/android-xmlrpc/
66 | [3]: https://code.google.com/p/google-gson/
67 | [4]: https://hc.apache.org/httpcomponents-client-ga/index.html
68 | [5]: https://github.com/fmetzger/android-sensorium/blob/master/netsys.md
69 | [6]: https://o3gm.cs.univie.ac.at/o3gm/
--------------------------------------------------------------------------------
/Sensorium/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Sensorium/.gitignore:
--------------------------------------------------------------------------------
1 | /gen
2 | /bin
3 |
--------------------------------------------------------------------------------
/Sensorium/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/Sensorium/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sensorium
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Sensorium/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
30 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
42 |
45 |
46 |
49 |
50 |
51 |
52 |
53 |
54 |
58 |
59 |
60 |
61 |
62 |
63 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/Sensorium/COPYING.LESSER:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 |
9 | This version of the GNU Lesser General Public License incorporates
10 | the terms and conditions of version 3 of the GNU General Public
11 | License, supplemented by the additional permissions listed below.
12 |
13 | 0. Additional Definitions.
14 |
15 | As used herein, "this License" refers to version 3 of the GNU Lesser
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
17 | General Public License.
18 |
19 | "The Library" refers to a covered work governed by this License,
20 | other than an Application or a Combined Work as defined below.
21 |
22 | An "Application" is any work that makes use of an interface provided
23 | by the Library, but which is not otherwise based on the Library.
24 | Defining a subclass of a class defined by the Library is deemed a mode
25 | of using an interface provided by the Library.
26 |
27 | A "Combined Work" is a work produced by combining or linking an
28 | Application with the Library. The particular version of the Library
29 | with which the Combined Work was made is also called the "Linked
30 | Version".
31 |
32 | The "Minimal Corresponding Source" for a Combined Work means the
33 | Corresponding Source for the Combined Work, excluding any source code
34 | for portions of the Combined Work that, considered in isolation, are
35 | based on the Application, and not on the Linked Version.
36 |
37 | The "Corresponding Application Code" for a Combined Work means the
38 | object code and/or source code for the Application, including any data
39 | and utility programs needed for reproducing the Combined Work from the
40 | Application, but excluding the System Libraries of the Combined Work.
41 |
42 | 1. Exception to Section 3 of the GNU GPL.
43 |
44 | You may convey a covered work under sections 3 and 4 of this License
45 | without being bound by section 3 of the GNU GPL.
46 |
47 | 2. Conveying Modified Versions.
48 |
49 | If you modify a copy of the Library, and, in your modifications, a
50 | facility refers to a function or data to be supplied by an Application
51 | that uses the facility (other than as an argument passed when the
52 | facility is invoked), then you may convey a copy of the modified
53 | version:
54 |
55 | a) under this License, provided that you make a good faith effort to
56 | ensure that, in the event an Application does not supply the
57 | function or data, the facility still operates, and performs
58 | whatever part of its purpose remains meaningful, or
59 |
60 | b) under the GNU GPL, with none of the additional permissions of
61 | this License applicable to that copy.
62 |
63 | 3. Object Code Incorporating Material from Library Header Files.
64 |
65 | The object code form of an Application may incorporate material from
66 | a header file that is part of the Library. You may convey such object
67 | code under terms of your choice, provided that, if the incorporated
68 | material is not limited to numerical parameters, data structure
69 | layouts and accessors, or small macros, inline functions and templates
70 | (ten or fewer lines in length), you do both of the following:
71 |
72 | a) Give prominent notice with each copy of the object code that the
73 | Library is used in it and that the Library and its use are
74 | covered by this License.
75 |
76 | b) Accompany the object code with a copy of the GNU GPL and this license
77 | document.
78 |
79 | 4. Combined Works.
80 |
81 | You may convey a Combined Work under terms of your choice that,
82 | taken together, effectively do not restrict modification of the
83 | portions of the Library contained in the Combined Work and reverse
84 | engineering for debugging such modifications, if you also do each of
85 | the following:
86 |
87 | a) Give prominent notice with each copy of the Combined Work that
88 | the Library is used in it and that the Library and its use are
89 | covered by this License.
90 |
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 | document.
93 |
94 | c) For a Combined Work that displays copyright notices during
95 | execution, include the copyright notice for the Library among
96 | these notices, as well as a reference directing the user to the
97 | copies of the GNU GPL and this license document.
98 |
99 | d) Do one of the following:
100 |
101 | 0) Convey the Minimal Corresponding Source under the terms of this
102 | License, and the Corresponding Application Code in a form
103 | suitable for, and under terms that permit, the user to
104 | recombine or relink the Application with a modified version of
105 | the Linked Version to produce a modified Combined Work, in the
106 | manner specified by section 6 of the GNU GPL for conveying
107 | Corresponding Source.
108 |
109 | 1) Use a suitable shared library mechanism for linking with the
110 | Library. A suitable mechanism is one that (a) uses at run time
111 | a copy of the Library already present on the user's computer
112 | system, and (b) will operate properly with a modified version
113 | of the Library that is interface-compatible with the Linked
114 | Version.
115 |
116 | e) Provide Installation Information, but only if you would otherwise
117 | be required to provide such information under section 6 of the
118 | GNU GPL, and only to the extent that such information is
119 | necessary to install and execute a modified version of the
120 | Combined Work produced by recombining or relinking the
121 | Application with a modified version of the Linked Version. (If
122 | you use option 4d0, the Installation Information must accompany
123 | the Minimal Corresponding Source and Corresponding Application
124 | Code. If you use option 4d1, you must provide the Installation
125 | Information in the manner specified by section 6 of the GNU GPL
126 | for conveying Corresponding Source.)
127 |
128 | 5. Combined Libraries.
129 |
130 | You may place library facilities that are a work based on the
131 | Library side by side in a single library together with other library
132 | facilities that are not Applications and are not covered by this
133 | License, and convey such a combined library under terms of your
134 | choice, if you do both of the following:
135 |
136 | a) Accompany the combined library with a copy of the same work based
137 | on the Library, uncombined with any other library facilities,
138 | conveyed under the terms of this License.
139 |
140 | b) Give prominent notice with the combined library that part of it
141 | is a work based on the Library, and explaining where to find the
142 | accompanying uncombined form of the same work.
143 |
144 | 6. Revised Versions of the GNU Lesser General Public License.
145 |
146 | The Free Software Foundation may publish revised and/or new versions
147 | of the GNU Lesser General Public License from time to time. Such new
148 | versions will be similar in spirit to the present version, but may
149 | differ in detail to address new problems or concerns.
150 |
151 | Each version is given a distinguishing version number. If the
152 | Library as you received it specifies that a certain numbered version
153 | of the GNU Lesser General Public License "or any later version"
154 | applies to it, you have the option of following the terms and
155 | conditions either of that published version or of any later version
156 | published by the Free Software Foundation. If the Library as you
157 | received it does not specify a version number of the GNU Lesser
158 | General Public License, you may choose any version of the GNU Lesser
159 | General Public License ever published by the Free Software Foundation.
160 |
161 | If the Library as you received it specifies that a proxy can decide
162 | whether future versions of the GNU Lesser General Public License shall
163 | apply, that proxy's public statement of acceptance of any version is
164 | permanent authorization for you to choose that version for the
165 | Library.
166 |
--------------------------------------------------------------------------------
/Sensorium/Sensorium.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | generateDebugSources
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/Sensorium/assets/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/assets/icon.png
--------------------------------------------------------------------------------
/Sensorium/assets/icon512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/assets/icon512.png
--------------------------------------------------------------------------------
/Sensorium/assets/o3gmpreferences.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "upload_url": "https://o3gm.cs.univie.ac.at/sensorium/",
4 | "upload_username": "o3gm_upload_user",
5 | "upload_password": "o3gm_upload_user_password",
6 | "upload_automatic": "true",
7 | "upload_wifi": "false",
8 | "upload_interval": "3600",
9 |
10 | "xmlrpc_enabled": "true",
11 | "sensor_autostart": "true",
12 |
13 | "at.univie.sensorium.sensors.BatterySensor": "true",
14 | "at.univie.sensorium.sensors.GPSLocationSensor": "true",
15 | "at.univie.sensorium.sensors.DeviceInfoSensor": "true",
16 | "at.univie.sensorium.sensors.NetworkLocationSensor": "true",
17 | "at.univie.sensorium.sensors.RadioSensor": "true",
18 | "at.univie.sensorium.sensors.BluetoothSensor": "false",
19 | "at.univie.sensorium.sensors.WifiConnectionSensor": "false",
20 | "at.univie.sensorium.sensors.WifiSensor": "false",
21 |
22 |
23 | "at.univie.sensorium.sensors.BatterySensor-privacylevel": "0",
24 | "at.univie.sensorium.sensors.BluetoothSensor-privacylevel": "4",
25 | "at.univie.sensorium.sensors.GPSLocationSensor-privacylevel": "0",
26 | "at.univie.sensorium.sensors.DeviceInfoSensor-privacylevel": "0",
27 | "at.univie.sensorium.sensors.NetworkLocationSensor-privacylevel": "0",
28 | "at.univie.sensorium.sensors.RadioSensor-privacylevel": "0",
29 | "at.univie.sensorium.sensors.WifiConnectionSensor-privacylevel": "4",
30 | "at.univie.sensorium.sensors.WifiSensor-privacylevel": "4"
31 |
32 | }
33 | ]
34 |
--------------------------------------------------------------------------------
/Sensorium/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | mavenCentral()
4 | }
5 | dependencies {
6 | classpath 'com.android.tools.build:gradle:2.3.0'
7 | }
8 | }
9 | apply plugin: 'com.android.application'
10 |
11 | dependencies {
12 | compile fileTree(dir: 'libs', include: '*.jar')
13 | }
14 |
15 | android {
16 | compileSdkVersion 19
17 | buildToolsVersion "25.0.0"
18 |
19 | sourceSets {
20 | main {
21 | manifest.srcFile 'AndroidManifest.xml'
22 | java.srcDirs = ['src']
23 | resources.srcDirs = ['src']
24 | aidl.srcDirs = ['src']
25 | renderscript.srcDirs = ['src']
26 | res.srcDirs = ['res']
27 | assets.srcDirs = ['assets']
28 | }
29 |
30 | // Move the tests to tests/java, tests/res, etc...
31 | instrumentTest.setRoot('tests')
32 |
33 | // Move the build types to build-types/
34 | // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
35 | // This moves them out of them default location under src//... which would
36 | // conflict with src/ being used by the main source set.
37 | // Adding new build types or product flavors should be accompanied
38 | // by a similar customization.
39 | debug.setRoot('build-types/debug')
40 | release.setRoot('build-types/release')
41 | }
42 |
43 | packagingOptions {
44 | exclude 'META-INF/LICENSE'
45 | exclude 'META-INF/LICENSE.txt'
46 | exclude 'META-INF/NOTICE'
47 | exclude 'META-INF/NOTICE.txt'
48 | exclude 'META-INF/DEPENDENCIES'
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Sensorium/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | /*@IF_PLAY_SERVICES@
68 |
69 |
70 |
71 | @ENDIF_PLAY_SERVICES@*/
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | ]]>
80 |
81 |
82 |
83 |
84 |
85 | //@IF_PLAY_SERVICES@
86 |
87 |
88 |
89 | //@ENDIF_PLAY_SERVICES@
90 |
91 |
92 |
93 | ]]>
94 |
95 |
96 |
97 | ]]>
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/Sensorium/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/ic_launcher-web.png
--------------------------------------------------------------------------------
/Sensorium/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/Sensorium/libs/apache-mime4j-core-0.7.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/libs/apache-mime4j-core-0.7.2.jar
--------------------------------------------------------------------------------
/Sensorium/libs/apache-mime4j-dom-0.7.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/libs/apache-mime4j-dom-0.7.2.jar
--------------------------------------------------------------------------------
/Sensorium/libs/apache-mime4j-storage-0.7.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/libs/apache-mime4j-storage-0.7.2.jar
--------------------------------------------------------------------------------
/Sensorium/libs/commons-codec-1.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/libs/commons-codec-1.6.jar
--------------------------------------------------------------------------------
/Sensorium/libs/commons-logging-1.1.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/libs/commons-logging-1.1.1.jar
--------------------------------------------------------------------------------
/Sensorium/libs/fluent-hc-4.2.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/libs/fluent-hc-4.2.3.jar
--------------------------------------------------------------------------------
/Sensorium/libs/gson-2.2.4-javadoc.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/libs/gson-2.2.4-javadoc.jar
--------------------------------------------------------------------------------
/Sensorium/libs/gson-2.2.4-sources.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/libs/gson-2.2.4-sources.jar
--------------------------------------------------------------------------------
/Sensorium/libs/gson-2.2.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/libs/gson-2.2.4.jar
--------------------------------------------------------------------------------
/Sensorium/libs/httpclient-4.2.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/libs/httpclient-4.2.3.jar
--------------------------------------------------------------------------------
/Sensorium/libs/httpclient-cache-4.2.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/libs/httpclient-cache-4.2.3.jar
--------------------------------------------------------------------------------
/Sensorium/libs/httpcore-4.2.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/libs/httpcore-4.2.2.jar
--------------------------------------------------------------------------------
/Sensorium/libs/httpmime-4.2.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/libs/httpmime-4.2.3.jar
--------------------------------------------------------------------------------
/Sensorium/lint.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Sensorium/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/Sensorium/project.properties:
--------------------------------------------------------------------------------
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.
14 | target=android-19
15 |
16 |
--------------------------------------------------------------------------------
/Sensorium/res/drawable-hdpi/ic_action_search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/res/drawable-hdpi/ic_action_search.png
--------------------------------------------------------------------------------
/Sensorium/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Sensorium/res/drawable-ldpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/res/drawable-ldpi/ic_launcher.png
--------------------------------------------------------------------------------
/Sensorium/res/drawable-mdpi/ic_action_search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/res/drawable-mdpi/ic_action_search.png
--------------------------------------------------------------------------------
/Sensorium/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Sensorium/res/drawable-xhdpi/ic_action_search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/res/drawable-xhdpi/ic_action_search.png
--------------------------------------------------------------------------------
/Sensorium/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fmetzger/android-sensorium/4f8a6ce2d31fbb21e45a1cea0c8b6313aaf6aa64/Sensorium/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Sensorium/res/layout/activity_sensor_debug.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
13 |
14 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Sensorium/res/layout/seattle_sensors_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
14 |
15 |
23 |
24 |
--------------------------------------------------------------------------------
/Sensorium/res/layout/sensor_preference_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
20 |
21 |
22 |
28 |
29 |
30 |
31 |
39 |
40 |
41 |
49 |
50 |
--------------------------------------------------------------------------------
/Sensorium/res/layout/sensor_view_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
18 |
19 |
26 |
33 |
34 |
35 |
41 |
42 |
50 |
51 |
59 |
60 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/Sensorium/res/layout/upload_dialogpreference.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
25 |
26 |
34 |
35 |
41 |
42 |
50 |
51 |
60 |
61 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/Sensorium/res/menu/activity_main.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Sensorium/res/menu/activity_sensor_debug.xml:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/Sensorium/res/menu/activity_sensors_view.xml:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/Sensorium/res/raw/defaultpreferences.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "preferences_version": "6",
4 |
5 | "upload_url": "https://o3gm.cs.univie.ac.at/sensorium/",
6 | "upload_username": "o3gm_upload_user",
7 | "upload_password": "o3gm_upload_user_password",
8 | "upload_automatic": "true",
9 | "upload_wifi": "true",
10 | "upload_interval": "86400",
11 |
12 | "xmlrpc_enabled": "true",
13 |
14 | "sensor_autostart": "true",
15 |
16 | "at.univie.sensorium.sensors.BatterySensor": "true",
17 | "at.univie.sensorium.sensors.GPSLocationSensor": "true",
18 | "at.univie.sensorium.sensors.DeviceInfoSensor": "true",
19 | "at.univie.sensorium.sensors.FusedLocationSensor": "true",
20 | "at.univie.sensorium.sensors.NetworkLocationSensor": "true",
21 | "at.univie.sensorium.sensors.RadioSensor": "true",
22 | "at.univie.sensorium.sensors.SIMsSensor": "true",
23 | "at.univie.sensorium.sensors.PressureSensor": "true",
24 | "at.univie.sensorium.sensors.BluetoothSensor": "true",
25 | "at.univie.sensorium.sensors.WifiConnectionSensor": "true",
26 | "at.univie.sensorium.sensors.WifiSensor": "true",
27 |
28 |
29 | "at.univie.sensorium.sensors.BatterySensor-privacylevel": "0",
30 | "at.univie.sensorium.sensors.BluetoothSensor-privacylevel": "4",
31 | "at.univie.sensorium.sensors.GPSLocationSensor-privacylevel": "0",
32 | "at.univie.sensorium.sensors.FusedLocationSensor-privacylevel": "4",
33 | "at.univie.sensorium.sensors.DeviceInfoSensor-privacylevel": "0",
34 | "at.univie.sensorium.sensors.NetworkLocationSensor-privacylevel": "0",
35 | "at.univie.sensorium.sensors.PressureSensor-privacylevel": "4",
36 | "at.univie.sensorium.sensors.RadioSensor-privacylevel": "0",
37 | "at.univie.sensorium.sensors.SIMSensor-privacylevel": "0",
38 | "at.univie.sensorium.sensors.WifiConnectionSensor-privacylevel": "4",
39 | "at.univie.sensorium.sensors.WifiSensor-privacylevel": "4"
40 |
41 | }
42 | ]
43 |
--------------------------------------------------------------------------------
/Sensorium/res/values-pt-rBR/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sensorium
4 | Configurações
5 | Sensorium
6 | Habilitar
7 | Deshabilitar
8 | Obrigado por doar para Seattle
9 | Sensores
10 | Configurações do Sensorium
11 | Habilitar na inicialização
12 | BotãoDeAutoIniciar
13 | Saída da Depuração
14 | Visualizações do Sensor
15 | Configuração Sensorium Configuration
16 | Habilitar/Desabilitar Sensores
17 | Log Sensorium
18 | Saída de Depuração dos Sensores
19 | Sensoresium
20 | Valores atuais do sensor:
21 | Nome do sensor
22 | Depurar
23 | Sobre
24 |
25 |
--------------------------------------------------------------------------------
/Sensorium/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Sensorium/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Sensorium/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 14pt
4 |
5 |
--------------------------------------------------------------------------------
/Sensorium/res/values/sensors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | at.univie.sensorium.sensors.DeviceInfoSensor
5 | at.univie.sensorium.sensors.BatterySensor
6 | at.univie.sensorium.sensors.RadioSensor
7 | at.univie.sensorium.sensors.SIMSensor
8 | at.univie.sensorium.sensors.NetworkLocationSensor
9 | at.univie.sensorium.sensors.GPSLocationSensor
10 |
13 | at.univie.sensorium.sensors.PressureSensor
14 |
15 | at.univie.sensorium.sensors.WifiConnectionSensor
16 | at.univie.sensorium.sensors.WifiSensor
17 | at.univie.sensorium.sensors.BluetoothSensor
18 |
19 |
--------------------------------------------------------------------------------
/Sensorium/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Sensorium
4 | Settings
5 | Sensorium
6 | Enable
7 | Disable
8 | Thank you for donating to Seattle
9 | Sensors
10 | Sensorium Configuration
11 | Enable at startup
12 | AutostartButton
13 | Debug Output
14 | Sensor Views
15 | Sensorium Configuration
16 | Enable/Disable Sensors
17 | Sensorium Log
18 | Sensors Debug Output
19 | Sensorsium
20 | Current sensor values:
21 | Sensor Name
22 | Debug
23 | About
24 |
25 |
--------------------------------------------------------------------------------
/Sensorium/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Sensorium/res/values/upload_interval_strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1h
5 | 1d
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Sensorium/src/at/univie/sensorium/SensorBootCompletedReceiver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Sensorium.
3 | *
4 | * Sensorium is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Sensorium is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with Sensorium. If not, see
16 | * .
17 | *
18 | *
19 | */
20 |
21 | package at.univie.sensorium;
22 |
23 | import android.content.BroadcastReceiver;
24 | import android.content.Context;
25 | import android.content.Intent;
26 | import android.content.SharedPreferences;
27 | import android.preference.PreferenceManager;
28 | import android.util.Log;
29 | import at.univie.sensorium.preferences.Preferences;
30 |
31 | public class SensorBootCompletedReceiver extends BroadcastReceiver {
32 |
33 | @Override
34 | public void onReceive(Context context, Intent intent) {
35 |
36 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
37 | if(prefs.getBoolean(Preferences.SENSOR_AUTOSTART_PREF, false)){
38 | Log.d(SensorRegistry.TAG,"boot completed receiver starting service");
39 | Intent myintent = new Intent(context, SensorService.class);
40 | context.startService(myintent);
41 | } else {
42 | Log.d(SensorRegistry.TAG,"boot completed receiver not starting service, preference disabled");
43 | }
44 |
45 |
46 | }
47 |
48 | }
--------------------------------------------------------------------------------
/Sensorium/src/at/univie/sensorium/SensorDebugActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Sensorium.
3 | *
4 | * Sensorium is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Sensorium is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with Sensorium. If not, see
16 | * .
17 | *
18 | *
19 | */
20 |
21 | package at.univie.sensorium;
22 |
23 | import android.app.Activity;
24 | import android.os.Bundle;
25 | import android.widget.TextView;
26 |
27 | public class SensorDebugActivity extends Activity {
28 |
29 | @Override
30 | public void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.activity_sensor_debug);
33 |
34 | ((SensoriumApplication) getApplication()).bindService();
35 |
36 | TextView t = (TextView) findViewById(R.id.sensoroutput);
37 |
38 | SensorRegistry sensorregistry = SensorRegistry.getInstance();
39 | sensorregistry.setDebugView(t);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Sensorium/src/at/univie/sensorium/SensorService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Sensorium.
3 | *
4 | * Sensorium is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Sensorium is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with Sensorium. If not, see
16 | * .
17 | *
18 | *
19 | */
20 |
21 | package at.univie.sensorium;
22 |
23 | import java.io.PrintWriter;
24 | import java.io.StringWriter;
25 |
26 | import android.app.Notification;
27 | import android.app.NotificationManager;
28 | import android.app.PendingIntent;
29 | import android.app.Service;
30 | import android.content.Intent;
31 | import android.content.res.Resources;
32 | import android.os.Binder;
33 | import android.os.IBinder;
34 | import android.support.v4.app.NotificationCompat;
35 | import android.util.Log;
36 | import at.univie.sensorium.logging.JSONLogger;
37 | import at.univie.sensorium.preferences.Preferences;
38 | import at.univie.sensorium.sensors.AbstractSensor;
39 |
40 | public class SensorService extends Service {
41 | private SensorRegistry registry;
42 | private static final int NOTIFICATION = 42;
43 | private final IBinder mBinder = new LocalBinder();
44 |
45 | @Override
46 | public IBinder onBind(Intent intent) {
47 | Log.d("LocalService", "Received bind intent: " + intent);
48 | init();
49 | return mBinder;
50 | }
51 |
52 | public class LocalBinder extends Binder {
53 | SensorService getService() {
54 | return SensorService.this;
55 | }
56 | }
57 |
58 | @Override
59 | public int onStartCommand(Intent intent, int flags, int startId) {
60 | Log.d("LocalService", "Received start id " + startId + ": " + intent);
61 | init();
62 | return START_STICKY;
63 | }
64 |
65 | private void init() {
66 |
67 | Preferences preferences = new Preferences(this);
68 | registry = SensorRegistry.getInstance();
69 | registry.setPreferences(preferences);
70 |
71 | preferences.loadDefaultPreferences();
72 |
73 |
74 | startSensors();
75 | registry.startup(this);
76 | startExtInterfaces();
77 | }
78 |
79 | private void startSensors() {
80 | Resources res = getResources();
81 | String[] sensorclassnames = res.getStringArray(R.array.sensors);
82 |
83 | for (String classname : sensorclassnames) {
84 | Log.d("SENSORS", classname);
85 | try {
86 | AbstractSensor s = (AbstractSensor) Class.forName(classname).newInstance();
87 | SensorRegistry.getInstance().registerSensor(s);
88 | } catch (ClassNotFoundException e) {
89 | StringWriter sw = new StringWriter();
90 | PrintWriter pw = new PrintWriter(sw);
91 | e.printStackTrace(pw);
92 | Log.d(SensorRegistry.TAG, sw.toString());
93 | } catch (InstantiationException e) {
94 | StringWriter sw = new StringWriter();
95 | PrintWriter pw = new PrintWriter(sw);
96 | e.printStackTrace(pw);
97 | Log.d(SensorRegistry.TAG, sw.toString());
98 | } catch (IllegalAccessException e) {
99 | StringWriter sw = new StringWriter();
100 | PrintWriter pw = new PrintWriter(sw);
101 | e.printStackTrace(pw);
102 | Log.d(SensorRegistry.TAG, sw.toString());
103 | }
104 | }
105 | }
106 |
107 | private void startExtInterfaces() {
108 | registry.startXMLRPCInterface();
109 | createJSONLoggerUploader();
110 | registry.getJSONLogger().init(registry.getSensors());
111 | }
112 |
113 | private void createJSONLoggerUploader() {
114 | registry.setJSONLogger(new JSONLogger());
115 | Preferences prefs = SensorRegistry.getInstance().getPreferences();
116 | if (prefs.getBoolean(Preferences.UPLOAD_AUTOMATIC_PREF, false)) {
117 | int interval = prefs.getInt(Preferences.UPLOAD_INTERVAL_PREF, 3600);
118 | boolean wifi = prefs.getBoolean(Preferences.UPLOAD_WIFI_PREF, false);
119 | String url = prefs.getString(Preferences.UPLOAD_URL_PREF, "");
120 | registry.getJSONLogger().autoupload(url, interval, wifi);
121 |
122 | }
123 | }
124 |
125 | @Override
126 | public void onCreate() {
127 | PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, SensoriumActivity.class),PendingIntent.FLAG_CANCEL_CURRENT);
128 | NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
129 | NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
130 |
131 | builder.setContentIntent(contentIntent)
132 | .setSmallIcon(R.drawable.ic_launcher)
133 | .setWhen(System.currentTimeMillis())
134 | .setAutoCancel(true)
135 | .setContentTitle(SensorRegistry.TAG)
136 | .setContentText("running");
137 | Notification n = builder.build();
138 | nm.notify(NOTIFICATION, n);
139 | }
140 |
141 | @Override
142 | public void onDestroy() {
143 | registry.getJSONLogger().finalizeLog();
144 | ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).cancel(NOTIFICATION);
145 | Log.d(SensorRegistry.TAG, "SeattleSensors stopped");
146 | }
147 |
148 | public SensorRegistry getSensorRegistry() {
149 | return registry;
150 | }
151 | }
152 |
--------------------------------------------------------------------------------
/Sensorium/src/at/univie/sensorium/SensorViewArrayAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Sensorium.
3 | *
4 | * Sensorium is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Sensorium is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with Sensorium. If not, see
16 | * .
17 | *
18 | *
19 | */
20 |
21 | package at.univie.sensorium;
22 |
23 | import java.util.List;
24 |
25 | import android.content.Context;
26 | import android.view.LayoutInflater;
27 | import android.view.View;
28 | import android.view.ViewGroup;
29 | import android.widget.ArrayAdapter;
30 | import android.widget.TextView;
31 | import at.univie.sensorium.sensors.AbstractSensor;
32 |
33 | public class SensorViewArrayAdapter extends ArrayAdapter {
34 |
35 | private LayoutInflater inflater;
36 |
37 | private List sensors;
38 |
39 | public SensorViewArrayAdapter(Context context, List sensorList) {
40 | super(context, R.layout.sensor_view_item, R.id.sensorValue, sensorList);
41 | inflater = LayoutInflater.from(context);
42 | this.sensors = sensorList;
43 | }
44 |
45 | @Override
46 | public View getView(int position, View convertView, ViewGroup parent) {
47 | TextView sValue;
48 | TextView sName;
49 | TextView sPrivacyLevel;
50 | TextView sTimestamp;
51 | TextView sUnit;
52 | TextView sType;
53 |
54 | SensorViewItem svi;
55 |
56 | if (convertView == null) {
57 | convertView = inflater.inflate(R.layout.sensor_view_item, null);
58 |
59 | sValue = (TextView) convertView.findViewById(R.id.sensorValues);
60 | sName = (TextView) convertView.findViewById(R.id.sensorName);
61 | sPrivacyLevel = (TextView) convertView.findViewById(R.id.sensorPrivacyLevel);
62 | sTimestamp = (TextView) convertView.findViewById(R.id.sensorTimestamp);
63 | sUnit = (TextView) convertView.findViewById(R.id.sensorUnits);
64 | sType = (TextView) convertView.findViewById(R.id.sensorTypes);
65 |
66 | svi = new SensorViewItem(sName, sPrivacyLevel, sTimestamp, sValue, sUnit, sType);
67 | convertView.setTag(svi);
68 |
69 | } else {
70 | svi = (SensorViewItem) convertView.getTag();
71 | }
72 |
73 | svi.updateDisplay(sensors.get(position));
74 | svi.attachto(sensors.get(position),sensors);
75 |
76 | return convertView;
77 | }
78 | }
--------------------------------------------------------------------------------
/Sensorium/src/at/univie/sensorium/SensorViewItem.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Sensorium.
3 | *
4 | * Sensorium is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Sensorium is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with Sensorium. If not, see
16 | * .
17 | *
18 | *
19 | */
20 |
21 | package at.univie.sensorium;
22 |
23 | import java.text.SimpleDateFormat;
24 | import java.util.Date;
25 | import java.util.List;
26 | import java.util.Locale;
27 |
28 | import android.widget.TextView;
29 | import at.univie.sensorium.sensors.AbstractSensor;
30 | import at.univie.sensorium.sensors.SensorChangeListener;
31 | import at.univie.sensorium.sensors.SensorValue;
32 |
33 | public class SensorViewItem implements SensorChangeListener {
34 |
35 | private TextView textViewSensorValues;
36 | private TextView textViewSensorUnits;
37 | private TextView textViewSensorTypes;
38 | private TextView textViewSensorName;
39 | private TextView textViewSensorPrivacyLevel;
40 | private TextView textViewSensorTimestamp;
41 |
42 | public SensorViewItem(TextView sName, TextView sPrivacyLevel, TextView sTimestamp, TextView sValues, TextView sUnits, TextView sTypes) {
43 |
44 | this.textViewSensorValues = sValues;
45 | this.textViewSensorUnits = sUnits;
46 | this.textViewSensorTypes = sTypes;
47 | this.textViewSensorName = sName;
48 | this.textViewSensorPrivacyLevel = sPrivacyLevel;
49 | this.textViewSensorTimestamp = sTimestamp;
50 | }
51 |
52 | public void attachto(AbstractSensor sensor, List sensors) {
53 | for (AbstractSensor s : sensors)
54 | s.removeListener(this);
55 | sensor.addListener(this);
56 | }
57 |
58 | public void updateDisplay(AbstractSensor sensor) {
59 | StringBuilder sValues = new StringBuilder();
60 | StringBuilder sUnits = new StringBuilder();
61 | StringBuilder sTypes = new StringBuilder();
62 |
63 | List values = sensor.getSensorValues();
64 |
65 | for (SensorValue v : values) {
66 | if (v != null) {
67 | if (v.getType().equals(SensorValue.TYPE.TIMESTAMP)) {
68 | if(v.getValue() instanceof String){
69 | textViewSensorTimestamp.setText((String) v.getValue());
70 | } else {
71 | textViewSensorTimestamp.setText(new SimpleDateFormat("HH:mm", Locale.US).format(new Date((Long) v.getValue())));
72 | }
73 |
74 | continue;
75 | }
76 | sValues.append(v.getValueRepresentation()).append("\n");
77 | sUnits.append(v.getUnit().getName()).append("\n");
78 | sTypes.append(v.getType().getName()).append("\n");
79 | }
80 | }
81 | textViewSensorName.setText(sensor.getName());
82 |
83 | textViewSensorPrivacyLevel.setText(sensor.getSensorStateDescription());
84 | textViewSensorValues.setText(sValues.toString());
85 | textViewSensorUnits.setText(" " + sUnits.toString());
86 | textViewSensorTypes.setText(sTypes.toString());
87 | }
88 |
89 | @Override
90 | public void sensorUpdated(AbstractSensor sensor) {
91 | updateDisplay(sensor);
92 | }
93 |
94 | }
95 |
--------------------------------------------------------------------------------
/Sensorium/src/at/univie/sensorium/SensoriumActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Sensorium.
3 | *
4 | * Sensorium is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Sensorium is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with Sensorium. If not, see
16 | * .
17 | *
18 | *
19 | */
20 |
21 | package at.univie.sensorium;
22 |
23 | import java.util.List;
24 |
25 | import android.app.Activity;
26 | import android.app.AlertDialog;
27 | import android.content.DialogInterface;
28 | import android.content.Intent;
29 | import android.os.Bundle;
30 | import android.os.Handler;
31 | import android.text.Html;
32 | import android.text.method.LinkMovementMethod;
33 | import android.view.Menu;
34 | import android.view.MenuItem;
35 | import android.widget.ArrayAdapter;
36 | import android.widget.ListView;
37 | import android.widget.TextView;
38 | import at.univie.sensorium.preferences.Preferences;
39 | import at.univie.sensorium.preferences.SensorPreferenceActivity;
40 | import at.univie.sensorium.sensors.AbstractSensor;
41 |
42 | public class SensoriumActivity extends Activity {
43 |
44 | private ArrayAdapter listAdapter;
45 |
46 | @Override
47 | public void onCreate(Bundle savedInstanceState) {
48 | super.onCreate(savedInstanceState);
49 | setContentView(R.layout.seattle_sensors_main);
50 | //SensorServiceSingleton.getInstance().bindService(this);
51 |
52 | ListView sensorViewList = (ListView) findViewById(R.id.sensorValues);
53 | List sensors = SensorRegistry.getInstance().getSensors();
54 | listAdapter = new SensorViewArrayAdapter(this, sensors);
55 | sensorViewList.setAdapter(listAdapter);
56 |
57 |
58 | // showNagScreen();
59 | // new Handler().postDelayed(new Runnable() {
60 | //
61 | // public void run() {
62 | // showNagScreen();
63 | // }
64 | //
65 | // }, 5000);// 3 Seconds
66 | }
67 |
68 | @Override
69 | protected void onStart() {
70 | super.onStart();
71 |
72 | // Preferences prefs = SensorRegistry.getInstance().getPreferences();
73 | // if (prefs == null)
74 | // showNagScreen();
75 | // else if (prefs.getBoolean(Preferences.WELCOME_SCREEN_SHOWN, false) == false && prefs.newerPrefsAvailable())
76 | // showNagScreen();
77 | //
78 | new Handler().postDelayed(new Runnable() {
79 | public void run() {
80 | // showNagScreen();
81 | Preferences prefs = SensorRegistry.getInstance().getPreferences();
82 | if (prefs.getBoolean(Preferences.WELCOME_SCREEN_SHOWN, false) == false && prefs.newerPrefsAvailable())
83 | showNagScreen();
84 | }
85 | }, 2000);
86 | }
87 |
88 | public void onDestroy() {
89 | super.onDestroy();
90 | }
91 |
92 | public void onPause() {
93 | super.onPause();
94 | }
95 |
96 | public void onResume() {
97 | super.onResume();
98 | }
99 |
100 | @Override
101 | public boolean onCreateOptionsMenu(Menu menu) {
102 | getMenuInflater().inflate(R.menu.activity_main, menu);
103 | return true;
104 | }
105 |
106 | @Override
107 | public boolean onOptionsItemSelected(MenuItem item) {
108 | switch (item.getItemId()) {
109 | case R.id.menu_settings:
110 | startActivityForResult(new Intent(this, SensorPreferenceActivity.class), 0);
111 | return true;
112 | case R.id.menu_debug:
113 | startActivityForResult(new Intent(this, SensorDebugActivity.class), 0);
114 | return true;
115 | case R.id.menu_about:
116 | AlertDialog alertDialog;
117 | alertDialog = new AlertDialog.Builder(this).create();
118 | alertDialog.setTitle("About Sensorium");
119 | alertDialog.setMessage(Html.fromHtml("Sensorium shows you sensor information available on your device. It can also provide this data on external interfaces while attempting to preserve your privacy. You should take a look at the preferences to configure this to your needs. Visit https://github.com/fmetzger/android-sensorium for further information. Have fun!"));
120 | alertDialog.show();
121 | ((TextView)alertDialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
122 |
123 | return true;
124 | default:
125 | return super.onOptionsItemSelected(item);
126 | }
127 | }
128 |
129 |
130 | private void showNagScreen(){
131 |
132 | // only show the dialog if auto upload is actually enabled (even if we are on the first run)
133 | //final Preferences prefs = SensorRegistry.getInstance().getPreferences();
134 |
135 |
136 | final AlertDialog.Builder alertDialog = new AlertDialog.Builder(this);
137 | alertDialog.setTitle("Sensorium Data Upload");
138 | alertDialog.setIcon(R.drawable.ic_launcher);
139 | alertDialog.setMessage(Html.fromHtml("Sensorium is configured to automatically upload some of the gathered data to the Open3GMap server at the University of Vienna by default. If you do not want this, please disable it now."));
140 |
141 | alertDialog.setPositiveButton("Leave Enabled", new DialogInterface.OnClickListener() {
142 |
143 | @Override
144 | public void onClick(DialogInterface dialog, int which) {
145 | Preferences prefs = SensorRegistry.getInstance().getPreferences();
146 | prefs.putBoolean(Preferences.WELCOME_SCREEN_SHOWN, true);
147 | }
148 | });
149 |
150 | alertDialog.setNegativeButton("Disable", new DialogInterface.OnClickListener() {
151 |
152 | @Override
153 | public void onClick(DialogInterface dialog, int which) {
154 | Preferences prefs = SensorRegistry.getInstance().getPreferences();
155 | prefs.putBoolean(Preferences.UPLOAD_AUTOMATIC_PREF, false);
156 | prefs.putBoolean(Preferences.WELCOME_SCREEN_SHOWN, true);
157 | }
158 | });
159 |
160 | AlertDialog d = alertDialog.create();
161 | d.show();
162 | ((TextView) d.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
163 | }
164 | }
165 |
--------------------------------------------------------------------------------
/Sensorium/src/at/univie/sensorium/SensoriumApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Sensorium.
3 | *
4 | * Sensorium is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Sensorium is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with Sensorium. If not, see
16 | * .
17 | *
18 | *
19 | */
20 |
21 | package at.univie.sensorium;
22 |
23 | import android.app.Application;
24 | import android.content.ComponentName;
25 | import android.content.Context;
26 | import android.content.Intent;
27 | import android.content.ServiceConnection;
28 | import android.os.IBinder;
29 | import android.util.Log;
30 |
31 | public class SensoriumApplication extends Application {
32 | private SensorService sensorService;
33 | private boolean mIsBound = false;
34 |
35 | public void onCreate() {
36 | Log.d(SensorRegistry.TAG, "application starting, binding service");
37 | bindService();
38 | }
39 |
40 | public void onDestroy() {
41 | Log.d(SensorRegistry.TAG, "application exiting, unbinding service");
42 | unbindService();
43 | }
44 |
45 | private ServiceConnection mConnection = new ServiceConnection() {
46 | public void onServiceConnected(ComponentName className, IBinder service) {
47 | sensorService = ((SensorService.LocalBinder) service).getService();
48 | Log.d(SensorRegistry.TAG, "service connected");
49 | }
50 |
51 | public void onServiceDisconnected(ComponentName className) {
52 | sensorService = null;
53 | Log.d(SensorRegistry.TAG, "service disconnected");
54 | }
55 | };
56 |
57 | public void bindService() {
58 | if (!mIsBound) {
59 | Log.d(SensorRegistry.TAG, "application starting, binding service");
60 | bindService(new Intent(this, SensorService.class), mConnection, Context.BIND_AUTO_CREATE);
61 | mIsBound = true;
62 | }
63 | }
64 |
65 | public void unbindService() {
66 | if (mIsBound) {
67 | unbindService(mConnection);
68 | mIsBound = false;
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Sensorium/src/at/univie/sensorium/extinterfaces/XMLRPCSensorServerThread.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Sensorium.
3 | *
4 | * Sensorium is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Sensorium is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with Sensorium. If not, see
16 | * .
17 | *
18 | *
19 | */
20 |
21 | package at.univie.sensorium.extinterfaces;
22 |
23 | import java.io.PrintWriter;
24 | import java.io.StringWriter;
25 | import java.net.InetAddress;
26 | import java.net.ServerSocket;
27 | import java.net.Socket;
28 | import java.net.SocketTimeoutException;
29 | import java.util.ArrayList;
30 |
31 | import org.xmlrpc.android.MethodCall;
32 | import org.xmlrpc.android.XMLRPCServer;
33 |
34 | import android.util.Log;
35 | import at.univie.sensorium.SensorRegistry;
36 |
37 | public class XMLRPCSensorServerThread implements Runnable {
38 |
39 | public static final String SOCKET_ADDRESS = "127.0.0.1";
40 | private int[] portArray = new int[] { 63090, 63091, 63092, 63093, 63094, 63095, 63096, 63097, 63098, 63099 };
41 | public static int SOCKET_PORT;
42 | public static boolean running = false;
43 |
44 | private volatile boolean isstopped = false;
45 |
46 | public XMLRPCSensorServerThread() {
47 | }
48 |
49 | public void run() {
50 | running = true;
51 | isstopped = false;
52 | int i;
53 | for (i = 0; i < portArray.length; i++) { // TODO: this is the culprit
54 | // when trying to cancel the
55 | // thread (loops over the
56 | // next 10 ports and
57 | // blocking them before
58 | // failing
59 | if (isstopped) { // escape the loop if we stopped XMLRPC
60 | break;
61 | }
62 | SOCKET_PORT = portArray[i];
63 | Log.d(SensorRegistry.TAG, "XMLRPC Server bonding on port... " + SOCKET_PORT);
64 |
65 | try {
66 | InetAddress localhost = InetAddress.getLocalHost();
67 | ServerSocket socket = new ServerSocket(SOCKET_PORT, 10, localhost);
68 | socket.setSoTimeout(5000); // wait for 10s at max to allow
69 | // interrupting the thread
70 | XMLRPCServer server = new XMLRPCServer();
71 | Log.d(SensorRegistry.TAG, "XMLRPC Server listening on port " + SOCKET_PORT);
72 |
73 | SensorRegistry sensorregistry = SensorRegistry.getInstance();
74 |
75 | while (!isstopped) {
76 | try {
77 | Socket client = socket.accept();
78 | MethodCall call = server.readMethodCall(client);
79 | String name = call.getMethodName();
80 |
81 | if (name.equals("isSeattleSensor")) {
82 | server.respond(client, true);
83 | }
84 |
85 | else if (name.equals("system.methodSignature")) {
86 | ArrayList