unit XSMS;


{ Listing generated by Opus Documentor 1.2.1.1147 on 6.3.2004 }
{ Parts omitted from listing: protected, private, undocumented }


{==============================================================================}
interface
uses
  Classes, SysUtils, Windows, Graphics, GSM, Contnrs, Connect;

const 
  smCommonTelChar = [ '-', '#', '*', 'W', 'w', 'P', 'p', smSpace ] + smCommonDigit;
  smBlinkOn = TChar( 'y' );
  smBlinkOff = TChar( 'o' );

type 

  TSMSProtocolStatus = 
    ( smspsEmpty
    , smspsOK
    , smspsNotComplete
    );

  TSMSProtocolInsertStatus = 
    ( smsprOK
    , smsprBadFragment
    , smsprFragmentDoesNotFit
    , smsprFragmentDifferentData
    );

  TSMSProtocolOptions = 
    ( smspoAddressing
    , smspoReference
    );

  TSMSProtocol = class
  public
    procedure Clear; virtual;
  public
    property FragmentCount: Integer read;
    property InsertedCount: Integer read;
    property Fragments[ Index: Integer ]: TString read;
    property Status: TSMSProtocolStatus read;
    property Stamp: TDateTime read;
  public
    function InsertFragment( const aFragment: TString ): TSMSProtocolInsertStatus; virtual; abstract;
  published
    property Data: TString read write;
    property Reference: LongInt read write;
  end {TSMSProtocol};

  TSMSProtocol2 = class( TSMSProtocol )
  published
    property SourceAddress: Word read write;
    property DestinationAddress: Word read write;
    property Options: TSMSProtocolOptionsSet read write;
  end {TSMSProtocol2};

  TNBS = class( TSMSProtocol2 )
  published
    property OtherHeader: TString read write;
    property Binary: Boolean read write;
  end {TNBS};

  TIE = class
  public
    property IEI: Byte read write;
    property IED: TString read write;
  end {TIE};

  TUDHProtocol = class( TSMSProtocol2 )
  public
    property IEs: TObjectList read;
  end {TUDHProtocol};

  TSiemensOTA = class( TSMSProtocol )
  published
    property ObjectName: TString read write;
    property ObjectType: TString read write;
  end {TSiemensOTA};

  TSMSProtocolStack = class( TStringList )
  public
    function ProcessSMS( 
        aSMS: TSMS; 
        var aId: TSMSProtocol ): Boolean;
    procedure RemoveSMSProtocol( aId: TSMSProtocol );
    procedure CleanSMSProtocols( 
        aRelativeDT: TDateTime; 
        aOnlyNotComplete: Boolean );
  end {TSMSProtocolStack};

  TDirectoryRecords = class( TStringList )
  published
    property FoldingLength: Integer read write;
    property Data: TString read write;
    property Kind: string read write;
  public
    property Params[ Index: Integer ]: TStrings read;
    property ParamsOf[ aName: string ]: TStrings read;
  end {TDirectoryRecords};

  TSmartMessage = class
  public
    class function CreateSM( 
        const aData: TString; 
        aPort: Word ): TSmartMessage;
  public
    property Data: TString read write;
  end {TSmartMessage};

  TSMMIMEDirectory = class( TSmartMessage )
  public
    property Records: TDirectoryRecords read;
  end {TSMMIMEDirectory};

  TSMvCard = class( TSMMIMEDirectory )
  end {TSMvCard};

  TSMvCalendar = class( TSMMIMEDirectory )
  end {TSMvCalendar};

  TSMOTABitmap = class( TSmartMessage )
  public
    property InfoFieldCount: Byte read write;
    property InfoFields[ Index: Integer ]: Byte read write;
    property AnimatedImageCount: Integer read write;
    property Width: Integer read write;
    property Height: Integer read write;
    property Images[ Index: Integer ]: TBitmap read write;
  public
    procedure ImportFromImage( aBMP: TBitmap );
    procedure ExportToImage( aBMP: TBitmap );
  end {TSMOTABitmap};

  TSMScreenSaver = class( TSMOTABitmap )
  end {TSMScreenSaver};

  TSMCLIIcon = class( TSMOTABitmap )
  end {TSMCLIIcon};

  TSMOperatorLogo = class( TSMOTABitmap )
  public
    property MCC: Word read write;
    property MNC: Byte read write;
  end {TSMOperatorLogo};

  TSMTextISO = class( TSmartMessage )
  public
    property Text: TString read write;
  end {TSMTextISO};

  TSMTextUnicode = class( TSmartMessage )
  public
    property Text: WideString read write;
  end {TSMTextUnicode};

  TSMProfile = class( TSMTextUnicode )
  end {TSMProfile};

  TBitStream = class
  public
    property Data: TString read write;
    property EOF: Boolean read;
  public
    procedure PutFillers;
    procedure SkipFillers;
    function GetBit{}: Boolean;
    procedure PutBit( aVal: Boolean );
    function GetBits( aNum: Byte ): LongWord;
    procedure PutBits( 
        aVal: LongWord; 
        aNum: Byte );
    procedure Move( aShift: Integer );
  end {TBitStream};

  TSMRTPattern = class
  public
    Id: Byte;
    Loop: Byte;
  public
    property Instructions: TObjectList read;
  end {TSMRTPattern};

  TSMRTInstruction = class
  public
    class function CreateFromStream( BS: TBitStream ): TSMRTInstruction;
  end {TSMRTInstruction};

  TSMRTNote = class( TSMRTInstruction )
  public
    Value: Byte;
    Duration: Byte;
    DurationSpecifier: Byte;
  end {TSMRTNote};

  TSMRTScale = class( TSMRTInstruction )
  public
    NoteScale: Byte;
  end {TSMRTScale};

  TSMRTStyle = class( TSMRTInstruction )
  public
    Value: Byte;
  end {TSMRTStyle};

  TSMRTTempo = class( TSMRTInstruction )
  public
    BeatsPerMin: Byte;
  public
    class function DecodeBeatsPerMin( aBeats: Byte ): Word;
    class function EncodeBeatsPerMin( aBeats: Word ): Byte;
  end {TSMRTTempo};

  TSMRTVolume = class( TSMRTInstruction )
  public
    Value: Byte;
  end {TSMRTVolume};

  TSMRTCommandPart = class
  public
    class function CreateFromStream( BS: TBitStream ): TSMRTCommandPart;
  end {TSMRTCommandPart};

  TSMRTRingingTone = class( TSMRTCommandPart )
  end {TSMRTRingingTone};

  TSMRTUnicode = class( TSMRTCommandPart )
  end {TSMRTUnicode};

  TSMRTCancel = class( TSMRTCommandPart )
  end {TSMRTCancel};

  TSMRTSound = class( TSMRTCommandPart )
  public
    class function CreateFromStream( BS: TBitStream ): TSMRTCommandPart;
  end {TSMRTSound};

  TSMRTTemporarySong = class( TSMRTSound )
  public
    property Patterns: TObjectList read;
  end {TSMRTTemporarySong};

  TSMRTMidiSong = class( TSMRTSound )
  end {TSMRTMidiSong};

  TSMRTDigitisedSong = class( TSMRTSound )
  end {TSMRTDigitisedSong};

  TSMRTPolyphonicSong = class( TSMRTSound )
  end {TSMRTPolyphonicSong};

  TSMRTCommand = class
  public
    property Parts: TObjectList read;
  end {TSMRTCommand};

  TSMRingingTone = class( TSmartMessage )
  public
    property Commands: TObjectList read;
    property RTTTL: string read write;
  end {TSMRingingTone};

  TSMMultipartMessage = class( TSmartMessage )
  public
    property Multiparts: TObjectList read;
  end {TSMMultipartMessage};

  TSMUnknown = class( TSmartMessage )
  end {TSMUnknown};

  TEMS = class
  public
    property Text: TString read write;
    property Objects: TObjectList read;
  public
    procedure ReadFrom( aProtocol: TUDHProtocol );
    procedure WriteTo( aProtocol: TUDHProtocol );
  end {TEMS};

  TEMSObject = class
  public
    property IEI: Byte read;
    property IED: TString read write;
  public
    class function CreateFromIEI( aIEI: Byte ): TEMSObject;
  end {TEMSObject};

  TEMSPosObject = class( TEMSObject )
  published
    property Pos: Byte read write;
  end {TEMSPosObject};

  TEMSUnknown = class( TEMSObject )
  published
    property Data: TString read write;
  end {TEMSUnknown};

  TEMSTextFormat = class( TEMSPosObject )
  published
    property Len: Byte read write;
    property Alignment: Byte read write;
    property Size: Byte read write;
    property Bold: Boolean read write;
    property Italic: Boolean read write;
    property Underlined: Boolean read write;
    property StrikeThrough: Boolean read write;
    property ForegroundColor: Byte read write;
    property BackgroundColor: Byte read write;
  end {TEMSTextFormat};

  TEMSSoundPredef = class( TEMSPosObject )
  published
    property SoundId: Byte read write;
  end {TEMSSoundPredef};

  TEMSSoundUserDef = class( TEMSPosObject )
  published
    property Records: TDirectoryRecords read;
  end {TEMSSoundUserDef};

  TEMSAnimationPredef = class( TEMSPosObject )
  published
    property AnimationId: Byte read write;
  end {TEMSAnimationPredef};

  TEMSPicture = class( TEMSPosObject )
  published
    property Width: Integer read write;
    property Height: Integer read write;
  public
    procedure ImportFromImage( aBMP: TBitmap );
  end {TEMSPicture};

  TEMSPictureVariable = class( TEMSPicture )
  end {TEMSPictureVariable};

  TEMSPictureSmall = class( TEMSPicture )
  end {TEMSPictureSmall};

  TEMSPictureLarge = class( TEMSPicture )
  end {TEMSPictureLarge};

  TEMSAnimation = class( TEMSPosObject )
  published
    property Width: Integer read write;
    property Height: Integer read write;
  public
    property Images[ Index: Integer ]: TBitmap read write;
  public
    procedure ImportFromImage( aBMP: TBitmap );
    procedure ExportToImage( aBMP: TBitmap );
  end {TEMSAnimation};

  TEMSAnimationSmall = class( TEMSAnimation )
  end {TEMSAnimationSmall};

  TEMSAnimationLarge = class( TEMSAnimation )
  end {TEMSAnimationLarge};

  TEMSUserPrompt = class( TEMSObject )
  public
    property NumOfObjects: Byte read write;
  end {TEMSUserPrompt};

