示例#1
0
        /// <summary>
        /// Configures this serial line.
        /// </summary>
        /// <remarks>
        /// This should be called at most once.
        /// </remarks>
        /// <param name="baudRate">The baud rate.</param>
        public void Configure(int baudRate = 9600)
        {
            if (_api != null)
            {
                throw new Exception("XBee.Configure can only be called once");
            }

            Logger.Initialize(ErrorPrint, LogLevel.Error, LogLevel.Fatal);
            Logger.Initialize(DebugPrint, LogLevel.Warn, LogLevel.Info, LogLevel.Debug, LogLevel.LowDebug);

            _connection = new SerialConnection(_serialPortName, baudRate);
            _api        = new XBeeApi(_connection);

            Enable();

            _api.Open();
        }
示例#2
0
        /// <summary>
        /// Configures this serial line.
        /// </summary>
        /// <remarks>
        /// This should be called at most once.
        /// </remarks>
        /// <param name="baudRate">The baud rate.</param>
        public void Configure(int baudRate = 9600)
        {
            if (_api != null)
                throw new Exception("XBee.Configure can only be called once");

            Logger.Initialize(ErrorPrint, LogLevel.Error, LogLevel.Fatal);
            Logger.Initialize(DebugPrint, LogLevel.Warn, LogLevel.Info, LogLevel.Debug, LogLevel.LowDebug);

            _connection = new SerialConnection(_serialPortName, baudRate);
            _api = new XBeeApi(_connection);

            Enable();

            _api.Open();
        }