MBMapkit
/Users/dongkui/ios_api/branches/1.0.x/code/config/MBMapDemo/MBMapkit/MBMapkit/MBNetService.h
00001 //
00002 //  MBNetService.h
00003 //  MBMapKit
00004 //
00005 //  Created by chendl@mapbar.com
00006 //  Copyright 2011年 Mapbar Inc. All rights reserved.
00007 //
00008 
00009 #import <UIKit/UIKit.h>
00010 #import <CoreLocation/CoreLocation.h>
00011 #import <Foundation/Foundation.h>
00012 
00016 extern NSString* kMBNetServiceConstraint_lowTransfer;
00017 
00021 extern NSString* kMBNetServiceConstraint_fast;
00022 
00026 extern NSString* kMBNetServiceConstraint_lowWalk;
00027 
00031 extern NSString* kMBNetServiceConstraint_lowDistance;
00032 
00036 extern NSString* kMBNetServiceConstraint_lowCost;
00037 
00038 
00042 typedef enum MBNetServiceActionType {
00046     MBNetServiceActionType_start,
00047     
00051     MBNetServiceActionType_walk,
00052     
00056     MBNetServiceActionType_bus,
00057     
00061     MBNetServiceActionType_metro,
00062     
00066     MBNetServiceActionType_move,
00067     
00071     MBNetServiceActionType_end
00072 } MBNetServiceActionType;
00073 
00074 
00078 typedef enum MBNetServiceType {
00079     MBNetServiceType_none,
00080     
00084     MBNetServiceType_search_suggest,
00085     
00089     MBNetServiceType_search_routeSuggest,
00090     
00094     MBNetServiceType_search_poi,
00095     
00099     MBNetServiceType_search_categoryPoi,
00100     
00104     MBNetServiceType_search_poiDetail,
00105     
00109     MBNetServiceType_search_PoiComment,
00110     
00114     MBNetServiceType_search_busStation,
00115     
00119     MBNetServiceType_search_busStationLine,
00120     
00124     MBNetServiceType_search_busLine,
00125     
00129     MBNetServiceType_search_busLineDetail,
00130     
00134     MBNetServiceType_search_busRoute,
00135     
00139     MBNetServiceType_search_busRouteDetail,
00140     
00144     MBNetServiceType_search_walkRoute,
00145     
00149     MBNetServiceType_search_driveRoute
00150 } MBNetServiceType;
00151 
00152 
00156 typedef enum MBNetServiceResultError {
00157     MBNetServiceResultError_none,
00158     
00162     MBNetServiceResultError_success,
00163     
00167     MBNetServiceResultError_net,
00168     
00172     MBNetServiceResultError_timeout,
00173     
00177     MBNetServiceResultError_invalid
00178 } MBNetServiceResultError;
00179 
00180 @class MBNetServiceParams;
00181 @protocol MBNetServiceResult;
00182 @class MBNetServiceInternal;
00183 
00184 @class MBNetService;
00185 
00186 @protocol MBNetServiceDelegate <NSObject>
00187 @optional
00188 - (void)mbNetService:(MBNetService*)netService start:(MBNetServiceParams*)params;
00189 - (void)mbNetService:(MBNetService*)netService finished:(id<MBNetServiceResult>)serviceResult;
00190 @end
00191 
00195 @interface MBNetService : NSObject {
00196     MBNetServiceInternal* _internal;
00197 }
00198 
00199 @property(nonatomic,assign) id<MBNetServiceDelegate> delegate;
00200 
00204 @property(nonatomic,readwrite) NSInteger timeoutInterval;
00205 
00209 @property(nonatomic,copy) NSString* city;
00210 
00214 @property(nonatomic,copy) NSString* center;
00264 - (id<MBNetServiceResult>)loadResultWithType:(MBNetServiceType)serviceType params:(MBNetServiceParams *)params;
00265 - (void)requestResultWithType:(MBNetServiceType)serviceType params:(MBNetServiceParams *)params;
00269 +(NSString*)encodeCoordinate:(CLLocationCoordinate2D)coordinate;
00270 
00274 +(CLLocationCoordinate2D)decodeCoordinate:(NSString*)text;
00275 + (NSString*)deleteBrackets:(NSString*)text;
00276 
00277 @end
00278 
00282 @class MBNetServiceParamsInternal;
00283 @interface MBNetServiceParams : NSObject {
00284     MBNetServiceParamsInternal* _internal;
00285 }
00286 
00290 - (void)addStringValue:(NSString *)value forName:(NSString *)name;
00291 
00295 - (void)addNumberValue:(NSInteger)value forName:(NSString *)name;
00296 
00300 - (void)addArrayValue:(NSArray *)value forName:(NSString *)name;
00301 
00305 - (NSString *)stringValue:(NSString *)name;
00306 
00310 - (NSInteger)numberValue:(NSString *)name;
00311 
00315 - (NSArray *)arrayValue:(NSString *)name;
00316 
00317 -(void)removeAllValues;
00318 
00319 @end
00320 
00321 
00325 @protocol MBNetServiceResult
00326 
00330 - (NSDictionary *)resultAtIndex:(NSInteger)index;
00331 
00335 - (NSInteger)count;
00336 
00340 - (NSInteger)total;
00344 - (NSInteger)pageNumber;
00348 - (NSInteger)pageCount;
00349 
00353 - (MBNetServiceType)serviceType;
00357 - (MBNetServiceResultError)error;
00358 
00362 - (MBNetServiceParams *)params;
00363 
00367 - (NSString*)hashAtIndex:(NSInteger)index;
00368 
00372 - (void)alert;
00373 
00374 @end
00375 
 全部  函数 变量 属性