Package kenozooid :: Package driver :: Package ostc :: Module parser

Module parser

source code

OSTC dive computer binary data parsing routines.
Functions
 
get_data(data)
Get status information and profile raw data, see Data named tuple.
source code
 
profiles(data)
Split profile data into individual dive profiles using profile regular expression RE_PROFILES.
source code
 
header(data)
Parse OSTC dive profile header, see DiveHeader named tuple.
source code
 
dive_data(header, data)
Parse OSTC dive profile data block.
source code
 
sample_data(data, i, sample, div_sample, div_count)
Parse sample item like temperature, deco, etc.
source code
 
divisor(value)
Split divisor value into divisor sample information and divisor byte count.
source code
 
flag_byte(value)
Split profile flag byte into
source code
Variables
  log = logging.getLogger('kenozooid.driver.ostc')
  Data = namedtuple('Data', 'preamble eeprom voltage ver1 ver2 p...
  FMT_STATUS = '<6s256sHbb'
  LEN_STATUS = calcsize(FMT_STATUS)
  EEPROMData = namedtuple('EEPROMData', 'serial dives data')
  FMT_EEPROM = '<HH252s'
  RE_PROFILES = re.compile(b'(\xfa\xfa' b'(\x20.{42}|\x21.{52})\...
  DiveHeader = namedtuple('DiveHeader', "...
  FMT_DIVE_HEADER = '<6BHHB' 'HHH' '10B' 'BBB' 'BBHB4B' 'BBBB'
  DiveHeader_191 = namedtuple('DiveHeader_191', DiveHeader._fiel...
  FMT_DIVE_HEADER_191 = FMT_DIVE_HEADER+ 'HH' 'BB' 'BBBB'
  DiveSample = namedtuple('DiveSample', 'depth alarm gas_set_o2 ...
Function Details

profiles(data)

source code 

Split profile data into individual dive profiles using profile regular expression RE_PROFILES.

Collection of tuples (header, block) is returned

header
dive profile header
block
dive profile block data

sample_data(data, i, sample, div_sample, div_count)

source code 
Parse sample item like temperature, deco, etc.
Parameters:
  • data - Profile block data.
  • i - Profile block data index, where sample item can be found.
  • sample - Number of dive sample (starts from 1).
  • div_sample - Divisor sampling information.
  • div_count - Sample item data bytes count.

flag_byte(value)

source code 

Split profile flag byte into

  • amount of additional bytes of extended information
  • event byte presence, which is zero or one

Variables Details

Data

Value:
namedtuple('Data', 'preamble eeprom voltage ver1 ver2 profiles')

RE_PROFILES

Value:
re.compile(b'(\xfa\xfa' b'(\x20.{42}|\x21.{52})\xfb\xfb)' b'(.+?\xfd\x\
fd)', re.DOTALL)

DiveHeader

Value:
namedtuple('DiveHeader', """\
version month day year hour minute max_depth dive_time_m dive_time_s
min_temp surface_pressure desaturation
gas1_o2 gas1_he gas2_o2 gas2_he gas3_o2 gas3_he gas4_o2 gas4_he gas5_o\
2 gas5_he
gas6_o2 gas6_he gas
ver1 ver2 voltage sampling div_temp div_deco div_gf div_ppo2
div_deco_debug div_cns salnity max_cns
...

DiveHeader_191

Value:
namedtuple('DiveHeader_191', DiveHeader._fields+('avg_depth', 'dive_ti\
me_total_s', 'gf_lo', 'gf_hi', 'deco_type', 'reserved1', 'reserved2', \
'reserved3'))

DiveSample

Value:
namedtuple('DiveSample', 'depth alarm gas_set_o2 gas_set_he' ' current\
_gas setpoint temp deco_depth deco_time gf ppo2 cns')