Example #1
0
 def __init__(self, bytes):
     if bytes:
         self.instNr = b2i(bytes[0:2])
         self.depNr = b2i(bytes[2:4])
         self.devId = b2i(bytes[4:4])
         self.devType = b2i(bytes[6:6])
         self.model = bdecode(bytes[9:14])
Example #2
0
 def __init__(self, bytes):
     self._print = False
     if bytes:
         # in minutes
         self.offset = b2i(bytes[0:2])
         self.index = b2i(bytes[2:4])
         self.desc = bdecode(bytes[4:])
         self._print = True
Example #3
0
 def __init__(self, bytes):
     self.value = ''
     if bytes and len(bytes) > 2:
         # H:m:s
         h = b2i(bytes[0:1])
         m = b2i(bytes[1:2])
         s = b2i(bytes[2:3])
         self.value = '{0}:{1}:{2}'.format(
             str(h).zfill(2), str(m).zfill(2), str(s).zfill(2))
Example #4
0
    def __init__(self, bytes):
        self.lookup = {
            0: 'Unspecified',
            1: 'cm',
            2: 'inch',
            3: 'mm'
        }
        self.text = ''

        if bytes:
            height = b2i(bytes[0:1])
            unit = b2i(bytes[2:3])
            self.text = '{0} {1}'.format(height, self.lookup[unit])
Example #5
0
    def __init__(self, bytes):
        self.lookup = {
            0: 'Unspecified',
            1: 'kg',
            2: 'g',
            3: 'Pound',
            4: 'Ounce'
        }
        self.text = ''

        if bytes:
            weight = b2i(bytes[0:1])
            unit = b2i(bytes[2:3])
            self.text = '{0} {1}'.format(weight, self.lookup[unit])
Example #6
0
    def __init__(self, bytes):
        self.lookup = {
            0: 'Unspecified',
            1: 'Caucasian',
            2: 'Black',
            3: 'Oriental'
        }

        # 1 byte
        if bytes:
            value = b2i(bytes)
            self.text = self.lookup[value]
        else:
            self.text = ''
Example #7
0
    def __init__(self, bytes):
        self.lookup = {
            0: 'Not Known',
            1: 'Male',
            2: 'Female',
            9: 'Unspecified'
        }
        self.text = ''

        if bytes:
            key = b2i(bytes)
            if key in self.lookup:
                self.text = self.lookup[key]
            else:
                self.text = key
Example #8
0
    def __init__(self, bytes):
        self.value = ''

        self.lookup = {
            0: '60Hz notch filter',
            1: '50Hz notch filter',
            2: 'Artifact filter',
            3: 'Basefilter filter'
        }

        if bytes:
            v = b2i(bytes)
            if v in self.lookup:
                self.value = self.lookup[v]
            else:
                self.value = v
Example #9
0
 def __init__(self, bytes):
     if bytes and len(bytes) > 2:
         self.text = '{0}/{1}/{2}'.format(
             b2i(bytes[0:2]), b2i(bytes[2:3]), b2i(bytes[3:4]))
     else:
         self.text = ''
Example #10
0
 def __init__(self, bytes):
     self.value = ''
     if bytes and len(bytes) > 3:
         # y/m/d
         self.value = '{0}/{1}/{2}'.format(
             b2i(bytes[0:2]), b2i(bytes[2:3]), b2i(bytes[3:4]))
Example #11
0
 def __init__(self, bytes):
     self.value = ''
     if bytes and len(bytes) > 2:
         self.value = b2i(bytes[0:2])
Example #12
0
 def __init__(self, bytes):
     self._print = False
     if bytes and len(bytes) > 1:
         self.value1 = b2i(bytes[0:1])
         self.value2 = b2i(bytes[1:2])
         self._print = True
Example #13
0
 def format_tag_int(self, tag, start, end):
     for _tag in self.tags:
         if _tag.tag == tag:
             return b2i(_tag.data[start:end])
     return ''