Tuya iOS Smart Life App SDK 5.15.0
ThingSmartP2pChannel Class Reference

#import <ThingSmartP2pChannel.h>

Inheritance diagram for ThingSmartP2pChannel:

Instance Methods

(void) - initSDKWithUid:
 init configs, add msg observing More...
 
(void) - deInitSDK
 reset configs, remove msg observing More...
 
("Use -[ThingSmartP2pChannel deInitSDK] instead") - __deprecated_msg
 
(void) - initP2PSDKWithUid:
 init P2P SDK, only call when login More...
 
(void) - deInitP2PSDK
 deInit P2P SDK, only call when logout More...
 
(NSString *) - connectWithDevId:mode:timeout:success:failure:
 
(NSString *) - connectWithDeviceId:mode:timeout:success:failure:
 
(NSString *) - connectWithDeviceId:token:traceId:mode:success:failure:
 
(int) - breakConnectWithTraceId:
 
(int) - disconnectWithP2pHandle:
 
(int) - readDataWithP2pHandle:channel:buffer:
 
(int) - readDataWithP2pHandle:channel:buffer:timeout:
 
(int) - sendDataWithP2pHandle:channel:buffer:length:
 
(int) - sendDataWithP2pHandle:channel:buffer:length:timeout:
 
(int) - resendOffer:
 
(int) - onDeviceOnline:
 
(BOOL) - isP2pActive:
 
(int) - activeCheckWithHandle:
 
(int) - startPreConnectWithDeviceId:
 
(int) - closePreConnectWithDeviceId:
 
(void) - initSDKWithUid:
 init configs, add msg observing More...
 
(void) - deInitSDK
 reset configs, remove msg observing More...
 
("Use -[ThingSmartP2pChannel deInitSDK] instead") - __deprecated_msg
 
(void) - initP2PSDKWithUid:
 init P2P SDK, only call when login More...
 
(void) - deInitP2PSDK
 deInit P2P SDK, only call when logout More...
 
(NSString *) - connectWithDevId:mode:timeout:success:failure:
 
(NSString *) - connectWithDeviceId:mode:timeout:success:failure:
 
(NSString *) - connectWithDeviceId:token:traceId:mode:success:failure:
 
(int) - breakConnectWithTraceId:
 
(int) - disconnectWithP2pHandle:
 
(int) - readDataWithP2pHandle:channel:buffer:
 
(int) - readDataWithP2pHandle:channel:buffer:timeout:
 
(int) - sendDataWithP2pHandle:channel:buffer:length:
 
(int) - sendDataWithP2pHandle:channel:buffer:length:timeout:
 
(int) - resendOffer:
 
(int) - onDeviceOnline:
 
(BOOL) - isP2pActive:
 
(int) - activeCheckWithHandle:
 
(int) - startPreConnectWithDeviceId:
 
(int) - closePreConnectWithDeviceId:
 

Class Methods

(instancetype) + sharedInstance
 
(instancetype) + sharedInstance
 

Properties

NSInteger readDataTimeOut
 
NSInteger sendDataTimeOut
 
NSString * p2pVersion
 

Detailed Description

Definition at line 19 of file ThingSmartP2pChannel.h.

Method Documentation

◆ __deprecated_msg [1/2]

- ("Use -[ThingSmartP2pChannel deInitSDK] instead") __deprecated_msg

◆ __deprecated_msg [2/2]

- ("Use -[ThingSmartP2pChannel deInitSDK] instead") __deprecated_msg

◆ activeCheckWithHandle: [1/2]

- (int) activeCheckWithHandle: (int)  p2pHandle

check the p2p session status, return a negative number to indicate that the connection has been disconnected

Parameters
p2pHandlep2p session handle

◆ activeCheckWithHandle: [2/2]

- (int) activeCheckWithHandle: (int)  p2pHandle

check the p2p session status, return a negative number to indicate that the connection has been disconnected

Parameters
p2pHandlep2p session handle

◆ breakConnectWithTraceId: [1/2]

- (int) breakConnectWithTraceId: (NSString *)  traceId

