Search code examples
delphiat-commandtcomport

How to cancel the last AT command ( Delphi - TComport )?


I send this command "AT+CUSD=1,"*511#",15", the answer is:

'+CUSD: 1,"Points Noudjoum
1: Mes points
2: Convertir en Units
3: Convertir en cadeaux physiques
4: Points Bonus
5: Catalogue
6: Conso
Tapez 1-6",15'

Here I need to send again the integer 1, 2, 3, 4, 5 or 6 depending on the option i want but at this point I can't send another AT command "AT+CUSD=1,"*113#",15" for example, it shows an error because it is expected to send the number of the option.
How can I break or cancel it so I can send another AT command ?


Solution

  • If your device supports it, send a command

    AT+CUSD=2
    

    It is not clear whether all devices support it, but it is documented for some devices, (e.g. in SIM7500_SIM7600 Series_AT Command Manual _V1.10). Meaning is cancel an ongoing USSD session.

    To find out whether the device supports this command, you can send

    AT+CUSD=?
    

    and the device will respond with the range accepted.