Library Apps.TickGeneratorPrefixSerializable

Require Import Coq.Strings.String.
Require Import PrefixSerializableDefinitions PrefixSerializable TickGenerator.

Local Open Scope string_scope.
Set Implicit Arguments.

Instance GatewayPreState_Serializable : Serializable GatewayPreState
  := {| to_string st := match st with
                          | Init ⇒ "Init"
                          | WaitingToWake ⇒ "WaitingToWakeUp"
                          | WaitingToSleep ⇒ "WaitingToSleep"
                        end |}.

Instance GatewayState_Serializable : Serializable GatewayState
  := {| to_string st := "systemTime " ++ to_string st.(systemTime) ++ " nextWakeUpTime " ++ to_string st.(nextWakeUpTime) ++ " waitingOn " ++ to_string st.(waitingOn) |}.

Instance tickGInput_Serializable : Serializable tickGInput
  := {| to_string ev := match ev with
                          | TGWakeUp ⇒ "TGWakeUp"
                          | TGClocksGot nanoseconds ⇒ "TGClocksGot " ++ to_string nanoseconds
                          | TGWantWakeupIn ticks ⇒ "TGWantWakeupIn " ++ to_string ticks
                        end |}.