pdu的不难,有公式换算的.
function TextToSms(SmsCenter: string; TargetMs: string; Text: string): Tpdu;
var
smsc,targ,leng,data : string;
ses1 : string;
i,d,e,j,k,n : integer;
a,b,c : array [1..8] of byte;
smsh : integer;
jump : boolean;
res : Tpdu;
ttt : WideString;
begin
if (Text = '') or (Length(TargetMs) < 11) then Exit;
ttt := text;
ses1:=smscenter;
// if Length(Ses1) >= 11 then
smsc:=ses1[2]+ses1[1]+ses1[4]+ses1[3]+ses1[6]+ses1[5]+ses1[8]+ses1[7]+ses1[10]+ses1[9]+'F'+ses1[11];
// else
// smsc:= '';
ses1:=targetms;
// if Length(Ses1) >= 11 then
targ:='68'+ses1[2]+ses1[1]+ses1[4]+ses1[3]+ses1[6]+ses1[5]+ses1[8]+ses1[7]+ses1[10]+ses1[9]+'F'+ses1[11];
// else
// Targ:= '';
ses1:=text;
j:=0;
d:=ord(ses1[1]);
c[8]:=round((d and 128)/128);
c[7]:=round((d and 64)/64);
c[6]:=round((d and 32)/32);
c[5]:=round((d and 16)/16);
c[4]:=round((d and 8)/8);
c[3]:=round((d and 4)/4);
c[2]:=round((d and 2)/2);
c[1]:=round((d and 1));
jump:=false;
for i:=2 to length(ses1) do
begin
j:=j+1;
if j=8 then
begin
j:=0;
jump:=true;
end;
d:=ord(ses1);
a[8]:=round((d and 128)/128);
a[7]:=round((d and 64)/64);
a[6]:=round((d and 32)/32);
a[5]:=round((d and 16)/16);
a[4]:=round((d and 8)/8);
a[3]:=round((d and 4)/4);
a[2]:=round((d and 2)/2);
a[1]:=round((d and 1));
if jump=false then
begin
for e:=1 to 8-j do
begin
b[e]:=c[e];
end;
k:=0;
for e:=8-j+1 to 8 do
begin
k:=k+1;
b[e]:=a[k];
end;
n:=128*b[8]+64*b[7]+32*b[6]+16*b[5]+8*b[4]+4*b[3]+2*b[2]+b[1];
if n>0 then data:=data+inttohex(n,2);
end;
jump:=false;
for e:=1 to 8-j do
begin
c[e]:=a[e+j]
end;
for e:=8-j to 8 do
begin
c[e]:=0;
end;
end;
n:=128*c[8]+64*c[7]+32*c[6]+16*c[5]+8*c[4]+4*c[3]+2*c[2]+c[1];
if n>0 then data:=data+inttohex(n,2);
leng:=inttohex(length(ttt)*2,2);
// res[1]:='0011000D91'+targ+'000801'+leng+data;
//0001 ---flash sms
res[1]:='0011000D91'+targ+'000801'+leng+encode2(ttt);
smsh:=round(length(res[1])/2-1);
res[2]:=inttostr(smsh);
result:=res;