private void sendRigBusState(RigStatePacket rigState) { var netRunniner = UdpServer.GetInstance(); var net = OmniRigInfoThread.GetInstance(); var state = RigOperatingState.Instance; var rigBusDesc = OmniRigInfo.Instance; state.Id = rigBusDesc.Id; state.DocType = "RigOperatingState"; state.Command = "StateUpdate"; state.Freq = rigState.Freq; state.FreqA = rigState.Freq; state.Mode = rigState.Mode; Console.WriteLine("Freq: {0} - Mode: {1}", state.Freq, state.Mode); netRunner.SendBroadcast(state, 7300); }
static int Main(string[] args) { UdpServer.GetInstance(); var netThread = OmniRigInfoThread.GetInstance(); netThread.StartInfoThread(); try { var exitCode = HostFactory.Run(c => { c.Service <OmniRigService>(service => { ServiceConfigurator <OmniRigService> s = service; s.ConstructUsing(() => new OmniRigService()); s.WhenStarted(a => a.Start()); s.WhenStopped(a => a.Stop()); }); c.SetServiceName("OmniRigHamBus"); c.SetDisplayName("OmniRig HamBus server"); c.SetDescription("Web server for OmniRig and hambus"); }); return((int)exitCode); } catch (Exception e) { Console.WriteLine(e.Message); if (e.InnerException != null) { Console.WriteLine(e.InnerException.Message); Console.WriteLine("\n\nCould not open COM object! Exiting"); return(-1); } } return(0); Console.ReadKey(); }