- 移除 Core 目录下的 CallBack.go、core.go 和 Type.go 文件 - 这些文件包含了未使用的类型定义和函数实现 - 删除冗余代码有助于简化项目结构,提高代码可读性和维护性
31 lines
640 B
Go
31 lines
640 B
Go
package HikSDK
|
|
|
|
import "C"
|
|
import (
|
|
"strconv"
|
|
)
|
|
|
|
// 构造HcnetError
|
|
func NewHcnetError(Code int, Msg string, FuncName string) *HcnetError {
|
|
return &HcnetError{Code: Code, Msg: Msg, FuncName: FuncName}
|
|
}
|
|
|
|
// 海康网络sdk自定义错误
|
|
type HcnetError struct {
|
|
Code int `json:"Code"` // 错误码
|
|
Msg string `json:"Msg"` // 错误码描述
|
|
FuncName string `json:"FuncName"`
|
|
}
|
|
|
|
func (p *HcnetError) Error() string {
|
|
return strconv.FormatInt(int64(p.Code), 10) + "," + p.Msg
|
|
}
|
|
|
|
func (p *HcnetError) IsPasswordError() bool {
|
|
return p.Code == 1
|
|
}
|
|
|
|
func (p *HcnetError) IsDeviceOfflineError() bool {
|
|
return p.Code == 7
|
|
}
|