浏览代码

* Make channel/message public, so they can be used in other service constructors

michael 6 年之前
父节点
当前提交
8aaabb14c0
共有 1 个文件被更改,包括 28 次插入0 次删除
  1. 28 0
      packages/dataabstract/dadataset.pas

+ 28 - 0
packages/dataabstract/dadataset.pas

@@ -92,8 +92,11 @@ Type
     FStreamerType: TDAStreamerType;
     FStreamerType: TDAStreamerType;
     FURL: String;
     FURL: String;
     procedure ClearConnection;
     procedure ClearConnection;
+    function GetChannel: TROHTTPClientChannel;
+    function GetClientID: String;
     Function GetDataService : TDADataAbstractService;
     Function GetDataService : TDADataAbstractService;
     function GetLoginService: TDASimpleLoginService;
     function GetLoginService: TDASimpleLoginService;
+    function GetMessage: TROMessage;
     procedure SetDataserviceName(AValue: String);
     procedure SetDataserviceName(AValue: String);
     procedure SetLoginServiceName(AValue: String);
     procedure SetLoginServiceName(AValue: String);
     procedure SetMessageType(AValue: TDAMessageType);
     procedure SetMessageType(AValue: TDAMessageType);
@@ -120,6 +123,11 @@ Type
     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.
     Property LoginService : TDASimpleLoginService Read GetLoginService Write FLoginService;
     Property LoginService : TDASimpleLoginService Read GetLoginService Write FLoginService;
+    // You can get this to use in other service constructors
+    Property Channel : TROHTTPClientChannel Read GetChannel;
+    Property Message : TROMessage Read GetMessage;
+    // Get client ID
+    Property ClientID : String Read GetClientID;
   Published
   Published
     // If set, this is the message type that will be used when auto-creating the service. Setting this while dataservice is Non-Nil will remove the reference
     // If set, this is the message type that will be used when auto-creating the service. Setting this while dataservice is Non-Nil will remove the reference
     Property MessageType : TDAMessageType Read FMessageType Write SetMessageType;
     Property MessageType : TDAMessageType Read FMessageType Write SetMessageType;
@@ -163,6 +171,12 @@ begin
   Result:=FLoginService;
   Result:=FLoginService;
 end;
 end;
 
 
+function TDAConnection.GetMessage: TROMessage;
+begin
+  CreateChannelAndMessage;
+  Result:=FMessage;
+end;
+
 procedure TDAConnection.SetDataserviceName(AValue: String);
 procedure TDAConnection.SetDataserviceName(AValue: String);
 begin
 begin
   if FDataserviceName=AValue then Exit;
   if FDataserviceName=AValue then Exit;
@@ -191,6 +205,20 @@ begin
   FMessage:=Nil;
   FMessage:=Nil;
 end;
 end;
 
 
+function TDAConnection.GetChannel: TROHTTPClientChannel;
+begin
+  CreateChannelAndMessage;
+  Result:=FChannel;
+end;
+
+function TDAConnection.GetClientID: String;
+begin
+  if Assigned(FMessage) then
+    Result:=FMessage.ClientID
+  else
+    Result:='';
+end;
+
 procedure TDAConnection.SetURL(AValue: String);
 procedure TDAConnection.SetURL(AValue: String);
 begin
 begin
   if FURL=AValue then Exit;
   if FURL=AValue then Exit;