📄 gsmctrfr.pas
字号:
LineTo(Picture.Width, Y);
Inc(Y, CellSize);
end;
X:= 0;
while X <= Picture.Width do
begin
MoveTo(X, 0);
LineTo(X, Picture.Height);
Inc(X, CellSize);
end;
end;
end;
procedure TGSMCentralForm.PictureWidthExit(Sender: TObject);
begin
AdjustPicture;
end;
procedure TGSMCentralForm.PictureWidthKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
begin
if (Key = VK_RETURN) and (Shift = []) then
begin
AdjustPicture;
Key:= 0;
end;
end;
procedure TGSMCentralForm.PictureMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
X:= X div CellSize;
Y:= Y div CellSize;
with fPictureBitmap.Canvas do
if Pixels[X, Y] = clWhite then
Pixels[X, Y]:= clBlack
else
Pixels[X, Y]:= clWhite;
Picture.Repaint;
end;
procedure TGSMCentralForm.BlinkClick(Sender: TObject);
begin
with Message do
Text:= Copy(Text, 1, SelStart)+smBlinkOn+Copy(Text, SelStart+1, SelLength)+smBlinkOff+Copy(Text, SelStart+SelLength+1, Length(Text));
end;
procedure TGSMCentralForm.Button2Click(Sender: TObject);
begin
if OpenPictureDialog.Execute then
begin
fPictureBitmap.LoadFromFile(OpenPictureDialog.FileName);
SavePictureDialog.FileName:= OpenPictureDialog.FileName;
AdjustPicture;
end;
end;
procedure TGSMCentralForm.Button3Click(Sender: TObject);
begin
if SavePictureDialog.Execute then
begin
fPictureBitmap.SaveToFile(SavePictureDialog.FileName);
end;
end;
procedure TGSMCentralForm.BitBtn1Click(Sender: TObject);
var
I: Integer;
B: Byte;
F: Boolean;
NBS: TSMSProtocol;
WapPushObj: TWapService;
WD: TWapDocument;
SM, SM2: TSmartMessage;
EMS: TEMS;
EMSObj: TEMSObject;
S: string;
WS: widestring;
St: TStream;
SndM: TSoundMelody;
begin
ShowModemLog;
try
NBS:= nil;
try
if FSmartMessage <> nil then
begin
if FSmartMessage.InheritsFrom(TSMMIMEDirectory) then
NBS:= TNBS.Create
else
NBS:= TUDHProtocol.Create;
TSMSProtocol2(NBS).Options:= [smspoAddressing, smspoReference];
SM:= FSmartMessage.Create;
try
if SM is TSMvCard then
begin
TSMSProtocol2(NBS).DestinationAddress:= smPortMIMEvCard;
SM:= TSMvCard.Create;
with TSMvCard(SM) do
begin
Records.Values['N']:= vCardName.Text;
Records.Values['TEL']:= vCardPhone.Text;
end;
end
else if SM is TSMOTABitmap then
begin
with TSMOTABitmap(SM) do
begin
AnimatedImageCount:= StrToIntDef(PictureNumAnimations.Text, 0);
Width:= StrToIntDef(PictureWidth.Text, 0);
Height:= StrToIntDef(PictureHeight.Text, 0);
for I:= 0 to AnimatedImageCount do
begin
Images[I].Width:= Width;
Images[I].Height:= Height;
end;
ImportFromImage(fPictureBitmap);
end;
if SM is TSMCLIIcon then
TSMSProtocol2(NBS).DestinationAddress:= smPortCLILogo
else if SM is TSMOperatorLogo then
begin
TSMSProtocol2(NBS).DestinationAddress:= smPortOperatorLogo;
with TSMOperatorLogo(SM) do
begin
I:= StrToIntDef(Copy(PictureOperator.Text, 1, Pos(',', PictureOperator.Text+',')-1), 0);
MCC:= I div 100;
MNC:= I mod 100;
end;
end;
end
else if SM is TSMRingingTone then
begin
TSMSProtocol2(NBS).DestinationAddress:= smPortRingingTone;
SndM:= GetMelodyFromGrid;
try
TSMRingingTone(SM).AssignSoundMelody(SndM);
finally
SndM.Free;
end;
end;
if (FSmartMessage = TSMOTABitmap) or (FSmartMessage = TSMScreenSaver) then
begin
TSMSProtocol2(NBS).DestinationAddress:= smPortMultiPart;
SM2:= SM;
SM:= TSMMultipartMessage.Create;
with TSMMultipartMessage(SM) do
begin
Multiparts.Add(SM2);
if Message.Text <> '' then
begin
SM2:= TSMTextISO.Create;
TSMTextISO(SM2).Text:= Message.Text;
Multiparts.Insert(0, SM2);
end;
end;
end;
NBS.Data:= SM.Data;
finally
SM.Free;
end;
end
else if fEMS <> nil then
begin
NBS:= TEMSUDHProtocol.Create;
TSMSProtocol2(NBS).Options:= [smspoReference];
EMS:= TEMS.Create;
EMS.Text:= Message.Text;
if fEMS <> TEMSObject then
begin
EMSObj:= fEMS.Create;
if EMSObj is TEMSPicture then
begin
with TEMSPicture(EMSObj) do
begin
Width:= StrToIntDef(PictureWidth.Text, 0);
Height:= StrToIntDef(PictureHeight.Text, 0);
ImportFromImage(fPictureBitmap);
end;
end
else if EMSObj is TEMSAnimation then
begin
with TEMSAnimation(EMSObj) do
begin
Width:= StrToIntDef(PictureWidth.Text, 0);
Height:= StrToIntDef(PictureHeight.Text, 0);
ImportFromImage(fPictureBitmap);
end
end
else if EMSObj is TEMSSoundUserDef then
begin
with TEMSSoundUserDef(EMSObj) do
begin
SndM:= GetMelodyFromGrid;
try
AssignSoundMelody(SndM);
// Records.Header:= drhNone; // phone compatability problem
finally
SndM.Free;
end;
end;
end;
EMS.Objects.Add(EMSObj);
end;
EMS.WriteTo(NBS as TUDHProtocol);
end
else if SMSKind.ItemIndex = 3 then // SEO
begin
NBS:= TSiemensOTA.Create;
with TSiemensOTA(NBS) do
begin
ObjectName:= SEOName.Text;
if SMSKind2.ItemIndex = 0 then
begin
ObjectType:= 'bmp';
St:= TMemoryStream.Create;
try
SEOPicture.Picture.Bitmap.SaveToStream(St);
St.Position:= 0;
NBS.Data:= StreamToString(St);
finally
St.Free;
end;
end
else
begin
ObjectType:= 'mid';
SEOMidi.Close; // file sharing lock
St:= TFileStream.Create(SEOMidi.FileName, fmOpenRead);
try
NBS.Data:= StreamToString(St);
finally
St.Free;
end;
try
SEOMidi.Open;
except
end;
end;
end;
end
else if fWapPush <> nil then // WAP Push
begin
NBS:= TUDHProtocol.Create;
TSMSProtocol2(NBS).Options:= [{smspoReference, }smspoAddressing];
TSMSProtocol2(NBS).DestinationAddress:= smPortWAPPushConnectionlessSessionService_client;
TSMSProtocol2(NBS).SourceAddress:= smPortWAPConnectionlessSessionService;
WapPushObj:= fWapPush.Create;
B:= 0; // unwarn
if WapPushObj is TWapServiceIndication then
with TWapServiceIndication(WapPushObj) do
begin
HRef:= siHref.Text;
Action:= siAction.ItemIndex;
Caption:= Message.Text;
SIId:= Self.siId.Text;
S:= Trim(siSiExpires.Text);
if S <> '' then
begin
S:= S+'00000000000000';
SIExpires:= EncodeDate(StrToInt(Copy(S, 5, 4)), StrToInt(Copy(S, 3, 2)), StrToInt(Copy(S, 1, 2))) +
EncodeTime(StrToInt(Copy(S, 9, 4)), StrToInt(Copy(S, 11, 2)), StrToInt(Copy(S, 13, 2)), 0)
end;
B:= $2E;
end
else if WapPushObj is TWapServiceLoad then
with TWapServiceLoad(WapPushObj) do
begin
HRef:= slHref.Text;
Action:= slAction.ItemIndex;
B:= $30;
end
else if WapPushobj is TWapCacheOperation then
with TWapCacheOperation(WapPushObj) do
begin
ServiceURLs.Text:= coServices.Lines.Text;
ObjectURLs.Text:= coObjects.Lines.Text;
B:= $32;
end;
WD:= TWapDocument.Create;
try
WapPushObj.AssignToWapDocument(WD);
// (NBS as TUDHProtocol).Data:= #01#06#01+Chr(B or $80)+WD.WBXMLData;
// Nokias require more complicated
(NBS as TUDHProtocol).Data:= Chr(fWapPushTransaction)+#06#$0A#$03+Chr(B or $80)+#$81#$EA#$AF#$82#$8D#$D9#$B4#$84+WD.WBXMLData;
Inc(fWapPushTransaction);
{ WSP:
# - transactioni
06 - pdu type (push)
0A - header len
03AE81EA - content type: application/vnd.wap.sic; charset=utf-8
AF82 - x-wap-application-id: w2 (wap browser)
8DD9 - content-length: 89
B484 - push-flag: 4
}
finally
WD.Free;
end;
end
else
begin
// text msg.
end;
if NBS <> nil then
begin
if NBS is TSMSProtocol2 then
begin
if fWapPush = nil then
TSMSProtocol2(NBS).SourceAddress:= TSMSProtocol2(NBS).DestinationAddress;
end;
NBS.Reference:= fReference mod 256;
Inc(fReference);
if (NBS is TNBS) {or (NBS is TUDHProtocol) M20 dislikes it} then
B:= 0
else
B:= $F4+DCS.ItemIndex;
for I:= 1 to NBS.FragmentCount do
begin
SendSmsPhn(DA.Text, NBS.Fragments[I], '', DeliveryNotification.Checked, B, NBS is TUDHProtocol, True, False);
end;
end
else
begin
if Spec.ItemIndex in [0, 1] then
begin
S:= Message.Text;
WS:= Message.Text;
F:= Spec.ItemIndex in [1];
if F then
B:= $18 // Siemens M20 does not support it correctly, or $80=disable message class M20 does not support anyway
else
B:= $F0;
Inc(B, DCS.ItemIndex);
if Pos(smBlinkOn, WS) <> 0 then
begin
F:= True;
WS:= #1+WS;
B:= $18; // Display immediately
end;
SendSmsPhn(DA.Text, S, WS, DeliveryNotification.Checked, B, False, F, F);
end
else
begin
S:= Hex2Bin(Message.Text);
SendSmsPhn(DA.Text, S, '', DeliveryNotification.Checked, $F5, Spec.ItemIndex in [3], True, False);
end;
end;
finally
NBS.Free;
end;
finally
HideModemLog;
end;
end;
const
MelodyScaleLow = smps440Hz;
MelodyScaleHigh = smps3520Hz;
procedure TGSMCentralForm.MelodyKeyboardPaint(Sender: TObject);
var
I: TSoundMelodyPatternScale;
J: TSoundMelodyPatternNote;
Keyis: Integer;
R: TRect;
begin
with (Sender as TPaintBox).Canvas do
begin
Brush.Style:= bsSolid;
Brush.Color:= clWhite;
Pen.Width:= 1;
Pen.Style:= psClear;
for I:= MelodyScaleLow to MelodyScaleHigh do
for J:= Succ(Low(TSoundMelodyPatternNote)) to High(TSoundMelodyPatternNote) do
begin
if fMelodyKeyPressed = Integer(I)*256 + Integer(J) then
Pen.Mode:= pmXor
else
Pen.Mode:= pmCopy;
GetKeyRect(I, J, R, Keyis);
if Keyis = 0 then
Rectangle(R.Left, R.Top, R.Right, R.Bottom);
end;
Pen.Style:= psClear;
for I:= MelodyScaleLow to MelodyScaleHigh do
for J:= Succ(Low(TSoundMelodyPatternNote)) to High(TSoundMelodyPatternNote) do
begin
if fMelodyKeyPressed = Integer(I)*256 + Integer(J) then
begin
Pen.Mode:= pmXor;
Brush.Color:= clSilver;
end
else
begin
Brush.Color:= clBlack;
Pen.Mode:= pmCopy;
end;
GetKeyRect(I, J, R, Keyis);
if Keyis > 0 then
Rectangle(R.Left, R.Top, R.Right, R.Bottom);
end;
end;
end;
procedure TGSMCentralForm.GetKeyRect;
var
I: TSoundMelodyPatternNote;
N: Integer;
Sc, Kpos: Integer;
begin
N:= 0;
Keyis:= 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -