Bypass message storage when sending SMS with AT commands - sms

I have an array of Motorola Razar v3m's containg about 26 phones now. I have a multi-threaded software platform I built which manages each phone and message routing/timed-wait tasks and all of that.
When I issue:
AT+CMGW="1234567890"message<26><27>
It takes nearly 30 seconds to write the message to the phone memory, I then get send the message using:
AT+CMSS=messageIndex
and that takes another 30 seconds.
I have tried using AT+CMGS but can't get that functionality to send a message successfully at all.
I need this to be reliable, but with this method/phone combination, I wouldn't even depend on it to tell me Happy Birthday once a year.
Is there another way to send an SMS without storing it to memory first? Not only is it slow; but eventually causes the phone to no longer send messages at all, even if they are deleted after by AT+CMGD.

It sounds like the you are writing to the sim memory since it is so slow.
From the description of AT+CMGW in 27.005:
Execution command stores message (either SMS-DELIVER or SMS-SUBMIT) to memory storage <mem2>.
and earlier in "3.1 Parameter definitions":
<mem1> string type; memory from which messages are read and deleted (commands List Messages +CMGL, Read Message +CMGR and Delete Message +CMGD); defined values (others are manufacturer specific):
"BM" broadcast message storage
"ME" ME message storage
"MT" any of the storages associated with ME
"SM" (U)SIM message storage
"TA" TA message storage
"SR" status report storage
<mem2> string type; memory to which writing and sending operations are made (commands Send Message from Storage +CMSS and Write Message to Memory +CMGW) ); refer for defined values
The value of <mem1> and <mem2> is configured with AT+CPMS, preferred message storage (notice you should set both to the same value). So my guess is that if you run AT+CPMS? it will return +CPMS: "SM", ..., ..., "SM", .... If my guess is correct you should just switch to another storage on the phone ("ME", "MT" or "TA" - check with AT+CPMG=? what it supports (and it might support additional storages compared to the standard)) which will be much faster that the sim storage.
Using AT+CMGS should be possible, but notice that you do need to wait for "\r\n> " before sending the payload. When you say you did not get that one to work I assume you had some trouble with regards to proper parsing of the responses and proper waiting.

Related

Proper way of freeing buffers when using NdisSendPackets? (NDIS 5.0)

When using the simple case of NdisSend, I free the packet buffer and the buffer in case the returned status is not NDIS_STATUS_PENDING,
So what is the proper way of freeing the buffers that i Allocated with NdisAllocatePacket and NdisAllcateBuffer in the case of NdisSendPackets?
in the NdisSendPackets page, MSDN says:
"The caller of NdisSendPackets should test the returned status for each packet in such an array individually when its ProtocolSendComplete function is called with the completion Status"
But in the ProtocolSendComplete MSDN, it says:
"This function is a required driver function that completes the processing of a protocol-initiated send previously passed to NdisSendPackets or NdisSend, which returned NDIS_STATUS_PENDING."
So.. based on what i gathered, SendComplete is called only for packets that returned NDIS_STATUS_PENDING.
But why it says that i "should test the returned status " in the SendComplete, if its only for NDIS_STATUS_PENDING?!
The main problem I'm facing right now is that even tho I'm looping through every packet in the array after NdisSendPackets, and freeing only the ones that are not NDIS_STATUS_PENDING, i got a bugcheck at NdisFreeBuffer for "Attempt to free pool which was already freed" (BAD_POOL_CALLER), even tho I'm sure as hell i didn't free it before myself.. I moved all my buffer freeing to the SendComplete and i no longer get bugcheck, So it seems like my assumption was true and my SendComplete gets called for every packet, and not just the ones that return NDIS_STATUS_PENDING..
And another side question:
Do all NICs support multi packet send/recv? Is there any need for me to be worry when i use a packet array with NdisSendPackets and NdisMIndicateReceivePacket, instead of a single packet, or do all the NICs properly support multi packet send/recv?

How to store receiving SMS in GSM Module memory (SM or ME)?

