更新时间:2024-12-24 02:48:53下载pdf
用于设备控制关联。
source 'https://github.com/tuya/tuya-pod-specs.git'
platform :ios, '11.0'
target 'Your_Project_Name' do
pod "ThingSmartBusinessExtensionKit"
end
设备关联管理类
open class ThingDeviceAssociationControlManager : NSObject {
...
}
设备的 DP 信息
open class ThingMultiControlDpInfo : NSObject {
open var dpCode: String
open var dpName: String
open var dpId: Int64
}
多控组 DP 信息
open class ThingMultiControlGroupDeviceDp : NSObject {
open var dpId: Int64
open var code: String
open var name: String
}
多控组设备
open class ThingMultiControlGroupDevice : NSObject {
open var multiControlId: Int64
open var datapoints: [ThingMultiControlGroupDeviceDp]
open var devId: String
open var devName: String
open var dpId: Int64
open var dpName: String
open var status: Int
open var enabled: Bool
}
多控组信息
open class ThingMultiControlGroup : NSObject {
open var multiControlGroupId: Int64
open var multiControlId: Int64
open var groupName: String
open var enabled: Bool
open var groupDetail: [ThingMultiControlGroupDevice]
open var groupType: Int
}
场景规则 DP 信息
open class ThingMultiControlGroupParentRuleDpInfo : NSObject {
open var dpId: Int64
open var dpName: String
}
场景规则
open class ThingMultiControlGroupParentRule : NSObject {
open var ruleId: String
open var name: String
open var dpList: [ThingMultiControlGroupParentRuleDpInfo]
}
设备多控组信息
open class ThingMultiControlGroupInfo : NSObject {
open var bindMaxValue: Int
open var multiGroup: ThingMultiControlGroup
open var parentRules: [ThingMultiControlGroupParentRule]
}
多控设备
open class ThingMultiControlDevice : NSObject {
open var datapoints: [ThingMultiControlGroupDeviceDp]
open var devId: String
open var iconUrl: String
open var inRule: Bool
open var multiControlIds: NSMutableArray
open var name: String
open var productId: String
open var roomName: String
}
设备 DP 多控信息
open class ThingMultiControlDeviceDpsInfo : NSObject {
open var bindMaxValue: Int
open var datapoints: [ThingMultiControlGroupDeviceDp]
open var mcGroups: [ThingMultiControlGroup]
open var parentRules: [ThingMultiControlGroupParentRule]
}
双控组信息
open class ThingDoubleControlGroup : NSObject {
open var mainDeviceId: String
open var slaveDeviceIds: [String]
}
双控从设备列表
open class ThingDoubleControlDevice : NSObject {
open var devId: String
open var isRelate: Bool
open var parentId: String
}
双控 DP 关系
open class ThingDoubleControlDPRelation : NSObject {
open var dpIds: [String]
open var subDpIds: [String]
open var dpIdMap: [String : String]
}
双控 DP 信息
open class ThingDoubleControlDPInfo : NSObject {
open var code: String
open var dpId: Int64
open var name: String
open var schemaId: String
}
判断设备是否支持多控关联
入参 | 类型 | 说明 |
---|---|---|
deviceId | String | 设备 ID |
返回值: true
表示支持,false
表示不支持。
class func checkSupportMultiControl(_ deviceId: String) -> Bool
获取设备支持多控的 DP 信息
入参 | 类型 | 说明 |
---|---|---|
deviceId | String | 设备 ID |
success | [ThingMultiControlDpInfo] | 设备多控 DP 信息列表 |
failure | error | 错误信息 |
class func getMultiControlDp(
withDeviceId deviceId: String,
success: (([ThingMultiControlDpInfo]?) -> Void)?,
failure: ((Error) -> Void)? = nil
)
获取设备多控 DP 下的多控组信息
入参 | 类型 | 说明 |
---|---|---|
deviceId | String | 设备 ID |
dpId | Int64 | 多控 DP ID |
success | ThingMultiControlGroupInfo | 设备多控 DP 信息列表 |
failure | error | 错误信息 |
class func getMultiControlGroup(
withDeviceId deviceId: String,
dpId: Int64,
success: ((ThingMultiControlGroupInfo?) -> Void)?,
failure: ((Error) -> Void)? = nil
)
多控组使能状态更新
入参 | 类型 | 说明 |
---|---|---|
multiControlGroupId | Int64 | 多控组 ID |
enable | Bool | 是否使能 |
success | Bool | 是否成功 |
failure | error | 错误信息 |
class func updateMultiControlGroupStatus(
_ multiControlGroupId: Int64,
enable: Bool,
success: ((Bool) -> Void)?,
failure: ((Error) -> Void)? = nil
)
获取家庭下可以支持多控的设备
入参 | 类型 | 说明 |
---|---|---|
spaceId | Int64 | 家庭 ID |
success | [ThingMultiControlDevice] | 多控设备列表 |
failure | error | 错误信息 |
class func getMultiControlDevices(
withSpaceId spaceId: Int64,
success: (([ThingMultiControlDevice]?) -> Void)?,
failure: ((Error) -> Void)? = nil
)
获取家庭下可以与指定设备组成多控的设备列表
入参 | 类型 | 说明 |
---|---|---|
deviceId | String | 设备 ID |
spaceId | Int64 | 家庭 ID |
success | [ThingMultiControlDevice] | 多控设备列表 |
failure | error | 错误信息 |
class func getMultiControlDevices(
withDeviceId deviceId: String,
spaceId: Int64,
success: (([ThingMultiControlDevice]?) -> Void)?,
failure: ((Error) -> Void)? = nil
)
获取设备可以与指定设备的指定 DP 组成多控组的 DP 信息
入参 | 类型 | 说明 |
---|---|---|
deviceId | String | 设备 ID |
targetDeviceId | String | 指定设备 ID |
targetDpId | Int64 | 指定设备 DP |
spaceId | Int64 | 家庭 ID |
success | ThingMultiControlDeviceDpsInfo | 设备 DP 多控信息 |
failure | error | 错误信息 |
class func getAvailableMultiControlDp(
withDeviceId deviceId: String,
targetDevice targetDeviceId: String,
targetDpId: Int64,
spaceId: Int64,
success: ((ThingMultiControlDeviceDpsInfo?) -> Void)?,
failure: ((Error) -> Void)? = nil
)
更新多控群组
入参 | 类型 | 说明 |
---|---|---|
multiControlGroupId | Int64 | 多控组 ID |
name | String | 多控组名称 |
spaceId | Int64 | 家庭 ID |
deviceDps | [[AnyHashable : Any]] | 设备 DP 数据,例如: [{devId:xxx, dpId:xxx}, {devId:xxx, dpId:xxx}] |
success | ThingMultiControlGroup | 多控组信息 |
failure | error | 错误信息 |
class func updateMultiControlGroup(
_ multiControlGroupId: Int64,
name: String,
spaceId: Int64,
deviceDps: [[AnyHashable : Any]],
success: ((ThingMultiControlGroup) -> Void)?,
failure: ((Error) -> Void)? = nil
)
判断设备是否支持双控关联
入参 | 类型 | 说明 |
---|---|---|
deviceId | String | 设备 ID |
返回值: true
表示支持,false
表示不支持。
class func checkSupportDoubleControl(_ deviceId: String) -> Bool
获取设备的双控组信息
入参 | 类型 | 说明 |
---|---|---|
deviceId | String | 设备 ID |
spaceId | Int64 | 家庭 ID |
success | ThingDoubleControlGroup | 双控组信息 |
failure | error | 错误信息 |
class func getDoubleControlGroup(
withDeviceId deviceId: String,
spaceId: Int64,
success: ((ThingDoubleControlGroup?) -> Void)?,
failure: ((Error) -> Void)? = nil
)
移除双控关联从设备
入参 | 类型 | 说明 |
---|---|---|
deviceId | String | 待移除的设备 ID |
spaceId | Int64 | 家庭 ID |
success | void | - |
failure | error | 错误信息 |
class func removeDoubleControlSlaveDevice(
withDeviceId deviceId: String,
spaceId: Int64,
success: (() -> Void)?,
failure: ((Error) -> Void)? = nil
)
获取可以与指定主设备形成双控关联的从设备列表
入参 | 类型 | 说明 |
---|---|---|
mainDeviceId | String | 主设备 ID |
spaceId | Int64 | 家庭 ID |
success | [ThingDoubleControlDevice] | 双控从设备列表 |
failure | error | 错误信息 |
class func getDoubleControlAvailableSlaveDevices(
withMainDeviceId mainDeviceId: String,
spaceId: Int64,
success: (([ThingDoubleControlDevice]?) -> Void)?,
failure: ((Error) -> Void)? = nil
)
更新双控关联从设备
入参 | 类型 | 说明 |
---|---|---|
mainDeviceId | String | 主设备 ID |
slaveDeviceIds | [String] | 从设备 ID 列表 |
spaceId | Int64 | 家庭 ID |
success | Void | - |
failure | error | 错误信息 |
class func updateDoubleControl(
withMainDeviceId mainDeviceId: String,
slaveDeviceIds: [String],
spaceId: Int64,
success: (() -> Void)?,
failure: ((Error) -> Void)? = nil
)
获取双控关联主从设备 DP 关系
入参 | 类型 | 说明 |
---|---|---|
mainDeviceId | String | 主设备 ID |
slaveDeviceId | [String] | 从设备 ID |
spaceId | Int64 | 家庭 ID |
success | ThingDoubleControlDPRelation | 双控 DP 关系 |
failure | error | 错误信息 |
class func getDoubleControlDPRelation(
withMainDeviceId mainDeviceId: String,
slaveDeviceId: String,
spaceId: Int64,
success: ((ThingDoubleControlDPRelation?) -> Void)?,
failure: ((Error) -> Void)? = nil
)
获取设备本地化的 DP 信息
入参 | 类型 | 说明 |
---|---|---|
deviceId | String | 设备 ID |
spaceId | Int64 | 家庭 ID |
success | [ThingDoubleControlDPInfo] | 双控 DP 信息列表 |
failure | error | 错误信息 |
class func getLocalizedDpInfo(
withDeviceId deviceId: String,
spaceId: Int64,
success: (([ThingDoubleControlDPInfo]?) -> Void)?,
failure: ((Error) -> Void)? = nil
)
更新双控关联 DP 关系
入参 | 类型 | 说明 |
---|---|---|
mainDeviceId | String | 主设备 ID |
slaveDeviceId | String | 从设备 ID |
relations | [String : String] | 主从设备 DP 关系, Key: 主设备 DP ID, Value: 从设备 DP ID |
spaceId | Int64 | 家庭 ID |
success | Void | - |
failure | error | 错误信息 |
class func updateDoubleControlDpRelation(
withMainDeviceId mainDeviceId: String,
slaveDeviceId: String,
relations: [String : String],
spaceId: Int64,
success: (() -> Void)?,
failure: ((Error) -> Void)? = nil
)
更多信息,参考 Demo。
该内容对您有帮助吗?
是意见反馈该内容对您有帮助吗?
是意见反馈