#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@文件    :globalvar.py
@时间    :2022/01/22 10:11:23
@作者    :None
@版本    :1.0
@说明    :全局变量
'''

from utils.can import MessageDeal
from utils.com import ComMaster


class SD:
    # 一二级BMS Can开关，Can开关开启后开始接收数据
    CAN_ON_OFF = False

    # 加载CAN连接驱动
    CAN_CONTROL = MessageDeal()

    # 加载串口连接驱动
    COM_CONTROL = ComMaster()

    EMV_ID = 1

    HIGH_DPI = 0


class EmvState:
    def __init__(self):
        self.__emv_total = 0
        self.__emv_1 = 0
        self.__emv_2 = 0
        self.__emv_3 = 0
        self.__emv_4 = 0
        self.__emv_5 = 0
        self.__emv_6 = 0
        self.__emv_7 = 0
        self.__emv_8 = 0
        self.__emv_9 = 0

    @property
    def emv_total_state(self):
        return self.__emv_total

    @emv_total_state.setter
    def emv_total_state(self, value):
        self.__emv_total = value

    @property
    def emv_1_state(self):
        return self.__emv_1

    @emv_1_state.setter
    def emv_1_state(self, value):
        if isinstance(value, int):
            self.__emv_1 = value
        else:
            raise ValueError("'int' type need")

    @property
    def emv_2_state(self):
        return self.__emv_2

    @emv_2_state.setter
    def emv_2_state(self, value):
        if isinstance(value, int):
            self.__emv_2 = value
        else:
            raise ValueError("'int' type need")

    @property
    def emv_3_state(self):
        return self.__emv_3

    @emv_3_state.setter
    def emv_3_state(self, value):
        if isinstance(value, int):
            self.__emv_3 = value
        else:
            raise ValueError("'int' type need")

    @property
    def emv_4_state(self):
        return self.__emv_4

    @emv_4_state.setter
    def emv_4_state(self, value):
        if isinstance(value, int):
            self.__emv_4 = value
        else:
            raise ValueError("'int' type need")

    @property
    def emv_5_state(self):
        return self.__emv_5

    @emv_5_state.setter
    def emv_5_state(self, value):
        if isinstance(value, int):
            self.__emv_5 = value
        else:
            raise ValueError("'int' type need")

    @ property
    def emv_6_state(self):
        return self.__emv_6

    @emv_6_state.setter
    def emv_6_state(self, value):
        if isinstance(value, int):
            self.__emv_6 = value
        else:
            raise ValueError("'int' type need")

    @ property
    def emv_7_state(self):
        return self.__emv_7

    @emv_7_state.setter
    def emv_7_state(self, value):
        if isinstance(value, int):
            self.__emv_7 = value
        else:
            raise ValueError("'int' type need")

    @ property
    def emv_8_state(self):
        return self.__emv_8

    @emv_8_state.setter
    def emv_8_state(self, value):
        if isinstance(value, int):
            self.__emv_8 = value
        else:
            raise ValueError("'int' type need")

    @ property
    def emv_9_state(self):
        return self.__emv_9

    @emv_9_state.setter
    def emv_9_state(self, value):
        if isinstance(value, int):
            self.__emv_9 = value
        else:
            raise ValueError("'int' type need")
