Skip to content

Commit

Permalink
update framework
Browse files Browse the repository at this point in the history
  • Loading branch information
Jianming Zhou committed May 3, 2012
1 parent 21443a5 commit 25cc02e
Show file tree
Hide file tree
Showing 37 changed files with 2,560 additions and 178 deletions.
Binary file modified iOS/Alohar.framework/Versions/A/Alohar
Binary file not shown.
58 changes: 58 additions & 0 deletions iOS/Alohar.framework/Versions/A/Headers/ALMobileState.h
@@ -0,0 +1,58 @@
//
// ALMobileState.h
// Alohar
//
// Created by Jianming Zhou on 5/1/12.
// Copyright (c) 2012 Alohar Mobile Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

#define ALMobileStateUnknown 0
#define ALMobileStateNotMoving 1
#define ALMobileStateSlowMoving 2
#define ALMobileStateFastMoving 3

/*!
ALMobileState captures a high-level movement state of a mobile device which
is different from lower level motion state like ALMotionState. It is the
decision state Alohar SDK surfaced out based on various senor data like
accecelometer, location, wifi etc.
Imagine you leave your home in the morning, drive to your company campus then
walk to your office. The ALMobileState will capture the major movement state in between.
Using ALMobileStateDelegate, user will recieve updates from ALMobileStateNotMoving
to ALMobileStateFastMoving shortly after user is driving, updates from
ALMobileStateFastMoving to ALMobileStateSlowMoving after user arrives company
campus and starts to walk to the office, and updates from ALMobileStateSlowMoving
to ALMobileStateNotMoving once user arrives the office.
In general, slow moving is anything like walking or biking or low speed driving.
Fast moving usually means high speed driving. Different from motion state, mobile
state will skip small state changes in between. For example, if user drives and
stops at red light for short time, ALMotionDelegate might surface the stationary
motion state, but ALMobileStateDelgate might treat it still fast moving and
skip the change completely.
Currently, we support following mobile state:
ALMobileStateUnknown
Initial unknown state
ALMobileStateNotMoving
Users are at a user stay. Users might walk inside the user stay.
ALMobileStateSlowMoving
Users are on commute and users are moving at a relative slow speed like walking, biking or slow driving.
ALMobileStateFastMoving
Users are no commute and users are moving at high speed like high way driving.
*/
@interface ALMobileState : NSObject

/*!
*/
@property (nonatomic, strong) NSNumber *state;

/*!
*/
- (NSString *)stateDescription;
@end
24 changes: 16 additions & 8 deletions iOS/Alohar.framework/Versions/A/Headers/ALMotionState.h
Expand Up @@ -15,24 +15,32 @@
#define ALMotionStateRotation 4

/*!
ALMotionState class represents the motion state of the device.
We support following high-level motion state:
ALMotionStateStationary
ALMotionState class represents the motion state of the device. The state
captures the high-level motion state by smoothing raw accecelometer data.
We support following high-level motion state:
ALMotionStateStationary:
The device is not moving. e.g. device is put on desk
ALMotionStateWalking
ALMotionStateWalking:
The device is moving with small regular shakes, e.g device in user's pocket when user is walking
ALMotionStateSmoothMoving
ALMotionStateSmoothMoving:
The device is moving on a smooth surface. e.g. sliding on a desk or driving on highway
ALMotionStateRotation
ALMotionStateRotation:
The device has significant movement. e.g Waving or Rotating.
ALMotionStateNoData
ALMotionStateNoData:
Initial unknown state.
@warning The APIs are still in Beta quality. Feedbacks are welcome: support@alohar.com
*/
@interface ALMotionState : NSObject

/*!
*/
@property (nonatomic, strong) NSNumber *state;

/*!
*/
- (NSString *)stateDescription;

