class BaseI2CFilter(HighLevelAnalyzer):
    current_address: int
    target_address: int
    is_read: bool = False

    address_setting = StringSetting(label='Target Address (Dec or Hex)')

    result_types = {
        'start': {
            'format': 'Start'
        },
        'stop': {
            'format': 'Stop'
        },
        'address': {
            'format': '{{data.address}}, Read: {{data.read}}'
        },
        'data': {
            'format': '{{data.data}} {{data.error}}'
        }
    }

    def __init__(self):
        target_address = self.address_setting
        if not target_address:
            raise Exception('Target address is missing')

        base = 16 if target_address.startswith('0x') else 10
        try:
            self.target_address = int(target_address, base)
        except Exception as e:
            raise Exception('Invalid target address')

    def decode(self, frame):
        '''
        '''
        value = None
        if frame.type == 'address':
            self.is_read = frame.data['read']
            self.current_address = frame.data['address'][0]

        if self.current_address != None and self.current_address == self.target_address:
            value = ''
            if frame.type in ['address', 'data']:
                value = frame.data['address'][
                    0] if frame.type == 'address' else frame.data['data'][0]

            return frame

        return None
Exemplo n.º 2
0
class TextMessages(HighLevelAnalyzer):

    temp_frame = None
    delimiter = '\n'

    # Settings:
    prefix = StringSetting(label='Message Prefix (optional)')
    packet_timeout = NumberSetting(label='Packet Timeout [s]', min_value=1E-6, max_value=1E4)
    delimiter_setting = ChoicesSetting(label='Packet Delimiter', choices=DELIMITER_CHOICES.keys())

    # Base output formatting options:
    result_types = {
        'error': {
            'format': 'Error!'
        },
    }

    def __init__(self):
        self.delimiter = DELIMITER_CHOICES.get(self.delimiter_setting, '\n')
        self.result_types["message"] = {
            'format': self.prefix + '{{{data.str}}}'
        }

    def clear_stored_message(self, frame):
        self.temp_frame = AnalyzerFrame('message', frame.start_time, frame.end_time, {
            'str': ''
        })

    def append_char(self, char):
        self.temp_frame.data["str"] += char

    def have_existing_message(self):
        if self.temp_frame is None:
            return False
        if len(self.temp_frame.data["str"]) == 0:
            return False
        return True

    def update_end_time(self, frame):
        self.temp_frame.end_time = frame.end_time

    def decode(self, frame: AnalyzerFrame):
        # This class method is called once for each frame produced by the input analyzer.
        # the "data" dictionary contents is specific to the input analyzer type. The readme with this repo contains a description of the "data" contents for each input analyzer type.
        # all frames contain some common keys: start_time, end_time, and type.

        # This function can either return nothing, a single new frame, or an array of new frames.
        # all new frames produced are dictionaries and need to have the required keys: start_time, end_time, and type
        # in addition, protocol-specific information should be stored in the "data" key, so that they can be accessed by rendering (using the format strings), by export, by the terminal view, and by the protocol search results list.
        # Not all of these are implemented yet, but we're working on it!

        # All protocols - use the delimiter specified in the settings.
        delimiters = [self.delimiter]  # [ "\0", "\n", "\r", " " ]
        # All protocols - delimit on a delay specified in the settings
        # consider frames further apart than this separate messages
        maximum_delay = GraphTimeDelta(second=self.packet_timeout or 0.5E-3)
        # I2C - delimit on address byte
        # SPI - delimit on Enable toggle. TODO: add support for the SPI analyzer to send Enable/disable frames, or at least a Packet ID to the low level analyzer.

        char = "unknown error."

        # setup initial result, if not present
        first_frame = False
        if self.temp_frame is None:
            first_frame = True
            self.clear_stored_message(frame)

        # handle serial data and I2C data
        if frame.type == "data" and "data" in frame.data.keys():
            value = frame.data["data"][0]
            char = chr(value)

        # handle I2C address
        if frame.type == "address":
            value = frame.data["address"][0]
            # if we have an existing message, send it
            if self.have_existing_message() == True:
                ret = self.temp_frame
                self.clear_stored_message(frame)
                self.append_char("address: " + hex(value) + ";")
                return ret
            # append the address to the beginning of the new message
            self.append_char("address: " + hex(value) + ";")
            return None

        # handle I2C start condition
        if frame.type == "start":
            return

        # handle I2C stop condition
        if frame.type == "stop":
            if self.have_existing_message() == True:
                ret = self.temp_frame
                self.temp_frame = None
                return ret
            self.temp_frame = None
            return

        # handle SPI byte
        if frame.type == "result":
            char = ""
            if "miso" in frame.data.keys() and frame.data["miso"] != 0:
                char += chr(ord(frame.data["miso"]))
            if "mosi" in frame.data.keys() and frame.data["mosi"] != 0:
                char += chr(ord(frame.data["mosi"]))

        # If we have a timeout event, commit the frame and make sure not to add the new frame after the delay, and add the current character to the next frame.
        if first_frame == False and self.temp_frame is not None:
            if self.temp_frame.end_time + maximum_delay < frame.start_time:
                ret = self.temp_frame
                self.clear_stored_message(frame)
                self.append_char(char)
                return ret

        self.append_char(char)
        self.update_end_time(frame)

        # if the current character is a delimiter, commit it.
        if char in delimiters:
            ret = self.temp_frame
            # leave the temp_frame blank, so the next frame is the beginning of the next message.
            self.temp_frame = None
            return ret
