Added many Eventbus Structs for the Frontend Handling
This commit is contained in:
+11
-3
@@ -9,13 +9,20 @@ const (
|
||||
CmdInitState = "init_state"
|
||||
CmdConnect = "connect"
|
||||
CmdDisconnect = "disconnect"
|
||||
CmdSendMessage = "send"
|
||||
CmdRX = "uart_rx"
|
||||
CmdTX = "uart_tx"
|
||||
)
|
||||
|
||||
var MessageReceiveRegistry = map[string]func() any{
|
||||
CmdConnect: func() any { return &WsUartConnect{} },
|
||||
CmdDisconnect: func() any { return &WsUartDisconnect{} },
|
||||
CmdSendMessage: func() any { return &WsUartSendMessage{} },
|
||||
}
|
||||
|
||||
type WsMessage struct {
|
||||
Cmd string `json:"cmd"`
|
||||
Payload any `json:"payload"`
|
||||
Payload []byte `json:"payload,omitempty"`
|
||||
}
|
||||
|
||||
type SystemState struct {
|
||||
@@ -28,14 +35,15 @@ type SystemState struct {
|
||||
|
||||
type WsUartConnect struct {
|
||||
SelectedAdapter string `json:"selected_adapter"`
|
||||
Baudrates string `json:"baudrates"`
|
||||
Baudrate int `json:"baudrate"`
|
||||
}
|
||||
|
||||
type WsUartDisconnect struct {
|
||||
}
|
||||
|
||||
type WsUartSendMessage struct {
|
||||
Data []byte `json:"data"`
|
||||
MsgId byte `json:"msg_id"`
|
||||
Data []byte `json:"data"`
|
||||
}
|
||||
|
||||
type WsUartRX struct {
|
||||
|
||||
@@ -86,3 +86,25 @@ type PayloadOtaPayload struct {
|
||||
type PayloadOtaStartEspNow struct {
|
||||
Data []byte
|
||||
}
|
||||
|
||||
type ActionUartConnect struct {
|
||||
Adapter string
|
||||
Baudrate int
|
||||
}
|
||||
|
||||
type ActionUartConnected struct {
|
||||
Adapter string
|
||||
Baudrate int
|
||||
Error error
|
||||
}
|
||||
|
||||
type ActionUartDisconnect struct {
|
||||
}
|
||||
|
||||
type ActionUartDisconnected struct {
|
||||
}
|
||||
|
||||
type ActionUartSendMessage struct {
|
||||
MsgId byte
|
||||
Data []byte
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user