Files
opencaser/main.py
2026-01-18 19:32:43 +09:00

36 lines
1.1 KiB
Python

import lib.OCer as OCer
import logging
import configparser
import serial
import socket
if __name__ == "__main__":
#consts&confs
config = configparser.ConfigParser()
#bc_calculator = lomka.BCCCalculator()
some_open_ports = serial.tools.list_ports.comports()
#load config file
config.read('config.ini')
# device_hwid = config['DEFAULT']['device_hwid']
# baudrate = config['DEFAULT']['baudrate']
#log section
logging.basicConfig(
level=logging.INFO if config['DEFAULT']['debug'] == "false" else logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[
logging.FileHandler('lastest.log'),
logging.StreamHandler()])
logger = logging.getLogger(socket.gethostname())
zxc = OCer.caser(device_hwid="PID=1A86:7523", baudrate=9600,
config=config, logger=logger)
zxc.set_controller_number(1)
zxc.set_port_device()
zxc.set_controller_capacity(18)
# добавь *aargs
zxc.READ_ALL_LOCKS()
# print(zxc.read_controller(1))
# print(zxc.send_command(1, 17))
# print(zxc.read_controller(1))