airobot/lib/base.go
2022-12-16 11:09:19 +08:00

89 lines
1.9 KiB
Go

package lib
import (
"time"
)
type LoginParam struct {
Account string `json:"account"`
ServerId string `json:"serverId"`
TimeStamp int64 `json:"timestamp"`
}
type RawReq struct {
ID int64
Req []byte
}
type RawResp struct {
ID int64
Resp []byte
Err error
Elapse time.Duration
}
type SceneInfo struct {
Name string
Desc string
}
type CallResult struct {
ID int64 // ID
SceneName string
MainType string
SubType string
Code int32
Elapse time.Duration // 耗时
Num int
}
type Statistics struct {
ElapseTotal time.Duration //总耗时
MaxElapse time.Duration //最大耗时
MinElapse time.Duration //最小耗时
AvgElapse time.Duration //平均耗时
CallCount int64 //调用次数
Route string //协议名称
SceneName string //场景名称
TimeoutCount int32 //超时次数
}
const (
//默认的机器人数量
DefaultRobotNum int = 10
)
// RetCode 表示结果代码的类型。
type RetCode int
const (
RET_CODE_SUCCESS RetCode = 0 // 成功。
RET_CODE_WARNING_CALL_TIMEOUT = 1001 // 调用超时警告。
RET_CODE_ERROR_CALL = 2001 // 调用错误。
RET_CODE_ERROR_RESPONSE = 2002 // 响应内容错误。
RET_CODE_ERROR_CALEE = 2003 // 被调用方(被测软件)的内部错误。
RET_CODE_FATAL_CALL = 3001 // 调用过程中发生了致命错误!
)
//机器人状态
const (
// STATUS_ORIGINAL 代表原始。
STATUS_ORIGINAL uint32 = 0
// STATUS_STARTING 代表正在启动。
STATUS_STARTING uint32 = 1
// STATUS_STARTED 代表已启动。
STATUS_STARTED uint32 = 2
// STATUS_STOPPING 代表正在停止。
STATUS_STOPPING uint32 = 3
// STATUS_STOPPED 代表已停止。
STATUS_STOPPED uint32 = 4
)
// 场景状态
const (
// 启用
STATUS_ENABLE uint32 = 1
// 禁用
STATUS_DISENABLE uint32 = 0
)