INCLUDE rtcu.inc
VAR_OUTPUT
gwOK : BOOL;
gprsOK : BOOL;
END_VAR;
PROGRAM testvsms;
VAR
rc : INT;
sms : gsmIncomingSMS;
ns : DINT;
sMyNodeID : STRING;
END_VAR;
gsmPower(power:=TRUE);
DebugFmt(message:="gprsOpen=\1",v1:=gprsOpen());
ns:=clockNow()+60;
sMyNodeID:=strConcat(str1:="@", str2:=dintToStr(v:=boardSerialNumber()));
DebugMsg(message:=sMyNodeID);
BEGIN
sms();
if clockNow()>ns THEN
DebugFmt(message:="gsmSendSMS()=\1", v1:=gsmSendSMS(phonenumber:=sMyNodeID, message:="Hello world"));
ns:=clockNow()+60;
END_IF;
if sms.status>0 THEN
DebugMsg(message:="SMS received");
DebugMsg(message:=sms.phonenumber);
DebugMsg(message:=sms.message);
END_IF;
gprsOK:=gprsConnected();
gwOK:=gwConnected();
END;
END_PROGRAM;
|