Skip to content

Commit

Permalink
Updated TeslaKit. Added new properties, including canAcceptNavigation…
Browse files Browse the repository at this point in the history
…Requests and isUserPresent. Updated scheduledChargingStartTime to be a Date instead of TimeInterval.
  • Loading branch information
jjjjaren committed Dec 18, 2018
1 parent 867b185 commit 0c11b43
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
28 changes: 25 additions & 3 deletions Source/Enumerations/Error.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,33 @@
import Foundation

///
//public enum Error: String, Error {
//public enum TKError: Error, LocalizedError, CustomStringConvertible {
//
// ///
// case vehicleUnavailable = "vehicle unavailable"
// public enum Code: String {
//
// ///
// case vehicleUnavailable = "vehicle unavailable"
//
// ///
// case invalidCommand = "invalid_command"
// }
//
//
// ///
// case invalidCommand = "invalid_command"
// case api(code: String)
//
// case invalidUsernameOrPassword
//
// public var description: String {
// return ""
// }
//
// public var errorDescription: String? { return nil }
//
// public var failureReason: String? { return nil }
//
// public var helpAnchor: String? { return nil }
//
// public var recoverySuggestion: String? { return nil }
//}
4 changes: 2 additions & 2 deletions Source/Structures/ChargeState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public struct ChargeState {
public var maxRangeChargeCounter: Int = 0

/// The start time of the scheduled charging
public var scheduledChargingStartTime: TimeInterval? = nil
public var scheduledChargingStartTime: Date? = nil

///
public var chargerPower: Int = 0
Expand Down Expand Up @@ -191,7 +191,7 @@ extension ChargeState: DataResponse {
motorizedChargePort <- map["motorized_charge_port"]
notEnoughPowerToHeat <- map["not_enough_power_to_heat"]
scheduledChargingPending <- map["scheduled_charging_pending"]
scheduledChargingStartTime <- map["scheduled_charging_start_time"]
scheduledChargingStartTime <- (map["scheduled_charging_start_time"], CustomDateFormatTransform(formatString: "yyyy-MM-dd'T'hh:mm:ss"))
timeStamp <- map["timestamp"]
timeToFullCharge <- map["time_to_full_charge"]
tripCharging <- map["trip_charging"]
Expand Down
4 changes: 4 additions & 0 deletions Source/Structures/VehicleConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public struct VehicleConfig {
///
public var exteriorColor: String? = nil

///
public var canAcceptNavigationRequests: Bool = false

///
public init() {}
}
Expand Down Expand Up @@ -102,6 +105,7 @@ extension VehicleConfig: Mappable {
timestamp <- map["timestamp"]
trimBadging <- map["trim_badging"]
wheelType <- map["wheel_type"]
canAcceptNavigationRequests <- map["can_accept_navigation_requests"]
}
}

Expand Down
4 changes: 4 additions & 0 deletions Source/Structures/VehicleState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ public struct VehicleState {
///
public var timestamp: TimeInterval = 0

///
public var isUserPresent: Bool = false

///
public var speedLimitMode: SpeedLimitMode = SpeedLimitMode()

Expand Down Expand Up @@ -211,6 +214,7 @@ extension VehicleState: DataResponse {
vehicleName <- map["vehicle_name"]
wheelType <- map["wheel_type"]
locked <- map["locked"]
isUserPresent <- map["is_user_present"]
speedLimitMode <- map["speed_limit_mode"]
softwareUpdate <- map["software_update"]
mediaState <- map["media_state"]
Expand Down

0 comments on commit 0c11b43

Please sign in to comment.