IDS peak genericC++ v1.16.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
49 , public std::enable_shared_from_this<Interface>
50{
51public:
53 using DeviceFoundCallback = std::function<void(const std::shared_ptr<DeviceDescriptor>& foundDevice)>;
57 using DeviceDisconnectedCallback = std::function<void(const std::shared_ptr<DeviceDescriptor>& disconnectedDevice)>;
61 using DeviceReconnectedCallback = std::function<void(
62 const std::shared_ptr<DeviceDescriptor>& reconnectedDevice, DeviceReconnectInformation reconnectInformation)>;
66 using DeviceLostCallback = std::function<void(const std::string& lostDeviceId)>;
70 using DeviceListChangedCallback = std::function<void()>;
73
74 Interface() = delete;
75 ~Interface() override;
76 Interface(const Interface& other) = delete;
77 Interface& operator=(const Interface& other) = delete;
78 Interface(Interface&& other) = delete;
79 Interface& operator=(Interface&& other) = delete;
80
82 std::string Key() const;
83
85 RawInformation Info(int32_t infoCommand) const;
87 std::string ID() const;
89 std::string DisplayName() const;
91 std::string TLType() const;
92
107 void UpdateDevices(Timeout timeout_ms);
108
118 std::vector<std::shared_ptr<DeviceDescriptor>> Devices() const;
119
121 std::shared_ptr<System> ParentSystem() const;
122
138
151
167
180
198
211
228
241
258
271
272private:
273 struct DeviceFoundCallbackContainer
274 {
275 std::weak_ptr<Interface> _Interface;
277 };
278 struct DeviceDisconnectedCallbackContainer
279 {
280 std::weak_ptr<Interface> _Interface;
282 };
283 struct DeviceReconnectedCallbackContainer
284 {
285 std::weak_ptr<Interface> _Interface;
287 };
288 static void PEAK_CALL_CONV DeviceFoundCallbackCWrapper(
289 PEAK_DEVICE_DESCRIPTOR_HANDLE foundDevice, void* context);
290 static void PEAK_CALL_CONV DeviceLostCallbackCWrapper(
291 const char* lostDeviceId, size_t lostDeviceIdSize, void* context);
292 static void PEAK_CALL_CONV DeviceDisconnectedCallbackCWrapper(
293 PEAK_DEVICE_DESCRIPTOR_HANDLE foundDevice, void* context);
294 static void PEAK_CALL_CONV DeviceReconnectedCallbackCWrapper(PEAK_DEVICE_DESCRIPTOR_HANDLE reconnectedDevice,
295 PEAK_DEVICE_RECONNECT_INFORMATION reconnectInformation, void* context);
296 static void PEAK_CALL_CONV DeviceListChangedCallbackCWrapper(void* context);
297
298 std::shared_ptr<DeviceDescriptor> GetOrAddFoundDevice(PEAK_DEVICE_DESCRIPTOR_HANDLE foundDevice);
299
300 PEAK_MODULE_HANDLE ModuleHandle() const override;
302
303 void InitializeUpdateMechanismIfNecessary();
304
305 friend ClassCreator<Interface>;
306 Interface(PEAK_INTERFACE_HANDLE interfaceHandle, const std::weak_ptr<System>& parentSystem);
307 PEAK_INTERFACE_HANDLE m_backendHandle;
308
309 std::weak_ptr<System> m_parentSystem;
310
311 std::unique_ptr<TCallbackManager<PEAK_DEVICE_FOUND_CALLBACK_HANDLE, DeviceFoundCallbackContainer>>
312 m_deviceFoundCallbackManager;
313 std::unique_ptr<TCallbackManager<PEAK_DEVICE_LOST_CALLBACK_HANDLE, DeviceLostCallback>>
314 m_deviceLostCallbackManager;
315
316 std::unique_ptr<TCallbackManager<PEAK_DEVICE_DISCONNECTED_CALLBACK_HANDLE, DeviceDisconnectedCallbackContainer>>
317 m_deviceDisconnectedCallbackManager;
318 std::unique_ptr<TCallbackManager<PEAK_DEVICE_RECONNECTED_CALLBACK_HANDLE, DeviceReconnectedCallbackContainer>>
319 m_deviceReconnectedCallbackManager;
320
321 std::unique_ptr<TCallbackManager<PEAK_DEVICE_LIST_CHANGED_CALLBACK_HANDLE, DeviceListChangedCallback>>
322 m_deviceListChangedCallbackManager;
323
324 std::vector<std::shared_ptr<DeviceDescriptor>> m_devices;
325 std::unordered_map<std::string, std::shared_ptr<DeviceDescriptor>> m_devicesByKey;
326 std::unordered_map<std::string, std::string> m_devicesKeyById;
327 mutable std::mutex m_devicesMutex;
328 std::once_flag m_updateMechanismInitializedFlag;
329
330 std::string m_key;
331};
332
333} /* namespace core */
334} /* namespace peak */
335
336/* Implementation */
337namespace peak
338{
339namespace core
340{
341
342inline Interface::Interface(PEAK_INTERFACE_HANDLE interfaceHandle, const std::weak_ptr<System>& parentSystem)
343 : m_backendHandle(interfaceHandle)
344 , m_parentSystem(parentSystem)
345 , m_key(QueryStringFromCInterfaceFunction([&](char* key, size_t* keySize) {
346 return PEAK_C_ABI_PREFIX PEAK_Interface_GetKey(interfaceHandle, key, keySize);
347 }))
348{
349 m_deviceFoundCallbackManager =
350 std::make_unique<TCallbackManager<PEAK_DEVICE_FOUND_CALLBACK_HANDLE, DeviceFoundCallbackContainer>>(
351 [&](void* callbackContext) {
352 return QueryNumericFromCInterfaceFunction<PEAK_DEVICE_FOUND_CALLBACK_HANDLE>(
353 [&](PEAK_DEVICE_FOUND_CALLBACK_HANDLE* deviceFoundCallbackHandle) {
355 m_backendHandle, DeviceFoundCallbackCWrapper, callbackContext, deviceFoundCallbackHandle);
356 });
357 },
358 [&](PEAK_DEVICE_FOUND_CALLBACK_HANDLE callbackHandle) {
359 CallAndCheckCInterfaceFunction([&] {
361 m_backendHandle, callbackHandle);
362 });
363 });
364
365 m_deviceLostCallbackManager =
366 std::make_unique<TCallbackManager<PEAK_DEVICE_LOST_CALLBACK_HANDLE, DeviceLostCallback>>(
367 [&](void* callbackContext) {
368 return QueryNumericFromCInterfaceFunction<PEAK_DEVICE_LOST_CALLBACK_HANDLE>(
369 [&](PEAK_DEVICE_LOST_CALLBACK_HANDLE* deviceLostCallbackHandle) {
371 m_backendHandle, DeviceLostCallbackCWrapper, callbackContext, deviceLostCallbackHandle);
372 });
373 },
374 [&](PEAK_DEVICE_LOST_CALLBACK_HANDLE callbackHandle) {
375 CallAndCheckCInterfaceFunction([&] {
377 m_backendHandle, callbackHandle);
378 });
379 });
380
381 m_deviceDisconnectedCallbackManager = std::make_unique<
382 TCallbackManager<PEAK_DEVICE_DISCONNECTED_CALLBACK_HANDLE, DeviceDisconnectedCallbackContainer>>(
383 [&](void* callbackContext) {
384 return QueryNumericFromCInterfaceFunction<PEAK_DEVICE_DISCONNECTED_CALLBACK_HANDLE>(
385 [&](PEAK_DEVICE_DISCONNECTED_CALLBACK_HANDLE* deviceDisconnectedCallbackHandle) {
387 DeviceDisconnectedCallbackCWrapper, callbackContext, deviceDisconnectedCallbackHandle);
388 });
389 },
390 [&](PEAK_DEVICE_DISCONNECTED_CALLBACK_HANDLE callbackHandle) {
391 CallAndCheckCInterfaceFunction([&] {
393 m_backendHandle, callbackHandle);
394 });
395 });
396
397 m_deviceReconnectedCallbackManager = std::make_unique<
398 TCallbackManager<PEAK_DEVICE_RECONNECTED_CALLBACK_HANDLE, DeviceReconnectedCallbackContainer>>(
399 [&](void* callbackContext) {
400 return QueryNumericFromCInterfaceFunction<PEAK_DEVICE_RECONNECTED_CALLBACK_HANDLE>(
401 [&](PEAK_DEVICE_RECONNECTED_CALLBACK_HANDLE* deviceReconnectedCallbackHandle) {
403 DeviceReconnectedCallbackCWrapper, callbackContext, deviceReconnectedCallbackHandle);
404 });
405 },
406 [&](PEAK_DEVICE_RECONNECTED_CALLBACK_HANDLE callbackHandle) {
407 CallAndCheckCInterfaceFunction([&] {
409 m_backendHandle, callbackHandle);
410 });
411 });
412
413 m_deviceListChangedCallbackManager =
414 std::make_unique<TCallbackManager<PEAK_DEVICE_LIST_CHANGED_CALLBACK_HANDLE, DeviceListChangedCallback>>(
415 [&](void* callbackContext) {
416 return QueryNumericFromCInterfaceFunction<PEAK_DEVICE_LIST_CHANGED_CALLBACK_HANDLE>(
417 [&](PEAK_DEVICE_LIST_CHANGED_CALLBACK_HANDLE* deviceListChangedCallbackHandle) {
419 DeviceListChangedCallbackCWrapper, callbackContext, deviceListChangedCallbackHandle);
420 });
421 },
422 [&](PEAK_DEVICE_LIST_CHANGED_CALLBACK_HANDLE callbackHandle) {
423 CallAndCheckCInterfaceFunction([&] {
425 m_backendHandle, callbackHandle);
426 });
427 });
428}
429
431{
432 try
433 {
434 m_deviceFoundCallbackManager->UnregisterAllCallbacks();
435 m_deviceLostCallbackManager->UnregisterAllCallbacks();
436
437 m_deviceDisconnectedCallbackManager->UnregisterAllCallbacks();
438 m_deviceReconnectedCallbackManager->UnregisterAllCallbacks();
439
440 m_deviceListChangedCallbackManager->UnregisterAllCallbacks();
441 }
442 catch (const Exception&)
443 {}
444
445 (void)PEAK_C_ABI_PREFIX PEAK_Interface_Destruct(m_backendHandle);
446}
447
448inline std::string Interface::Key() const
449{
450 return m_key;
451}
452
453inline RawInformation Interface::Info(int32_t infoCommand) const
454{
455 return QueryRawInformationFromCInterfaceFunction([&](int32_t* dataType, uint8_t* buffer, size_t* bufferSize) {
457 m_backendHandle, infoCommand, dataType, buffer, bufferSize);
458 });
459}
460
461inline std::string Interface::ID() const
462{
463 return QueryStringFromCInterfaceFunction([&](char* id, size_t* idSize) {
464 return PEAK_C_ABI_PREFIX PEAK_Interface_GetID(m_backendHandle, id, idSize);
465 });
466}
467
468inline std::string Interface::DisplayName() const
469{
470 return QueryStringFromCInterfaceFunction([&](char* displayName, size_t* displayNameSize) {
471 return PEAK_C_ABI_PREFIX PEAK_Interface_GetDisplayName(m_backendHandle, displayName, displayNameSize);
472 });
473}
474
475inline std::string Interface::TLType() const
476{
477 return QueryStringFromCInterfaceFunction([&](char* tlType, size_t* tlTypeSize) {
478 return PEAK_C_ABI_PREFIX PEAK_Interface_GetTLType(m_backendHandle, tlType, tlTypeSize);
479 });
480}
481
482inline void Interface::UpdateDevices(Timeout timeout_ms)
483{
484 InitializeUpdateMechanismIfNecessary();
485
486 CallAndCheckCInterfaceFunction(
487 [&] { return PEAK_C_ABI_PREFIX PEAK_Interface_UpdateDevices(m_backendHandle, timeout_ms); });
488}
489
490inline std::vector<std::shared_ptr<DeviceDescriptor>> Interface::Devices() const
491{
492 std::lock_guard<std::mutex> lock(m_devicesMutex);
493 return m_devices;
494}
495
496inline std::shared_ptr<System> Interface::ParentSystem() const
497{
498 return LockOrThrow(m_parentSystem);
499}
500
502 const Interface::DeviceFoundCallback& callback)
503{
504 return reinterpret_cast<DeviceFoundCallbackHandle>(
505 m_deviceFoundCallbackManager->RegisterCallback(DeviceFoundCallbackContainer{ shared_from_this(), callback }));
506}
507
509{
510 m_deviceFoundCallbackManager->UnregisterCallback(
511 reinterpret_cast<PEAK_DEVICE_FOUND_CALLBACK_HANDLE>(callbackHandle));
512}
513
515 const DeviceReconnectedCallback& callback)
516{
517 return reinterpret_cast<DeviceReconnectedCallbackHandle>(m_deviceReconnectedCallbackManager->RegisterCallback(
518 DeviceReconnectedCallbackContainer{ shared_from_this(), callback }));
519}
520
522{
523 m_deviceReconnectedCallbackManager->UnregisterCallback(
524 reinterpret_cast<PEAK_DEVICE_RECONNECTED_CALLBACK_HANDLE>(callbackHandle));
525}
526
528 const DeviceDisconnectedCallback& callback)
529{
530 return reinterpret_cast<DeviceDisconnectedCallbackHandle>(m_deviceDisconnectedCallbackManager->RegisterCallback(
531 DeviceDisconnectedCallbackContainer{ shared_from_this(), callback }));
532}
533
535{
536 m_deviceDisconnectedCallbackManager->UnregisterCallback(
537 reinterpret_cast<PEAK_DEVICE_DISCONNECTED_CALLBACK_HANDLE>(callbackHandle));
538}
539
541 const Interface::DeviceLostCallback& callback)
542{
543 return reinterpret_cast<DeviceLostCallbackHandle>(m_deviceLostCallbackManager->RegisterCallback(callback));
544}
545
547{
548 m_deviceLostCallbackManager->UnregisterCallback(
549 reinterpret_cast<PEAK_DEVICE_LOST_CALLBACK_HANDLE>(callbackHandle));
550}
551
554{
555 return reinterpret_cast<DeviceListChangedCallbackHandle>(m_deviceListChangedCallbackManager->RegisterCallback(callback));
556}
557
559{
560 m_deviceListChangedCallbackManager->UnregisterCallback(
561 reinterpret_cast<PEAK_DEVICE_LIST_CHANGED_CALLBACK_HANDLE>(callbackHandle));
562}
563
564inline void PEAK_CALL_CONV Interface::DeviceFoundCallbackCWrapper(
565 PEAK_DEVICE_DESCRIPTOR_HANDLE foundDevice, void* context)
566{
567 auto callbackContainer = static_cast<DeviceFoundCallbackContainer*>(context);
568
569 auto interfaceDescriptor = callbackContainer->_Interface.lock()->GetOrAddFoundDevice(foundDevice);
570
571 callbackContainer->Callback(interfaceDescriptor);
572}
573
574inline void PEAK_CALL_CONV Interface::DeviceLostCallbackCWrapper(
575 const char* lostDeviceId, size_t lostDeviceIdSize, void* context)
576{
577 auto callback = static_cast<Interface::DeviceLostCallback*>(context);
578
579 callback->operator()(std::string(lostDeviceId, lostDeviceIdSize - 1));
580}
581
582inline void PEAK_CALL_CONV Interface::DeviceDisconnectedCallbackCWrapper(
583 PEAK_DEVICE_DESCRIPTOR_HANDLE foundDevice, void* context)
584{
585 auto callbackContainer = static_cast<DeviceDisconnectedCallbackContainer*>(context);
586
587 auto deviceDescriptor = callbackContainer->_Interface.lock()->GetOrAddFoundDevice(foundDevice);
588
589 callbackContainer->Callback(deviceDescriptor);
590}
591
592inline void PEAK_CALL_CONV Interface::DeviceReconnectedCallbackCWrapper(PEAK_DEVICE_DESCRIPTOR_HANDLE foundDevice,
593 PEAK_DEVICE_RECONNECT_INFORMATION reconnectInformation, void* context)
594{
595 auto callbackContainer = static_cast<DeviceReconnectedCallbackContainer*>(context);
596
597 auto deviceDescriptor = callbackContainer->_Interface.lock()->GetOrAddFoundDevice(foundDevice);
598
599 callbackContainer->Callback(deviceDescriptor, DeviceReconnectInformation(std::move(reconnectInformation)));
600}
601
602inline void PEAK_CALL_CONV Interface::DeviceListChangedCallbackCWrapper(void* context)
603{
604 auto callback = static_cast<Interface::DeviceListChangedCallback*>(context);
605 callback->operator()();
606}
607
608inline std::shared_ptr<DeviceDescriptor> Interface::GetOrAddFoundDevice(PEAK_DEVICE_DESCRIPTOR_HANDLE foundDevice)
609{
610 std::lock_guard<std::mutex> lock(m_devicesMutex);
611
612 const auto deviceKey = QueryStringFromCInterfaceFunction([&](char* key, size_t* keySize) {
613 return PEAK_C_ABI_PREFIX PEAK_DeviceDescriptor_GetKey(foundDevice, key, keySize);
614 });
615 auto keyDevicePairIterator = m_devicesByKey.find(deviceKey);
616 if (keyDevicePairIterator == m_devicesByKey.end())
617 {
618 auto deviceDescriptor = std::static_pointer_cast<DeviceDescriptor>(
619 std::make_shared<ClassCreator<DeviceDescriptor>>(
620 foundDevice, std::weak_ptr<Interface>{ shared_from_this() }));
621 m_devices.emplace_back(deviceDescriptor);
622 m_devicesByKey.emplace(deviceKey, deviceDescriptor);
623 m_devicesKeyById.emplace(deviceDescriptor->ID(), deviceKey);
624
625 return deviceDescriptor;
626 }
627
628 return keyDevicePairIterator->second;
629}
630
632{
633 auto moduleHandle = QueryNumericFromCInterfaceFunction<PEAK_MODULE_HANDLE>(
634 [&](PEAK_MODULE_HANDLE* _moduleHandle) {
635 return PEAK_C_ABI_PREFIX PEAK_Interface_ToModule(m_backendHandle, _moduleHandle);
636 });
637
638 return moduleHandle;
639}
640
642{
643 auto eventSupportingModuleHandle = QueryNumericFromCInterfaceFunction<PEAK_EVENT_SUPPORTING_MODULE_HANDLE>(
644 [&](PEAK_EVENT_SUPPORTING_MODULE_HANDLE* _eventSupportingModuleHandle) {
646 m_backendHandle, _eventSupportingModuleHandle);
647 });
648
649 return eventSupportingModuleHandle;
650}
651
652inline void Interface::InitializeUpdateMechanismIfNecessary()
653{
654 std::call_once(m_updateMechanismInitializedFlag, [&] {
655 (void)RegisterDeviceFoundCallback([](const std::shared_ptr<DeviceDescriptor>&) {
656 // Registering an empty callback is enough since DeviceFoundCallbackCWrapper() handles everything else.
657 });
658
659 (void)RegisterDeviceLostCallback([&](const std::string& lostDeviceId) {
660 {
661 std::lock_guard<std::mutex> lock(m_devicesMutex);
662 const auto lostDeviceKey = m_devicesKeyById.at(lostDeviceId);
663 m_devices.erase(std::remove_if(std::begin(m_devices), std::end(m_devices),
664 [lostDeviceKey](const std::shared_ptr<DeviceDescriptor>& device) {
665 return device->Key() == lostDeviceKey;
666 }),
667 std::end(m_devices));
668 m_devicesByKey.erase(lostDeviceKey);
669 m_devicesKeyById.erase(lostDeviceId);
670 }
671 });
672 });
673}
674
675} /* namespace core */
676} /* namespace peak */
Definition reconnect_information.hpp:17
virtual PEAK_EVENT_SUPPORTING_MODULE_HANDLE EventSupportingModuleHandle() const =0
The base class for all exceptions thrown by the library.
Definition peak_exception.hpp:28
std::function< void()> DeviceListChangedCallback
Definition peak_interface.hpp:70
~Interface() override
Definition peak_interface.hpp:430
std::shared_ptr< System > ParentSystem() const
Returns the parent system.
Definition peak_interface.hpp:496
std::string TLType() const
Returns the TL (transport layer) type.
Definition peak_interface.hpp:475
RawInformation Info(int32_t infoCommand) const
Delivers information based on the given GenTL info command.
Definition peak_interface.hpp:453
Interface(Interface &&other)=delete
Interface(const Interface &other)=delete
Interface & operator=(const Interface &other)=delete
DeviceReconnectedCallback * DeviceReconnectedCallbackHandle
Definition peak_interface.hpp:64
void UpdateDevices(Timeout timeout_ms)
Searches for devices.
Definition peak_interface.hpp:482
void UnregisterDeviceReconnectedCallback(DeviceReconnectedCallbackHandle callbackHandle)
Unregisters a device reconnected callback.
Definition peak_interface.hpp:521
void UnregisterDeviceListChangedCallback(DeviceListChangedCallbackHandle callbackHandle)
Unregisters a device list changed callback.
Definition peak_interface.hpp:558
DeviceDisconnectedCallbackHandle RegisterDeviceDisconnectedCallback(const DeviceDisconnectedCallback &callback)
Registers a callback for signaling a disconnected device.
Definition peak_interface.hpp:527
DeviceReconnectedCallbackHandle RegisterDeviceReconnectedCallback(const DeviceReconnectedCallback &callback)
Registers a callback for signaling a reconnected device.
Definition peak_interface.hpp:514
std::string ID() const
Returns the ID.
Definition peak_interface.hpp:461
DeviceListChangedCallbackHandle RegisterDeviceListChangedCallback(const DeviceListChangedCallback &callback)
Registers a callback for signaling a device list changed.
Definition peak_interface.hpp:552
std::function< void( const std::shared_ptr< DeviceDescriptor > &reconnectedDevice, DeviceReconnectInformation reconnectInformation)> DeviceReconnectedCallback
Definition peak_interface.hpp:61
void UnregisterDeviceDisconnectedCallback(DeviceDisconnectedCallbackHandle callbackHandle)
Unregisters a device disconnected callback.
Definition peak_interface.hpp:534
std::function< void(const std::shared_ptr< DeviceDescriptor > &foundDevice)> DeviceFoundCallback
Definition peak_interface.hpp:53
DeviceListChangedCallback * DeviceListChangedCallbackHandle
Definition peak_interface.hpp:72
std::vector< std::shared_ptr< DeviceDescriptor > > Devices() const
Returns the device list.
Definition peak_interface.hpp:490
std::string DisplayName() const
Returns the display name.
Definition peak_interface.hpp:468
DeviceLostCallbackHandle RegisterDeviceLostCallback(const DeviceLostCallback &callback)
Registers a callback for signaling a lost device.
Definition peak_interface.hpp:540
DeviceLostCallback * DeviceLostCallbackHandle
Definition peak_interface.hpp:68
Interface & operator=(Interface &&other)=delete
DeviceFoundCallback * DeviceFoundCallbackHandle
Definition peak_interface.hpp:55
void UnregisterDeviceFoundCallback(DeviceFoundCallbackHandle callbackHandle)
Unregisters a device found callback.
Definition peak_interface.hpp:508
void UnregisterDeviceLostCallback(DeviceLostCallbackHandle callbackHandle)
Unregisters a device lost callback.
Definition peak_interface.hpp:546
DeviceFoundCallbackHandle RegisterDeviceFoundCallback(const DeviceFoundCallback &callback)
Registers a callback for signaling a found device.
Definition peak_interface.hpp:501
std::string Key() const
Returns the unique key.
Definition peak_interface.hpp:448
DeviceDisconnectedCallback * DeviceDisconnectedCallbackHandle
Definition peak_interface.hpp:59
std::function< void(const std::string &lostDeviceId)> DeviceLostCallback
Definition peak_interface.hpp:66
std::function< void(const std::shared_ptr< DeviceDescriptor > &disconnectedDevice)> DeviceDisconnectedCallback
Definition peak_interface.hpp:57
virtual PEAK_MODULE_HANDLE ModuleHandle() const =0
Represents a GenTL System module.
Definition peak_system.hpp:52
Represents a timeout value in milliseconds.
Definition peak_timeout.hpp:32
The "core" namespace contains the direct GenAPI and GenTL wrapper.
Definition peak_buffer.hpp:34
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition peak_dynamic_loader.h:35
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