Search code examples
gsmat-commandhyperterminal

Is there any AT command to check whether the inbox is full or not in GSM?


Is there any AT command to check whether the message inbox is full or empty? i know some SMS related commands to read,write,send and storing into the memory locations (SIM memory,flash).In my case i'm storing the messages in SIM memory,so it is offering some memory locations (upto 10 messages only).


Solution

  • Yes there is. You can check with the AT+CPMS command. Example using atinout:

    $ echo AT+CPMS=? | atinout - /dev/ttyACM0 -
    AT+CPMS=?
    +CPMS: ("ME","SM"),("ME","SM"),("ME","SM")
    
    OK
    $ echo AT+CPMS? | atinout - /dev/ttyACM0 -
    AT+CPMS?
    +CPMS: "ME",5029,47843,"ME",5029,47843,"ME",5029,47843
    
    OK
    $
    

    The command is defined in 27.005 and the format for the read command1 response is given as

    +CPMS: <mem1>,<used1>,<total1>,<mem2>,<used2>,<total2>,<mem3>,<used3>,<total3>
    

    which is exactly what you ask for.

    The read command will return values for the currently selected mem locations, to query a different mem location select it first with the set command2. Alternatively the set command actually gives the same information as the read command in a information text response as well, so you might choose to parse that instead.


    1 See 5.4.4.3 Parameter read command syntax in V.250.

    2 Notice that while the syntax for that is specified to allow for mem1 to be specified alone without giving mem2 some phones do not like that, so the compatible approach is to always specify both mem1 and mem2 at the same time, e.g. AT+CPMS="SM","SM".