# Path: myDevices/utils/logger.py
# def exception(message):
#     if checkFlood(message):
#         return
#     LOGGER.exception(message)
# 
# def info(message):
#     # if checkFlood(message):
#     #     return
#     LOGGER.info(message)
# 
# def warn(message):
#     if checkFlood(message):
#         return
#     LOGGER.warn(message)
# 
# def error(message, *args, **kwargs):
#     if checkFlood(message):
#         return
#     LOGGER.error(message, *args, **kwargs)
# 
# def debug(message):
#     outerFrame = getouterframes(currentframe())[1][0]
#     (args, _, _, values) = getargvalues(outerFrame)
#     argsValue = ''
#     
#     for i in args:
#         if i is 'self':
#             continue
#         argsValue += "(%s=%s)" % (i, str(values[i]))
#     
#     stack = extract_stack()
#     (filename, line, procname, text) = stack[-2]
#     LOGGER.debug(str(filename) + ' ' + str(procname) + str(argsValue) + ':' + str(line) + '> '  + str(message))


import re
import sys
        import netifaces
from myDevices.utils.logger import exception, info, warn, error, debug
"""
This module provides constants for the board revision info and pin mapping as well as
a class for getting hardware info, including manufacturer, model and MAC address.
"""

BOARD_REVISION = 0
CPU_REVISION = "0"
CPU_HARDWARE = ""

try:
    with open("/proc/cpuinfo") as f:
        cpuinfo = f.read()
        rc = re.compile("Revision\s*:\s(.*)\n")
        result = rc.search(cpuinfo)
        if result:
            CPU_REVISION = result.group(1)
            if CPU_REVISION.startswith("1000"):
                CPU_REVISION = CPU_REVISION[-4:]
            if CPU_REVISION != "0000":
                cpurev = int(CPU_REVISION, 16)
                if cpurev < 0x04:
                    BOARD_REVISION = 1
                elif cpurev < 0x10:
                    BOARD_REVISION = 2
                else:
                    BOARD_REVISION = 3
        rc = re.compile("Hardware\s*:\s(.*)\n")
        result = rc.search(cpuinfo)
        CPU_HARDWARE = result.group(1)
except:

# Path: myDevices/utils/logger.py
# def exception(message):
#     if checkFlood(message):
#         return
#     LOGGER.exception(message)
# 
# def info(message):
#     # if checkFlood(message):
#     #     return
#     LOGGER.info(message)
# 
# def warn(message):
#     if checkFlood(message):
#         return
#     LOGGER.warn(message)
# 
# def error(message, *args, **kwargs):
#     if checkFlood(message):
#         return
#     LOGGER.error(message, *args, **kwargs)
# 
# def debug(message):
#     outerFrame = getouterframes(currentframe())[1][0]
#     (args, _, _, values) = getargvalues(outerFrame)
#     argsValue = ''
#     
#     for i in args:
#         if i is 'self':
#             continue
#         argsValue += "(%s=%s)" % (i, str(values[i]))
#     
#     stack = extract_stack()
#     (filename, line, procname, text) = stack[-2]
#     LOGGER.debug(str(filename) + ' ' + str(procname) + str(argsValue) + ':' + str(line) + '> '  + str(message))


# Path: myDevices/system/hardware.py
import re
import sys
        import netifaces
from myDevices.utils.logger import exception, info, warn, error, debug

"""
This module provides constants for the board revision info and pin mapping as well as
a class for getting hardware info, including manufacturer, model and MAC address.
"""

BOARD_REVISION = 0
CPU_REVISION = "0"
CPU_HARDWARE = ""

try:
    with open("/proc/cpuinfo") as f:
        cpuinfo = f.read()
        rc = re.compile("Revision\s*:\s(.*)\n")
        result = rc.search(cpuinfo)
        if result:
            CPU_REVISION = result.group(1)
            if CPU_REVISION.startswith("1000"):
                CPU_REVISION = CPU_REVISION[-4:]
            if CPU_REVISION != "0000":
                cpurev = int(CPU_REVISION, 16)
                if cpurev < 0x04:
                    BOARD_REVISION = 1
                elif cpurev < 0x10:
                    BOARD_REVISION = 2
                else:
                    BOARD_REVISION = 3
        rc = re.compile("Hardware\s*:\s(.*)\n")
        result = rc.search(cpuinfo)
        CPU_HARDWARE = result.group(1)
except:

    exception("Error reading cpuinfo")