break connecting session

Parameters
traceIdtrace id

◆ breakConnectWithTraceId: [2/2]

- (int) breakConnectWithTraceId: (NSString *)  traceId

break connecting session

Parameters
traceIdtrace id

◆ closePreConnectWithDeviceId: [1/2]

- (int) closePreConnectWithDeviceId: (NSString *)  devId

returnValue >= 0 , success

Parameters
devIddevice id

◆ closePreConnectWithDeviceId: [2/2]

- (int) closePreConnectWithDeviceId: (NSString *)  devId

returnValue >= 0 , success

Parameters
devIddevice id

◆ connectWithDeviceId:mode:timeout:success:failure: [1/2]

- (NSString *) connectWithDeviceId: (NSString *)  devId
mode: (ThingSmartP2pConnectMode)  mode
timeout: (NSInteger)  timeout
success: (void(^)(int p2pHandle))  success
failure: (void(^)(NSInteger errCode))  failure 

create p2p channel

Parameters
devIddevice id
modeconnect mode
timeouttimeout, set 0 will use default value, Lan Mode: 3000 ms, Internet Mode: 15000 ms
successsuccess callback, and parameter is the p2p session handle
failurefailure callback
Returns
trace id, break connecting must use trace id to specify p2p session

◆ connectWithDeviceId:mode:timeout:success:failure: [2/2]

- (NSString *) connectWithDeviceId: (NSString *)  devId
mode: (ThingSmartP2pConnectMode)  mode
timeout: (NSInteger)  timeout
success: (void(^)(int p2pHandle))  success
failure: (void(^)(NSInteger errCode))  failure 

create p2p channel

Parameters
devIddevice id
modeconnect mode
timeouttimeout, set 0 will use default value, Lan Mode: 3000 ms, Internet Mode: 15000 ms
successsuccess callback, and parameter is the p2p session handle
failurefailure callback
Returns
trace id, break connecting must use trace id to specify p2p session

◆ connectWithDeviceId:token:traceId:mode:success:failure: [1/2]

- (NSString *) connectWithDeviceId: (NSString *)  devId
token: (NSString *)  token
traceId: (NSString *)  traceId
mode: (ThingSmartP2pConnectMode)  mode
success: (void(^)(int p2pHandle))  success
failure: ("Use connectWithDeviceId:mode:timeout:success:failure: instead")  __deprecated_msg 

create p2p channel

Parameters
devIddevice id
tokenp2p token
traceIdtrace id for link, and break a connecting session must use the trace id to specify the p2p session
modeconnect mode
successconnect success callback, and parameter is the p2p session handle
failureconnect failure callback
Returns
trace id, if param traceId is nil, there well create one

◆ connectWithDeviceId:token:traceId:mode:success:failure: [2/2]

- (NSString *) connectWithDeviceId: (NSString *)  devId
token: (NSString *)  token
traceId: (NSString *)  traceId
mode: (ThingSmartP2pConnectMode)  mode
success: (void(^)(int p2pHandle))  success
failure: ("Use connectWithDeviceId:mode:timeout:success:failure: instead")  __deprecated_msg 

create p2p channel

Parameters
devIddevice id
tokenp2p token
traceIdtrace id for link, and break a connecting session must use the trace id to specify the p2p session
modeconnect mode
successconnect success callback, and parameter is the p2p session handle
failureconnect failure callback
Returns
trace id, if param traceId is nil, there well create one

◆ connectWithDevId:mode:timeout:success:failure: [1/2]

- (NSString *) connectWithDevId: (NSString *)  devId
mode: (ThingSmartP2pConnectMode)  mode
timeout: (NSInteger)  timeout
success: (void(^)(int p2pHandle))  success
failure: (void(^)(NSInteger errCode))  failure 

create p2p channel new – optimize error code

Parameters
devIddevice id
modeconnect mode
timeouttimeout, set 0 will use default value, Lan Mode: 3000 ms, Internet Mode: 15000 ms
successsuccess callback, and parameter is the p2p session handle
failurefailure callback, Note: errCode -3 split info more error codes,eg:-33,-38,-39, -40 and so on.
Returns
trace id, break connecting must use trace id to specify p2p session

