Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AtCommandResultView = MainView{ Name: "AtCommandResultView", Render: func(m Model) string { var resultString string for _, l := range m.AtCommandResult { resultString += fmt.Sprintf("%s\n", l) } return resultString }, Action: func(m Model) Model { return m }, ItemLength: 0, }
View Source
var AtCommandView = MainView{ Name: "AtCommandView", Render: func(m Model) string { var commandListString string for i, command := range at_commands.GetModemInfoCommands() { cursor := " " if m.Cursor == i { cursor = "👉" } commandListString += fmt.Sprintf("%s %s - %s\n", cursor, command.Command, command.Description) } return commandListString }, Action: func(m Model) Model { command := at_commands.GetModemInfoCommands()[m.Cursor] info := command.Run(m.SelectedPort) m.AtCommandResult = info m.MainView = AtCommandResultView return m }, ItemLength: len(at_commands.GetModemInfoCommands()), }
View Source
var CustomInputView = MainView{ Name: "CustomInputView", Render: func(m Model) string { return fmt.Sprintf( "Custom AT command: %s\n", m.textInput.View(), ) }, Action: func(m Model) Model { command := at_commands.AtCommand{Command: m.textInput.Value()} info := command.Run(m.SelectedPort) m.AtCommandResult = info m.MainView = AtCommandResultView m.textInput.Blur() return m }, }
View Source
var SerialPortView = MainView{ Name: "SerialPortView", Render: func(m Model) string { var portListString string for i, port := range serial_ports.GetSerialPorts() { cursor := " " if m.Cursor == i { cursor = "👉" } portListString += fmt.Sprintf("%s %s\n", cursor, port.Name) } return portListString }, Action: func(m Model) Model { m.SelectedPort = serial_ports.GetSerialPorts()[m.Cursor] m.MainView = AtCommandView m.Cursor = 0 return m }, ItemLength: len(serial_ports.GetSerialPorts()), }
Functions ¶
This section is empty.
Types ¶
type Model ¶
type Model struct { Cursor int SelectedPort serial_ports.SerialPort MainView MainView AtCommandResult []string // contains filtered or unexported fields }
func InitialModel ¶
func InitialModel() Model
Click to show internal directories.
Click to hide internal directories.