class Hla(HighLevelAnalyzer):
    # List of settings that a user can set for this High Level Analyzer.
    my_string_setting = StringSetting()
    my_number_setting = NumberSetting(min_value=0, max_value=100)
    my_choices_setting = ChoicesSetting(choices=('A', 'B'))

    pumpReplyRowCount = 0
    aircraftReplyRowCount = 0
    rowStore = ""
    unknownStore = ""
    previousFrameValue = ""
    toggler = 0

    # An optional list of types this analyzer produces, providing a way to customize the way frames are displayed in Logic 2.
    result_types = {'mytype': {'format': '= {{data.input_type}} ='}}

    def __init__(self):
        '''
        Initialize HLA.

        Settings can be accessed using the same name used above.
        '''

        print("Settings:", self.my_string_setting, self.my_number_setting,
              self.my_choices_setting)

    def decode(self, frame: AnalyzerFrame):
        '''
        Process a frame from the input analyzer, and optionally return a single `AnalyzerFrame` or a list of `AnalyzerFrame`s.

        The type and data values in `frame` will depend on the input analyzer.
        '''

        printUnknownZeros = False
        printUnknownData = False
        printAircraftFrames = True
        printPumpFrames = True

        currentFrameValue = frame.data['data'].hex()
        # print("current frame val",currentFrameValue)
        if self.previousFrameValue == "55" and currentFrameValue == "16":
            # aircraft message
            # print("aircraft frame")
            self.toggler = 1
        if self.previousFrameValue == "55" and currentFrameValue == "1c":
            # pump message
            # print("pump frame")
            self.toggler = 2

        if self.toggler == 0:  # for unknown data storing
            self.unknownStore = self.unknownStore + self.previousFrameValue + ","
            if self.previousFrameValue != "00":
                if printUnknownData == True:
                    print("Unknown useful data: " + self.previousFrameValue)
        if self.toggler != 0 and self.unknownStore != "":  # for unknown data printing
            if printUnknownZeros == True:
                print("Unknown data: " + self.unknownStore)
            self.unknownStore = ""

        if self.toggler == 1:  # aircraft data processing
            self.aircraftReplyRowCount = self.aircraftReplyRowCount + 1
            # 10 && 16 are slow rate increase vales that range 6 to 9 on two motors then back from 6 to 9 when 4 motors
            # if self.aircraftReplyRowCount == 8 or self.aircraftReplyRowCount == 9 or self.aircraftReplyRowCount == 10  or self.aircraftReplyRowCount == 14 or self.aircraftReplyRowCount == 15 or self.aircraftReplyRowCount == 21 or self.aircraftReplyRowCount == 22: # filter changing values and convert to decimal
            #    modifiedOutput = str(int(self.previousFrameValue,16))
            #    if int(self.previousFrameValue,16) < 100:
            #        modifiedOutput = " " + str(int(self.previousFrameValue,16))
            #    if int(self.previousFrameValue,16) < 10:
            #        modifiedOutput = "  " + str(int(self.previousFrameValue,16))
            #    self.rowStore = self.rowStore + modifiedOutput + ","
            # else: #do not modify, just save unfiltered values
            self.rowStore = self.rowStore + self.previousFrameValue + ","
            # self.rowStore = rowStore + str(int(csvStore[i], 16)) + ","
            if self.aircraftReplyRowCount == 22:
                if printAircraftFrames == True:
                    output = self.rowStore
                    frameCheck = self.previousFrameValue
                    if frameCheck == "11":
                        print("AIRC", output, "ALL PUMPS OFF")
                    elif frameCheck == "53":
                        print("AIRC", output, "PUMP RUNNING")
                    elif frameCheck == "83":
                        print("AIRC", output, "PUMP DISABLED")
                    elif frameCheck == "a0":
                        print("AIRC", output, "MINIMUM SPRAY")
                    else:
                        print("AIRC", output, "Unknown: " + frameCheck)

                ##print("end found")
                self.toggler = 0
                self.rowStore = ""
                self.aircraftReplyRowCount = 0

        if self.toggler == 2:  # pump data processing
            self.pumpReplyRowCount = self.pumpReplyRowCount + 1
            self.rowStore = self.rowStore + self.previousFrameValue + ","
            # self.rowStore = self.rowStore + str(int(csvStore[i], 16)) + ","
            if self.pumpReplyRowCount == 28:
                if printPumpFrames == True:
                    output = self.rowStore
                    print("PUMP", output)
                self.toggler = 0
                self.pumpReplyRowCount = 0
                self.rowStore = ""

        self.previousFrameValue = currentFrameValue

        # Return the data frame itself
        return AnalyzerFrame(
            'mytype', frame.start_time, frame.end_time, {
                'input_type':
                "DEC: " + str(int(currentFrameValue, 16)) + "  HEX: 0x" +
                currentFrameValue,
            })
