{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE RecordWildCards #-}
module SwiftNav.SBP.Vehicle
( module SwiftNav.SBP.Vehicle
) 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
{-# ANN module ("HLint: ignore Use camelCase"::String) #-}
{-# ANN module ("HLint: ignore Redundant do"::String) #-}
{-# ANN module ("HLint: ignore Use newtype instead of data"::String) #-}
msgOdometry :: Word16
msgOdometry :: Word16
msgOdometry = Word16
0x0903
data MsgOdometry = MsgOdometry
{ MsgOdometry -> Word32
_msgOdometry_tow :: !Word32
, MsgOdometry -> Int32
_msgOdometry_velocity :: !Int32
, MsgOdometry -> Word8
_msgOdometry_flags :: !Word8
} deriving ( Int -> MsgOdometry -> ShowS
[MsgOdometry] -> ShowS
MsgOdometry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MsgOdometry] -> ShowS
$cshowList :: [MsgOdometry] -> ShowS
show :: MsgOdometry -> String
$cshow :: MsgOdometry -> String
showsPrec :: Int -> MsgOdometry -> ShowS
$cshowsPrec :: Int -> MsgOdometry -> ShowS
Show, ReadPrec [MsgOdometry]
ReadPrec MsgOdometry
Int -> ReadS MsgOdometry
ReadS [MsgOdometry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MsgOdometry]
$creadListPrec :: ReadPrec [MsgOdometry]
readPrec :: ReadPrec MsgOdometry
$creadPrec :: ReadPrec MsgOdometry
readList :: ReadS [MsgOdometry]
$creadList :: ReadS [MsgOdometry]
readsPrec :: Int -> ReadS MsgOdometry
$creadsPrec :: Int -> ReadS MsgOdometry
Read, MsgOdometry -> MsgOdometry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MsgOdometry -> MsgOdometry -> Bool
$c/= :: MsgOdometry -> MsgOdometry -> Bool
== :: MsgOdometry -> MsgOdometry -> Bool
$c== :: MsgOdometry -> MsgOdometry -> Bool
Eq )
instance Binary MsgOdometry where
get :: Get MsgOdometry
get = do
Word32
_msgOdometry_tow <- Get Word32
getWord32le
Int32
_msgOdometry_velocity <- (forall a b. (Integral a, Num b) => a -> b
fromIntegral forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Word32
getWord32le)
Word8
_msgOdometry_flags <- Get Word8
getWord8
forall (f :: * -> *) a. Applicative f => a -> f a
pure MsgOdometry {Int32
Word8
Word32
_msgOdometry_flags :: Word8
_msgOdometry_velocity :: Int32
_msgOdometry_tow :: Word32
_msgOdometry_flags :: Word8
_msgOdometry_velocity :: Int32
_msgOdometry_tow :: Word32
..}
put :: MsgOdometry -> Put
put MsgOdometry {Int32
Word8
Word32
_msgOdometry_flags :: Word8
_msgOdometry_velocity :: Int32
_msgOdometry_tow :: Word32
_msgOdometry_flags :: MsgOdometry -> Word8
_msgOdometry_velocity :: MsgOdometry -> Int32
_msgOdometry_tow :: MsgOdometry -> Word32
..} = do
Word32 -> Put
putWord32le Word32
_msgOdometry_tow
(Word32 -> Put
putWord32le forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral) Int32
_msgOdometry_velocity
Word8 -> Put
putWord8 Word8
_msgOdometry_flags
$(makeSBP 'msgOdometry ''MsgOdometry)
$(makeJSON "_msgOdometry_" ''MsgOdometry)
$(makeLenses ''MsgOdometry)
msgWheeltick :: Word16
msgWheeltick :: Word16
msgWheeltick = Word16
0x0904
data MsgWheeltick = MsgWheeltick
{ MsgWheeltick -> Word64
_msgWheeltick_time :: !Word64
, MsgWheeltick -> Word8
_msgWheeltick_flags :: !Word8
, MsgWheeltick -> Word8
_msgWheeltick_source :: !Word8
, MsgWheeltick -> Int32
_msgWheeltick_ticks :: !Int32
} deriving ( Int -> MsgWheeltick -> ShowS
[MsgWheeltick] -> ShowS
MsgWheeltick -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MsgWheeltick] -> ShowS
$cshowList :: [MsgWheeltick] -> ShowS
show :: MsgWheeltick -> String
$cshow :: MsgWheeltick -> String
showsPrec :: Int -> MsgWheeltick -> ShowS
$cshowsPrec :: Int -> MsgWheeltick -> ShowS
Show, ReadPrec [MsgWheeltick]
ReadPrec MsgWheeltick
Int -> ReadS MsgWheeltick
ReadS [MsgWheeltick]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MsgWheeltick]
$creadListPrec :: ReadPrec [MsgWheeltick]
readPrec :: ReadPrec MsgWheeltick
$creadPrec :: ReadPrec MsgWheeltick
readList :: ReadS [MsgWheeltick]
$creadList :: ReadS [MsgWheeltick]
readsPrec :: Int -> ReadS MsgWheeltick
$creadsPrec :: Int -> ReadS MsgWheeltick
Read, MsgWheeltick -> MsgWheeltick -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MsgWheeltick -> MsgWheeltick -> Bool
$c/= :: MsgWheeltick -> MsgWheeltick -> Bool
== :: MsgWheeltick -> MsgWheeltick -> Bool
$c== :: MsgWheeltick -> MsgWheeltick -> Bool
Eq )
instance Binary MsgWheeltick where
get :: Get MsgWheeltick
get = do
Word64
_msgWheeltick_time <- Get Word64
getWord64le
Word8
_msgWheeltick_flags <- Get Word8
getWord8
Word8
_msgWheeltick_source <- Get Word8
getWord8
Int32
_msgWheeltick_ticks <- (forall a b. (Integral a, Num b) => a -> b
fromIntegral forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get Word32
getWord32le)
forall (f :: * -> *) a. Applicative f => a -> f a
pure MsgWheeltick {Int32
Word8
Word64
_msgWheeltick_ticks :: Int32
_msgWheeltick_source :: Word8
_msgWheeltick_flags :: Word8
_msgWheeltick_time :: Word64
_msgWheeltick_ticks :: Int32
_msgWheeltick_source :: Word8
_msgWheeltick_flags :: Word8
_msgWheeltick_time :: Word64
..}
put :: MsgWheeltick -> Put
put MsgWheeltick {Int32
Word8
Word64
_msgWheeltick_ticks :: Int32
_msgWheeltick_source :: Word8
_msgWheeltick_flags :: Word8
_msgWheeltick_time :: Word64
_msgWheeltick_ticks :: MsgWheeltick -> Int32
_msgWheeltick_source :: MsgWheeltick -> Word8
_msgWheeltick_flags :: MsgWheeltick -> Word8
_msgWheeltick_time :: MsgWheeltick -> Word64
..} = do
Word64 -> Put
putWord64le Word64
_msgWheeltick_time
Word8 -> Put
putWord8 Word8
_msgWheeltick_flags
Word8 -> Put
putWord8 Word8
_msgWheeltick_source
(Word32 -> Put
putWord32le forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral) Int32
_msgWheeltick_ticks
$(makeSBP 'msgWheeltick ''MsgWheeltick)
$(makeJSON "_msgWheeltick_" ''MsgWheeltick)
$(makeLenses ''MsgWheeltick)