sbp 2.3.13 → 2.3.15
raw patch · 4 files changed
+191/−143 lines, 4 filesdep ~aesondep ~arraydep ~base
Dependency ranges changed: aeson, array, base, base64-bytestring, basic-prelude, binary, binary-conduit, bytestring, conduit, conduit-extra, data-binary-ieee754, lens, lens-aeson, monad-loops, resourcet, tasty, tasty-hunit, template-haskell, text, yaml
Files
- sbp.cabal +120/−111
- src/SwiftNav/SBP/Msg.hs +6/−0
- src/SwiftNav/SBP/Orientation.hs +32/−32
- src/SwiftNav/SBP/Piksi.hs +33/−0
sbp.cabal view
@@ -1,124 +1,133 @@-name: sbp-version: 2.3.13-synopsis: SwiftNav's SBP Library-homepage: https://github.com/swift-nav/libsbp-license: LGPL-3-author: Swift Navigation Inc.-maintainer: Swift Navigation <dev@swiftnav.com>-copyright: Copyright (C) 2015-2018 Swift Navigation, Inc.-category: Network-build-type: Simple-cabal-version: >= 1.22-extra-source-files: README.md+cabal-version: >=1.22+name: sbp+version: 2.3.15+license: LGPL-3+copyright: Copyright (C) 2015-2018 Swift Navigation, Inc.+maintainer: Swift Navigation <dev@swiftnav.com>+author: Swift Navigation Inc.+homepage: https://github.com/swift-nav/libsbp+synopsis: SwiftNav's SBP Library description:- Haskell bindings for Swift Navigation Binary Protocol (SBP), a fast,- simple, and minimal binary protocol for communicating with Swift- devices. It is the native binary protocol used by the Piksi GPS- receiver to transmit solutions, observations, status and debugging- messages, as well as receive messages from the host operating- system, such as differential corrections and the almanac.+ Haskell bindings for Swift Navigation Binary Protocol (SBP), a fast,+ simple, and minimal binary protocol for communicating with Swift+ devices. It is the native binary protocol used by the Piksi GPS+ receiver to transmit solutions, observations, status and debugging+ messages, as well as receive messages from the host operating+ system, such as differential corrections and the almanac.+category: Network+build-type: Simple+extra-source-files:+ README.md source-repository head- type: git- location: git@github.com:swift-nav/libsbp.git+ type: git+ location: git@github.com:swift-nav/libsbp.git library- exposed-modules: SwiftNav.CRC16- , SwiftNav.SBP- other-modules: SwiftNav.SBP.Msg- , SwiftNav.SBP.TH- , SwiftNav.SBP.Types- , SwiftNav.SBP.Acquisition- , SwiftNav.SBP.Bootload- , SwiftNav.SBP.ExtEvents- , SwiftNav.SBP.FileIo- , SwiftNav.SBP.Flash- , SwiftNav.SBP.Gnss- , SwiftNav.SBP.Imu- , SwiftNav.SBP.Logging- , SwiftNav.SBP.Mag- , SwiftNav.SBP.Navigation- , SwiftNav.SBP.Ndb- , SwiftNav.SBP.Observation- , SwiftNav.SBP.Orientation- , SwiftNav.SBP.Piksi- , SwiftNav.SBP.Sbas- , SwiftNav.SBP.Settings- , SwiftNav.SBP.Ssr- , SwiftNav.SBP.System- , SwiftNav.SBP.Tracking- , SwiftNav.SBP.User- , SwiftNav.SBP.Vehicle- default-language: Haskell2010- hs-source-dirs: src- ghc-options: -Wall- build-depends: aeson- , array- , base >= 4.8 && < 5- , base64-bytestring- , basic-prelude- , binary- , bytestring- , data-binary-ieee754- , lens- , lens-aeson- , monad-loops- , template-haskell- , text+ exposed-modules:+ SwiftNav.CRC16+ SwiftNav.SBP+ SwiftNav.SBP.Acquisition+ SwiftNav.SBP.Bootload+ SwiftNav.SBP.ExtEvents+ SwiftNav.SBP.FileIo+ SwiftNav.SBP.Flash+ SwiftNav.SBP.Gnss+ SwiftNav.SBP.Imu+ SwiftNav.SBP.Logging+ SwiftNav.SBP.Mag+ SwiftNav.SBP.Navigation+ SwiftNav.SBP.Ndb+ SwiftNav.SBP.Observation+ SwiftNav.SBP.Orientation+ SwiftNav.SBP.Piksi+ SwiftNav.SBP.Sbas+ SwiftNav.SBP.Settings+ SwiftNav.SBP.Ssr+ SwiftNav.SBP.System+ SwiftNav.SBP.Tracking+ SwiftNav.SBP.User+ SwiftNav.SBP.Vehicle+ SwiftNav.SBP.Types+ hs-source-dirs: src+ other-modules:+ SwiftNav.SBP.Msg+ SwiftNav.SBP.TH+ default-language: Haskell2010+ ghc-options: -Wall+ build-depends:+ aeson >=1.2.4.0,+ array >=0.5.2.0,+ base >=4.8 && <5,+ base64-bytestring >=1.0.0.1,+ basic-prelude >=0.7.0,+ binary >=0.8.5.1,+ bytestring >=0.10.8.2,+ data-binary-ieee754 >=0.4.4,+ lens >=4.15.4,+ lens-aeson >=1.0.2,+ monad-loops >=0.4.3,+ template-haskell >=2.12.0.0,+ text >=1.2.2.2 executable sbp2json- hs-source-dirs: main- main-is: SBP2JSON.hs- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall- build-depends: aeson- , base- , basic-prelude- , binary-conduit- , bytestring- , conduit- , conduit-extra- , resourcet- , sbp- default-language: Haskell2010+ main-is: SBP2JSON.hs+ hs-source-dirs: main+ default-language: Haskell2010+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ build-depends:+ aeson >=1.2.4.0,+ base >=4.10.1.0,+ basic-prelude >=0.7.0,+ binary-conduit >=1.2.5,+ bytestring >=0.10.8.2,+ conduit >=1.2.13.1,+ conduit-extra >=1.2.3.2,+ resourcet >=1.1.11,+ sbp -any executable json2sbp- hs-source-dirs: main- main-is: JSON2SBP.hs- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall- build-depends: aeson- , base- , basic-prelude- , binary-conduit- , conduit- , conduit-extra- , resourcet- , sbp- default-language: Haskell2010+ main-is: JSON2SBP.hs+ hs-source-dirs: main+ default-language: Haskell2010+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ build-depends:+ aeson >=1.2.4.0,+ base >=4.10.1.0,+ basic-prelude >=0.7.0,+ binary-conduit >=1.2.5,+ conduit >=1.2.13.1,+ conduit-extra >=1.2.3.2,+ resourcet >=1.1.11,+ sbp -any executable sbp2yaml- hs-source-dirs: main- main-is: SBP2YAML.hs- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall- build-depends: base- , basic-prelude- , binary-conduit- , bytestring- , conduit- , conduit-extra- , resourcet- , sbp- , yaml- default-language: Haskell2010+ main-is: SBP2YAML.hs+ hs-source-dirs: main+ default-language: Haskell2010+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ build-depends:+ base >=4.10.1.0,+ basic-prelude >=0.7.0,+ binary-conduit >=1.2.5,+ bytestring >=0.10.8.2,+ conduit >=1.2.13.1,+ conduit-extra >=1.2.3.2,+ resourcet >=1.1.11,+ sbp -any,+ yaml >=0.8.28 test-suite test- type: exitcode-stdio-1.0- hs-source-dirs: test- main-is: Test.hs- other-modules: Test.SwiftNav.CRC16- build-depends: base- , basic-prelude- , sbp- , tasty- , tasty-hunit- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall- default-language: Haskell2010+ type: exitcode-stdio-1.0+ main-is: Test.hs+ hs-source-dirs: test+ other-modules:+ Test.SwiftNav.CRC16+ default-language: Haskell2010+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ build-depends:+ base >=4.10.1.0,+ basic-prelude >=0.7.0,+ sbp -any,+ tasty >=0.11.3,+ tasty-hunit >=0.9.2
@@ -78,6 +78,7 @@ | SBPMsgBootloaderHandshakeReq MsgBootloaderHandshakeReq Msg | SBPMsgBootloaderHandshakeResp MsgBootloaderHandshakeResp Msg | SBPMsgBootloaderJumpToApp MsgBootloaderJumpToApp Msg+ | SBPMsgCellModemStatus MsgCellModemStatus Msg | SBPMsgCommandOutput MsgCommandOutput Msg | SBPMsgCommandReq MsgCommandReq Msg | SBPMsgCommandResp MsgCommandResp Msg@@ -234,6 +235,7 @@ | _msgSBPType == msgBootloaderHandshakeReq = SBPMsgBootloaderHandshakeReq (decode (fromStrict (unBytes _msgSBPPayload))) m | _msgSBPType == msgBootloaderHandshakeResp = SBPMsgBootloaderHandshakeResp (decode (fromStrict (unBytes _msgSBPPayload))) m | _msgSBPType == msgBootloaderJumpToApp = SBPMsgBootloaderJumpToApp (decode (fromStrict (unBytes _msgSBPPayload))) m+ | _msgSBPType == msgCellModemStatus = SBPMsgCellModemStatus (decode (fromStrict (unBytes _msgSBPPayload))) m | _msgSBPType == msgCommandOutput = SBPMsgCommandOutput (decode (fromStrict (unBytes _msgSBPPayload))) m | _msgSBPType == msgCommandReq = SBPMsgCommandReq (decode (fromStrict (unBytes _msgSBPPayload))) m | _msgSBPType == msgCommandResp = SBPMsgCommandResp (decode (fromStrict (unBytes _msgSBPPayload))) m@@ -382,6 +384,7 @@ encoder (SBPMsgBootloaderHandshakeReq _ m) = put m encoder (SBPMsgBootloaderHandshakeResp _ m) = put m encoder (SBPMsgBootloaderJumpToApp _ m) = put m+ encoder (SBPMsgCellModemStatus _ m) = put m encoder (SBPMsgCommandOutput _ m) = put m encoder (SBPMsgCommandReq _ m) = put m encoder (SBPMsgCommandResp _ m) = put m@@ -534,6 +537,7 @@ | msgType == msgBootloaderHandshakeReq = SBPMsgBootloaderHandshakeReq <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj | msgType == msgBootloaderHandshakeResp = SBPMsgBootloaderHandshakeResp <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj | msgType == msgBootloaderJumpToApp = SBPMsgBootloaderJumpToApp <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj+ | msgType == msgCellModemStatus = SBPMsgCellModemStatus <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj | msgType == msgCommandOutput = SBPMsgCommandOutput <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj | msgType == msgCommandReq = SBPMsgCommandReq <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj | msgType == msgCommandResp = SBPMsgCommandResp <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj@@ -687,6 +691,7 @@ toJSON (SBPMsgBootloaderHandshakeReq n m) = toJSON n <<>> toJSON m toJSON (SBPMsgBootloaderHandshakeResp n m) = toJSON n <<>> toJSON m toJSON (SBPMsgBootloaderJumpToApp n m) = toJSON n <<>> toJSON m+ toJSON (SBPMsgCellModemStatus n m) = toJSON n <<>> toJSON m toJSON (SBPMsgCommandOutput n m) = toJSON n <<>> toJSON m toJSON (SBPMsgCommandReq n m) = toJSON n <<>> toJSON m toJSON (SBPMsgCommandResp n m) = toJSON n <<>> toJSON m@@ -834,6 +839,7 @@ msg f (SBPMsgBootloaderHandshakeReq n m) = SBPMsgBootloaderHandshakeReq n <$> f m msg f (SBPMsgBootloaderHandshakeResp n m) = SBPMsgBootloaderHandshakeResp n <$> f m msg f (SBPMsgBootloaderJumpToApp n m) = SBPMsgBootloaderJumpToApp n <$> f m+ msg f (SBPMsgCellModemStatus n m) = SBPMsgCellModemStatus n <$> f m msg f (SBPMsgCommandOutput n m) = SBPMsgCommandOutput n <$> f m msg f (SBPMsgCommandReq n m) = SBPMsgCommandReq n <$> f m msg f (SBPMsgCommandResp n m) = SBPMsgCommandResp n <$> f m
@@ -82,25 +82,25 @@ -- of the vector should sum to a unit vector assuming that the LSB of each -- component as a value of 2^-31. data MsgOrientQuat = MsgOrientQuat- { _msgOrientQuat_tow :: !Word32+ { _msgOrientQuat_tow :: !Word32 -- ^ GPS Time of Week- , _msgOrientQuat_w :: !Int32+ , _msgOrientQuat_w :: !Int32 -- ^ Real component- , _msgOrientQuat_x :: !Int32+ , _msgOrientQuat_x :: !Int32 -- ^ 1st imaginary component- , _msgOrientQuat_y :: !Int32+ , _msgOrientQuat_y :: !Int32 -- ^ 2nd imaginary component- , _msgOrientQuat_z :: !Int32+ , _msgOrientQuat_z :: !Int32 -- ^ 3rd imaginary component- , _msgOrientQuat_acc_w :: !Float+ , _msgOrientQuat_w_accuracy :: !Float -- ^ Estimated standard deviation of w- , _msgOrientQuat_acc_x :: !Float+ , _msgOrientQuat_x_accuracy :: !Float -- ^ Estimated standard deviation of x- , _msgOrientQuat_acc_y :: !Float+ , _msgOrientQuat_y_accuracy :: !Float -- ^ Estimated standard deviation of y- , _msgOrientQuat_acc_z :: !Float+ , _msgOrientQuat_z_accuracy :: !Float -- ^ Estimated standard deviation of z- , _msgOrientQuat_flags :: !Word8+ , _msgOrientQuat_flags :: !Word8 -- ^ Status flags } deriving ( Show, Read, Eq ) @@ -111,10 +111,10 @@ _msgOrientQuat_x <- fromIntegral <$> getWord32le _msgOrientQuat_y <- fromIntegral <$> getWord32le _msgOrientQuat_z <- fromIntegral <$> getWord32le- _msgOrientQuat_acc_w <- getFloat32le- _msgOrientQuat_acc_x <- getFloat32le- _msgOrientQuat_acc_y <- getFloat32le- _msgOrientQuat_acc_z <- getFloat32le+ _msgOrientQuat_w_accuracy <- getFloat32le+ _msgOrientQuat_x_accuracy <- getFloat32le+ _msgOrientQuat_y_accuracy <- getFloat32le+ _msgOrientQuat_z_accuracy <- getFloat32le _msgOrientQuat_flags <- getWord8 pure MsgOrientQuat {..} @@ -124,10 +124,10 @@ putWord32le $ fromIntegral _msgOrientQuat_x putWord32le $ fromIntegral _msgOrientQuat_y putWord32le $ fromIntegral _msgOrientQuat_z- putFloat32le _msgOrientQuat_acc_w- putFloat32le _msgOrientQuat_acc_x- putFloat32le _msgOrientQuat_acc_y- putFloat32le _msgOrientQuat_acc_z+ putFloat32le _msgOrientQuat_w_accuracy+ putFloat32le _msgOrientQuat_x_accuracy+ putFloat32le _msgOrientQuat_y_accuracy+ putFloat32le _msgOrientQuat_z_accuracy putWord8 _msgOrientQuat_flags $(makeSBP 'msgOrientQuat ''MsgOrientQuat)@@ -144,21 +144,21 @@ -- and roll in order to rotate the from a frame aligned with the local-level -- NED frame to the vehicle body frame. data MsgOrientEuler = MsgOrientEuler- { _msgOrientEuler_tow :: !Word32+ { _msgOrientEuler_tow :: !Word32 -- ^ GPS Time of Week- , _msgOrientEuler_roll :: !Int32+ , _msgOrientEuler_roll :: !Int32 -- ^ rotation about the forward axis of the vehicle- , _msgOrientEuler_pitch :: !Int32+ , _msgOrientEuler_pitch :: !Int32 -- ^ rotation about the rightward axis of the vehicle- , _msgOrientEuler_yaw :: !Int32+ , _msgOrientEuler_yaw :: !Int32 -- ^ rotation about the downward axis of the vehicle- , _msgOrientEuler_var_roll :: !Float+ , _msgOrientEuler_roll_accuracy :: !Float -- ^ Estimated standard deviation of roll- , _msgOrientEuler_var_pitch :: !Float+ , _msgOrientEuler_pitch_accuracy :: !Float -- ^ Estimated standard deviation of pitch- , _msgOrientEuler_var_yaw :: !Float+ , _msgOrientEuler_yaw_accuracy :: !Float -- ^ Estimated standard deviation of yaw- , _msgOrientEuler_flags :: !Word8+ , _msgOrientEuler_flags :: !Word8 -- ^ Status flags } deriving ( Show, Read, Eq ) @@ -168,9 +168,9 @@ _msgOrientEuler_roll <- fromIntegral <$> getWord32le _msgOrientEuler_pitch <- fromIntegral <$> getWord32le _msgOrientEuler_yaw <- fromIntegral <$> getWord32le- _msgOrientEuler_var_roll <- getFloat32le- _msgOrientEuler_var_pitch <- getFloat32le- _msgOrientEuler_var_yaw <- getFloat32le+ _msgOrientEuler_roll_accuracy <- getFloat32le+ _msgOrientEuler_pitch_accuracy <- getFloat32le+ _msgOrientEuler_yaw_accuracy <- getFloat32le _msgOrientEuler_flags <- getWord8 pure MsgOrientEuler {..} @@ -179,9 +179,9 @@ putWord32le $ fromIntegral _msgOrientEuler_roll putWord32le $ fromIntegral _msgOrientEuler_pitch putWord32le $ fromIntegral _msgOrientEuler_yaw- putFloat32le _msgOrientEuler_var_roll- putFloat32le _msgOrientEuler_var_pitch- putFloat32le _msgOrientEuler_var_yaw+ putFloat32le _msgOrientEuler_roll_accuracy+ putFloat32le _msgOrientEuler_pitch_accuracy+ putFloat32le _msgOrientEuler_yaw_accuracy putWord8 _msgOrientEuler_flags $(makeSBP 'msgOrientEuler ''MsgOrientEuler)
@@ -772,6 +772,39 @@ $(makeJSON "_msgNetworkBandwidthUsage_" ''MsgNetworkBandwidthUsage) $(makeLenses ''MsgNetworkBandwidthUsage) +msgCellModemStatus :: Word16+msgCellModemStatus = 0x00BE++-- | SBP class for message MSG_CELL_MODEM_STATUS (0x00BE).+--+-- If a cell modem is present on a piksi device, this message will be send+-- periodically to update the host on the status of the modem and its various+-- parameters.+data MsgCellModemStatus = MsgCellModemStatus+ { _msgCellModemStatus_signal_strength :: !Int8+ -- ^ Received cell signal strength in dBm, zero translates to unknown+ , _msgCellModemStatus_signal_error_rate :: !Float+ -- ^ BER as reported by the modem, zero translates to unknown+ , _msgCellModemStatus_reserved :: ![Word8]+ -- ^ Unspecified data TBD for this schema+ } deriving ( Show, Read, Eq )++instance Binary MsgCellModemStatus where+ get = do+ _msgCellModemStatus_signal_strength <- fromIntegral <$> getWord8+ _msgCellModemStatus_signal_error_rate <- getFloat32le+ _msgCellModemStatus_reserved <- whileM (not <$> isEmpty) getWord8+ pure MsgCellModemStatus {..}++ put MsgCellModemStatus {..} = do+ putWord8 $ fromIntegral _msgCellModemStatus_signal_strength+ putFloat32le _msgCellModemStatus_signal_error_rate+ mapM_ putWord8 _msgCellModemStatus_reserved++$(makeSBP 'msgCellModemStatus ''MsgCellModemStatus)+$(makeJSON "_msgCellModemStatus_" ''MsgCellModemStatus)+$(makeLenses ''MsgCellModemStatus)+ msgSpecanDep :: Word16 msgSpecanDep = 0x0050