Mech-Eye API 2.5.0
API reference documentation for Mech-Eye 3D Laser Profiler
All Classes Functions Variables Typedefs Enumerations Enumerator Pages
ProfilerEvent.h
1/*******************************************************************************
2 * BSD 3-Clause License
3 *
4 * Copyright (c) 2016-2025, Mech-Mind Robotics
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 *
17 * 3. Neither the name of the copyright holder nor the names of its
18 * contributors may be used to endorse or promote products derived from
19 * this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 * Info: https://www.mech-mind.com/
33 *
34 ******************************************************************************/
35
36#pragma once
37#include <functional>
38#include "profiler/Profiler.h"
39
40namespace mmind {
41
42namespace eye {
43
48class MMIND_API_EXPORT ProfilerEvent
49{
50public:
56 enum Event {
57 PROFILER_EVENT_DISCONNECTED = 0x0001,
58 PROFILER_EVENT_ALL = 0xFFFF,
59 };
60
61 using EventCallback = std::function<void(Event event, void* pUser)>;
62
78 [[deprecated(
79 "Please use @ref registerProfilerEventCallback(Profiler& profiler, Event event, const "
80 "ProfilerEventCallback& callback) instead.")]] static ErrorStatus
81 registerProfilerEventCallback(Profiler& profiler, EventCallback callback, void* pUser,
82 unsigned int events);
83
87 struct EventInfo
88 {
89 std::string eventName{};
90 uint16_t eventId{0x0000};
91
92 EventInfo() = default;
93 EventInfo(const std::string& eventName, uint16_t eventId)
94 : eventName(eventName), eventId(eventId)
95 {
96 }
97 };
98
110 std::vector<EventInfo>& eventInfos);
111
113 {
114 int eventId{0};
115 std::string eventName{};
116 int64_t timestamp{0};
117 };
118
123 {
124 std::string name;
125 enum class Type {
126 _UInt32,
127 _Int32,
128 _Int64,
129 _Float,
130 _Double,
131 _Bool,
132 _String,
133 };
134 Type type;
136 {
137 uint32_t uint32Value;
138 int32_t int32Value;
139 int64_t int64Value;
140 float floatValue;
141 double doubleValue;
142 bool boolValue;
143 std::string stringValue;
144 };
146 };
147
148 using Payload = std::vector<PayloadMember>;
149
156 std::function<void(const EventData* eventData, const void* extraPayload)>;
157
178 static ErrorStatus registerProfilerEventCallback(Profiler& profiler, uint16_t event,
179 const ProfilerEventCallback& callback);
180
198 static ErrorStatus unregisterProfilerEventCallback(Profiler& profiler, uint16_t event);
199};
200
201} // namespace eye
202
203} // namespace mmind
Describes the event of profiler. Use ProfilerEvent::registerProfilerEventCallback to register an even...
static ErrorStatus getSupportedEvents(const Profiler &profiler, std::vector< EventInfo > &eventInfos)
Get supported events by the profiler.
std::function< void(const EventData *eventData, const void *extraPayload)> ProfilerEventCallback
callback function for a camera event.
static ErrorStatus registerProfilerEventCallback(Profiler &profiler, uint16_t event, const ProfilerEventCallback &callback)
Registers a callback function to be executed when the specified Event occurs on the specified Profile...
static ErrorStatus registerProfilerEventCallback(Profiler &profiler, EventCallback callback, void *pUser, unsigned int events)
Registers a profiler event of interest.
static ErrorStatus unregisterProfilerEventCallback(Profiler &profiler, uint16_t event)
Cancels the registration of a callback function for the specified event and Profiler object.
Event
Describes the types of Event.
Operates the laser profiler. Use Profiler::connect to connect an available laser profiler,...
Definition Profiler.h:68
Describes the types of errors.
Definition ErrorStatus.h:12
Describes the event information.
Describes the data member of the event's payload.