 # -*- coding:UTF-8 -*-

#import threading
#import time
#import RPi.GPIO as GPIO
#import LCD_1in44
#import LCD_Config
#import cv2
#import json
#import os
#import shutil
#import subprocess
#import picamera
#from PIL import Image, ImageDraw
#from scapy.all import RadioTap, Dot11, Dot11Deauth, sendp
from RaAction import RaAction
from RaDisplay import RaDisplay
from RaKeypad import RaKeypad
from RaMenu import RaMenu
from RaCamera import RaCamera
from RaNas import RaNas
from RaNetwork import RaNetwork
import threading

from RaUtil import RaUtil



class RaComponents:

    Keypad : RaKeypad = None
    Display : RaDisplay = None
    Menu : RaMenu = None
    Camera : RaCamera = None
    Nas : RaNas = None
    Action : RaAction = None
    Util : RaUtil = None
    Network : RaNetwork = None

    def __init__(self):
        pass



if __name__ == "__main__":
    Components : RaComponents = RaComponents()

    # Init Stuff
    Components.Util = RaUtil(Components)
    Components.Display = RaDisplay(Components)
    Components.Keypad = RaKeypad(Components, {
        "KEY_UP": 6,
        "KEY_DOWN": 19,
        "KEY_LEFT": 5,
        "KEY_RIGHT": 26,
        "KEY_PRESS": 13,
        "KEY1": 21,
        "KEY2": 20,
        "KEY3": 16
    })
    Components.Nas = RaNas(Components)
    Components.Menu = RaMenu(Components)
    Components.Camera = RaCamera(Components)
    Components.Action = RaAction(Components)
    Components.Network = RaNetwork(Components)

    # End init stuff
    Components.Display.waitForLogoEnd()
    # start Main Stuff
    try:
        # Wait for end
    
        Components.Keypad.join()
    except KeyboardInterrupt:
        threading.Lock().acquire()
        exit()