Browse Source

* Add logout method

michael 6 years ago
parent
commit
1d57ca0f7e
1 changed files with 14 additions and 1 deletions
  1. 14 1
      packages/dataabstract/dadataset.pas

+ 14 - 1
packages/dataabstract/dadataset.pas

@@ -86,6 +86,9 @@ Type
     FChannel : TROHTTPClientChannel;
     FChannel : TROHTTPClientChannel;
     FOnLoginFailed: TDAFailedEvent;
     FOnLoginFailed: TDAFailedEvent;
     FOnLogin: TDALoginSuccessEvent;
     FOnLogin: TDALoginSuccessEvent;
+    FOnLogout: TDASuccessEvent;
+    FOnLogoutailed: TDAFailedEvent;
+    FOnLogoutFailed: TDAFailedEvent;
     FStreamerType: TDAStreamerType;
     FStreamerType: TDAStreamerType;
     FURL: String;
     FURL: String;
     procedure ClearConnection;
     procedure ClearConnection;
@@ -112,6 +115,7 @@ Type
     // Call this to login. This is an asynchronous call, check the result using OnLoginOK and OnLoginFailed calls.
     // Call this to login. This is an asynchronous call, check the result using OnLoginOK and OnLoginFailed calls.
     Procedure Login(aUserName, aPassword : String);
     Procedure Login(aUserName, aPassword : String);
     Procedure LoginEx(aLoginString : String);
     Procedure LoginEx(aLoginString : String);
+    Procedure Logout;
     // You can set this. If you didn't set this, and URL is filled, an instance will be created.
     // You can set this. If you didn't set this, and URL is filled, an instance will be created.
     Property DataService : TDADataAbstractService Read GetDataService Write FDataService;
     Property DataService : TDADataAbstractService Read GetDataService Write FDataService;
     //  You can set this. If you didn't set this, and URL is filled, an instance will be created.
     //  You can set this. If you didn't set this, and URL is filled, an instance will be created.
@@ -129,6 +133,10 @@ Type
     Property OnLogin : TDALoginSuccessEvent Read FOnLogin Write FOnLogin;
     Property OnLogin : TDALoginSuccessEvent Read FOnLogin Write FOnLogin;
     // Called when login call failed. When call was executed but user is wrong OnLogin is called !
     // Called when login call failed. When call was executed but user is wrong OnLogin is called !
     Property OnLoginCallFailed : TDAFailedEvent Read FOnLoginFailed Write FOnLoginFailed;
     Property OnLoginCallFailed : TDAFailedEvent Read FOnLoginFailed Write FOnLoginFailed;
+    // Called when logout call is executed.
+    Property OnLogout : TDASuccessEvent Read FOnLogout Write FOnLogout;
+    // Called when logout call failed.
+    Property OnLogOutCallFailed : TDAFailedEvent Read FOnLogoutailed Write FOnLogoutFailed;
     // Streamertype : format of the data package in the message.
     // Streamertype : format of the data package in the message.
     Property StreamerType : TDAStreamerType Read FStreamerType Write FStreamerType;
     Property StreamerType : TDAStreamerType Read FStreamerType Write FStreamerType;
   end;
   end;
@@ -203,7 +211,7 @@ begin
     end;
     end;
 end;
 end;
 
 
-function TDAConnection.DetectMessageType(Const aURL : String) : TDAMessageType;
+function TDAConnection.DetectMessageType(const aURL: String): TDAMessageType;
 
 
 Var
 Var
   S : String;
   S : String;
@@ -284,6 +292,11 @@ begin
   EnsureLoginService.LoginEx(aLoginString,FOnLogin,FOnLoginFailed);
   EnsureLoginService.LoginEx(aLoginString,FOnLogin,FOnLoginFailed);
 end;
 end;
 
 
+procedure TDAConnection.Logout;
+begin
+  EnsureLoginService.Logout(FOnLogout,FOnLogoutFailed);
+end;
+
 { TDADataset }
 { TDADataset }
 
 
 function TDADataset.DataTypeToFieldType(s : String) : TFieldType;
 function TDADataset.DataTypeToFieldType(s : String) : TFieldType;