Esempio n. 1
0
        private void StatsTimerElapsed(object source, System.Timers.ElapsedEventArgs e)
        {
            if (!Enabled)
            {
                WriteTimer.Stop();
                return;
            }

            if (LogSyncConnectorEnable)
            {
                LogConnectorStats();
            }
            if (LogRegionEnable)
            {
                LogStats("scene", LogRegionDirectory, LogRegionFilenamePrefix, LogRegionFileTimeMinutes, LogRegionFlushWrites, regionStatFields);
            }
            if (LogServerEnable)
            {
                LogStatsCombineCategory("server", LogServerDirectory, LogServerFilenamePrefix, LogServerFileTimeMinutes, LogServerFlushWrites, serverStatFields);
            }

            if (LogLLUDPBWAggEnabled)
            {
                LogLLUDPStats();
            }
        }
Esempio n. 2
0
 public void Dispose()
 {
     Enabled = false;
     LogSyncConnectorEnable = false;
     if (WriteTimer != null)
     {
         WriteTimer.Stop();
         WriteTimer.Dispose();
         WriteTimer = null;
     }
     Close();
 }
Esempio n. 3
0
 public override void Disconnect()
 {
     try
     {
         ClearCmd();
         Cmd.Clear();
         ReadTimer.Change(-1, -1);
         WriteTimer.Change(-1, -1);
         WaitUntilThreadOver();
         serialport.Close();
         CreateEvent(EventReason.Disconnected, null);
     }
     catch (Exception ex)
     {
         CreateEvent(EventReason.Disconnected, ex.Message);
     }
     finally
     {
         PACK.FlushReadBuffer();
         PACK.FlushWriteBuffer();
         CMD.ClearTask();
         serialport = null;
     }
 }
Esempio n. 4
0
 public override void Connect(object device)
 {
     if (device is SerialPort)
     {
         IsUSBSerial = false;
         serialport  = (SerialPort)device;
         try
         {
             serialport.DataBits               = 8;
             serialport.StopBits               = StopBits.One;
             serialport.Parity                 = Parity.None;
             serialport.ReadTimeout            = 50;
             serialport.ReceivedBytesThreshold = 1;
             serialport.DataReceived          +=
                 new SerialDataReceivedEventHandler(SerialReadThread);
             serialport.ReadBufferSize  = 8192;
             serialport.WriteBufferSize = 8192;
             PACK.FlushReadBuffer();
             PACK.FlushWriteBuffer();
             CMD.ClearTask();
             serialport.Open();
             WriteTimer.Change(0, 25);
             ReadTimer.Change(0, 25);
             SerialChannel = SerialChannelEnum.ChipConnect;
             CreateEvent(EventReason.ChipConnected, null);   // 仅串口连接成功
             return;
         }
         catch (Exception ex)
         {
             Disconnect();
             CreateEvent(EventReason.ConnectFailed, ex.Message);
             return;
         }
     }
     CreateEvent(EventReason.ConnectFailed, "连接的不是串口设备!");
 }
Esempio n. 5
0
 private void bWriteStart_Click(object sender, EventArgs e)
 {
     WriteTimer.Start();
 }
Esempio n. 6
0
 private void bWriteEnd_Click(object sender, EventArgs e)
 {
     WriteTimer.Stop();
 }
Esempio n. 7
0
 protected override void OnStop()
 {
     WriteTimer.Stop();
 }
Esempio n. 8
0
 protected override void OnStart(string[] args)
 {
     WriteTimer.Start();
 }