Add disconnect API in C# generator 61/263861/11
authorChanggyu Choi <changyu.choi@samsung.com>
Mon, 13 Sep 2021 02:05:01 +0000 (11:05 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Mon, 13 Sep 2021 08:03:45 +0000 (08:03 +0000)
Change-Id: Ibb86a4447f93e8c76c673dc1ac9212344a796999
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
idlc/gen/cs_proxy_gen_cb.h
idlc/gen/cs_stub_gen_cb.h

index b416f6bfe0dcc9e5a4475c28db25626451117b1f..2093aac067949a12bfbf179438f3d5a730f7c300 100644 (file)
@@ -128,6 +128,17 @@ R"__cs_cb(
                 Connect(_appId, "$$");
             }
 
+            /// <summary>
+            /// Disconnects from the service app.
+            /// </summary>
+            /// <exception cref="System.InvalidOperationException">
+            /// Thrown when an internal IO error occurrs.
+            /// </exception>
+            public void Disconnect()
+            {
+                Port?.Disconnect();
+            }
+
             /// <summary>
             /// Connects to the service app synchronously.
             /// </summary>
index 1eeb36e1f9736953520c8138a08887218c0bd8c9..9e6d015864335fee850cf8513a41309d253cb06e 100644 (file)
@@ -46,10 +46,28 @@ R"__cs_cb(
                     get; internal set;
                 }
 
+                public Port Port
+                {
+                    internal get;
+                    internal set;
+                }
+
                 protected ServiceBase()
                 {
                 }
 
+                /// <summary>
+                /// Disconnects from the proxy app
+                /// </summary>
+                /// <exception cref="System.InvalidOperationException">
+                /// Thrown when an internal IO error occurrs.
+                /// </exception>
+                protected void Disconnect()
+                {
+                    Port?.Disconnect();
+                    Port = null;
+                }
+
                 /// <summary>
                 /// This method will be called when the client is connected
                 /// </summary>
@@ -120,6 +138,7 @@ R"__cs_cb(
                 ServiceBase s = Activator.CreateInstance(_serviceType) as ServiceBase;
                 s.Sender = sender;
                 s.Instance = instance;
+                s.Port = GetPort(PortType.Callback, instance);
                 s.OnCreate();
                 _services.Add(s);
             }