hbjorgo / ATLib

ATLib is a C# library that makes it easy to communicate with modems.
MIT License
52 stars 20 forks source link

Unhandled Exception #11

Closed flybyray closed 3 years ago

flybyray commented 3 years ago

https://github.com/hbjorgo/ATLib/blob/a71502cc1f73644bc9648dd466ae637f1420cf73/src/HeboTech.ATLib/Modems/Generic/ModemBase.cs#L141

SIM Status: SIM_READY
Unhandled exception. System.InvalidOperationException: Sequence contains no elements
   at System.Linq.ThrowHelper.ThrowNoElementsException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at HeboTech.ATLib.Modems.Generic.ModemBase.SendSmsAsync(PhoneNumber phoneNumber, String message)
   at sendsms.Program.Main(String[] args) in /home/test/sendsms/Program.cs:line 45
   at sendsms.Program.<Main>(String[] args)
flybyray commented 3 years ago

Checked the DWM222 Modem manually AT+CMGF? and found that it was in PDU mode. I used smstools before. I think the current implementation of ATLib is using Text mode. After switching to Text Mode via minicom. I could send SMS.

hbjorgo commented 3 years ago

Hi

Thank you for reporting this, I appreciate feedback that can make this library better! I'll look into it and see what I can do. You shouldn't need to use minicom, did you try SetSmsMessageFormatAsync(...) to set the mode?

flybyray commented 3 years ago

sorry for not updating this issue. yes i already found that call and it worked. maybe just update the minimal example from README.md. I started with that but the modem was in PDU mode from previous usage.

hbjorgo commented 3 years ago

Thanks, I've updated it now :)