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 b416f6b..2093aac 100644 (file)
@@ -129,6 +129,17 @@ R"__cs_cb(
             }
 
             /// <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>
             /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
index 1eeb36e..9e6d015 100644 (file)
@@ -46,11 +46,29 @@ 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>
                 public abstract void OnCreate();
@@ -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);
             }