38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
|
# coding: gb2312
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD>Һ<EFBFBD>
|
|||
|
from DeviceDefine.consensus import UNKNOWN
|
|||
|
from PureBackend.base_driver import MODEL_MEDIAPIPE
|
|||
|
from PureBackend.standard_manager import StandardManager
|
|||
|
|
|||
|
|
|||
|
MAX_HR = "max_hr"
|
|||
|
MIN_BO = "min_bo"
|
|||
|
HR = "hr"
|
|||
|
BO = "bo"
|
|||
|
|
|||
|
|
|||
|
class HealthyBackend(StandardManager):
|
|||
|
|
|||
|
def __init__(self, master_mode=True, positioning=True, camera=True, model=MODEL_MEDIAPIPE, speaker=True,
|
|||
|
multi_positioning_mode=True, device_type=UNKNOWN, pure_mode=False):
|
|||
|
super().__init__(master_mode, positioning, camera, model, speaker, multi_positioning_mode, device_type, pure_mode)
|
|||
|
|
|||
|
# <20>ֻ<EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD>
|
|||
|
self.hr_bo_record = {MAX_HR: 0, MIN_BO: 100, HR: 0, BO: 100}
|
|||
|
|
|||
|
def reset_hr_bo_record(self):
|
|||
|
self.hr_bo_record = {MAX_HR: 0, MIN_BO: 100, HR: 0, BO: 100}
|
|||
|
|
|||
|
def update_hr_bo_record(self, tag_mes):
|
|||
|
if tag_mes[HR] != 0:
|
|||
|
self.hr_bo_record[HR] = tag_mes[HR]
|
|||
|
if self.hr_bo_record[MAX_HR] < tag_mes[HR]:
|
|||
|
self.hr_bo_record[MAX_HR] = tag_mes[HR]
|
|||
|
if tag_mes[BO] != 0:
|
|||
|
self.hr_bo_record[BO] = tag_mes[BO]
|
|||
|
if self.hr_bo_record[MIN_BO] > tag_mes[BO]:
|
|||
|
self.hr_bo_record[MIN_BO] = tag_mes[BO]
|
|||
|
|
|||
|
def return_hr_bo_record(self):
|
|||
|
return self.hr_bo_record
|