arbeite wieder mal an meinen AT Commander projekt (Handyverwaltung über AT Kommandos) und hab Probleme beim senden von SMS
Delphi-Quellcode:
procedure TForm1.SendSMSClick(Sender: TObject);
begin
s := 'AT+CMGS=' + inttostr(Length(Edit8.Text) div 2-1); //PDU Länge senden
SendCMD2;
Memo5.Lines.Add(Result1);
s := Edit8.Text+ #$1A; // enthält PDU
SendCMD2;
Memo5.Lines.Add(Result1);
end;
Das Log vom PortMon sieht so aus
Zitat:
Mein Programm
194 0.00100404 ATcommander.exe IRP_MJ_WRITE Serial2 SUCCESS Length 12: AT+CMGS=26..
195 0.07969588 ATcommander.exe IRP_MJ_READ Serial2 TIMEOUT Length 4: ..>
196 0.00077887 ATcommander.exe IRP_MJ_WRITE Serial2 SUCCESS Length 57: 0001000B911027436739F900000ED4F29C0EA296E77410B53C A703...
197 4.07700755 ATcommander.exe IRP_MJ_READ Serial2 TIMEOUT Length 20: ..+CMGS: 218....OK..
Funktionierendes Programm
179 0.00072216 PDUspy.exe IRP_MJ_WRITE Serial2 SUCCESS Length 11: at+cmgs=26.
182 0.00000335 PDUspy.exe IRP_MJ_READ Serial2 SUCCESS Length 4: ..>
187 0.00112249 PDUspy.exe IRP_MJ_WRITE Serial2 SUCCESS Length 55: 0001000B811027436739F900000ED4F29C0EA296E77410B53C A703.
253 0.00000335 PDUspy.exe IRP_MJ_READ Serial2 SUCCESS Length 20: ..+CMGS: 215....OK..
Hab da TimeOuts aber alle anderen sachen am Gerät kann ich fehlerfrei Lesen und Schreiben
Ankommen tut aber nix
Comport
Delphi-Quellcode:
function TForm1.SetupCOMPort: Boolean;
const RxBufferSize = 8192;
TxBufferSize = 8192;
var DCB: TDCB;
Config: string;
CommTimeouts: TCommTimeouts;
begin
Result := True;
if not SetupComm(ComFile, RxBufferSize, TxBufferSize) then
Result := False;
if not GetCommState(ComFile, DCB) then
Result := False;
Config := 'baud=' + (iComBaud) + ' parity=n data=8 stop=1';
if not BuildCommDCB(@Config[1], DCB) then
Result := False;
if not SetCommState(ComFile, DCB) then
Result := False;
with CommTimeouts do
begin
PurgeCom(PURGE_TXABORT or PURGE_RXABORT or PURGE_TXCLEAR or PURGE_RXCLEAR);
ReadIntervalTimeout := 20;
ReadTotalTimeoutMultiplier := 1;
ReadTotalTimeoutConstant := 200;
WriteTotalTimeoutMultiplier := 0;
WriteTotalTimeoutConstant := 0;
{ReadIntervalTimeout := 15;
ReadTotalTimeoutMultiplier := 0;
ReadTotalTimeoutConstant := 1000;
WriteTotalTimeoutMultiplier := 0;
WriteTotalTimeoutConstant := 1000; }
end;
if not SetCommTimeouts(ComFile, CommTimeouts) then Result := False;
PurgeCom(PURGE_TXABORT or PURGE_RXABORT or PURGE_TXCLEAR or PURGE_RXCLEAR);
end;
function TForm1.PurgeCom(mode:Dword): boolean; //function
begin
result := PurgeComm(ComFile,mode);
end;
Portmon Log
Zitat:
Fremdanwendung
56 0.05360402 PDUspy.exe IOCTL_SERIAL_SET_BAUD_RATE Serial2 SUCCESS Rate: 115200
57 0.00276711 PDUspy.exe IOCTL_SERIAL_CLR_RTS Serial2 SUCCESS
58 0.00295568 PDUspy.exe IOCTL_SERIAL_SET_DTR Serial2 SUCCESS
59 0.00000196 PDUspy.exe IOCTL_SERIAL_SET_LINE_CONTROL Serial2 SUCCESS StopBits: 1 Parity: NONE WordLength: 8
60 0.00000168 PDUspy.exe IOCTL_SERIAL_SET_CHAR Serial2 SUCCESS EOF:0 ERR:0 BRK:0 EVT:0 XON:11 XOFF:13
61 0.02095518 PDUspy.exe IOCTL_SERIAL_SET_HANDFLOW Serial2 SUCCESS Shake:1 Replace:0 XonLimit:2048 XoffLimit:2048
62 0.00000447 PDUspy.exe IOCTL_SERIAL_PURGE Serial2 SUCCESS Purge: TXABORT RXABORT TXCLEAR RXCLEAR
63 0.00000475 PDUspy.exe IOCTL_SERIAL_SET_QUEUE_SIZE Serial2 SUCCESS InSize: 8192 OutSize: 8192
64 0.00000140 PDUspy.exe IOCTL_SERIAL_SET_TIMEOUTS Serial2 SUCCESS RI:-1 RM:0 RC:0 WM:0 WC:0
67 0.00000279 PDUspy.exe IOCTL_SERIAL_PURGE Serial2 SUCCESS Purge: TXABORT RXABORT TXCLEAR RXCLEAR
Meine
146 0.00000670 ATcommander.exe IOCTL_SERIAL_SET_QUEUE_SIZE Serial2 SUCCESS InSize: 8192 OutSize: 8192
147 0.00000140 ATcommander.exe IOCTL_SERIAL_GET_BAUD_RATE Serial2 SUCCESS
148 0.00000140 ATcommander.exe IOCTL_SERIAL_GET_LINE_CONTROL Serial2 SUCCESS
149 0.00000140 ATcommander.exe IOCTL_SERIAL_GET_CHARS Serial2 SUCCESS
150 0.00000140 ATcommander.exe IOCTL_SERIAL_GET_HANDFLOW Serial2 SUCCESS
151 0.00000140 ATcommander.exe IOCTL_SERIAL_GET_BAUD_RATE Serial2 SUCCESS
152 0.00000140 ATcommander.exe IOCTL_SERIAL_GET_LINE_CONTROL Serial2 SUCCESS
153 0.00000140 ATcommander.exe IOCTL_SERIAL_GET_CHARS Serial2 SUCCESS
154 0.00000112 ATcommander.exe IOCTL_SERIAL_GET_HANDFLOW Serial2 SUCCESS
155 0.05347635 ATcommander.exe IOCTL_SERIAL_SET_BAUD_RATE Serial2 SUCCESS Rate: 115200
156 0.00339345 ATcommander.exe IOCTL_SERIAL_SET_RTS Serial2 SUCCESS
157 0.00219693 ATcommander.exe IOCTL_SERIAL_SET_DTR Serial2 SUCCESS
158 0.00000168 ATcommander.exe IOCTL_SERIAL_SET_LINE_CONTROL Serial2 SUCCESS StopBits: 1 Parity: NONE WordLength: 8
159 0.00000251 ATcommander.exe IOCTL_SERIAL_SET_CHAR Serial2 SUCCESS EOF:0 ERR:0 BRK:0 EVT:0 XON:11 XOFF:13
160 0.00695591 ATcommander.exe IOCTL_SERIAL_SET_HANDFLOW Serial2 SUCCESS Shake:1 Replace:40 XonLimit:4096 XoffLimit:1024
161 0.00000307 ATcommander.exe IOCTL_SERIAL_PURGE Serial2 SUCCESS Purge: TXABORT RXABORT TXCLEAR RXCLEAR
162 0.00000140 ATcommander.exe IOCTL_SERIAL_SET_TIMEOUTS Serial2 SUCCESS RI:20 RM:1 RC:200 WM:0 WC:0
163 0.00000112 ATcommander.exe IOCTL_SERIAL_PURGE Serial2 SUCCESS Purge: TXABORT RXABORT TXCLEAR RXCLEAR