mirror of
https://github.com/bckelley/tconnectsync.git
synced 2026-08-24 03:34:12 -05:00
Update events.json blob
This commit is contained in:
+1061
-179
File diff suppressed because it is too large
Load Diff
@@ -5131,6 +5131,282 @@ class LidCgmAlertClearedFsl2(BaseEvent):
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class LidCgmJoinSessionFsl3(BaseEvent):
|
||||
"""477: LID_CGM_JOIN_SESSION_FSL3"""
|
||||
ID = 477
|
||||
NAME = "LID_CGM_JOIN_SESSION_FSL3"
|
||||
|
||||
raw: RawEvent
|
||||
sessionstarttime: int # Seconds
|
||||
sessionjointime: int # Seconds
|
||||
sessionduration: int # Days
|
||||
sessionjoinreason: int
|
||||
|
||||
|
||||
@staticmethod
|
||||
def build(raw):
|
||||
sessionstarttime, = struct.unpack_from(UINT32, raw[:EVENT_LEN], 10)
|
||||
sessionjointime, = struct.unpack_from(UINT32, raw[:EVENT_LEN], 14)
|
||||
sessionduration, = struct.unpack_from(UINT8, raw[:EVENT_LEN], 18)
|
||||
sessionjoinreason, = struct.unpack_from(UINT8, raw[:EVENT_LEN], 19)
|
||||
|
||||
return LidCgmJoinSessionFsl3(
|
||||
raw = RawEvent.build(raw),
|
||||
sessionstarttime = sessionstarttime,
|
||||
sessionjointime = sessionjointime,
|
||||
sessionduration = sessionduration,
|
||||
sessionjoinreason = sessionjoinreason,
|
||||
)
|
||||
|
||||
@property
|
||||
def eventTimestamp(self):
|
||||
return self.raw.timestamp
|
||||
|
||||
@property
|
||||
def seqNum(self):
|
||||
return self.raw.seqNum
|
||||
|
||||
@property
|
||||
def eventId(self):
|
||||
return self.ID
|
||||
|
||||
def todict(self):
|
||||
return dict(
|
||||
id=self.ID,
|
||||
name=self.NAME,
|
||||
seqNum=self.seqNum,
|
||||
eventTimestamp=str(self.eventTimestamp),
|
||||
sessionstarttime=self.sessionstarttime,
|
||||
sessionjointime=self.sessionjointime,
|
||||
sessionduration=self.sessionduration,
|
||||
sessionjoinreason=self.sessionjoinreason,
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class LidCgmDataFsl3(BaseEvent):
|
||||
"""480: LID_CGM_DATA_FSL3"""
|
||||
ID = 480
|
||||
NAME = "LID_CGM_DATA_FSL3"
|
||||
|
||||
raw: RawEvent
|
||||
glucosevaluestatusRaw: int
|
||||
cgmDataTypeRaw: int
|
||||
rateRaw: int # mg/dL/min
|
||||
algorithmstateRaw: int
|
||||
RSSI: int # dBm
|
||||
currentglucosedisplayvalue: int # mg/dL
|
||||
egvTimestamp: int # Seconds
|
||||
egvInfoBitmaskRaw: int
|
||||
interval: int
|
||||
|
||||
GlucosevaluestatusMap = {
|
||||
"0": "Precise Value",
|
||||
"1": "Special High",
|
||||
"2": "Special Low"
|
||||
}
|
||||
|
||||
class GlucosevaluestatusEnum(Enum):
|
||||
PreciseValue = 0
|
||||
SpecialHigh = 1
|
||||
SpecialLow = 2
|
||||
|
||||
@property
|
||||
def glucosevaluestatus(self):
|
||||
try:
|
||||
return self.GlucosevaluestatusEnum(self.glucosevaluestatusRaw)
|
||||
except ValueError as e:
|
||||
logger.error("Invalid glucosevaluestatusRaw in Glucosevaluestatus for "+str(self))
|
||||
logger.error(e)
|
||||
return None
|
||||
|
||||
CgmdatatypeMap = {
|
||||
"0": "Five Minute Reading (FMR)",
|
||||
"1": "Backfill",
|
||||
"4": "None",
|
||||
"5": "One Minute Reading (OMR)"
|
||||
}
|
||||
|
||||
class CgmdatatypeBitmask(IntFlag):
|
||||
FiveMinuteReadingFmr = 2**0
|
||||
Backfill = 2**1
|
||||
NoneVal = 2**4
|
||||
OneMinuteReadingOmr = 2**5
|
||||
|
||||
@property
|
||||
def cgmDataType(self):
|
||||
try:
|
||||
return self.CgmdatatypeBitmask(self.cgmDataTypeRaw)
|
||||
except ValueError as e:
|
||||
logger.error("Invalid cgmDataTypeRaw in CgmdatatypeBitmask for "+str(self))
|
||||
logger.error(e)
|
||||
return None
|
||||
|
||||
@property
|
||||
def rate(self):
|
||||
return self.rateRaw * 0.1
|
||||
|
||||
AlgorithmstateMap = {
|
||||
"100": "OK State"
|
||||
}
|
||||
|
||||
class AlgorithmstateEnum(Enum):
|
||||
OkState = 100
|
||||
|
||||
@property
|
||||
def algorithmstate(self):
|
||||
try:
|
||||
return self.AlgorithmstateEnum(self.algorithmstateRaw)
|
||||
except ValueError as e:
|
||||
logger.error("Invalid algorithmstateRaw in Algorithmstate for "+str(self))
|
||||
logger.error(e)
|
||||
return None
|
||||
|
||||
EgvinfobitmaskMap = {
|
||||
"0": "Five Minute Reading (FMR)",
|
||||
"1": "Backfill",
|
||||
"4": "NO_EGV message",
|
||||
"5": "Valid timestamp",
|
||||
"6": "Valid EGV (valid range)",
|
||||
"7": "Valid algState (algState is 100)",
|
||||
"8": "EGV was successfully added to CGM subsystem array (e.g., not a duplicate)",
|
||||
"9": "OMR reading type",
|
||||
"11": "Sensor Type (see CGMTxType enum)",
|
||||
"12": "Sensor Type (see CGMTxType enum)",
|
||||
"13": "Sensor Type (see CGMTxType enum)"
|
||||
}
|
||||
|
||||
class EgvinfobitmaskBitmask(IntFlag):
|
||||
FiveMinuteReadingFmr = 2**0
|
||||
Backfill = 2**1
|
||||
NoEgvMessage = 2**4
|
||||
ValidTimestamp = 2**5
|
||||
ValidEgvValidRange = 2**6
|
||||
ValidAlgstateAlgstateIs100 = 2**7
|
||||
EgvWasSuccessfullyAddedToCgmSubsystemArrayE = 2**8
|
||||
OmrReadingType = 2**9
|
||||
SensorTypeSeeCgmtxtypeEnum = 2**11
|
||||
SensorTypeSeeCgmtxtypeEnum = 2**12
|
||||
SensorTypeSeeCgmtxtypeEnum = 2**13
|
||||
|
||||
@property
|
||||
def egvInfoBitmask(self):
|
||||
try:
|
||||
return self.EgvinfobitmaskBitmask(self.egvInfoBitmaskRaw)
|
||||
except ValueError as e:
|
||||
logger.error("Invalid egvInfoBitmaskRaw in EgvinfobitmaskBitmask for "+str(self))
|
||||
logger.error(e)
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def build(raw):
|
||||
glucosevaluestatus, = struct.unpack_from(UINT8, raw[:EVENT_LEN], 13)
|
||||
cgmDataType, = struct.unpack_from(UINT8, raw[:EVENT_LEN], 12)
|
||||
rate, = struct.unpack_from(INT16, raw[:EVENT_LEN], 10)
|
||||
algorithmstate, = struct.unpack_from(UINT8, raw[:EVENT_LEN], 17)
|
||||
RSSI, = struct.unpack_from(INT8, raw[:EVENT_LEN], 16)
|
||||
currentglucosedisplayvalue, = struct.unpack_from(UINT16, raw[:EVENT_LEN], 14)
|
||||
egvTimestamp, = struct.unpack_from(UINT32, raw[:EVENT_LEN], 18)
|
||||
egvInfoBitmask, = struct.unpack_from(UINT16, raw[:EVENT_LEN], 24)
|
||||
interval, = struct.unpack_from(UINT8, raw[:EVENT_LEN], 23)
|
||||
|
||||
return LidCgmDataFsl3(
|
||||
raw = RawEvent.build(raw),
|
||||
glucosevaluestatusRaw = glucosevaluestatus,
|
||||
cgmDataTypeRaw = cgmDataType,
|
||||
rateRaw = rate,
|
||||
algorithmstateRaw = algorithmstate,
|
||||
RSSI = RSSI,
|
||||
currentglucosedisplayvalue = currentglucosedisplayvalue,
|
||||
egvTimestamp = egvTimestamp,
|
||||
egvInfoBitmaskRaw = egvInfoBitmask,
|
||||
interval = interval,
|
||||
)
|
||||
|
||||
@property
|
||||
def eventTimestamp(self):
|
||||
return self.raw.timestamp
|
||||
|
||||
@property
|
||||
def seqNum(self):
|
||||
return self.raw.seqNum
|
||||
|
||||
@property
|
||||
def eventId(self):
|
||||
return self.ID
|
||||
|
||||
def todict(self):
|
||||
return dict(
|
||||
id=self.ID,
|
||||
name=self.NAME,
|
||||
seqNum=self.seqNum,
|
||||
eventTimestamp=str(self.eventTimestamp),
|
||||
glucosevaluestatusRaw=self.glucosevaluestatusRaw,
|
||||
cgmDataTypeRaw=self.cgmDataTypeRaw,
|
||||
rateRaw=self.rateRaw,
|
||||
algorithmstateRaw=self.algorithmstateRaw,
|
||||
RSSI=self.RSSI,
|
||||
currentglucosedisplayvalue=self.currentglucosedisplayvalue,
|
||||
egvTimestamp=self.egvTimestamp,
|
||||
egvInfoBitmaskRaw=self.egvInfoBitmaskRaw,
|
||||
interval=self.interval,
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class LidCgmStopSessionFsl3(BaseEvent):
|
||||
"""486: LID_CGM_STOP_SESSION_FSL3"""
|
||||
ID = 486
|
||||
NAME = "LID_CGM_STOP_SESSION_FSL3"
|
||||
|
||||
raw: RawEvent
|
||||
sessionstarttime: int # sec
|
||||
sessionstoptime: int # sec
|
||||
sessionduration: int # days
|
||||
sessionstopreason: int
|
||||
|
||||
|
||||
@staticmethod
|
||||
def build(raw):
|
||||
sessionstarttime, = struct.unpack_from(UINT32, raw[:EVENT_LEN], 10)
|
||||
sessionstoptime, = struct.unpack_from(UINT32, raw[:EVENT_LEN], 14)
|
||||
sessionduration, = struct.unpack_from(UINT8, raw[:EVENT_LEN], 18)
|
||||
sessionstopreason, = struct.unpack_from(UINT8, raw[:EVENT_LEN], 19)
|
||||
|
||||
return LidCgmStopSessionFsl3(
|
||||
raw = RawEvent.build(raw),
|
||||
sessionstarttime = sessionstarttime,
|
||||
sessionstoptime = sessionstoptime,
|
||||
sessionduration = sessionduration,
|
||||
sessionstopreason = sessionstopreason,
|
||||
)
|
||||
|
||||
@property
|
||||
def eventTimestamp(self):
|
||||
return self.raw.timestamp
|
||||
|
||||
@property
|
||||
def seqNum(self):
|
||||
return self.raw.seqNum
|
||||
|
||||
@property
|
||||
def eventId(self):
|
||||
return self.ID
|
||||
|
||||
def todict(self):
|
||||
return dict(
|
||||
id=self.ID,
|
||||
name=self.NAME,
|
||||
seqNum=self.seqNum,
|
||||
eventTimestamp=str(self.eventTimestamp),
|
||||
sessionstarttime=self.sessionstarttime,
|
||||
sessionstoptime=self.sessionstoptime,
|
||||
sessionduration=self.sessionduration,
|
||||
sessionstopreason=self.sessionstopreason,
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class LidDailyBasal(BaseEvent):
|
||||
"""81: LID_DAILY_BASAL"""
|
||||
@@ -5370,6 +5646,9 @@ EVENT_IDS = {
|
||||
447: LidCgmStopSessionG7,
|
||||
460: LidCgmAlertActivatedFsl2,
|
||||
461: LidCgmAlertClearedFsl2,
|
||||
477: LidCgmJoinSessionFsl3,
|
||||
480: LidCgmDataFsl3,
|
||||
486: LidCgmStopSessionFsl3,
|
||||
81: LidDailyBasal,
|
||||
48: LidCarbsEntered,
|
||||
36: LidUsbConnected,
|
||||
@@ -5429,6 +5708,9 @@ EVENT_NAMES = {
|
||||
"LID_CGM_STOP_SESSION_G7": LidCgmStopSessionG7,
|
||||
"LID_CGM_ALERT_ACTIVATED_FSL2": LidCgmAlertActivatedFsl2,
|
||||
"LID_CGM_ALERT_CLEARED_FSL2": LidCgmAlertClearedFsl2,
|
||||
"LID_CGM_JOIN_SESSION_FSL3": LidCgmJoinSessionFsl3,
|
||||
"LID_CGM_DATA_FSL3": LidCgmDataFsl3,
|
||||
"LID_CGM_STOP_SESSION_FSL3": LidCgmStopSessionFsl3,
|
||||
"LID_DAILY_BASAL": LidDailyBasal,
|
||||
"LID_CARBS_ENTERED": LidCarbsEntered,
|
||||
"LID_USB_CONNECTED": LidUsbConnected,
|
||||
|
||||
Reference in New Issue
Block a user