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/device.h>
10 #include <ifm3d/pcicclient/module_pcicclient.h>
11 #include <string>
12 
13 namespace ifm3d
14 {
21  class IFM3D_EXPORT PCICClient
22  {
23  public:
24  using Ptr = std::shared_ptr<PCICClient>;
25 
33  PCICClient(ifm3d::LegacyDevice::Ptr cam,
34  std::uint16_t pcic_port = ifm3d::PCIC_PORT);
35 
40  virtual ~PCICClient();
41 
42  // copy and move semantics
43  PCICClient(PCICClient&&) = delete;
44  PCICClient& operator=(PCICClient&&) = delete;
45  PCICClient(PCICClient&) = delete;
46  PCICClient& operator=(const PCICClient&) = delete;
47 
56  void Stop();
57 
78  long Call(const std::string& request,
79  std::function<void(const std::string& response)> callback);
80 
95  std::string Call(const std::string& request);
96 
120  bool Call(const std::string& request,
121  std::string& response,
122  long timeout_millis);
123 
138  std::function<void(const std::string& error)> callback);
139 
156  std::function<void(const std::string& notification)> callback);
157 
168  void CancelCallback(long callback_id);
169 
170  private:
171  class Impl;
172  std::unique_ptr<Impl> _impl;
173 
174  }; // end: class PCICClient
175 
176 } // end: namespace ifm3d
177 
178 #endif // IFM3D_PCICCLIENT_PCICCLIENT_H
The PCICClient is a class that, when given access to an ifm3d::Camera::Ptr, it provides unbuffered co...
Definition: pcicclient.h:22
std::string Call(const std::string &request)
Sends a PCIC command to the camera and returns the response as soon as it has been received.
bool Call(const std::string &request, std::string &response, long timeout_millis)
Similar to the Call function above.
virtual ~PCICClient()
Cleans up any resources held by the receive thread object and blocks until the operating system threa...
void CancelCallback(long callback_id)
Cancels registered callbacks.
long Call(const std::string &request, std::function< void(const std::string &response)> callback)
Sends a PCIC command to the camera and returns the response asynchronously through a callback (,...
long SetNotificationCallback(std::function< void(const std::string &notification)> callback)
Sets the specified callback for receiving asynchronous notification messages until it is replaced by ...
long SetErrorCallback(std::function< void(const std::string &error)> callback)
Sets the specified callback for receiving asynchronous error messages until it is replaced by a new c...
PCICClient(ifm3d::LegacyDevice::Ptr cam, std::uint16_t pcic_port=ifm3d::PCIC_PORT)
Stores reference to the passed in camera and starts connect/receive thread.
void Stop()
Interrupts the running thread by throwing an ifm3d::error_t with code IFM3D_THREAD_INTERRUPTED.