Exemplo n.º 4
0
class search(HighLevelAnalyzer):

    search_for = StringSetting()
    search_in_type = ChoicesSetting(['Ascii', 'Hex', 'Dec'])
    for_spi_test = ChoicesSetting(['MOSI', 'MISO'])

    result_types = {
        'match': {
            'format': 'Match: {{data.char}}'
        },
    }

    def __init__(self):

        self.print_cnt = 0

        self.search_index = 0
        self.match_start_time = None
        self.match_end_time = None

        self.search_len = 0
        self.search_raw = []
        if (self.search_in_type == "Ascii"):
            self.search_len = len(self.search_for)
            for c in self.search_for:
                self.search_raw.append(ord(c))
        else:
            nums = self.search_for.split()
            base = 10
            if (self.search_in_type == "Hex"):
                base = 16
            for n in nums:
                try:
                    self.search_raw.append(int(n, base))
                except:
                    continue
                self.search_len += 1

    def decode(self, frame: AnalyzerFrame):

        if (frame.type != 'data' and frame.type != 'result'):
            return

        try:
            if (frame.type == 'data'):
                ch = frame.data['data'][0]
            elif (frame.type == 'result'):
                if (self.for_spi_test == 'MOSI'):
                    ch = frame.data['mosi'][0]
                else:
                    ch = frame.data['miso'][0]
            else:
                return
        except:
            return

        if self.search_len == 0:
            return

        if ch != self.search_raw[self.search_index]:
            self.search_index = 0

        if ch == self.search_raw[self.search_index]:

            frames = []

            if self.search_index == 0:
                self.match_start_time = frame.start_time
            self.search_index = self.search_index + 1
            if self.search_index == self.search_len:
                self.match_end_time = frame.end_time

                char = ''
                for i in range(self.search_len):
                    if (self.search_in_type == "Dec"):
                        char += "%d " % self.search_raw[i]
                    elif (self.search_in_type == "Hex"):
                        char += "0x%02x " % self.search_raw[i]
                    else:
                        char += chr(self.search_raw[i])

                frames.append(
                    AnalyzerFrame('match', self.match_start_time,
                                  self.match_end_time, {'char': char.strip()}))
                self.search_index = 0

            return frames
