Esempio n. 1
0
        public void WriteModuleConfiguration()
        {
            _commandProcessingService.OnCommandSuccess += OnMultipleConnectionSettingSuccess;
            if (_moduleConfiguration.MultipleConnections)
            {
                _commandProcessingService.ExecuteCommand("AT+CIPMUX=1", 100);
            }
            else
            {
                _commandProcessingService.ExecuteCommand("AT+CIPMUX=0", 100);
            }
            commandParsed = false;
            while (!commandParsed)
            {
                ;
            }
            _commandProcessingService.OnCommandSuccess -= OnMultipleConnectionSettingSuccess;

            if (_moduleConfiguration.Mode == ModuleMode.STATION)
            {
                SetMode((int)ModuleMode.STATION);
                WriteStationConfiguration();
            }
            else if (_moduleConfiguration.Mode == ModuleMode.SOFT_AP)
            {
                SetMode((int)ModuleMode.SOFT_AP);
                WriteAccessPointConfiguration();
            }
            else
            {
                SetMode((int)ModuleMode.STATION_AND_AP);
                WriteStationConfiguration();
                WriteAccessPointConfiguration();
            }
        }
Esempio n. 2
0
        public void GetModuleConfiguration()
        {
            error = false;
            _commandProcessingService.OnCommandTimeout += Timeout;

            _commandProcessingService.OnParseSuccessResponse += ParseModeSetting;
            commandParsed = false;
            _commandProcessingService.ExecuteCommand("AT+CWMODE?", 200);
            while (!commandParsed)
            {
                ;
            }
            _commandProcessingService.OnParseSuccessResponse -= ParseModeSetting;

            _commandProcessingService.OnParseSuccessResponse += ParseMultipleConnectionSetting;
            commandParsed = false;
            _commandProcessingService.ExecuteCommand("AT+CIPMUX?", 200);
            while (!commandParsed)
            {
                ;
            }
            _commandProcessingService.OnParseSuccessResponse -= ParseMultipleConnectionSetting;

            if (_moduleConfiguration.Mode == ModuleMode.STATION)
            {
                GetStationConfiguration();
            }
            else if (_moduleConfiguration.Mode == ModuleMode.SOFT_AP)
            {
                GetAccessPointConfiguration();
            }
            else
            {
                GetStationConfiguration();
                GetAccessPointConfiguration();
            }

            _commandProcessingService.OnCommandTimeout -= Timeout;
            _moduleConfiguration.ConfigurationValid     = !error;
        }