Tizen 2.1 base
[sdk/ide/native-sample.git] / samples / native / partner / cpp / Sample / Tizen C++ / NfcMemoTag / NfcMemoTag / project / src / NfcMemoTagEntry.cpp
1 //\r
2 // Open Service Platform\r
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
4 //\r
5 // Licensed under the Flora License, Version 1.0 (the License);\r
6 // you may not use this file except in compliance with the License.\r
7 // You may obtain a copy of the License at\r
8 //\r
9 //     http://www.tizenopensource.org/license\r
10 //\r
11 // Unless required by applicable law or agreed to in writing, software\r
12 // distributed under the License is distributed on an AS IS BASIS,\r
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
14 // See the License for the specific language governing permissions and\r
15 // limitations under the License.\r
16 //\r
17 #include "NfcMemoTag.h"\r
18 \r
19 using namespace Osp::Base;\r
20 using namespace Osp::Base::Collection;\r
21 \r
22 #ifdef __cplusplus\r
23 extern "C"\r
24 {\r
25 #endif // __cplusplus\r
26 \r
27 _EXPORT_ int OspMain(int argc, char *pArgv[]);\r
28 #ifdef _PROFILE\r
29 extern void start_profile (void);\r
30 extern void end_profile (void);\r
31 #else\r
32 #define start_profile()\r
33 #define end_profile()\r
34 #endif\r
35 \r
36 \r
37 /**\r
38  * The entry function of Tizen application called by the operating system.\r
39  */\r
40 int\r
41 OspMain(int argc, char *pArgv[])\r
42 {\r
43         result r = E_SUCCESS;\r
44 \r
45         AppLog("Application started.");\r
46         ArrayList* pArgs = new ArrayList();\r
47         pArgs->Construct();\r
48         for (int i = 0; i < argc; i++)\r
49                 pArgs->Add(*(new String(pArgv[i])));\r
50 \r
51         start_profile();\r
52         r = Osp::App::Application::Execute(NfcMemoTag::CreateInstance, pArgs);\r
53         if (IsFailed(r))\r
54         {\r
55                 AppLogException("Application execution failed-[%s].", GetErrorMessage(r));\r
56                 r &= 0x0000FFFF;\r
57         }\r
58         end_profile();\r
59 \r
60         pArgs->RemoveAll(true);\r
61         delete pArgs;\r
62         AppLog("Application finished.");\r
63 \r
64         return static_cast<int>(r);\r
65 }\r
66 #ifdef __cplusplus\r
67 }\r
68 #endif // __cplusplus\r