Exemplo n.º 5
0
class Hla(HighLevelAnalyzer):
    # List of settings that a user can set for this High Level Analyzer.
    # my_string_setting = StringSetting()
    # my_number_setting = NumberSetting(min_value=0, max_value=100)
    # my_choices_setting = ChoicesSetting(choices=('A', 'B'))

    # An optional list of types this analyzer produces, providing a way to customize the way frames are displayed in Logic 2.
    result_types = {
        'mytype': {
            'format': 'Output type: {{type}}, Input type: {{data.input_type}}'
        }
    }

    prefix = StringSetting(label='Message Prefix (optional)')
    myHlaFrame = None
    listHlaFrame = []
    sm = None
    xchksum = 0  # Calculated checksum
    chksum = 0  # Checksum from data frame represented as ASCII string

    def __init__(self):
        '''
        Initialize HLA.

        Settings can be accessed using the same name used above.
        '''

        self.result_types["message"] = {
            'format': self.prefix + '{{{data.str}}}'
        }

        # print("Settings:", self.my_string_setting,
        #       self.my_number_setting, self.my_choices_setting)

        self.sm = HlaSM()

    def initHlaFrame(self, frame):
        try:
            del self.myHlaFrame
        except:
            pass
        self.myHlaFrame = AnalyzerFrame('message', frame.start_time,
                                        frame.end_time, {'str': ''})
        return self.myHlaFrame

    def bracketed(self, string):
        ret = "[" + string + "]"
        return ret

    def char(self, byte):
        # c = chr(byte)
        c = re.sub(r'[^a-zA-Z0-9 -_.,!\"\'/$]', '.', chr(byte))
        # ret = c if c.isalnum() else '.'
        ret = c
        return ret

    def decode(self, frame: AnalyzerFrame):
        '''
        Process a frame from the input analyzer, and optionally return a single `AnalyzerFrame` or a list of `AnalyzerFrame`s.

        The type and data values in `frame` will depend on the input analyzer.
        '''

        # setup initial result, if not present
        hlaMsg = "Unknown"
        myRet = None

        frameValue = frame.data["data"][0]
        """"""
        self.sm.update(frame)
        """"""

        if self.sm.is_Soh:
            hlaMsg = "SOH"
            self.listHlaFrame.clear()
            _frame = self.initHlaFrame(frame)
            _frame.data["str"] += hlaMsg
            self.listHlaFrame.append(_frame)
            self.xchksum = 0
        elif self.sm.is_Sta:
            if ord('A') <= frameValue <= ord('V'):
                comment = "~" + str(frameValue - 0x37)
            elif ord('1') <= frameValue <= ord('9'):
                comment = ""
            else:
                comment = "(error)"
            hlaMsg = "STA=" + self.bracketed(self.char(frameValue)) + comment
            _frame = self.initHlaFrame(frame)
            _frame.data["str"] += hlaMsg
            self.listHlaFrame.append(_frame)
            self.xchksum += frameValue
        elif self.sm.is_Cmd:
            if self.sm.tick == 0:
                hlaMsg = "CMD=" + self.bracketed(self.char(frameValue))
                _frame = self.initHlaFrame(frame)
                _frame.data["str"] += hlaMsg
                self.listHlaFrame.append(_frame)
            else:
                hlaMsg = self.bracketed(self.char(frameValue))
                _frame = self.listHlaFrame[-1]
                _frame.end_time = frame.end_time
                _frame.data["str"] += hlaMsg
            self.xchksum += frameValue
        elif self.sm.is_Stx:
            hlaMsg = "STX" + ('(error)' if not frameValue == STX else '')
            _frame = self.initHlaFrame(frame)
            _frame.data["str"] += hlaMsg
            self.listHlaFrame.append(_frame)
            self.xchksum += frameValue
        elif self.sm.is_Datano:
            if self.sm.tick == 0:
                hlaMsg = "Data No=" + self.bracketed(self.char(frameValue))
                _frame = self.initHlaFrame(frame)
                _frame.data["str"] += hlaMsg
                self.listHlaFrame.append(_frame)
            else:
                hlaMsg = self.bracketed(self.char(frameValue))
                _frame = self.listHlaFrame[-1]
                _frame.end_time = frame.end_time
                _frame.data["str"] += hlaMsg
            self.xchksum += frameValue
        elif self.sm.is_Data:
            if self.sm.tick == 0:
                # hlaMsg = "Data=" + self.bracketed(self.char(frameValue))
                hlaMsg = "]Data[=" + self.char(frameValue)
                _frame = self.initHlaFrame(frame)
                _frame.data["str"] += hlaMsg
                self.listHlaFrame.append(_frame)
            else:
                # hlaMsg = self.bracketed(self.char(frameValue))
                hlaMsg = self.char(frameValue)
                _frame = self.listHlaFrame[-1]
                _frame.end_time = frame.end_time
                _frame.data["str"] += hlaMsg
            self.xchksum += frameValue
        elif self.sm.is_Etx:
            hlaMsg = "ETX" + ('(error)' if not frameValue == ETX else '')
            _frame = self.initHlaFrame(frame)
            _frame.data["str"] += hlaMsg
            self.listHlaFrame.append(_frame)
            self.xchksum += frameValue
        elif self.sm.is_Chk:
            if self.sm.tick == 0:
                hlaMsg = "Chk=" + self.bracketed(self.char(frameValue))
                _frame = self.initHlaFrame(frame)
                _frame.data["str"] += hlaMsg
                self.listHlaFrame.append(_frame)
                self.chksum = chr(frameValue)
            else:
                comment = ""
                try:
                    self.chksum += chr(frameValue)
                except:
                    pass

                # Only the last two bytes of the calculated checsum, xchecksum, are relevant
                try:
                    if (0xff & self.xchksum) != int(self.chksum, 16):
                        comment = "(error)"
                except:
                    pass

                hlaMsg = self.bracketed(self.char(frameValue)) + comment
                _frame = self.listHlaFrame[-1]
                _frame.end_time = frame.end_time
                _frame.data["str"] += hlaMsg
                myRet = self.listHlaFrame
        elif self.sm.is_Stx2:
            hlaMsg = "STX"
            self.listHlaFrame.clear()
            _frame = self.initHlaFrame(frame)
            _frame.data["str"] += hlaMsg
            self.listHlaFrame.append(_frame)
            self.xchksum = 0
        elif self.sm.is_Sta2:
            if ord('A') <= frameValue <= ord('V'):
                comment = "~" + str(frameValue - 0x37)
            elif ord('1') <= frameValue <= ord('9'):
                comment = ""
            else:
                comment = "(error)"
            hlaMsg = "STA=" + self.bracketed(self.char(frameValue)) + comment
            _frame = self.initHlaFrame(frame)
            _frame.data["str"] += hlaMsg
            self.listHlaFrame.append(_frame)
            self.xchksum += frameValue
        elif self.sm.is_Err:
            hlaMsg = "ERR=" + self.bracketed(self.char(frameValue))
            _frame = self.initHlaFrame(frame)
            _frame.data["str"] += hlaMsg
            self.listHlaFrame.append(_frame)
            self.xchksum += frameValue
        # elif self.sm.is_Eot:
        #     hlaMsg = "EOT"
        #     _frame = self.initHlaFrame(frame)
        #     _frame.data["str"] += hlaMsg
        #     myRet = (_frame)

        if myRet != None:
            self.sm.update(frame)

        return myRet
