Skip to content

Commit

Permalink
Migrated from JVCocoa to JVSwift
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMisfit68 committed Jan 4, 2024
1 parent 0815014 commit b445697
Show file tree
Hide file tree
Showing 34 changed files with 346 additions and 266 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import HAP
import SoftPLC
import ModbusDriver
import IOTypes
import JVCocoa
import JVSwift

// MARK: - PLC level class
class CirtcuitEnabler:PLCClassAccessoryDelegate, PulsOperatedCircuit, Simulateable{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,14 @@ import HAP
import SoftPLC
import ModbusDriver
import IOTypes
import JVCocoa
import JVSwift

// MARK: - PLC level class
class DimmableLight:PLCClassAccessoryDelegate, DimmedLight{
class DimmableLight:PLCClassAccessoryDelegate{

// MARK: - Accessory binding
typealias AccessorySubclass = Accessory.Lightbulb
var characteristicChanged: Bool = false

var brightnessTimer: BrightnessTimer!

override init(){
super.init()
self.brightnessTimer = BrightnessTimer(dimmer: self)
}

// MARK: - State
var powerState:Bool? = nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import HAP
import SoftPLC
import ModbusDriver
import IOTypes
import JVCocoa
import JVSwift

// MARK: - PLC level class
class Doorlock:PLCClassAccessoryDelegate, PulsOperatedCircuit{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import HAP
import SoftPLC
import ModbusDriver
import IOTypes
import JVCocoa
import JVSwift


class FunctionKey:PLCClassAccessoryDelegate{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import HAP
import SoftPLC
import ModbusDriver
import IOTypes
import JVCocoa
import JVSwift

// MARK: - PLC level class
class GarageDoor:PLCClassAccessoryDelegate, PulsOperatedCircuit{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import HAP
import SoftPLC
import ModbusDriver
import IOTypes
import JVCocoa
import JVSwift
import OSLog

// MARK: - PLC level class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import HAP
import SoftPLC
import ModbusDriver
import IOTypes
import JVCocoa
import JVSwift

// MARK: - PLC level class
class Outlet:PLCClassAccessoryDelegate{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import HAP
import SoftPLC
import ModbusDriver
import IOTypes
import JVCocoa
import JVSwift
import WeatherKit
import JVWeather
import CoreLocation
import OSLog

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import HAP
import SoftPLC
import ModbusDriver
import IOTypes
import JVCocoa
import JVSwift

// MARK: - PLC level class
class ToggleableOutlet:PLCClassAccessoryDelegate, PulsOperatedCircuit, Simulateable{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import HAP
import SoftPLC
import ModbusDriver
import IOTypes
import JVCocoa
import JVSwift

// MARK: - PLC level class
class WindowCovering:PLCClassAccessoryDelegate, PulsOperatedCircuit, Simulateable{
Expand Down
2 changes: 1 addition & 1 deletion Accessory Delegates/AccessoryDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation
import HAP
import JVCocoa
import JVSwift
import SoftPLC
import OSLog

Expand Down
2 changes: 1 addition & 1 deletion Accessory Delegates/LeafAccessoryDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation
import HAP
import JVCocoa
import JVSwift
import LeafDriver
import OSLog

Expand Down
10 changes: 3 additions & 7 deletions Accessory Delegates/MilightAccessoryDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@

import Foundation
import HAP
import JVCocoa
import JVSwift
import MilightDriver
import OSLog

/// Handles characteristic changes for a Homekit Accessory.
/// It uses the MilightDriver to pass those changes to the hardware

class MilightAccessoryDelegate:MilightDriverV6, AccessoryDelegate, DimmedLight {
class MilightAccessoryDelegate:MilightDriverV6, AccessoryDelegate{

var brightnessTimer: BrightnessTimer!

let zone:MilightDriver.Zone
var name: String{
Expand All @@ -27,7 +26,6 @@ class MilightAccessoryDelegate:MilightDriverV6, AccessoryDelegate, DimmedLight {
init(ipAddress: String, zone:MilightDriver.Zone){
self.zone = zone
super.init(ipAddress: ipAddress)
self.brightnessTimer = BrightnessTimer(dimmer: self)
}

var characteristicChanged: Bool = false
Expand Down Expand Up @@ -85,9 +83,7 @@ class MilightAccessoryDelegate:MilightDriverV6, AccessoryDelegate, DimmedLight {

case CharacteristicType.brightness:

// brightness = characteristic.value as! Int
self.brightnessTimer.timeFor100percentChange = 1800
self.brightnessTimer.targetBrightness = (characteristic.value as! Int)
brightness = characteristic.value as! Int

case CharacteristicType.hue:

Expand Down
2 changes: 1 addition & 1 deletion Accessory Delegates/PLCAccessoryDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation
import HAP
import JVCocoa
import JVSwift
import SoftPLC
import OSLog

Expand Down
2 changes: 1 addition & 1 deletion Accessory Delegates/TizenAccessoryDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation
import HAP
import JVCocoa
import JVSwift
import TizenDriver
import OSLog

Expand Down
2 changes: 1 addition & 1 deletion HAP Extensions/Accessory/Accessory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation
import SoftPLC
import HAP
import JVCocoa
import JVSwift

extension HAP.Accessory{

Expand Down
2 changes: 1 addition & 1 deletion HAP Extensions/Bridge(Device]/Bridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

import Foundation
import JVCocoa
import JVSwift
import OSLog
import HAP
import SoftPLC
Expand Down
3 changes: 1 addition & 2 deletions HAP Extensions/Custom Accessories/ElectricCarAccessory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import HAP

extension Accessory {

class ElectricCar: Accessory{

class ElectricCar:Accessory{

let primaryService:Service.Battery = Service.Battery(characteristics: [.name(String(localized: "Battery status",table: "ServiceNames")),
AnyCharacteristic(GenericCharacteristic<Double>(
Expand Down
Loading

0 comments on commit b445697

Please sign in to comment.