discoverComponents method

Future<List<Discovery>> discoverComponents([
  1. List<DiscoveryQuery> queries = const []
])

Discover components that the robot can connect to, given specific query metadata.

var queries = [DiscoveryQuery(subtype: 'camera', model: 'webcam', extra: {'username': 'admin', 'password': 'admin'})];
var discoveredComponents = await machine.discoverComponents(queries);

Implementation

Future<List<Discovery>> discoverComponents([List<DiscoveryQuery> queries = const []]) async {
  final request = rpb.DiscoverComponentsRequest()
    ..queries.addAll(queries.map((sdkQuery) => rpb.DiscoveryQuery()
      ..subtype = sdkQuery.subtype
      ..model = sdkQuery.model
      ..extra = sdkQuery.extraStruct));

  final response = await _client.discoverComponents(request);
  return response.discovery.map((d) => Discovery.fromProto(d)).toList();
}