def generate():
    frameObjects = []  #for holding the frame objects
    symbol_objects = symbol_generation.generateSymbols()

    #start with the first id
    id = 0

    for frame in frames:  #for all of the frames

        lastData = None
        newData = []
        save_id = None

        id_symbol = [
            symbol for symbol in symbol_objects if symbol.value == id
        ][0]

        for data in frame:  #for the data in each frame

            if lastData is not None:
                if lastData.name == data:
                    lastData.symbol_length += 1
                else:
                    newData.append(lastData)
                    lastData = block(name=data, symbol_length=1)
            else:
                lastData = block(name=data, symbol_length=1)

        newData.append(lastData)

        frameObjects.append(symbol_frame(identifier=id_symbol, blocks=newData))

        id += 1

    return frameObjects
Esempio n. 2
0
def generate():
    frameObjects = [] #for holding the frame objects
    symbol_objects = symbol_generation.generateSymbols()
    
    #start with the first id
    id = 0
    
    for frame in frames: #for all of the frames
        
        lastData = None
        newData = []
        save_id = None
        
        id_symbol = [symbol for symbol in symbol_objects if symbol.value == id][0]
        
        for data in frame: #for the data in each frame
            
            if lastData is not None: 
                if lastData.name == data:
                    lastData.symbol_length += 1
                else:
                    newData.append(lastData)
                    lastData = block(name=data,symbol_length=1)
            else:
                lastData = block(name=data,symbol_length=1)
                
        newData.append(lastData)
        
        frameObjects.append(symbol_frame(identifier=id_symbol,blocks=newData))

        id += 1

    return frameObjects
Esempio n. 3
0
def generate():
    frameObjects = [] #for holding the frame objects
    symbol_objects = symbol_generation.generateSymbols()
    
    id = 0
    for frame in frames: #for all of the frames
        lastData = None
        newData = []
        save_id = None
        for symbol in symbol_objects:
            if symbol.value == id:
                save_id = symbol
                break

        for data in frame: #for the data in each frame
            
            if lastData is not None: 
                if lastData.name == data:
                    lastData.symbolLength += 1
                else:
                    newData.append(lastData)
                    lastData = block(name=data,symbolLength=1)
            else:
                lastData = block(name=data,symbolLength=1)
                
        newData.append(lastData)
        
        frameObjects.append(symbol_frame(identifier=save_id,blocks=newData))

        id += 1

    return frameObjects
Esempio n. 4
0
        def setup(self):
            self.testHeader = element(chirpLength=5,identifier='Header',value=5)
            self.testSubFrames = []
            self.testBlock = block(chirpLengths=[5,4],name='Test',value='1A')
            self.testBlock2 = block(chirpLengths=[4],name='Test2',value='5')
            self.testSubFrame = sub_frame(blocks=[self.testBlock,self.testBlock2],name='SubFrame1',timeStamp=datetime.now())
            self.testCheckSum = element(chirpLength=5,identifier='CheckSum',value=5)
            self.testFrame = frame(header=self.testHeader,subFrames=[self.testSubFrame],checkSum=self.testCheckSum)
            
            import frame_generation

            self.TwoOfFiveFrames = frame_generation.generate()
def generateErrors():
    frameObjects = []  #for holding the frame objects
    id = 0
    for frame in badFrames:  #for all of the frames
        lastData = None
        newData = []
        for data in frame:  #for the data in each frame

            if lastData != None:
                if lastData.name == data:
                    lastData.symbol_length += 1
                else:
                    newData.append(lastData)
                    lastData = block(name=data, symbol_length=1)
            else:
                lastData = block(name=data, symbol_length=1)

        newData.append(lastData)

        frameObjects.append(Frame(header=id + 63, subFrames=newData))

        id += 1

    return frameObjects
Esempio n. 6
0
def generateErrors():
    frameObjects = [] #for holding the frame objects
    id = 0
    for frame in badFrames: #for all of the frames
        lastData = None
        newData = []
        for data in frame: #for the data in each frame
            
            if lastData!=None: 
                if lastData.name == data:
                    lastData.symbol_length += 1
                else:
                    newData.append(lastData)
                    lastData = block(name=data,symbol_length=1)
            else:
                lastData = block(name=data,symbol_length=1)
                
        newData.append(lastData)

        frameObjects.append(Frame(header=id+63,subFrames=newData))

        id += 1

    return frameObjects
Esempio n. 7
0
 def setup(self):
     self.testBlock = block(chirpLengths=[5,4,4],name='Test')
     self.testSubFrame = sub_frame(blocks=[self.testBlock],name='SubFrame1',timeStamp=datetime.now())