using IOB_UT;
using System;
using System.Collections.Generic;
namespace IOB_WIN
{
///
/// This Configuration class is basically just a set of
/// properties with a couple of static methods to manage
/// the serialization to and deserialization from a
/// simple XML file.
///
/// ref: http://www.cambiaresearch.com/articles/33/how-can-i-easily-manage-an-xml-configuration-file-in-dotnet
///
[Serializable]
public class IobConfiguration
{
///
/// Timeout test PING
///
public int pingMsTimeout { get; set; }
///
/// Vendor della macchina
///
public string vendor { get; set; }
///
/// Modello della macchina
///
public string model { get; set; }
///
/// Codice univoco IOB
///
public string codIOB { get; set; }
///
/// Versione IOB
///
public string versIOB { get; set; }
///
/// Indirizzo Ip del CNC Controllato
///
public string cncIpAddr { get; set; }
///
/// Porta del CNC Controllato
///
public string cncPort { get; set; }
///
/// Nome file di INI
///
public string iniFileName { get; set; }
///
/// TipoCPU (es: Siemens)
///
public string cpuType { get; set; }
///
/// Rack (Siemens S7)
///
public short rack { get; set; }
///
/// Slot (Siemens S7)
///
public short slot { get; set; }
///
/// Dati di conf del server MoonPro cui comunicare
///
public serverMapo serverData { get; set; }
///
/// Tipologia dell'adapter/CNC Controllato
///
public tipoAdapter tipoIob { get; set; }
///
/// Valore MAX per countdown segnali blinking
///
public int MAX_COUNTER_BLINK;
///
/// Valore intero corrispondente ai BIT da filtrare x blinking
///
public int BLINK_FILT;
///
/// Dizionario dei parametri opzionali
///
public Dictionary optPar;
///
/// Avvio configurazione DUMMY
///
public IobConfiguration()
{
vendor = "ND";
model = "ND";
codIOB = "ND";
versIOB = "0";
cncIpAddr = "127.0.0.1";
cncPort = "0";
iniFileName = "";
cpuType = "";
rack = 0;
slot = 0;
tipoIob = tipoAdapter.SIMULA;
serverData = new serverMapo("127.0.0.1", "/", "/IOB/input/", "/IOB/flog/", "/IOB", "/IOB/enabled/", "/sendReboot.aspx?idxMacchina=", "/IOB/getCurrOdlStart/");
MAX_COUNTER_BLINK = 10;
BLINK_FILT = 0;
optPar = new Dictionary();
}
}
public class serverMapo
{
///
/// Indirizzo IP server
///
public string MPIP = "";
///
/// URL Base del server applicativo
///
public string MPURL = "";
///
/// comando base x INPUT
///
public string CMDBASE = "";
///
/// comando base x LOG di FLUSSSO generico - salvataggio parametri extra sistema MAPO
///
public string CMDFLOG = "";
///
/// comando base x INPUT in modalità JSON payload come lista
///
public string CMDBASE_JSON = "";
///
/// comando base x LOG di FLUSSSO generico - salvataggio parametri extra sistema MAPO in modalità JSON payload come lista
///
public string CMDFLOG_JSON = "";
///
/// comando base x check ALIVE
///
public string CMDALIVE = "";
///
/// comando base x check ENABLED
///
public string CMDENABLED = "";
///
/// comando base x check avvio ODL
///
public string CMD_ODL_STARTED = "";
///
/// comando base x check avvio ODL
///
public string CMD_FORCLE_SPLIT_ODL = "";
///
/// comando base x check IDLE time IOB
///
public string CMD_IDLE_TIME = "";
///
/// comando base x comando reboot
///
public string CMDREBO = "";
///
/// Parametri configurazione server MoonPro cui inviare dati
///
/// Indirizzo IP del server MoonPro
/// URL Base server applicativo
/// Comando x invio INPUT
/// Comando x invio LOG per FLUSSO generico
/// Comando x check alive
/// Comando x check abilitato
/// Comando x reboot
/// Comando x check data avvio ODL
/// Comando x forzare split ODL
public serverMapo(string MPIP_, string MPURL_ = "/MP/IO", string CMDBASE_ = "/IOB/input/", string CMDFLOG_ = "/IOB/flog/", string CMDALIVE_ = "IOB", string CMDENABLED_ = "/IOB/enabled/", string CMDREBO_ = "/sendReboot.aspx?idxMacchina=", string CMD_ODL_STARTED_ = "/IOB/getCurrOdlStart/", string CMD_FORCLE_SPLIT_ODL_ = "/IOB/forceSplitOdl/", string CMD_IDLE_TIME_ = "/IOB/getIdlePeriod/")
{
MPIP = MPIP_.Replace("http://", ""); // tolgo http...
MPURL = MPURL_;
CMDBASE = CMDBASE_;
CMDFLOG = CMDFLOG_;
CMDBASE_JSON = CMDBASE_.Replace("input", "evListJson");
CMDFLOG_JSON = CMDFLOG_.Replace("flog", "flogJson");
CMDALIVE = CMDALIVE_;
CMDENABLED = CMDENABLED_;
CMDREBO = CMDREBO_;
CMD_ODL_STARTED = CMD_ODL_STARTED_;
CMD_FORCLE_SPLIT_ODL = CMD_FORCLE_SPLIT_ODL_;
CMD_IDLE_TIME = CMD_IDLE_TIME_;
}
}
}