Documentation
¶
Overview ¶
Code generated by godddx, DO AVOID EDIT.
Code generated by godddx, DO AVOID EDIT.
Code generated by godddx, DO AVOID EDIT.
Code generated by godddx, DO AVOID EDIT.
Code generated by godddx, DO AVOID EDIT.
Code generated by godddx, DO AVOID EDIT.
Index ¶
- Variables
- func NewEventCore(db *gorm.DB, conf *conf.Bootstrap) event.Core
- func NewGBAdapter(store ipc.Storer, uni uniqueid.Core) ipc.Adapter
- func NewHTTPHandler(uc *Usecase) http.Handler
- func NewIPCCore(store ipc.Storer, uni uniqueid.Core, protocols map[string]ipc.Protocoler) ipc.Core
- func NewIPCStore(db *gorm.DB) ipc.Storer
- func NewProtocols(adapter ipc.Adapter, sms sms.Core, ipcCore ipc.Core, gbs *gbs.Server) map[string]ipc.Protocoler
- func NewProxyCore(db *gorm.DB, uni uniqueid.Core) *proxy.Core
- func NewSMSCore(db *gorm.DB, cfg *conf.Bootstrap) sms.Core
- func NewUniqueID(db *gorm.DB) uniqueid.Core
- func RegisterEvent(g gin.IRouter, api EventAPI, handler ...gin.HandlerFunc)
- func RegisterUser(r gin.IRouter, api UserAPI, mid ...gin.HandlerFunc)
- type AIBoundingBox
- type AIDetection
- type AIDetectionInput
- type AIGlobalStats
- type AIKeepaliveInput
- type AINormBox
- type AIStartedInput
- type AIStoppedInput
- type AIWebhookAPI
- type AIWebhookOutput
- type ConfigAPI
- type Data
- type DefaultOutput
- type EventAPI
- type IOWriter
- type IPCAPI
- type KV
- type OriginSock
- type ProxyAPI
- type PushAPI
- type Secret
- type SmsAPI
- type Tracks
- type Usecase
- type UserAPI
- type WebHookAPI
Constants ¶
This section is empty.
Variables ¶
var ( ErrAIGlobalDisabled = reason.NewError("ErrAIGlobalDisabled", "AI 功能已在全局配置中禁用") ErrAIServiceNotReady = reason.NewError("ErrAIServiceNotReady", "AI 服务未初始化或连接失败") ErrChannelNotSupported = reason.NewError("ErrChannelNotSupported", "不支持的通道类型") )
var ( ProviderVersionSet = wire.NewSet(versionapi.NewVersionCore) ProviderSet = wire.NewSet( wire.Struct(new(Usecase), "*"), NewHTTPHandler, versionapi.New, NewSMSCore, NewSmsAPI, NewWebHookAPI, NewUniqueID, gbs.NewServer, NewIPCStore, NewProtocols, NewIPCCore, NewIPCAPI, NewGBAdapter, NewConfigAPI, NewUserAPI, NewAIWebhookAPIWithDeps, NewEventCore, NewEventAPI, ) )
var ErrDevice = reason.NewError("ErrDevice", "设备错误")
Functions ¶
func NewIPCCore ¶
func NewProtocols ¶
func NewProtocols(adapter ipc.Adapter, sms sms.Core, ipcCore ipc.Core, gbs *gbs.Server) map[string]ipc.Protocoler
NewProtocols 创建协议适配器映射
func RegisterEvent ¶
func RegisterEvent(g gin.IRouter, api EventAPI, handler ...gin.HandlerFunc)
func RegisterUser ¶
func RegisterUser(r gin.IRouter, api UserAPI, mid ...gin.HandlerFunc)
Types ¶
type AIBoundingBox ¶
type AIBoundingBox struct {
XMin int `json:"x_min"`
YMin int `json:"y_min"`
XMax int `json:"x_max"`
YMax int `json:"y_max"`
}
AIBoundingBox 像素坐标边界框
type AIDetection ¶
type AIDetection struct {
Label string `json:"label"` // 物体类别
Confidence float64 `json:"confidence"` // 置信度 (0.0 - 1.0)
Box AIBoundingBox `json:"box"` // 像素坐标边界框
Area int `json:"area"` // 边界框像素面积
NormBox *AINormBox `json:"norm_box"` // 归一化边界框
}
AIDetection 检测对象
type AIDetectionInput ¶
type AIDetectionInput struct {
CameraID string `json:"camera_id"` // 摄像头 ID
Timestamp orm.Time `json:"timestamp"` // Unix 时间戳 (毫秒)
Detections []AIDetection `json:"detections"` // 检测结果列表
Snapshot string `json:"snapshot"` // Base64 编码的快照 (JPEG)
SnapshotWidth int `json:"snapshot_width"` // 快照宽度
SnapshotHeight int `json:"snapshot_height"` // 快照高度
}
AIDetectionInput 检测事件回调请求体
type AIGlobalStats ¶
type AIGlobalStats struct {
ActiveStreams int `json:"active_streams"` // 活跃流数量
TotalDetections int64 `json:"total_detections"` // 总检测次数
UptimeSeconds int64 `json:"uptime_seconds"` // 运行时间 (秒)
}
AIGlobalStats 全局统计信息
type AIKeepaliveInput ¶
type AIKeepaliveInput struct {
Timestamp int64 `json:"timestamp"` // Unix 时间戳 (毫秒)
Stats *AIGlobalStats `json:"stats"` // 全局统计信息
Message string `json:"message"` // 附加消息
}
AIKeepaliveInput 心跳回调请求体
type AINormBox ¶
type AINormBox struct {
X float64 `json:"x"` // 中心点 X 坐标
Y float64 `json:"y"` // 中心点 Y 坐标
W float64 `json:"w"` // 宽度
H float64 `json:"h"` // 高度
}
AINormBox 归一化边界框
type AIStartedInput ¶
type AIStartedInput struct {
Timestamp int64 `json:"timestamp"` // Unix 时间戳 (毫秒)
Message string `json:"message"` // 启动消息
}
AIStartedInput 服务启动回调请求体
type AIStoppedInput ¶
type AIStoppedInput struct {
CameraID string `json:"camera_id"` // 摄像头 ID
Timestamp orm.Time `json:"timestamp"` // Unix 时间戳 (毫秒)
Reason string `json:"reason"` // 停止原因 (user_requested, error)
Message string `json:"message"` // 详细信息
}
AIStoppedInput 任务停止回调请求体
type AIWebhookAPI ¶
type AIWebhookAPI struct {
// contains filtered or unexported fields
}
AIWebhookAPI 处理 AI 分析服务的回调请求
func NewAIWebhookAPI ¶
NewAIWebhookAPI 创建 AI Webhook API 实例
func NewAIWebhookAPIWithDeps ¶
func NewAIWebhookAPIWithDeps(conf *conf.Bootstrap, eventCore event.Core, ipcCore ipc.Core) AIWebhookAPI
NewAIWebhookAPIWithDeps 创建带依赖的 AI Webhook API
func (*AIWebhookAPI) StartAIDetection ¶
func (a *AIWebhookAPI) StartAIDetection(ctx context.Context, ch *ipc.Channel, rtspURL string) (*protos.StartCameraResponse, error)
StartAIDetection 启动 AI 检测任务,供外部调用(如 ipc.go 中的 enableAI)
func (*AIWebhookAPI) StartAISyncLoop ¶
func (a *AIWebhookAPI) StartAISyncLoop(ctx context.Context, smsCore sms.Core)
StartAISyncLoop 启动 AI 任务同步协程,每 5 分钟检测一次数据库中 enabled_ai 状态与内存 aiTasks 的差异并同步
func (*AIWebhookAPI) StopAIDetection ¶
func (a *AIWebhookAPI) StopAIDetection(ctx context.Context, channelID string) error
StopAIDetection 停止 AI 检测任务,供外部调用(如 ipc.go 中的 disableAI)
type AIWebhookOutput ¶
AIWebhookOutput 通用响应体
type Data ¶
type Data struct {
Buffer int `json:"Buffer"`
BufferLikeString int `json:"BufferLikeString"`
BufferList int `json:"BufferList"`
BufferRaw int `json:"BufferRaw"`
Frame int `json:"Frame"`
FrameImp int `json:"FrameImp"`
MediaSource int `json:"MediaSource"`
MultiMediaSourceMuxer int `json:"MultiMediaSourceMuxer"`
RtmpPacket int `json:"RtmpPacket"`
RtpPacket int `json:"RtpPacket"`
Socket int `json:"Socket"`
TCPClient int `json:"TcpClient"`
TCPServer int `json:"TcpServer"`
TCPSession int `json:"TcpSession"`
UDPServer int `json:"UdpServer"`
UDPSession int `json:"UdpSession"`
}
type DefaultOutput ¶
type EventAPI ¶
type EventAPI struct {
// contains filtered or unexported fields
}
EventAPI 为 http 提供业务方法
type IPCAPI ¶
type IPCAPI struct {
// contains filtered or unexported fields
}
func (IPCAPI) FindChannelsForDevice ¶
type OriginSock ¶
type ProxyAPI ¶
type ProxyAPI struct {
// contains filtered or unexported fields
}
func NewProxyAPI ¶
type Secret ¶
type Secret struct {
// contains filtered or unexported fields
}
func (*Secret) GetOrCreatePublicKey ¶
TODO: 有概率存在过期导致登录解密识别
type Tracks ¶
type Tracks struct {
Channels int `json:"channels,omitempty"`
CodecID int `json:"codec_id"`
CodecIDName string `json:"codec_id_name"`
CodecType int `json:"codec_type"`
Ready bool `json:"ready"`
SampleBit int `json:"sample_bit,omitempty"`
SampleRate int `json:"sample_rate,omitempty"`
Fps float32 `json:"fps,omitempty"`
Height int `json:"height,omitempty"`
Width int `json:"width,omitempty"`
}
type WebHookAPI ¶
type WebHookAPI struct {
// contains filtered or unexported fields
}