// // GlobalDeviceProfileModel.swift // Lookfit // // Created by lemo on 2018/6/15. // Copyright © 2020年 ecell. All rights reserved. // import UIKit @objcMembers class GlobalDeviceProfileModel: NSObject { static let shareInstance = GlobalDeviceProfileModel() /// 需要在oc中调用此单例 @objc open class func ocShareInstance() -> GlobalDeviceProfileModel { return shareInstance } var adapterModel: AdapterModel? var noDisturbModel: NoDisturbModel? var gestureModel: GestureSetModel? var heartRateModel: HeartRateCheckModel? var remindMode: Int = 1 // 默认响铃 public var firwareModel: FirmwareModel? var alarmModels: [AlarmModel]? var sedentaryModel: SedentaryModel? var drinkModel: DrinkingModel? var temperatureModel: TemperatureCheckModel? /// 推送设置值 var pushSetValue: Int = 0 /// 当前响铃状态 var isPlaying: Bool = false /// 周期字符串转换 /// - Parameter cycleStr: "0000000" static func cycle(cycleStr: String) -> String { if cycleStr == "0000000" { return MultiLanguageKey.onlyOne.localized } if cycleStr == "1111111" { return MultiLanguageKey.everyDay.localized } if cycleStr == "1111100" { return MultiLanguageKey.workDay.localized } if cycleStr == "0000011" { return MultiLanguageKey.weekDay.localized } let weekdays = [MultiLanguageKey.monday.localized, MultiLanguageKey.tuesday.localized, MultiLanguageKey.wednesday.localized, MultiLanguageKey.thursday.localized, MultiLanguageKey.friday.localized, MultiLanguageKey.saturday.localized, MultiLanguageKey.sunday.localized] var showStr = "" cycleStr.indices.enumerated().forEach { (index, element) in if cycleStr[element] == "1" { showStr += weekdays[index] showStr += " " } } return showStr } /// 获取当前版本号 /// - Returns: 版本号 @objc func currenVersion() -> String? { return firwareModel?.firmwareVersion } } class AdapterModel: NSObject, HandyJSON { /// 适配序号 var number: String = "" /// 设备型号 var model: String = "" /// 固件升级 var firware: String = "" /// 主板名称 var board: String = "" /// 平台 var platform: String = "" /// 应用通知 var appnotice: String = "" /// 来电通知 var callnotice: String = "" /// 短信通知 var smsnotice: String = "" /// 久坐提醒 var longsit: String = "" /// 智能闹钟 var smartalarm: String = "" /// 勿扰模式 var nodisturb: String = "" /// 提醒模式 var remindMode: String = "" /// 喝水提醒 var drinknotice: String = "" /// 表盘推送 var watchnotice: String = "" /// 查找设备 var finddevice: String = "" /// 蓝牙通话 var btcall: String = "" /// 防丢功能 var losenotice: String = "" /// 抬手亮屏 var raisingbright: String = "" /// 智能拍照 var smartphoto: String = "" /// 运动模式 var sports: String = "" /// 血压 var blood: String = "" /// 血氧 var oxygen: String = "" /// 心率 var heart: String = "" /// 心率自动检测 var autoheart: String = "" /// 二维码推送 var qrcodenotice: String = "" /// 天气推送 var weathernotice: String = "" /// 气象指数(紫外线,气压,海拔) var meteorology: String = "" /// 微信运动 var wechatSport: String = "" /// 单位设置 var unitSetup: String = "" /// 更新时间 var updateTimes: String = "" /// 指针校验 var pointerCalibration: String = "" /// 睡眠 var sleep: String = "" /// 通讯录 var telephone: String = "" /// 钱包 var theWallet: String = "" required override init() { } } //久坐模型 class SedentaryModel: HandyJSON, NSCopying { var IsOpen: Bool = false var Cycle: String = "0000000" var EndHour: String = "00" var SittingThreshold: String = "100" var SittingTime: String = "30" var StartHour: String = "00" func copy(with zone: NSZone? = nil) -> Any { let sedentary = SedentaryModel() sedentary.IsOpen = IsOpen let cycle = (Cycle as NSString).integerValue if cycle > 0 { sedentary.Cycle = Cycle } sedentary.StartHour = StartHour sedentary.EndHour = EndHour let sittingTime = (SittingTime as NSString).integerValue if sittingTime > 0 { sedentary.SittingTime = SittingTime } let sittingThreshold = (SittingThreshold as NSString).integerValue if sittingThreshold > 0 { sedentary.SittingThreshold = SittingThreshold } return sedentary } required init() { } } //闹钟模型 @objcMembers class AlarmModel: NSObject, HandyJSON, NSCopying { var IsOpen: Bool = false var Cycle: String = "0000000" var Hour: String? var Minutes: String? var Label: String = "0" required override init() { } func copy(with zone: NSZone? = nil) -> Any { let alarm = AlarmModel() alarm.IsOpen = IsOpen let cycle = (Cycle as NSString).integerValue if cycle > 0 { alarm.Cycle = Cycle } alarm.Hour = Hour alarm.Minutes = Minutes alarm.Label = Label return alarm } } //喝水提醒模型 class DrinkingModel: HandyJSON, NSCopying { var IsOpen: Bool = false var Cycle: String = "0000000" var EndTime: String = "00:00" var Interval: String = "10" var StartTime: String = "00:00" func copy(with zone: NSZone? = nil) -> Any { let drink = DrinkingModel() drink.IsOpen = IsOpen let cycle = (Cycle as NSString).integerValue if cycle > 0 { drink.Cycle = Cycle } drink.StartTime = StartTime drink.EndTime = EndTime let interval = (Interval as NSString).integerValue if interval > 0 { drink.Interval = Interval } return drink } required init() { } } //勿扰提醒模型 class NoDisturbModel: HandyJSON, NSCopying { var StartTime: String = "00:00" var EndTime: String = "00:00" var IsOpen: Bool = false func copy(with zone: NSZone? = nil) -> Any { let noDisturb = NoDisturbModel() noDisturb.StartTime = StartTime noDisturb.EndTime = EndTime noDisturb.IsOpen = IsOpen return noDisturb } required init() { } } /// 心率检测模型 class HeartRateCheckModel: HandyJSON, NSCopying { var IsOpen: Bool = false var EndTime: String = "00:00" var Interval: String = "10" var StartTime: String = "00:00" func copy(with zone: NSZone? = nil) -> Any { let rateCheck = HeartRateCheckModel() rateCheck.IsOpen = IsOpen rateCheck.StartTime = StartTime rateCheck.EndTime = EndTime let interval = (Interval as NSString).integerValue if interval > 0 { rateCheck.Interval = Interval } return rateCheck } required init() { } } /// 体温检测模型 class TemperatureCheckModel: HandyJSON, NSCopying { var IsOpen: Bool = false var EndTime: String = "00:00" var Interval: String = "10" var StartTime: String = "00:00" func copy(with zone: NSZone? = nil) -> Any { let rateCheck = TemperatureCheckModel() rateCheck.IsOpen = IsOpen rateCheck.StartTime = StartTime rateCheck.EndTime = EndTime let interval = (Interval as NSString).integerValue if interval > 0 { rateCheck.Interval = Interval } return rateCheck } required init() { } } @objcMembers class FirmwareModel: HandyJSON { var deviceName: String = "" var platform: Int = 0 var macID: String = "" var adapterNumber: Int = 0 var protocolVersion: String = "" var firmwareVersion: String = "" required init() {} } //手势设置模型 class GestureSetModel: HandyJSON { var Flip: Bool = false var Hand: Int = 0 var Raise: Bool = false required init() { } }