FileType

public struct FileType
extension FileType: Equatable
extension FileType: Hashable
extension FileType: FitFieldCodeable

FIT File Type

  • Raw Value for File Type

    Declaration

    Swift

    public let rawValue: UInt8
  • Manufacturing Speciic Range Check

    Declaration

    Swift

    public var isManufacturingType: Bool { get }
  • Init FileType

    Declaration

    Swift

    public init(rawValue: UInt8)

    Parameters

    rawValue

    Raw File Type Number (ex: 4 == Activity)

  • Returns a Boolean value indicating whether two values are equal.

    Equality is the inverse of inequality. For any values a and b, a == b implies that a != b is false.

    Declaration

    Swift

    public static func == (lhs: FileType, rhs: FileType) -> Bool

    Parameters

    lhs

    A value to compare.

    rhs

    Another value to compare.

  • Hashes the essential components of this value by feeding them into the given hasher.

    Implement this method to conform to the Hashable protocol. The components used for hashing must be the same as the components compared in your type’s == operator implementation. Call hasher.combine(_:) with each of these components.

    Important

    Never call finalize() on hasher. Doing so may become a compile-time error in the future.

    Declaration

    Swift

    public func hash(into hasher: inout Hasher)

    Parameters

    hasher

    The hasher to use when combining the components of this instance.

Types

  • Non FIT File

    Declaration

    Swift

    static let nonFitFile: FileType
  • Device - Read only, single File

    The device file contains data records that provide information on a device’s file structure/capabilities. The records provide details on the types of files a device supports, and restrictions/capabilities (if applicable) of the messages and fields contained within each file type.

    Declaration

    Swift

    static let device: FileType
  • Settings - Read/Write, single File

    The settings file contains data records that provide user and device information in the form of profiles. Each profile is grouped into either user, bike, or specific device profiles (such as HRMs, SDMs and activity monitors). The profiles provide information about the user, bicycle, sensors that a device may pair to, and user interface preferences.

    Declaration

    Swift

    static let settings: FileType
  • Sport - Read/write, multiple files

    The sports settings file contains information about the user’s desired target zones. The records provide details on the types of zones supported (such as heart rate or power), and the desired target levels. The sports settings file allows these values to be grouped by sport.

    Declaration

    Swift

    static let sport: FileType
  • Activity - Read/write/erase, multiple files

    Activity files are used to record sensor data and events from an active session

    Declaration

    Swift

    static let activity: FileType
  • Workout - Read/write/erase, multiple files

    A workout file describes a structured activity and guides a user through the activity. It can be designed on a computer and transferred to a display device or generated on the device itself.

    Declaration

    Swift

    static let workout: FileType
  • Course - Read/write/erase, multiple files

    A course file contains data from a recorded activity that can be transferred to a display device to guide a user through the same activity.

    Declaration

    Swift

    static let course: FileType
  • Schedules - Read/write, single file

    Schedule files are used to schedule a user’s workouts and may contain multiple schedule messages each representing the start time of a workout.

    Declaration

    Swift

    static let schedules: FileType
  • Weight - Read, single file

    A weight file is similar in structure to the blood pressure file type. A weight file contains time-stamped discrete measurement data that is reported after measurement. The file is organized such that all definition messages are declared first, prior to recording any weight messages. No definition messages should appear after weight data messages have been recorded. To link multiple data messages in a weight file, they must have identical timestamps.

    Declaration

    Swift

    static let weight: FileType
  • Totals - Read, single file

    Totals files are used to summarize a user’s activities and may contain multiple totals messages each representing summaries of a different activity type/sport.

    Declaration

    Swift

    static let totals: FileType
  • Goals - Read/write, single file

    Goals files allow a user to communicate their exercise/health goals. Goals may be set for a variety of activities, over specific periods of time, and with desired targets set according to total duration, calories consumed, distance travelled, number of steps taken and/or frequency of activity.

    Declaration

    Swift

    static let goals: FileType
  • Blood Pressure - Read

    Declaration

    Swift

    static let bloodPressure: FileType
  • Monitoring A - Read

    Declaration

    Swift

    static let monitoringA: FileType
  • Activity Summary - Read/erase

    Activity summary files are a compact version of the activity file.

    Declaration

    Swift

    static let activitySummary: FileType
  • Monitoring Daily

    Declaration

    Swift

    static let monitoringDaily: FileType
  • Monitoring B - Read

    Declaration

    Swift

    static let monitoringB: FileType
  • Segment - Read/write/erase

    Segment files contain data defining a route and timing information to gauge progress against previous performances or other users.

    Declaration

    Swift

    static let segment: FileType
  • Segment List - Read/write/erase

    Segment List files maintain a list of available segments on the device.

    Declaration

    Swift

    static let segmentList: FileType
  • Extd Configuration - Read/write/erase

    Declaration

    Swift

    static let extdConfiguration: FileType
  • Invalid

    Declaration

    Swift

    static let invalid: FileType

FitFieldCodeable

  • Encode Into Data

    Declaration

    Swift

    public func encode(base: BaseTypeData) -> Data?

    Parameters

    base

    BaseTypeData

  • Decode FIT Field

    Declaration

    Swift

    public static func decode<T>(type: T.Type, data: Data, base: BaseTypeData, arch: Endian) -> T?

    Parameters

    type

    Type of Field

    data

    Data to Decode

    base

    BaseTypeData

    arch

    Endian

    Return Value

    Decoded Value