Hi,
I'm still getting used to the components, so forgive me for asking such newbie questions
I'd like to create a base class where I will derive some API functions.
TmdwClientModule = class
private
function GetModuleFileName: String;
function GetModuleHost: String;
protected
FClientModule : TrtcClientModule; // I'd like to move this fellow to private
procedure SetModuleFileName(const Value: String);
procedure SetModuleHost(const Value: String);
function DoExecute( aInfo : TRtcFunctionInfo ) : TRtcValue; // I would like to call this one!
public
constructor Create( aRtcDataClient : TrtcDataClient ); virtual;
destructor Destroy; override;
property ModuleFileName : String read GetModuleFileName;
property ModuleHost : String read GetModuleHost;
end;
And for example the modules would use somthing like :
TmdwClientModule_Authentication = Class( TmdwClientModule )
public
constructor Create(aRtcDataClient: TRtcDataClient); override;
function AuthorizeUser( const aLogin, aPwd : String ) : Boolean;
{.. All the other functions for authentication .. }
End;
The application will call AuthorizeUser with the login and Password the user typed in. How should I write the AuthorizeUser function?
I would like it to use the "DoExecute" parent method. With this approach I want to centralize all my synchronized calls.
function TmdwClientModule_Authentication.AuthorizeUser(const aLogin,
aPwd: String): Boolean;
var
RC : TRtcFunctionInfo;
Retval : TRtcValue;
begin
RC := FClientModule.NewFunction('Login');
RC.AsParam['Login'] := aLogin;
RC.AsParam['PWD'] := aPwd;
Retval := FClientModule.Execute;
// Here I want to check if the results is valid not call directly... ex: No exception was raised
// That's one reason to use "DoExecute"
Result := Retval.AsBoolean;
end;
And I would like to implement a DoExecuteAsync with an anominous method which will use TRtcResult "somehow" .
Am I completely out of line?
Do you have some example?
Best regards,
Clément