Added many Eventbus Structs for the Frontend Handling

This commit is contained in:
2026-02-08 23:49:22 +01:00
parent 7534459e73
commit f8aa19d331
5 changed files with 198 additions and 50 deletions
+11 -3
View File
@@ -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 {
+22
View File
@@ -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
}