@end
38 changes: 20 additions & 18 deletions iOS/Alohar.framework/Versions/A/Headers/ALResponse.h
Expand Up @@ -29,24 +29,26 @@ typedef enum {
typedef NSUInteger ALRequestType;

/*!
* ALResponse class declare a common protocol to process
* Alohar response.
*
* The response has three main parts:
* + timeStamp The time the response is returned.
* + requestType The type of the request type.
* + objects The payload of the response
*
* ALResponse has following request types:
* ```
* enum {
* kALRequestTypeUserStays,
* kALRequestTypePlaces,
* kALRequestTypeMotionState,
* kALRequestTypeStayDetail,
* kALRequestTypePlaceDetail,
* }
* ```
ALResponse class declare a common protocol to process
Alohar response.
The response has three main parts:
+ timeStamp The time the response is returned.
+ requestType The type of the request type.
+ objects The payload of the response
ALResponse has following request types:
enum {
kALRequestTypeUserStays,
kALRequestTypePlaces,
kALRequestTypeMotionState,
kALRequestTypeStayDetail,
kALRequestTypePlaceDetail,
}
*/
@interface ALResponse : NSObject

Expand Down
2 changes: 1 addition & 1 deletion iOS/Alohar.framework/Versions/A/Headers/ALUserStay.h
Expand Up @@ -16,7 +16,7 @@
* includes a list of Place candidates ranked. The best match will be
* chosen as the selectedPlace.
*
* The startTime/endTime records the start/end of the stay. The centroid
* The startTime, endTime records the start/end of the stay. The centroid
* location is the location Alohar detected for that stay, which is not
* necessary equivalent to the location of the selected place.
*
Expand Down
90 changes: 74 additions & 16 deletions iOS/Alohar.framework/Versions/A/Headers/Alohar.h
Expand Up @@ -3,6 +3,7 @@
// Alohar
//
// Created by Sam Warmuth on 2/23/12.
// Last Updated by Jianming Zhou on 5/3/2012.
// Copyright (c) 2012 Alohar Mobile Inc.. All rights reserved.
//

Expand All @@ -12,17 +13,17 @@
#import <CoreLocation/CoreLocation.h>
#import "ALPlace.h"
#import "ALUserStay.h"
#import "ALMobileState.h"

/*!
Complete handler block for Alohar Requests
if success, ALResponse instance will be set, otherwise error will be thrown
* Complete handler block for Alohar Requests
* if success, ALResponse instance will be set, otherwise error will be thrown
*/

typedef void (^ALRequestCompleteBlock)(ALResponse*, NSError*);

/*!
Block alternative for ALSessionDelegate
if success, userToken will be returned, otherwise error will be thrown
* Block alternative for ALSessionDelegate
* if success, userToken will be returned, otherwise error will be thrown
*/
typedef void (^ALSessionCompleteBlock)(NSString*, NSError*);

Expand Down Expand Up @@ -55,9 +56,26 @@ typedef void (^ALSessionCompleteBlock)(NSString*, NSError*);
* @see ALMotionState
*/
- (void)didUpdateToMotionState:(ALMotionState *)newMotionState fromMotionState:(ALMotionState *)oldMotionState;
- (void)aloharDidFailWithError:(NSError *)error;

@end


/*!
* Protocol to listen to high level mobile state updates.
* \param newMobileState New mobile state
* \param oldMobileState Old mobile state
*/
@protocol ALMobileStateDelegegate <NSObject>
@optional

/*!
* Callback when mobile state changes
* \param newMobileState New Mobile State
* \param oldMobileState Old Mobile State
*/
- (void)didUpdateToMobileState:(ALMobileState *)newMobileState fromMobileState:(ALMobileState *)oldMobileState;

@end
/*!
* Protocol to listen to real time events such as arrival, departure and user stay detection.
*/
Expand Down Expand Up @@ -109,23 +127,23 @@ enum {
*
*/
@interface Alohar : NSObject

@property (weak) id <ALSessionDelegate> sessionDelegate;
@property (weak) id <ALMotionDelegate> motionDelegate;
@property (weak) id <ALUserStayDelegate> userStayDelegate;

@property (weak) id <ALMobileStateDelegegate> mobileStateDelegate;
@property (nonatomic, strong) ALMotionState *currentMotionState;
@property (nonatomic, strong) ALMobileState *currentMobileState;


/** @name Initialization */

/*!
* Get the Shared Instance of Alohar
*/
+ (Alohar *)sharedInstance;

/*!
* Get Framework Version
* \return The version of Alohar Framework
*/
+ (NSString *)version;
/** @name Registration/Authentication */

/*!
* Register a new user for a given App using delegate
Expand Down Expand Up @@ -169,6 +187,8 @@ enum {
*/
+ (void)authenticateWithAppID:(NSString *)appID andAPIKey:(NSString *)APIKey andUserID:(NSString *)userID completeHandler:(ALSessionCompleteBlock)handler;

/** @name Monitering Serive Life Cycle */

/*!
* Start the monitoring service
*/
Expand All @@ -179,9 +199,31 @@ enum {
*/
+ (void)stopMonitoringUser;

/** @name Delegates */

/*!
* Set Motion State Delegate
* \param delegate A delegate that conforms to the ALMotionDelegate
*
*/
+ (void)setMotionDelegate:(id <ALMotionDelegate>)delegate;

/*!
* Set User Stay Delegate
* \param delegate A delegate that conforms to the ALUserStayDelegate
*
*/
+ (void)setUserStayDelegate:(id <ALUserStayDelegate>)delegate;

/*!
* Set Mobile State Delegate
* \param delegate A delegate that conforms to the ALMobileStateDelegate
*
*/
+ (void)setMobileStateDelegate:(id<ALMobileStateDelegegate>)delegate;

/** @name Place/User Stay Retrieval Methods */

/*!
* Get the current user stay object
* @see ALUserStay
Expand Down Expand Up @@ -286,7 +328,7 @@ enum {
* \param stayId The user stay's stayId
* \param handler The complete handler block with ALResponse or Error.
*/
+ (void)deletateStay:(NSInteger)stayId completeHandler:(ALRequestCompleteBlock)handler;
+ (void)deleteStay:(NSInteger)stayId completeHandler:(ALRequestCompleteBlock)handler;

/*!
* Get the place candidates of a user stay.
Expand Down Expand Up @@ -320,10 +362,13 @@ enum {
*/
+ (void)getDetailsForStay:(NSInteger)stayId completeHandler:(ALRequestCompleteBlock)handler;


/** @name State Methods */

/*!
* Get the user's current location.
*
* Note: the current location is the last known location of the device in SDK.
* @warning *important* the current location is the last known location of the device in SDK.
* If the monitoring service is stopped, the location will be stale. When the monitoring
* service is running, it is close to the real current location in most cases. But it
* is NOT a replacement for the current location of native LocationManager.
Expand All @@ -336,6 +381,13 @@ enum {
*/
+ (ALMotionState *)currentMotionState;

/*!
* Get the device's current mobile state.
* @see ALMobileState
*/
+ (ALMobileState *)currentMobileState;


/*!
* Check whether the device is stationary.
* \return YES if the device is NOT moving
Expand All @@ -350,7 +402,7 @@ enum {

/*!
* Check whether the Alohar monitoring service is running.
\return YES if the monitoring service is ON
* \return YES if the monitoring service is ON
*/
+ (BOOL)monitoringUser;

Expand All @@ -360,6 +412,12 @@ enum {
*/
+ (BOOL)isLoggedIn;

/*!
* Get Framework Version
* \return The version of Alohar Framework
*/
+ (NSString *)version;

/*!
* History of arrival/departure events.
* \return Array of events
Expand All @@ -386,8 +444,8 @@ enum {

- (void)arriveLocation;

- (void)mobileStateChanged:(ALMobileState *)newMobileState;

//PRIVATE
+ (NSArray *)logs;

@end
Expand Down
Binary file modified iOS/Alohar.framework/Versions/A/Resources/Info.plist
Binary file not shown.
2 changes: 1 addition & 1 deletion iOS/aloharDemo/ADPlaceDetailViewController.m
Expand Up @@ -111,7 +111,7 @@ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)butto
case 0:
break;
case 1:
[Alohar deletateStay:self.stay.stayID completeHandler:^(ALResponse *response, NSError *error) {
[Alohar deleteStay:self.stay.stayID completeHandler:^(ALResponse *response, NSError *error) {
[self.navigationController popViewControllerAnimated:YES];
}];
break;
Expand Down
Expand Up @@ -446,7 +446,7 @@ <h4 class="method-subtitle">Declared In</h4>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2012 Alohar Mobile. All rights reserved. (Last updated: 2012-04-27)</span><br />
<p><span class="copyright">&copy; 2012 Alohar Mobile. All rights reserved. (Last updated: 2012-05-03)</span><br />

<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.0.5 (build 789)</a>.</span></p>

Expand Down

0 comments on commit 25cc02e

Please sign in to comment.