◆ connectWithDevId:mode:timeout:success:failure: [2/2]

- (NSString *) connectWithDevId: (NSString *)  devId
mode: (ThingSmartP2pConnectMode)  mode
timeout: (NSInteger)  timeout
success: (void(^)(int p2pHandle))  success
failure: (void(^)(NSInteger errCode))  failure 

create p2p channel new – optimize error code

Parameters
devIddevice id
modeconnect mode
timeouttimeout, set 0 will use default value, Lan Mode: 3000 ms, Internet Mode: 15000 ms
successsuccess callback, and parameter is the p2p session handle
failurefailure callback, Note: errCode -3 split info more error codes,eg:-33,-38,-39, -40 and so on.
Returns
trace id, break connecting must use trace id to specify p2p session

◆ deInitP2PSDK [1/2]

- (void) deInitP2PSDK

deInit P2P SDK, only call when logout

◆ deInitP2PSDK [2/2]

- (void) deInitP2PSDK

deInit P2P SDK, only call when logout

◆ deInitSDK [1/2]

- (void) deInitSDK

reset configs, remove msg observing

◆ deInitSDK [2/2]

- (void) deInitSDK

reset configs, remove msg observing

◆ disconnectWithP2pHandle: [1/2]

- (int) disconnectWithP2pHandle: (int)  handle

disconnect p2p

Parameters
handlep2p session handle

◆ disconnectWithP2pHandle: [2/2]

- (int) disconnectWithP2pHandle: (int)  handle

disconnect p2p

Parameters
handlep2p session handle

◆ initP2PSDKWithUid: [1/2]

- (void) initP2PSDKWithUid: (NSString *)  uid

init P2P SDK, only call when login

◆ initP2PSDKWithUid: [2/2]

- (void) initP2PSDKWithUid: (NSString *)  uid

init P2P SDK, only call when login

◆ initSDKWithUid: [1/2]

- (void) initSDKWithUid: (NSString *)  uid

init configs, add msg observing

◆ initSDKWithUid: [2/2]

- (void) initSDKWithUid: (NSString *)  uid

init configs, add msg observing

◆ isP2pActive: [1/2]

- (BOOL) isP2pActive: ("Use activeCheckWithHandle: instead")  __deprecated_msg

check the p2p session active or not

Parameters
p2pHandlep2p session handle

◆ isP2pActive: [2/2]

- (BOOL) isP2pActive: ("Use activeCheckWithHandle: instead")  __deprecated_msg

check the p2p session active or not

Parameters
p2pHandlep2p session handle

◆ onDeviceOnline: [1/2]

- (int) onDeviceOnline: ("Use resendOffer: instead")  __deprecated_msg

notify p2p SDK the device is online, for the low-power device

Parameters
deviceIddevice id

◆ onDeviceOnline: [2/2]

- (int) onDeviceOnline: ("Use resendOffer: instead")  __deprecated_msg

notify p2p SDK the device is online, for the low-power device

Parameters
deviceIddevice id

◆ readDataWithP2pHandle:channel:buffer: [1/2]

- (int) readDataWithP2pHandle: (int)  handle
channel: (int)  channel
buffer: (unsigned char *)  buffer 

read data from p2p channel

Parameters
handlep2p session handle
channelp2p channel
bufferbuffer ponter
Returns
the length of read data. if -0, means error. -3 is timeout, and others means session did disconnected

◆ readDataWithP2pHandle:channel:buffer: [2/2]

- (int) readDataWithP2pHandle: (int)  handle
channel: (int)  channel
buffer: (unsigned char *)  buffer 

read data from p2p channel

Parameters
handlep2p session handle
channelp2p channel
bufferbuffer ponter
Returns
the length of read data. if -0, means error. -3 is timeout, and others means session did disconnected

◆ readDataWithP2pHandle:channel:buffer:timeout: [1/2]

