1 //******************************************************************
3 // Copyright 2014 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #ifndef NOTIFICATIONMANAGER_H_
22 #define NOTIFICATIONMANAGER_H_
34 #include "OCPlatform.h"
35 #include "OCResource.h"
36 #include "OCResourceRequest.h"
37 #include "OCResourceResponse.h"
40 #include "ResourceManager.h"
41 #include "RegistrationManager.h"
42 #include "VirtualRepresentation.h"
47 using namespace OCPlatform;
49 const std::string VIRTURL_TAG = "/virtual";
51 class NotificationManager
56 static NotificationManager *s_instance;
57 // static OCPlatform *s_nmOCPlatform;
59 static PlatformConfig s_cfg;
61 std::function< void(AttributeMap &inputAttMap) > m_print;
62 std::function< void(std::shared_ptr< OCResource > resource) > m_onfound;
63 std::function< void(AttributeMap &inputAttMap) > m_onObserve;
65 std::function< void(std::shared_ptr< OCResource > resource) > m_startHosting;
66 std::function< void() > m_findHosting;
67 std::function< void(std::string) > m_addExtraStr;
71 NotificationManager();
72 ~NotificationManager();
74 static NotificationManager *getInstance();
77 void findHostingCandidate();
78 void registerHostingEventListener();
80 int setPrint(std::function< void(AttributeMap &inputAttMap) > func);
81 int setOnFoundHostingCandidate(
82 std::function< void(std::shared_ptr< OCResource > resource) > func);
83 int setOnObserve(std::function< void(AttributeMap &inputAttMap) > func);
85 std::function< void(AttributeMap &inputAttMap) > getPrint();
86 std::function< void(std::shared_ptr< OCResource > resource) > getOnFoundHostingCandidate();
87 std::function< void(AttributeMap &inputAttMap) > getOnObserve();
89 int setStartHosting(std::function< void(std::shared_ptr< OCResource > resource) > &func);
90 int setFindHosting(std::function< void() > &func);
91 int setAddExtraStr(std::function< void(std::string) > &func);
93 std::function< void(std::shared_ptr< OCResource > resource) > getStartHosting();
94 std::function< void() > getFindHosting();
95 std::function< void(std::string) > getAddExtraStr();
99 #endif /* NOTIFICATIONMANAGER_H_ */