void ClientObjectReceivedEvent(object o, RIOXClient.ObjectReceivedEventArgs e) { _data = (RIOXData) e.DataObject; Console.WriteLine("Object received: " + _data); // Console.WriteLine("Preamp: " + _radio.Custom["preamp"]); UpdateForm(); }
private void button1_Click(object sender, EventArgs e) { _data = new RIOXData(); _client = new RIOXClient(typeof(RIOXData),"localhost", 1234); _client.ObjectReceivedEvent += ClientObjectReceivedEvent; _client.ServerDisconnectedEvent += new EventHandler(_client_ServerDisconnectedEvent); }
private void btnRIOXTest_Click(object sender, EventArgs e) { try { //DDUtilState.RadioData r = new DDUtilState.RadioData(); RIOX.RIOXData r = new RIOX.RIOXData(); _c = new RIOX.RIOXClient(r.GetType(), txtRIOXIP.Text, int.Parse(txtRIOXport.Text)); _c.SendCommand(new RIOX.RIOXCommand("UpDateType", "PSH:500")); _c.SendCommand(new RIOX.RIOXCommand("Sub", "ZZFA;")); _c.ObjectReceivedEvent += new RIOX.RIOXClient.ObjectReceivedEventHandler(c_ObjectReceivedEvent); } catch (Exception ex) { MessageBox.Show("Failure: " + ex.Message); } }
public void Start() { try { _data = new RadioData { vfoa = "0", vfob = "0", Mode = "99", mox = false, DisplayMode = "0", Smeter = "0", dspfilters = "", dspfilterarray = new ArrayList { "6.0", "4.0", "2.6", "2.1", "1.0", "500", "250", "100", "50", "25", "VAR1", "VAR2", "UNKN" }, }; if (Properties.Settings.Default.SerialPortIdx == 0) { // RIOX try { Console.WriteLine("RIOX initializing"); _riox = new RIOX.RIOXClient(typeof(RIOXData), Properties.Settings.Default.RIOXIP, Properties.Settings.Default.RIOXPort); _riox.ObjectReceivedEvent += new RIOX.RIOXClient.ObjectReceivedEventHandler(_riox_ObjectReceivedEvent); _usingRIOX = true; } catch (Exception ex) { _notifyIcon.MessageBox("RIOX error: " + ex.Message + "\r\n" + ex.StackTrace); throw ex; } } else { _cat = new CATConnector(new SerialPort(Properties.Settings.Default.SerialPort)); _timerShort = new Timer(Properties.Settings.Default.HighInterval); _cat.CATEvent += CatcatEvent; _timerShort.Elapsed += TimerShortElapsed; } _timerLong = new Timer(Properties.Settings.Default.LowInterval); _timerLong.Elapsed += TimerLongElapsed; //_listenOnly = Properties.Settings.Default.ListenOnly; _server = new HRDTCPServer(this); } catch (Exception e) { _notifyIcon.MessageBox("While starting: " + e.Message + "\n" + "Server is disabled. Please check configuration.\nIf using RIOX mode, please make sure DDUtil is running."); ShowOptionsForm(); return; } _server.HRDTCPEvent += ServerHRDTCPEvent; // Start the timers only if serial polling is enabled if (!_usingRIOX) { // write initial commands to the radio to fill in initial data WriteCommand("ZZIF;"); WriteCommand("ZZFA;"); WriteCommand("ZZFB;"); WriteCommand("ZZBS;"); WriteCommand("ZZDM;"); WriteCommand("ZZGT;"); WriteCommand("ZZPA;"); WriteCommand("ZZFI;"); _timerShort.Start(); //_timerLong.Start(); } else // using RIOX { // subscribe to what we want from DDUtil _riox.SendCommand(new RIOXCommand("UpDateType", "PSH:500")); //_riox.SendCommand(new RIOXCommand("UnSub", "NONE")); _riox.SendCommand(new RIOXCommand("Sub", "ZZIF;ZZFA;ZZFB;ZZBS;ZZDM;ZZGT;ZZPA;ZZFI;")); } _timerLong.Start(); _server.Start(); SetNotifyIconText("MiniDeluxe - Running (0 connections)"); }
public void Start() { try { _data = new RadioData { vfoa = "0", vfob = "0", Mode = "99", mox = false, DisplayMode = "0", Smeter = "0", dspfilters = "", dspfilterarray = new ArrayList { "6.0","4.0","2.6","2.1","1.0", "500","250","100","50","25","VAR1","VAR2","UNKN" }, }; if (Properties.Settings.Default.SerialPortIdx == 0) { // RIOX try { Console.WriteLine("RIOX initializing"); _riox = new RIOX.RIOXClient(typeof(RIOXData), Properties.Settings.Default.RIOXIP, Properties.Settings.Default.RIOXPort); _riox.ObjectReceivedEvent += new RIOX.RIOXClient.ObjectReceivedEventHandler(_riox_ObjectReceivedEvent); _usingRIOX = true; } catch (Exception ex) { _notifyIcon.MessageBox("RIOX error: " + ex.Message + "\r\n" + ex.StackTrace); throw ex; } } else { _cat = new CATConnector(new SerialPort(Properties.Settings.Default.SerialPort)); _timerShort = new Timer(Properties.Settings.Default.HighInterval); _cat.CATEvent += CatcatEvent; _timerShort.Elapsed += TimerShortElapsed; } _timerLong = new Timer(Properties.Settings.Default.LowInterval); _timerLong.Elapsed += TimerLongElapsed; //_listenOnly = Properties.Settings.Default.ListenOnly; _server = new HRDTCPServer(this); } catch (Exception e) { _notifyIcon.MessageBox("While starting: " + e.Message + "\n" + "Server is disabled. Please check configuration.\nIf using RIOX mode, please make sure DDUtil is running."); ShowOptionsForm(); return; } _server.HRDTCPEvent += ServerHRDTCPEvent; // Start the timers only if serial polling is enabled if (!_usingRIOX) { // write initial commands to the radio to fill in initial data WriteCommand("ZZIF;"); WriteCommand("ZZFA;"); WriteCommand("ZZFB;"); WriteCommand("ZZBS;"); WriteCommand("ZZDM;"); WriteCommand("ZZGT;"); WriteCommand("ZZPA;"); WriteCommand("ZZFI;"); _timerShort.Start(); //_timerLong.Start(); } else // using RIOX { // subscribe to what we want from DDUtil _riox.SendCommand(new RIOXCommand("UpDateType", "PSH:500")); //_riox.SendCommand(new RIOXCommand("UnSub", "NONE")); _riox.SendCommand(new RIOXCommand("Sub","ZZIF;ZZFA;ZZFB;ZZBS;ZZDM;ZZGT;ZZPA;ZZFI;")); } _timerLong.Start(); _server.Start(); SetNotifyIconText("MiniDeluxe - Running (0 connections)"); }