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.
 
 
 

324 lines
8.3 KiB

//
// 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() { }
}