At commands with E3531, sms disappears after one second - sms

I'm using the AT commands with the dongle. I activated the ttyUSB[0-2] based on this answer and as follows /etc/usb_modeswitch.d/12d1:1f01:
TargetVendor=0x12d1
TargetProduct= 0x1f01
MessageContent="55534243123456780000000000000011062000000100000000000000000000"
Now, I set my device as follows:
AT+CNMI=2,1,0,2,1
And when I receive a sms I see the message +CMTI: "SM",0 which means that I have the message in memory. However, the message stays there only for one second. If I enter the code to check the message after more than one second, it disappears, I have no idea why.
I verify the message with the following code:
AT+CMGF=1
AT+CMGL="ALL"
Have anyone encountered this problem before?

Related

what policy is based vehicle rerouting in case of accident?

I'm doing a scenario where there is 1 route at the beginning and then it splits into 3, then merges into 1 again. I'm stopping the car in the first lane, the second car stops also, the third one reroutes in the middle lane, the fourth goes to the queue, the fifth reroutes, the sixth goes to the queue, the seventh reroutes.....why is it behaving like that? I can't understand where to change this "balancing" or "threshold". Any suggestion?
The Veins 4.6 sample application behaves as follows:
if a vehicle is stopped (and has been driving) and has not yet sent a warning message, it sends a message containing its current road (TraCIDemo11p.cc, line 82)
if a vehicle receives a warning message, it tries to find a new route through the road network that avoids this road (TraCIDemo11p.cc, line 48); in addition, if it has not yet sent a warning message, it re-sends the received message (TraCIDemo11p.cc, line 54)
So, if you use this sample application and observe that some vehicles do not change their route, this can be attributed (among others) to either of the following effects:
they never received a message that told them about the congestion
they received a message, but couldn't find a route through the road network that would avoid the congestion
Why a vehicle did not receive a message can again be attributed (among others) to any of the following:
a warning message was transmitted to them, but they could not receive it (e.g., due to interference)
a warning message was transmitted through the network before they started their trip (remember, warning messages are not repeated by the example application)

How to test when the end of an SMS message has been reached

I am writing an application which acts on commands received via SMS (in Python, but the problem occurs in other languages).
This page on the CMGL command shows the following command and response:
AT+CMGL="ALL"
+CMGL: 1,"REC UNREAD","+31628870634",,"11/01/09,10:26:26+04"
This is text message 1
+CMGL: 2,"REC UNREAD","+31628870634",,"11/01/09,10:26:49+04"
This is text message 2
OK
Most implementations I have looked at look for a valid status such as OK or ERROR to detect the end of the response.
I am trying to find a way to determine the difference between this status code and the end of the message.
Otherwise it would be possible for a malicious sender to send a message of
Hello<CR><LF>OK<CR><LF>+CMGL: 1,(rest of fake message...)
Because I am receiving data on the serial port, there is no clear way to tell when I have reached the end of one message from the GSM board.
Could anyone point me to some information on the best practice here please? Other implementations I have seen do not seem to cover this issue.
The only idea I have had so far (but feels quite messy) is to keep reading until a timeout has been hit. Then check the number of OK / ERROR lines in the message and only accept the last.

Duplicate Firing of `active chat message received` handler

While Manu G E asked a similar question twice, neither got an adequate answer, and I'm hoping I'll have better luck.
I'm writing an AppleScript to execute a handler when Messages.app receives a message. The script is being saved to ~/Library/Application\ Scripts/com.apple.iChat and is set in the Messages preferences to be the AppleScript handler.
When Messages is the frontmost application and a message is received, the active chat message received handler is fired twice. This doesn't seem to be a problem when Messages is in the background (received messages then fire message received, and that handler only once). I know which handler is fired because the portion that deals with the handlers looks like this:
using terms from application "Messages"
on message received _msg from _sender for _chat with _text_desc
if DEBUG then display dialog "message received"
message_received(_sender)
end message received
on chat room message received _msg from _sender for _chat with _text_desc
if DEBUG then display dialog "chat room message received"
message_received(_sender)
end chat room message received
on active chat message received _msg from _sender for _chat with _text_desc
if DEBUG then display dialog "active chat message received"
message_received(_sender)
end active chat message received
-- More handlers below, mostly like the above or empty
end using terms from
I set a DEBUG property to true and can see which handler gets fired.
I've tried working around this by writing a temporary file (using the UUID of the _sender). The message_received handler checks for the existence of the file and is supposed to do nothing if it's present. But this hasn't worked, even with random delays. I tried extending the length of the random delays, but this brings up errors about the AppleScript running for more than 10 seconds, even when enclosing the code within a with timeout of block.
Regardless of Apple's apparent support for executing AppleScripts in response to Messages events, perhaps I should look at some other mechanism to support this request from the client. I'm open to ideas.
Somehow I managed to find a simple but (very) dirty hack that seems to work for me, but I can't say if it will work on any machine. So "active chat message received" seems to be called twice at the same time, but I noticed something like do shell script "php -r 'echo microtime() >> file.txt'" sometimes reveals slightly different values.
I also use a property as a flag and try to take advantage of that shell execution tiny interval by writing to a file:
echo 0 > ~/Documents/flag.txt
then:
property flag : 0
using terms from application "Messages"
#...
on active chat message received theMessage from theBuddy
set response to false
set the_script to "cat ~/Documents/flag.txt"
set flag to do shell script the_script
do shell script "echo 1 > ~/Documents/flag.txt"
if flag is "0" then
set response to true
else
do shell script "echo 0 > ~/Documents/flag.txt"
end if
if response then
#this should be executed only once
end if
end active chat message received
#...
end using terms from
And voilĂ . Again I cannot say if that solution works everytime, and explaining why it actually works in my case is way beyond my capabilities right now. Still, I hope it will be useful. Cheers

