Esempio n. 1
0
        public ClientListener(CalorimeterClient client) : base(false)
        {
            this.client       = client;
            Acknowledge       = false;
            NotifyTermination = null;
            NonAcknowledge    = null;

            int fLength = client.Ini.GetInteger("Device", "FValueLength");
            int nLength = client.Ini.GetInteger("Device", "NValueLength");

            FValues = new float[fLength];
            NValues = new UInt16[nLength];

            packet     = new ClientReceivePacket(fLength * 4 + nLength * 2 + 17);
            clientArgs = new ClientReceiveArgs();

            logger        = new UlLogger();
            logger.Active = true;
            logger.Path   = client.Ini.GetString("Listener", "LogPath");
            logger.FName  = client.Ini.GetString("Listener", "LogFileName");
            logger.AddHead("CLIENT->SERVER");
            logger.AddHead("CLIENT<-SERVER");
            logger.AddHead("NOTE");
            logger.AddHead("EXCEPTION");

            Logging = GetLogging();
        }
        public static void Create()
        {
            Busy = false;

            Ini = new UlIniFile(csIniFName);

            TotalLog       = new UlLogger();
            TotalLog.Path  = Path.GetFullPath(Ini.GetString("Log", "TotalPath"));
            TotalLog.FName = Ini.GetString("Log", "TotalFileName");

            DbLog       = new UlLogger();
            DbLog.Path  = Path.GetFullPath(Ini.GetString("Log", "DatabasePath"));
            DbLog.FName = Ini.GetString("Log", "DatabaseFileName");

            string connectString = Ini.GetString("Database", "ConnectString");

            DB = new AppDatabase(connectString);

            if (string.IsNullOrWhiteSpace(connectString) == true)
            {
                DB.DataSource     = Ini.GetString("Database", "DataSource");
                DB.InitialCatalog = Ini.GetString("Database", "InitialCatalog");
                DB.UserID         = Ini.GetString("Database", "UserID");
                DB.Password       = Ini.GetString("Database", "Password");
            }
            DB.Open();

            Settings = new AppSettings();
            TotalLog[ELogTag.Note] = $"Create application resource";
        }
Esempio n. 3
0
        public UlTemi2500Tcp(string ip, int port)
        {
            this.ip   = ip;
            this.port = port;

            logging = ETemiLogging.Event;

            logger        = new UlLogger();
            logger.Active = true;
            logger.Path   = "";
            logger.FName  = "Temi2500Log";

            logger.Clear();
            logger.AddTag("CONNECT");
            logger.AddTag("DISCONNECT");
            logger.AddTag("PC->PLC");
            logger.AddTag("PC<-PLC");
            logger.AddTag("COMMENT");
            logger.AddTag("EXCEPTION");

            connected = false;
            client    = new TcpClient();

            stopWatch    = new Stopwatch();
            criticalLock = new object();
        }
Esempio n. 4
0
        //----------------------------------------------------------------------
        public UlMelsecQClient(
            string aIP,
            int aPort,
            EUlProtocol aProtocol = EUlProtocol.Tcp,
            int aPortCount        = csPortCount,
            int aPacketSize       = csPacketSize)
        {
            ip         = aIP;
            port       = aPort;
            protocol   = aProtocol;
            portCount  = aPortCount;
            packetSize = aPacketSize;

            index     = 0;
            connected = false;

            SendingEvent   = null;
            ReceivingEvent = null;

            network = 0x00;
            plc     = 0xFF;
            station = 0x00;

            rand      = new Random();
            stopWatch = new Stopwatch();

            logging       = EMQLog.Event;
            logger        = new UlLogger();
            logger.Active = true;
            logger.Path   = "";
            logger.FName  = "MelsecQLog";

            logger.Clear();
            logger.AddTag("CONNECT");
            logger.AddTag("DISCONNECT");
            logger.AddTag("PC->PLC");
            logger.AddTag("PC<-PLC");
            logger.AddTag("COMMENT");
            logger.AddTag("EXCEPTION");

            if (protocol == EUlProtocol.Tcp)
            {
                tcpList = new List <TcpClient>();

                for (int i = 0; i < portCount; i++)
                {
                    tcpList.Add(new TcpClient());
                }
            }
            else
            {
                udp = new UdpClient();
            }

            // 송수신 Packet 생성
            sPacket = new UlQnA4ESendPacket(packetSize);
            rPacket = new UlQnA4ERecvPacket(packetSize);
        }
