public static void initRemoteInterface() { RemoteInterface.ConsoleServer.Start((int)RemoteInterface.ConsolePortEnum.Host); notifyServer = new RemoteInterface.EventNotifyServer((int)RemoteInterface.NotifyServerPortEnum.HOST); ServerFactory.SetChannelPort((int)RemoteInterface.RemotingPortEnum.HOST); ServerFactory.RegisterRemoteObject(typeof(HC_FWIS_Robj), "FWIS"); ServerFactory.RegisterRemoteObject(typeof(HC_Comm_Robj), "Comm"); }
protected override void OnStart(string[] args) { MyServiceObject = new AmidaServerService.AmidaService(); ServiceHost host = new ServiceHost(MyServiceObject); MyRestObj=new AmidaServerService.RestService(); ServiceHost restHost = new ServiceHost(MyRestObj); host.Open(); restHost.Open(); ServerFactory.SetChannelPort(9090); ServerFactory.RegisterRemoteObject(typeof(RemoteObject), "AmidaService"); NotifyServer = new EventNotifyServer(9091); //EventLog mylog = new EventLog() { Source = "AmidaService" }; //mylog.WriteEntry("AmidaService started!"); }
//protected DbCmdServer dbServer; public MFCC_Base(string mfccid,string devType,int remotePort,int notifyPort,int consolePort,string regRemoteName,Type regRemoteType) { Comm.DB2.Db2.MFCC_TYPE = mfccid; this.devType = devType; this.remotePort = remotePort; this.notifyPort = notifyPort; this.consolePort = consolePort; this.regRemoteName = regRemoteName; this.regRemoteType = regRemoteType; this.mfccid = mfccid; this.tmr1min.Elapsed += new System.Timers.ElapsedEventHandler(tmr1min_Elapsed); tmr1min.Start(); // dbServer = new DbCmdServer(); init_RemoteInterface(); try { if(mfccid!="MFCC_PBX" ) load_protocol(); } catch { ConsoleServer.WriteLine("Loading Protocol error"); System.Environment.Exit(-1); } notifier = new EventNotifyServer(notifyPort); ConsoleServer.WriteLine("loading Tc ..."); loadTC_AndBuildManaer(); IsLoadTcCompleted = true; this.AfterDeviceAllStart(); ConsoleServer.WriteLine("load Tc Completed!"); check_and_connect_remote_obj(r_host_comm); new System.Threading.Thread(HW_StatusDBTask).Start(); // new System.Threading.Thread(updateStstask).Start(); if (!(this is MFCC.MFCC_DataColloetBase)) { tmrSunSet = new ExactIntervalTimer(0,0, 0); tmrSunSet.OnElapsed += new OnConnectEventHandler(tmrSunSet_OnElapsed); } }
public MFCC_Base(string devType,int remotePort,int notifyPort,int consolePort,string regRemoteName,Type regRemoteType) { this.devType = devType; this.remotePort = remotePort; this.notifyPort = notifyPort; this.consolePort = consolePort; this.regRemoteName = regRemoteName; this.regRemoteType = regRemoteType; init_RemoteInterface(); load_protocol(); ConsoleServer.WriteLine("loading Tc ..."); loadTC_AndBuildManaer(); ConsoleServer.WriteLine("load Tc Completed!"); notifier = new EventNotifyServer(notifyPort); check_and_connect_remote_obj(r_host_comm); }
public MFCC_BA(string mfccid, string devType, int remotePort, int notifyPort, int consolePort, string regRemoteName, Type regRemoteType) { this.mfccid = mfccid; this.devType = devType; this.remotePort = remotePort; this.notifyPort = notifyPort; this.consolePort = consolePort; this.regRemoteName = regRemoteName; this.regRemoteType = regRemoteType; notifier = new EventNotifyServer(notifyPort); ConsoleServer.WriteLine("loading Tc ..."); loadTC_AndBuildManaer(); IsLoadTcCompleted = true; this.AfterDeviceAllStart(); ConsoleServer.WriteLine("load Tc Completed!"); init_RemoteInterface(); tmr10min = new System.Threading.Timer(new System.Threading.TimerCallback(TmrTask)); // double secdiff=0; Console.WriteLine("next tmr task:"+ DateTime.Now.Add(GetNext10MinTimeSpan())); tmr10min.Change((long)GetNext10MinTimeSpan().TotalMilliseconds, -1); }