Swiftpack.co - Package - FitnessKit/DataDecoder

DataDecoder

Swift Data Decoder. Easily Decode Data values

Swift4 CI Status Version License Platform Readme Score

Installation

DataDecoder is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "DataDecoder"

Swift Package Manager:

Swift3

    dependencies: [
        .Package(url: "https://github.com/FitnessKit/DataDecoder", majorVersion: 0)
    ]

Swift4

    dependencies: [
        .package(url: "https://github.com/FitnessKit/DataDecoder", from: "4.1.1"),
    ]

How to Use

  let sensorData: Data = Data([ 0x02, 0xFE, 0xFF, 0xEF, 0xBE, 0xAD, 0xDE, 0xA5])

  var decoder = DecodeData()
  let height = decoder.decodeUInt8(sensorData)
  let weight = decoder.decodeUInt16(sensorData)
  let deadbeef = decoder.decodeUInt32(sensorData)
  let nib = decoder.decodeNibble(sensorData)
  let novalue = decoder.decodeNibble(sensorData) //This should come back 0 as there is no more data left

Data Decoders

  • Nibble
  • UInt8/Int8
  • UInt16/Int16
  • UInt24/Int23
  • UInt32/Int32
  • UInt48
  • UInt64/Int64
  • IEEE-11073 16-bit SFLOAT
  • IEEE-11073 32-bit FLOAT
  • IP Address to String Value
  • MAC Address to String Value

Author

This package is developed and maintained by Kevin A. Hoogheem

License

DataDecoder is available under the MIT license

Github

link
Stars: 4
Help us keep the lights on

Dependencies

Used By

Total: 0

Releases

4.1.1 - Jan 14, 2018

4.0.1 - Sep 30, 2017

4.0.0 - Sep 30, 2017

0.6.3 - Jul 10, 2017

0.6.1 - May 7, 2017