update container and sample bundles for so bundle dynamic configuraion
[platform/upstream/iotivity.git] / service / resource-manipulation / src / resourceContainer / unittests / TestBundle / src / TestBundleActivator.cpp
1 //******************************************************************
2 //
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 #include "TestBundleActivator.h"
22
23 TestBundleActivator *bundle;
24
25 TestBundleActivator::TestBundleActivator()
26 {
27 }
28
29 TestBundleActivator::~TestBundleActivator()
30 {
31 }
32
33 void TestBundleActivator::activateBundle(ResourceContainerBundleAPI *resourceContainer,
34         std::string bundleId)
35 {
36     std::cout << "TestBundleActivator::activateBundle .. " << std::endl;
37 }
38
39 void TestBundleActivator::deactivateBundle()
40 {
41     std::cout << "TestBundleActivator::deactivateBundle .. " << std::endl;
42 }
43
44 void TestBundleActivator::createResource(resourceInfo resourceInfo)
45 {
46     std::cout << "TestBundleActivator::createResource .. " << std::endl;
47 }
48
49 void TestBundleActivator::destroyResource(BundleResource *pBundleResource)
50 {
51     std::cout << "TestBundleActivator::destroyResource .. " << std::endl;
52 }
53
54 extern "C" void externalActivateBundle(ResourceContainerBundleAPI *resourceContainer,
55                                        std::string bundleId)
56 {
57     bundle = new TestBundleActivator();
58     bundle->activateBundle(resourceContainer, bundleId);
59 }
60
61 extern "C" void externalDeactivateBundle()
62 {
63     if (!bundle)
64     {
65         bundle->deactivateBundle();
66     }
67 }
68
69 extern "C" void externalCreateResource(resourceInfo resourceInfo)
70 {
71     bundle->createResource(resourceInfo);
72 }
73
74 extern "C" void externalDestroyResource(BundleResource *pBundleResource)
75 {
76     bundle->destroyResource(pBundleResource);
77 }