-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautopilot_keeper.py
More file actions
47 lines (41 loc) · 2.56 KB
/
Copy pathautopilot_keeper.py
File metadata and controls
47 lines (41 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
══════════════════════════════════════════════════════════════════
TJN NEXUS CORE — AUTO-PILOT KEEP-ALIVE & SCREEN LOCK MODULE
OFFICIAL SYSTEM CODE · AUTHORIZED BY MASTER SONIC
Version: v58.0.3_SONIC_FINAL · TRL-10 STANDARDS
══════════════════════════════════════════════════════════════════
"""
import time
import ctypes
import logging
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
def prevent_sleep_and_keep_screen_on():
"""
ฟังก์ชันป้องกันระบบ Sleep / Suspend และบังคับให้หน้าจอเปิดสแตนด์บาย
รองรับการทำงานระบบ Auto Pilot 7 ตัว 21 ฟังก์ชันแบบ 24 ชั่วโมง
"""
logging.info("[AI-05: Auto Pilot] Initializing Keep-Alive & Display Lock Protocol...")
# สำหรับระบบปฏิบัติการ Windows (ถ้าใช้งานบน Windows)
try:
# ES_CONTINUOUS = 0x80000000
# ES_SYSTEM_REQUIRED = 0x00000001
# ES_DISPLAY_REQUIRED = 0x00000002 (บังคับให้จอไม่ดับ)
ctypes.windll.kernel32.SetThreadExecutionState(0x80000000 | 0x00000001 | 0x00000002)
logging.info("[AI-02 & AI-05] Windows Power State locked: Display & System will NOT sleep.")
except Exception:
logging.info("[AI-02 & AI-05] Non-Windows environment detected. Applying Linux/Codespaces keep-alive loop.")
# ลูปทำงานรักษาสถานะระบบ (Heartbeat Loop)
counter = 1
while True:
logging.info(f"[Auto Pilot Heartbeat #{counter}] All 7 AI Units & 21 Functions are fully engaged. Remote Mobile Bridge active.")
time.sleep(300) # ส่งสัญญาณทุกๆ 5 นาทีเพื่อป้องกันการตัดการเชื่อมต่อ
counter += 1
if __name__ == "__main__":
print("="*70)
print("🚀 TJN NEXUS CORE — AUTO-PILOT SCREEN LOCK ACTIVATED")
print("Commander: MASTER SONIC / MASTER 01")
print("Status: Notebook display and session are locked ON. Safe to leave.")
print("="*70)
prevent_sleep_and_keep_screen_on()