I have a problem with the use of at.register('>') in the following code of the GPRS driver:
send: function(sckt, data) {
if (at.isBusy() || socks[sckt]=="Wait") return 0;
if (!socks[sckt]) return -1; // error - close it
var f = function(d) {
at.unregister('>');
if (d != sckt + ", SEND OK") return;
};
at.register('>', function() {
at.write(data);
return "";
});
at.cmd('AT+CIPSEND='+sckt+','+data.lengtĀh+'\r\n', 10000, f);
return data.length;
}
How can it handle multiple sockets with it? In the AT lib I can just register for some chars once. The next call of the send function for another (or for the same) socket tries to register for '>' again or sends a new AT+CIPSEND without waiting for ">" which leads the communication to an inconsistent state. I tried to set the socket to "Wait" until ">" comes in for the particular socket, but requests for other sockets were still able to send.
In the ESP8266 driver the problem was not existing because you send the data directly after AT+CIPSEND, which is - unfortunately - not working with the SIM900.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hello Gordon,
I have a problem with the use of at.register('>') in the following code of the GPRS driver:
How can it handle multiple sockets with it? In the AT lib I can just register for some chars once. The next call of the send function for another (or for the same) socket tries to register for '>' again or sends a new AT+CIPSEND without waiting for ">" which leads the communication to an inconsistent state. I tried to set the socket to "Wait" until ">" comes in for the particular socket, but requests for other sockets were still able to send.
In the ESP8266 driver the problem was not existing because you send the data directly after AT+CIPSEND, which is - unfortunately - not working with the SIM900.
Do you have an idea how to solve the problem?
Best,
Tobias