Swiftpack.co - Package - highmobility/auto-api-swift

AutoAPI Swift SDK

The AutoAPI Swift SDK purpose is to help developers serialise AutoAPI data in Swift, so they wouldn't have to worry about parsing and generating the bytes themselves. The SDK is generated based on the AutoAPI spec.

Table of contents

Features

Serialising: The library is designed to serialise AutoAPI data to and from Swift types.

Support for Updates: Updates to the AutoAPI spec (non-binary) will work with older versions of the library and the new types of data are accessible.

Integration

It's recommended to use the library through Swift Package Manager (SPM), which is now also built-in to Xcode and accessible in File > Swift Packages > ... or going to project settings and selecting Swift Packages in the top-center.
When targeting a Swift package, the Package.swift file must include .package(url: "https://github.com/highmobility/auto-api-swift", .upToNextMinor(from: "[__version__]")), under dependencies.

If SPM is not possible, the source can be downloaded directly from Github and built into an .xcframework using an accompaning script: XCFrameworkBuilder.sh. The created package includes both the simulator and device binaries, which must then be dropped (linked) to the target Xcode project.

Furthermore, when .xcframework is also not suitable, the library can be made into a fat binary (.framework) by running UniversalBuildScript.sh. This combines both simulator and device slices into one binary, but requires the simulator slice to be removed before being able to upload to App Store Connect – for this there is a AppStoreCompatible.sh script included inside the created .framework folder.

Requirements

AutoAPI Swift SDK requires Xcode 11.0 or later and is compatible with apps targeting iOS 10.0 or above.

Getting started

Get started by reading the iOS AutoAPI guide in high-mobility.com.

Check out the spec for more details on the structure and logic, or some other libs generatated on that spec: Android, Elixir.

Examples

There are 3 sample apps available on Github.com to showcase usage of AutoAPI (and HMKit):

  • Scaffold
    • Demonstrates the most basic usage of AutoAPI.
  • Data Viewer
    • Tries to parse and show the AutoAPI data received from a vehicle. Limited functionality to send commands.
  • AutoAPI Explorer
    • Incorporates all the "abilities" of the previous sample apps along with more commands to send to the vehicle and takes a shot at a nice(r) UI.

Contributing

We would love to accept your patches and contributions to this project. Before getting to work, please first discuss the changes that you wish to make with us via GitHub Issues, Spectrum or Slack.

The generator used to create this lib, based on the AutoAPI spec, will be open-sourced in the near future. Until then, changes to the Swift interface need to go through our private generator. If you'd like to make changes to the AutoAPI, please see here.

Releases are done by tagged commits (as required by SPM, please read more about it here and here).

See more in CONTRIBUTING.md

License

This repository is using MIT license. See more in LICENSE

Github

link
Stars: 1

Dependencies

Used By

Total: 0

Releases

- 2020-01-23 11:07:56

New LICENCE!

Added back scripts to deal with fat-binaries. Updated README.

- 2020-01-17 10:04:51

New LICENCE!

Added back scripts to deal with fat-binaries. Updated README.

- 2020-01-08 13:21:53

New AutoAPI L11 binary parser and generator. Most of the lib is generated based on the AutoAPI spec and will have different names, i.e. Door Locks is replaced by Doors. For API change log, please see the releases page at high-mobility.com. For more information regarding names of capabilities and others, please check the AutoAPI guide.

- 2020-01-08 11:46:07

Updated dependecies. Updated XCFrameworkBuilder script.

- 2019-10-16 09:20:15

Changed type AutoAPI to AAAutoAPI to make XCFramework usable.

Proper Xcode 11 release.

- 2019-10-15 13:22:33

Proper Xcode 11 release.

10.0.8 - 2019-09-17 11:51:40

Updated for Xcode 11 GM2. Added XCFramework building script (and removed the "old" universal scripts). Removed typealias AutoAPI to make XCFramework usable.

- 2019-09-17 11:20:54

Updated for Xcode 11 GM2. Changed type AutoAPI to AAAutoAPI to make XCFramework usable. Added XCFramework building script (and removed the "old" universal scripts).

- 2019-09-11 11:39:57

Updated for Xcode 11 GM and Swift 5.1

- 2019-09-11 11:32:39

Updated for Xcode 11 GM and Swift 5.1

- 2019-08-21 13:28:02