const 
  emsodiaNoForwarding = '01';

type 

  TEMSObjectDistributionIndicator = class( TEMSObject )
  public
    property NumOfIE: Byte read write;
    property Attrib: Byte read write;
  end {TEMSObjectDistributionIndicator};

const 
  emsxaNoForwarding = '01';
  emsxaUserPrompt = '02';

type 

  TEMSXObject = class( TEMSObject )
  published
    property HeaderFlag: Boolean read write;
    property Reference: Byte read write;
    property Pos: Word read write;
    property Attrib: Byte read write;
    property DataLength: Word read write;
    property Kind: Byte read write;
    property Data: TString read write;
  end {TEMSXObject};

  TEMSXObjectReused = class( TEMSObject )
  published
    property Reference: Byte read write;
    property Pos: Word read write;
  end {TEMSXObjectReused};

  TEMSXObjectDataRequest = class( TEMSObject )
  end {TEMSXObjectDataRequest};

  TEMSWVGObject = class( TEMSPosObject )
  published
    property Data: TString read write;
  end {TEMSWVGObject};

  TEMSWVGObjectStandard = class( TEMSWVGObject )
  end {TEMSWVGObjectStandard};

  TEMSWVGObjectCharSize = class( TEMSWVGObject )
  end {TEMSWVGObjectCharSize};

  TEMSCompressionControl = class( TEMSUnknown )
  end {TEMSCompressionControl};


{==============================================================================}
implementation
