motion-sensoro 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +61 -0
- data/lib/android/sensoro_beacon_manager.rb +61 -0
- data/lib/ios/sensoro_beacon_manager.rb +58 -0
- data/lib/motion-sensoro.rb +22 -0
- data/lib/sensoro_beacon.rb +18 -0
- data/vendor/android/android-async-http-1.4.6.jar +0 -0
- data/vendor/android/greendao-1.3.7.jar +0 -0
- data/vendor/android/gson-2.3.1.jar +0 -0
- data/vendor/android/sensoro-scanner-1.0.1.jar +0 -0
- data/vendor/android/sensorobeaconkit-4.1.1.jar +0 -0
- data/vendor/android/sensorocloud-4.1.1.jar +0 -0
- data/vendor/ios/Headers/SBKBeacon.h +765 -0
- data/vendor/ios/Headers/SBKBeaconID.h +132 -0
- data/vendor/ios/Headers/SBKBeaconManager+Cloud.h +15 -0
- data/vendor/ios/Headers/SBKBeaconManager.h +273 -0
- data/vendor/ios/Headers/SBKConstants.h +394 -0
- data/vendor/ios/Headers/SBKError.h +74 -0
- data/vendor/ios/Headers/SBKUnitConvertHelper.h +85 -0
- data/vendor/ios/Headers/SIKBeacon.h +45 -0
- data/vendor/ios/Headers/SIKError.h +20 -0
- data/vendor/ios/Headers/SIKManager.h +120 -0
- data/vendor/ios/Headers/SIKUser.h +138 -0
- data/vendor/ios/libSensoroBeaconKit.a +0 -0
- data/vendor/ios/libSensoroCloud.a +0 -0
- metadata +70 -0
@@ -0,0 +1,74 @@
|
|
1
|
+
//
|
2
|
+
// SBKError.h
|
3
|
+
// Sensoro Beacon Kit
|
4
|
+
//
|
5
|
+
// Created by Blankwonder on 6/20/14.
|
6
|
+
// Copyright (c) 2014 Sensoro Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
|
11
|
+
/**
|
12
|
+
* Indicates an error occurred in Sensoro Beacon Kit.
|
13
|
+
*/
|
14
|
+
extern NSString * const SBKErrorDomain;
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Error codes for the Sensoro Beacon Kit error domain.
|
18
|
+
*/
|
19
|
+
enum {
|
20
|
+
/**
|
21
|
+
* Indicates that an unknown or unexpected error occurred.
|
22
|
+
*/
|
23
|
+
SBKErrorUnknownError = 0,
|
24
|
+
|
25
|
+
/**
|
26
|
+
* The connection failed.
|
27
|
+
*/
|
28
|
+
SBKErrorConnectionFailed = 10000,
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Unexpected disconnection occurred.
|
32
|
+
*/
|
33
|
+
SBKErrorUnexpectedDisconnect = 10010,
|
34
|
+
|
35
|
+
/**
|
36
|
+
* The bluetooth is power off.
|
37
|
+
*/
|
38
|
+
SBKErrorBluetoothPowerOff = 10020,
|
39
|
+
|
40
|
+
/**
|
41
|
+
* The attribute’s value cannot be written.
|
42
|
+
*/
|
43
|
+
SBKErrorWriteNotPermitted = 11000,
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Unsupport feature.
|
47
|
+
*/
|
48
|
+
SBKErrorUnsupport = 11010,
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Indicates that the data is not valid.
|
52
|
+
*/
|
53
|
+
SBKErrorInvalidData = 11020,
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Authorization failed.
|
57
|
+
*/
|
58
|
+
SBKErrorAuthorizationFailed = 12000,
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Device on beacon is busy.
|
62
|
+
*/
|
63
|
+
SBKErrorDeviceBusy = 13000,
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Bluetooth error in communication with beacon.
|
67
|
+
*/
|
68
|
+
SBKErrorDeviceBLE = 13001,
|
69
|
+
|
70
|
+
/**
|
71
|
+
* System error on beacon.
|
72
|
+
*/
|
73
|
+
SBKErrorDeviceSystem = 13002,
|
74
|
+
};
|
@@ -0,0 +1,85 @@
|
|
1
|
+
//
|
2
|
+
// SBKUnitConvertHelper.h
|
3
|
+
// Sensoro Beacon Kit
|
4
|
+
//
|
5
|
+
// Created by David Yang on 14/12/26.
|
6
|
+
// Copyright (c) 2014年 Sensoro Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
#import "SBKConstants.h"
|
11
|
+
|
12
|
+
@class SBKBeacon;
|
13
|
+
|
14
|
+
/**
|
15
|
+
* The SBKUnitConvertHelper class is a utitlity tool class to help developer to convert enum to a readable text
|
16
|
+
* or value.
|
17
|
+
*
|
18
|
+
*/
|
19
|
+
@interface SBKUnitConvertHelper : NSObject
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Get the radius of beacon's region, unit is meter.
|
23
|
+
*
|
24
|
+
* @param beacon which beacon.
|
25
|
+
*
|
26
|
+
* @return the radius of region, unit is meter.
|
27
|
+
*/
|
28
|
+
+ (float) rangeRadiusOfBeacon: (SBKBeacon *) beacon;
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Get transmit power of beacon, unit is dBm.
|
32
|
+
*
|
33
|
+
* @param beacon which beacon.
|
34
|
+
*
|
35
|
+
* @return transmit power of beacon.
|
36
|
+
*/
|
37
|
+
+ (short) transmitPowerToRawValue: (SBKBeacon *) beacon;
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Get broadcast interval of beacon, unit is ms.
|
41
|
+
*
|
42
|
+
* @param beacon which beacon.
|
43
|
+
*
|
44
|
+
* @return broadcast interval of beacon.
|
45
|
+
*/
|
46
|
+
+ (float) frequencyToRawValue: (SBKBeacon *) beacon;
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Get descripton of transmit power of beacon.
|
50
|
+
*
|
51
|
+
* @param beacon which beacon.
|
52
|
+
*
|
53
|
+
* @return descripton of transmit power of beacon.
|
54
|
+
*/
|
55
|
+
+ (NSString*) transmitPowerToString: (SBKBeacon *) beacon;
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Get description of broadcast interval of beacon.
|
59
|
+
*
|
60
|
+
* @param beacon which beacon.
|
61
|
+
*
|
62
|
+
* @return description of broadcast interval of beacon.
|
63
|
+
*/
|
64
|
+
+ (NSString*) frequencyToString: (SBKBeacon *) beacon;
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Flag to indicator whether the beacon use micro antenna.
|
68
|
+
*
|
69
|
+
* @param beacon which beacon.
|
70
|
+
*
|
71
|
+
* @return YES : use micro antenna, NO : use normal antenna.
|
72
|
+
*/
|
73
|
+
+ (BOOL)isMicroTX:(SBKBeacon *) beacon;
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Convert a url to eddystone encode data.
|
77
|
+
*
|
78
|
+
* @param url url to convert.
|
79
|
+
*
|
80
|
+
* @return nil : failed, otherwise : OK.
|
81
|
+
*/
|
82
|
+
+ (NSData*)urlToEddystoneEncodeURL:(NSString*) url;
|
83
|
+
|
84
|
+
|
85
|
+
@end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
//
|
2
|
+
// SIKBeacon.h
|
3
|
+
// Sensoro Beacon Kit
|
4
|
+
//
|
5
|
+
// Created by Blankwonder on 6/12/14.
|
6
|
+
// Copyright (c) 2014 Sensoro Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
#import "SBKBeacon.h"
|
11
|
+
|
12
|
+
/**
|
13
|
+
* The SIKBeacon class defines the interface of a sensoro beacon device. You can use instances of this class to get rssi, sensor data or configurate device settings. You do not create instances of this class directly. Use SBKBeaconManager to get SBKBeacon instances.
|
14
|
+
*
|
15
|
+
* The identity of a beacon is defined by its beaconID properties.
|
16
|
+
*/
|
17
|
+
@interface SIKBeacon : NSObject
|
18
|
+
|
19
|
+
/**---------------------------------------------------------------------------------------
|
20
|
+
* @name SIKBeacon Properties
|
21
|
+
* ---------------------------------------------------------------------------------------
|
22
|
+
*/
|
23
|
+
|
24
|
+
/**
|
25
|
+
* The beacon's name in SENSORO Cloud's App
|
26
|
+
*/
|
27
|
+
@property (readonly, nonatomic, copy) NSString * name;
|
28
|
+
|
29
|
+
/**
|
30
|
+
* The beacon's custom config infomation
|
31
|
+
*/
|
32
|
+
@property (readonly, nonatomic, strong) NSDictionary *metadata;
|
33
|
+
|
34
|
+
/**
|
35
|
+
* The beacon's identifier
|
36
|
+
* @discussion also use beacon's UMM as it's identifier
|
37
|
+
*/
|
38
|
+
@property (readonly, nonatomic, copy) NSString * identifier;
|
39
|
+
|
40
|
+
/**
|
41
|
+
* The beacon's device data , is SBKBeacon object show beacon's infomation
|
42
|
+
*/
|
43
|
+
@property (readonly, nonatomic, strong) SBKBeacon * device;
|
44
|
+
|
45
|
+
@end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
//
|
2
|
+
// SIKError.h
|
3
|
+
// Sensoro Beacon Kit
|
4
|
+
//
|
5
|
+
// Created by Blankwonder on 6/20/14.
|
6
|
+
// Copyright (c) 2014 Sensoro Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
|
11
|
+
extern NSString * const SIKErrorDomain;
|
12
|
+
/**
|
13
|
+
SIKError state code
|
14
|
+
*/
|
15
|
+
enum {
|
16
|
+
SIKErrorUnknownError = 0,
|
17
|
+
SIKErrorUnauthorizedError = 401,
|
18
|
+
SIKErrorNotFoundError = 404,
|
19
|
+
|
20
|
+
};
|
@@ -0,0 +1,120 @@
|
|
1
|
+
//
|
2
|
+
// SIKManager.h
|
3
|
+
// Sensoro Intelligence Kit
|
4
|
+
//
|
5
|
+
// Created by Blankwonder on 6/25/14.
|
6
|
+
// Copyright (c) 2014 Sensoro Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
//#import "SIKBeaconManager.h"
|
11
|
+
#import "SIKUser.h"
|
12
|
+
#import "SIKError.h"
|
13
|
+
|
14
|
+
|
15
|
+
/// the block as a callback when app fetch SENSOROCloud configs from remote
|
16
|
+
typedef void (^SIKManagerCompletionBlock)(BOOL succeeded, NSError *error);
|
17
|
+
|
18
|
+
/**
|
19
|
+
* The SIKManager class defines the interface for connecting to SENSORO Cloud to your application. You use an instance of this class to get SIKUser objects, and reset an instance of this class data;
|
20
|
+
* You should always use the shared instance. Creating own instance is not allowed.
|
21
|
+
*/
|
22
|
+
@interface SIKManager : NSObject
|
23
|
+
|
24
|
+
/**
|
25
|
+
* SIKManager instance, Users are not allowed to create own instance.
|
26
|
+
*
|
27
|
+
* @return the shared instance of the SIKManager class.
|
28
|
+
*/
|
29
|
+
+ (instancetype)sharedInstance;
|
30
|
+
|
31
|
+
|
32
|
+
/**---------------------------------------------------------------------------------------
|
33
|
+
* @name Initiating Beacon Ranging
|
34
|
+
* ---------------------------------------------------------------------------------------
|
35
|
+
*/
|
36
|
+
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Sets the applicationId and clientKey of your application.
|
40
|
+
*
|
41
|
+
* @param applicationKey The applicaiton key for your SENSORO Cloud application.
|
42
|
+
* @param secret Sets the secret of your SENSORO Cloud application.
|
43
|
+
*/
|
44
|
+
- (void)setApplicationKey:(NSString *)applicationKey
|
45
|
+
secret:(NSString *)secret;
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
/**
|
50
|
+
* set monitorBackgoundMode, in backgroundMode, In Appdelegate didFinishLaunchingWithOptions method should add
|
51
|
+
*
|
52
|
+
* @param enable support backgroundMode or not
|
53
|
+
*/
|
54
|
+
- (void)monitorRangionInBackgroundTask:(BOOL)enable;
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Stop monitor rangion for SIKManager, just stop monitor beacons in your account
|
58
|
+
*/
|
59
|
+
- (void)stopMonitorRangion;
|
60
|
+
|
61
|
+
/**
|
62
|
+
* callback for SIKManager, when fetch data from SENSOROCloud completely, the block should have the following argument signature: (BOOL succeeded, NSError *error)
|
63
|
+
*/
|
64
|
+
@property (nonatomic, copy) SIKManagerCompletionBlock complete;
|
65
|
+
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Current SIKBeacons in SENSOROCloud
|
69
|
+
*
|
70
|
+
* @return current SIKBeacons
|
71
|
+
*/
|
72
|
+
- (NSDictionary *)currentBeacons;
|
73
|
+
|
74
|
+
|
75
|
+
/**---------------------------------------------------------------------------------------
|
76
|
+
* @name SIKManager SIKUser
|
77
|
+
* ---------------------------------------------------------------------------------------
|
78
|
+
*/
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Accessing the Current User,Gets the currently logged in user from memory and returns an instance of it.
|
82
|
+
*
|
83
|
+
* @return a SIKUser that is the currently logged in user. If there is none, returns nil.
|
84
|
+
*/
|
85
|
+
+ (SIKUser *)currentUser;
|
86
|
+
|
87
|
+
/**
|
88
|
+
* Reset user's data to initial value
|
89
|
+
*/
|
90
|
+
+ (void)resetUser;
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
/**---------------------------------------------------------------------------------------
|
95
|
+
* @name SIKManager Debug
|
96
|
+
* ---------------------------------------------------------------------------------------
|
97
|
+
*/
|
98
|
+
|
99
|
+
/**
|
100
|
+
* SIK release version
|
101
|
+
*
|
102
|
+
* @return version String
|
103
|
+
*/
|
104
|
+
+ (NSString*) version;
|
105
|
+
|
106
|
+
/**
|
107
|
+
* SIK debug build version
|
108
|
+
*
|
109
|
+
* @return build version String
|
110
|
+
*/
|
111
|
+
+ (NSUInteger) buildVersion;
|
112
|
+
|
113
|
+
/**
|
114
|
+
* DebugMode
|
115
|
+
*
|
116
|
+
* @param active enable Debug
|
117
|
+
*/
|
118
|
+
+ (void)setDebugModeActive:(BOOL)active;
|
119
|
+
|
120
|
+
@end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
//
|
2
|
+
// SIKUser.h
|
3
|
+
// Sensoro Intelligence Kit
|
4
|
+
//
|
5
|
+
// Created by Blankwonder on 6/25/14.
|
6
|
+
// Copyright (c) 2014 Sensoro Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
|
11
|
+
/**
|
12
|
+
* SIKUserGender type
|
13
|
+
*/
|
14
|
+
typedef NS_ENUM(NSInteger, SIKUserGender){
|
15
|
+
/**
|
16
|
+
* Unknown
|
17
|
+
*/
|
18
|
+
SIKUserGenderUnknown,
|
19
|
+
/**
|
20
|
+
* Male
|
21
|
+
*/
|
22
|
+
SIKUserGenderMale,
|
23
|
+
/**
|
24
|
+
* Female
|
25
|
+
*/
|
26
|
+
SIKUserGenderFemale
|
27
|
+
};
|
28
|
+
|
29
|
+
|
30
|
+
/**
|
31
|
+
* SENSOROCloud supported SNS Platform types currently
|
32
|
+
*/
|
33
|
+
typedef NS_ENUM(NSInteger, SIKUserSNSType){
|
34
|
+
/// weibo
|
35
|
+
SIKUserSNSTypeWeibo,
|
36
|
+
|
37
|
+
/// weChat
|
38
|
+
SIKUserSNSTypeWeChat,
|
39
|
+
|
40
|
+
/// Twitter
|
41
|
+
SIKUserSNSTypeTwitter,
|
42
|
+
|
43
|
+
/// Facebook
|
44
|
+
SIKUserSNSTypeFacebook
|
45
|
+
};
|
46
|
+
|
47
|
+
|
48
|
+
/*!
|
49
|
+
A SENSORO Cloud Framework User Object that is a local representation of a user persisted to the SENSORO Cloud.
|
50
|
+
It is the functionality of SENSORO Analysis, It synchronize data to the cloud automatically, also support SNS platform like weibo、weChat、Twitter、Facebook
|
51
|
+
*/
|
52
|
+
@interface SIKUser : NSObject
|
53
|
+
|
54
|
+
/**---------------------------------------------------------------------------------------
|
55
|
+
* @name SIKUser Properties
|
56
|
+
* ---------------------------------------------------------------------------------------
|
57
|
+
*/
|
58
|
+
|
59
|
+
|
60
|
+
/**
|
61
|
+
* The unique identifier for the SIKUser
|
62
|
+
*
|
63
|
+
* The identifier is created when user first launch app, or retrieve identifier from PersistentStore
|
64
|
+
*/
|
65
|
+
@property (nonatomic, copy) NSString *identifier;
|
66
|
+
|
67
|
+
/// The name for the SIKUser.
|
68
|
+
@property (nonatomic, copy) NSString *name;
|
69
|
+
|
70
|
+
/// The email for the SIKUser.
|
71
|
+
@property (nonatomic, copy) NSString *email;
|
72
|
+
|
73
|
+
/// The gender for the SIKUser.
|
74
|
+
@property (nonatomic, assign) SIKUserGender gender;
|
75
|
+
|
76
|
+
/// The avatar's URL for the SIKUser.
|
77
|
+
@property (nonatomic, copy) NSString *avatarURL;
|
78
|
+
|
79
|
+
|
80
|
+
/**---------------------------------------------------------------------------------------
|
81
|
+
* @name SIKUser Tags
|
82
|
+
* ---------------------------------------------------------------------------------------
|
83
|
+
*/
|
84
|
+
|
85
|
+
/**
|
86
|
+
* Add SIKUser tags
|
87
|
+
*
|
88
|
+
* @param tags to add SIKUser's tags contents
|
89
|
+
*/
|
90
|
+
- (void)addUserTags:(NSArray *)tags;
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Remove SIKUser tags
|
94
|
+
*
|
95
|
+
* @param tags to remove SIKUser's tags contents
|
96
|
+
*/
|
97
|
+
- (void)removeUserTags:(NSArray *)tags;
|
98
|
+
|
99
|
+
/**
|
100
|
+
* The tags for SIKUser
|
101
|
+
*
|
102
|
+
* @return SIKUser's tags contents
|
103
|
+
*/
|
104
|
+
- (NSArray *)userTags;
|
105
|
+
|
106
|
+
/// Remove SIKUser all tags
|
107
|
+
- (void)removeAllUserTags;
|
108
|
+
|
109
|
+
|
110
|
+
/**---------------------------------------------------------------------------------------
|
111
|
+
* @name SIKUser SNS
|
112
|
+
* ---------------------------------------------------------------------------------------
|
113
|
+
*/
|
114
|
+
|
115
|
+
|
116
|
+
/**
|
117
|
+
* Set SIKUser SocialNetwork Infomation
|
118
|
+
*
|
119
|
+
* @param userId userId
|
120
|
+
* @param displayName displayName
|
121
|
+
* @param additionalInfo additional Infomation
|
122
|
+
* @param platform platform type
|
123
|
+
*/
|
124
|
+
- (void)setSocialNetowrkInfoWithUserId:(NSString *)userId
|
125
|
+
displayName:(NSString *)displayName
|
126
|
+
additionalInfo:(NSDictionary *)additionalInfo
|
127
|
+
forPlatform:(SIKUserSNSType)platform;
|
128
|
+
|
129
|
+
/**
|
130
|
+
* Fetch specified SNSPlatform info
|
131
|
+
*
|
132
|
+
* @param platform SNSPlatform type
|
133
|
+
*
|
134
|
+
* @return SIKUser's specified SNSPlatform info
|
135
|
+
*/
|
136
|
+
- (NSDictionary *)SNSInfoForPlatform:(SIKUserSNSType)platform;
|
137
|
+
|
138
|
+
@end
|