Documentation
¶
Index ¶
- Constants
- type AppFooter
- type AppHeader
- type DirectoriesPage
- type DirectoryInfo
- type DiscoPage
- type TDInfoPanel
- func (infoPanel *TDInfoPanel) ShowActionAff(actionName string, aff *wot.ActionAffordance)
- func (infoPanel *TDInfoPanel) ShowEventAff(eventName string, aff *wot.EventAffordance)
- func (infoPanel *TDInfoPanel) ShowForm(row int, form wot.Form, i int) int
- func (infoPanel *TDInfoPanel) ShowForms(forms []wot.Form)
- func (infoPanel *TDInfoPanel) ShowPropAff(propName string, aff *wot.PropertyAffordance)
- type TDPage
- type ThingsPage
- type TreeMenu
- type TuiApp
- func (tuiApp *TuiApp) HandleNotification(notif *msg.NotificationMessage)
- func (tuiApp *TuiApp) NextPage()
- func (tuiApp *TuiApp) QueueSwitchToPage(pageName string)
- func (tuiApp *TuiApp) SelectTD(thingID string)
- func (tuiApp *TuiApp) ShowDirectories()
- func (tuiApp *TuiApp) ShowDiscovery()
- func (tuiApp *TuiApp) ShowError(err error)
- func (tuiApp *TuiApp) ShowTD(thingID string)
- func (tuiApp *TuiApp) ShowThings()
- func (tuiApp *TuiApp) Start()
- func (tuiApp *TuiApp) StartDiscovery()
- type TuiTable
- func (t *TuiTable) Clear() *tview.Table
- func (tbl *TuiTable) SetSelectableCell(row int, col int, content string) *tview.TableCell
- func (tbl *TuiTable) SetTextCell(row int, col int, content ...string) int
- func (tbl *TuiTable) SetTextRow(row int, texts ...string)
- func (tbl *TuiTable) SetTitleCell(row int, col int, title string, text string) *tview.TableCell
- func (tbl *TuiTable) SetTitleRow(row int, titles ...string)
Constants ¶
const ( // PageLanding = "landing" PageThings = "things" PageDirectories = "directories" PageDiscovery = "discovery" PageTD = "td" )
const ( MenuEvClose = "close" MenuEvDiscover = "discover" MenuEvListTDs = "listTDs" MenuEvNextPage = "nextPage" MenuEvSelectTD = "selectTD" MenuEvShowDiscovered = "showDiscovered" MenuEvShowDirectory = "showDirectory" MenuEvShowDirectories = "showDirectories" MenuEvShowTD = "showTD" MenuEvShowThings = "showThings" MenuEvQuit = "quit" )
menu events
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppFooter ¶
type AppFooter struct {
// contains filtered or unexported fields
}
The application footer are that shows the current activity and ?
func (*AppFooter) SetHandler ¶
type AppHeader ¶
The application header are that shows the connect connection and loaded status
func (*AppHeader) Refresh ¶
func (header *AppHeader) Refresh(discoRecs []*discovery.DiscoveryResult, tdList []*wot.TD)
Reload the text being shown using updated values
func (*AppHeader) ShowStatus ¶
Show a status text in the header
type DirectoriesPage ¶
type DirectoriesPage struct {
*TuiTable
// contains filtered or unexported fields
}
Show the loaded directories in the main view
func NewDirectoriesPage ¶
func NewDirectoriesPage() *DirectoriesPage
Return a new page with a table of known directory TDs
func (*DirectoriesPage) GetDirectoryID ¶
func (v *DirectoriesPage) GetDirectoryID(row int) string
Return the directoryID of the selected row, or empty string if not found
func (*DirectoriesPage) Refresh ¶
func (v *DirectoriesPage) Refresh(dirList []*wot.TD)
Show the loaded directories in the main view
func (*DirectoriesPage) SetHandler ¶
func (footer *DirectoriesPage) SetHandler(h func(ev ...string))
type DirectoryInfo ¶
type DirectoryInfo struct {
// contains filtered or unexported fields
}
DirInfo is the discovered directory information
type DiscoPage ¶
type DiscoPage struct {
*TuiTable
// contains filtered or unexported fields
}
Page with discovery records
func (*DiscoPage) Refresh ¶
func (page *DiscoPage) Refresh(dirRecs, deviceRecs []*discovery.DiscoveryResult)
Show a table of discovered directory and device records. records can be nil for initial display.
type TDInfoPanel ¶
type TDInfoPanel struct {
*TuiTable
}
TD Info panel for show selected affordance details
func NewTDInfoPanel ¶
func NewTDInfoPanel() *TDInfoPanel
func (*TDInfoPanel) ShowActionAff ¶
func (infoPanel *TDInfoPanel) ShowActionAff(actionName string, aff *wot.ActionAffordance)
Show a basic description of the selected action affordance
func (*TDInfoPanel) ShowEventAff ¶
func (infoPanel *TDInfoPanel) ShowEventAff(eventName string, aff *wot.EventAffordance)
Show a basic description of the selected event affordance
func (*TDInfoPanel) ShowForm ¶
Add a form section to the table at the row This returns the last row+1.
func (*TDInfoPanel) ShowForms ¶
func (infoPanel *TDInfoPanel) ShowForms(forms []wot.Form)
func (*TDInfoPanel) ShowPropAff ¶
func (infoPanel *TDInfoPanel) ShowPropAff(propName string, aff *wot.PropertyAffordance)
Show a basic description of the selected property affordance
type TDPage ¶
Page for showing details of a TD document: - header area with thingID, title, base URL, ... - list of properties and latest value (if available) - list of events and latest value (if available) - list of actions - bottom info on selected affordance: forms
func (*TDPage) Refresh ¶
func (page *TDPage) Refresh(thingID string, tdoc *wot.TD, propsMap map[string]msg.ThingValue, events map[string]msg.ThingValue)
redraw the TD page TODO: Change to grid and use a tree menu for properties, events, and actions TODO: table should have scroll indicators
func (*TDPage) SetHandler ¶
set the handler for page events
type ThingsPage ¶
type ThingsPage struct {
*TuiTable
// contains filtered or unexported fields
}
Show the loaded things in the main view
func NewThingsPage ¶
func NewThingsPage() *ThingsPage
Return a new page with a table of known thing TDs
func (*ThingsPage) GetThingID ¶
func (page *ThingsPage) GetThingID(row int) string
Return the thingID of the selected row, or empty string if not found
func (*ThingsPage) Refresh ¶
func (page *ThingsPage) Refresh(tdList []*wot.TD)
Show the loaded things in the main view this rotates through different tables
func (*ThingsPage) SetHandler ¶
func (page *ThingsPage) SetHandler(h func(ev ...string))
type TreeMenu ¶
func NewTreeMenu ¶
func NewTreeMenu() *TreeMenu
Show a tree menu with discovered directories and things
func (*TreeMenu) HandleSelection ¶
func (*TreeMenu) Refresh ¶
func (m *TreeMenu) Refresh(dirList []DirectoryInfo, discoveredThings map[string]*wot.TD)
Refresh the menu with the latest discovered things and directories
func (*TreeMenu) SelectDiscovery ¶
func (m *TreeMenu) SelectDiscovery()
Select the Discovery entry in the tree view
func (*TreeMenu) SelectThing ¶
Select the Thing in the tree view
func (*TreeMenu) SetHandler ¶
type TuiApp ¶
type TuiApp struct {
tview.Application
// contains filtered or unexported fields
}
The main application view with panels for header, menu main view and footer - header shows the current status - menu shows quick actions for discovery and viewing TDs - main shows details - footer shows last action
func NewTuiApp ¶
func NewTuiApp(f api.ICellFactory) (*TuiApp, *consumer.Consumer)
Return a new instance of the tui app along with the consumer to link to. Call Start to run.
func (*TuiApp) HandleNotification ¶
func (tuiApp *TuiApp) HandleNotification(notif *msg.NotificationMessage)
Handle notifications
func (*TuiApp) QueueSwitchToPage ¶
Show to page. This is queued to avoid deadlock when invoking from the event handler. This can be called from the background or the main thread.
func (*TuiApp) SelectTD ¶
Select a TD in the menu. This is called by the ThingList to select a thing in the menu which in turn updates the TD view.
func (*TuiApp) ShowDirectories ¶
func (tuiApp *TuiApp) ShowDirectories()
func (*TuiApp) ShowDiscovery ¶
func (tuiApp *TuiApp) ShowDiscovery()
Switch to the the discovery page
func (*TuiApp) ShowTD ¶
Show the TD page with the thingID details This reads and subscribes to properties and events
func (*TuiApp) ShowThings ¶
func (tuiApp *TuiApp) ShowThings()
Show the loaded things in the main view
func (*TuiApp) StartDiscovery ¶
func (tuiApp *TuiApp) StartDiscovery()
Restart a discovery and update the cached TDs. If a directory is found, set the TDD for the directory service.
type TuiTable ¶
type TuiTable struct {
tview.Table
TitleColor tcell.Color
DataColor tcell.Color
TextColor tcell.Color
SelectableColor tcell.Color
}
A simple table with boilerplate code for adding titles and data rows and some bug fixes.
TODO: add paging indicators if the table is longer than available rows
func NewTuiTable ¶
func NewTuiTable() *TuiTable
func (*TuiTable) Clear ¶
Clear removes all table data. Workaround for bug #1146, race causing endless loop after pressing 'down' when repopulating the table after calling Clear in a fixed table. This ensure the row exists.
func (*TuiTable) SetSelectableCell ¶
Add a selectable data cell to the table, and return the tabel cell Row should start at 1, as row 0 is for the titles
func (*TuiTable) SetTextCell ¶
Set plain text in the table and return the cell multiple text strings can be passed this returns the next column number
func (*TuiTable) SetTextRow ¶
Add a text row to the table Row should start at 1, as row 0 is for the titles
func (*TuiTable) SetTitleCell ¶
Set a cell table in title color and text in text color This returns the text cell
func (*TuiTable) SetTitleRow ¶
Add the column titles to the table These use the titleColor and are not selectable