• Printable version
  • Tell by mail
  • Export to OpenOffice
  • Export to PDF
  • Export to csv
  • Export to Timeline
  • Add page to book
  • Tools:

Using argonaut in your plugins

supportDaemon

If you want to call argonaut methods in your plug-in, you'll need to use the class supportDaemon.

  $sd = new supportDaemon();  
  if ($sd->is_available()) { // If you need to test argonaut server connexion, this will ping the server
      $action     = "manage_service";
      $targets    = array($macAddress1,$macAddress2);
      $data       = array("args"=>array("goCupsServer","restart"));
      $sd->append_call($action, $targets, $data); // append_call allows you to directly call an argonaut client method
      if ($sd->is_error()) { // if the call failed
          die $sd->get_error();
      }
  } else {
      echo $sd->get_error(); // when returning FALSE, is_available sets the error explaining the problem
  }

$action must be one of ClientDaemon.pm methods. (I chose manage_service for this example because it takes two parameters.)
$targets must be an array containing the macAddresses you want to execute the action on.
$data must be an associative array that follows Argonaut protocol (third parameter of action method).
You don't need to call $sd→is_available(), as you test $sd→is_error() after the call, you'll know if the call failed.
So only call is_available if you need to, for instance if some UI elements of your plugin should not be displayed when argonaut is not available.
(is_available causes the call of an argonaut server method in order to see if it answers, that's why you should not abuse of it)
Append_call allows you to execute actions on argonaut clients, supportDaemon have a few other useful functions, look at http://api.fusiondirectory.org/classsupportDaemon.html for more details

en/developers/using_argonaut.txt · Last modified: 2017/10/31 10:40 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0