Fix the boiler plate codes
[platform/framework/native/appfw.git] / src / app / FApp_AppArg.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 6657a36..9183760
@@ -1,5 +1,4 @@
 //
-// Open Service Platform
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the License);
@@ -71,6 +70,7 @@ static const char OSP_V_REQUEST_TYPE_MAP_QEURY[] = "map_query";
 static const char OSP_V_REQUEST_TYPE_MAP_INSERT[] = "map_insert";
 static const char OSP_V_REQUEST_TYPE_MAP_UPDATE[] = "map_update";
 static const char OSP_V_REQUEST_TYPE_MAP_DELETE[] = "map_delete";
+static const char OSP_V_VERSION_2_1_0_2[] = "ver_2.1.0.2";
 static const char BUNDLE_KEY_PREFIX_AUL[] = "__AUL_";
 static const char BUNDLE_KEY_PREFIX_SERVICE[] = "__APP_SVC_";
 static const char BUNDLE_KEY_PREFIX_OSP[] = "__OSP_";
@@ -430,6 +430,26 @@ BundleIterFnCb(const char* pKey, const int type, const bundle_keyval_t* pVal, vo
                                }
                        }
                        break;
+               case BUNDLE_TYPE_BYTE:
+                       bundle_keyval_get_basic_val(const_cast<bundle_keyval_t*>(pVal), reinterpret_cast<void**>(&pStr), &size);
+
+                       SysLog(NID_IO, "Bundle byte value = %s, size = %d", pStr, size);
+
+                       if (pStr)
+                       {
+                               ByteBuffer* pBuffer = new (std::nothrow) ByteBuffer();
+                               SysTryLog(NID_IO, pBuffer != null, "The memory is insufficient.");
+                               result r = pBuffer->Construct(size);
+                               SysTryLog(NID_IO, r == E_SUCCESS, "Constructing pBuffer is failed.");
+
+                               r = pBuffer->SetArray((const byte*)pStr, 0, size);
+                               SysTryLog(NID_IO, r == E_SUCCESS, "SetArray()for ByteBuffer is failed.");
+
+                               pBuffer->Flip();
+
+                               pMap->Add(new (std::nothrow) String(pKey), pBuffer);
+                       }
+                       break;
                default:
                        SysLog(NID_APP, "Invalid type for %s : %d", pKey, type);
                        break;
@@ -701,6 +721,10 @@ _AppArg::AddStrMap(bundle* b, const IMap* pMap)
                        else if (typeid(*pObj) == typeid(const ByteBuffer))
                        {
                                SysLog(NID_APP, "ByteBuffer type");
+                               const ByteBuffer* pBuffer = static_cast<const ByteBuffer*>(pObj);
+
+                               std::unique_ptr<char[]> pBundleKey(_StringConverter::CopyToCharArrayN(*pKey));
+                               bundle_add_byte(b, pBundleKey.get(), pBuffer->GetPointer(), pBuffer->GetLimit());
                        }
                }
        }
@@ -1006,6 +1030,7 @@ _AppArg::CreateSqlDataControlArg(bundle* b, const _SqlDataControlImpl& dc, _Data
        char dataControlRequestType[MAX_LEN_DATA_CONTROL_REQ_TYPE] = {0, };
        snprintf(dataControlRequestType, MAX_LEN_DATA_CONTROL_REQ_TYPE, "%d", static_cast<int>(requestType));
        bundle_add(b, OSP_K_DATACONTROL_REQUEST_TYPE, dataControlRequestType);
+       bundle_add(b, OSP_K_DATACONTROL_PROTOCOL_VERSION, OSP_V_VERSION_2_1_0_2);
 
        std::unique_ptr<char[]> pProvider(_StringConverter::CopyToCharArrayN(dc.__providerId));
        if (pProvider)
@@ -1030,6 +1055,7 @@ _AppArg::CreateMapDataControlArg(bundle* b, const _MapDataControlImpl& dc, _Data
        char dataControlRequestType[MAX_LEN_DATA_CONTROL_REQ_TYPE] = {0, };
        snprintf(dataControlRequestType, MAX_LEN_DATA_CONTROL_REQ_TYPE, "%d", static_cast < int >(requestType));
        bundle_add(b, OSP_K_DATACONTROL_REQUEST_TYPE, dataControlRequestType);
+       bundle_add(b, OSP_K_DATACONTROL_PROTOCOL_VERSION, OSP_V_VERSION_2_1_0_2);
 
        std::unique_ptr<char[]> pProvider(_StringConverter::CopyToCharArrayN(dc.__providerId));
        if (pProvider)
@@ -1237,7 +1263,7 @@ BundlePrintIterFnCb(const char* pKey, const int type, const bundle_keyval_t* pVa
                        bundle_keyval_get_basic_val(const_cast<bundle_keyval_t*>(pVal), reinterpret_cast<void**>(&pStr), &size);
                        if (pStr)
                        {
-                               SysLog(NID_APP, "(%s, %s)", pKey, pStr);
+                               SysSecureLog(NID_APP, "(%s, %s)", pKey, pStr);
                        }
                        break;
                default: