scmClientDevice.h
1 
4 #pragma once
5 #include "../../../../LIBRARIES/MIDDLEWARE/src/com/dpyMwClient.h"
6 #include "scmApi.h"
7 #include <map>
8 
14 {
15 private:
17  SCMClientDevice& operator=(const SCMClientDevice&);
18  std::string mId;
19 
20  static std::map<std::string, SCMClientDevice*> instances;
21  void RegisterCallbacks();
22  SCMClientDevice(std::string& ip);
23  ~SCMClientDevice();
24 public:
25  static void destroyAll()
26  {
27  for (auto it = instances.begin(); it != instances.end(); ++it)
28  {
29  delete (*it).second;
30  }
31  instances.clear();
32  }
33 
34  static void destroy(std::string &key)
35  {
36  auto it = instances.find(key);
37 
38  if (it != instances.end()) {
39  delete (*it).second;
40  instances.erase(it);
41  }
42  }
43 
44  static SCMClientDevice* getPtr(std::string &key)
45  {
46  const auto it = instances.find(key);
47 
48  if (it != instances.end())
49  {
50  return (it->second);
51  }
52  instances[key] = new SCMClientDevice(key);
53  return instances[key];
54  }
55 
56  static SCMClientDevice& getRef(std::string &key)
57  {
58  return *getPtr(key);
59  }
60 
61  void asyncCardOperation(dpySCM::TransactionDevice opertionDevice, dpySCM::card_operation_handler_function handler);
62  void asyncPassThrough(dpySCM::DevicePassThrough devicePassThrough, dpySCM::pass_through_operation_handler_function handler);
63 
64  void asyncGetULCounter(std::string deviceId, dpySCM::UltraLightCounter& ulCounter, dpySCM::ultralight_counter_handler_function handler);
65  void asyncIncrementULCounter(std::string deviceI, dpySCM::UltraLightCounter& ulCounter, dpySCM::confirmation_handler_function handler);
66 
67  void asyncAddKeys(dpySCM::DeviceKeys deviceKeys, dpySCM::confirmation_handler_function handler);
68  void asyncAddKeys(std::string deviceId, std::string json, dpySCM::confirmation_handler_function handler);
69  void asyncGetKeys(std::string deviceId, dpySCM::get_keys_handler_function handler);
70  void asyncRemoveKeys(std::string deviceId, dpySCM::confirmation_handler_function handler);
71 };
Structure for UltraLight counter requests.
Definition: scmTypes.h:644
boost::function< void(boost::system::error_code &ec, dpySCM::TransactionDevice TransactionDevice)> card_operation_handler_function
Result of card operation.
Definition: scmApi.h:46
boost::function< void(boost::system::error_code &ec, dpySCM::DeviceKeys deviceKeys)> get_keys_handler_function
Result of getting keys information.
Definition: scmApi.h:45
Transaction operation device.
Definition: scmTypes.h:199
boost::function< void(boost::system::error_code &ec, dpySCM::UltraLightCounter &ulCounter)> ultralight_counter_handler_function
Result of getting a ultralight counter value.
Definition: scmApi.h:54
boost::function< void(boost::system::error_code &ec)> confirmation_handler_function
Result of confirmation operation.
Definition: scmApi.h:44
Interacts with platform manager service.
Definition: scmClientDevice.h:13
Device pass through.
Definition: scmTypes.h:637
Add Keys.
Definition: scmTypes.h:214
Manages dealer and susbriber.
Definition: dpyMwClient.h:59
boost::function< void(boost::system::error_code &ec, dpySCM::DevicePassThrough devicePassThrough)> pass_through_operation_handler_function
Result of pass through operation.
Definition: scmApi.h:47