public Radio(string text, Vector2 position, RadioType type, CallMethodOnChange methodChecked = null, CallMethodOnChange methodUnchecked = null, string name = null) { if (type == RadioType.classic) { if (text != null) { _boudary = new RectangleF(24, 24, position.X + 512, position.Y); } else { _boudary = new RectangleF(24, 24, position.X, position.Y); } _btn = new Button(_boudary.Position, "", ChangeState, null, null, ButtonType.check); } else if (type == RadioType.big) { _boudary = new RectangleF(128, 64, position.X, position.Y); _btn = new Button(_boudary.Position, "", ChangeState, null, null, ButtonType.big); } _methodChecked = methodChecked; _methodUnchecked = methodUnchecked; _text = text; _position = position; _type = type; Name = name; }
public void SetRadioStandby(RadioType radio, double MHz) { var bcd = ToBCD((uint)(MHz * 100)); switch (radio) { case RadioType.COM_1: Client.TransmitClientEventToUser(Events.COM_STBY_RADIO_SET, (uint)bcd, SIMCONNECT_GROUP_PRIORITY.HIGHEST); break; case RadioType.COM_2: Client.TransmitClientEventToUser(Events.COM2_STBY_RADIO_SET, (uint)bcd, SIMCONNECT_GROUP_PRIORITY.HIGHEST); break; case RadioType.NAV_1: Client.TransmitClientEventToUser(Events.NAV1_STBY_SET, (uint)bcd, SIMCONNECT_GROUP_PRIORITY.HIGHEST); break; case RadioType.NAV_2: Client.TransmitClientEventToUser(Events.NAV2_STBY_SET, (uint)bcd, SIMCONNECT_GROUP_PRIORITY.HIGHEST); break; default: Log.Instance.Warning("Unsupported radio selected."); break; } }
public void SwapRadio(RadioType radio) { switch (radio) { case RadioType.COM_1: Client.TransmitClientEventToUser(Events.COM_STBY_RADIO_SWAP, SIMCONNECT_GROUP_PRIORITY.HIGHEST); break; case RadioType.COM_2: Client.TransmitClientEventToUser(Events.COM2_RADIO_SWAP, SIMCONNECT_GROUP_PRIORITY.HIGHEST); break; case RadioType.NAV_1: Client.TransmitClientEventToUser(Events.NAV1_RADIO_SWAP, SIMCONNECT_GROUP_PRIORITY.HIGHEST); break; case RadioType.NAV_2: Client.TransmitClientEventToUser(Events.NAV2_RADIO_SWAP, SIMCONNECT_GROUP_PRIORITY.HIGHEST); break; default: Log.Instance.Warning("Unsupported radio swap selected."); break; } }
public RadioCommunication(string name, RadioType senderRadioType, RadioType ownRadioType, bool playMicClick) { this.Name = name; this.SenderRadioType = senderRadioType; this.OwnRadioType = ownRadioType; this.PlayMicClick = playMicClick; this.Direct = true; }
public RadioCommunication(string name, RadioType senderRadioType, RadioType ownRadioType, bool playMicClick, bool direct, string[] relayedBy) { this.Name = name; this.SenderRadioType = senderRadioType; this.OwnRadioType = ownRadioType; this.PlayMicClick = playMicClick; this.Direct = direct; this.RelayedBy = relayedBy; }
public Radio(int id, int serialNum, string descp, RadioType type, OperationMode opm, int mId, int cId) { Id = id; MasterId = mId; SerialNumber = serialNum; Desc = descp; Type = type; OpMode = opm; ChannelId = cId; }
public RadioCommunication(string name, RadioType senderRadioType, RadioType ownRadioType, bool playMicClick, bool direct, bool isSecondary) { this.Name = name; this.SenderRadioType = senderRadioType; this.OwnRadioType = ownRadioType; this.PlayMicClick = playMicClick; this.Direct = direct; this.Secondary = isSecondary; }
public Radio(int id, int serialNum, string descp, RadioType type, OperationMode opm, int mId, int cId) { Id = id; MasterId = mId; SerialNumber = serialNum; Desc = descp; Type = type; OpMode = opm; ChannelId = cId; TimeStamp = DateTime.Now; CommStatus = 0; }
private void clearRadioButtons(RadioType group = RadioType.all) { if (group == RadioType.all) { infoRadioButtonA.Checked = false; infoRadioButtonB.Checked = false; infoRadioButtonC.Checked = false; infoRadioButton1.Checked = false; infoRadioButton2.Checked = false; infoRadioButton3.Checked = false; infoRadioButton4.Checked = false; infoRadioButton5.Checked = false; infoRadioButton6.Checked = false; infoRadioButtonm1.Checked = false; infoRadioButtonm2.Checked = false; infoRadioButtonm3.Checked = false; infoRadioButtonm4.Checked = false; infoRadioButtonm5.Checked = false; infoRadioButtonm6.Checked = false; return; } if (group == RadioType.shift) { infoRadioButtonA.Checked = false; infoRadioButtonB.Checked = false; infoRadioButtonC.Checked = false; return; } if (group == RadioType.machine) { infoRadioButtonm1.Checked = false; infoRadioButtonm2.Checked = false; infoRadioButtonm3.Checked = false; infoRadioButtonm4.Checked = false; infoRadioButtonm5.Checked = false; infoRadioButtonm6.Checked = false; return; } if (group == RadioType.line) { infoRadioButton1.Checked = false; infoRadioButton2.Checked = false; infoRadioButton3.Checked = false; infoRadioButton4.Checked = false; infoRadioButton5.Checked = false; infoRadioButton6.Checked = false; return; } }
public RadioCommunication(string name, RadioType senderRadioType, RadioType ownRadioType, bool playMicClick, bool direct, bool isSecondary, string[] relayedBy, float volume) { this.Name = name; this.SenderRadioType = senderRadioType; this.OwnRadioType = ownRadioType; this.PlayMicClick = playMicClick; this.Direct = direct; this.Secondary = isSecondary; this.RelayedBy = relayedBy; if (volume != 1f) { this.Volume = volume; } }
private void Populate() { IntegerType c1 = new IntegerType("id", "id"); Border b1 = c1.Border; stackPanel.Children.Add(b1); StringType c2 = new StringType("First Name", "First Name"); Border b2 = c2.Border; stackPanel.Children.Add(b2); StringType c3 = new StringType("Last Name", "Last Name"); Border b3 = c3.Border; stackPanel.Children.Add(b3); RadioType c4 = new RadioType("Gender", "Male", "Female"); Border b4 = c4.Border; stackPanel.Children.Add(b4); LongType c5 = new LongType("Phone No.", "Phone No"); Border b5 = c5.Border; stackPanel.Children.Add(b5); DateType c9 = new DateType("Date", System.DateTime.Now); Border b9 = c9.Border; stackPanel.Children.Add(b9); FloatType c6 = new FloatType("Salary", "Salary"); Border b6 = c6.Border; stackPanel.Children.Add(b6); IntegerType c7 = new IntegerType("Roll no", "Roll No"); Border b7 = c7.Border; stackPanel.Children.Add(b7); StringType c8 = new StringType("Address", "Address"); Border b8 = c8.Border; stackPanel.Children.Add(b8); }
/// <summary> /// 根据类型和类型ID获取一个新的<see cref="RadioModel"/>实例,如果已经创建过则返回这个实例 /// </summary> /// <param name="type">电台的类型</param> /// <param name="oid">该类型电台需要的参数</param> public static RadioModel GetNew(RadioType type, uint oid) { uint xiamiID = 0; ExtensionMethods.InvokeAndWait(async() => xiamiID = await WebApi.Instance.GetRadioId(type, oid)); RadioModel radio = null; if (!(_dict?.TryGetValue(xiamiID, out radio) ?? false)) { if (type == RadioType.User) { radio = new UserRadioModel(xiamiID, oid); } else { radio = new RadioModel(xiamiID, type, oid); } _dict?.Add(xiamiID, radio); } return(radio); }
public void init(string pIcon, string pName, RadioType pType, Action pActionClick, int pLevel, bool pOnlyAction = false) { if (mIcon != null) { mIcon.text = pIcon; } if (mName != null) { mName.text = pName; } setType(pType); mClickAction = pActionClick; if (mBtn != null) { mBtn.onClick.AddListener(delegate { mClickAction(); if (!pOnlyAction) { Select(); } }); } // Задаем смещение для уровня if (mGroupOnLevel != null) { mGroupOnLevel.padding.left = mGroupOnLevel.padding.left + (pLevel * 20); if (pLevel != 0) { mName.fontSize = 12; stateDevider(false); } } }
public BadgeReader(RadioType radioType, string comPortName) { _radioType = radioType; OpenSerialPort(comPortName); }
protected RadioModel(uint xiamiID, RadioType type, uint oid) { XiamiID = xiamiID; Type = type; OID = oid; }
public RadioTraffic(string playerName, bool isSending, string radioChannelName, RadioType senderType, RadioType receiverType, string[] relays) { this.Name = playerName; this.IsSending = isSending; this.RadioChannelName = radioChannelName; this.SenderRadioType = senderType; this.ReceiverRadioType = receiverType; this.Relays = relays; }
private void setType(RadioType pType) { _typeRadioBtn = pType; }
public static void SetRadioType(RadioType in_Radio) { Instance.CurrentRadio.RadioType = in_Radio; //Switch the playback to something else }
public IAsyncOperation<uint> GetRadioId(RadioType radiotype, uint oid) { if (radiotype == RadioType.UnKnown||oid==0) throw new ArgumentException("Radio参数设置错误"); return Run(async token => { try { LogService.DebugWrite($"Get id of Radio type={radiotype} oid={oid}", nameof(WebApi)); var gettask = HttpHelper.GetAsync($"http://www.xiami.com/radio/play/type/{(int)radiotype}/oid/{oid}"); token.Register(() => gettask.Cancel()); var content = await gettask; var start = content.IndexOf("value=\""); start += 7; var end = content.IndexOf("\"", start); LogService.DebugWrite($"Finish Getting id of Radio oid={oid}", nameof(WebApi)); return uint.Parse(content.Substring(start, end - start)); } catch (Exception e) { LogService.ErrorWrite(e, nameof(WebApi)); #if DEBUG System.Diagnostics.Debugger.Break(); #endif throw e; } }); }
public void SetRadioStandby(RadioType radio, double MHz) { Log.Instance.Debug($"SetRadioStandby (radio = {radio}, MHz = {MHz})"); }
public BadgeReaderEventArgs(string badgeNumber, RadioType radioType) { BadgeNumber = badgeNumber; RadioType = radioType; IsMaster = true; // true by default. Manually set to false in Slave reader event handler }
public void SwapRadio(RadioType radio) { Log.Instance.Debug($"SwapRadio (radio = {radio})"); }
private void SetupSx125x(Byte rf_chain, Byte rf_clkout, Boolean rf_enable, RadioType rf_radio_type, UInt32 freq_hz) { Int32 cpt_attempts = 0; if (rf_chain >= 2) { throw new Exception("ERROR: INVALID RF_CHAIN"); } // Get version to identify SX1255/57 silicon revision //Console.WriteLine("Note: SX125x #" + rf_chain + " version register returned " + this.Sx125xRead(rf_chain, 0x07).ToString("X2")); // General radio setup if (rf_clkout == rf_chain) { this.Sx125xWrite(rf_chain, 0x10, (Byte)(SX125X.TX_DAC_CLK_SEL + 2)); //Console.WriteLine("Note: SX125x #"+ rf_chain + " clock output enabled"); } else { this.Sx125xWrite(rf_chain, 0x10, SX125X.TX_DAC_CLK_SEL); //Console.WriteLine("Note: SX125x #"+ rf_chain + " clock output disabled"); } switch (rf_radio_type) { case RadioType.SX1255: //LGW_RADIO_TYPE_SX1255 this.Sx125xWrite(rf_chain, 0x28, (Byte)(SX125X.XOSC_GM_STARTUP + SX125X.XOSC_DISABLE * 16)); break; case RadioType.SX1257: //LGW_RADIO_TYPE_SX1257 this.Sx125xWrite(rf_chain, 0x26, (Byte)(SX125X.XOSC_GM_STARTUP + SX125X.XOSC_DISABLE * 16)); break; default: throw new Exception("ERROR: UNEXPECTED VALUE " + rf_radio_type + " FOR RADIO TYPE"); } if (rf_enable == true) { // Tx gain and trim this.Sx125xWrite(rf_chain, 0x08, (Byte)(SX125X.TX_MIX_GAIN + SX125X.TX_DAC_GAIN * 16)); this.Sx125xWrite(rf_chain, 0x0A, (Byte)(SX125X.TX_ANA_BW + SX125X.TX_PLL_BW * 32)); this.Sx125xWrite(rf_chain, 0x0B, SX125X.TX_DAC_BW); // Rx gain and trim this.Sx125xWrite(rf_chain, 0x0C, (Byte)(SX125X.LNA_ZIN + SX125X.RX_BB_GAIN * 2 + SX125X.RX_LNA_GAIN * 32)); this.Sx125xWrite(rf_chain, 0x0D, (Byte)(SX125X.RX_BB_BW + SX125X.RX_ADC_TRIM * 4 + SX125X.RX_ADC_BW * 32)); this.Sx125xWrite(rf_chain, 0x0E, (Byte)(SX125X.ADC_TEMP + SX125X.RX_PLL_BW * 2)); UInt32 part_int; UInt32 part_frac; // set RX PLL frequency switch (rf_radio_type) { case RadioType.SX1255: //LGW_RADIO_TYPE_SX1255: part_int = freq_hz / (SX125X.FRAC_32MHz << 7); // integer part, gives the MSB part_frac = ((freq_hz % (SX125X.FRAC_32MHz << 7)) << 9) / SX125X.FRAC_32MHz; // fractional part, gives middle part and LSB break; case RadioType.SX1257: //LGW_RADIO_TYPE_SX1257: part_int = freq_hz / (SX125X.FRAC_32MHz << 8); // integer part, gives the MSB part_frac = ((freq_hz % (SX125X.FRAC_32MHz << 8)) << 8) / SX125X.FRAC_32MHz; // fractional part, gives middle part and LSB break; default: throw new Exception("ERROR: UNEXPECTED VALUE " + rf_radio_type + " FOR RADIO TYPE"); } this.Sx125xWrite(rf_chain, 0x01, (Byte)(0xFF & part_int)); // Most Significant Byte this.Sx125xWrite(rf_chain, 0x02, (Byte)(0xFF & (part_frac >> 8))); // middle byte this.Sx125xWrite(rf_chain, 0x03, (Byte)(0xFF & part_frac)); // Least Significant Byte // start and PLL lock do { if (cpt_attempts >= 50) { throw new Exception("ERROR: FAIL TO LOCK PLL"); } this.Sx125xWrite(rf_chain, 0x00, 1); // enable Xtal oscillator this.Sx125xWrite(rf_chain, 0x00, 3); // Enable RX (PLL+FE) ++cpt_attempts; //Console.WriteLine("Note: SX125x #"+ rf_chain + " PLL start (attempt "+ cpt_attempts + ")"); Thread.Sleep(2); } while((this.Sx125xRead(rf_chain, 0x11) & 0x02) == 0); } else { Console.WriteLine("Note: SX125x #" + rf_chain + " kept in standby mode"); } }
public Radio(RadioType in_Type, float in_Volume, float in_TolerancePercentage) { this.RadioType = in_Type; Volume = 0; TolerancePercentage = in_TolerancePercentage; }