App-ArduinoBuilder

 view release on metacpan or  search on metacpan

lib/App/ArduinoBuilder/Monitor.pm  view on Meta::CPAN

  $tool->send("HELLO 1 ${App::ArduinoBuilder::TOOLS_USER_AGENT}\n");

  # TODO: we should have a way to check whether we are at least logging DEBUG
  # messages and, if so, building the all_params and set_params variable with a
  # single call to the tool to pass the result to the log calls.
  my $get_all_params = sub { $tool->send("DESCRIBE\n")->{port_description}{configuration_parameters} };
  my $get_set_params = sub { { map { $_->{label} => $_->{selected} } values %{$get_all_params->()} } };
  debug "Monitor port configuration: %s", $get_set_params;
  trace "Monitor port available options: %s", $get_all_params;
  
  my $serv = IO::Socket::INET->new(Listen => 1, Timeout => 5);
  my $serv_addr = sprintf "%s:%s", $serv->sockhost, $serv->sockport();
  debug "Listening for the monitor on '${serv_addr}'";
  
  # TODO: check OK response (here and in other commands too).
  $tool->send("OPEN ${serv_addr} ${board_port}\n");

  my $client = $serv->accept();
  $serv->close();

  my $select = IO::Select->new();



( run in 0.230 second using v1.01-cache-2.11-cpan-4d50c553e7e )