You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

287 lines
10 KiB

//
// JCClient.h
// JCSDK-OC
//
// Created by maikireton on 2017/8/10.
// Copyright © 2017年 juphoon. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "JCClientCallback.h"
/**
* @defgroup
* @{
* sdk Juphoon Cloud
*/
/**
*
*/
@interface JCClientCreateParam : NSObject
/**
* sdk
*
* Documents/JuphoonCloud
*
* @note App
*/
@property (nonatomic, copy) NSString* __nonnull sdkInfoDir;
/**
* sdk
*
* @ref sdkInfoDir log
*
* @note App
*/
@property (nonatomic, copy) NSString* __nonnull sdkLogDir;
/**
* sdk @ref JCLogLevelInfo
*
* - @ref JCLogLevelDisable :
* - @ref JCLogLevelError : error
* - @ref JCLogLevelInfo : info error
* - @ref JCLogLevelDebug :
*/
@property (nonatomic) JCLogLevel sdkLogLevel;
@end
/**
*
*
* {@link JCClient#login:password:loginParam: login}
*/
@interface JCClientLoginParam : NSObject
/**
* id
*
* 使id都一样
*/
@property (nonatomic, copy) NSString* __nonnull deviceId;
/**
* https代理地址
*
* 192.168.1.100:3128
*/
@property (nonatomic, copy) NSString* __nullable httpsProxy;
/**
*
* - true:
* - false:
*/
@property (nonatomic) bool autoCreateAccount;
/**
*
*
*
* PC端同时能登录 mobilepc端设为 pc {@link login:password:loginParam: login} 线
*/
@property (nonatomic, strong) NSString* __nonnull terminalType;
/**
* callserver接入方式
* - true: arc形式
* - false: endpoint形式
*/
@property (nonatomic) bool directConnectEnable;
@end
/**
*
*
*
*/
@interface JCClient : NSObject
/**
*
*
* {@link login:password:loginParam: login} userId <br>
* nil
*/
@property (nonatomic, readonly, copy) NSString* __nullable userId;
/**
* /
*
*
*
* @note
* - {@link create:callback:createParam: create} SDK
* - IOT
*/
@property (nonatomic, copy) NSString* __nullable displayName;
/**
*
*
* - @ref JCClientStateNotInit :
* - @ref JCClientStateIdle :
* - @ref JCClientStateLogining :
* - @ref JCClientStateLogined :
* - @ref JCClientStateLogouting :
*/
@property (nonatomic, readonly) JCClientState state;
/**
*
*
* {@link create:callback:createParam: create} createParam <br>
* {@link create:callback:createParam: create} createParam nil JCClientCreateParam
*/
@property (nonatomic, readonly) JCClientCreateParam* __nullable createParam;
/**
*
*
* {@link login:password:loginParam: login} loginParam <br>
* {@link login:password:loginParam: login} loginParam nil JCClientLoginParam <br>
* nil
*/
@property (nonatomic, readonly) JCClientLoginParam* __nullable loginParam;
/**
* appkey
*
* appkey是由 {@link create:callback:createParam: create}
*/
@property (nonatomic, readonly) NSString* __nonnull appkey;
/// @cond Doxygen_All
/**
* uid
*/
@property (nonatomic, readonly) NSString* __nonnull serverUid;
/// @endcond
/**
* /
*
* http:<span><span/>cn.router.justalkcloud.com:8080 http:<span><span/>intl.router.justalkcloud.com:8080<br>
* {@link login:password:loginParam: login}
*/
@property (nonatomic, copy) NSString * __nonnull serverAddress;
/**
* , 60
*/
@property (nonatomic, assign) int timeout;
/**
* arcChannel开关
*/
@property (nonatomic, assign) bool arcChannel;
/**
* JCClient
*
* JCClient 线
*
* @note
* - API JCClient
* - JCClient {@link destroy} JCClient
*
* @param appKey Juphoon Cloud AppKey [ appKey](https://developer.juphoon.com/cn/document/V2.1/create-application.php)
* @param callback JCClientCallback
* @param createParam nil JCClientCreateParam
* @return JCClient
* @exception "appKey、JCClientCallback 任意一个参数传空就会返回 nil"
*/
+(JCClient* __nullable)create:(NSString* __nonnull)appKey callback:(id<JCClientCallback> __nonnull)callback createParam:(JCClientCreateParam* __nullable)createParam;
/**
* JCClient
*
* JCClient 使 SDK <br>
* JCClient **** JCSDK JCClient <br>
* JCClient @ref destroy
*/
+(void)destroy;
/**
* Juphoon Cloud
*
*
*
* @param userId 64 66
* - 26 a-z
* - 26 A-Z
* - 10 0-9
* - '+''-''_''.' '-''_''.'
* @param password nil "" 128 Token Token
* @param loginParam nil JCClientLoginParam
* @return
* - true {@link JCClientCallback#onLogin:reason: onLogin}
* - false {@link JCClientCallback#onLogin:reason: onLogin}
*/
-(bool)login:(NSString* __nonnull)userId password:(NSString* __nonnull)password loginParam:(JCClientLoginParam* __nullable)loginParam;
/// @cond Doxygen_All
/**
*
*
* {@link JCClientCallback#onLogin:reason: onLogin}
*
* @note @ref login
* - 使线
* - 使
* - 使
*
* @param userId
* @param password
* @param loginParam nil JCClientLoginParam
* @return
* - true {@link JCClientCallback#onLogin:reason: onLogin}
* - false {@link JCClientCallback#onLogin:reason: onLogin}
*/
-(bool)relogin:(NSString* __nonnull)userId password:(NSString* __nonnull)password loginParam:(JCClientLoginParam* __nullable)loginParam;
/// @endcond
/**
* Juphoon Cloud
*
*
*
* @return
* - true {@link JCClientCallback#onLogout: onLogout}
* - false {@link JCClientCallback#onLogout: onLogout}
*/
-(bool)logout;
/**
* 线
*
* @ref JCClientCallback#onOnlineMessageSendResult "onOnlineMessageSendResult"
*
* @note
* - 线
* - 100/
*
* @param userId userId
* @param content
* @return
* - &gt;0id operationId
* - -1
*/
-(int)sendOnlineMessage:(NSString* __nonnull)userId content:(NSString* __nonnull)content;
@end
/**
* @}
*/