Initial commit: Dabit Time Manager project
Python-based time management application with UDP discovery, TCP protocol communication, time sync, and drift monitoring. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
0
models/__init__.py
Normal file
0
models/__init__.py
Normal file
33
models/controller.py
Normal file
33
models/controller.py
Normal file
@@ -0,0 +1,33 @@
|
||||
"""Controller 데이터클래스"""
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
|
||||
@dataclass
|
||||
class Controller:
|
||||
"""컨트롤러 네트워크 정보"""
|
||||
mac: str = ""
|
||||
ip: str = ""
|
||||
port: int = 5000
|
||||
name: str = ""
|
||||
subnet: str = "255.255.255.0"
|
||||
gateway: str = "192.168.0.1"
|
||||
dhcp_mode: int = 0 # 0: Static, 1: DHCP
|
||||
server_ip: str = "0.0.0.0"
|
||||
server_port: int = 0
|
||||
server_mode: int = 0 # 0: Client, 1: Server
|
||||
keep_alive: int = 0
|
||||
dns_name: str = ""
|
||||
ap_ssid_name: str = ""
|
||||
ap_ssid_pw: str = ""
|
||||
ap_mode: int = 0 # 0: Station, 1: AP
|
||||
|
||||
# 시간 동기화/읽기용 상태 (GUI에서 사용)
|
||||
selected: bool = field(default=True, repr=False)
|
||||
|
||||
@property
|
||||
def display_label(self) -> str:
|
||||
"""GUI 표시용 라벨: 이름(IP:포트)"""
|
||||
if self.name:
|
||||
return f"{self.name}({self.ip}:{self.port})"
|
||||
return f"{self.ip}:{self.port}"
|
||||
20
models/reading.py
Normal file
20
models/reading.py
Normal file
@@ -0,0 +1,20 @@
|
||||
"""TimeReading 데이터클래스"""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
@dataclass
|
||||
class TimeReading:
|
||||
"""시간 읽기 결과"""
|
||||
controller_mac: str
|
||||
controller_label: str
|
||||
pc_time: datetime
|
||||
controller_time: datetime
|
||||
drift_seconds: float
|
||||
|
||||
@property
|
||||
def drift_display(self) -> str:
|
||||
"""오차 표시용 문자열"""
|
||||
sign = "+" if self.drift_seconds >= 0 else ""
|
||||
return f"{sign}{self.drift_seconds:.1f}초"
|
||||
Reference in New Issue
Block a user