/// <summary> /// Returns the XBee value (value stored in the XBee module) of the stop bits setting of the /// firmware. /// </summary> /// <returns>The XBee value of the stop bits setting of the firmware.</returns> public int GetSerialStopBits() { AbstractXBeeSetting atSetting = GetAtSetting(SERIAL_SETTING_STOP_BITS); if (atSetting != null) { // Do not specify the network stack of the SB parameter by the moment (it's a common value). // TODO: [DUAL] When this setting is implemented individually for each network stack, update this code to // specify the network ID from which this parameter should be read. string settingValue = atSetting.GetXBeeValue(); if (!ParsingUtils.IsInteger(atSetting.GetXBeeValue())) { return(DEFAULT_SERIAL_STOP_BITS); } switch (int.Parse(settingValue)) { case 0: return(1); case 1: return(2); default: return(DEFAULT_SERIAL_STOP_BITS); } } return(DEFAULT_SERIAL_STOP_BITS); }
/// <summary> /// Returns the XBee value (value stored in the XBee module) of the baud rate setting of the firmware. /// </summary> /// <returns>The XBee value of the baud rate setting of the firmware.</returns> public int GetSerialBaudRate() { AbstractXBeeSetting atSetting = GetAtSetting(SERIAL_SETTING_BAUD_RATE); if (atSetting != null) { // Do not specify the network stack of the BD parameter by the moment (it's a common value). // TODO: [DUAL] When this setting is implemented individually for each network stack, update this code to // specify the network ID from which this parameter should be read. string settingValue = atSetting.GetXBeeValue(); if (!ParsingUtils.IsHexadecimal(atSetting.GetXBeeValue())) { return(DEFAULT_SERIAL_BAUD_RATE); } switch (ParsingUtils.HexStringToInt(settingValue)) { case 0: return(1200); case 1: return(2400); case 2: return(4800); case 3: return(9600); case 4: return(19200); case 5: return(38400); case 6: return(57600); case 7: return(115200); case 8: return(230400); case 9: return(460800); case 10: return(921600); default: return(DEFAULT_SERIAL_BAUD_RATE); } } return(DEFAULT_SERIAL_BAUD_RATE); }