33 lines
1.8 KiB
Python
Raw Normal View History

2025-08-02 12:38:52 +08:00
from sqlalchemy import Column, String, Text, Boolean, Integer, Float, DateTime
from .base import BaseModel
class Device(BaseModel):
__tablename__ = "devices"
name = Column(String(100), nullable=False, comment="设备名称")
device_type = Column(String(50), nullable=False, comment="设备类型: camera, sensor, etc")
location = Column(String(200), comment="设备位置")
ip_address = Column(String(50), comment="IP地址")
port = Column(Integer, comment="端口号")
username = Column(String(50), comment="用户名")
password = Column(String(100), comment="密码")
rtsp_url = Column(String(500), comment="RTSP流地址")
status = Column(String(20), default="offline", comment="设备状态: online, offline, error")
resolution = Column(String(20), comment="分辨率,如: 1920x1080")
fps = Column(Integer, comment="帧率")
algorithm_id = Column(Integer, comment="关联的算法ID")
is_enabled = Column(Boolean, default=True, comment="是否启用")
last_heartbeat = Column(DateTime, comment="最后心跳时间")
latitude = Column(Float, comment="纬度")
longitude = Column(Float, comment="经度")
description = Column(Text, comment="设备描述")
manufacturer = Column(String(100), comment="制造商")
model = Column(String(100), comment="设备型号")
2025-08-06 14:45:07 +08:00
serial_number = Column(String(100), comment="序列号")
# 新增字段:视频处理相关
demo_video_path = Column(String(500), comment="演示视频路径")
processed_video_path = Column(String(500), comment="处理结果视频路径")
processing_status = Column(String(20), default="idle", comment="处理状态: idle, processing, completed, failed")
processing_result = Column(Text, comment="处理结果JSON格式")
last_processed_at = Column(DateTime, comment="最后处理时间")