mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-01-29 06:10:52 +00:00
26 lines
709 B
Python
26 lines
709 B
Python
from ..Capabilites import Capabilites
|
|
from ..enums import enums
|
|
from typing import Literal
|
|
|
|
class EarDetectionNotification:
|
|
NOTIFICATION_BIT = Capabilites.EAR_DETECTION
|
|
NOTIFICATION_PREFIX = enums.SEND_PREFIX + NOTIFICATION_BIT
|
|
IN_EAR = 0x00
|
|
OUT_OF_EAR = 0x01
|
|
def __init__(self):
|
|
pass
|
|
|
|
def isEarDetectionData(self, data: bytes):
|
|
if len(data) != 8:
|
|
return False
|
|
if data.hex().startswith(self.NOTIFICATION_PREFIX.hex()):
|
|
return True
|
|
|
|
def setEarDetection(self, data: bytes):
|
|
self.first = data[6]
|
|
self.second = data[7]
|
|
|
|
def getEarDetection(self):
|
|
return [self.first, self.second]
|
|
pass
|
|
|