7 #ifndef IFM3D_FG_FRAMEGRABBER_H
8 #define IFM3D_FG_FRAMEGRABBER_H
13 #include <ifm3d/device/device.h>
14 #include <ifm3d/device/err.h>
15 #include <ifm3d/device/pcic_command.h>
16 #include <ifm3d/fg/buffer.h>
17 #include <ifm3d/fg/frame.h>
18 #include <ifm3d/fg/module_frame_grabber.h>
19 #include <ifm3d/fg/organizer.h>
34 using Ptr = std::shared_ptr<FrameGrabber>;
35 using NewFrameCallback = std::function<void(Frame::Ptr)>;
36 using AsyncErrorCallback = std::function<void(
int,
const std::string&)>;
37 using AsyncNotificationCallback =
38 std::function<void(
const std::string&,
const std::string&)>;
39 using ErrorCallback = std::function<void(
const ifm3d::Error&)>;
41 std::vector<std::variant<std::uint64_t, int, ifm3d::buffer_id>>;
42 using PCICCommandResponse =
43 std::variant<std::monostate, std::string, std::vector<std::uint8_t>>;
52 std::optional<std::uint16_t> pcic_port = std::nullopt);
81 std::shared_future<void> SWTrigger();
87 void OnNewFrame(NewFrameCallback callback =
nullptr);
110 std::shared_future<void> Start(
111 const BufferList& buffers,
112 const std::optional<json>& schema = std::nullopt);
119 std::shared_future<void> Stop();
129 std::shared_future<Frame::Ptr> WaitForFrame();
137 void SetOrganizer(std::unique_ptr<Organizer> organizer);
145 void OnAsyncError(AsyncErrorCallback callback =
nullptr);
152 void OnAsyncNotification(AsyncNotificationCallback callback =
nullptr);
158 void OnError(ErrorCallback callback =
nullptr);
166 void SetMasking(
bool mask);
185 std::shared_future<PCICCommandResponse> SendCommand(
190 std::unique_ptr<Impl> _impl;
196 #endif // IFM3D_FG_FRAMEGRABBER_H