Mech-Eye API
2.6.0
API reference documentation for Mech-Eye 3D Laser Profiler
Toggle main menu visibility
Loading...
Searching...
No Matches
profiler
ProfilerEvent.h
1
/*******************************************************************************
2
* BSD 3-Clause License
3
*
4
* Copyright (c) 2016-2025, Mech-Mind Robotics Technologies Co., Ltd.
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
40
namespace
mmind {
41
42
namespace
eye {
43
48
class
MMIND_API_EXPORT
ProfilerEvent
49
{
50
public
:
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
109
static
ErrorStatus
getSupportedEvents
(
const
Profiler
& profiler,
110
std::vector<EventInfo>& eventInfos);
111
112
struct
EventData
113
{
114
int
eventId
{0};
115
std::string
eventName
{};
116
int64_t
timestamp
{0};
117
};
118
122
struct
PayloadMember
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
;
135
struct
MemberValue
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
};
145
MemberValue
value
;
146
};
147
148
using
Payload = std::vector<PayloadMember>;
149
155
using
ProfilerEventCallback
=
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
mmind::eye::ProfilerEvent
Describes the event of profiler. Use ProfilerEvent::registerProfilerEventCallback to register an even...
Definition
ProfilerEvent.h:49
mmind::eye::ProfilerEvent::getSupportedEvents
static ErrorStatus getSupportedEvents(const Profiler &profiler, std::vector< EventInfo > &eventInfos)
Get supported events by the profiler.
mmind::eye::ProfilerEvent::registerProfilerEventCallback
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...
mmind::eye::ProfilerEvent::ProfilerEventCallback
std::function< void(const EventData *eventData, const void *extraPayload)> ProfilerEventCallback
callback function for a camera event.
Definition
ProfilerEvent.h:155
mmind::eye::ProfilerEvent::registerProfilerEventCallback
static ErrorStatus registerProfilerEventCallback(Profiler &profiler, EventCallback callback, void *pUser, unsigned int events)
Registers a profiler event of interest.
mmind::eye::ProfilerEvent::unregisterProfilerEventCallback
static ErrorStatus unregisterProfilerEventCallback(Profiler &profiler, uint16_t event)
Cancels the registration of a callback function for the specified event and Profiler object.
mmind::eye::ProfilerEvent::Event
Event
Describes the types of Event.
Definition
ProfilerEvent.h:56
mmind::eye::ProfilerEvent::PROFILER_EVENT_DISCONNECTED
@ PROFILER_EVENT_DISCONNECTED
The profiler has disconnected.
Definition
ProfilerEvent.h:57
mmind::eye::ProfilerEvent::PROFILER_EVENT_ALL
@ PROFILER_EVENT_ALL
All profiler events.
Definition
ProfilerEvent.h:58
mmind::eye::Profiler
Operates the laser profiler. Use Profiler::connect to connect an available laser profiler,...
Definition
Profiler.h:100
mmind::eye::ErrorStatus
Describes the types of errors.
Definition
ErrorStatus.h:12
mmind::eye::ProfilerEvent::EventData
Definition
ProfilerEvent.h:113
mmind::eye::ProfilerEvent::EventData::eventId
int eventId
Event ID, defined in ProfilerEvent::Event.
Definition
ProfilerEvent.h:114
mmind::eye::ProfilerEvent::EventData::eventName
std::string eventName
Event name.
Definition
ProfilerEvent.h:115
mmind::eye::ProfilerEvent::EventData::timestamp
int64_t timestamp
The timestamp of the event occurrence.
Definition
ProfilerEvent.h:116
mmind::eye::ProfilerEvent::EventInfo
Describes the event information.
Definition
ProfilerEvent.h:88
mmind::eye::ProfilerEvent::EventInfo::eventId
uint16_t eventId
The ID of the event.
Definition
ProfilerEvent.h:90
mmind::eye::ProfilerEvent::EventInfo::eventName
std::string eventName
The name of the event.
Definition
ProfilerEvent.h:89
mmind::eye::ProfilerEvent::PayloadMember::MemberValue
Definition
ProfilerEvent.h:136
mmind::eye::ProfilerEvent::PayloadMember
Describes the data member of the event's payload.
Definition
ProfilerEvent.h:123
mmind::eye::ProfilerEvent::PayloadMember::type
Type type
Member type.
Definition
ProfilerEvent.h:134
mmind::eye::ProfilerEvent::PayloadMember::name
std::string name
Member name.
Definition
ProfilerEvent.h:124
mmind::eye::ProfilerEvent::PayloadMember::value
MemberValue value
Member value.
Definition
ProfilerEvent.h:145
Generated by
1.17.0