/*********************************************************************
 *
 *  $Id: svn_id $
 *
 *  Implements commands to handle Network functions
 *
 *  - - - - - - - - - License information: - - - - - - - - -
 *
 *  Copyright (C) 2011 and beyond by Yoctopuce Sarl, Switzerland.
 *
 *  Yoctopuce Sarl (hereafter Licensor) grants to you a perpetual
 *  non-exclusive license to use, modify, copy and integrate this
 *  file into your software for the sole purpose of interfacing
 *  with Yoctopuce products.
 *
 *  You may reproduce and distribute copies of this file in
 *  source or object form, as long as the sole purpose of this
 *  code is to interface with Yoctopuce products. You must retain
 *  this notice in the distributed source file.
 *
 *  You should refer to Yoctopuce General Terms and Conditions
 *  for additional information regarding your rights and
 *  obligations.
 *
 *  THE SOFTWARE AND DOCUMENTATION ARE PROVIDED 'AS IS' WITHOUT
 *  WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
 *  WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS
 *  FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO
 *  EVENT SHALL LICENSOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL,
 *  INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
 *  COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR
 *  SERVICES, ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT
 *  LIMITED TO ANY DEFENSE THEREOF), ANY CLAIMS FOR INDEMNITY OR
 *  CONTRIBUTION, OR OTHER SIMILAR COSTS, WHETHER ASSERTED ON THE
 *  BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE), BREACH OF
 *  WARRANTY, OR OTHERWISE.
 *
 *********************************************************************/


#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#include "YNetwork.h"
#include "yocto_api.h"
#include "yocto_network.h"

using namespace std;

//--- (YNetwork definitions)

static const char *enumBool[] = {
    "FALSE",
    "TRUE",
    NULL
};

static const char *enumOnOff[] = {
    "OFF",
    "ON",
    NULL
};

static const char *enumReadiness[] = {
    "DOWN",
    "EXISTS",
    "LINKED",
    "LAN_OK",
    "WWW_OK",
    NULL
};

static const char *enumSecurityMode[] = {
    "UNDEFINED",
    "LEGACY",
    "MIXED",
    "SECURE",
    NULL
};

static const char *enumHTTPMethod[] = {
    "POST",
    "GET",
    "PUT",
    NULL
};

static const char *enumCallbackEncoding[] = {
    "FORM",
    "JSON",
    "JSON_ARRAY",
    "CSV",
    "YOCTO_API",
    "JSON_NUM",
    "EMONCMS",
    "AZURE",
    "INFLUXDB",
    "MQTT",
    "YOCTO_API_JZON",
    "PRTG",
    "INFLUXDB_V2",
    NULL
};

//--- (end of YNetwork definitions)


//--- (YNetwork implementation)
bool   YNetworkCmdLine::isModule(void)      { return false; }
string YNetworkCmdLine::YFunctionName(void) { return "YNetwork"; }

// type of logicalName is string (Text)
// type of advertisedValue is string (PubText)
// type of readiness is int (Readiness)
// type of macAddress is string (MACAddress)
// type of ipAddress is string (IPAddress)
// type of subnetMask is string (IPAddress)
// type of router is string (IPAddress)
// type of currentDNS is string (IPAddress)
// type of ipConfig is string (IPConfig)
// type of primaryDNS is string (IPAddress)
// type of secondaryDNS is string (IPAddress)
// type of ntpServer is string (IPAddress)
// type of userPassword is string (UserPassword)
// type of adminPassword is string (AdminPassword)
// type of httpPort is int (UInt31)
// type of httpsPort is int (UInt31)
// type of securityMode is int (SecurityMode)
// type of defaultPage is string (Text)
// type of discoverable is int (Bool)
// type of wwwWatchdogDelay is int (UInt31)
// type of callbackUrl is string (Text)
// type of callbackMethod is int (HTTPMethod)
// type of callbackEncoding is int (CallbackEncoding)
// type of callbackTemplate is int (OnOff)
// type of callbackCredentials is string (Credentials)
// type of callbackInitialDelay is int (UInt31)
// type of callbackSchedule is string (CallbackSchedule)
// type of callbackMinDelay is int (UInt31)
// type of callbackMaxDelay is int (UInt31)
// type of poeCurrent is int (UsedCurrent)
/**
 * Returns the logical name of the network interface, corresponding to the network name of the module.
 *
 * @return a string corresponding to the logical name of the network interface, corresponding to the
 * network name of the module
 *
 * On failure, throws an exception or returns YNetwork.LOGICALNAME_INVALID.
 */
class Network_get_logicalName : public YapiCommand /* arguments: */
{
public:
  Network_get_logicalName(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_logicalName";
  }

