packages feed

haal-models-0.1.3.0: src/Haal/Models/MQTT/HbmqttSimple.hs

-- Generated by haal-gen. Do not edit manually.
module Haal.Models.MQTT.HbmqttSimple
    ( HbmqttSimpleInput (..)
    , HbmqttSimpleOutput (..)
    , hbmqttSimple
    ) where

import Haal.Automaton.MealyAutomaton (MealyAutomaton, mkMealyAutomatonTable)

data HbmqttSimpleInput
    = In_Connect
    | In_Publish
    | In_Subscribe
    | In_UnSubScribe
    | In_Ping
    | In_Disconnect
    | In_DisconnectTCP
    deriving (Show, Eq, Ord, Enum, Bounded)

data HbmqttSimpleOutput
    = Out_ConnAckPacket
    | Out_Empty
    | Out_ConnectionClosed
    | Out_PubAckPacket
    | Out_SubAckPacket
    | Out_UnSubAckPacket
    | Out_PingRespPacket
    | Out_PublishPacket__PubAckPacket
    deriving (Show, Eq, Ord, Enum, Bounded)

{- Transitions (state  input -> next state / output):
    0     In_Connect        -> 1 / Out_ConnAckPacket
          In_Publish        -> 2 / Out_Empty
          In_Subscribe      -> 2 / Out_Empty
          In_UnSubScribe    -> 2 / Out_Empty
          In_Ping           -> 2 / Out_Empty
          In_Disconnect     -> 2 / Out_Empty
          In_DisconnectTCP  -> 3 / Out_ConnectionClosed
    1     In_Connect        -> 1 / Out_Empty
          In_Publish        -> 1 / Out_PubAckPacket
          In_Subscribe      -> 4 / Out_SubAckPacket
          In_UnSubScribe    -> 1 / Out_UnSubAckPacket
          In_Ping           -> 1 / Out_PingRespPacket
          In_Disconnect     -> 3 / Out_ConnectionClosed
          In_DisconnectTCP  -> 3 / Out_ConnectionClosed
    2     In_Connect        -> 2 / Out_Empty
          In_Publish        -> 2 / Out_Empty
          In_Subscribe      -> 2 / Out_Empty
          In_UnSubScribe    -> 2 / Out_Empty
          In_Ping           -> 2 / Out_Empty
          In_Disconnect     -> 2 / Out_Empty
          In_DisconnectTCP  -> 3 / Out_ConnectionClosed
    3     In_Connect        -> 1 / Out_ConnAckPacket
          In_Publish        -> 3 / Out_ConnectionClosed
          In_Subscribe      -> 3 / Out_ConnectionClosed
          In_UnSubScribe    -> 3 / Out_ConnectionClosed
          In_Ping           -> 3 / Out_ConnectionClosed
          In_Disconnect     -> 3 / Out_ConnectionClosed
          In_DisconnectTCP  -> 3 / Out_ConnectionClosed
    4     In_Connect        -> 4 / Out_Empty
          In_Publish        -> 4 / Out_PublishPacket__PubAckPacket
          In_Subscribe      -> 4 / Out_SubAckPacket
          In_UnSubScribe    -> 1 / Out_UnSubAckPacket
          In_Ping           -> 4 / Out_PingRespPacket
          In_Disconnect     -> 3 / Out_ConnectionClosed
          In_DisconnectTCP  -> 3 / Out_ConnectionClosed
-}
hbmqttSimple :: MealyAutomaton Int HbmqttSimpleInput HbmqttSimpleOutput
hbmqttSimple =
    case mkMealyAutomatonTable 5 0 deltaTable lambdaTable of
        Right m -> m
        Left err -> error ("haal-gen: invalid transition table: " ++ err)
  where
    deltaTable =
        "\1\2\2\2\2\2\3\
        \\1\1\4\1\1\3\3\
        \\2\2\2\2\2\2\3\
        \\1\3\3\3\3\3\3\
        \\4\4\4\1\4\3\3"
    lambdaTable =
        "\0\1\1\1\1\1\2\
        \\1\3\4\5\6\2\2\
        \\1\1\1\1\1\1\2\
        \\0\2\2\2\2\2\2\
        \\1\7\4\5\6\2\2"