Google is committed to advancing racial equity for Black communities. See how.

request method

InterfaceRequest<T> request ()

Creates an interface request whose peer is bound to this interface proxy.

Creates a channel pair, binds one of the channels to this object, and returns the other channel. Calls to the proxy will be encoded as messages and sent to the returned channel.

The proxy must not already have been bound.

Implementation

InterfaceRequest<T> request() {
  if (!isUnbound) {
    throw FidlStateException(
        "AsyncProxyController<${$interfaceName}> isn't unbound");
  }

  ChannelPair pair = ChannelPair();
  if (pair.status != ZX.OK) {
    throw FidlError(
        "AsyncProxyController<${$interfaceName}> couldn't create channel: ${getStringForStatus(pair.status)}");
  }
  _reader.bind(pair.first);
  state = InterfaceState.bound;

  return InterfaceRequest<T>(pair.second);
}