start inherit more drivers

This commit is contained in:
chrys 2017-10-24 07:39:02 +02:00
parent bdedc207f6
commit 6b3a89a837
2 changed files with 10 additions and 29 deletions

View File

@ -9,51 +9,39 @@ from core import debug
class inputDriver():
def __init__(self):
self._initialized = False
def initialize(self, environment):
self.env = environment
self._isInitialized = True
def shutdown(self):
pass
self._isInitialized = False
def getInputEvent(self):
time.sleep(0.05)
if not self._initialized:
return None
def writeEventBuffer(self):
if not self._initialized:
return
def clearEventBuffer(self):
if not self._initialized:
return
del self.env['input']['eventBuffer'][:]
def updateInputDevices(self, force = False, init = False):
if not self._initialized:
return
def getLedState(self, led = 0):
if not self._initialized:
return False
return False
def toggleLedState(self, led = 0):
if not self._initialized:
return None
def grabDevices(self):
if not self._initialized:
return None
def releaseDevices(self):
if not self._initialized:
return None
def __del__(self):
if not self._initialized:
return None
self.releaseDevices()

View File

@ -30,16 +30,16 @@ from ctypes import c_bool
from core.eventData import fenrirEventType
from core import inputData
from core import debug
from core.inputDriver import inputDriver
class driver():
class driver(inputDriver):
def __init__(self):
inputDriver.__init__(self)
self._manager = multiprocessing.Manager()
self.iDevices = {}
self.iDevicesFD = self._manager.list()
self.uDevices = {}
self.iDeviceNo = 0
self._initialized = False
self.watchDog = Value(c_bool, True)
def initialize(self, environment):
self.env = environment
@ -70,9 +70,6 @@ class driver():
def plugInputDeviceWatchdogTimer(self, active):
time.sleep(2.5)
return time.time()
def shutdown(self):
if not self._initialized:
return
def inputWatchdog(self,active , params):
try:
deviceFd = []
@ -325,8 +322,4 @@ class driver():
self.uDevices.clear()
self.iDeviceNo = 0
def __del__(self):
if not self._initialized:
return