rtcm 0.2.11 → 0.2.13
raw patch · 4 files changed
+193/−127 lines, 4 filesdep ~aesondep ~arraydep ~base
Dependency ranges changed: aeson, array, base, base64-bytestring, basic-prelude, binary, binary-bits, binary-conduit, bytestring, conduit, conduit-extra, lens, lens-aeson, random, tasty, tasty-hunit, tasty-quickcheck, template-haskell, text, word24
Files
- rtcm.cabal +93/−99
- src/Data/RTCM3/Ephemerides.hs +28/−28
- src/Data/RTCM3/Extras.hs +48/−0
- test/Test/Data/RTCM3/Extras.hs +24/−0
rtcm.cabal view
@@ -1,110 +1,104 @@-name: rtcm-version: 0.2.11-cabal-version: >=1.22-build-type: Simple-license: BSD3-copyright: Copyright (C) 2015-2017 Swift Navigation, Inc.-maintainer: Swift Navigation <dev@swift-nav.com>-homepage: http://github.com/swift-nav/librtcm-synopsis: RTCM Library.+name: rtcm+version: 0.2.13+synopsis: RTCM Library.+description: Haskell bindings for RTCM.+homepage: http://github.com/swift-nav/librtcm+license: BSD3+author: Mark Fine <mark@swift-nav.com>, Joshua Gross <josh@swift-nav.com>+maintainer: Swift Navigation <dev@swift-nav.com>+copyright: Copyright (C) 2015-2017 Swift Navigation, Inc.+category: Network+build-type: Simple+cabal-version: >= 1.22 description:- Haskell bindings for Radio Technical Commission For Maritime- Services (RTCM) standard, supporting GPS, GLONASS, Galileo and other- satellite-based position systems operation with one reference- station or a network.-category: Network-author: Mark Fine <mark@swift-nav.com>, Joshua Gross <josh@swift-nav.com>+ Haskell bindings for Radio Technical Commission For Maritime+ Services (RTCM) standard, supporting GPS, GLONASS, Galileo and other+ satellite-based position systems operation with one reference+ station or a network. source-repository head- type: git- location: https://github.com/swift-nav/librtcm+ type: git+ location: https://github.com/swift-nav/librtcm library- exposed-modules:- Data.CRC24Q- Data.RTCM3- Data.RTCM3.Antennas- Data.RTCM3.Ephemerides- Data.RTCM3.Internal- Data.RTCM3.Observations- Data.RTCM3.SSR- Data.RTCM3.System- Data.RTCM3.Types- build-depends:- aeson >=0.11.3.0,- array >=0.5.1.0,- base >=4.8 && <5,- base64-bytestring >=1.0.0.1,- basic-prelude >=0.5.2,- binary >=0.7.5.0,- binary-bits >=0.5,- bytestring >=0.10.6.0,- lens >=4.13,- lens-aeson >=1.0.0.5,- template-haskell >=2.10.0.0,- text >=1.2.2.2,- word24 >=2.0.1- default-language: Haskell2010- hs-source-dirs: src- other-modules:- Data.RTCM3.Extras- Data.RTCM3.TH- ghc-options: -Wall+ hs-source-dirs: src+ exposed-modules: Data.CRC24Q+ , Data.RTCM3+ , Data.RTCM3.Antennas+ , Data.RTCM3.Ephemerides+ , Data.RTCM3.Internal+ , Data.RTCM3.Observations+ , Data.RTCM3.SSR+ , Data.RTCM3.System+ , Data.RTCM3.Types+ other-modules: Data.RTCM3.Extras+ , Data.RTCM3.TH+ ghc-options: -Wall+ build-depends: aeson+ , array+ , base >= 4.8 && < 5+ , base64-bytestring+ , basic-prelude+ , binary+ , binary-bits+ , bytestring+ , lens+ , lens-aeson+ , template-haskell+ , text+ , word24+ default-language: Haskell2010 executable rtcm32json- main-is: rtcm32json.hs- build-depends:- aeson >=0.11.3.0,- base >=4.8.2.0,- basic-prelude >=0.5.2,- binary-conduit >=1.2.4.1,- bytestring >=0.10.6.0,- conduit >=1.2.10,- conduit-extra >=1.1.16,- rtcm- default-language: Haskell2010- hs-source-dirs: main- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ hs-source-dirs: main+ main-is: rtcm32json.hs+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ build-depends: aeson+ , base+ , basic-prelude+ , binary-conduit+ , bytestring+ , conduit+ , conduit-extra+ , rtcm+ default-language: Haskell2010 executable json2rtcm3- main-is: json2rtcm3.hs- build-depends:- aeson >=0.11.3.0,- base >=4.8.2.0,- basic-prelude >=0.5.2,- binary-conduit >=1.2.4.1,- conduit >=1.2.10,- conduit-extra >=1.1.16,- rtcm- default-language: Haskell2010- hs-source-dirs: main- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ hs-source-dirs: main+ main-is: json2rtcm3.hs+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ build-depends: aeson+ , base+ , basic-prelude+ , binary-conduit+ , conduit+ , conduit-extra+ , rtcm+ default-language: Haskell2010 test-suite test- type: exitcode-stdio-1.0- main-is: Test.hs- build-depends:- base >=4.8.2.0,- basic-prelude >=0.5.2,- binary >=0.7.5.0,- binary-bits >=0.5,- bytestring >=0.10.6.0,- lens >=4.13,- random >=1.1,- rtcm,- tasty >=0.11.2.1,- tasty-hunit >=0.9.2,- tasty-quickcheck >=0.8.4,- word24 >=2.0.1- default-language: Haskell2010- hs-source-dirs: test- other-modules:- Test.Data.CRC24Q- Test.Data.RTCM3.Antennas- Test.Data.RTCM3.Ephemerides- Test.Data.RTCM3.Extras- Test.Data.RTCM3.Observations- Test.Data.RTCM3.SSR- Test.Data.RTCM3.System- Test.Data.RTCM3.Test- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ type: exitcode-stdio-1.0+ hs-source-dirs: test+ main-is: Test.hs+ other-modules: Test.Data.CRC24Q+ , Test.Data.RTCM3.Antennas+ , Test.Data.RTCM3.Ephemerides+ , Test.Data.RTCM3.Extras+ , Test.Data.RTCM3.Observations+ , Test.Data.RTCM3.SSR+ , Test.Data.RTCM3.System+ , Test.Data.RTCM3.Test+ build-depends: base+ , basic-prelude+ , binary+ , binary-bits+ , bytestring+ , lens+ , random+ , rtcm+ , tasty+ , tasty-hunit+ , tasty-quickcheck+ , word24+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ default-language: Haskell2010
src/Data/RTCM3/Ephemerides.hs view
@@ -328,21 +328,21 @@ _glonassEphemeris_bn_msb <- B.getBool _glonassEphemeris_p2 <- B.getBool _glonassEphemeris_tb <- B.getWord8 7- _glonassEphemeris_xndot <- getInt32be 24- _glonassEphemeris_xn <- getInt32be 27- _glonassEphemeris_xndotdot <- getInt8 5- _glonassEphemeris_yndot <- getInt32be 24- _glonassEphemeris_yn <- getInt32be 27- _glonassEphemeris_yndotdot <- getInt8 5- _glonassEphemeris_zndot <- getInt32be 24- _glonassEphemeris_zn <- getInt32be 27- _glonassEphemeris_zndotdot <- getInt8 5+ _glonassEphemeris_xndot <- getSInt32be 24+ _glonassEphemeris_xn <- getSInt32be 27+ _glonassEphemeris_xndotdot <- getSInt8 5+ _glonassEphemeris_yndot <- getSInt32be 24+ _glonassEphemeris_yn <- getSInt32be 27+ _glonassEphemeris_yndotdot <- getSInt8 5+ _glonassEphemeris_zndot <- getSInt32be 24+ _glonassEphemeris_zn <- getSInt32be 27+ _glonassEphemeris_zndotdot <- getSInt8 5 _glonassEphemeris_p3 <- B.getBool- _glonassEphemeris_gammaN <- getInt16be 11+ _glonassEphemeris_gammaN <- getSInt16be 11 _glonassEphemeris_mp <- B.getWord8 2 _glonassEphemeris_mi3 <- B.getBool- _glonassEphemeris_tauN <- getInt32be 22- _glonassEphemeris_mdeltatau <- getInt8 5+ _glonassEphemeris_tauN <- getSInt32be 22+ _glonassEphemeris_mdeltatau <- getSInt8 5 _glonassEphemeris_en <- B.getWord8 5 _glonassEphemeris_mp4 <- B.getBool _glonassEphemeris_mft <- B.getWord8 4@@ -350,9 +350,9 @@ _glonassEphemeris_mM <- B.getWord8 2 _glonassEphemeris_additional <- B.getBool _glonassEphemeris_nA <- B.getWord16be 11- _glonassEphemeris_tauC <- getInt32be 32+ _glonassEphemeris_tauC <- getSInt32be 32 _glonassEphemeris_mn4 <- B.getWord8 5- _glonassEphemeris_mTauGps <- getInt32be 22+ _glonassEphemeris_mTauGps <- getSInt32be 22 _glonassEphemeris_mln5 <- B.getBool _glonassEphemeris_reserved <- B.getWord8 7 pure GlonassEphemeris{..}@@ -365,21 +365,21 @@ B.putBool _glonassEphemeris_bn_msb B.putBool _glonassEphemeris_p2 B.putWord8 7 _glonassEphemeris_tb- putInt32be 24 _glonassEphemeris_xndot- putInt32be 27 _glonassEphemeris_xn- putInt8 5 _glonassEphemeris_xndotdot- putInt32be 24 _glonassEphemeris_yndot- putInt32be 27 _glonassEphemeris_yn- putInt8 5 _glonassEphemeris_yndotdot- putInt32be 24 _glonassEphemeris_zndot- putInt32be 27 _glonassEphemeris_zn- putInt8 5 _glonassEphemeris_zndotdot+ putSInt32be 24 _glonassEphemeris_xndot+ putSInt32be 27 _glonassEphemeris_xn+ putSInt8 5 _glonassEphemeris_xndotdot+ putSInt32be 24 _glonassEphemeris_yndot+ putSInt32be 27 _glonassEphemeris_yn+ putSInt8 5 _glonassEphemeris_yndotdot+ putSInt32be 24 _glonassEphemeris_zndot+ putSInt32be 27 _glonassEphemeris_zn+ putSInt8 5 _glonassEphemeris_zndotdot B.putBool _glonassEphemeris_p3- putInt16be 11 _glonassEphemeris_gammaN+ putSInt16be 11 _glonassEphemeris_gammaN B.putWord8 2 _glonassEphemeris_mp B.putBool _glonassEphemeris_mi3- putInt32be 22 _glonassEphemeris_tauN- putInt8 5 _glonassEphemeris_mdeltatau+ putSInt32be 22 _glonassEphemeris_tauN+ putSInt8 5 _glonassEphemeris_mdeltatau B.putWord8 5 _glonassEphemeris_en B.putBool _glonassEphemeris_mp4 B.putWord8 4 _glonassEphemeris_mft@@ -387,9 +387,9 @@ B.putWord8 2 _glonassEphemeris_mM B.putBool _glonassEphemeris_additional B.putWord16be 11 _glonassEphemeris_nA- putInt32be 32 _glonassEphemeris_tauC+ putSInt32be 32 _glonassEphemeris_tauC B.putWord8 5 _glonassEphemeris_mn4- putInt32be 22 _glonassEphemeris_mTauGps+ putSInt32be 22 _glonassEphemeris_mTauGps B.putBool _glonassEphemeris_mln5 B.putWord8 7 _glonassEphemeris_reserved
src/Data/RTCM3/Extras.hs view
@@ -19,6 +19,14 @@ , putInt16be , putInt32be , putInt64be+ , getSInt8+ , getSInt16be+ , getSInt32be+ , getSInt64be+ , putSInt8+ , putSInt16be+ , putSInt32be+ , putSInt64be , getWord24be , putWord24be ) where@@ -66,6 +74,46 @@ putInt64be :: Int -> Int64 -> B.BitPut () putInt64be n = B.putWord64be n . fromIntegral++getSInt8 :: Int -> B.BitGet Int8+getSInt8 n = do+ signed <- B.getBool+ bool id negate signed . fromIntegral <$> B.getWord8 (n - 1)++getSInt16be :: Int -> B.BitGet Int16+getSInt16be n = do+ signed <- B.getBool+ bool id negate signed . fromIntegral <$> B.getWord16be (n - 1)++getSInt32be :: Int -> B.BitGet Int32+getSInt32be n = do+ signed <- B.getBool+ bool id negate signed . fromIntegral <$> B.getWord32be (n - 1)++getSInt64be :: Int -> B.BitGet Int64+getSInt64be n = do+ signed <- B.getBool+ bool id negate signed . fromIntegral <$> B.getWord64be (n - 1)++putSInt8 :: Int -> Int8 -> B.BitPut ()+putSInt8 n v = do+ B.putBool $ v < 0+ B.putWord8 (n - 1) $ fromIntegral (abs v)++putSInt16be :: Int -> Int16 -> B.BitPut ()+putSInt16be n v = do+ B.putBool $ v < 0+ B.putWord16be (n - 1) $ fromIntegral (abs v)++putSInt32be :: Int -> Int32 -> B.BitPut ()+putSInt32be n v = do+ B.putBool $ v < 0+ B.putWord32be (n - 1) $ fromIntegral (abs v)++putSInt64be :: Int -> Int64 -> B.BitPut ()+putSInt64be n v = do+ B.putBool $ v < 0+ B.putWord64be (n - 1) $ fromIntegral (abs v) getWord24be :: Get Word24 getWord24be = do
test/Test/Data/RTCM3/Extras.hs view
@@ -84,6 +84,26 @@ testProperty "Roundtrip Int64be" $ \(TestInt n i) -> decodeBits (getInt64be n) (encodeBits (putInt64be n i)) == (i :: Int64) +testSInt8 :: TestTree+testSInt8 =+ testProperty "Roundtrip SInt8" $ \(TestInt n i) ->+ decodeBits (getSInt8 n) (encodeBits (putSInt8 n i)) == (i :: Int8)++testSInt16be :: TestTree+testSInt16be =+ testProperty "Roundtrip SInt16" $ \(TestInt n i) ->+ decodeBits (getSInt16be n) (encodeBits (putSInt16be n i)) == (i :: Int16)++testSInt32be :: TestTree+testSInt32be =+ testProperty "Roundtrip SInt32" $ \(TestInt n i) ->+ decodeBits (getSInt32be n) (encodeBits (putSInt32be n i)) == (i :: Int32)++testSInt64be :: TestTree+testSInt64be =+ testProperty "Roundtrip SInt64be" $ \(TestInt n i) ->+ decodeBits (getSInt64be n) (encodeBits (putSInt64be n i)) == (i :: Int64)+ testWord24be :: TestTree testWord24be = testProperty "Roundtrip Word24be" $ \i ->@@ -96,5 +116,9 @@ , testInt16be , testInt32be , testInt64be+ , testSInt8+ , testSInt16be+ , testSInt32be+ , testSInt64be , testWord24be ]