module SwiftNav.SBP.Ssr
( module SwiftNav.SBP.Ssr
) where
import BasicPrelude
import Control.Lens
import Control.Monad.Loops
import Data.Binary
import Data.Binary.Get
import Data.Binary.IEEE754
import Data.Binary.Put
import Data.ByteString.Lazy hiding (ByteString)
import Data.Int
import Data.Word
import SwiftNav.SBP.TH
import SwiftNav.SBP.Types
import SwiftNav.SBP.Gnss
data CodeBiasesContent = CodeBiasesContent
{ _codeBiasesContent_code :: !Word8
, _codeBiasesContent_value :: !Int16
} deriving ( Show, Read, Eq )
instance Binary CodeBiasesContent where
get = do
_codeBiasesContent_code <- getWord8
_codeBiasesContent_value <- fromIntegral <$> getWord16le
pure CodeBiasesContent {..}
put CodeBiasesContent {..} = do
putWord8 _codeBiasesContent_code
putWord16le $ fromIntegral _codeBiasesContent_value
$(makeJSON "_codeBiasesContent_" ''CodeBiasesContent)
$(makeLenses ''CodeBiasesContent)
data PhaseBiasesContent = PhaseBiasesContent
{ _phaseBiasesContent_code :: !Word8
, _phaseBiasesContent_integer_indicator :: !Word8
, _phaseBiasesContent_widelane_integer_indicator :: !Word8
, _phaseBiasesContent_discontinuity_counter :: !Word8
, _phaseBiasesContent_bias :: !Int32
} deriving ( Show, Read, Eq )
instance Binary PhaseBiasesContent where
get = do
_phaseBiasesContent_code <- getWord8
_phaseBiasesContent_integer_indicator <- getWord8
_phaseBiasesContent_widelane_integer_indicator <- getWord8
_phaseBiasesContent_discontinuity_counter <- getWord8
_phaseBiasesContent_bias <- fromIntegral <$> getWord32le
pure PhaseBiasesContent {..}
put PhaseBiasesContent {..} = do
putWord8 _phaseBiasesContent_code
putWord8 _phaseBiasesContent_integer_indicator
putWord8 _phaseBiasesContent_widelane_integer_indicator
putWord8 _phaseBiasesContent_discontinuity_counter
putWord32le $ fromIntegral _phaseBiasesContent_bias
$(makeJSON "_phaseBiasesContent_" ''PhaseBiasesContent)
$(makeLenses ''PhaseBiasesContent)
msgSsrOrbitClock :: Word16
msgSsrOrbitClock = 0x05DC
data MsgSsrOrbitClock = MsgSsrOrbitClock
{ _msgSsrOrbitClock_time :: !GpsTimeSec
, _msgSsrOrbitClock_sid :: !GnssSignal
, _msgSsrOrbitClock_update_interval :: !Word8
, _msgSsrOrbitClock_iod_ssr :: !Word8
, _msgSsrOrbitClock_iod :: !Word8
, _msgSsrOrbitClock_radial :: !Int32
, _msgSsrOrbitClock_along :: !Int32
, _msgSsrOrbitClock_cross :: !Int32
, _msgSsrOrbitClock_dot_radial :: !Int32
, _msgSsrOrbitClock_dot_along :: !Int32
, _msgSsrOrbitClock_dot_cross :: !Int32
, _msgSsrOrbitClock_c0 :: !Int32
, _msgSsrOrbitClock_c1 :: !Int32
, _msgSsrOrbitClock_c2 :: !Int32
} deriving ( Show, Read, Eq )
instance Binary MsgSsrOrbitClock where
get = do
_msgSsrOrbitClock_time <- get
_msgSsrOrbitClock_sid <- get
_msgSsrOrbitClock_update_interval <- getWord8
_msgSsrOrbitClock_iod_ssr <- getWord8
_msgSsrOrbitClock_iod <- getWord8
_msgSsrOrbitClock_radial <- fromIntegral <$> getWord32le
_msgSsrOrbitClock_along <- fromIntegral <$> getWord32le
_msgSsrOrbitClock_cross <- fromIntegral <$> getWord32le
_msgSsrOrbitClock_dot_radial <- fromIntegral <$> getWord32le
_msgSsrOrbitClock_dot_along <- fromIntegral <$> getWord32le
_msgSsrOrbitClock_dot_cross <- fromIntegral <$> getWord32le
_msgSsrOrbitClock_c0 <- fromIntegral <$> getWord32le
_msgSsrOrbitClock_c1 <- fromIntegral <$> getWord32le
_msgSsrOrbitClock_c2 <- fromIntegral <$> getWord32le
pure MsgSsrOrbitClock {..}
put MsgSsrOrbitClock {..} = do
put _msgSsrOrbitClock_time
put _msgSsrOrbitClock_sid
putWord8 _msgSsrOrbitClock_update_interval
putWord8 _msgSsrOrbitClock_iod_ssr
putWord8 _msgSsrOrbitClock_iod
putWord32le $ fromIntegral _msgSsrOrbitClock_radial
putWord32le $ fromIntegral _msgSsrOrbitClock_along
putWord32le $ fromIntegral _msgSsrOrbitClock_cross
putWord32le $ fromIntegral _msgSsrOrbitClock_dot_radial
putWord32le $ fromIntegral _msgSsrOrbitClock_dot_along
putWord32le $ fromIntegral _msgSsrOrbitClock_dot_cross
putWord32le $ fromIntegral _msgSsrOrbitClock_c0
putWord32le $ fromIntegral _msgSsrOrbitClock_c1
putWord32le $ fromIntegral _msgSsrOrbitClock_c2
$(makeSBP 'msgSsrOrbitClock ''MsgSsrOrbitClock)
$(makeJSON "_msgSsrOrbitClock_" ''MsgSsrOrbitClock)
$(makeLenses ''MsgSsrOrbitClock)
msgSsrCodeBiases :: Word16
msgSsrCodeBiases = 0x05E1
data MsgSsrCodeBiases = MsgSsrCodeBiases
{ _msgSsrCodeBiases_time :: !GpsTimeSec
, _msgSsrCodeBiases_sid :: !GnssSignal
, _msgSsrCodeBiases_update_interval :: !Word8
, _msgSsrCodeBiases_iod_ssr :: !Word8
, _msgSsrCodeBiases_biases :: ![CodeBiasesContent]
} deriving ( Show, Read, Eq )
instance Binary MsgSsrCodeBiases where
get = do
_msgSsrCodeBiases_time <- get
_msgSsrCodeBiases_sid <- get
_msgSsrCodeBiases_update_interval <- getWord8
_msgSsrCodeBiases_iod_ssr <- getWord8
_msgSsrCodeBiases_biases <- whileM (not <$> isEmpty) get
pure MsgSsrCodeBiases {..}
put MsgSsrCodeBiases {..} = do
put _msgSsrCodeBiases_time
put _msgSsrCodeBiases_sid
putWord8 _msgSsrCodeBiases_update_interval
putWord8 _msgSsrCodeBiases_iod_ssr
mapM_ put _msgSsrCodeBiases_biases
$(makeSBP 'msgSsrCodeBiases ''MsgSsrCodeBiases)
$(makeJSON "_msgSsrCodeBiases_" ''MsgSsrCodeBiases)
$(makeLenses ''MsgSsrCodeBiases)
msgSsrPhaseBiases :: Word16
msgSsrPhaseBiases = 0x05E6
data MsgSsrPhaseBiases = MsgSsrPhaseBiases
{ _msgSsrPhaseBiases_time :: !GpsTimeSec
, _msgSsrPhaseBiases_sid :: !GnssSignal
, _msgSsrPhaseBiases_update_interval :: !Word8
, _msgSsrPhaseBiases_iod_ssr :: !Word8
, _msgSsrPhaseBiases_dispersive_bias :: !Word8
, _msgSsrPhaseBiases_mw_consistency :: !Word8
, _msgSsrPhaseBiases_yaw :: !Word16
, _msgSsrPhaseBiases_yaw_rate :: !Int8
, _msgSsrPhaseBiases_biases :: ![PhaseBiasesContent]
} deriving ( Show, Read, Eq )
instance Binary MsgSsrPhaseBiases where
get = do
_msgSsrPhaseBiases_time <- get
_msgSsrPhaseBiases_sid <- get
_msgSsrPhaseBiases_update_interval <- getWord8
_msgSsrPhaseBiases_iod_ssr <- getWord8
_msgSsrPhaseBiases_dispersive_bias <- getWord8
_msgSsrPhaseBiases_mw_consistency <- getWord8
_msgSsrPhaseBiases_yaw <- getWord16le
_msgSsrPhaseBiases_yaw_rate <- fromIntegral <$> getWord8
_msgSsrPhaseBiases_biases <- whileM (not <$> isEmpty) get
pure MsgSsrPhaseBiases {..}
put MsgSsrPhaseBiases {..} = do
put _msgSsrPhaseBiases_time
put _msgSsrPhaseBiases_sid
putWord8 _msgSsrPhaseBiases_update_interval
putWord8 _msgSsrPhaseBiases_iod_ssr
putWord8 _msgSsrPhaseBiases_dispersive_bias
putWord8 _msgSsrPhaseBiases_mw_consistency
putWord16le _msgSsrPhaseBiases_yaw
putWord8 $ fromIntegral _msgSsrPhaseBiases_yaw_rate
mapM_ put _msgSsrPhaseBiases_biases
$(makeSBP 'msgSsrPhaseBiases ''MsgSsrPhaseBiases)
$(makeJSON "_msgSsrPhaseBiases_" ''MsgSsrPhaseBiases)
$(makeLenses ''MsgSsrPhaseBiases)