packages feed

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

-- Generated by haal-gen. Do not edit manually.
module Haal.Models.MQTT.ActiveMQSimple
    ( ActiveMQSimpleInput (..)
    , ActiveMQSimpleOutput (..)
    , activeMQSimple
    ) where

import Haal.Automaton.MealyAutomaton (MealyAutomaton, mkMealyAutomatonTable)

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

data ActiveMQSimpleOutput
    = Out_ConnAckPacket
    | Out_ConnectionClosed
    | Out_PingRespPacket
    | Out_PubAckPacket
    | Out_SubAckPacket
    | Out_UnSubAckPacket
    | 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_ConnectionClosed
          In_Subscribe      -> 2 / Out_ConnectionClosed
          In_UnSubScribe    -> 2 / Out_ConnectionClosed
          In_Ping           -> 0 / Out_PingRespPacket
          In_Disconnect     -> 2 / Out_ConnectionClosed
          In_DisconnectTCP  -> 2 / Out_ConnectionClosed
    1     In_Connect        -> 2 / Out_ConnectionClosed
          In_Publish        -> 1 / Out_PubAckPacket
          In_Subscribe      -> 3 / Out_SubAckPacket
          In_UnSubScribe    -> 1 / Out_UnSubAckPacket
          In_Ping           -> 1 / Out_PingRespPacket
          In_Disconnect     -> 2 / Out_ConnectionClosed
          In_DisconnectTCP  -> 2 / Out_ConnectionClosed
    2     In_Connect        -> 1 / Out_ConnAckPacket
          In_Publish        -> 2 / Out_ConnectionClosed
          In_Subscribe      -> 2 / Out_ConnectionClosed
          In_UnSubScribe    -> 2 / Out_ConnectionClosed
          In_Ping           -> 2 / Out_ConnectionClosed
          In_Disconnect     -> 2 / Out_ConnectionClosed
          In_DisconnectTCP  -> 2 / Out_ConnectionClosed
    3     In_Connect        -> 2 / Out_ConnectionClosed
          In_Publish        -> 3 / Out_PublishPacket__PubAckPacket
          In_Subscribe      -> 3 / Out_SubAckPacket
          In_UnSubScribe    -> 1 / Out_UnSubAckPacket
          In_Ping           -> 3 / Out_PingRespPacket
          In_Disconnect     -> 2 / Out_ConnectionClosed
          In_DisconnectTCP  -> 2 / Out_ConnectionClosed
-}
activeMQSimple :: MealyAutomaton Int ActiveMQSimpleInput ActiveMQSimpleOutput
activeMQSimple =
    case mkMealyAutomatonTable 4 0 deltaTable lambdaTable of
        Right m -> m
        Left err -> error ("haal-gen: invalid transition table: " ++ err)
  where
    deltaTable =
        "\1\2\2\2\0\2\2\
        \\2\1\3\1\1\2\2\
        \\1\2\2\2\2\2\2\
        \\2\3\3\1\3\2\2"
    lambdaTable =
        "\0\1\1\1\2\1\1\
        \\1\3\4\5\2\1\1\
        \\0\1\1\1\1\1\1\
        \\1\6\4\5\2\1\1"