state machine
This commit is contained in:
parent
fa9fa1746c
commit
5e60c3e540
1 changed files with 7 additions and 0 deletions
|
@ -6,6 +6,7 @@ from queue import Queue, Empty
|
|||
import time
|
||||
import zmq
|
||||
import json
|
||||
from enum import Enum
|
||||
|
||||
NO_MSG = {"msg": None}
|
||||
INIT_MSG = {"msg": "init"}
|
||||
|
@ -13,6 +14,12 @@ ACK_MSG = {"msg": "ack"}
|
|||
PING_MSG = {"msg": "ping"}
|
||||
PONG_MSG = {"msg": "pong"}
|
||||
|
||||
class NetworkState(Enum):
|
||||
DISCONNECTED = auto()
|
||||
CONNECTED = auto()
|
||||
PING = auto()
|
||||
SENDING = auto()
|
||||
|
||||
def convert_to_strings(obj):
|
||||
if isinstance(obj, dict):
|
||||
return {convert_to_strings(key): convert_to_strings(value)
|
||||
|
|
Loading…
Reference in a new issue