+CMS ERROR 41 on Telit Modem

I am a developer, working on "Telit" GE865-Quad using AT commands.
I am planning an application, witch sends SMS when certain condition occurs. When the application does not send SMS the modem is shut-down (Therefore every time I want to send SMS I have to turn on the modem). This application sends 3 SMS to different numbers one after the other.
The application is working just fine. The problem apear after a while (after sending certain amount of SMS), when I give the command to send SMS I get "+CMS ERROR 41" ("Temporary failure"). Once this message appear, every time I try to send SMS I get the same ERROR - It is like the SIM card is stuck. The only way I have found to get rid of this error is to enter the SIM card to my privet phone and send SMS.
I have spoken to "Telit" representative and he could not give a satisfying answer other then adding more delay between messages.
This is some of the relevant code :
(Turning on sequence) // From "Telit" GE865-Quad DataSheet
> #QSS: 3 //Before I start working with the modem i wait for this response with means the SIM is ready to use and the registration is to cellular network is complete*/
AT+CMGF=1 // Text Mode
OK
AT+CMGS=+xxxxxxxxxxxx // My number.
"This is the message i want to send" //Preparing the desired message require some coding But I think this is irrelevant to the subject.
//Delay for 3 secs//
And again : AT+CMGS=+xxxxxxxxxxxx // My number.
"This is the message I want to send"
//Delay for 3 secs//
(The same thing one more time)
The questions are:
Why does it happen, what am I doing wrong??
How can I unblock the SIM? What does the phone do so I can keep sending SMS?
The purpose is the keep sending SMS automatically.
This is the first time I publish a message in this website so if something is unclear please let me know. :)
Thanks for all the helpers.
Itay.
today i encountered this +CMS ERROR: 41 error, many times.
There was about 40 unread messages in the receiving modem.
After i deleted all received messages error disappeared.
I think may be operator is protecting customers from spam.
Dmitri
It is due Either SMS service on your SIM is not available or your SMS subscription is expired.

Selecting an outgoing mail message programmatically

Here's what I'm attempting to do: Let's assume that you are in mail and create a New blank mail message, then enter some data into it, such as body copy, etc. (in my case, the message was created through scripting bridge using the "Mail Contents of this Page" from safari... the main purpose of this process for my application.)
From my application, I want to select that message and assign it to:
MailOutgoingMessage *myMessage;
so that I can programmatically add recipients. I've tried several ways of doing this which seemed logical, but so far I haven't found the right combination, and the header file doesn't seem to be very clear to me (I'm new to scripting bridge.)
My initial thought was to try this:
mailMessage = [[mail outgoingMessages] lastObject];
Which should grab the last outgoing message created. It seems to work in that I am able to add recipients to mailMessage (though there have been a few times that I received unexpected results when multiple outgoing messages exist, such as adding the recipients to the wrong message) but attempting to log the subject line of the message:
NSLog(#"Subject = %#",[mailMessage subject]);
always returns NULL even though there is a subject clearly viewable in the subject field of the message. NULL is returned for any other parameter as well.
I'm gathering it must be a problem with my assignment to mailMessage above, because the only time I receive a NULL for message properties (or receive unexpected results) is if I try to point mailMessage to an existing outgoing message. If I create the mail message with scripting bridge, then I can retrieve all of the properties correctly.
Does anyone understand the hierarchy of the Mail scripting enough to tell me why I am getting NULLs for the parameters using the above assignment for mailMessage? What would the simplest way be go grab my message so that I can add recipients and later call the:
[myMessage send];
method? Any insight would be helpful. I've spent a week going through the mail.h header file and am quite literally at a loss as to what else to try at this point.
There's no way to (send, get or set the properties of the outgoing message) that the user or Safari has created.
It's a bug (it stopped working since Mac OS X 10.4), or some privacy/security considerations.

Resources