-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | TinyMesh - communicating with auto-meshing sensor network -- -- TinyMesh are modules build on CC11xx TI MCU transceivers that allow -- for automatic meshing, and remote sensor reading. -- -- Whole sensor network may be orchestrated by a single *gateway* machine -- that is best connected to internet in order to submit the data to the -- cloud. -- -- This library is aimed to allow programming such a gateway machine in -- Haskell, so that it may be Raspberry Pi, or a similar networked ARM -- device. -- -- Current functionality of the module is limited to querying all the -- nodes within the mesh. @package tinyMesh @version 0.1.0.0 -- | Defines Parse class and its generic counterpart for easier parsing of -- packets. module Packet.Parse -- | Class of things that have a default parsing from ByteString. class Parse a parser :: Parse a => Parser a -- | Parse ByteString to any value that has Parse instance. parseBS :: Parse a => ByteString -> a -- | WARNING: doesn't seem to work!!! untilEOF :: Parser a -> Parser [a] instance (Parse a, Parse b, Parse c, Parse d) => Parse (a, b, c, d) instance (Parse a, Parse b, Parse c) => Parse (a, b, c) instance (Parse a, Parse b) => Parse (a, b) instance Parse Int module TinyMesh -- | Serial settings successfully used for communication. serialSettings :: SerialPortSettings queryCmd :: ByteString -- | Reading exactly N bytes from serial port, or reporting a failure. readN :: SerialPort -> Int -> IO (Maybe ByteString) -- | Reading a packet: readPacket :: SerialPort -> IO (Maybe ByteString) -- | Read all the packets currently in the buffer/network. readPackets :: SerialPort -> IO [ByteString] data Header Header :: Int -> NetAddr -> NetAddr -> Int -> Int -> Int -> Int -> Int -> Int -> Header -- | length of the packet len :: Header -> Int -- | system address for mesh nodes systemId :: Header -> NetAddr -- | network address of originating node originId :: Header -> NetAddr -- | origin RSSI originRSSI :: Header -> Int -- | number of vertical hops to gateway netLevel :: Header -> Int -- | number of actual hops from router to gateway hops :: Header -> Int -- | origin message counter origMsgCnt :: Header -> Int -- | latency between message creation and delivery *10ms latency :: Header -> Int -- | integer packet type packetType :: Header -> Int netaddr :: Parser NetAddr headerLen :: Int data Payload Event :: Payload Serial :: Maybe Int -> ByteString -> Payload blockCount :: Payload -> Maybe Int serData :: Payload -> ByteString Unknown :: ByteString -> Payload data Packet Packet :: Header -> Payload -> Packet header :: Packet -> Header payload :: Packet -> Payload newtype NetAddr NetAddr :: (Int, Int, Int, Int) -> NetAddr netAddrAsTuple :: NetAddr -> (Int, Int, Int, Int) byte :: Parser Int word :: Parser Int -- | TODO: Hex literals parseEvent :: Parser Payload parseSerial :: Int -> Parser Payload bytestringParser :: Int -> Parser ByteString parsePacket :: ByteString -> Packet -- | Main test script: main :: IO () instance Show Payload instance Generic NetAddr instance Show Header instance Generic Header instance Show Packet instance Generic Packet instance Datatype D1NetAddr instance Constructor C1_0NetAddr instance Selector S1_0_0NetAddr instance Datatype D1Header instance Constructor C1_0Header instance Selector S1_0_0Header instance Selector S1_0_1Header instance Selector S1_0_2Header instance Selector S1_0_3Header instance Selector S1_0_4Header instance Selector S1_0_5Header instance Selector S1_0_6Header instance Selector S1_0_7Header instance Selector S1_0_8Header instance Datatype D1Packet instance Constructor C1_0Packet instance Selector S1_0_0Packet instance Selector S1_0_1Packet instance Parse Packet instance Parse NetAddr instance Show NetAddr instance Parse Header