I am using AI Thinker A7 GSM/GPRS/GPS Module demo v7.1.
I am trying to send and receive SMS through AI-Thinker Serial Tools V1.2.3.0
This module is working fine with making a call and receiving a call, sending and receiving an SMS. They work exactly fine.
The problem is that it does not store SMS in the memory?
I have done a lot of things to make it work, but there is no progress.
For instance, my AT commands and their responses are here,
AT+CPMS=?
+CPMS: ("ME","SM"),("ME","SM"),("ME","SM")
and
AT+CPMS="SM"
+CPMS: 0,35,0,35,0,25
and
AT+CPMS="ME"
+CPMS: 0,25,0,35,0,25
And I have tried CNMI settings like these,
AT+CNMI=1,1,0,0,0
OK
After these, I send msgs, and then tried to check through AT+CPMS and AT+CMGL, but there are no messages stored.
then I tried
AT +CNMI = 2,1,0,0,0
OK
and the same with
AT +CNMI = 2,2,0,0,0
OK
similarly
AT +CNMI = 0,1,0,0,0
OK
But still, I have not succeeded in getting message stored in memories.
Please help, if there are any other settings I need to do or my commands are wrong or my module doesn't support storing SMS (i highly doubt it since it has memory spaces which are showing that 25 SMS in SM, 35 in ME can be stored)??
If I understand your problem correctly, you are trying to read incoming SMS but can't list them.
Well, you need to understand that your GSM module doesn't store any incoming SMS by default. You have to command your GSM Module to store it. As you mentioned, you were very close to command for that. you need to command it this way:
AT+CPMS=mem1,mem2,mem3
AT+CPMS="SM","SM","SM"
As per documentation, you can mention three memories as the parameter for different operations like:
mem1 (in this example SM) - a memory from which messages are read and delete
mem2 (in this example SM; but could be ME) - a memory from which writing and sending operations are made
mem3 (in this example SM; but could be ME) - memory to which received messages are preferred to be stored
Now your GSM module will store all incoming messages into the SIM card and you'll be able to list all the messages with AT+CMGL=ALL
This way it worked for me.

Message formatting of OSC for MIDI messages

I'm using the github.com/hypebeast/go-osc/osc package to send OSC messages to an OSC server. For this I'm using OSCulator so that I can route the data as MIDI to Abelton Live.
The problem I'm having is I can not find any information on message formatting for things like note on, note off, duration etc. I found a guide on the OSCulator website that's a little helpful, but it doesn't go into much detail on messaging: http://s3.amazonaws.com/osculator/doc/OSCulator+2.12+Manual.pdf
For example, the following function works just fine, but I have no idea what the message is really doing:
func note(pitch float32 , velocity float32) {
// TODO: Pass client into function. Find out it's type.
client := osc.NewClient("localhost", 8765)
noteMsg := osc.NewMessage("/4/toggle2")
client.Send(noteMsg)
msg := osc.NewMessage("/4/xy")
msg.Append(pitch)
msg.Append(velocity)
client.Send(msg)
}
I mean, what purpose does the 4 play in this, and what is xy? Also, what other messages are available apart from toggle2? I thought there would be some sort of documentation online that has all the different types of messages available for MIDI type applications.
Your question seems to be more related to OSC itself.
OSC works like this:
You send a message to a server. A message is composed by an adress and some values.
In this case, /4/xy is the address. The 4 and the slashes you define what will be. When you receive it on the other side you will know what you want to receive, which means the address you're sending. So you will configure the server or the receiver to do something when it receives a message from a specific adress.
In the same way, you are appending values to the message. The quantity of values you already know, so you just have to do what you want with them when you receive.
Basically, if you decide to have a keyboard sending notes, you would use something like /keyboard/note as adress and send one value at a time, so you would read this value and do something with it.

Pubnub chat application with storage

