Fix C# generator for cion 62/266362/2
authorjusung <jusung07.son@samsung.com>
Thu, 11 Nov 2021 03:59:59 +0000 (12:59 +0900)
committerjusung <jusung07.son@samsung.com>
Thu, 11 Nov 2021 04:26:28 +0000 (13:26 +0900)
 - indentation
 - method name confilct
 - missing description

Change-Id: I88005751dd1b29a1ef064f356ceb56d6907eeef9
Signed-off-by: jusung <jusung07.son@samsung.com>
idlc/gen_cion/cs_cion_gen_base.cc
idlc/gen_cion/cs_cion_gen_base_cb.h
idlc/gen_cion/cs_cion_proxy_gen.cc
idlc/gen_cion/cs_cion_proxy_gen_cb.h
idlc/gen_cion/cs_cion_stub_gen.cc
idlc/gen_cion/cs_cion_stub_gen_cb.h

index 0b6430e..9d08f1f 100644 (file)
@@ -619,7 +619,7 @@ void CsCionGeneratorBase::GenInvokeMethod(std::ofstream& stream,
         for (auto& i : decl.GetParameters().GetParams()) {
           auto& pt = i->GetParameterType();
           if(HasFile(pt.GetBaseType()))
-            m += "_serverBase.ShareFile(" + i->GetID() + ");\n";
+            m += "_serverBase.TryShareFile(" + i->GetID() + ");\n";
         }
         return AddIndent(TAB_SIZE * 6, m);
       });
index 04a7cb5..5fd1441 100644 (file)
@@ -131,19 +131,19 @@ R"__cs_cb(
 
 const char CB_SHARE_FILE_DEF[] =
 R"__cs_cb(
-            private void ShareFile(IEnumerable<string> paths)
+            private void TryShareFile(IEnumerable<string> paths)
             {
                 if (paths == null)
                     throw new ArgumentException("Invalid path");
 
                 foreach (string path in paths)
                 {
-                    ShareFile(path);
+                    TryShareFile(path);
                 }
 
             }
 
-            private void ShareFile(string path)
+            private void TryShareFile(string path)
             {
                 if (path == null)
                     throw new ArgumentException("Invalid path");
index a137bb7..f33cd7c 100644 (file)
@@ -185,7 +185,7 @@ void CsCionProxyGen::GenInvocation(std::ofstream& stream, const Declaration& dec
              pt.GetBaseType().GetMetaType()->ToString() == "file")) {
            st += GenTemplateString(CB_SHARE_FILE, [&]()->std::string {
              std::string str = "";
-             str += Tab(7) + "ShareFile(" + i->GetID() + ");";
+             str += Tab(7) + "TryShareFile(" + i->GetID() + ");";
              return str;
            });
          }
index 09f2551..f321b2c 100644 (file)
@@ -33,7 +33,6 @@ R"__cs_cb(            public delegate void DiscoveredEvent(object sender, PeerIn
 
             public new string ServiceName;
 
-            private static readonly string _tidlVersion = "<VERSION>";
             private bool _online = false;
             private Object _lock = new Object();
             private List<CallbackBase> _delegateList = new List<CallbackBase>();
@@ -43,7 +42,8 @@ const char CB_EVENT_METHODS[] =
 R"__cs_cb(
             protected override void OnConnectionResult(PeerInfo peerInfo, ConnectionResult result)
             {
-               if (result.Status == ConnectionStatus.OK) {
+               if (result.Status == ConnectionStatus.OK)
+               {
                     _online = true;
                }
 
@@ -61,11 +61,14 @@ R"__cs_cb(
                 Discovered?.Invoke(this, peerInfo);
             }
 
-             protected override void OnPayloadReceived(Payload payload, PayloadTransferStatus status)
+            protected override void OnPayloadReceived(Payload payload, PayloadTransferStatus status)
             {
-                if(payload.PayloadType == PayloadType.FilePayload) {
+                if(payload.PayloadType == PayloadType.FilePayload)
+                {
                     FileReceived?.Invoke(this, (FilePayload)payload, status);
-                } else {
+                }
+                else
+                {
                     Parcel parcelReceived;
 
                     try
@@ -113,9 +116,13 @@ const char CB_CONNECT_METHOD[] =
 R"__cs_cb(
             /// <summary>
             /// Starts discovering cion servers.
+            /// <privilege>http://tizen.org/privilege/d2d.datasharing</privilege>
+            /// <privilege>http://tizen.org/privilege/internet</privilege>
             /// </summary>
             /// <exception cref="InvalidOperationException">Thrown when the discovery operation is already in progress.</exception>
-            public new void TryDiscovery() {
+            /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access this method.</exception>
+            public new void TryDiscovery()
+            {
                 base.TryDiscovery();
             }
 
index 73b811f..aa71ab6 100644 (file)
@@ -193,14 +193,14 @@ void CsCionStubGen::GenSyncInvocation(std::ofstream& stream, const Declaration&
                                 "param" + std::to_string(cnt), "result");
 
     if (HasFile(pt.GetBaseType())) {
-      m += "ShareFile(param" + std::to_string(cnt) + ");\n\n";
+      m += "TryShareFile(param" + std::to_string(cnt) + ");\n\n";
     }
   }
 
   if (hasRet) {
     m += ConvertTypeToSerializer(decl.GetType(), "retVal", "result");
     if (HasFile(decl.GetType())) {
-      m += "ShareFile(retVal);\n";
+      m += "TryShareFile(retVal);\n";
     }
   }
 
index 0bee020..82c4b61 100644 (file)
 #ifndef IDLC_CS_CION_GEN_CS_STUB_GEN_CB_H_
 #define IDLC_CS_CION_GEN_CS_STUB_GEN_CB_H_
 
-/**
- * <VERSION> Version of TIDL Compiler.
- */
 const char CB_DATA_MEMBERS[] =
 R"__cs_cb(            private List<ServiceBase> _services = new List<ServiceBase>();
             private Type _serviceType;
-            private static readonly string _tidlVersion = "<VERSION>";
 )__cs_cb";
 
 const char CB_SERVICE_BASE_FRONT[] =
@@ -252,8 +248,8 @@ R"__cs_cb(
                 s.DisplayName = base.DisplayName;
                 s.ConnectionRequestClient = peerInfo;
                 s.ServerBase = this;
-                s.OnConnectionRequest();
                 _services.Add(s);
+                s.OnConnectionRequest();
             }
 )__cs_cb";