コード例 #1
0
def main():
    p = print_header._header(__file__, __author__, __copyright__, __version__)
    p._print()
    DATA = np.array([1, 0, 1, 1, 1])
    enc = encoder(DATA)
    enc.hamming_rule()
    enc.generator_matrix()
    enc.syndrome_matrix()
    enc.encoded_data()
コード例 #2
0
ファイル: main.py プロジェクト: LinuxIoT/IoT-Gateway
def main():
        
        # Print headers. Use print_header.py
        h = _header(__file__,__author__,__copyright__,__version__)
        h._print()
        
        # Initiallize the System. Use init.py
        sysinit_obj = sysinit()
        sysinit_obj.run()
        
        # Print the grabage collector = True/False
        print "Garbage Collector Enabled: " + str(gc.isenabled()) + "\n"

        # Initiallize the Serial Port for reading data from serial
        ser_obj = ser_init()
        ser = ser_obj.serial_init()
        print ser

        # Check whether  to initiallize Coap Server or Not
        parse = Parser_Functions()
        parse.parser_init()
        parse.ConfigSectionMap()

        _section = 'COAP'
        _server = parse.getSectionOption(_section, 'server')
        _ip = parse.getSectionOption(_section, 'ip')
        _port = int(parse.getSectionOption(_section, 'port'))

        if _server == '0':
                print "OFF COAP Server"
        elif _server == '1':
                print "COAP Server has been Started"
                t0 = start_coap(_ip,_port,False)
                t0.start()
                _thread_pool.append(t0)
        else:
                print "INVALID Section [COAP] = OPTION [Server]. Only 0/1 boolean"
                return exit
            
        # Spawn Threads
        
        # Get Serial Data by spawning thread t1. Use serial_IO.py
        t1 = serial_data(ser)
        t1.start()
        _thread_pool.append(t1)

        # Filter the raw serial data based on the frame structure.
        t2 = filter_data()
        t2.start()
        _thread_pool.append(t2)

        t3 = DFRA()
        t3.start()
        _thread_pool.append(t3)

        t4 = ZMQ_LL()
	t4.start()
	_thread_pool.append(t4)

        
	t5 = ZMQ_HL()
	t5.start()
	_thread_pool.append(t5)

##	
	t6 = Http_Server()
	t6.start()
	_thread_pool.append(t6)
コード例 #3
0
"""Hamming Codes Implementation: https://programmingpraxis.com/2012/05/22/hamming-codes/
"""

__author__ = "Weqaar Janjua & Ahmer Malik"
__copyright__ = "Copyright (C) 2016 Linux IoT"
__revision__ = "$Id$"
__version__ = "0.1"


import numpy as np
import math
import print_header


p = print_header._header(__file__, __author__, __copyright__, __version__)
p._print()

data_bits = 2
parity_bits = int(math.sqrt(data_bits)) + 2

# Hamming Rule:  d + p + 1 ≤ 2^p

H1 = data_bits + parity_bits + 1
H2 = 2 ** parity_bits

while H1 > H2:
    H1 = data_bits + parity_bits + 1
    H2 = 2 ** parity_bits
    parity_bits += 1
コード例 #4
0
def main():
    p = print_header._header(__file__,__author__,__copyright__,__version__)
    p._print()