Esempio n. 5
0
        static public void CreateLogger()
        {
            Ini = new UlIniFile(csConfigIniFName);

            TLog       = new UlLogger();
            TLog.Path  = Ini.GetString("Log", "TotalPath");
            TLog.FName = Ini.GetString("Log", "TotalFileName");
            TLog.AddHead("NOTE");
            TLog.AddHead("ERROR");
            TLog.AddHead("EXCEPTION");
        }
Esempio n. 6
0
        public ClientSender(CalorimeterClient client)
        {
            this.client = client;
            packet      = new ClientSendPacket();

            logger        = new UlLogger();
            logger.Active = true;
            logger.Path   = client.Ini.GetString("Sender", "LogPath");
            logger.FName  = client.Ini.GetString("Sender", "LogFileName");
            logger.AddHead("CLIENT->SERVER");
            logger.AddHead("NOTE");
            logger.AddHead("EXCEPTION");

            Logging = GetLogging();
        }
Esempio n. 7
0
        public ServerSender(CalorimeterServer server) : base(false)
        {
            this.server = server;
            packet      = new ServerSendPacket(server.Devices.Bytes.Length + 17);

            logger        = new UlLogger();
            logger.Active = true;
            logger.Path   = server.Ini.GetString("Sender", "LogPath");
            logger.FName  = server.Ini.GetString("Sender", "LogFileName");
            logger.AddHead("SERVER->CLIENT");
            logger.AddHead("NOTE");
            logger.AddHead("EXCEPTION");

            Logging = GetLogging();
        }
Esempio n. 8
0
        public ServerListener(CalorimeterServer server) : base(false)
        {
            this.server    = server;
            packet         = new ServerReceivePacket(64);
            ChangedClients = null;

            logger        = new UlLogger();
            logger.Active = true;
            logger.Path   = server.Ini.GetString("Listener", "LogPath");
            logger.FName  = server.Ini.GetString("Listener", "LogFileName");
            logger.AddHead("SERVER->CLIENT");
            logger.AddHead("SERVER<-CLIENT");
            logger.AddHead("NOTE");
            logger.AddHead("EXCEPTION");

            Logging = GetLogging();
        }
Esempio n. 9
0
        public UlEthernetClient(
            string name, int scanTime, EEthernetProtocol protocol, int timeout)
        {
            InvalidFloatValue = float.NaN;
            ScanTime          = scanTime;
            Protocol          = protocol;
            Timeout           = timeout;
            Name = name;

            Mode = EEthernetMode.Real;

            rand = new Random();

            stopWatch = new Stopwatch();

            CreateClient();

            if (ScanTime > 0)
            {
                scaner = new UlEthernetScanerThread(this, ScanTime);
            }
            else
            {
                scaner = null;
            }

            Logging = EEthernetLogging.None;

            logger        = new UlLogger();
            logger.Active = true;
            logger.Path   = "";
            logger.FName  = "EthernetClientLog";

            logger.Clear();
            logger.AddTag("CONNECT");
            logger.AddTag("DISCONNECT");
            logger.AddTag("PC->Device");
            logger.AddTag("PC<-Device");
            logger.AddTag("NOTE");
            logger.AddTag("EXCEPTION");
        }
Esempio n. 10
0
        static public void Create()
        {
            UserNo    = 0;
            Authority = EUserAuthority.Viewer;

            Ini = new UlIniFile(csConfigIniFName);

            TLog       = new UlLogger();
            TLog.Path  = Ini.GetString("Log", "TotalPath");
            TLog.FName = Ini.GetString("Log", "TotalFileName");
            TLog.AddHead("NOTE");
            TLog.AddHead("ERROR");
            TLog.AddHead("EXCEPTION");

            Server = new CalorimeterServer(Ini);

            Db          = new CalorimeterDatabase();
            Db.Database = Ini.GetString("Database", "FileName");
            Db.Open();

            Db.Load(Ini.GetInteger("Calibrator", "CalibrationNo"));
        }