You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-10Lines changed: 26 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,33 +5,40 @@ An iOS library that provides Continuous Sensing functionality to your applicatio
5
5
6
6
## Supported Sensors
7
7
8
-
The following sensor modules are currently supported in SensingKit-Android, (listed in [SKSensorModuleType](SensingKit/SKSensorModuleType.h) enum):
8
+
The following mobile sensors are currently supported in SensingKit-iOS, (listed in [SKSensorType](SensingKit/SKSensorType.h) enum):
9
9
10
10
- Accelerometer
11
11
- Gyroscope
12
12
- Magnetometer
13
13
- Device Motion (senses Attitude, Gravity, User Acceleration, Magnetic Field, Rotation)
14
-
- Activity
14
+
-Motion Activity
15
15
- Pedometer
16
16
- Altimeter
17
17
- Battery
18
18
- Location
19
19
- iBeacon™ Proximity
20
20
- Eddystone™ Proximity
21
+
- Microphone
21
22
22
23
23
24
## Configuring the Library
24
25
26
+
You can always skip this step by downloading the released version of SensingKit-iOS from [here](https://github.com/SensingKit/SensingKit-iOS/releases).
27
+
28
+
In case you want to build the library yourself:
29
+
25
30
- Open SensingKit project in Xcode and build SensingKit library using Product -> Build.
26
31
27
32
- Choose the ‘Framework’ scheme from the top toolbar (or using Product -> Scheme -> Framework) and build the framework. SensingKit.framework file should be available in your desktop.
28
33
29
-
- Move the generated SensingKit.framework file into your new Xcode project.
30
34
35
+
## Using the Library
36
+
37
+
- First, you need to move the generated SensingKit.framework file into your new Xcode project.
31
38
32
-
## How to Use this Library
39
+
- Since SensingKit-iOS uses Categories internally, you need to add the ’-ObjC’ flag into your project build settings. Open your project, select your project from the Project Navigator on the left and click on the app’s target. Select the Build Settings tab on the top of the screen and search for “Other Linker Flags”. Finally, click the + button and add ‘-ObjC’ as a new property on the list.
33
40
34
-
- Import and init SensingKit into your Activity class as shown bellow:
41
+
- Import and init SensingKit as shown bellow:
35
42
36
43
```objectivec
37
44
#import<SensingKit/SensingKitLib.h>
@@ -46,18 +53,27 @@ The following sensor modules are currently supported in SensingKit-Android, (lis
46
53
```
47
54
48
55
49
-
- Register a sensor module (e.g. a Battery sensor) as shown bellow:
56
+
- Check if a sensor is available in the device:
57
+
58
+
```objectivec
59
+
if ([self.sensingKit isSensorAvailable:Battery]) {
60
+
// You can access the sensor
61
+
}
62
+
```
63
+
64
+
65
+
- Register a sensor (e.g. a Battery sensor) as shown bellow:
50
66
51
67
```objectivec
52
-
[self.sensingKit registerSensorModule:Battery];
68
+
[self.sensingKit registerSensor:Battery];
53
69
```
54
70
55
71
56
-
- Subscribe a sensor data listener. You can cast the data object into the actual sensor data object in order to access all the sensor data properties:
72
+
- Subscribe a sensor data handler. You can cast the data object into the actual sensor data object in order to access all the sensor data properties:
// Copyright (c) 2014. Queen Mary University of London
6
+
// Kleomenis Katevas, k.katevas@qmul.ac.uk
7
+
//
8
+
// This file is part of SensingKit-iOS library.
9
+
// For more information, please visit http://www.sensingkit.org
10
+
//
11
+
// SensingKit-iOS is free software: you can redistribute it and/or modify
12
+
// it under the terms of the GNU Lesser General Public License as published by
13
+
// the Free Software Foundation, either version 3 of the License, or
14
+
// (at your option) any later version.
15
+
//
16
+
// SensingKit-iOS is distributed in the hope that it will be useful,
17
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+
// GNU Lesser General Public License for more details.
20
+
//
21
+
// You should have received a copy of the GNU Lesser General Public License
22
+
// along with SensingKit-iOS. If not, see <http://www.gnu.org/licenses/>.
23
+
//
24
+
25
+
#import<Foundation/Foundation.h>
26
+
#import"SKSensorType.h"
27
+
28
+
NS_ASSUME_NONNULL_BEGIN
29
+
30
+
/**
31
+
* NSString+SKSensorType is a category responsible for converting an SKSensorType enum into string.
32
+
*/
33
+
@interfaceNSString (SKSensorType)
34
+
35
+
/**
36
+
* Converts an SKSensorType enum into a string.
37
+
* This method is useful when you want to use the sensor name in the application's User Interface. The returned string might contain spaces or special characters (such as '™'). For example, iBeacon™ Proximity sensor (enum iBeaconProximity) will be returned as "iBeacon™ Proximity".
38
+
*
39
+
* @param sensorType The type of the sensor.
40
+
*
41
+
* @return A string with the sensor name. (e.g. "iBeacon™ Proximity").
* Converts an SKSensorType enum into a non-spaced string that does not include special characters.
47
+
* This method is useful when you want to use the sensor name in file or directory names. The returned string does not contain spaces or any special character (such as '™'). For example, iBeacon™ Proximity sensor (enum iBeaconProximity) will be returned as "iBeaconProximity".
48
+
*
49
+
* @param sensorType The type of the sensor.
50
+
*
51
+
* @return A non-spaced string with the sensor name. (e.g. "iBeaconProximity").
0 commit comments