def subConfig()

in leda_python/leda.py [0:0]


    def subConfig(self, key, type=1):
        '''
			:param key: config name
			:param type: 0: Owner, 1: observer
			:return:
		'''

        if (None == self.driverMbusHandle):
            raise exception.LedaBusHandleException("mbus Handle is None")

        if (False == isinstance(key, str)):
            raise exception.LedaParamsException("subConfig: input args type is invalid")

        reply_cb = self._subConfig_cb
        error_cb = self._subConfig_errCb

        self.subConfigSync.clear()
        self.driverMbusHandle.subscribeConfig(key, type, reply_cb, error_cb)

        syncMsg = self.subConfigSync.wait(mbusConfig.MERHOD_SYNC_TIMEOUT)
        if (None == syncMsg):
            raise exception.LedaRPCMethodException("subConfig time out", exception.LEDA_ERROR_TIMEOUT)
        elif (False == syncMsg["state"]):
            raise exception.LedaRPCMethodException("subConfig failed", exception.LEDA_ERROR_FAILED)