2020-05-06 16:29:59 +00:00
|
|
|
"""ONVIF models."""
|
|
|
|
from dataclasses import dataclass
|
2020-05-11 17:12:12 +00:00
|
|
|
from typing import Any, List
|
2020-05-06 16:29:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class DeviceInfo:
|
|
|
|
"""Represent device information."""
|
|
|
|
|
|
|
|
manufacturer: str = None
|
|
|
|
model: str = None
|
|
|
|
fw_version: str = None
|
2020-05-24 19:50:50 +00:00
|
|
|
serial_number: str = None
|
2020-05-06 16:29:59 +00:00
|
|
|
mac: str = None
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class Resolution:
|
|
|
|
"""Represent video resolution."""
|
|
|
|
|
|
|
|
width: int
|
|
|
|
height: int
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class Video:
|
|
|
|
"""Represent video encoding settings."""
|
|
|
|
|
|
|
|
encoding: str
|
|
|
|
resolution: Resolution
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class PTZ:
|
|
|
|
"""Represents PTZ configuration on a profile."""
|
|
|
|
|
|
|
|
continuous: bool
|
|
|
|
relative: bool
|
|
|
|
absolute: bool
|
|
|
|
presets: List[str] = None
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class Profile:
|
|
|
|
"""Represent a ONVIF Profile."""
|
|
|
|
|
|
|
|
index: int
|
|
|
|
token: str
|
|
|
|
name: str
|
|
|
|
video: Video
|
|
|
|
ptz: PTZ = None
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class Capabilities:
|
|
|
|
"""Represents Service capabilities."""
|
|
|
|
|
|
|
|
snapshot: bool = False
|
2020-05-11 17:12:12 +00:00
|
|
|
events: bool = False
|
2020-05-06 16:29:59 +00:00
|
|
|
ptz: bool = False
|
2020-05-11 17:12:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class Event:
|
|
|
|
"""Represents a ONVIF event."""
|
|
|
|
|
|
|
|
uid: str
|
|
|
|
name: str
|
|
|
|
platform: str
|
|
|
|
device_class: str = None
|
|
|
|
unit_of_measurement: str = None
|
|
|
|
value: Any = None
|
|
|
|
entity_enabled: bool = True
|