Initialize Tizen 2.3
[framework/osp/security-service.git] / src / SecurityServiceEntry.cpp
1 //
2 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file                SecurirtyServiceEntry.cpp
19  * @brief               This is the implementation file for SecurirtyService entry point.
20  */
21
22 #include <FOspConfig.h>
23 #include <FBaseSysLog.h>
24 #include <FBaseColArrayList.h>
25
26 #include "SecurityService.h"
27
28 using namespace Tizen::Base;
29 using namespace Tizen::Base::Collection;
30
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif // __cplusplus
35
36 _OSP_EXPORT_ int OspMain(int argc, char *pArgv[]);
37 #ifdef _PROFILE
38 extern void start_profile (void);
39 extern void end_profile (void);
40 #else
41 #define start_profile(void)
42 #define end_profile(void)
43 #endif
44
45
46 /**
47  * The entry function of Tizen application called by the operating system.
48  */
49 int
50 OspMain(int argc, char *pArgv[])
51 {
52         result r = E_SUCCESS;
53
54         AppLog("Application started.");
55         ArrayList* pArgs = new ArrayList();
56         pArgs->Construct();
57         for (int i = 0; i < argc; i++)
58         {
59                 pArgs->Add(*(new String(pArgv[i])));
60         }
61
62         start_profile();
63         r = Tizen::App::ServiceApp::Execute(SecurityService::CreateInstance, pArgs);
64         if (IsFailed(r))
65         {
66                 AppLogException("Application execution failed-[%s].", GetErrorMessage(r));
67                 r &= 0x0000FFFF;
68         }
69         end_profile();
70
71         pArgs->RemoveAll(true);
72         delete pArgs;
73         AppLog("Application finished.");
74
75         return static_cast<int>(r);
76 }
77 #ifdef __cplusplus
78 }
79 #endif // __cplusplus