//public override void loadTC_AndBuildManaer() //{ //// try //// { //// //System.Data.Odbc.OdbcDataReader rd; //// //System.Data.Odbc.OdbcConnection cn = new System.Data.Odbc.OdbcConnection(Comm.DB2.Db2.db2ConnectionStr); //// //rd = Comm.DB2.Db2.getDeviceConfigReader(cn, this.mfccid); //// //while (rd.Read()) //// //{ //// // byte[] hw_status = new byte[4]; //// // for (int i = 0; i < 4; i++) //// // hw_status[i] = System.Convert.ToByte(rd[3 + i]); //// // Comm.TC.VDTC tc = new Comm.TC.VDTC(protocol, rd[0].ToString().Trim(), rd[1].ToString(), (int)rd[2], 0xffff, hw_status); //// // ConsoleServer.WriteLine(string.Format("load tc:{0} ip:{1} port:{2}", rd[0], rd[1], rd[2])); //// // tcAry.Add(tc); //// //} //// //rd.Close(); //// //cn.Close(); // Comm.TC.VDTC tc=new Comm.TC.VDTC(protocol,"VD231","192.168.22.231",1001,0xffff,new byte[]{0,0,0,0}); // tc.OnRealTimeData += new Comm.TC.OnRealTimeEventHandler(tc_OnRealTimeData); // tc.OnTriggerEvent += new Comm.TC.OnTriggerEventHandler(tc_OnTriggerEvent); // // tc.OnHwStatusChanged += new HWStatusChangeHandler(tc_OnHwStatusChanged); // // tc.OnConnectStatusChanged += new ConnectStatusChangeHandler(tc_OnConnectStatusChanged); // tc.On1MinTrafficData += new Comm.TC.On1MinEventDataHandler(tc_On1MinTrafficData); // tcAry.Add(tc); // this.manager = new TC_Manager(tcAry); // //} // //catch (Exception ex) // //{ // // ConsoleServer.WriteLine(ex.Message); // //} //} void tc_On1MinTrafficData(object vdtc, Comm.TC.VD_MinAvgData data) { //throw new Exception("The method or operation is not implemented."); //this.InDbQueue.Enqueue(data); //lock (this.InDbQueue) //{ // System.Threading.Monitor.PulseAll(InDbQueue); //} try { // this.ToDb(data.getExecuteSql()); if (data.IsValid) dbServer.SendSqlCmd(data.getExecuteSql()); else { if (r_host_comm != null) r_host_comm.DoVD_InteropData((vdtc as TCBase).DeviceName, data.dateTime); } RemoteInterface.MFCC.VD1MinCycleEventData vd1min; //if (((TCBase)vdtc).DeviceName == "VD-N1-S-149.5") //{ vd1min = data.ToVD1MinCycleEventData(); //} //else //{ // vd1min = data.ToVD1MinCycleEventData(); //} // remove on 2013-3-17 //this.notifier.NotifyAll(new NotifyEventObject(EventEnumType.VD_1min_Cycle_Event, ((TCBase)vdtc).DeviceName, vd1min)); } catch (Exception ex) { ConsoleServer.WriteLine((vdtc as TCBase).DeviceName+":"+ex.Message + ex.StackTrace); } }
void MFCC_VD_OnFiveMinAvgData(object vdtc, Comm.TC.VD_MinAvgData data) { try { if (r_host_comm == null) return; // lock(this.r_host_comm) this.r_host_comm.setVDFiveMinData(data.devName, data.ToVD1MinCycleEventData()); } catch (Exception ex) { ConsoleServer.WriteLine("HostException!"+ex.Message+ex.StackTrace); } }