Documentation
¶
Index ¶
- Constants
- func Decode(reader io.Reader) (data []byte, err error)
- func Encode(cmd any) ([]byte, error)
- func FormatOmPath(path string) string
- func FormatOmPathPrefix(prefix string) string
- func GetFaultCode(code string) string
- type Class
- type Client
- func (own *Client) ADD(object, argument string) error
- func (own *Client) AUTH(cert string) error
- func (own *Client) Close() error
- func (own *Client) Connect(cert ...string) (err error)
- func (own *Client) DELETE(object, argument string) error
- func (own *Client) FACTORY(resetAll bool) error
- func (own *Client) GET(params []string, prefix ...string) (map[string]string, error)
- func (own *Client) INFORM(event InformEvent) error
- func (own *Client) REBOOT() error
- func (own *Client) RELOADSN() error
- func (own *Client) RESET(module string, action int) error
- func (own *Client) Request(req any) (Response, error)
- func (own *Client) SET(params map[string]string, prefix ...string) error
- func (own *Client) WithPort(port int) *Client
- func (own *Client) WithPrint() *Client
- func (own *Client) WithReadTimeout(timeout int) *Client
- func (own *Client) WithWriteTimeout(timeout int) *Client
- type Command
- type DownloadType
- type InformEvent
- type Request
- type RequestDownloadFile
- type RequestUploadFile
- type Response
- type UploadType
Constants ¶
View Source
const ( DEFAULT_PORT = 20300 // OM接口默认端口 DEFAULT_READ_TIMEOUT = 60 // OM接口默认读超时时间 DEFAULT_WRITE_TIMEOUT = 10 // OM接口默认写超时时间 DEFAULT_CERT = "" // OM接口默认认证密码 /* 128-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func FormatOmPath ¶
func FormatOmPathPrefix ¶
func GetFaultCode ¶
Types ¶
type Class ¶
type Class string
Class 定义OM接口的消息类型
func (Class) IsMatchCommand ¶
IsMatchCommand 检查当前消息类型是否与指定命令匹配
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client 定义OM接口的客户端结构
func (*Client) WithReadTimeout ¶
WithReadTimeout 指定读超时时间
func (*Client) WithWriteTimeout ¶
WithWriteTimeout 指定写超时时间
type Command ¶
type Command string
Command 定义OM接口的命令类型
const ( CMD_GET Command = "get" // 查询命令 CMD_SET Command = "set" // 修改命令 CMD_ADD Command = "add" // 新增命令 CMD_DELETE Command = "delete" // 删除命令 CMD_REBOOT Command = "reboot" // 重启命令 CMD_FACTORY Command = "factory_reboot" // 初始化重启命令 CMD_DOWNLOAD Command = "download" // 下载命令 CMD_UPLOAD Command = "upload" // 上传命令 CMD_RESET Command = "reset" // 模块重置命令 CMD_INFORM Command = "inform" // 消息转发命令 CMD_RELOAD_SN Command = "snReload" // 重置SN命令 )
func (Command) IsMatchClass ¶
IsMatchClass 检查当前命令类型是否与指定消息匹配
type DownloadType ¶
type DownloadType string
********************************************************************************************
const ( DOWNLOAD_TYPE_1 DownloadType = "1 软件包" DOWNLOAD_TYPE_2 DownloadType = "2 配置文件" DOWNLOAD_TYPE_3 DownloadType = "3 普通文件" DOWNLOAD_TYPE_5 DownloadType = "5 Dt omcore log file" DOWNLOAD_TYPE_6 DownloadType = "6 Dt omkeeper log file" DOWNLOAD_TYPE_7 DownloadType = "7 Dt omproxy log file" DOWNLOAD_TYPE_8 DownloadType = "8 Dt proxy log file" DOWNLOAD_TYPE_9 DownloadType = "9 Dt atproxy log file" DOWNLOAD_TYPE_10 DownloadType = "10 Dt xds log file" DOWNLOAD_TYPE_11 DownloadType = "11 Dt all log file" DOWNLOAD_TYPE_12 DownloadType = "12 Data Model File" DOWNLOAD_TYPE_14 DownloadType = "14 Dt ordinary log file" DOWNLOAD_TYPE_15 DownloadType = "15 All configure File" DOWNLOAD_TYPE_18 DownloadType = "18 Dt Alarm Model File" DOWNLOAD_TYPE_19 DownloadType = "19 Dt Exception Model File" DOWNLOAD_TYPE_20 DownloadType = "20 Dt Alarm File" DOWNLOAD_TYPE_21 DownloadType = "21 Dt Exception File" )
type InformEvent ¶
type InformEvent string
const ( INFORM_EVENT_1 InformEvent = "1 boot" INFORM_EVENT_2 InformEvent = "2 periodic" INFORM_EVENT_3 InformEvent = "3 scheduled" INFORM_EVENT_4 InformEvent = "4 value_change" INFORM_EVENT_6 InformEvent = "6 connection request" INFORM_EVENT_8 InformEvent = "8 diagnostics complete" INFORM_EVENT_13 InformEvent = "13 downLoad complete" INFORM_EVENT_14 InformEvent = "14 upload complete" INFORM_EVENT_15 InformEvent = "15 upgrade report" )
type Request ¶
func (Request) GetCommand ¶
type RequestDownloadFile ¶
type RequestDownloadFile struct { Key string `json:"key"` // 文件唯一识别码 Url string `json:"url"` FileType DownloadType `json:"file_type"` // 文件类型 FileSize int64 `json:"file_size"` Username string `json:"username"` Password string `json:"password"` DelayTime int64 `json:"delay_time"` }
********************************************************************************************
func (*RequestDownloadFile) Generate ¶
func (own *RequestDownloadFile) Generate() map[string]any
func (*RequestDownloadFile) GetClass ¶
func (own *RequestDownloadFile) GetClass() Class
func (*RequestDownloadFile) GetCommand ¶
func (own *RequestDownloadFile) GetCommand() Command
type RequestUploadFile ¶
type RequestUploadFile struct { Key string `json:"key"` // 文件唯一识别码 Url string `json:"url"` FileType UploadType `json:"file_type"` // 文件类型 Username string `json:"username"` Password string `json:"password"` DelayTime int64 `json:"delay_time"` StartTime string `json:"start_time"` // 告警异常上传时开始时间 NumberDay int64 `json:"numberDay"` // 告警异常上传几天的文件 }
********************************************************************************************
func (*RequestUploadFile) Generate ¶
func (own *RequestUploadFile) Generate() map[string]any
func (*RequestUploadFile) GetClass ¶
func (own *RequestUploadFile) GetClass() Class
func (*RequestUploadFile) GetCommand ¶
func (own *RequestUploadFile) GetCommand() Command
type Response ¶
func (Response) IsStatusOk ¶
type UploadType ¶
type UploadType string
********************************************************************************************
const ( UPLOAD_TYPE_1 UploadType = "1 Firmware Upgrade Image" UPLOAD_TYPE_2 UploadType = "2 Web Content" UPLOAD_TYPE_3 UploadType = "3 Vendor Configuration File" UPLOAD_TYPE_13 UploadType = "13 Work Order File" UPLOAD_TYPE_16 UploadType = "16 Dt Firmware Upgrade Uu" UPLOAD_TYPE_17 UploadType = "17 Dt Firmware Upgrade Hc" )
Click to show internal directories.
Click to hide internal directories.