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.


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)}");
  state = InterfaceState.bound;

  return InterfaceRequest<T>(pair.second);