# Path: core/interfaces/base.py
# class BaseInterface(ABC, Module):
# 
#     def  __init__(self, hplayer, name="INTERFACE", color="blue"):
#         super().__init__(hplayer, name, color)
#         self.hplayer = hplayer
# 
#         # stopping flag
#         self.stopped = threading.Event()
#         self.stopped.set()
# 
#         # Listen thread
#         self.recvThread = threading.Thread(target=self.listen)
# 
# 
#     # Receiver THREAD (ABSTRACT)
#     @abstractmethod
#     def listen(self):
#         self.stopped.wait()
# 
#     # Start
#     def start(self):
#         self.stopped.clear()
#         self.recvThread.start()
#         return self
# 
#     # Stop
#     def quit(self):
#         self.log("stopping...")
#         self.stopped.set()
#         self.recvThread.join()
#         self.log("stopped")
# 
# 	# is Running
#     def isRunning(self, state=None):
#         if state is not None:
#             self.stopped.clear() if state else self.stopped.set()
#         return not self.stopped.is_set()
# 
# Path: core/engine/network.py
# def get_ip(iface=None):
# def get_allip():
# def get_broadcast(iface=None):
# def get_hostname():
# def get_ethmac():
# def get_essid(iface):
# def get_rssi(iface):


from .base import BaseInterface
from core.engine import network
from serial.tools import list_ports
from threading import Timer
import time, os
import serial

    # change active page
    def page(self, p):
        self.activePage = p


    def init(self):
        self.page(PAGE_MEDIA)
        

    def refresh(self):

        if self.activePage == PAGE_WELCOME:

            self.line(0, '       ')
            self.line(1, '        KXKM')
            self.line(2, '^1     RPi-Player')
            self.line(3, '       ')
            self.line(4, '       ')

        elif self.activePage == PAGE_EXIT:

            self.line(0, '       ')
            self.line(1, '       ')
            self.line(2, '^0    ^2Ngoodbye !')
            self.line(3, '       ')
            self.line(4, '       ')

        elif self.activePage == PAGE_STATUS:


# Path: core/interfaces/base.py
# class BaseInterface(ABC, Module):
# 
#     def  __init__(self, hplayer, name="INTERFACE", color="blue"):
#         super().__init__(hplayer, name, color)
#         self.hplayer = hplayer
# 
#         # stopping flag
#         self.stopped = threading.Event()
#         self.stopped.set()
# 
#         # Listen thread
#         self.recvThread = threading.Thread(target=self.listen)
# 
# 
#     # Receiver THREAD (ABSTRACT)
#     @abstractmethod
#     def listen(self):
#         self.stopped.wait()
# 
#     # Start
#     def start(self):
#         self.stopped.clear()
#         self.recvThread.start()
#         return self
# 
#     # Stop
#     def quit(self):
#         self.log("stopping...")
#         self.stopped.set()
#         self.recvThread.join()
#         self.log("stopped")
# 
# 	# is Running
#     def isRunning(self, state=None):
#         if state is not None:
#             self.stopped.clear() if state else self.stopped.set()
#         return not self.stopped.is_set()
# 
# Path: core/engine/network.py
# def get_ip(iface=None):
# def get_allip():
# def get_broadcast(iface=None):
# def get_hostname():
# def get_ethmac():
# def get_essid(iface):
# def get_rssi(iface):


# Path: core/interfaces/teleco.py
from .base import BaseInterface
from core.engine import network
from serial.tools import list_ports
from threading import Timer
import time, os
import serial


    # change active page
    def page(self, p):
        self.activePage = p


    def init(self):
        self.page(PAGE_MEDIA)
        

    def refresh(self):

        if self.activePage == PAGE_WELCOME:

            self.line(0, '       ')
            self.line(1, '        KXKM')
            self.line(2, '^1     RPi-Player')
            self.line(3, '       ')
            self.line(4, '       ')

        elif self.activePage == PAGE_EXIT:

            self.line(0, '       ')
            self.line(1, '       ')
            self.line(2, '^0    ^2Ngoodbye !')
            self.line(3, '       ')
            self.line(4, '       ')

        elif self.activePage == PAGE_STATUS:


            net = network.get_essid('wlan0')