Quecopen SMS read on EC200UCN

Hello everyone, I’m trying to read new SMS via Quecopen sms api. Unfortunately it does not work.

Used the sms_demo example.

uint16_t msg_len = 512;
ql_sms_mem_info_t sms_mem = {0};
ql_sms_recv_s *sms_recv = NULL;

char *msg = malloc(msg_len);
if(msg == NULL){
	QL_SMS_LOG("malloc ql_sms_msg_s fail");
	goto exit;
memset(msg ,0 ,msg_len);

ql_sms_get_storage(nSim, &sms_mem);
QL_SMS_LOG("mem1=%d, mem2=%d, mem3=%d", sms_mem.mem1, sms_mem.mem2, sms_mem.mem3);

//Read SMS messages as text
if(QL_SMS_SUCCESS == ql_sms_read_msg(nSim,2, msg, msg_len, TEXT)){
	QL_SMS_LOG("read msg OK text, msg=%s", msg);
	QL_SMS_LOG("read sms FAIL");

//Read SMS messages as pdu
memset(msg ,0 ,msg_len);
if(QL_SMS_SUCCESS == ql_sms_read_msg(nSim,2, msg, msg_len, PDU)){
	QL_SMS_LOG("read msg OK pdu, msg=%s", msg);
	QL_SMS_LOG("read sms FAIL");

SMS read faild.

ql_sms:user_sms_event_callback 68 read sms FAIL.

Please Help.

Hi @J_S_Sahoo,
May I ask how’d you compiled the firmware? What was the command you used?
SMS might require VoLTE to work so please try the “VOLTE” build option if you didn’t.

is there any command or instruction that allows a SMS to be sent successfully when the message contains special characters?
Thank you beforehand

In sms_demo.c

ql_sms_new_s *msg = (ql_sms_new_s *)ctx;
QL_SMS_LOG(“sim=%d, index=%d, storage memory=%d”, nSim, msg->index, msg->mem);

Works, when new sms coming it shows.

#if 1
ql_sms_msg_s *msg = (ql_sms_msg_s *)ctx;
QL_SMS_LOG(“sim=%d,index=%d, msg = %s”,nSim, msg->index, msg->buf);

It also works at startup.

But if I want to read a sms using sms read api, does not work, showing read fail.

Hi @ShortyPTG
Could you give me an example of “special characters”?

Hi @J_S_Sahoo
The demo code by default reads the SMS message at index 2 (the third message) and will fail if the SIM card doesn’t have a message at that slot.
You can change the second parameter of the read API to 0 and see if you can read the first message.
And of course, make sure there is message to read in the first place.

Sim card has sms.

case QL_SMS_LIST_IND shows sms with index, msg, time .

ql_sms_read_msg(nSim,2, msg, msg_len, TEXT))
ql_sms_read_msg(nSim,2, msg, msg_len, PDU))

Both are not working, I also changed the index to 0 . But not working.

Are you able to get the return value of ql_sms_read_msg()? Please share it here. Thank you.


Return value -1

Just want to make sure that you were using the untouched SMS demo at “components\ql-application\sms\sms_demo.c” right? A return value of -1 is kinda odd.
Also, you might want to try the ql_sms_read_msg_ex() API included in the demo and see if that works.

Ok I will try.

When new sms comming how to read that sms?

A typical way of reading incoming SMS message is to release a message queue to another task that will do the actual reading in the SMS event callback. Reading SMS inside the event callback is not recommended.

1 Like

Can you share the code ?

Here’s a SMS demo I modified:
sms_demo.pdf (9.7 KB)
Due to site limitation, I have to change the file extension before uploading. Please change the file extension back to ".c” after downloading or just open the file in a notepad or something. We apologize for the inconvenience.

Thank for sharing the code

Kind regards

it works as i expected. Thank you

The characters å and à are not in the GSM 7-bit default alphabet or its extension table. But your first two characters are.

The characters å and à do appear in the GSM Portuguese National Language Single Shift Table (3GPP 23.038, section A.2.3).

Otherwise they can be encoded as Unicode in an 8-bit SMS.

All right, so, the message must use unicode 8 bit…

For those two characters, and in the absence of the Portuguese 7-bit extension table, yes.

These Unicode characters are 16 bits. You use 8-bit SMSs to transport them.

1 Like