Portál AbcLinuxu, 10. května 2025 09:42
ch.... module number(1..31, 32=any) len... number of PDU bytes PDU... message in PDU format csum.. checksum of all PDU bytes (2 hexa digits) without carryThe sequence is:
AT!G=A6 (sms mode) AT^SR|SD|SM|SG (sms read,delete,to module,to group) AT!G=55 (smsm mode stop)manual (work with sms..) The PDU format is a little bit complicated..
hello, thank you for your time.
I've login by telnet to the 2N - VoiceBlue Lite. Executed the:
AT!G=A6 and received the OK msg.
But now i'm having trouble with the correct params for the AT^SR command, expecially the CSUM.
I've enconded a msg using de PDU Enconder. The param ch (module) active is number 0.
AT^SM=0,68,26069110090000F111000D92301569324394F50000AA0CC8F71D14969741F977FD07,??
ch = 0 (seen by using the commnd AT&QALL)
len = 68 Bytes, i'm using the function strlen() from PHP
But how do i calculate the correct csum?!
Thank you for you time.
String pduString = "26069110090000F111000D92301569324394F50000AA0CC8F71D14969741F977FD07";
byte[] pduBytes = DatatypeConverter.parseHexBinary(pduString);
int chsum = 0;
for (byte b : pduBytes) {
chsum += b;
}
chsum = chsum % 65536;
String finalyChsum = Integer.toHexString(chsum);
String pduString = "26069110090000F111000D92301569324394F50000AA0CC8F71D14969741F977FD07";
byte[] pduBytes = DatatypeConverter.parseHexBinary(pduString);
int chsum = 0;
for (byte b : pduBytes) {
chsum += (int)b;
if (b < 0) chsum += 256; //java byte is signed
chsum = chsum % 256;
}
String finalyChsum = Integer.toHexString(chsum);
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.