ifm3d
pcicclient.h
1 // -*- c++ -*-
2 /*
3  * Copyright (C) 2017 Kuhn & Völkel GmbH
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef IFM3D_PCICCLIENT_PCICCLIENT_H
7 #define IFM3D_PCICCLIENT_PCICCLIENT_H
8 
9 #include <ifm3d/pcicclient/pcicclient_export.h>
10 #include <atomic>
11 #include <condition_variable>
12 #include <map>
13 #include <mutex>
14 #include <string>
15 #include <thread>
16 #include <ifm3d/device.h>
17 
18 namespace ifm3d
19 {
26  class IFM3D_PCICCLIENT_EXPORT PCICClient
27  {
28  public:
29  using Ptr = std::shared_ptr<PCICClient>;
30 
38  PCICClient(ifm3d::LegacyDevice::Ptr cam,
39  const std::uint16_t pcic_port = ifm3d::PCIC_PORT);
40 
45  virtual ~PCICClient();
46 
47  // copy and move semantics
48  PCICClient(PCICClient&&) = delete;
49  PCICClient& operator=(PCICClient&&) = delete;
50  PCICClient(PCICClient&) = delete;
51  PCICClient& operator=(const PCICClient&) = delete;
52 
61  void Stop();
62 
83  long Call(const std::string& request,
84  std::function<void(const std::string& response)> callback);
85 
100  std::string Call(const std::string& request);
101 
125  bool Call(const std::string& request,
126  std::string& response,
127  long timeout_millis);
128 
142  long SetErrorCallback(
143  std::function<void(const std::string& error)> callback);
144 
160  long SetNotificationCallback(
161  std::function<void(const std::string& notification)> callback);
162 
173  void CancelCallback(long callback_id);
174 
175  private:
176  class IFM3D_PCICCLIENT_LOCAL Impl;
177  std::unique_ptr<Impl> pImpl;
178 
179  }; // end: class PCICClient
180 
181 } // end: namespace ifm3d
182 
183 #endif // IFM3D_PCICCLIENT_PCICCLIENT_H
ifm3d::PCICClient
Definition: pcicclient.h:26