IDS peak genericC++ v1.10.0
Loading...
Searching...
No Matches
peak_interface.hpp
Go to the documentation of this file.
1
10
11#pragma once
12
13
18#include <peak/dll_interface/peak_dll_interface_util.hpp>
19#include <peak/generic/peak_t_callback_manager.hpp>
21
22#include <unordered_map>
23#include <cstdint>
24#include <functional>
25#include <memory>
26#include <mutex>
27#include <string>
28#include <vector>
29
30
31namespace peak
32{
33namespace core
34{
35
36class System;
37
38struct DeviceFoundCallbackContainer;
39
48 , public std::enable_shared_from_this<Interface>
49{
50public:
52 using DeviceFoundCallback = std::function<void(const std::shared_ptr<DeviceDescriptor>& foundDevice)>;
56 using DeviceDisconnectedCallback = std::function<void(const std::shared_ptr<DeviceDescriptor>& disconnectedDevice)>;
60 using DeviceReconnectedCallback = std::function<void(
61 const std::shared_ptr<DeviceDescriptor>& reconnectedDevice, DeviceReconnectInformation reconnectInformation)>;
65 using DeviceLostCallback = std::function<void(const std::string& lostDeviceId)>;
69 using DeviceListChangedCallback = std::function<void()>;
72
73 Interface() = delete;
74 ~Interface() override;
75 Interface(const Interface& other) = delete;
76 Interface& operator=(const Interface& other) = delete;
77 Interface(Interface&& other) = delete;
78 Interface& operator=(Interface&& other) = delete;
79
81 std::string Key() const;
82
84 RawInformation Info(int32_t infoCommand) const;
86 std::string ID() const;
88 std::string DisplayName() const;
90 std::string TLType() const;
91
106 void UpdateDevices(Timeout timeout_ms);
107
117 std::vector<std::shared_ptr<DeviceDescriptor>> Devices() const;
118
120 std::shared_ptr<System> ParentSystem() const;
121
137
150
166
179
197
210
227
240
257
270
271private:
272 struct DeviceFoundCallbackContainer
273 {
274 std::weak_ptr<Interface> _Interface;
276 };
277 struct DeviceDisconnectedCallbackContainer
278 {
279 std::weak_ptr<Interface> _Interface;
281 };
282 struct DeviceReconnectedCallbackContainer
283 {
284 std::weak_ptr<Interface> _Interface;
286 };
287 static void PEAK_CALL_CONV DeviceFoundCallbackCWrapper(
288 PEAK_DEVICE_DESCRIPTOR_HANDLE foundDevice, void* context);
289 static void PEAK_CALL_CONV DeviceLostCallbackCWrapper(
290 const char* lostDeviceId, size_t lostDeviceIdSize, void* context);
291 static void PEAK_CALL_CONV DeviceDisconnectedCallbackCWrapper(
292 PEAK_DEVICE_DESCRIPTOR_HANDLE foundDevice, void* context);
293 static void PEAK_CALL_CONV DeviceReconnectedCallbackCWrapper(PEAK_DEVICE_DESCRIPTOR_HANDLE reconnectedDevice,
294 PEAK_DEVICE_RECONNECT_INFORMATION reconnectInformation, void* context);
295 static void PEAK_CALL_CONV DeviceListChangedCallbackCWrapper(void* context);
296
297 std::shared_ptr<DeviceDescriptor> GetOrAddFoundDevice(PEAK_DEVICE_DESCRIPTOR_HANDLE foundDevice);
298
299 PEAK_MODULE_HANDLE ModuleHandle() const override;
300 PEAK_EVENT_SUPPORTING_MODULE_HANDLE EventSupportingModuleHandle() const override;
301
302 void InitializeUpdateMechanismIfNecessary();
303
304 friend ClassCreator<Interface>;
305 Interface(PEAK_INTERFACE_HANDLE interfaceHandle, const std::weak_ptr<System>& parentSystem);
306 PEAK_INTERFACE_HANDLE m_backendHandle;
307
308 std::weak_ptr<System> m_parentSystem;
309
310 std::unique_ptr<TCallbackManager<PEAK_DEVICE_FOUND_CALLBACK_HANDLE, DeviceFoundCallbackContainer>>
311 m_deviceFoundCallbackManager;
312 std::unique_ptr<TCallbackManager<PEAK_DEVICE_LOST_CALLBACK_HANDLE, DeviceLostCallback>>
313 m_deviceLostCallbackManager;
314
315 std::unique_ptr<TCallbackManager<PEAK_DEVICE_DISCONNECTED_CALLBACK_HANDLE, DeviceDisconnectedCallbackContainer>>
316 m_deviceDisconnectedCallbackManager;
317 std::unique_ptr<TCallbackManager<PEAK_DEVICE_RECONNECTED_CALLBACK_HANDLE, DeviceReconnectedCallbackContainer>>
318 m_deviceReconnectedCallbackManager;
319
320 std::unique_ptr<TCallbackManager<PEAK_DEVICE_LIST_CHANGED_CALLBACK_HANDLE, DeviceListChangedCallback>>
321 m_deviceListChangedCallbackManager;
322
323 std::vector<std::shared_ptr<DeviceDescriptor>> m_devices;
324 std::unordered_map<std::string, std::shared_ptr<DeviceDescriptor>> m_devicesByKey;
325 std::unordered_map<std::string, std::string> m_devicesKeyById;
326 mutable std::mutex m_devicesMutex;
327 std::once_flag m_updateMechanismInitializedFlag;
328
329 std::string m_key;
330};
331
332} /* namespace core */
333} /* namespace peak */
334
335/* Implementation */
336namespace peak
337{
338namespace core
339{
340
341inline Interface::Interface(PEAK_INTERFACE_HANDLE interfaceHandle, const std::weak_ptr<System>& parentSystem)
342 : m_backendHandle(interfaceHandle)
343 , m_parentSystem(parentSystem)
344 , m_key(QueryStringFromCInterfaceFunction([&](char* key, size_t* keySize) {
345 return PEAK_C_ABI_PREFIX PEAK_Interface_GetKey(interfaceHandle, key, keySize);
346 }))
347{
348 m_deviceFoundCallbackManager =
349 std::make_unique<TCallbackManager<PEAK_DEVICE_FOUND_CALLBACK_HANDLE, DeviceFoundCallbackContainer>>(
350 [&](void* callbackContext) {
351 return QueryNumericFromCInterfaceFunction<PEAK_DEVICE_FOUND_CALLBACK_HANDLE>(
352 [&](PEAK_DEVICE_FOUND_CALLBACK_HANDLE* deviceFoundCallbackHandle) {
354 m_backendHandle, DeviceFoundCallbackCWrapper, callbackContext, deviceFoundCallbackHandle);
355 });
356 },
357 [&](PEAK_DEVICE_FOUND_CALLBACK_HANDLE callbackHandle) {
358 CallAndCheckCInterfaceFunction([&] {
360 m_backendHandle, callbackHandle);
361 });
362 });
363
364 m_deviceLostCallbackManager =
365 std::make_unique<TCallbackManager<PEAK_DEVICE_LOST_CALLBACK_HANDLE, DeviceLostCallback>>(
366 [&](void* callbackContext) {
367 return QueryNumericFromCInterfaceFunction<PEAK_DEVICE_LOST_CALLBACK_HANDLE>(
368 [&](PEAK_DEVICE_LOST_CALLBACK_HANDLE* deviceLostCallbackHandle) {
370 m_backendHandle, DeviceLostCallbackCWrapper, callbackContext, deviceLostCallbackHandle);
371 });
372 },
373 [&](PEAK_DEVICE_LOST_CALLBACK_HANDLE callbackHandle) {
374 CallAndCheckCInterfaceFunction([&] {
376 m_backendHandle, callbackHandle);
377 });
378 });
379
380 m_deviceDisconnectedCallbackManager = std::make_unique<
381 TCallbackManager<PEAK_DEVICE_DISCONNECTED_CALLBACK_HANDLE, DeviceDisconnectedCallbackContainer>>(
382 [&](void* callbackContext) {
383 return QueryNumericFromCInterfaceFunction<PEAK_DEVICE_DISCONNECTED_CALLBACK_HANDLE>(
384 [&](PEAK_DEVICE_DISCONNECTED_CALLBACK_HANDLE* deviceDisconnectedCallbackHandle) {
386 DeviceDisconnectedCallbackCWrapper, callbackContext, deviceDisconnectedCallbackHandle);
387 });
388 },
389 [&](PEAK_DEVICE_DISCONNECTED_CALLBACK_HANDLE callbackHandle) {
390 CallAndCheckCInterfaceFunction([&] {
392 m_backendHandle, callbackHandle);
393 });
394 });
395
396 m_deviceReconnectedCallbackManager = std::make_unique<
397 TCallbackManager<PEAK_DEVICE_RECONNECTED_CALLBACK_HANDLE, DeviceReconnectedCallbackContainer>>(
398 [&](void* callbackContext) {
399 return QueryNumericFromCInterfaceFunction<PEAK_DEVICE_RECONNECTED_CALLBACK_HANDLE>(
400 [&](PEAK_DEVICE_RECONNECTED_CALLBACK_HANDLE* deviceReconnectedCallbackHandle) {
402 DeviceReconnectedCallbackCWrapper, callbackContext, deviceReconnectedCallbackHandle);
403 });
404 },
405 [&](PEAK_DEVICE_RECONNECTED_CALLBACK_HANDLE callbackHandle) {
406 CallAndCheckCInterfaceFunction([&] {
408 m_backendHandle, callbackHandle);
409 });
410 });
411
412 m_deviceListChangedCallbackManager =
413 std::make_unique<TCallbackManager<PEAK_DEVICE_LIST_CHANGED_CALLBACK_HANDLE, DeviceListChangedCallback>>(
414 [&](void* callbackContext) {
415 return QueryNumericFromCInterfaceFunction<PEAK_DEVICE_LIST_CHANGED_CALLBACK_HANDLE>(
416 [&](PEAK_DEVICE_LIST_CHANGED_CALLBACK_HANDLE* deviceListChangedCallbackHandle) {
418 DeviceListChangedCallbackCWrapper, callbackContext, deviceListChangedCallbackHandle);
419 });
420 },
421 [&](PEAK_DEVICE_LIST_CHANGED_CALLBACK_HANDLE callbackHandle) {
422 CallAndCheckCInterfaceFunction([&] {
424 m_backendHandle, callbackHandle);
425 });
426 });
427}
428
430{
431 try
432 {
433 m_deviceFoundCallbackManager->UnregisterAllCallbacks();
434 m_deviceLostCallbackManager->UnregisterAllCallbacks();
435
436 m_deviceDisconnectedCallbackManager->UnregisterAllCallbacks();
437 m_deviceReconnectedCallbackManager->UnregisterAllCallbacks();
438
439 m_deviceListChangedCallbackManager->UnregisterAllCallbacks();
440 }
441 catch (const Exception&)
442 {}
443
444 (void)PEAK_C_ABI_PREFIX PEAK_Interface_Destruct(m_backendHandle);
445}
446
447inline std::string Interface::Key() const
448{
449 return m_key;
450}
451
452inline RawInformation Interface::Info(int32_t infoCommand) const
453{
454 return QueryRawInformationFromCInterfaceFunction([&](int32_t* dataType, uint8_t* buffer, size_t* bufferSize) {
456 m_backendHandle, infoCommand, dataType, buffer, bufferSize);
457 });
458}
459
460inline std::string Interface::ID() const
461{
462 return QueryStringFromCInterfaceFunction([&](char* id, size_t* idSize) {
463 return PEAK_C_ABI_PREFIX PEAK_Interface_GetID(m_backendHandle, id, idSize);
464 });
465}
466
467inline std::string Interface::DisplayName() const
468{
469 return QueryStringFromCInterfaceFunction([&](char* displayName, size_t* displayNameSize) {
470 return PEAK_C_ABI_PREFIX PEAK_Interface_GetDisplayName(m_backendHandle, displayName, displayNameSize);
471 });
472}
473
474inline std::string Interface::TLType() const
475{
476 return QueryStringFromCInterfaceFunction([&](char* tlType, size_t* tlTypeSize) {
477 return PEAK_C_ABI_PREFIX PEAK_Interface_GetTLType(m_backendHandle, tlType, tlTypeSize);
478 });
479}
480
481inline void Interface::UpdateDevices(Timeout timeout_ms)
482{
483 InitializeUpdateMechanismIfNecessary();
484
485 CallAndCheckCInterfaceFunction(
486 [&] { return PEAK_C_ABI_PREFIX PEAK_Interface_UpdateDevices(m_backendHandle, timeout_ms); });
487}
488
489inline std::vector<std::shared_ptr<DeviceDescriptor>> Interface::Devices() const
490{
491 std::lock_guard<std::mutex> lock(m_devicesMutex);
492 return m_devices;
493}
494
495inline std::shared_ptr<System> Interface::ParentSystem() const
496{
497 return LockOrThrow(m_parentSystem);
498}
499
501 const Interface::DeviceFoundCallback& callback)
502{
503 return reinterpret_cast<DeviceFoundCallbackHandle>(
504 m_deviceFoundCallbackManager->RegisterCallback(DeviceFoundCallbackContainer{ shared_from_this(), callback }));
505}
506
508{
509 m_deviceFoundCallbackManager->UnregisterCallback(
510 reinterpret_cast<PEAK_DEVICE_FOUND_CALLBACK_HANDLE>(callbackHandle));
511}
512
514 const DeviceReconnectedCallback& callback)
515{
516 return reinterpret_cast<DeviceReconnectedCallbackHandle>(m_deviceReconnectedCallbackManager->RegisterCallback(
517 DeviceReconnectedCallbackContainer{ shared_from_this(), callback }));
518}
519
521{
522 m_deviceReconnectedCallbackManager->UnregisterCallback(
523 reinterpret_cast<PEAK_DEVICE_RECONNECTED_CALLBACK_HANDLE>(callbackHandle));
524}
525
527 const DeviceDisconnectedCallback& callback)
528{
529 return reinterpret_cast<DeviceDisconnectedCallbackHandle>(m_deviceDisconnectedCallbackManager->RegisterCallback(
530 DeviceDisconnectedCallbackContainer{ shared_from_this(), callback }));
531}
532
534{
535 m_deviceDisconnectedCallbackManager->UnregisterCallback(
536 reinterpret_cast<PEAK_DEVICE_DISCONNECTED_CALLBACK_HANDLE>(callbackHandle));
537}
538
540 const Interface::DeviceLostCallback& callback)
541{
542 return reinterpret_cast<DeviceLostCallbackHandle>(m_deviceLostCallbackManager->RegisterCallback(callback));
543}
544
546{
547 m_deviceLostCallbackManager->UnregisterCallback(
548 reinterpret_cast<PEAK_DEVICE_LOST_CALLBACK_HANDLE>(callbackHandle));
549}
550
553{
554 return reinterpret_cast<DeviceListChangedCallbackHandle>(m_deviceListChangedCallbackManager->RegisterCallback(callback));
555}
556
558{
559 m_deviceListChangedCallbackManager->UnregisterCallback(
560 reinterpret_cast<PEAK_DEVICE_LIST_CHANGED_CALLBACK_HANDLE>(callbackHandle));
561}
562
563inline void PEAK_CALL_CONV Interface::DeviceFoundCallbackCWrapper(
564 PEAK_DEVICE_DESCRIPTOR_HANDLE foundDevice, void* context)
565{
566 auto callbackContainer = static_cast<DeviceFoundCallbackContainer*>(context);
567
568 auto interfaceDescriptor = callbackContainer->_Interface.lock()->GetOrAddFoundDevice(foundDevice);
569
570 callbackContainer->Callback(interfaceDescriptor);
571}
572
573inline void PEAK_CALL_CONV Interface::DeviceLostCallbackCWrapper(
574 const char* lostDeviceId, size_t lostDeviceIdSize, void* context)
575{
576 auto callback = static_cast<Interface::DeviceLostCallback*>(context);
577
578 callback->operator()(std::string(lostDeviceId, lostDeviceIdSize - 1));
579}
580
581inline void PEAK_CALL_CONV Interface::DeviceDisconnectedCallbackCWrapper(
582 PEAK_DEVICE_DESCRIPTOR_HANDLE foundDevice, void* context)
583{
584 auto callbackContainer = static_cast<DeviceDisconnectedCallbackContainer*>(context);
585
586 auto deviceDescriptor = callbackContainer->_Interface.lock()->GetOrAddFoundDevice(foundDevice);
587
588 callbackContainer->Callback(deviceDescriptor);
589}
590
591inline void PEAK_CALL_CONV Interface::DeviceReconnectedCallbackCWrapper(PEAK_DEVICE_DESCRIPTOR_HANDLE foundDevice,
592 PEAK_DEVICE_RECONNECT_INFORMATION reconnectInformation, void* context)
593{
594 auto callbackContainer = static_cast<DeviceReconnectedCallbackContainer*>(context);
595
596 auto deviceDescriptor = callbackContainer->_Interface.lock()->GetOrAddFoundDevice(foundDevice);
597
598 callbackContainer->Callback(deviceDescriptor, DeviceReconnectInformation(std::move(reconnectInformation)));
599}
600
601inline void PEAK_CALL_CONV Interface::DeviceListChangedCallbackCWrapper(void* context)
602{
603 auto callback = static_cast<Interface::DeviceListChangedCallback*>(context);
604 callback->operator()();
605}
606
607inline std::shared_ptr<DeviceDescriptor> Interface::GetOrAddFoundDevice(PEAK_DEVICE_DESCRIPTOR_HANDLE foundDevice)
608{
609 std::lock_guard<std::mutex> lock(m_devicesMutex);
610
611 const auto deviceKey = QueryStringFromCInterfaceFunction([&](char* key, size_t* keySize) {
612 return PEAK_C_ABI_PREFIX PEAK_DeviceDescriptor_GetKey(foundDevice, key, keySize);
613 });
614 auto keyDevicePairIterator = m_devicesByKey.find(deviceKey);
615 if (keyDevicePairIterator == m_devicesByKey.end())
616 {
617 auto deviceDescriptor = std::static_pointer_cast<DeviceDescriptor>(
618 std::make_shared<ClassCreator<DeviceDescriptor>>(
619 foundDevice, std::weak_ptr<Interface>{ shared_from_this() }));
620 m_devices.emplace_back(deviceDescriptor);
621 m_devicesByKey.emplace(deviceKey, deviceDescriptor);
622 m_devicesKeyById.emplace(deviceDescriptor->ID(), deviceKey);
623
624 return deviceDescriptor;
625 }
626
627 return keyDevicePairIterator->second;
628}
629
630inline PEAK_MODULE_HANDLE Interface::ModuleHandle() const
631{
632 auto moduleHandle = QueryNumericFromCInterfaceFunction<PEAK_MODULE_HANDLE>(
633 [&](PEAK_MODULE_HANDLE* _moduleHandle) {
634 return PEAK_C_ABI_PREFIX PEAK_Interface_ToModule(m_backendHandle, _moduleHandle);
635 });
636
637 return moduleHandle;
638}
639
640inline PEAK_EVENT_SUPPORTING_MODULE_HANDLE Interface::EventSupportingModuleHandle() const
641{
642 auto eventSupportingModuleHandle = QueryNumericFromCInterfaceFunction<PEAK_EVENT_SUPPORTING_MODULE_HANDLE>(
643 [&](PEAK_EVENT_SUPPORTING_MODULE_HANDLE* _eventSupportingModuleHandle) {
645 m_backendHandle, _eventSupportingModuleHandle);
646 });
647
648 return eventSupportingModuleHandle;
649}
650
651inline void Interface::InitializeUpdateMechanismIfNecessary()
652{
653 std::call_once(m_updateMechanismInitializedFlag, [&] {
654 (void)RegisterDeviceFoundCallback([](const std::shared_ptr<DeviceDescriptor>&) {
655 // Registering an empty callback is enough since DeviceFoundCallbackCWrapper() handles everything else.
656 });
657
658 (void)RegisterDeviceLostCallback([&](const std::string& lostDeviceId) {
659 {
660 std::lock_guard<std::mutex> lock(m_devicesMutex);
661 const auto lostDeviceKey = m_devicesKeyById.at(lostDeviceId);
662 m_devices.erase(std::remove_if(std::begin(m_devices), std::end(m_devices),
663 [lostDeviceKey](const std::shared_ptr<DeviceDescriptor>& device) {
664 return device->Key() == lostDeviceKey;
665 }),
666 std::end(m_devices));
667 m_devicesByKey.erase(lostDeviceKey);
668 m_devicesKeyById.erase(lostDeviceId);
669 }
670 });
671 });
672}
673
674} /* namespace core */
675} /* namespace peak */
Definition reconnect_information.hpp:15
The base class for all exceptions thrown by the library.
Definition peak_exception.hpp:26
std::function< void()> DeviceListChangedCallback
Definition peak_interface.hpp:69
~Interface() override
Definition peak_interface.hpp:429
std::shared_ptr< System > ParentSystem() const
Returns the parent system.
Definition peak_interface.hpp:495
std::string TLType() const
Returns the TL (transport layer) type.
Definition peak_interface.hpp:474
RawInformation Info(int32_t infoCommand) const
Delivers information based on the given GenTL info command.
Definition peak_interface.hpp:452
Interface(Interface &&other)=delete
Interface(const Interface &other)=delete
Interface & operator=(const Interface &other)=delete
DeviceReconnectedCallback * DeviceReconnectedCallbackHandle
Definition peak_interface.hpp:63
void UpdateDevices(Timeout timeout_ms)
Searches for devices.
Definition peak_interface.hpp:481
void UnregisterDeviceReconnectedCallback(DeviceReconnectedCallbackHandle callbackHandle)
Unregisters a device reconnected callback.
Definition peak_interface.hpp:520
void UnregisterDeviceListChangedCallback(DeviceListChangedCallbackHandle callbackHandle)
Unregisters a device list changed callback.
Definition peak_interface.hpp:557
DeviceDisconnectedCallbackHandle RegisterDeviceDisconnectedCallback(const DeviceDisconnectedCallback &callback)
Registers a callback for signaling a disconnected device.
Definition peak_interface.hpp:526
DeviceReconnectedCallbackHandle RegisterDeviceReconnectedCallback(const DeviceReconnectedCallback &callback)
Registers a callback for signaling a reconnected device.
Definition peak_interface.hpp:513
std::string ID() const
Returns the ID.
Definition peak_interface.hpp:460
DeviceListChangedCallbackHandle RegisterDeviceListChangedCallback(const DeviceListChangedCallback &callback)
Registers a callback for signaling a device list changed.
Definition peak_interface.hpp:551
std::function< void( const std::shared_ptr< DeviceDescriptor > &reconnectedDevice, DeviceReconnectInformation reconnectInformation)> DeviceReconnectedCallback
Definition peak_interface.hpp:60
void UnregisterDeviceDisconnectedCallback(DeviceDisconnectedCallbackHandle callbackHandle)
Unregisters a device disconnected callback.
Definition peak_interface.hpp:533
std::function< void(const std::shared_ptr< DeviceDescriptor > &foundDevice)> DeviceFoundCallback
Definition peak_interface.hpp:52
DeviceListChangedCallback * DeviceListChangedCallbackHandle
Definition peak_interface.hpp:71
std::vector< std::shared_ptr< DeviceDescriptor > > Devices() const
Returns the device list.
Definition peak_interface.hpp:489
std::string DisplayName() const
Returns the display name.
Definition peak_interface.hpp:467
DeviceLostCallbackHandle RegisterDeviceLostCallback(const DeviceLostCallback &callback)
Registers a callback for signaling a lost device.
Definition peak_interface.hpp:539
DeviceLostCallback * DeviceLostCallbackHandle
Definition peak_interface.hpp:67
Interface & operator=(Interface &&other)=delete
DeviceFoundCallback * DeviceFoundCallbackHandle
Definition peak_interface.hpp:54
void UnregisterDeviceFoundCallback(DeviceFoundCallbackHandle callbackHandle)
Unregisters a device found callback.
Definition peak_interface.hpp:507
void UnregisterDeviceLostCallback(DeviceLostCallbackHandle callbackHandle)
Unregisters a device lost callback.
Definition peak_interface.hpp:545
DeviceFoundCallbackHandle RegisterDeviceFoundCallback(const DeviceFoundCallback &callback)
Registers a callback for signaling a found device.
Definition peak_interface.hpp:500
std::string Key() const
Returns the unique key.
Definition peak_interface.hpp:447
DeviceDisconnectedCallback * DeviceDisconnectedCallbackHandle
Definition peak_interface.hpp:58
std::function< void(const std::string &lostDeviceId)> DeviceLostCallback
Definition peak_interface.hpp:65
std::function< void(const std::shared_ptr< DeviceDescriptor > &disconnectedDevice)> DeviceDisconnectedCallback
Definition peak_interface.hpp:56
Represents a GenTL System module.
Definition peak_system.hpp:51
Represents a timeout value in milliseconds.
Definition peak_timeout.hpp:31
The "core" namespace contains the direct GenAPI and GenTL wrapper.
Definition peak_buffer.hpp:31
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition peak_dynamic_loader.h:33
PEAK_C_API PEAK_DeviceDescriptor_GetKey(PEAK_DEVICE_DESCRIPTOR_HANDLE deviceDescriptorHandle, char *key, size_t *keySize)
Asks the given device descriptor for its key.
struct PEAK_MODULE * PEAK_MODULE_HANDLE
Definition peak_backend.h:421
PEAK_C_API PEAK_Interface_ToEventSupportingModule(PEAK_INTERFACE_HANDLE interfaceHandle, PEAK_EVENT_SUPPORTING_MODULE_HANDLE *eventSupportingModuleHandle)
Casts the given interface to an event-supporting module.
PEAK_C_API PEAK_Interface_GetInfo(PEAK_INTERFACE_HANDLE interfaceHandle, int32_t infoCommand, int32_t *infoDataType, uint8_t *info, size_t *infoSize)
Asks the given interface for an information based on a specific command.
PEAK_C_API PEAK_Interface_UnregisterDeviceFoundCallback(PEAK_INTERFACE_HANDLE interfaceHandle, PEAK_DEVICE_FOUND_CALLBACK_HANDLE callbackHandle)
Unregisters the device-found callback with the given handle from the given interface.
PEAK_C_API PEAK_Interface_ToModule(PEAK_INTERFACE_HANDLE interfaceHandle, PEAK_MODULE_HANDLE *moduleHandle)
Casts the given interface to a module.
struct PEAK_INTERFACE * PEAK_INTERFACE_HANDLE
Definition peak_backend.h:381
PEAK_C_API PEAK_Interface_GetTLType(PEAK_INTERFACE_HANDLE interfaceHandle, char *tlType, size_t *tlTypeSize)
Asks the given interface for its TL type.
PEAK_DEVICE_DISCONNETED_CALLBACK * PEAK_DEVICE_DISCONNECTED_CALLBACK_HANDLE
Definition peak_backend.h:570
PEAK_C_API PEAK_Interface_UnregisterDeviceListChangedCallback(PEAK_INTERFACE_HANDLE interfaceHandle, PEAK_DEVICE_LIST_CHANGED_CALLBACK_HANDLE callbackHandle)
Unregisters the device-list-changed callback with the given handle from the given interface.
struct PEAK_EVENT_SUPPORTING_MODULE * PEAK_EVENT_SUPPORTING_MODULE_HANDLE
Definition peak_backend.h:477
PEAK_C_API PEAK_Interface_RegisterDeviceLostCallback(PEAK_INTERFACE_HANDLE interfaceHandle, PEAK_DEVICE_LOST_CALLBACK callback, void *callbackContext, PEAK_DEVICE_LOST_CALLBACK_HANDLE *callbackHandle)
Registers a callback signaling a lost device at the given interface.
PEAK_DEVICE_LOST_CALLBACK * PEAK_DEVICE_LOST_CALLBACK_HANDLE
Definition peak_backend.h:572
PEAK_DEVICE_RECONNECTED_CALLBACK * PEAK_DEVICE_RECONNECTED_CALLBACK_HANDLE
Definition peak_backend.h:568
PEAK_C_API PEAK_Interface_UnregisterDeviceDisconnectedCallback(PEAK_INTERFACE_HANDLE interfaceHandle, PEAK_DEVICE_DISCONNECTED_CALLBACK_HANDLE callbackHandle)
Unregisters the device disconnected callback with the given handle from the given interface.
PEAK_DEVICE_FOUND_CALLBACK * PEAK_DEVICE_FOUND_CALLBACK_HANDLE
Definition peak_backend.h:566
PEAK_DEVICE_LIST_CHANGED_CALLBACK * PEAK_DEVICE_LIST_CHANGED_CALLBACK_HANDLE
Definition peak_backend.h:574
PEAK_C_API PEAK_Interface_RegisterDeviceFoundCallback(PEAK_INTERFACE_HANDLE interfaceHandle, PEAK_DEVICE_FOUND_CALLBACK callback, void *callbackContext, PEAK_DEVICE_FOUND_CALLBACK_HANDLE *callbackHandle)
Registers a callback signaling a found device at the given interface.
PEAK_C_API PEAK_Interface_RegisterDeviceDisconnectedCallback(PEAK_INTERFACE_HANDLE interfaceHandle, PEAK_DEVICE_DISCONNETED_CALLBACK callback, void *callbackContext, PEAK_DEVICE_DISCONNECTED_CALLBACK_HANDLE *callbackHandle)
Registers a callback signaling a disconnected device that is now waiting to be reconnected at the giv...
PEAK_C_API PEAK_Interface_RegisterDeviceReconnectedCallback(PEAK_INTERFACE_HANDLE interfaceHandle, PEAK_DEVICE_RECONNECTED_CALLBACK callback, void *callbackContext, PEAK_DEVICE_RECONNECTED_CALLBACK_HANDLE *callbackHandle)
Registers a callback signaling a reconnected device at the given interface.
PEAK_C_API PEAK_Interface_UnregisterDeviceLostCallback(PEAK_INTERFACE_HANDLE interfaceHandle, PEAK_DEVICE_LOST_CALLBACK_HANDLE callbackHandle)
Unregisters the device-lost callback with the given handle from the given interface.
PEAK_C_API PEAK_Interface_RegisterDeviceListChangedCallback(PEAK_INTERFACE_HANDLE interfaceHandle, PEAK_DEVICE_LIST_CHANGED_CALLBACK callback, void *callbackContext, PEAK_DEVICE_LIST_CHANGED_CALLBACK_HANDLE *callbackHandle)
Registers a callback signaling a change in the device list at the given interface.
PEAK_C_API PEAK_Interface_Destruct(PEAK_INTERFACE_HANDLE interfaceHandle)
Destroys the given interface.
PEAK_C_API PEAK_Interface_UnregisterDeviceReconnectedCallback(PEAK_INTERFACE_HANDLE interfaceHandle, PEAK_DEVICE_RECONNECTED_CALLBACK_HANDLE callbackHandle)
Unregisters the device-reconnected callback with the given handle from the given interface.
PEAK_C_API PEAK_Interface_GetDisplayName(PEAK_INTERFACE_HANDLE interfaceHandle, char *displayName, size_t *displayNameSize)
Asks the given interface for its display name.
struct PEAK_DEVICE_DESCRIPTOR * PEAK_DEVICE_DESCRIPTOR_HANDLE
Definition peak_backend.h:385
PEAK_C_API PEAK_Interface_GetKey(PEAK_INTERFACE_HANDLE interfaceHandle, char *key, size_t *keySize)
Asks the given interface for its key.
PEAK_C_API PEAK_Interface_GetID(PEAK_INTERFACE_HANDLE interfaceHandle, char *id, size_t *idSize)
Asks the given interface for its ID.
PEAK_C_API PEAK_Interface_UpdateDevices(PEAK_INTERFACE_HANDLE interfaceHandle, uint64_t timeout_ms)
Tells the given interface to update its devices with the given timeout.
#define PEAK_C_ABI_PREFIX
Definition peak_dll_defines.h:16
#define PEAK_CALL_CONV
Definition peak_dynamic_loader.h:30
Definition peak_backend.h:536
The struct returned by all raw information functions.
Definition peak_common_structs.hpp:25