I'm looking to develop a chat application with Pubnub where I want to make sure all the chat messages that are send is been stored in the database and also want to send messages in chat.
I found out that I can use the Parse with pubnub to provide storage options, But I'm not sure how to setup those two in a way where the messages and images send in the chat are been stored in the database.
Anyone have done this before with pubnub and parse? Are there any other easy options available to use with pubnub instead of using parse?
Sutha,
What you are seeking is not a trivial solution unless you are talking about a limited number of end users. So I wouldn't say there are no "easy" solutions, but there are solutions.
The reason is your server would need to listen (subscribe) to every chat channel that is active and store the messages being sent into your database. Imagine your app scaling to 1 million users (doesn't even need to get that big, but that number should help you realize how this can get tricky to scale where several server instances are listening to channels in a non-overlapping manner or with overlap but using a server queue implementation and de-duping messages).
That said, yes, there are PubNub customers that have implemented such a solution - Parse not being the key to making this happen, by the way.
You have three basic options for implementing this:
Implement a solution that will allow many instances of your server to subscribe to all of the channels as they become active and store the messages as they come in. There are a lot of details to making this happen so if you are not up to this then this is not likely where you want to go.
There is a way to monitor all channels that become active or inactive with PubNub Presence webhooks (enable Presence on your keys). You would use this to keep a list of all channels that your server would use to pull history (enable Storage & Playback on your keys) from in an on-demand (not completely realtime) fashion.
For every channel that goes active or inactive, your server will receive these events via the REST call (and endpoint that you implement on your server - your Parse server in this case):
channel active: record "start chat" timetoken in your Parse db
channel inactive: record "end chat" timetoken in your Parse db
the inactive event is the kickoff for a process that uses start/end timetokens that you recorded for that channel to get history from for channel from PubNub: pubnub.history({channel: channelName, start:startTT, end:endTT})
you will need to iterate on this history call until you receive < 100 messages (100 is the max number of messages you can retrieve at a time)
as you retrieve these messages you will save them to your Parse db
New Presence Webhooks have been added:
We now have webhooks for all presence events: join, leave, timeout, state-change.
Finally, you could just save each message to Parse db on success of every pubnub.publish call. I am not a Parse expert and barely know all of its capabilities but I believe they have some sort or store local then sync to cloud db option (like StackMob when that was a product), but even if not, you will save msg to Parse cloud db directly.
The code would look something like this (not complete, likely errors, figure it out or ask PubNub support for details) in your JavaScript client (on the browser).
var pubnub = PUBNUB({
publish_key : your_pub_key,
subscribe_key : your_sub_key
});
var msg = ... // get the message form your UI text box or whatever
pubnub.publish({
// this is some variable you set up when you enter a chat room
channel: chat_channel,
message: msg
callback: function(event){
// DISCLAIMER: code pulled from [Parse example][4]
// but there are some object creation details
// left out here and msg object is not
// fully fleshed out in this sample code
var ChatMessage = Parse.Object.extend("ChatMessage");
var chatMsg = new ChatMessage();
chatMsg.set("message", msg);
chatMsg.set("user", uuid);
chatMsg.set("channel", chat_channel);
chatMsg.set("timetoken", event[2]);
// this ChatMessage object can be
// whatever you want it to be
chatMsg.save();
}
error: function (error) {
// Handle error here, like retry until success, for example
console.log(JSON.stringify(error));
}
});
You might even just store the entire set of publishes (on both ends of the conversation) based on time interval, number of publishes or size of total data but be careful because either user could exit the chat and the browser without notice and you will fail to save. So the per publish save is probably best practice if a bit noisy.
I hope you find one of these techniques as a means to get started in the right direction. There are details left out so I expect you will have follow up questions.
Just some other links that might be helpful:
http://blog.parse.com/learn/building-a-killer-webrtc-video-chat-app-using-pubnub-parse/
http://www.pubnub.com/blog/realtime-collaboration-sync-parse-api-pubnub/
https://www.pubnub.com/knowledge-base/discussion/293/how-do-i-publish-a-message-from-parse
And we have a PubNub Parse SDK, too. :)

Server unable to receive byte data smoothly in vb6

I have a sender, a message forwarder which sends fix sizes of byte data at a rate of 5 milliseconds per message to my receiving program written in vb6, when I run the message fowarder and my receiving program on one machine, there's no issue but when they run on separate machines, the receiving program starts to experience some abnormalities.
e.g:
private sub socket_DataArrival(index as integer, ByVal dataTotal as Long)
Dim Data() as Byte
Length.Text = dataTotal
socket.GetData byteData, vbArray + vbByte
If Length.Text = "100" Then
txtOutput.Text = "Message1"
ElseIf Length.Text = "150" Then
txtOutput.text = "Message2"
End Sub
I will sometimes receive "2 in 1" message as in it comes in as 250 bytes or a non-recognizable byte size when I should be receiving either 100 or 150 only but if I reduce the sending rate to a slower speed say 50 milliseconds per message then it will be fine.
Can anyone provide with an advice? Thanks.
When sending data over a network you have to get used to the fact that the packets may arrive out of order, not promptly, not at all, etc.
You need to improve your message protocol to include a header that states which type of message follows. If order is important include a sequence number (I'm assuming you're using UDP). At present you are relying on timing to separate messages, which you cannot rely on over a network.
Buffer all your arriving data and handle it in chunks - the header allows you to tell what chunk size to use. Separate your input buffering from your message handling - use the DataArrival event to add data to the buffer, use a Timer or some other means of polling the buffer to check if it has messages ready to parse. Alas, this is VB6 so threading is not so easy. Take a look at The Common Controls Replacement Project timer object DLL if you need a Timer class that doesn't rely on a UI element being present.

Resources