userx14 / omblepy

Cli tool to read records from omron blood-pressure bluetooth-low-energy measurement instruments

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recovering device's internal clock

vulcainman opened this issue · comments

Thanks for your nice project, it gave me a lot of information about Omron devices' Bluetooth protocol. I would like to implement other features in relation with devices' internal clock (how to recover it, to reconfigure it, etc...) and I've several question :

  1. Do you have any information concerning devices' internal clock ?
  2. How did you get EEPROM address and data format for measurement information (official documentation reverse engineering, communication analysis, EEPROM diff analysis) ?

Thanks !

Hi @vulcainman,

on hem-7600 it should be a read around 0x276, and the first byte is the year+2000, the second byte the month and so on.
Deleted the comment to protect personal info, check your mail 😄, thanks for the info.

Best,
Benjamin

For future reference the clock sync is now included in the HEM-7322 driver in the current development branch

def deviceSpecific_syncWithSystemTime(self):
timeSyncSettingsCopy = self.cachedSettingsBytes[self.settingsTimeSyncBytesSlice]
#read current time from cached settings bytes
month, year, hour, day, second, minute = [int(byte) for byte in timeSyncSettingsCopy[2:8]]
logger.info(f"device is set to date: {datetime.datetime(year + 2000, month, day, hour, minute, second).strftime('%Y-%m-%d %H:%M:%S')}")
#write the current time into the cached settings which will be written later
currentTime = datetime.datetime.now()
setNewTimeDataBytes = timeSyncSettingsCopy[0:2]
setNewTimeDataBytes += bytes([currentTime.month, currentTime.year - 2000, currentTime.hour, currentTime.day, currentTime.second, currentTime.minute])
setNewTimeDataBytes += bytes([0x00, sum(setNewTimeDataBytes) & 0xff]) #first byte does not seem to matter, second byte is crc generated by sum over data and only using lower 8 bits
self.cachedSettingsBytes[self.settingsTimeSyncBytesSlice] = setNewTimeDataBytes
logger.info(f"settings updated to new date {currentTime.strftime('%Y-%m-%d %H:%M:%S')}")
return