Exemplo n.º 6
0
class I2CRegisterTransactions(HighLevelAnalyzer):
    # json_register_map_path = StringSetting(label='Register map (JSON)')
    # csv_register_map_path = StringSetting(label='Register map (CSV)')
    pickled_register_map_path = StringSetting(label='Register map (Python Pickle)')
    log_file_path = StringSetting(label='Log file path')


#    # List of settings that a user can set for this High Level Analyzer.
#     my_string_setting = StringSetting()
#     my_number_setting = NumberSetting(min_value=0, max_value=100)
#     my_choices_setting = ChoicesSetting(choices=('A', 'B'))

    # TODO: consider other frame types
    result_types = {
        'i2c_frame  ': {
            'format': '{{data.out_str}}'
        },
        'transaction': {
            'format': '{{data.transaction_string}}'
        }
    }

    def __init__(self):
        '''
        Initialize this HLA.

        If you have any initialization to do before any methods are called, you can do it here.
        '''
        self.current_frame = None
        self.current_transaction = None
        self.address_is_write = False
        #self.register_map = None
        # self.decoder = RegisterDecoder(register_map=self.register_map)
        self.decoder = None

        self._init_decoder()
        if not self.decoder:
            raise  AttributeError("You must provide a path to a valid register map")


    def _init_decoder(self):
        if self.pickled_register_map_path and os.path.exists(self.pickled_register_map_path):
            self.decoder = RegisterDecoder(pickled_map_path=self.pickled_register_map_path, log_path=self.log_file_path)
        # CSV support here

    def process_transaction(self):
        # This doesn't need to be in here?
        self.current_transaction.register_address = self.current_transaction.data.pop(0)
        self.current_transaction.write = self.address_is_write
        # we can also set the type here
        transaction_string = self.decoder.decode_transaction(self.current_transaction)

        new_frame = {
            'type': 'transaction',
            'start_time': self.current_transaction.start_time,
            'end_time': self.current_transaction.end_time,
            'data': {
                'transaction_string' : transaction_string
            }
        }
        new_frame = AnalyzerFrame('transaction',
            self.current_transaction.start_time, self.current_transaction.end_time, {
            'input_type': self.current_frame.type, 'transaction_string':transaction_string
        })

        return new_frame

    def _process_address_frame(self, frame):
        self.address_is_write = not frame.data['read']

    def _process_data_frame(self, frame):
        byte = int.from_bytes(frame.data['data'], 'little')

        self.current_transaction.data.append(byte)

    def _process_stop_frame(self, frame):
        # we don't want to end on the stop after a single byte write
        # which is used to set up a read.
        # we _do_ want to save that data as the register address that is being read from
        # so! if the current transaction's data is len(1) and the previous address frame
        # was for a write, pop the byte off the bytes collection and use it to set
        # the current transaction's register address

        # otherwise, we are ending a
        # * multi-byte write (reg addr+ values)
        #   - in this case, the register address is the first byte of the data
        # * single or multi-byte read ( read data)
        #   - reg address was previous set by the write used to set the read up
        # in either case the transaction frame should be ended and returned.
        # REVISED!
        # in either case (read or write), all the data frames are used and the first
        # will always be the register address!
        # This means the only difference is that reads transactions do not process the first write, but they still append their data

        if self.address_is_write and len(self.current_transaction.data) == 1:
            # do nothing?
            return
        # setting the end time will trigger processing the txn
        self.current_transaction.end_time = frame.end_time


        return

    def decode(self, frame):
        self.current_frame = frame
        new_frame = None
        frame_type = frame.type


        if frame_type == 'start': # begin new transaction or repeated start
            if self.current_transaction is None:
                self.current_transaction = Transaction(start_time=frame.start_time)
        if self.current_transaction is None:
            return

        if frame_type == 'address': # read or write + I2C slave addr
            self._process_address_frame(frame)
        if frame_type == 'data': # register address and data
            self._process_data_frame(frame)

        if frame_type == 'stop': # transaction end, ready to process
            self._process_stop_frame(frame)

        if self.current_transaction.end_time:

            # in the rack-like model we would just pass the txn and other rack item would process it
            transaction_frame = self.process_transaction()
            # expecting start to create a new txn?
            # should be created after start frame is processed
            # which will set...??? frame start 
            self.current_transaction = None
            return transaction_frame
