Hi Roman
I'm having some problems sending long messages. I have attached two log files, one is okay (a short message) and one is not okay (with long message).
It seems that the delivery report are not received.
It seems that sending long messages sometimes messes up the RefID (so it's missing).
It seems that the first char of the text message is chopped off (in this case "Alarm..." becomes "larm...") although I can see that the text property is being assigned with the correct message.
I have, just for now, tried using 7bit and I'm replacing special chars.
Do you have any suggestion for solving this problem?
function TAlarmScanThr.SendLowLevelPackage(ADispatchEventItem: TDispatchEventItem) : Boolean;
var
aPDU : TnrPduSms;
msg : string;
RefID : string;
eid : Integer;
i : integer;
AEventTypeItem : TEventTypeItem;
function replacespecchars(Atext : WideString) : WideString;
var
s : string;
begin
s := Atext;
s := WideStringReplace(s, 'æ', 'ae', [rfReplaceAll]);
s := WideStringReplace(s, 'ø', 'o', [rfReplaceAll]);
s := WideStringReplace(s, 'Ã¥', 'a', [rfReplaceAll]);
s := WideStringReplace(s, 'Æ', 'AE', [rfReplaceAll]);
s := WideStringReplace(s, 'Ø', 'O', [rfReplaceAll]);
s := WideStringReplace(s, 'Ã...', 'A', [rfReplaceAll]);
result := s;
end;
begin
result := False;
if not Assigned(ADispatchEventItem) then exit;
AEventTypeItem := FEventTypeNameList.GetEventTypeNameByID(100);
with fmMain, ADispatchEventItem, SetupRec do
try
inc(FAlarmCountThisScan);
for I := 0 to DispatchEventItems.Count-1 do
begin
with (DispatchEventItems.Items as TDispatchItem) do
begin
if PhoneNumber = '' then Continue;
if pos(GSMCountryCode, PhoneNumber) = 0 then
PhoneNumber := GSMCountryCode + PhoneNumber;
aPDU := TnrPduSms.Create(False);
aPDU.Phone := PhoneNumber;
// aPDU.Coding := pc16bit;
aPDU.Confirm := True;
aPDU.AutoCutText := True;
aPDU.DateTime := Now;
aPDU.Text := replacespecchars(Calllist);
// aPDU.Text := replacespecchars(AlarmPath+'/'+AlarmAlias);
nrGsm.NewSmsMode := nsmSkipSave;
msg := 'Sending SMS PhoneNo:%s Message:%s, RefId:%s';
msg := format(msg,[aPDU.Phone, aPDU.Text, RefId]);
LogEvent(lcDispatchEvents, msg);
RefID := nrGsm.SmsSendWaitRefID(aPDU);
// RefID := nrGsm.SmsSendWaitRefID(PhoneNumber, replacespecchars(AlarmPath+'/'+AlarmAlias), True);
if trystrtoint(RefId, eid) then ExtId := eid;
SentTime := now;
aPDU.Free;
InsertAlarmHistoryLog(EventID, AEventTypeItem.EventTypeID, 0, AEventTypeItem.EventDescription, format('Alarm sent to %s, RefId %s',[DispatchName, RefID]));
end;
end;
result := True;
except
on e:exception do LogEvent(lcErrorEvents,'TAlarmScanThr.LowLevelSendPackage ' + e.message);
end;
end;
Hello
Thank you for your information.
I see some timeout errors in the BAD log.
You can try to play with baud rate or StreamProtocol of connection.
We need reproduce trouble on our side before we can fix it.
0) Does sample code run in main application thread?
1) Which value do you use for nrComm.UseMainThread property? Play with it.
2) Can you show me sample of long text, that was wrong separated on several parts.
3) Can you try on other device (other model and manufacturer)?
Roman Novgorodov
DeepSoftware
Hi Roman
I have no other devices (except from the sierra wireless - which doesn't work for the moment ;) )
My application has a mainform where the nrComm, nrGsm and NrLog is placed.
nrComm has UseMainThread = True.
StreamProtocol is Hardware and the com params are 115200, 8, n, 1 (as it should be) the device is connected via USB.
The "send" function is being called from a thread. That thread reads data from a SQL database and then send it via the nrGsm on the mainform.
This is a sample string of what I'm trying to send
Alarm Prio: 1
XXX-Bygning 101-CTS - ANLAEG-Bibliotek kaelder fugtalarm/Fugt alarm, Bibliotek kaelder
Msg: Alarm message pa et eller andet
1: [HENE] HENRIK NEDERGAARD
Phone1: 47101200 Phone2: Phone3: 20102200
Remark:
2: [GSM2] Bruger Efternavn
Phone1: Phone2: Phone3: 29804991
Remark: Test gsm bruger
3: [GSM3] Bruger3 Efternavn
Phone1: Phone2: Phone3: 29802359
Remark:
, RefId:
I have tried using the GSMDemo, and the exact same thing happens, I do however get a report back.
But no RefId and the message that arrives at the terminal is missing one chars at 3 different places.
The message is being sent as 3 messages....
I have done some more research, it's the 1st and thereafter every 153rd char that gets cut away. So I think the length of multipart packages or the offset when the message is being sent is one position wrong.
Quote from: Roman Novgorodov on May 03, 2011, 04:45:55 PM
Hello
Thank you for your information.
I see some timeout errors in the BAD log.
You can try to play with baud rate or StreamProtocol of connection.
We need reproduce trouble on our side before we can fix it.
0) Does sample code run in main application thread?
1) Which value do you use for nrComm.UseMainThread property? Play with it.
2) Can you show me sample of long text, that was wrong separated on several parts.
3) Can you try on other device (other model and manufacturer)?
Roman Novgorodov
DeepSoftware
Hi Roman
Have you had a look at this problem yet?
I you send me a gsmdemo binary I can test it and return the log file if it's any help?
Anyways, I think there is an error in sending splitting a long message string into multiple packages.
I don't know why this affects the report function, but it does. ???
Hello
Thanks for your investigation and information.
Yes, we reproduced problem. Trouble appears if message exceeds 160 length.
We are trying to fix problem now.
Roman Novgorodov
DeepSoftware
Hello
Please check new version of GSM demo from attachment.
Roman Novgorodov
DeepSoftware
Hello
I have not done a full test but have successfully testet a long message where I received a RefID and two reports 8) I understand that I of course will get two reports when two messages are sent. ::)
thanks!
Hello Roman
When is the next version being released? (the version that solves this issue 8) )
Hello
Please check nrComm Lib v9.17. It was released week ago. You can visit update center and get latest release.
Roman Novgorodov
DeepSoftware