2 * Copyright (C) 2018 "IoT.bzh"
3 * Author Sebastien Douheret <sebastien@iot.bzh>
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
24 // TargetType definition
25 type TargetType string
28 // TypeTgtStandard Standard target type
29 TypeTgtStandard = "standard"
32 // Target Status definition
34 StatusTgtErrorConfig = "ErrorConfig"
35 StatusTgtDisable = "Disable"
36 StatusTgtEnable = "Enable"
39 // TargetConfig config of a target / board
40 type TargetConfig struct {
42 Name string `json:"name"`
43 Type TargetType `json:"type"`
45 Status string `json:"status"`
46 Terms []TerminalConfig `json:"terms"`
53 // TerminalType definition
54 type TerminalType string
57 // TypeTermSSH ssh terminal type
60 // StatusTermErrorConfig Configuration error
61 StatusTermErrorConfig = "ErrorConfig"
62 // StatusTermEnable Enable state
63 StatusTermEnable = "Enable"
64 // StatusTermOpen Open state
65 StatusTermOpen = "Open"
66 // StatusTermClose Close state
67 StatusTermClose = "Close"
69 // TerminalInEvent Event send in WS when characters are sent (stdin)
70 TerminalInEvent = "term:input"
71 // TerminalOutEvent Event send in WS when characters are received (stdout or stderr)
72 TerminalOutEvent = "term:output"
73 // TerminalExitEvent Event send in WS on terminal/console exit
74 TerminalExitEvent = "term:exit"
79 // TerminalConfig config of a board terminal
80 TerminalConfig struct {
82 Name string `json:"name"`
83 Type TerminalType `json:"type"`
84 User string `json:"user"`
85 Options []string `json:"options"`
86 Status string `json:"status"`
87 Cols uint16 `json:"cols"`
88 Rows uint16 `json:"rows"`
91 // TerminalInMsg Message used to received input characters (stdin)
92 TerminalInMsg struct {
93 TermID string `json:"termID"`
94 Timestamp string `json:"timestamp"`
95 Stdin string `json:"stdin"`
98 // TerminalOutMsg Message used to send output characters (stdout+stderr)
99 TerminalOutMsg struct {
100 TermID string `json:"termID"`
101 Timestamp string `json:"timestamp"`
102 Stdout []byte `json:"stdout"`
103 Stderr []byte `json:"stderr"`
106 // TerminalExitMsg Message sent on terminal/console exit
107 TerminalExitMsg struct {
108 TermID string `json:"termID"`
109 Timestamp string `json:"timestamp"`
110 Code int `json:"code"`
111 Error error `json:"error"`
114 // TerminalResizeArgs JSON parameters of /terminal/:tid/resize command
115 TerminalResizeArgs struct {
116 Cols uint16 `json:"cols"`
117 Rows uint16 `json:"rows"`
120 // TerminalSignalArgs JSON parameters of /terminal/:tid/signal command
121 TerminalSignalArgs struct {
122 Signal string `json:"signal" binding:"required"` // signal number