// // IHLightCommandManager.swift // Inhealth // // Created by weclouds on 2020/8/21. // Copyright © 2020 weclouds. All rights reserved. // import UIKit class IHLightCommandManager: NSObject { lazy var mainView : IHLightCommandView = { let mainView = Bundle.main.loadNibNamed("IHLightCommandView", owner: nil, options: nil)?.first as! IHLightCommandView // colorView.isHidden = true mainView.delegate = self return mainView }() // lazy var clientSocket: GCDAsyncUdpSocket? = { // var mainQueue = DispatchQueue.main // var clientSocket = GCDAsyncUdpSocket(delegate: self, delegateQueue: DispatchQueue.global()) // return clientSocket // }() // var modelList = [gatewayInfor]() weak var vc : IHLightCommandCtr? func bindController(_ vc : UIViewController) { self.vc = vc as? IHLightCommandCtr self.vc?.view.addSubview(mainView) mainView.schollDeviceInfor = self.vc?.schollDeviceInfor } deinit { log.debug("IHLightCommandManager销毁") } } extension IHLightCommandManager : IHLightCommandViewDelegate{ //灯的开关 func setDeviceTurnOn(_ isTurnOn: Bool, _ device: (address: String, type: String,location : String)) { IHLightCommandService.share.setCWOrOtherLightTurnOn(isTurnOn: isTurnOn, device: device, ip: self.vc!.gateway!.ip!, port: self.vc!.gateway!.port!) } //设置灯的亮度与色温 func setLampCWBrightnessAndColorValue(device: (address: String, type: String, location: String), brightness: String, color: String,isColor : Bool) { IHLightCommandService.share.setLightCWBrightnessAndColorValue(device : device,brightness: brightness, color: color, ip: self.vc!.gateway!.ip!, port: self.vc!.gateway!.port!,isColor : isColor) } }