Updated for Xcode 11b6 to use with it's integrated SPM and Swift 5.1 Removed the CLT target for now.

- 2019-08-21 13:21:25

Updated for Xcode 11b6 to use with it's integrated SPM and Swift 5.1 Removed the CLT target for now.

- 2019-05-27 07:57:19

Further improved the parsing speed by 20-50%.

- 2019-05-02 09:41:54

Improved parsing speed by 100-1000x

Added AutoAPI Profiler to be able to use Instruments. Renamed AACommandIdentifier to AACapabilityIdentifier. Other minor fixes.

- 2019-04-05 08:03:20

Fixed multiple AAItem subtypes.
Fixed other minor issues found through tests.
Removed obsolete files.

- 2019-03-29 09:10:24

Updated to Swift 5 Updated HMUtilities to 1.3.x

- 2019-03-29 08:05:57

Updated to Swift 5

AANaviDestination, AARace, Chassis' types and General Capabilities fixes.

- 2019-03-18 10:06:48

Added multi state response to MultiCommand.

- 2019-03-11 15:03:01

Fixed AACapability's debugging property .debugTree: HMDebugTree to parse the new L10 properly.

- 2019-02-25 17:01:33

Rewritten property-capability-command architecture.

  • Properties are wrapped in a new type AAProperty, with it's main accessors:
    • .value: ValueType?
    • .failure: AAPropertyFailure?
    • .timestamp: Date?
  • AACapability renamed to AACapabilityValue:
    • It's .command renamed to .capability
  • AACommand rewritten and renamed to AACapability:
    • Also conforms to AACapabilityClass
  • Outgoing commands' methods return a rewritten type AACommand (used to return [UInt8]):
    • Has .bytes accessor for getting the data to send
  • Percentage changed from UInt32 (0-100 value) to Double (0.0-1.0 value).

- 2019-01-03 10:47:11

Removed:

  • All legacy types.

New:

  • AAPropertyFailure type to convey that getting a property failed.

Added:

  • AAFueling

    • .gasFlapLockState: AALockState?
    • .gasFlapPosition: AAPositionState?
  • AALights

    • .fogLights: [AAFogLight]?
    • .readingLamps: [AAReadingLamp]?
    • .interiorLamps: [AAInteriorLamp]?
    • .controlLights(... fogLights: [AAFogLight]?, readingLamps: [AAReadingLamp]?, interiorLamps: [AAInteriorLamp]?)
  • AAMultiCommand

    • .states: [AAVehicleState]? – returned when a multi-command is sent.

Updated:

  • AADoorLocks

    • .insideLocks: [AADoorLock]?
    • .locks: [AADoorLock]?
    • .positions: [AADoorPosition]?
  • AAFailureMessage

    • .reason: AAFailureReason?
  • AAFueling

    • .controlGasFlap(lockState: AALockState?, position: AAPositionState?) – renamed.
  • AALights

    • .frontExterior: AAFrontLightState?

- 2018-12-03 07:46:17

New:

  • MultiCommand for sending multiple commands at the same time

Added:

  • Diagnostics
    • .mileageMeters: UInt32?

- 2018-12-03 07:41:57

New:

  • AAMultiCommand for sending multiple commands at the same time

Added:

  • AADiagnostics
    • .mileageMeters: UInt32?
  • AARooftopControl
    • .sunroofState: AAPositionState?
    • .controlRooftop(... sunroofState: AAPositionState?)

- 2018-11-08 08:38:48

New AutoAPI Level 8 framework.
Not compatible with Level 7, but L7 usage has been temporarily made available through .legacy and Legacy access points on different capabilities.
Most of AutoAPI has been rewritten, with a lot of additional capabilities, properties and commands added.
All types now have an AA prefix, to reduce namespace pollution.

- 2018-09-27 09:02:10

Proper Xcode 10 and Swift 4.2 release.

- 2018-08-21 08:40:39

Updated to Swift 4.2

- 2018-07-19 09:24:46

Replaced UInt8-s that represent a 0-100% value with PercentageInt for clarity.

- 2018-05-11 07:23:13

Updated AutoAPI to level 7 with new capabilities and added properties to some existing capabilities.
Moved DebugTree to HMUtilities.

- 2018-04-12 17:24:50

Fixed invalid bundle-identifier and bitcode problems.

Swift 4.1 - 2018-04-03 08:09:08

Updated to Swift 4.1