- (int) readDataWithP2pHandle: (int)  handle
channel: (int)  channel
buffer: (unsigned char *)  buffer
timeout: (int)  timeout 

read data from p2p channel

Parameters
handlep2p session handle
channelp2p channel
bufferbuffer ponter
Returns
the length of read data. if -0, means error. -3 is timeout, and others means session did disconnected

◆ readDataWithP2pHandle:channel:buffer:timeout: [2/2]

- (int) readDataWithP2pHandle: (int)  handle
channel: (int)  channel
buffer: (unsigned char *)  buffer
timeout: (int)  timeout 

read data from p2p channel

Parameters
handlep2p session handle
channelp2p channel
bufferbuffer ponter
Returns
the length of read data. if -0, means error. -3 is timeout, and others means session did disconnected

◆ resendOffer: [1/2]

- (int) resendOffer: (NSString *)  deviceId

resend p2p connect offer

Parameters
deviceIddevice id

◆ resendOffer: [2/2]

- (int) resendOffer: (NSString *)  deviceId

resend p2p connect offer

Parameters
deviceIddevice id

◆ sendDataWithP2pHandle:channel:buffer:length: [1/2]

- (int) sendDataWithP2pHandle: (int)  handle
channel: (int)  channel
buffer: (unsigned char *)  buffer
length: (int)  len 

send data by p2p channel

Parameters
handlep2p session handle
channelp2p channel
bufferbuffer pointer
lenlength of buffer
Returns
the length of send data successfull. if -0, means error. -3 is timeout, and others means session did disconnected

◆ sendDataWithP2pHandle:channel:buffer:length: [2/2]

- (int) sendDataWithP2pHandle: (int)  handle
channel: (int)  channel
buffer: (unsigned char *)  buffer
length: (int)  len 

send data by p2p channel

Parameters
handlep2p session handle
channelp2p channel
bufferbuffer pointer
lenlength of buffer
Returns
the length of send data successfull. if -0, means error. -3 is timeout, and others means session did disconnected

◆ sendDataWithP2pHandle:channel:buffer:length:timeout: [1/2]

- (int) sendDataWithP2pHandle: (int)  handle
channel: (int)  channel
buffer: (unsigned char *)  buffer
length: (int)  len
timeout: (int)  timeout 

send data by p2p channel

Parameters
handlep2p session handle
channelp2p channel
bufferbuffer pointer
lenlength of buffer
Returns
the length of send data successfull. if -0, means error. -3 is timeout, and others means session did disconnected

◆ sendDataWithP2pHandle:channel:buffer:length:timeout: [2/2]

- (int) sendDataWithP2pHandle: (int)  handle
channel: (int)  channel
buffer: (unsigned char *)  buffer
length: (int)  len
timeout: (int)  timeout 

send data by p2p channel

Parameters
handlep2p session handle
channelp2p channel
bufferbuffer pointer
lenlength of buffer
Returns
the length of send data successfull. if -0, means error. -3 is timeout, and others means session did disconnected

◆ sharedInstance [1/2]

+ (instancetype) sharedInstance

◆ sharedInstance [2/2]

+ (instancetype) sharedInstance

◆ startPreConnectWithDeviceId: [1/2]

- (int) startPreConnectWithDeviceId: (NSString *)  devId

returnValue >= 0 , success

Parameters
devIddevice id

◆ startPreConnectWithDeviceId: [2/2]

- (int) startPreConnectWithDeviceId: (NSString *)  devId

returnValue >= 0 , success

Parameters
devIddevice id

Property Documentation

◆ p2pVersion

- (NSString *) p2pVersion
readnonatomiccopy

Definition at line 24 of file ThingSmartP2pChannel.h.

◆ readDataTimeOut

- (NSInteger) readDataTimeOut
readwritenonatomicassign

Definition at line 21 of file ThingSmartP2pChannel.h.

◆ sendDataTimeOut

- (NSInteger) sendDataTimeOut
readwritenonatomicassign

Definition at line 22 of file ThingSmartP2pChannel.h.


The documentation for this class was generated from the following files: