!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Copyright 2014-2015, Matt Giles'Modified BSD License (see LICENSE file)matt.w.giles@gmail.com experimentalSafe(>:Convenience type for values to use in a big-endian context=Convenience type for values to use in a little-endian context=Tag a value for use in a little- or big-endian context (with  and , respectively) Alias for   Alias for      Copyright 2014-2015, Matt Giles'Modified BSD License (see LICENSE file)matt.w.giles@gmail.com experimentalNoneParse n bytes and interpret them as a little-endian integer. The caller must ensure that the returned type is the correct size for the number of bytes parsed.Parse n bytes and interpret them as a big-endian integer. The caller must ensure that the returned type is the correct size for the number of bytes parsed.nGet the number of 8-bit bytes used to represent the given number. The actual value passed is not used at all.     Copyright 2014-2015, Matt Giles'Modified BSD License (see LICENSE file)matt.w.giles@gmail.com experimentalSafe2The different types that FIT uses for field values.A time offset is 5 bits10A local message type is a 4 bit unsigned integer4Each message has a header that primarily determines whether the message is a definition or data message. If the message uses a compressed timestamp header7, the header also contains the compressed time offset.8Array values use similar constructors to singleton values. However, there is no constructor for arrays of strings, which seem to be unused in FIT.FSingleton values. There is a Value constructor for each BaseType constructor. The wrapped value in these constructors corresponds to the specific format used in the FIT file, for example an enuma in FIT is stored as an 8-bit unsigned int (ie a Word8). The primary exception to this is using  for string values.NA string> in FIT is a null-terminated arrays of UTF-8 code units, but  is used here insteadUNA single field in a data message, containing the field number and the value(s)X5Defines the structure for a single field in a messageZThe  field numberl. The interpretation of the field number depends on the global message type and is found in the FIT profile[The size, in bytes, of the field's contents. This will be a multiple of the base type size. In a singleton field this size will be the same as the base type size. In an array field it will be some multiple of the base type size.\(The FIT base type of values in the field]A ] for a local message type (LMT) determines how future data messages with that LMT are decoded. LMTs can be re-used: a data message with LMT n will use the  most recent message definition for LMT n._$The local message type being defined`The global7 message type this LMT will refer to. Must be a valid mesg_num value from the FIT profileaThe  architectureT this messages with this LMT will use for multi-byte values (little- or big-endian)b>Definitions for the fields messages with this LMT will containc$There are two kinds of FIT messages:Definition messages0 set the structure for messages of a particular local message type Data messagesa contain the actual information, according to the structure given by a definition message.fThe FIT file headerhSSize of the header in bytes. Will always be 12 or 14, based on presence of the CRCiProtocol version numberjProfile version numberk-Combined length of the FIT messages, in bytesl!File tag, should always be ".FIT"m%Optional checksum for header contentsn=A FIT file consists of a header and a collection of messages.s=Only the lower 4 bits of the integer are used to construct a 1t Unwrap a 10. The resulting integer will be between 0 and 15u,Only the lower 5 bits of the number are usedv?Get the size in bytes for a single value of the given base type[ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuv[ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuv[nopqfghijklmcder]^_`abXYZ[\UVWFGHIJKLMNOPQRST89:;<=>?@ABCDE4567123st./0u+,- !"#$%&'()*v !"#$%&'()*+,-./012345678 9:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvCopyright 2014-2015, Matt Giles'Modified BSD License (see LICENSE file)matt.w.giles@gmail.com experimentalNoneUwThe definitions are stored as a map on the local message type number. When a definition is parsed with a previously-used local message type, the previous definition is overwritten.z)The necessary state for parsing FIT files|The active endian-ness}%The set of active message definitions~"The most recently stored timestampTurn a  into a plain attoparsec b. This doesn't require any configuration as the initial state for a FIT parse is always the same.3Little-endian interpretation is used by default by . Use this function to set the endianness to use for the scope of a particular action. After the action is finished the previous endianness is restored. Register a ]Q with the parser, so it can decode subsequent data messages using the definition Look up the ] for the given message type. It is an error to look up a message type that has no registered definition, since it is impossible to decode a data message with no definitionStore the given + as the most recent. Is used to store timestamps from non-compressed timestamp messages. For compressed-timestamp messages use  instead.Use the given . and the previous +& to compute a new Timestamp. The new +* is stored as most recent and is returned.5This function fails if there is no previously-stored +E. This condition should never come up when parsing a valid FIT file.*Parse a Word16 using the active endianness*Parse a Word32 using the active endianness*Parse a Word64 using the active endianness*Parse an Int16 using the active endianness+Parse an Int32 using the active endiannessa*Parse an Int64 using the active endianness)Parse a Float using the active endianness*Parse a Double using the active endiannessePerform an architecture-sensitive operation with separate actions for little- and big-endian parsing/wxyz{|}~wxyz{|}~z{|}~wxy'wxyz{|}~Copyright 2014-2015, Matt Giles'Modified BSD License (see LICENSE file)matt.w.giles@gmail.com experimentalNoneUZParse a strict  containing the FIT data into a n valueAn Attoparsec parser for n valuesThis function will fail if the  is $|. This implementation currently doesn't support arrays of strings, but treats char arrays as always being a single string.Run a  n times to parse a  of values%Parse a null-terminated UTF-8 string.0Parse a compressed-timestamp message, using the ./ from the compressed-timestamp message header.+Transform a FIT message header byte into a 4#The number of elements in the arrayThe base element typeCopyright 2014-2015, Matt Giles'Modified BSD License (see LICENSE file)matt.w.giles@gmail.com experimentalNone Array values. Like singleton values these ignore the specific FIT base type to present a simpler interface. Byte arrays are presented as strict 6s. There are no character arrays, since the singleton  handles that case.A singleton value. In the Messages API we abstract over the specific FIT base type of the field. For example, the FIT types uint8, sint8, uint16, etc. are all presented as an @. FIT strings (ie. character arrays) are presented as singleton Ps. If you need to know the specific base type of a field you can use the API in Fit.Internal.FitFile.[FIT values can either contain a single piece of data or an array. FIT arrays are homogenous$A single field in a FIT data message-The field number, as found in the FIT profileA FIT data message6The global message number, as found in the FIT profile7The fields in the message, mapped from field number to 2The collection of data messages from the FIT file.Parse a strict " containing the FIT data into its "Parse the given FIT file into its An Attoparsec parser for Copyright 2014-2015, Matt Giles'Modified BSD License (see LICENSE file)matt.w.giles@gmail.com experimentalNoneTraverse all the messages in a  'messages :: Traversal' Messages Message6A Fold over the messages with the given message number 'message :: Int -> Fold Messages Message"Lens on the message number from a  "messageNumber :: Lens' Message IntTraverse all the fields in a  "fields :: Traversal' Message FieldA Fold over the fields in a  with the given field number "field :: Int -> Fold Message Field Lens on the field number from a  fieldNumber :: Lens Field Int Lens on the  from a  fieldValue :: Lens Field Value Traverse the  and  constructors for a field value int :: Traversal' Field Int Traverse the  and  constructors for a field value real :: Traversal' Field Double Traverse the  and  constructors for a field value text :: Traversal' Field Text Traverse the  and  constructors for a field value byte :: Traversal' Field Word8 Traverse the  and  constructors for a field value "ints :: Traversal' Field (Seq Int) Traverse the  and  constructors for a field value &reals :: Traversal' Field (Seq Double) Travese the  and  constructors for a field value )bytestring :: Traversal' Field ByteStringCopyright 2014-2015, Matt GilesModified BSD Licensematt.w.giles@gmail.com experimentalNone((       !"#$%&'()*+,-./01233456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^__`abcdefghijklmnopqrstuvwxyz{|}~~L[M?\\iifit_BsEsSqllU6a8QYusKLonYTFit.Internal.ArchitectureFit.Internal.NumbersFit.Internal.FitFileFit.Internal.FitParserFit.Internal.Parse Fit.MessagesFit.Messages.LensFit BigEndian LittleEndianWithArchunArchArch ArchLittleArchBigwithLEwithBEword16leword32leword64leint16leint32leint64le float32le float64le nByteIntLeword16beword32beword64beint16beint32beint64be float32be float64be nByteIntBeBaseTypeFitEnumFitSInt8FitUInt8 FitSInt16 FitUInt16 FitSInt32 FitUInt32 FitString FitFloat32 FitFloat64 FitUInt8Z FitUInt16Z FitUInt32ZFitByte Timestamp unTimestamp TimeOffsetTOunToLocalMessageTypeLMTunLmt MessageHeader DefHeader DataHeader CTDataHeaderArray EnumArray SInt8Array UInt8Array SInt16Array UInt16Array SInt32Array UInt32Array Float32Array Float64Array UInt8ZArray UInt16ZArray UInt32ZArray ByteArrayValue EnumValue SInt8Value UInt8Value SInt16Value UInt16Value SInt32Value UInt32Value StringValue Float32Value Float64Value UInt8ZValue UInt16ZValue UInt32ZValue ByteValueFieldSingletonField ArrayFieldFieldDeffdNumfdSize fdBaseTypeMessageDefinition MessageDef defLocalType defGlobalTypedefArch defFieldsMessageDefMDataM FitHeaderFHfhSizefhProtocolVersionfhProfileVersion fhDataSize fhDataTypefhCrcfHeader fMessagesmsgLmtmkLocalMessageTypeunLocalMessageType mkTimeOffsetbtSize DefinitionsDefsunDefsFpState_fpArch_fpMessageDefs_fpLastTimestamp FitParser runFitParserwithArchitecture addMessageDeflookupMessageDefstoreTimestampupdateTimestampword8int8 archWord16 archWord32 archWord64 archInt16 archInt32 archInt64 archFloat32 archFloat64 readFitRawparseFit parseHeader parseMessages parseMessageparseMessageDef parseFieldDefparseDataMessage parseField parseValue parseArrayparseSeq parseStringparseCTDataMessagemkHeader ArrayValueIntArray RealArraySingletonValueIntValue RealValue TextValue Singleton_fNumber_fValue_mNumber_mFieldsMessages _messages readMessagesreadFileMessagesmessagesmessage messageNumberfieldsfield fieldNumber fieldValueintrealtextbyteintsreals bytestringbaseGHC.Basepure$fApplicativeWithArch$fFunctorWithArchbyteSizeparseLeparseBetoFloattoDoubletext_5c7VCmRXJenGcMPs3kwpkIData.Text.InternalTextattop_KGz8kXnHawX2yTRIBzGnQa#Data.Attoparsec.ByteString.InternalParserwithArchIdentity runIdentitySetterGetterLenssetArchfpArch fpMessageDefsfpLastTimestampdefAdd defLookupdefEmptyviewoversetuseassign.=%=$fFunctorIdentitybytes_6VWy06pWzJq9evDvK2d4w6Data.ByteString.Internal ByteStringconta_2C3ZI8RgPO2LBMidXKTvIU Data.SequenceSeqTimestampField toMessages toMessagetoFieldfromSingletonValue fromArraycoerce