{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE RecordWildCards #-}
module SwiftNav.SBP.Acquisition
( module SwiftNav.SBP.Acquisition
) 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
{-# ANN module ("HLint: ignore Use camelCase"::String) #-}
{-# ANN module ("HLint: ignore Redundant do"::String) #-}
{-# ANN module ("HLint: ignore Use newtype instead of data"::String) #-}
msgAcqResult :: Word16
msgAcqResult = 0x002F
data MsgAcqResult = MsgAcqResult
{ _msgAcqResult_cn0 :: !Float
, _msgAcqResult_cp :: !Float
, _msgAcqResult_cf :: !Float
, _msgAcqResult_sid :: !GnssSignal
} deriving ( Show, Read, Eq )
instance Binary MsgAcqResult where
get = do
_msgAcqResult_cn0 <- getFloat32le
_msgAcqResult_cp <- getFloat32le
_msgAcqResult_cf <- getFloat32le
_msgAcqResult_sid <- get
pure MsgAcqResult {..}
put MsgAcqResult {..} = do
putFloat32le _msgAcqResult_cn0
putFloat32le _msgAcqResult_cp
putFloat32le _msgAcqResult_cf
put _msgAcqResult_sid
$(makeSBP 'msgAcqResult ''MsgAcqResult)
$(makeJSON "_msgAcqResult_" ''MsgAcqResult)
$(makeLenses ''MsgAcqResult)
msgAcqResultDepC :: Word16
msgAcqResultDepC = 0x001F
data MsgAcqResultDepC = MsgAcqResultDepC
{ _msgAcqResultDepC_cn0 :: !Float
, _msgAcqResultDepC_cp :: !Float
, _msgAcqResultDepC_cf :: !Float
, _msgAcqResultDepC_sid :: !GnssSignalDep
} deriving ( Show, Read, Eq )
instance Binary MsgAcqResultDepC where
get = do
_msgAcqResultDepC_cn0 <- getFloat32le
_msgAcqResultDepC_cp <- getFloat32le
_msgAcqResultDepC_cf <- getFloat32le
_msgAcqResultDepC_sid <- get
pure MsgAcqResultDepC {..}
put MsgAcqResultDepC {..} = do
putFloat32le _msgAcqResultDepC_cn0
putFloat32le _msgAcqResultDepC_cp
putFloat32le _msgAcqResultDepC_cf
put _msgAcqResultDepC_sid
$(makeSBP 'msgAcqResultDepC ''MsgAcqResultDepC)
$(makeJSON "_msgAcqResultDepC_" ''MsgAcqResultDepC)
$(makeLenses ''MsgAcqResultDepC)
msgAcqResultDepB :: Word16
msgAcqResultDepB = 0x0014
data MsgAcqResultDepB = MsgAcqResultDepB
{ _msgAcqResultDepB_snr :: !Float
, _msgAcqResultDepB_cp :: !Float
, _msgAcqResultDepB_cf :: !Float
, _msgAcqResultDepB_sid :: !GnssSignalDep
} deriving ( Show, Read, Eq )
instance Binary MsgAcqResultDepB where
get = do
_msgAcqResultDepB_snr <- getFloat32le
_msgAcqResultDepB_cp <- getFloat32le
_msgAcqResultDepB_cf <- getFloat32le
_msgAcqResultDepB_sid <- get
pure MsgAcqResultDepB {..}
put MsgAcqResultDepB {..} = do
putFloat32le _msgAcqResultDepB_snr
putFloat32le _msgAcqResultDepB_cp
putFloat32le _msgAcqResultDepB_cf
put _msgAcqResultDepB_sid
$(makeSBP 'msgAcqResultDepB ''MsgAcqResultDepB)
$(makeJSON "_msgAcqResultDepB_" ''MsgAcqResultDepB)
$(makeLenses ''MsgAcqResultDepB)
msgAcqResultDepA :: Word16
msgAcqResultDepA = 0x0015
data MsgAcqResultDepA = MsgAcqResultDepA
{ _msgAcqResultDepA_snr :: !Float
, _msgAcqResultDepA_cp :: !Float
, _msgAcqResultDepA_cf :: !Float
, _msgAcqResultDepA_prn :: !Word8
} deriving ( Show, Read, Eq )
instance Binary MsgAcqResultDepA where
get = do
_msgAcqResultDepA_snr <- getFloat32le
_msgAcqResultDepA_cp <- getFloat32le
_msgAcqResultDepA_cf <- getFloat32le
_msgAcqResultDepA_prn <- getWord8
pure MsgAcqResultDepA {..}
put MsgAcqResultDepA {..} = do
putFloat32le _msgAcqResultDepA_snr
putFloat32le _msgAcqResultDepA_cp
putFloat32le _msgAcqResultDepA_cf
putWord8 _msgAcqResultDepA_prn
$(makeSBP 'msgAcqResultDepA ''MsgAcqResultDepA)
$(makeJSON "_msgAcqResultDepA_" ''MsgAcqResultDepA)
$(makeLenses ''MsgAcqResultDepA)
data AcqSvProfile = AcqSvProfile
{ _acqSvProfile_job_type :: !Word8
, _acqSvProfile_status :: !Word8
, _acqSvProfile_cn0 :: !Word16
, _acqSvProfile_int_time :: !Word8
, _acqSvProfile_sid :: !GnssSignal
, _acqSvProfile_bin_width :: !Word16
, _acqSvProfile_timestamp :: !Word32
, _acqSvProfile_time_spent :: !Word32
, _acqSvProfile_cf_min :: !Int32
, _acqSvProfile_cf_max :: !Int32
, _acqSvProfile_cf :: !Int32
, _acqSvProfile_cp :: !Word32
} deriving ( Show, Read, Eq )
instance Binary AcqSvProfile where
get = do
_acqSvProfile_job_type <- getWord8
_acqSvProfile_status <- getWord8
_acqSvProfile_cn0 <- getWord16le
_acqSvProfile_int_time <- getWord8
_acqSvProfile_sid <- get
_acqSvProfile_bin_width <- getWord16le
_acqSvProfile_timestamp <- getWord32le
_acqSvProfile_time_spent <- getWord32le
_acqSvProfile_cf_min <- fromIntegral <$> getWord32le
_acqSvProfile_cf_max <- fromIntegral <$> getWord32le
_acqSvProfile_cf <- fromIntegral <$> getWord32le
_acqSvProfile_cp <- getWord32le
pure AcqSvProfile {..}
put AcqSvProfile {..} = do
putWord8 _acqSvProfile_job_type
putWord8 _acqSvProfile_status
putWord16le _acqSvProfile_cn0
putWord8 _acqSvProfile_int_time
put _acqSvProfile_sid
putWord16le _acqSvProfile_bin_width
putWord32le _acqSvProfile_timestamp
putWord32le _acqSvProfile_time_spent
putWord32le $ fromIntegral _acqSvProfile_cf_min
putWord32le $ fromIntegral _acqSvProfile_cf_max
putWord32le $ fromIntegral _acqSvProfile_cf
putWord32le _acqSvProfile_cp
$(makeJSON "_acqSvProfile_" ''AcqSvProfile)
$(makeLenses ''AcqSvProfile)
data AcqSvProfileDep = AcqSvProfileDep
{ _acqSvProfileDep_job_type :: !Word8
, _acqSvProfileDep_status :: !Word8
, _acqSvProfileDep_cn0 :: !Word16
, _acqSvProfileDep_int_time :: !Word8
, _acqSvProfileDep_sid :: !GnssSignalDep
, _acqSvProfileDep_bin_width :: !Word16
, _acqSvProfileDep_timestamp :: !Word32
, _acqSvProfileDep_time_spent :: !Word32
, _acqSvProfileDep_cf_min :: !Int32
, _acqSvProfileDep_cf_max :: !Int32
, _acqSvProfileDep_cf :: !Int32
, _acqSvProfileDep_cp :: !Word32
} deriving ( Show, Read, Eq )
instance Binary AcqSvProfileDep where
get = do
_acqSvProfileDep_job_type <- getWord8
_acqSvProfileDep_status <- getWord8
_acqSvProfileDep_cn0 <- getWord16le
_acqSvProfileDep_int_time <- getWord8
_acqSvProfileDep_sid <- get
_acqSvProfileDep_bin_width <- getWord16le
_acqSvProfileDep_timestamp <- getWord32le
_acqSvProfileDep_time_spent <- getWord32le
_acqSvProfileDep_cf_min <- fromIntegral <$> getWord32le
_acqSvProfileDep_cf_max <- fromIntegral <$> getWord32le
_acqSvProfileDep_cf <- fromIntegral <$> getWord32le
_acqSvProfileDep_cp <- getWord32le
pure AcqSvProfileDep {..}
put AcqSvProfileDep {..} = do
putWord8 _acqSvProfileDep_job_type
putWord8 _acqSvProfileDep_status
putWord16le _acqSvProfileDep_cn0
putWord8 _acqSvProfileDep_int_time
put _acqSvProfileDep_sid
putWord16le _acqSvProfileDep_bin_width
putWord32le _acqSvProfileDep_timestamp
putWord32le _acqSvProfileDep_time_spent
putWord32le $ fromIntegral _acqSvProfileDep_cf_min
putWord32le $ fromIntegral _acqSvProfileDep_cf_max
putWord32le $ fromIntegral _acqSvProfileDep_cf
putWord32le _acqSvProfileDep_cp
$(makeJSON "_acqSvProfileDep_" ''AcqSvProfileDep)
$(makeLenses ''AcqSvProfileDep)
msgAcqSvProfile :: Word16
msgAcqSvProfile = 0x002E
data MsgAcqSvProfile = MsgAcqSvProfile
{ _msgAcqSvProfile_acq_sv_profile :: ![AcqSvProfile]
} deriving ( Show, Read, Eq )
instance Binary MsgAcqSvProfile where
get = do
_msgAcqSvProfile_acq_sv_profile <- whileM (not <$> isEmpty) get
pure MsgAcqSvProfile {..}
put MsgAcqSvProfile {..} = do
mapM_ put _msgAcqSvProfile_acq_sv_profile
$(makeSBP 'msgAcqSvProfile ''MsgAcqSvProfile)
$(makeJSON "_msgAcqSvProfile_" ''MsgAcqSvProfile)
$(makeLenses ''MsgAcqSvProfile)
msgAcqSvProfileDep :: Word16
msgAcqSvProfileDep = 0x001E
data MsgAcqSvProfileDep = MsgAcqSvProfileDep
{ _msgAcqSvProfileDep_acq_sv_profile :: ![AcqSvProfileDep]
} deriving ( Show, Read, Eq )
instance Binary MsgAcqSvProfileDep where
get = do
_msgAcqSvProfileDep_acq_sv_profile <- whileM (not <$> isEmpty) get
pure MsgAcqSvProfileDep {..}
put MsgAcqSvProfileDep {..} = do
mapM_ put _msgAcqSvProfileDep_acq_sv_profile
$(makeSBP 'msgAcqSvProfileDep ''MsgAcqSvProfileDep)
$(makeJSON "_msgAcqSvProfileDep_" ''MsgAcqSvProfileDep)
$(makeLenses ''MsgAcqSvProfileDep)