Great! The response is coming back prefixed with +RECEIVE, not +IPD. Seems odd (I'd expected IPD after the call to CIPHEAD), but it can be changed easily...
// Instead of ipdHandler:
//Handle +RECEIVE input data from SIM900A
function receiveHandler(line) {
var colon = line.indexOf(":");
if (colon<0) return line; // not enough data here at the moment
var parms = line.substring(9,colon).split(",");
parms[1] = 0|parms[1];
var len = line.length-(colon+1);
if (len>=parms[1]) {
// we have everything
sockData[parms[0]] += line.substr(colon+1,parms[1]);
return line.substr(colon+parms[1]+1); // return anything else
} else {
// still some to get
sockData[parms[0]] += line.substr(colon+1,len);
return "+RECEIVE,"+parms[0]+","+(parms[1]-len)+":"; // return RECEIVE so we get called next time
}
}
// ...
var connect = function(usart, connectedCallback) {
gprsFuncs.at = at = require("AT").connect(usart);
require("NetworkJS").create(netCallbacks);
at.register("+RECEIVE", receiveHandler); // <----------------------------
gprsFuncs.reset(connectedCallback);
return gprsFuncs;
};
Sorry for not getting this sorted for you last time - I've been a bit busy. I did buy the second GPRS module, from a UK seller, but I still wasn't getting a mobile connection so couldn't get anything working :(
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.
Great! The response is coming back prefixed with
+RECEIVE
, not+IPD
. Seems odd (I'd expected IPD after the call to CIPHEAD), but it can be changed easily...Sorry for not getting this sorted for you last time - I've been a bit busy. I did buy the second GPRS module, from a UK seller, but I still wasn't getting a mobile connection so couldn't get anything working :(