예제 #1
0
    def FetchDevices(self, callback, plugin_filter=Plugin.OLA_PLUGIN_ALL):
        """Fetch a list of devices from the server.

    Args:
      callback: The function to call once complete, takes two arguments, a
        RequestStatus object and a list of Device objects.
      filter: a plugin id to filter by
    """
        controller = SimpleRpcController()
        request = Ola_pb2.DeviceInfoRequest()
        request.plugin_id = plugin_filter
        done = lambda x, y: self._DeviceInfoComplete(callback, x, y)
        self._stub.GetDeviceInfo(controller, request, done)
예제 #2
0
파일: OlaClient.py 프로젝트: swgrainger/ola
    def FetchDevices(self, callback, plugin_filter=Plugin.OLA_PLUGIN_ALL):
        """Fetch a list of devices from the server.

    Args:
      callback: The function to call once complete, takes two arguments, a
        RequestStatus object and a list of Device objects.
      filter: a plugin id to filter by

    Returns:
      True if the request was sent, False otherwise.
    """
        if self._socket is None:
            return False

        controller = SimpleRpcController()
        request = Ola_pb2.DeviceInfoRequest()
        request.plugin_id = plugin_filter
        done = lambda x, y: self._DeviceInfoComplete(callback, x, y)
        try:
            self._stub.GetDeviceInfo(controller, request, done)
        except socket.error:
            raise OLADNotRunningException()
        return True