om

package
v0.0.0-...-720534f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_PORT = 20300

	DEFAULT_READ_TIMEOUT  = 60
	DEFAULT_WRITE_TIMEOUT = 10
)
View Source
const DEFAULT_CERT = "" /* 128-byte string literal not displayed */

Variables

This section is empty.

Functions

func Decode

func Decode(reader io.Reader, from, to string) (data []byte, err error)

func Encode

func Encode(cmd any, from, to string) ([]byte, error)

func FormatOmPath

func FormatOmPath(path string) string

func FormatOmPathPrefix

func FormatOmPathPrefix(prefix string) string

func GetFaultCode

func GetFaultCode(code string) string

func String

func String(req Requester) string

Types

type Class

type Class string
const (
	CLS_NONE         Class = ""
	CLS_NAME         Class = "name"
	CLS_VALUE        Class = "value"
	CLS_OBJECT       Class = "object"
	CLS_MODULE       Class = "module"
	CLS_CERTIFICATE  Class = "certificate"
	CLS_NOTIFICATION Class = "notification"
)

func (Class) IsLegal

func (own Class) IsLegal() bool

func (Class) IsMatchCommand

func (own Class) IsMatchCommand(cmd Command) bool

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(host string) *Client

func (*Client) Close

func (own *Client) Close() error

func (*Client) Connect

func (own *Client) Connect() (err error)

func (*Client) Request

func (own *Client) Request(request Requester) (Responser, error)

func (*Client) WithCertificate

func (own *Client) WithCertificate(cert string) *Client

func (*Client) WithPort

func (own *Client) WithPort(port int) *Client

func (*Client) WithReadTimeout

func (own *Client) WithReadTimeout(timeout int) *Client

func (*Client) WithWriteTimeout

func (own *Client) WithWriteTimeout(timeout int) *Client

type Command

type Command string
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"
)

func (Command) IsLegal

func (own Command) IsLegal() bool

func (Command) IsMatchClass

func (own Command) IsMatchClass(cls Class) bool

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 Event

type Event string

********************************************************************************************

const (
	INFORM_EVENT_1  Event = "1 boot"
	INFORM_EVENT_2  Event = "2 periodic"
	INFORM_EVENT_3  Event = "3 scheduled"
	INFORM_EVENT_4  Event = "4 value_change"
	INFORM_EVENT_6  Event = "6 connection request"
	INFORM_EVENT_8  Event = "8 diagnostics complete"
	INFORM_EVENT_13 Event = "13 downLoad complete"
	INFORM_EVENT_14 Event = "14 upload complete"
	INFORM_EVENT_15 Event = "15 upgrade report"
)

type RequestAddObject

type RequestAddObject struct {
	Param    string
	Argument string
}

********************************************************************************************

func (*RequestAddObject) Generate

func (own *RequestAddObject) Generate() map[string]any

func (*RequestAddObject) GetClass

func (own *RequestAddObject) GetClass() Class

func (*RequestAddObject) GetCommand

func (own *RequestAddObject) GetCommand() Command

type RequestDeleteObject

type RequestDeleteObject struct {
	Param    string
	Argument string
}

********************************************************************************************

func (*RequestDeleteObject) Generate

func (own *RequestDeleteObject) Generate() map[string]any

func (*RequestDeleteObject) GetClass

func (own *RequestDeleteObject) GetClass() Class

func (*RequestDeleteObject) GetCommand

func (own *RequestDeleteObject) GetCommand() Command

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 RequestFactoryReboot

type RequestFactoryReboot struct {
	ResetAll bool
}

********************************************************************************************

func (*RequestFactoryReboot) Generate

func (own *RequestFactoryReboot) Generate() map[string]any

func (*RequestFactoryReboot) GetClass

func (own *RequestFactoryReboot) GetClass() Class

func (*RequestFactoryReboot) GetCommand

func (own *RequestFactoryReboot) GetCommand() Command

type RequestGetValue

type RequestGetValue struct {
	Prefix string
	Params []string
}

********************************************************************************************

func (*RequestGetValue) Generate

func (own *RequestGetValue) Generate() map[string]any

func (*RequestGetValue) GetClass

func (own *RequestGetValue) GetClass() Class

func (*RequestGetValue) GetCommand

func (own *RequestGetValue) GetCommand() Command

type RequestInformEvent

type RequestInformEvent struct {
	Event Event
}

********************************************************************************************

func (*RequestInformEvent) Generate

func (own *RequestInformEvent) Generate() map[string]any

func (*RequestInformEvent) GetClass

func (own *RequestInformEvent) GetClass() Class

func (*RequestInformEvent) GetCommand

func (own *RequestInformEvent) GetCommand() Command

type RequestReboot

type RequestReboot struct{}

func (*RequestReboot) Generate

func (own *RequestReboot) Generate() map[string]any

func (*RequestReboot) GetClass

func (own *RequestReboot) GetClass() Class

func (*RequestReboot) GetCommand

func (own *RequestReboot) GetCommand() Command

type RequestReloadSN

type RequestReloadSN struct{}

********************************************************************************************

func (*RequestReloadSN) Generate

func (own *RequestReloadSN) Generate() map[string]any

func (*RequestReloadSN) GetClass

func (own *RequestReloadSN) GetClass() Class

func (*RequestReloadSN) GetCommand

func (own *RequestReloadSN) GetCommand() Command

type RequestResetModule

type RequestResetModule struct {
	Module string
	Action ResetAction
}

********************************************************************************************

func (*RequestResetModule) Generate

func (own *RequestResetModule) Generate() map[string]any

func (*RequestResetModule) GetClass

func (own *RequestResetModule) GetClass() Class

func (*RequestResetModule) GetCommand

func (own *RequestResetModule) GetCommand() Command

type RequestSetCertificate

type RequestSetCertificate struct {
	Cert string
}

********************************************************************************************

func (*RequestSetCertificate) Generate

func (own *RequestSetCertificate) Generate() map[string]any

func (*RequestSetCertificate) GetClass

func (own *RequestSetCertificate) GetClass() Class

func (*RequestSetCertificate) GetCommand

func (own *RequestSetCertificate) GetCommand() Command

type RequestSetValue

type RequestSetValue struct {
	Prefix string
	Params map[string]string
}

********************************************************************************************

func (*RequestSetValue) Generate

func (own *RequestSetValue) Generate() map[string]any

func (*RequestSetValue) GetClass

func (own *RequestSetValue) GetClass() Class

func (*RequestSetValue) GetCommand

func (own *RequestSetValue) 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 Requester

type Requester interface {
	GetClass() Class
	GetCommand() Command
	Generate() map[string]any
}

type ResetAction

type ResetAction string

********************************************************************************************

const (
	RESET_ACT_REBOOT   ResetAction = "1" // reboot
	RESET_ACT_ACTIVE   ResetAction = "2" // active
	RESET_ACT_DEACTIVE ResetAction = "3" // deactive
)

type Response

type Response struct {
	// contains filtered or unexported fields
}

func NewResponse

func NewResponse(req Requester, resp []byte) (*Response, error)

func (*Response) GetValueParamteres

func (own *Response) GetValueParamteres() map[string]string

func (*Response) Query

func (own *Response) Query(key string) any

func (*Response) Response

func (own *Response) Response() map[string]any

func (*Response) String

func (own *Response) String() string

func (*Response) Validate

func (own *Response) Validate() error

type Responser

type Responser interface {
	Validate() error
	Query(key string) any

	GetValueParamteres() map[string]string
	Response() map[string]any
	String() string
}

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"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL