contextApi.h
Go to the documentation of this file.
1 
4 #pragma once
5 
9 #include <boost/function.hpp>
10 #include <boost/system/error_code.hpp>
11 #include <boost/shared_ptr.hpp>
12 #include <vector>
13 #include "iContext.h"
14 
16 
22 namespace dpyContext {
23 
28 typedef boost::function<void(boost::system::error_code error_code)> result_handler_function;
29 
35 typedef boost::function<void(boost::system::error_code, std::list<std::string> devices)> devices_list_handler_function;
36 
42 typedef boost::function<void(boost::system::error_code, std::string memoryType)> memory_type_handler_function;
43 
49 typedef boost::function<void(boost::system::error_code, unsigned int contextSize)> context_size_handler_function;
50 
56 typedef boost::function<void(boost::system::error_code, std::string data)> get_context_handler_function;
57 
58 } //dpyContext
59 
60 
61 //Note that the ContextApiCPP group must be defined in the general documentation
68 {
69 
70 private:
71  boost::shared_ptr<ContextClient> mClient; // Context Client
72 
73 public:
74 
75  /*
76  * @brief Constructor of the class
77  * @param ip IP address to be binded to the App
78  */
79  explicit ContextManager(std::string ip = "127.0.0.1");
80 
81  /*
82  * @brief Destructor of the class
83  */
84  ~ContextManager();
85 
90  bool isAlive();
91 
96  void asyncGetDevices(dpyContext::devices_list_handler_function handler);
97 
105  void asyncGetMemoryValues(dpyContext::get_context_handler_function handler, std::string deviceid, unsigned int position, unsigned int length);
106 
114  void asyncSetMemoryValues(dpyContext::result_handler_function handler, std::string deviceid, unsigned int position, const std::string& data);
115 
121  void asyncGetMemoryType(dpyContext::memory_type_handler_function handler, std::string deviceid);
122 
128  void asyncGetContextSize(dpyContext::context_size_handler_function handler, std::string deviceid);
129 
135  void asyncDumpContext(dpyContext::get_context_handler_function handler, std::string deviceid);
136 };
Deepsy SERVICE_NAME namespace that includes the different enums, structs or method signatures that sh...
Definition: contextApi.h:15
boost::function< void(boost::system::error_code, unsigned int contextSize)> context_size_handler_function
Prototype of the handler function for getting context memory size.
Definition: contextApi.h:49
boost::function< void(boost::system::error_code, std::string memoryType)> memory_type_handler_function
Prototype of the handler function for getting context memory type.
Definition: contextApi.h:42
boost::function< void(boost::system::error_code, std::list< std::string > devices)> devices_list_handler_function
Prototype of the handler function for getting available context devices.
Definition: contextApi.h:35
boost::function< void(boost::system::error_code, std::string data)> get_context_handler_function
Prototype of the handler function for getting context memory content.
Definition: contextApi.h:56
Definition: contextApi.h:67
Interacts with Context service.
Definition: contextClient.h:13
boost::function< void(boost::system::error_code error_code)> result_handler_function
Prototype of the handler function for obtaining a result.
Definition: contextApi.h:28