from saleae.analyzers import AnalyzerFrame
from abc import ABC, abstractmethod

""" Parent class for Decoders that defines its abstract methods
This follows a similar structure to the HLSM in the analyzer,
where the parent class defines the decoding methods and for DDR or SDR
the implementation changes.
"""
class GenericDecoder:
    @abstractmethod
    def __init__(self):
        pass

    """ This method will be called in the I3C HLA each time a frame
    is about to be committed so it can be processed first.
    When overwriting this method it must always return an
    AnalyzerFrame or None if nothing is to be committed and the decoding mode.
    """
    @abstractmethod
    def processFrame(self, frame: AnalyzerFrame):
        return frame
