Initial merge-commit of the OIC code. Should successfully do discovery for single...
[platform/upstream/iotivity.git] / include / InProcClientWrapper.h
1 //******************************************************************
2 //
3 // Copyright 2014 Intel Corporation All Rights Reserved.
4 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5
6 #ifndef _IN_PROC_CLIENT_WRAPPER_H_
7 #define _IN_PROC_CLIENT_WRAPPER_H_
8
9 #include <thread>
10 #include <mutex>
11 #include <sstream>
12 #include <iostream>
13
14 #include <boost/property_tree/ptree.hpp>
15 #include <boost/property_tree/json_parser.hpp>
16
17 #include <OCApi.h>
18 #include <ocstack.h>
19 #include <IClientWrapper.h>
20 #include <InitializeException.h>
21 #include <ResourceInitException.h>
22
23 namespace OC
24 {
25     class InProcClientWrapper : public IClientWrapper
26     {
27     public:
28         InProcClientWrapper(PlatformConfig cfg);
29         virtual ~InProcClientWrapper();
30
31         virtual int ListenForResource(const std::string& serviceUrl, const std::string& resourceType, std::function<void(OCResource::Ptr)>& callback);
32
33     private:
34         void listeningFunc();
35         std::thread m_listeningThread;
36         bool m_threadRun;
37         std::mutex m_resourceListenerLock;
38                 std::mutex m_csdkLock;
39         std::vector<std::function<void(OCClientResponse*)>> callbackList;
40     };
41 }
42
43 #endif