module SwiftNav.SBP.Logging where
import Control.Monad
import Control.Monad.Loops
import Data.Binary
import Data.Binary.Get
import Data.Binary.IEEE754
import Data.Binary.Put
import Data.ByteString
import Data.ByteString.Lazy hiding ( ByteString )
import Data.Int
import Data.Word
msgLog :: Word16
msgLog = 0x0401
data MsgLog = MsgLog
{ msgLogLevel :: Word8
, msgLogText :: ByteString
} deriving ( Show, Read, Eq )
instance Binary MsgLog where
get = do
msgLogLevel <- getWord8
msgLogText <- liftM toStrict getRemainingLazyByteString
return MsgLog {..}
put MsgLog {..} = do
putWord8 msgLogLevel
putByteString msgLogText
msgTweet :: Word16
msgTweet = 0x0012
data MsgTweet = MsgTweet
{ msgTweetTweet :: ByteString
} deriving ( Show, Read, Eq )
instance Binary MsgTweet where
get = do
msgTweetTweet <- getByteString 140
return MsgTweet {..}
put MsgTweet {..} = do
putByteString msgTweetTweet
msgPrintDep :: Word16
msgPrintDep = 0x0010
data MsgPrintDep = MsgPrintDep
{ msgPrintDepText :: ByteString
} deriving ( Show, Read, Eq )
instance Binary MsgPrintDep where
get = do
msgPrintDepText <- liftM toStrict getRemainingLazyByteString
return MsgPrintDep {..}
put MsgPrintDep {..} = do
putByteString msgPrintDepText