Exemple #1
0
 public async Task SendSmsAsync(SmsMessage smsMessage)
 {
     await Task.Factory.StartNew(() =>
     {
         var execPath   = _configuration.GetSection("GammuSettings")["InjectorExecPath"];
         var confPath   = _configuration.GetSection("GammuSettings")["ConfPath"];
         var strCmdText = $"{GammuCommandFormatter.FormatSendSmsCommand(confPath, smsMessage.PhoneNumber, smsMessage.Content, smsMessage.Content.Length)}";
         _gammuExecutor.ExecuteCommand(execPath, strCmdText, true);
     });
 }
Exemple #2
0
        public async Task Init()
        {
            var execPath = _configuration.GetSection("GammuSettings")["ExecPath"];
            var confPath = _configuration.GetSection("GammuSettings")["ConfPath"];

            await _gammuConfigService.Init(confPath);

            await _gammuConfigService.PutValue("gammu", "device", GammuConfig.Device);

            await _gammuConfigService.PutValue("smsd", "device", GammuConfig.Device);

            await _gammuConfigService.Save();

            var stopSmsServiceCmd = GammuCommandFormatter.FormatStopSmsServiceCommand(confPath);

            _gammuExecutor.ExecuteCommand(execPath, stopSmsServiceCmd, true);

            var strCmdText = $"{GammuCommandFormatter.FormatRunSmsdCommand(confPath)}";

            _gammuExecutor.ExecuteCommand(execPath, strCmdText, true);
        }