예제 #1
0
 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 )
예제 #2
0
 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
예제 #3
0
파일: _Proxy.py 프로젝트: mksteve/ohNet
 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)
예제 #4
0
 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
예제 #5
0
    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)
예제 #6
0
파일: _DevList.py 프로젝트: Jacik/ohNet
 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 )
예제 #7
0
파일: _Eventing.py 프로젝트: simoncn/ohNet
 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 )
예제 #8
0
 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 )