query method

AsyncReply<List<IResource?>> query(
  1. String path
)
Query resources at specific link. Link path.

Implementation

AsyncReply<List<IResource?>> query(String path) {
  var str = DC.stringToBytes(path);
  var reply = new AsyncReply<List<IResource?>>();

  sendRequest(IIPPacketAction.QueryLink)
    ..addUint16(str.length)
    ..addDC(str)
    ..done().then<dynamic>((args) {
      if (args != null) {
        var content = args[0] as DC;

        Codec.parseResourceArray(content, 0, content.length, this)
            .then((resources) => reply.trigger(resources));
      } else {
        reply.triggerError(Exception("Null response"));
      }
    }).error((ex) => reply.triggerError(ex));

  return reply;
}