  string getDescription()
  {
    return "Returns the logical name of the network interface, corresponding to the network name of the module.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_logicalName();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the logical name of the network interface, corresponding to the network name of the module.
 * You can use yCheckLogicalName()
 * prior to this call to make sure that your parameter is valid.
 * Remember to call the saveToFlash() method of the module if the
 * modification must be kept.
 *
 * @param newval : a string corresponding to the logical name of the network interface, corresponding
 * to the network name of the module
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_logicalName : public YapiCommand /* arguments: newval */
{
public:
  Network_set_logicalName(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_logicalName";
  }

  string getDescription()
  {
    return "Changes the logical name of the network interface, corresponding to the network name of the module.";
  }

  string getMoreInfo()
  {
    return "You can use yCheckLogicalName() prior to this call to make sure that your parameter is valid. Remember to call \"YModule {target} saveToFlash\" if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(STRING_ARG, "newval", "a string corresponding to the logical name of the network interface, corresponding to the network name of the module", "_LOGICAL", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    if (!YAPI::CheckLogicalName((*args)[0]->get_stringValue())) {
        throw std::string("Invalid name :" + (*args)[0]->get_stringValue());
    }
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_logicalName(string((*args)[0]->get_stringValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns a short string representing the current state of the network interface.
 *
 * @return a string corresponding to a short string representing the current state of the network interface
 *
 * On failure, throws an exception or returns YNetwork.ADVERTISEDVALUE_INVALID.
 */
class Network_get_advertisedValue : public YapiCommand /* arguments: */
{
public:
  Network_get_advertisedValue(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_advertisedValue";
  }

  string getDescription()
  {
    return "Returns a short string representing the current state of the network interface.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_advertisedValue();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Returns the current established working mode of the network interface.
 * Level zero (DOWN_0) means that no hardware link has been detected. Either there is no signal
 * on the network cable, or the selected wireless access point cannot be detected.
 * Level 1 (LIVE_1) is reached when the network is detected, but is not yet connected.
 * For a wireless network, this shows that the requested SSID is present.
 * Level 2 (LINK_2) is reached when the hardware connection is established.
 * For a wired network connection, level 2 means that the cable is attached at both ends.
 * For a connection to a wireless access point, it shows that the security parameters
 * are properly configured. For an ad-hoc wireless connection, it means that there is
 * at least one other device connected on the ad-hoc network.
 * Level 3 (DHCP_3) is reached when an IP address has been obtained using DHCP.
 * Level 4 (DNS_4) is reached when the DNS server is reachable on the network.
 * Level 5 (WWW_5) is reached when global connectivity is demonstrated by properly loading the
 * current time from an NTP server.
 *
 * @return a value among YNetwork.READINESS_DOWN, YNetwork.READINESS_EXISTS,
 * YNetwork.READINESS_LINKED, YNetwork.READINESS_LAN_OK and YNetwork.READINESS_WWW_OK corresponding to
 * the current established working mode of the network interface
 *
 * On failure, throws an exception or returns YNetwork.READINESS_INVALID.
 */
class Network_get_readiness : public YapiCommand /* arguments: */
{
public:
  Network_get_readiness(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_readiness";
  }

  string getDescription()
  {
    return "Returns the current established working mode of the network interface.";
  }

  string getMoreInfo()
  {
    return "Level zero (DOWN_0) means that no hardware link has been detected. Either there is no signal on the network cable, or the selected wireless access point cannot be detected. Level 1 (LIVE_1) is reached when the network is detected, but is not yet connected. For a wireless network, this shows that the requested SSID is present. Level 2 (LINK_2) is reached when the hardware connection is established. For a wired network connection, level 2 means that the cable is attached at both ends. For a connection to a wireless access point, it shows that the security parameters are properly configured. For an ad-hoc wireless connection, it means that there is at least one other device connected on the ad-hoc network. Level 3 (DHCP_3) is reached when an IP address has been obtained using DHCP. Level 4 (DNS_4) is reached when the DNS server is reachable on the network. Level 5 (WWW_5) is reached when global connectivity is demonstrated by properly loading the current time from an NTP server.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        int attrval = (*list)[i]->get_readiness();
        string strval =  enumString(attrval,enumReadiness);
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Returns the MAC address of the network interface. The MAC address is also available on a sticker
 * on the module, in both numeric and barcode forms.
 *
 * @return a string corresponding to the MAC address of the network interface
 *
 * On failure, throws an exception or returns YNetwork.MACADDRESS_INVALID.
 */
class Network_get_macAddress : public YapiCommand /* arguments: */
{
public:
  Network_get_macAddress(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_macAddress";
  }

  string getDescription()
  {
    return "Returns the MAC address of the network interface.";
  }

  string getMoreInfo()
  {
    return "The MAC address is also available on a sticker on the module, in both numeric and barcode forms.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_macAddress();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Returns the IP address currently in use by the device. The address may have been configured
 * statically, or provided by a DHCP server.
 *
 * @return a string corresponding to the IP address currently in use by the device
 *
 * On failure, throws an exception or returns YNetwork.IPADDRESS_INVALID.
 */
class Network_get_ipAddress : public YapiCommand /* arguments: */
{
public:
  Network_get_ipAddress(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_ipAddress";
  }

  string getDescription()
  {
    return "Returns the IP address currently in use by the device.";
  }

  string getMoreInfo()
  {
    return "The address may have been configured statically, or provided by a DHCP server.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_ipAddress();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Returns the subnet mask currently used by the device.
 *
 * @return a string corresponding to the subnet mask currently used by the device
 *
 * On failure, throws an exception or returns YNetwork.SUBNETMASK_INVALID.
 */
class Network_get_subnetMask : public YapiCommand /* arguments: */
{
public:
  Network_get_subnetMask(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_subnetMask";
  }

  string getDescription()
  {
    return "Returns the subnet mask currently used by the device.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_subnetMask();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Returns the IP address of the router on the device subnet (default gateway).
 *
 * @return a string corresponding to the IP address of the router on the device subnet (default gateway)
 *
 * On failure, throws an exception or returns YNetwork.ROUTER_INVALID.
 */
class Network_get_router : public YapiCommand /* arguments: */
{
public:
  Network_get_router(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_router";
  }

  string getDescription()
  {
    return "Returns the IP address of the router on the device subnet (default gateway).";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_router();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Returns the IP address of the DNS server currently used by the device.
 *
 * @return a string corresponding to the IP address of the DNS server currently used by the device
 *
 * On failure, throws an exception or returns YNetwork.CURRENTDNS_INVALID.
 */
class Network_get_currentDNS : public YapiCommand /* arguments: */
{
public:
  Network_get_currentDNS(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_currentDNS";
  }

  string getDescription()
  {
    return "Returns the IP address of the DNS server currently used by the device.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_currentDNS();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Returns the IP configuration of the network interface.
 *
 * If the network interface is set up to use a static IP address, the string starts with "STATIC:" and
 * is followed by three
 * parameters, separated by "/". The first is the device IP address, followed by the subnet mask
 * length, and finally the
 * router IP address (default gateway). For instance: "STATIC:192.168.1.14/16/192.168.1.1"
 *
 * If the network interface is configured to receive its IP from a DHCP server, the string start with
 * "DHCP:" and is followed by
 * three parameters separated by "/". The first is the fallback IP address, then the fallback subnet
 * mask length and finally the
 * fallback router IP address. These three parameters are used when no DHCP reply is received.
 *
 * @return a string corresponding to the IP configuration of the network interface
 *
 * On failure, throws an exception or returns YNetwork.IPCONFIG_INVALID.
 */
class Network_get_ipConfig : public YapiCommand /* arguments: */
{
public:
  Network_get_ipConfig(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_ipConfig";
  }

  string getDescription()
  {
    return "Returns the IP configuration of the network interface.";
  }

  string getMoreInfo()
  {
    return "If the network interface is set up to use a static IP address, the string starts with \"STATIC:\" and is followed by three parameters, separated by \"/\". The first is the device IP address, followed by the subnet mask length, and finally the router IP address (default gateway). For instance: \"STATIC:192.168.1.14/16/192.168.1.1\"\nIf the network interface is configured to receive its IP from a DHCP server, the string start with \"DHCP:\" and is followed by three parameters separated by \"/\". The first is the fallback IP address, then the fallback subnet mask length and finally the fallback router IP address. These three parameters are used when no DHCP reply is received.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_ipConfig();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Returns the IP address of the primary name server to be used by the module.
 *
 * @return a string corresponding to the IP address of the primary name server to be used by the module
 *
 * On failure, throws an exception or returns YNetwork.PRIMARYDNS_INVALID.
 */
class Network_get_primaryDNS : public YapiCommand /* arguments: */
{
public:
  Network_get_primaryDNS(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_primaryDNS";
  }

  string getDescription()
  {
    return "Returns the IP address of the primary name server to be used by the module.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_primaryDNS();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the IP address of the primary name server to be used by the module.
 * When using DHCP, if a value is specified, it overrides the value received from the DHCP server.
 * Remember to call the saveToFlash() method and then to reboot the module to apply this setting.
 *
 * @param newval : a string corresponding to the IP address of the primary name server to be used by the module
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_primaryDNS : public YapiCommand /* arguments: newval */
{
public:
  Network_set_primaryDNS(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_primaryDNS";
  }

  string getDescription()
  {
    return "Changes the IP address of the primary name server to be used by the module.";
  }

  string getMoreInfo()
  {
    return "When using DHCP, if a value is specified, it overrides the value received from the DHCP server. Remember to call the saveToFlash() method and then to reboot the module to apply this setting.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(STRING_ARG, "newval", "a string corresponding to the IP address of the primary name server to be used by the module", "_STRING", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_primaryDNS(string((*args)[0]->get_stringValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns the IP address of the secondary name server to be used by the module.
 *
 * @return a string corresponding to the IP address of the secondary name server to be used by the module
 *
 * On failure, throws an exception or returns YNetwork.SECONDARYDNS_INVALID.
 */
class Network_get_secondaryDNS : public YapiCommand /* arguments: */
{
public:
  Network_get_secondaryDNS(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_secondaryDNS";
  }

  string getDescription()
  {
    return "Returns the IP address of the secondary name server to be used by the module.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_secondaryDNS();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the IP address of the secondary name server to be used by the module.
 * When using DHCP, if a value is specified, it overrides the value received from the DHCP server.
 * Remember to call the saveToFlash() method and then to reboot the module to apply this setting.
 *
 * @param newval : a string corresponding to the IP address of the secondary name server to be used by the module
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_secondaryDNS : public YapiCommand /* arguments: newval */
{
public:
  Network_set_secondaryDNS(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_secondaryDNS";
  }

  string getDescription()
  {
    return "Changes the IP address of the secondary name server to be used by the module.";
  }

  string getMoreInfo()
  {
    return "When using DHCP, if a value is specified, it overrides the value received from the DHCP server. Remember to call the saveToFlash() method and then to reboot the module to apply this setting.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(STRING_ARG, "newval", "a string corresponding to the IP address of the secondary name server to be used by the module", "_STRING", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_secondaryDNS(string((*args)[0]->get_stringValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns the IP address of the NTP server to be used by the device.
 *
 * @return a string corresponding to the IP address of the NTP server to be used by the device
 *
 * On failure, throws an exception or returns YNetwork.NTPSERVER_INVALID.
 */
class Network_get_ntpServer : public YapiCommand /* arguments: */
{
public:
  Network_get_ntpServer(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_ntpServer";
  }

  string getDescription()
  {
    return "Returns the IP address of the NTP server to be used by the device.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_ntpServer();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the IP address of the NTP server to be used by the module. Use an empty
 * string to restore the factory set  address.
 * Remember to call the saveToFlash() method and then to reboot the module to apply this setting.
 *
 * @param newval : a string corresponding to the IP address of the NTP server to be used by the module
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_ntpServer : public YapiCommand /* arguments: newval */
{
public:
  Network_set_ntpServer(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_ntpServer";
  }

  string getDescription()
  {
    return "Changes the IP address of the NTP server to be used by the module.";
  }

  string getMoreInfo()
  {
    return "Use an empty string to restore the factory set address. Remember to call the saveToFlash() method and then to reboot the module to apply this setting.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(STRING_ARG, "newval", "a string corresponding to the IP address of the NTP server to be used by the module", "_STRING", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_ntpServer(string((*args)[0]->get_stringValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns a hash string if a password has been set for "user" user,
 * or an empty string otherwise.
 *
 * @return a string corresponding to a hash string if a password has been set for "user" user,
 *         or an empty string otherwise
 *
 * On failure, throws an exception or returns YNetwork.USERPASSWORD_INVALID.
 */
class Network_get_userPassword : public YapiCommand /* arguments: */
{
public:
  Network_get_userPassword(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_userPassword";
  }

  string getDescription()
  {
    return "Returns a hash string if a password has been set for \"user\" user,or an empty string otherwise.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_userPassword();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the password for the "user" user. This password becomes instantly required
 * to perform any use of the module. If the specified value is an
 * empty string, a password is not required anymore.
 * Remember to call the saveToFlash() method of the module if the
 * modification must be kept.
 *
 * @param newval : a string corresponding to the password for the "user" user
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_userPassword : public YapiCommand /* arguments: newval */
{
public:
  Network_set_userPassword(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_userPassword";
  }

  string getDescription()
  {
    return "Changes the password for the \"user\" user.";
  }

  string getMoreInfo()
  {
    return "This password becomes instantly required to perform any use of the module. If the specified value is an empty string, a password is not required anymore. Remember to call \"YModule {target} saveToFlash\" if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(STRING_ARG, "newval", "a string corresponding to the password for the \"user\" user", "_STRING", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_userPassword(string((*args)[0]->get_stringValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns a hash string if a password has been set for user "admin",
 * or an empty string otherwise.
 *
 * @return a string corresponding to a hash string if a password has been set for user "admin",
 *         or an empty string otherwise
 *
 * On failure, throws an exception or returns YNetwork.ADMINPASSWORD_INVALID.
 */
class Network_get_adminPassword : public YapiCommand /* arguments: */
{
public:
  Network_get_adminPassword(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_adminPassword";
  }

  string getDescription()
  {
    return "Returns a hash string if a password has been set for user \"admin\",or an empty string otherwise.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_adminPassword();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the password for the "admin" user. This password becomes instantly required
 * to perform any change of the module state. If the specified value is an
 * empty string, a password is not required anymore.
 * Remember to call the saveToFlash() method of the module if the
 * modification must be kept.
 *
 * @param newval : a string corresponding to the password for the "admin" user
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_adminPassword : public YapiCommand /* arguments: newval */
{
public:
  Network_set_adminPassword(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_adminPassword";
  }

  string getDescription()
  {
    return "Changes the password for the \"admin\" user.";
  }

  string getMoreInfo()
  {
    return "This password becomes instantly required to perform any change of the module state. If the specified value is an empty string, a password is not required anymore. Remember to call \"YModule {target} saveToFlash\" if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(STRING_ARG, "newval", "a string corresponding to the password for the \"admin\" user", "_STRING", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_adminPassword(string((*args)[0]->get_stringValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns the TCP port used to serve the hub web UI.
 *
 * @return an integer corresponding to the TCP port used to serve the hub web UI
 *
 * On failure, throws an exception or returns YNetwork.HTTPPORT_INVALID.
 */
class Network_get_httpPort : public YapiCommand /* arguments: */
{
public:
  Network_get_httpPort(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_httpPort";
  }

  string getDescription()
  {
    return "Returns the TCP port used to serve the hub web UI.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        int attrval = (*list)[i]->get_httpPort();
        char buf[32]; SAFE_SPRINTF(buf, 32, "%d", attrval); string strval =  string(buf);
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the the TCP port used to serve the hub web UI. The default value is port 80,
 * which is the default for all Web servers. Regardless of the value set here,
 * the hub will always reply on port 4444, which is used by default by Yoctopuce
 * API library. When you change this parameter, remember to call the saveToFlash()
 * method of the module if the modification must be kept.
 *
 * @param newval : an integer corresponding to the the TCP port used to serve the hub web UI
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_httpPort : public YapiCommand /* arguments: newval */
{
public:
  Network_set_httpPort(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_httpPort";
  }

  string getDescription()
  {
    return "Changes the the TCP port used to serve the hub web UI.";
  }

  string getMoreInfo()
  {
    return "The default value is port 80, which is the default for all Web servers. Regardless of the value set here, the hub will always reply on port 4444, which is used by default by Yoctopuce API library. When you change this parameter, remember to call the saveToFlash() method of the module if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(INT_ARG, "newval", "an integer corresponding to the the TCP port used to serve the hub web UI", "_INT", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_httpPort(int((*args)[0]->get_intValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns the secure TCP port used to serve the hub web UI.
 *
 * @return an integer corresponding to the secure TCP port used to serve the hub web UI
 *
 * On failure, throws an exception or returns YNetwork.HTTPSPORT_INVALID.
 */
class Network_get_httpsPort : public YapiCommand /* arguments: */
{
public:
  Network_get_httpsPort(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_httpsPort";
  }

  string getDescription()
  {
    return "Returns the secure TCP port used to serve the hub web UI.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        int attrval = (*list)[i]->get_httpsPort();
        char buf[32]; SAFE_SPRINTF(buf, 32, "%d", attrval); string strval =  string(buf);
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the secure TCP port used to serve the hub web UI. The default value is port 4443,
 * which is the default for all Web servers. When you change this parameter, remember to call the saveToFlash()
 * method of the module if the modification must be kept.
 *
 * @param newval : an integer corresponding to the secure TCP port used to serve the hub web UI
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_httpsPort : public YapiCommand /* arguments: newval */
{
public:
  Network_set_httpsPort(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_httpsPort";
  }

  string getDescription()
  {
    return "Changes the secure TCP port used to serve the hub web UI.";
  }

  string getMoreInfo()
  {
    return "The default value is port 4443, which is the default for all Web servers. When you change this parameter, remember to call the saveToFlash() method of the module if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(INT_ARG, "newval", "an integer corresponding to the secure TCP port used to serve the hub web UI", "_INT", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_httpsPort(int((*args)[0]->get_intValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns the security level chosen to prevent unauthorized access to the server.
 *
 * @return a value among YNetwork.SECURITYMODE_UNDEFINED, YNetwork.SECURITYMODE_LEGACY,
 * YNetwork.SECURITYMODE_MIXED and YNetwork.SECURITYMODE_SECURE corresponding to the security level
 * chosen to prevent unauthorized access to the server
 *
 * On failure, throws an exception or returns YNetwork.SECURITYMODE_INVALID.
 */
class Network_get_securityMode : public YapiCommand /* arguments: */
{
public:
  Network_get_securityMode(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_securityMode";
  }

  string getDescription()
  {
    return "Returns the security level chosen to prevent unauthorized access to the server.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        int attrval = (*list)[i]->get_securityMode();
        string strval =  enumString(attrval,enumSecurityMode);
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the security level used to prevent unauthorized access to the server.
 * The value UNDEFINED causes the security configuration wizard to be
 * displayed the next time you log on to the Web console.
 * The value LEGACY offers unencrypted HTTP access by default, and
 * is designed to provide compatibility with legacy applications that do not
 * handle password or do not support HTTPS. But it should
 * only be used when system security is guaranteed by other means, such as the
 * use of a firewall.
 * The value MIXED requires the configuration of passwords, and allows
 * access via both HTTP (unencrypted) and HTTPS (encrypted), while requiring
 * the Yoctopuce API to be tolerant of certificate characteristics.
 * The value SECURE requires the configuration of passwords and the
 * use of secure communications in all cases.
 * When you change this parameter, remember to call the saveToFlash()
 * method of the module if the modification must be kept.
 *
 * @param newval : a value among YNetwork.SECURITYMODE_UNDEFINED, YNetwork.SECURITYMODE_LEGACY,
 * YNetwork.SECURITYMODE_MIXED and YNetwork.SECURITYMODE_SECURE corresponding to the security level
 * used to prevent unauthorized access to the server
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_securityMode : public YapiCommand /* arguments: newval */
{
public:
  Network_set_securityMode(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_securityMode";
  }

  string getDescription()
  {
    return "Changes the security level used to prevent unauthorized access to the server.";
  }

  string getMoreInfo()
  {
    return "The value UNDEFINED causes the security configuration wizard to be displayed the next time you log on to the Web console. The value LEGACY offers unencrypted HTTP access by default, and is designed to provide compatibility with legacy applications that do not handle password or do not support HTTPS. But it should only be used when system security is guaranteed by other means, such as the use of a firewall. The value MIXED requires the configuration of passwords, and allows access via both HTTP (unencrypted) and HTTPS (encrypted), while requiring the Yoctopuce API to be tolerant of certificate characteristics. The value SECURE requires the configuration of passwords and the use of secure communications in all cases. When you change this parameter, remember to call the saveToFlash() method of the module if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(INT_ARG, "newval", "a value among UNDEFINED, LEGACY, MIXED and SECURE corresponding to the security level used to prevent unauthorized access to the server", "UNDEFINED=0,LEGACY=1,MIXED=2,SECURE=3", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_securityMode(Y_SECURITYMODE_enum((*args)[0]->get_intValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns the HTML page to serve for the URL "/"" of the hub.
 *
 * @return a string corresponding to the HTML page to serve for the URL "/"" of the hub
 *
 * On failure, throws an exception or returns YNetwork.DEFAULTPAGE_INVALID.
 */
class Network_get_defaultPage : public YapiCommand /* arguments: */
{
public:
  Network_get_defaultPage(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_defaultPage";
  }

  string getDescription()
  {
    return "Returns the HTML page to serve for the URL \"/\"\" of the hub.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_defaultPage();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the default HTML page returned by the hub. If not value are set the hub return
 * "index.html" which is the web interface of the hub. It is possible to change this page
 * for file that has been uploaded on the hub. The maximum filename size is 15 characters.
 * When you change this parameter, remember to call the saveToFlash()
 * method of the module if the modification must be kept.
 *
 * @param newval : a string corresponding to the default HTML page returned by the hub
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_defaultPage : public YapiCommand /* arguments: newval */
{
public:
  Network_set_defaultPage(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_defaultPage";
  }

  string getDescription()
  {
    return "Changes the default HTML page returned by the hub.";
  }

  string getMoreInfo()
  {
    return "If not value are set the hub return \"index.html\" which is the web interface of the hub. It is possible to change this page for file that has been uploaded on the hub. The maximum filename size is 15 characters. When you change this parameter, remember to call the saveToFlash() method of the module if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(STRING_ARG, "newval", "a string corresponding to the default HTML page returned by the hub", "_STRING", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_defaultPage(string((*args)[0]->get_stringValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns the activation state of the multicast announce protocols to allow easy
 * discovery of the module in the network neighborhood (uPnP/Bonjour protocol).
 *
 * @return either YNetwork.DISCOVERABLE_FALSE or YNetwork.DISCOVERABLE_TRUE, according to the
 * activation state of the multicast announce protocols to allow easy
 *         discovery of the module in the network neighborhood (uPnP/Bonjour protocol)
 *
 * On failure, throws an exception or returns YNetwork.DISCOVERABLE_INVALID.
 */
class Network_get_discoverable : public YapiCommand /* arguments: */
{
public:
  Network_get_discoverable(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_discoverable";
  }

  string getDescription()
  {
    return "Returns the activation state of the multicast announce protocols to allow easydiscovery of the module in the network neighborhood (uPnP/Bonjour protocol).";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        int attrval = (*list)[i]->get_discoverable();
        string strval =  enumString(attrval,enumBool);
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the activation state of the multicast announce protocols to allow easy
 * discovery of the module in the network neighborhood (uPnP/Bonjour protocol).
 * Remember to call the saveToFlash()
 * method of the module if the modification must be kept.
 *
 * @param newval : either YNetwork.DISCOVERABLE_FALSE or YNetwork.DISCOVERABLE_TRUE, according to the
 * activation state of the multicast announce protocols to allow easy
 *         discovery of the module in the network neighborhood (uPnP/Bonjour protocol)
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_discoverable : public YapiCommand /* arguments: newval */
{
public:
  Network_set_discoverable(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_discoverable";
  }

  string getDescription()
  {
    return "Changes the activation state of the multicast announce protocols to allow easydiscovery of the module in the network neighborhood (uPnP/Bonjour protocol).";
  }

  string getMoreInfo()
  {
    return "Remember to call the saveToFlash() method of the module if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(INT_ARG, "newval", "either FALSE or TRUE, according to the activation state of the multicast announce protocols to allow easy discovery of the module in the network neighborhood (uPnP/Bonjour protocol)", "FALSE=0,TRUE=1", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_discoverable(Y_DISCOVERABLE_enum((*args)[0]->get_intValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns the allowed downtime of the WWW link (in seconds) before triggering an automated
 * reboot to try to recover Internet connectivity. A zero value disables automated reboot
 * in case of Internet connectivity loss.
 *
 * @return an integer corresponding to the allowed downtime of the WWW link (in seconds) before
 * triggering an automated
 *         reboot to try to recover Internet connectivity
 *
 * On failure, throws an exception or returns YNetwork.WWWWATCHDOGDELAY_INVALID.
 */
class Network_get_wwwWatchdogDelay : public YapiCommand /* arguments: */
{
public:
  Network_get_wwwWatchdogDelay(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_wwwWatchdogDelay";
  }

  string getDescription()
  {
    return "Returns the allowed downtime of the WWW link (in seconds) before triggering an automatedreboot to try to recover Internet connectivity.";
  }

  string getMoreInfo()
  {
    return "A zero value disables automated reboot in case of Internet connectivity loss.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        int attrval = (*list)[i]->get_wwwWatchdogDelay();
        char buf[32]; SAFE_SPRINTF(buf, 32, "%d", attrval); string strval =  string(buf);
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the allowed downtime of the WWW link (in seconds) before triggering an automated
 * reboot to try to recover Internet connectivity. A zero value disables automated reboot
 * in case of Internet connectivity loss. The smallest valid non-zero timeout is
 * 90 seconds. Remember to call the saveToFlash()
 * method of the module if the modification must be kept.
 *
 * @param newval : an integer corresponding to the allowed downtime of the WWW link (in seconds)
 * before triggering an automated
 *         reboot to try to recover Internet connectivity
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_wwwWatchdogDelay : public YapiCommand /* arguments: newval */
{
public:
  Network_set_wwwWatchdogDelay(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_wwwWatchdogDelay";
  }

  string getDescription()
  {
    return "Changes the allowed downtime of the WWW link (in seconds) before triggering an automatedreboot to try to recover Internet connectivity.";
  }

  string getMoreInfo()
  {
    return "A zero value disables automated reboot in case of Internet connectivity loss. The smallest valid non-zero timeout is 90 seconds. Remember to call the saveToFlash() method of the module if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(INT_ARG, "newval", "an integer corresponding to the allowed downtime of the WWW link (in seconds) before triggering an automated reboot to try to recover Internet connectivity", "_INT", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_wwwWatchdogDelay(int((*args)[0]->get_intValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns the callback URL to notify of significant state changes.
 *
 * @return a string corresponding to the callback URL to notify of significant state changes
 *
 * On failure, throws an exception or returns YNetwork.CALLBACKURL_INVALID.
 */
class Network_get_callbackUrl : public YapiCommand /* arguments: */
{
public:
  Network_get_callbackUrl(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_callbackUrl";
  }

  string getDescription()
  {
    return "Returns the callback URL to notify of significant state changes.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_callbackUrl();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the callback URL to notify significant state changes. Remember to call the
 * saveToFlash() method of the module if the modification must be kept.
 *
 * @param newval : a string corresponding to the callback URL to notify significant state changes
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_callbackUrl : public YapiCommand /* arguments: newval */
{
public:
  Network_set_callbackUrl(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_callbackUrl";
  }

  string getDescription()
  {
    return "Changes the callback URL to notify significant state changes.";
  }

  string getMoreInfo()
  {
    return "Remember to call the saveToFlash() method of the module if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(STRING_ARG, "newval", "a string corresponding to the callback URL to notify significant state changes", "_STRING", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_callbackUrl(string((*args)[0]->get_stringValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns the HTTP method used to notify callbacks for significant state changes.
 *
 * @return a value among YNetwork.CALLBACKMETHOD_POST, YNetwork.CALLBACKMETHOD_GET and
 * YNetwork.CALLBACKMETHOD_PUT corresponding to the HTTP method used to notify callbacks for
 * significant state changes
 *
 * On failure, throws an exception or returns YNetwork.CALLBACKMETHOD_INVALID.
 */
class Network_get_callbackMethod : public YapiCommand /* arguments: */
{
public:
  Network_get_callbackMethod(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_callbackMethod";
  }

  string getDescription()
  {
    return "Returns the HTTP method used to notify callbacks for significant state changes.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        int attrval = (*list)[i]->get_callbackMethod();
        string strval =  enumString(attrval,enumHTTPMethod);
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the HTTP method used to notify callbacks for significant state changes.
 * Remember to call the saveToFlash() method of the module if the
 * modification must be kept.
 *
 * @param newval : a value among YNetwork.CALLBACKMETHOD_POST, YNetwork.CALLBACKMETHOD_GET and
 * YNetwork.CALLBACKMETHOD_PUT corresponding to the HTTP method used to notify callbacks for
 * significant state changes
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_callbackMethod : public YapiCommand /* arguments: newval */
{
public:
  Network_set_callbackMethod(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_callbackMethod";
  }

  string getDescription()
  {
    return "Changes the HTTP method used to notify callbacks for significant state changes.";
  }

  string getMoreInfo()
  {
    return "Remember to call \"YModule {target} saveToFlash\" if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(INT_ARG, "newval", "a value among POST, GET and PUT corresponding to the HTTP method used to notify callbacks for significant state changes", "POST=0,GET=1,PUT=2", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_callbackMethod(Y_CALLBACKMETHOD_enum((*args)[0]->get_intValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns the encoding standard to use for representing notification values.
 *
 * @return a value among YNetwork.CALLBACKENCODING_FORM, YNetwork.CALLBACKENCODING_JSON,
 * YNetwork.CALLBACKENCODING_JSON_ARRAY, YNetwork.CALLBACKENCODING_CSV,
 * YNetwork.CALLBACKENCODING_YOCTO_API, YNetwork.CALLBACKENCODING_JSON_NUM,
 * YNetwork.CALLBACKENCODING_EMONCMS, YNetwork.CALLBACKENCODING_AZURE,
 * YNetwork.CALLBACKENCODING_INFLUXDB, YNetwork.CALLBACKENCODING_MQTT,
 * YNetwork.CALLBACKENCODING_YOCTO_API_JZON, YNetwork.CALLBACKENCODING_PRTG and
 * YNetwork.CALLBACKENCODING_INFLUXDB_V2 corresponding to the encoding standard to use for
 * representing notification values
 *
 * On failure, throws an exception or returns YNetwork.CALLBACKENCODING_INVALID.
 */
class Network_get_callbackEncoding : public YapiCommand /* arguments: */
{
public:
  Network_get_callbackEncoding(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_callbackEncoding";
  }

  string getDescription()
  {
    return "Returns the encoding standard to use for representing notification values.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        int attrval = (*list)[i]->get_callbackEncoding();
        string strval =  enumString(attrval,enumCallbackEncoding);
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the encoding standard to use for representing notification values.
 * Remember to call the saveToFlash() method of the module if the
 * modification must be kept.
 *
 * @param newval : a value among YNetwork.CALLBACKENCODING_FORM, YNetwork.CALLBACKENCODING_JSON,
 * YNetwork.CALLBACKENCODING_JSON_ARRAY, YNetwork.CALLBACKENCODING_CSV,
 * YNetwork.CALLBACKENCODING_YOCTO_API, YNetwork.CALLBACKENCODING_JSON_NUM,
 * YNetwork.CALLBACKENCODING_EMONCMS, YNetwork.CALLBACKENCODING_AZURE,
 * YNetwork.CALLBACKENCODING_INFLUXDB, YNetwork.CALLBACKENCODING_MQTT,
 * YNetwork.CALLBACKENCODING_YOCTO_API_JZON, YNetwork.CALLBACKENCODING_PRTG and
 * YNetwork.CALLBACKENCODING_INFLUXDB_V2 corresponding to the encoding standard to use for
 * representing notification values
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_callbackEncoding : public YapiCommand /* arguments: newval */
{
public:
  Network_set_callbackEncoding(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_callbackEncoding";
  }

  string getDescription()
  {
    return "Changes the encoding standard to use for representing notification values.";
  }

  string getMoreInfo()
  {
    return "Remember to call \"YModule {target} saveToFlash\" if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(INT_ARG, "newval", "a value among FORM, JSON, JSON_ARRAY, CSV, YOCTO_API, JSON_NUM, EMONCMS, AZURE, INFLUXDB, MQTT, YOCTO_API_JZON, PRTG and INFLUXDB_V2 corresponding to the encoding standard to use for representing notification values", "FORM=0,JSON=1,JSON_ARRAY=2,CSV=3,YOCTO_API=4,JSON_NUM=5,EMONCMS=6,AZURE=7,INFLUXDB=8,MQTT=9,YOCTO_API_JZON=10,PRTG=11,INFLUXDB_V2=12", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_callbackEncoding(Y_CALLBACKENCODING_enum((*args)[0]->get_intValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns the activation state of the custom template file to customize callback
 * format. If the custom callback template is disabled, it will be ignored even
 * if present on the YoctoHub.
 *
 * @return either YNetwork.CALLBACKTEMPLATE_OFF or YNetwork.CALLBACKTEMPLATE_ON, according to the
 * activation state of the custom template file to customize callback
 *         format
 *
 * On failure, throws an exception or returns YNetwork.CALLBACKTEMPLATE_INVALID.
 */
class Network_get_callbackTemplate : public YapiCommand /* arguments: */
{
public:
  Network_get_callbackTemplate(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_callbackTemplate";
  }

  string getDescription()
  {
    return "Returns the activation state of the custom template file to customize callbackformat.";
  }

  string getMoreInfo()
  {
    return "If the custom callback template is disabled, it will be ignored even if present on the YoctoHub.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        int attrval = (*list)[i]->get_callbackTemplate();
        string strval =  enumString(attrval,enumOnOff);
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Enable the use of a template file to customize callbacks format.
 * When the custom callback template file is enabled, the template file
 * will be loaded for each callback in order to build the data to post to the
 * server. If template file does not exist on the YoctoHub, the callback will
 * fail with an error message indicating the name of the expected template file.
 * Remember to call the saveToFlash() method of the module if the
 * modification must be kept.
 *
 * @param newval : either YNetwork.CALLBACKTEMPLATE_OFF or YNetwork.CALLBACKTEMPLATE_ON
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_callbackTemplate : public YapiCommand /* arguments: newval */
{
public:
  Network_set_callbackTemplate(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_callbackTemplate";
  }

  string getDescription()
  {
    return "Enable the use of a template file to customize callbacks format.";
  }

  string getMoreInfo()
  {
    return "When the custom callback template file is enabled, the template file will be loaded for each callback in order to build the data to post to the server. If template file does not exist on the YoctoHub, the callback will fail with an error message indicating the name of the expected template file. Remember to call \"YModule {target} saveToFlash\" if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(INT_ARG, "newval", "either OFF or ON", "OFF=0,ON=1", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_callbackTemplate(Y_CALLBACKTEMPLATE_enum((*args)[0]->get_intValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns a hashed version of the notification callback credentials if set,
 * or an empty string otherwise.
 *
 * @return a string corresponding to a hashed version of the notification callback credentials if set,
 *         or an empty string otherwise
 *
 * On failure, throws an exception or returns YNetwork.CALLBACKCREDENTIALS_INVALID.
 */
class Network_get_callbackCredentials : public YapiCommand /* arguments: */
{
public:
  Network_get_callbackCredentials(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_callbackCredentials";
  }

  string getDescription()
  {
    return "Returns a hashed version of the notification callback credentials if set,or an empty string otherwise.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_callbackCredentials();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the credentials required to connect to the callback address. The credentials
 * must be provided as returned by function get_callbackCredentials,
 * in the form username:hash. The method used to compute the hash varies according
 * to the the authentication scheme implemented by the callback, For Basic authentication,
 * the hash is the MD5 of the string username:password. For Digest authentication,
 * the hash is the MD5 of the string username:realm:password. For a simpler
 * way to configure callback credentials, use function callbackLogin instead.
 * Remember to call the saveToFlash() method of the module if the
 * modification must be kept.
 *
 * @param newval : a string corresponding to the credentials required to connect to the callback address
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_callbackCredentials : public YapiCommand /* arguments: newval */
{
public:
  Network_set_callbackCredentials(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_callbackCredentials";
  }

  string getDescription()
  {
    return "Changes the credentials required to connect to the callback address.";
  }

  string getMoreInfo()
  {
    return "The credentials must be provided as returned by function get_callbackCredentials, in the form username:hash. The method used to compute the hash varies according to the the authentication scheme implemented by the callback, For Basic authentication, the hash is the MD5 of the string username:password. For Digest authentication, the hash is the MD5 of the string username:realm:password. For a simpler way to configure callback credentials, use function callbackLogin instead. Remember to call \"YModule {target} saveToFlash\" if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(STRING_ARG, "newval", "a string corresponding to the credentials required to connect to the callback address", "_STRING", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_callbackCredentials(string((*args)[0]->get_stringValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Connects to the notification callback and saves the credentials required to
 * log into it. The password is not stored into the module, only a hashed
 * copy of the credentials are saved. Remember to call the
 * saveToFlash() method of the module if the modification must be kept.
 *
 * @param username : username required to log to the callback
 * @param password : password required to log to the callback
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class alias_Network_callbackLogin : public YapiCommand /* arguments: username password */
{
public:
  alias_Network_callbackLogin(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "callbackLogin";
  }

  string getDescription()
  {
    return "Connects to the notification callback and saves the credentials required tolog into it.";
  }

  string getMoreInfo()
  {
    return "The password is not stored into the module, only a hashed copy of the credentials are saved. Remember to call the saveToFlash() method of the module if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(STRING_ARG, "username", "username required to log to the callback", "_STRING", false));
    res->push_back(new ArgumentDesc(STRING_ARG, "password", "password required to log to the callback", "_STRING", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = "";
    value = value +  (*args)[0]->to_str();
    value = value + " "+ (*args)[1]->to_str();
    for (i = 0; i < list->size(); i++)
      {
        (*list)[i]->callbackLogin((*args)[0]->get_stringValue(),
                                  (*args)[1]->get_stringValue());
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
      }
  }
};

/**
 * Returns the initial waiting time before first callback notifications, in seconds.
 *
 * @return an integer corresponding to the initial waiting time before first callback notifications, in seconds
 *
 * On failure, throws an exception or returns YNetwork.CALLBACKINITIALDELAY_INVALID.
 */
class Network_get_callbackInitialDelay : public YapiCommand /* arguments: */
{
public:
  Network_get_callbackInitialDelay(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_callbackInitialDelay";
  }

  string getDescription()
  {
    return "Returns the initial waiting time before first callback notifications, in seconds.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        int attrval = (*list)[i]->get_callbackInitialDelay();
        char buf[32]; SAFE_SPRINTF(buf, 32, "%d", attrval); string strval =  string(buf);
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the initial waiting time before first callback notifications, in seconds.
 * Remember to call the saveToFlash() method of the module if the modification must be kept.
 *
 * @param newval : an integer corresponding to the initial waiting time before first callback
 * notifications, in seconds
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_callbackInitialDelay : public YapiCommand /* arguments: newval */
{
public:
  Network_set_callbackInitialDelay(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_callbackInitialDelay";
  }

  string getDescription()
  {
    return "Changes the initial waiting time before first callback notifications, in seconds.";
  }

  string getMoreInfo()
  {
    return "Remember to call \"YModule {target} saveToFlash\" if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(INT_ARG, "newval", "an integer corresponding to the initial waiting time before first callback notifications, in seconds", "_INT", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_callbackInitialDelay(int((*args)[0]->get_intValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns the HTTP callback schedule strategy, as a text string.
 *
 * @return a string corresponding to the HTTP callback schedule strategy, as a text string
 *
 * On failure, throws an exception or returns YNetwork.CALLBACKSCHEDULE_INVALID.
 */
class Network_get_callbackSchedule : public YapiCommand /* arguments: */
{
public:
  Network_get_callbackSchedule(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_callbackSchedule";
  }

  string getDescription()
  {
    return "Returns the HTTP callback schedule strategy, as a text string.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string attrval = (*list)[i]->get_callbackSchedule();
        string strval =  attrval;
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the HTTP callback schedule strategy, as a text string.
 * Remember to call the saveToFlash()
 * method of the module if the modification must be kept.
 *
 * @param newval : a string corresponding to the HTTP callback schedule strategy, as a text string
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_callbackSchedule : public YapiCommand /* arguments: newval */
{
public:
  Network_set_callbackSchedule(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_callbackSchedule";
  }

  string getDescription()
  {
    return "Changes the HTTP callback schedule strategy, as a text string.";
  }

  string getMoreInfo()
  {
    return "Remember to call the saveToFlash() method of the module if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(STRING_ARG, "newval", "a string corresponding to the HTTP callback schedule strategy, as a text string", "_STRING", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_callbackSchedule(string((*args)[0]->get_stringValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns the minimum waiting time between two HTTP callbacks, in seconds.
 *
 * @return an integer corresponding to the minimum waiting time between two HTTP callbacks, in seconds
 *
 * On failure, throws an exception or returns YNetwork.CALLBACKMINDELAY_INVALID.
 */
class Network_get_callbackMinDelay : public YapiCommand /* arguments: */
{
public:
  Network_get_callbackMinDelay(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_callbackMinDelay";
  }

  string getDescription()
  {
    return "Returns the minimum waiting time between two HTTP callbacks, in seconds.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        int attrval = (*list)[i]->get_callbackMinDelay();
        char buf[32]; SAFE_SPRINTF(buf, 32, "%d", attrval); string strval =  string(buf);
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the minimum waiting time between two HTTP callbacks, in seconds.
 * Remember to call the saveToFlash() method of the module if the modification must be kept.
 *
 * @param newval : an integer corresponding to the minimum waiting time between two HTTP callbacks, in seconds
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_callbackMinDelay : public YapiCommand /* arguments: newval */
{
public:
  Network_set_callbackMinDelay(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_callbackMinDelay";
  }

  string getDescription()
  {
    return "Changes the minimum waiting time between two HTTP callbacks, in seconds.";
  }

  string getMoreInfo()
  {
    return "Remember to call \"YModule {target} saveToFlash\" if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(INT_ARG, "newval", "an integer corresponding to the minimum waiting time between two HTTP callbacks, in seconds", "_INT", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_callbackMinDelay(int((*args)[0]->get_intValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns the waiting time between two HTTP callbacks when there is nothing new.
 *
 * @return an integer corresponding to the waiting time between two HTTP callbacks when there is nothing new
 *
 * On failure, throws an exception or returns YNetwork.CALLBACKMAXDELAY_INVALID.
 */
class Network_get_callbackMaxDelay : public YapiCommand /* arguments: */
{
public:
  Network_get_callbackMaxDelay(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_callbackMaxDelay";
  }

  string getDescription()
  {
    return "Returns the waiting time between two HTTP callbacks when there is nothing new.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        int attrval = (*list)[i]->get_callbackMaxDelay();
        char buf[32]; SAFE_SPRINTF(buf, 32, "%d", attrval); string strval =  string(buf);
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

/**
 * Changes the waiting time between two HTTP callbacks when there is nothing new.
 * Remember to call the saveToFlash() method of the module if the modification must be kept.
 *
 * @param newval : an integer corresponding to the waiting time between two HTTP callbacks when there
 * is nothing new
 *
 * @return YAPI.SUCCESS if the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class Network_set_callbackMaxDelay : public YapiCommand /* arguments: newval */
{
public:
  Network_set_callbackMaxDelay(YFunctionCmdLine *function):YapiCommand(function){}
  string getName()
  {
    return "set_callbackMaxDelay";
  }

  string getDescription()
  {
    return "Changes the waiting time between two HTTP callbacks when there is nothing new.";
  }

  string getMoreInfo()
  {
    return "Remember to call \"YModule {target} saveToFlash\" if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(INT_ARG, "newval", "an integer corresponding to the waiting time between two HTTP callbacks when there is nothing new", "_INT", false));
    return res;
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = (*args)[0]->to_str();
    for (i = 0; i < list->size(); i++) {
        (*list)[i]->set_callbackMaxDelay(int((*args)[0]->get_intValue()));
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
    }
  }
};

/**
 * Returns the current consumed by the module from Power-over-Ethernet (PoE), in milliamps.
 * The current consumption is measured after converting PoE source to 5 Volt, and should
 * never exceed 1800 mA.
 *
 * @return an integer corresponding to the current consumed by the module from Power-over-Ethernet
 * (PoE), in milliamps
 *
 * On failure, throws an exception or returns YNetwork.POECURRENT_INVALID.
 */
class Network_get_poeCurrent : public YapiCommand /* arguments: */
{
public:
  Network_get_poeCurrent(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_poeCurrent";
  }

  string getDescription()
  {
    return "Returns the current consumed by the module from Power-over-Ethernet (PoE), in milliamps.";
  }

  string getMoreInfo()
  {
    return "The current consumption is measured after converting PoE source to 5 Volt, and should never exceed 1800 mA.";
  }

  void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches )
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        int attrval = (*list)[i]->get_poeCurrent();
        char buf[32]; SAFE_SPRINTF(buf, 32, "%d [mA]", attrval); string strval =  string(buf);
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), strval, true);
      }
  }
};

// type of valueCallbackNetwork is YNetworkValueCallback* (YNetworkValueCallback)
/**
 * Disables the propagation of every new advertised value to the parent hub.
 * You can use this function to save bandwidth and CPU on computers with limited
 * resources, or to prevent unwanted invocations of the HTTP callback.
 * Remember to call the saveToFlash() method of the module if the
 * modification must be kept.
 *
 * @return YAPI.SUCCESS when the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class apifun_Network_muteValueCallbacks : public YapiCommand /* arguments: */
{
public:
  apifun_Network_muteValueCallbacks(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "muteValueCallbacks";
  }

  string getDescription()
  {
    return "Disables the propagation of every new advertised value to the parent hub.";
  }

  string getMoreInfo()
  {
    return "You can use this function to save bandwidth and CPU on computers with limited resources, or to prevent unwanted invocations of the HTTP callback. Remember to call \"YModule {target} saveToFlash\" if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    return res;
  }

  virtual void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = "";
    for (i = 0; i < list->size(); i++)
      {
        (*list)[i]->muteValueCallbacks();
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
      }
  }
};

/**
 * Re-enables the propagation of every new advertised value to the parent hub.
 * This function reverts the effect of a previous call to muteValueCallbacks().
 * Remember to call the saveToFlash() method of the module if the
 * modification must be kept.
 *
 * @return YAPI.SUCCESS when the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class apifun_Network_unmuteValueCallbacks : public YapiCommand /* arguments: */
{
public:
  apifun_Network_unmuteValueCallbacks(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "unmuteValueCallbacks";
  }

  string getDescription()
  {
    return "Re-enables the propagation of every new advertised value to the parent hub.";
  }

  string getMoreInfo()
  {
    return "This function reverts the effect of a previous call to muteValueCallbacks(). Remember to call \"YModule {target} saveToFlash\" if the modification must be kept.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    return res;
  }

  virtual void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = "";
    for (i = 0; i < list->size(); i++)
      {
        (*list)[i]->unmuteValueCallbacks();
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
      }
  }
};

/**
 * Indicates whether changes to the function are prohibited or allowed.
 * Returns true if the function is blocked by an admin password
 * or if the function is not available.
 *
 * @return true if the function is write-protected or not online.
 */
class apifun_Network_isReadOnly : public YapiCommand /* arguments: */
{
public:
  apifun_Network_isReadOnly(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "isReadOnly";
  }

  string getDescription()
  {
    return "Indicates whether changes to the function are prohibited or allowed.";
  }

  string getMoreInfo()
  {
    return "Returns true if the function is blocked by an admin password or if the function is not available.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    return res;
  }

  virtual void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        bool value = (*list)[i]->isReadOnly();
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
      }
  }
};

/**
 * Returns the serial number of the module, as set by the factory.
 *
 * @return a string corresponding to the serial number of the module, as set by the factory.
 *
 * On failure, throws an exception or returns YFunction.SERIALNUMBER_INVALID.
 */
class apifun_Network_get_serialNumber : public YapiCommand /* arguments: */
{
public:
  apifun_Network_get_serialNumber(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "get_serialNumber";
  }

  string getDescription()
  {
    return "Returns the serial number of the module, as set by the factory.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    return res;
  }

  virtual void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string value = (*list)[i]->get_serialNumber();
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
      }
  }
};

/**
 * Changes the configuration of the network interface to enable the use of an
 * IP address received from a DHCP server. Until an address is received from a DHCP
 * server, the module uses the IP parameters specified to this function.
 * Remember to call the saveToFlash() method and then to reboot the module to apply this setting.
 *
 * @param fallbackIpAddr : fallback IP address, to be used when no DHCP reply is received
 * @param fallbackSubnetMaskLen : fallback subnet mask length when no DHCP reply is received, as an
 *         integer (e.g. 24 means 255.255.255.0)
 * @param fallbackRouter : fallback router IP address, to be used when no DHCP reply is received
 *
 * @return YAPI.SUCCESS when the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class apifun_Network_useDHCP : public YapiCommand /* arguments: fallbackIpAddr fallbackSubnetMaskLen fallbackRouter */
{
public:
  apifun_Network_useDHCP(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "useDHCP";
  }

  string getDescription()
  {
    return "Changes the configuration of the network interface to enable the use of anIP address received from a DHCP server.";
  }

  string getMoreInfo()
  {
    return "Until an address is received from a DHCP server, the module uses the IP parameters specified to this function. Remember to call the saveToFlash() method and then to reboot the module to apply this setting.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(STRING_ARG, "fallbackIpAddr", "fallback IP address, to be used when no DHCP reply is received", "_STRING", false));
    res->push_back(new ArgumentDesc(INT_ARG, "fallbackSubnetMaskLen", "fallback subnet mask length when no DHCP reply is received, as an integer (e.g. 24 means 255.255.255.0)", "_INT", false));
    res->push_back(new ArgumentDesc(STRING_ARG, "fallbackRouter", "fallback router IP address, to be used when no DHCP reply is received", "_STRING", false));
    return res;
  }

  virtual void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = "";
    value = value +  (*args)[0]->to_str();
    value = value + " "+ (*args)[1]->to_str();
    value = value + " "+ (*args)[2]->to_str();
    for (i = 0; i < list->size(); i++)
      {
        (*list)[i]->useDHCP((*args)[0]->get_stringValue(),
                            (int)(*args)[1]->get_intValue(),
                            (*args)[2]->get_stringValue());
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
      }
  }
};

/**
 * Changes the configuration of the network interface to enable the use of an
 * IP address received from a DHCP server. Until an address is received from a DHCP
 * server, the module uses an IP of the network 169.254.0.0/16 (APIPA).
 * Remember to call the saveToFlash() method and then to reboot the module to apply this setting.
 *
 * @return YAPI.SUCCESS when the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class apifun_Network_useDHCPauto : public YapiCommand /* arguments: */
{
public:
  apifun_Network_useDHCPauto(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "useDHCPauto";
  }

  string getDescription()
  {
    return "Changes the configuration of the network interface to enable the use of anIP address received from a DHCP server.";
  }

  string getMoreInfo()
  {
    return "Until an address is received from a DHCP server, the module uses an IP of the network 169.254.0.0/16 (APIPA). Remember to call the saveToFlash() method and then to reboot the module to apply this setting.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    return res;
  }

  virtual void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = "";
    for (i = 0; i < list->size(); i++)
      {
        (*list)[i]->useDHCPauto();
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
      }
  }
};

/**
 * Changes the configuration of the network interface to use a static IP address.
 * Remember to call the saveToFlash() method and then to reboot the module to apply this setting.
 *
 * @param ipAddress : device IP address
 * @param subnetMaskLen : subnet mask length, as an integer (e.g. 24 means 255.255.255.0)
 * @param router : router IP address (default gateway)
 *
 * @return YAPI.SUCCESS when the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class apifun_Network_useStaticIP : public YapiCommand /* arguments: ipAddress subnetMaskLen router */
{
public:
  apifun_Network_useStaticIP(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "useStaticIP";
  }

  string getDescription()
  {
    return "Changes the configuration of the network interface to use a static IP address.";
  }

  string getMoreInfo()
  {
    return "Remember to call the saveToFlash() method and then to reboot the module to apply this setting.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(STRING_ARG, "ipAddress", "device IP address", "_STRING", false));
    res->push_back(new ArgumentDesc(INT_ARG, "subnetMaskLen", "subnet mask length, as an integer (e.g. 24 means 255.255.255.0)", "_INT", false));
    res->push_back(new ArgumentDesc(STRING_ARG, "router", "router IP address (default gateway)", "_STRING", false));
    return res;
  }

  virtual void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = "";
    value = value +  (*args)[0]->to_str();
    value = value + " "+ (*args)[1]->to_str();
    value = value + " "+ (*args)[2]->to_str();
    for (i = 0; i < list->size(); i++)
      {
        (*list)[i]->useStaticIP((*args)[0]->get_stringValue(),
                                (int)(*args)[1]->get_intValue(),
                                (*args)[2]->get_stringValue());
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
      }
  }
};

/**
 * Pings host to test the network connectivity. Sends four ICMP ECHO_REQUEST requests from the
 * module to the target host. This method returns a string with the result of the
 * 4 ICMP ECHO_REQUEST requests.
 *
 * @param host : the hostname or the IP address of the target
 *
 * @return a string with the result of the ping.
 */
class apifun_Network_ping : public YapiCommand /* arguments: host */
{
public:
  apifun_Network_ping(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "ping";
  }

  string getDescription()
  {
    return "Pings host to test the network connectivity.";
  }

  string getMoreInfo()
  {
    return "Sends four ICMP ECHO_REQUEST requests from the module to the target host. This method returns a string with the result of the 4 ICMP ECHO_REQUEST requests.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(STRING_ARG, "host", "the hostname or the IP address of the target", "_STRING", false));
    return res;
  }

  virtual void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    for (i = 0; i < list->size(); i++)
      {
        string value = (*list)[i]->ping((*args)[0]->get_stringValue());
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
      }
  }
};

/**
 * Trigger an HTTP callback quickly. This function can even be called within
 * an HTTP callback, in which case the next callback will be triggered 5 seconds
 * after the end of the current callback, regardless if the minimum time between
 * callbacks configured in the device.
 *
 * @return YAPI.SUCCESS when the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class apifun_Network_triggerCallback : public YapiCommand /* arguments: */
{
public:
  apifun_Network_triggerCallback(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "triggerCallback";
  }

  string getDescription()
  {
    return "Trigger an HTTP callback quickly.";
  }

  string getMoreInfo()
  {
    return "This function can even be called within an HTTP callback, in which case the next callback will be triggered 5 seconds after the end of the current callback, regardless if the minimum time between callbacks configured in the device.";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    return res;
  }

  virtual void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = "";
    for (i = 0; i < list->size(); i++)
      {
        (*list)[i]->triggerCallback();
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
      }
  }
};

/**
 * Set up periodic HTTP callbacks (simplified function).
 *
 * @param interval : a string representing the callback periodicity, expressed in
 *         seconds, minutes or hours, eg. "60s", "5m", "1h", "48h".
 * @param offset : an integer representing the time offset relative to the period
 *         when the callback should occur. For instance, if the periodicity is
 *         24h, an offset of 7 will make the callback occur each day at 7AM.
 *
 * @return YAPI.SUCCESS when the call succeeds.
 *
 * On failure, throws an exception or returns a negative error code.
 */
class apifun_Network_set_periodicCallbackSchedule : public YapiCommand /* arguments: interval offset */
{
public:
  apifun_Network_set_periodicCallbackSchedule(YFunctionCmdLine *function):YapiCommand(function){}

  string getName()
  {
    return "set_periodicCallbackSchedule";
  }

  string getDescription()
  {
    return "Set up periodic HTTP callbacks (simplified function).";
  }

  vector<ArgumentDesc*>* getArgumentDesc()
  {
    vector<ArgumentDesc*>* res = new vector<ArgumentDesc*>();
    res->push_back(new ArgumentDesc(STRING_ARG, "interval", "a string representing the callback periodicity, expressed in seconds, minutes or hours, eg. \"60s\", \"5m\", \"1h\", \"48h\".", "_STRING", false));
    res->push_back(new ArgumentDesc(INT_ARG, "offset", "an integer representing the time offset relative to the period when the callback should occur. For instance, if the periodicity is 24h, an offset of 7 will make the callback occur each day at 7AM.", "_INT", false));
    return res;
  }

  virtual void execute(string target, vector<YModule*> *modulelist, string resultformat, vector<ArgumentDesc*>* args, vector<SwitchDesc*>* switches)
  {
    vector<YNetwork*>* list = enumerateTargets<YNetwork>(_function, target, modulelist);
    unsigned int i;
    string value = "";
    value = value +  (*args)[0]->to_str();
    value = value + " "+ (*args)[1]->to_str();
    for (i = 0; i < list->size(); i++)
      {
        (*list)[i]->set_periodicCallbackSchedule((*args)[0]->get_stringValue(),
                                                 (int)(*args)[1]->get_intValue());
        PrintResult(resultformat, this->getName(),YFunctionInfoCache((*list)[i]), value, true);
      }
  }
};

//--- (end of YNetwork implementation)

//--- (YNetwork functions)
void YNetworkCmdLine::RegisterCommands(vector<YapiCommand*>* cmdList)
  {
    RegisterGenericFunctions<YNetwork>(this, cmdList);
    cmdList->push_back((YapiCommand*) (new Network_get_logicalName(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_logicalName(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_advertisedValue(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_readiness(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_macAddress(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_ipAddress(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_subnetMask(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_router(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_currentDNS(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_ipConfig(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_primaryDNS(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_primaryDNS(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_secondaryDNS(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_secondaryDNS(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_ntpServer(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_ntpServer(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_userPassword(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_userPassword(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_adminPassword(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_adminPassword(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_httpPort(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_httpPort(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_httpsPort(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_httpsPort(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_securityMode(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_securityMode(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_defaultPage(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_defaultPage(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_discoverable(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_discoverable(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_wwwWatchdogDelay(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_wwwWatchdogDelay(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_callbackUrl(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_callbackUrl(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_callbackMethod(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_callbackMethod(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_callbackEncoding(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_callbackEncoding(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_callbackTemplate(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_callbackTemplate(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_callbackCredentials(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_callbackCredentials(this)));
    cmdList->push_back((YapiCommand*) (new alias_Network_callbackLogin(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_callbackInitialDelay(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_callbackInitialDelay(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_callbackSchedule(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_callbackSchedule(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_callbackMinDelay(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_callbackMinDelay(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_callbackMaxDelay(this)));
    cmdList->push_back((YapiCommand*) (new Network_set_callbackMaxDelay(this)));
    cmdList->push_back((YapiCommand*) (new Network_get_poeCurrent(this)));
    cmdList->push_back((YapiCommand*) (new apifun_Network_muteValueCallbacks(this)));
    cmdList->push_back((YapiCommand*) (new apifun_Network_unmuteValueCallbacks(this)));
    cmdList->push_back((YapiCommand*) (new apifun_Network_isReadOnly(this)));
    cmdList->push_back((YapiCommand*) (new apifun_Network_get_serialNumber(this)));
    cmdList->push_back((YapiCommand*) (new apifun_Network_useDHCP(this)));
    cmdList->push_back((YapiCommand*) (new apifun_Network_useDHCPauto(this)));
    cmdList->push_back((YapiCommand*) (new apifun_Network_useStaticIP(this)));
    cmdList->push_back((YapiCommand*) (new apifun_Network_ping(this)));
    cmdList->push_back((YapiCommand*) (new apifun_Network_triggerCallback(this)));
    cmdList->push_back((YapiCommand*) (new apifun_Network_set_periodicCallbackSchedule(this)));
  }

//--- (end of YNetwork functions)
