LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

GSM modem HELP!!!

hi, i done a receive SMS and delete SMS program. As the deleting part request the user to press a button in order to delete the msg. At the same time a second SMS is coming in but after the first SMS is deleted. The second SMS is unable to be shown. Is there any ways to prevent the data lost? Thank You.

0 Kudos
Message 1 of 10
(3,918 Views)

Hi gabriellimhj,

 

What is the GSM modem or related hardware that you're using?

 

May I ask what does your code does? 

 

 

From what I understand (correct me if I'm wrong):

  1. You're setting the preferred message format to text based (AT+CMGF=1)
  2. I'm not sure what is the ALL section of the AT+CMGL="ALL" does but I presume based on the AT_CMGL means that you are trying to list all the message (AT+CMGL="ALL").
  3. From what I can see from the case structure and while loop in it, if there is a message in the list, then you're to delete the first index of the message (AT+CMGD=1) when the byte exceeds 21 and it will continue to delete index 1 until you stop it?

When you mentioned that the second SMS is not shown, was the 1st SMS shown? Is all the message content been deleted or that the message received is still there? 

 

If you want the use to press the button to delete the message, why did you place that delete command within the while loop instead of the below screenshot?:

Capture.JPG

 

 

Warmest regards,

Lennard.C

 

 

Learning new things everyday...
0 Kudos
Message 2 of 10
(3,878 Views)

Ya, i have changed it and it works too. But it is able to display the remaining messages but i wont be able to delete them, as i only have the command to delete the first message.

 

AT+CMGF=1 - set modem to SMS mode

AT+CMGL="ALL" - displayed all messages

AT+CMGD=1 - delete the first message

0 Kudos
Message 3 of 10
(3,805 Views)

Hi,

 

When you receive the message, did you receive any unparsed results which indicates where the unread message is stored?

 

For example:

+CMTI:"SM",3
Note: New message received

 

Where 3 should be the index of where the unread message is. If so, perhaps you can create the following order: 

Presume that you have no message initially, check if any message is received as shown in the example above >> Parse out the value of the unread message (e.g. extract the value = 3 from the +CMTI:"SM",3) >> Read the message >> User select delete and it will delete the read message (e.g AT+CMGD=3).

 

It does seem to be tricky but its more a less that order. It would be great if you can have something like a 2 way handshaking interface between labview and the modem.

 

Warmest regards,

Lennard.C 

Learning new things everyday...
0 Kudos
Message 4 of 10
(3,618 Views)

hi, can u show me a example how do i parse out the value and then delete it? i did a code which is able to detele 2 messages but its not very practical because there might be alot of messages coming in.

0 Kudos
Message 5 of 10
(3,578 Views)

Hi,

 

Can you provide me an output result after you send the  AT+CMGL="ALL" command? Second, do you have any docummentation which I can refer onto about your modem in terms of their AT commands? If you delete index 1, will the unread message (let's say its at index 2) will become index 1?

 

Theoratically, you can parse the word out using Match Pattern function (ctrl+space and type Match Pattern).

 

For example (result after I send a AT+CMGL="ALL"):
Untitled2.jpg

 

So let say that I know that the unread message will be at index 2, I'll have to delete index 1. 

Untitled.jpg

 

 

What happens above is that after I extract the index number of the unread message, I'll use it as the anount of loop I have to run (decrement by 1 since I don't want to delete the unread message). The for loop is wrapped around the AT+CMGD command. I used the iteration value + 1 (you need to increment by 1 since the message index starts with 1) and format it into string using Format into String function. This value is concenated after the AT+CMGD= command so that I will individually delete the message excluding the unread message. Let's say the unread message index is 3, so it will be like

iteration1: AT+CMGD=1 

iteration2: AT+CMGD=2

and so on...

 

It's just an idea. Perhaps you can think of a better option? 

 

Warmest regards,

Lennard.C

 

Learning new things everyday...
0 Kudos
Message 6 of 10
(3,571 Views)

hi, more information about the modem is over here. http://www.bluocean.biz/technicalinfo.html The output of AT+CMGL="ALL" is attached in the image. If i delete index 1 message at index 2 wont become index 1. Thanks

0 Kudos
Message 7 of 10
(3,563 Views)

Hi, 

 

Then, maybe you can try something like the below?:
Untitled 3.jpg

 

Use Match Pattern to parse out the first message index number. Use Match Pattern to parse out the message from the first read message to the unread message. Put them into string array determine the size of that array and use the value of the array size to get the element out from that string array. Use match pattern on that extracted element to get the index number of the unread message.

 

Subtract the unread message index and the 1st read message index value to determine the loop count. Use the first read message index value as the first message you want to delete from. Add that value to the iteration value. E.g. lets say I have index 2 as my 1st read message and index 5 is my unread message, I'll do the following:

 

Loop count = 5-2 = 3

 

iteration: 0, 2+0 = 2, AT+CMGD=2

iteration: 1, 2+1 = 3, AT+CMGD=3 

iteration: 2, 2+2 = 4, AT+CMGD=4

 

The code seemed to be a little messy but I'm sure you can figure out the rest. 

 

Warmest regards,

Lennard.C

Learning new things everyday...
0 Kudos
Message 8 of 10
(3,541 Views)

hi may i know how can i extract the information of read buffer. For example i want to make the code if +CMGL:10 it will enter the delete loop. Thanks

0 Kudos
Message 9 of 10
(3,528 Views)

Hi,

 

The below should do the trick. I'll leave the rest to you to play around with the suggested code. You can use the match pattern to find that particular string and connect its match output string to the string length. If the value is string length is 0, means that there aren't any. If there is such string, it should give a value >0. 

Capture.JPG

 

Warmest regards,

Lennard.C

 

 

Learning new things everyday...
0 Kudos
Message 10 of 10
(3,522 Views)