def __init__( self, aDomain, aName, aVersion, aDevice ): self.lib = PyOhNet.lib self.handle = self.lib.CpProxyCreate( aDomain, aName, aVersion, aDevice.handle ) self.service = self.lib.CpProxyService( self.handle ) self._propertyAnyCb = None self._propertyInitCb = None self.actions = [] self.properties = [] self.semaReady = threading.Semaphore( 0 ) # Sema rather than Event as can be multiple CB = PyOhNet.makeCb( None, ctypes.c_void_p ) # actions ongoing at any time self._AnyEvent = CB( self._AnyEventCb ) CB = PyOhNet.makeCb( None, ctypes.c_void_p ) self._InitEvent = CB( self._InitEventCb ) PyOhNet.cpProxies.append( self )
def __init__( self, aService, aAction, aCb ): global gAsyncCbs self.lib = PyOhNet.lib self.callersCb = aCb CB = PyOhNet.makeCb( None, ctypes.c_void_p, ctypes.c_void_p ) asyncCb = CB( self.AsyncComplete ) self.handle = self.lib.CpServiceInvocation( aService, aAction.handle, asyncCb, None ) gAsyncCbs.append( {'handle':self.handle, 'cb':asyncCb} ) # keep CB in scope until called
def __init__(self, aDomain, aName, aVersion, aDevice): self.lib = PyOhNet.lib self.lib.CpProxyCreate.restype = ctypes.c_void_p self.handle = ctypes.c_void_p( self.lib.CpProxyCreate(aDomain, aName, aVersion, aDevice.handle)) self.lib.CpProxyService.restype = ctypes.c_void_p self.service = ctypes.c_void_p(self.lib.CpProxyService(self.handle)) self._propertyAnyCb = None self._propertyInitCb = None self.actions = [] self.properties = [] self.semaReady = threading.Semaphore( 0) # Sema rather than Event as can be multiple CB = PyOhNet.makeCb(None, ctypes.c_void_p) # actions ongoing at any time self._AnyEvent = CB(self._AnyEventCb) CB = PyOhNet.makeCb(None, ctypes.c_void_p) self._InitEvent = CB(self._InitEventCb) PyOhNet.cpProxies.append(self)
def __init__(self, aService, aAction, aCb): global gAsyncCbs self.lib = PyOhNet.lib self.callersCb = aCb CB = PyOhNet.makeCb(None, ctypes.c_void_p, ctypes.c_void_p) asyncCb = CB(self.AsyncComplete) self.lib.CpServiceInvocation.restype = ctypes.c_void_p self.handle = ctypes.c_void_p( self.lib.CpServiceInvocation(aService, aAction.handle, asyncCb, None)) gAsyncCbs.append({ 'handle': self.handle, 'cb': asyncCb }) # keep CB in scope until called
def __init__(self, aAddedCb, aRemovedCb): self.lib = PyOhNet.lib self.handle = None self.devices = [] self.addedCbs = [] self.removedCbs = [] if aAddedCb: self.addedCbs.append(aAddedCb) if aRemovedCb: self.removedCbs.append(aRemovedCb) CB = PyOhNet.makeCb(None, ctypes.c_void_p, ctypes.c_void_p) self._PrimaryAddedCb = CB(self._Added) self._PrimaryRemovedCb = CB(self._Removed) PyOhNet.devLists.append(self)
def __init__( self, aAddedCb, aRemovedCb ): self.lib = PyOhNet.lib self.handle = None self.devices = [] self.addedCbs = [] self.removedCbs = [] if aAddedCb: self.addedCbs.append( aAddedCb ) if aRemovedCb: self.removedCbs.append( aRemovedCb ) CB = PyOhNet.makeCb( None, ctypes.c_void_p, ctypes.c_void_p ) self._PrimaryAddedCb = CB( self._Added ) self._PrimaryRemovedCb = CB( self._Removed ) PyOhNet.devLists.append( self )
def __init__( self, aName, aCb ): self.lib = PyOhNet.lib self.handle = None self.name = aName CB = PyOhNet.makeCb( None, ctypes.c_void_p ) self.callback = CB( aCb )