Exemplo n.º 7
0
class Hla(HighLevelAnalyzer):
    # List of settings that a user can set for this High Level Analyzer
    Line_start_delimiter_Type = ChoicesSetting(choices=('HEX', 'DEC', 'CHAR'))
    Line_start_delimiter = StringSetting(label='Line start delimiter')
    Terminal_output_type = ChoicesSetting(choices=('HEX', 'DEC', 'HEX & DEC',
                                                   'CHAR'))
    Output_Chunk_Time = ChoicesSetting(choices=('Yes', 'No'))
    Output_Frame_Time = ChoicesSetting(choices=('Yes', 'No'))
    Output_Configuration = ChoicesSetting(choices=('Yes', 'No'))

    delimiter = ""
    lineLimit = ""

    startTime = 0
    startFrameTime = 0
    startChunkTime = 0
    firstFrame = True

    delimiterFound = False
    delimiterProcessing = False
    customFrameTag = False

    rowStore = ""
    unknownStore = ""
    previousFrameValue = ""
    toggler = 0
    if Line_start_delimiter == "":
        delimiter = "DISABLED"
    else:
        delimiter = Line_start_delimiter

    # An optional list of types this analyzer produces, providing a way to customize the way frames are displayed in Logic 2.
    result_types = {'mytype': {'format': ' {{data.input_type}} '}}

    def __init__(self):
        '''
        Initialize HLA.

        Settings can be accessed using the same name used above.
        '''

        print("Delimiter type: " + self.Line_start_delimiter_Type,
              "Delimiter: " + self.delimiter,
              "Terminal output type: " + self.Terminal_output_type)

    def decode(self, frame: AnalyzerFrame):
        currentFrameValueHex = frame.data['data'].hex()
        currentFrameValueDec = int(currentFrameValueHex, 16)

        hours = int(str(
            frame.start_time).split("T")[1].split(":")[0]) * 60 * 60
        minutes = int(str(frame.start_time).split("T")[1].split(":")[1]) * 60
        seconds = float(((str(
            frame.start_time).split("T")[1].split(":")[2]).split("Z"))[0])

        hoursEnd = int(str(
            frame.end_time).split("T")[1].split(":")[0]) * 60 * 60
        minutesEnd = int(str(frame.end_time).split("T")[1].split(":")[1]) * 60
        secondsEnd = float(
            ((str(frame.end_time).split("T")[1].split(":")[2]).split("Z"))[0])

        totalSecondsStart = hours + minutes + seconds

        totalSecondsEnd = hoursEnd + minutesEnd + secondsEnd

        if self.firstFrame == True:
            self.startTime = totalSecondsStart
            self.startFrameTime = frame.start_time
            self.firstFrame = False

        # If the character matches the one we are searching for, output a new frame
        if self.Line_start_delimiter_Type == 'HEX':
            if currentFrameValueHex == self.delimiter:
                print("")
                self.delimiterFound = True
                startChunkTime = totalSecondsStart
        elif self.Line_start_delimiter_Type == 'DEC':
            if int(currentFrameValueDec) == int(self.delimiter):
                print("")
                self.delimiterFound = True
        elif self.Line_start_delimiter_Type == 'CHAR':
            if chr(currentFrameValueDec) == self.delimiter:
                print("")
                self.delimiterFound = True

        if self.Terminal_output_type == 'HEX':
            outputString = str(currentFrameValueHex)
        elif self.Terminal_output_type == 'DEC':
            outputString = str(currentFrameValueDec)
        elif self.Terminal_output_type == 'CHAR':
            outputString = str(chr(currentFrameValueDec))
        elif self.Terminal_output_type == 'HEX & DEC':
            outputString = (str(currentFrameValueDec) + "-" +
                            str(currentFrameValueHex))

        if self.delimiterFound == True and self.delimiterProcessing == False:
            self.rowStore = outputString
            self.delimiterProcessing = True
            self.delimiterFound = False
        elif self.delimiterFound == False and self.delimiterProcessing == True:
            self.rowStore = self.rowStore + "," + outputString
        elif self.delimiterFound == True and self.delimiterProcessing == True:
            print("")
            print(self.rowStore)
            self.rowStore = ""
            self.rowStore = outputString
            self.delimiterProcessing = True
            self.delimiterFound = False

            if self.Output_Chunk_Time == 'Yes':
                print(" Chunk time: " + str(totalSecondsEnd - startChunkTime))
                print(
                    " Chunk START time: " +
                    str(frame.start_time).split("T")[1],
                    " Chunk END time: " + str(frame.end_time).split("T")[1])
            if self.Output_Frame_Time == 'Yes':
                print(
                    " First frame time: " +
                    str(self.startFrameTime).split("T")[1],
                    " Last frame time: " + str(frame.end_time).split("T")[1])
            if self.Output_Configuration == 'Yes':
                print(" Delimiter " + self.Line_start_delimiter_Type +
                      " Val: " + self.delimiter + ", Terminal outputting " +
                      self.Terminal_output_type)
                print(" Total runTime: " +
                      str(totalSecondsEnd - self.startTime))

        else:
            print(outputString)
            outputString = ""
        '''if self.deliniator == self.Line_start_delimiter:
                    return AnalyzerFrame('mytype', frame.start_time, frame.end_time, {
                        'input_type': frame.type
                 })'''

        #self.delimiterFound = False
        if self.customFrameTag == False:
            # Return the data frame itself
            return AnalyzerFrame(
                'mytype', frame.start_time, frame.end_time, {
                    'input_type':
                    "DEC: " + str(currentFrameValueDec) + "  HEX: 0x" +
                    currentFrameValueHex + " CHAR: " +
                    chr(currentFrameValueDec),
                })
        else:
            # Return the data frame itself
            return AnalyzerFrame(
                'mytype', frame.start_time, frame.end_time, {
                    'input_type':
                    "DEC: " + str(currentFrameValueDec) + "  HEX: 0x" +
                    currentFrameValueHex + " CHAR: " +
                    chr(currentFrameValueDec),
                })