--------------------------------------------------------------------------------
                   CyBroAutodetect (c) 2021 Robotina d.o.o.
--------------------------------------------------------------------------------

CyBroAutodetect is a tool that searches the local network for controllers that 
have a defined variable of a certain value or all available controllers on network.
It allows to automatically modify an existing controller NAD with new one 
in the CyBroMiniScada xml files. 

It features also:
- definition of application name
- definition of custom parameter and custom parameter value
- definition of search timeout
- definition of search retries
- definitions of xml file paths 

CyBroAutodetect works in local network. Internet connection is not directly 
supported, but it can be established with the help of CyBroRelay or CyBroHIQUniverseRelay. 
In such case, adjustment of timeout values and retries may be needed.

CyBroComServer is used to communicate with the controller so it is necessary 
that the "CyBroComServer.com" (version 1.6.4) is in the same directory.

There is no installation, just unzip and run.

Usage:

CyBroAutodetect /an=<name> /cp=<var> /cpv=<val> /t=<ms> /r=<count> <file> [<file> ...] 

Parameters:

/an=<name>  : name of application (default: CyBro)
/cp=<var>   : name of variable being searched (optional)
/cpv=<val>  : value of searched variable (optional)
/t=<ms>     : timeout for autodetect [ms] (default: 250ms) 
/r=<count>  : number of retries, not counting the first message (default: 1)
<file>      : an xml file where c<nad> will be replaced with NAD address of 
              found controller (optional)

- /cp=<var> and /cpv=? will list all Cybro controllers which do not have the 
  specified variable defined
- if none or only one of /cp and /cpv parameters are specified, the program will 
  search for all Cybro controllers on network

Examples:

- search controllers with application_id = 123456 and modify CyBroMiniScada.xml:

CyBroAutodetect /an=HEMS /cp=application_id /cpv=123456 /t=250 /r=1 CyBroMiniScada.xml

- definition of command and parameters "autodetect" button in CyBroMiniScada.xml

<object>
  <type>button</type> 
  <name>autodetect</name>    
  <file>button.png</file>
  <shortpress>           
    <action>
      <type>command</type>
      <command>CyBroAutodetect.exe</command>
      <parameters>/an=HEMS /cp=application_id /cpv=19005000 /t=500 /r=1 CyBroMiniScada.xml scene.xml</parameters>
      <waitforexit>1</waitforexit>
    </action>
  </shortpress>
  <style>button</style>   
  <x></x>
  <y></y>
</object>
