mirror of
https://github.com/gowvp/gb28181.git
synced 2026-04-22 23:17:19 +08:00
59 lines
1.4 KiB
Go
Executable File
59 lines
1.4 KiB
Go
Executable File
// Code generated by godddx, DO AVOID EDIT.
|
|
package ipc
|
|
|
|
import (
|
|
"database/sql/driver"
|
|
"encoding/json"
|
|
|
|
"github.com/gowvp/owl/internal/core/bz"
|
|
"github.com/ixugo/goddd/pkg/orm"
|
|
)
|
|
|
|
const (
|
|
TypeGB28181 = "GB28181"
|
|
TypeOnvif = "ONVIF"
|
|
TypeRTSP = "RTSP"
|
|
TypeRTMP = "RTMP"
|
|
)
|
|
|
|
func GetType(stream string) string {
|
|
switch true {
|
|
case bz.IsGB28181(stream):
|
|
return TypeGB28181
|
|
case bz.IsOnvif(stream):
|
|
return TypeOnvif
|
|
case bz.IsRTSP(stream):
|
|
return TypeRTSP
|
|
case bz.IsRTMP(stream):
|
|
return TypeRTMP
|
|
default:
|
|
return ""
|
|
}
|
|
}
|
|
|
|
// DeviceExt domain model
|
|
type DeviceExt struct {
|
|
Manufacturer string `json:"manufacturer"` // 生产厂商
|
|
Model string `json:"model"` // 型号
|
|
Firmware string `json:"firmware"` // 固件版本
|
|
Name string `json:"name"` // 设备名
|
|
GBVersion string `json:"gb_version"` // GB版本
|
|
Zones []Zone `json:"zones"` // 区域
|
|
}
|
|
|
|
// Scan implements orm.Scaner.
|
|
func (i *DeviceExt) Scan(input any) error {
|
|
return orm.JSONUnmarshal(input, i)
|
|
}
|
|
|
|
func (i DeviceExt) Value() (driver.Value, error) {
|
|
return json.Marshal(i)
|
|
}
|
|
|
|
type Zone struct {
|
|
Name string `json:"name"` // 区域名称
|
|
Coordinates []float32 `json:"coordinates"` // 坐标
|
|
Color string `json:"color"` // 颜色,支持 hex 颜色值,如 #FF0000
|
|
Labels []string `json:"labels"` // 标签
|
|
}
|