File ManagedDeviceEventHandler.h¶
File List > SpinnakerNET > ManagedDeviceEventHandler.h
Go to the documentation of this file
//=============================================================================
// Copyright (c) 2026 FLIR Integrated Imaging Solutions, Inc. All Rights Reserved.
//
// This software is the confidential and proprietary information of FLIR
// Integrated Imaging Solutions, Inc. ("Confidential Information"). You
// shall not disclose such Confidential Information and shall use it only in
// accordance with the terms of the license agreement you entered into
// with FLIR Integrated Imaging Solutions, Inc. (FLIR)
//
// FLIR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
// SOFTWARE, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE, OR NON-INFRINGEMENT. FLIR SHALL NOT BE LIABLE FOR ANY DAMAGES
// SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
// THIS SOFTWARE OR ITS DERIVATIVES.
//=============================================================================
#ifndef FLIR_SPINNAKER_MANAGED_DEVICE_EVENT_HANDLER_H
#define FLIR_SPINNAKER_MANAGED_DEVICE_EVENT_HANDLER_H
#include "ManagedEventHandler.h"
#include "DeviceEventHandler.h"
#include <vcclr.h>
#include "MarshalString.h"
using namespace ::System;
namespace SpinnakerNET
{
// forward declaration
ref class ManagedDeviceEventHandler;
// Intermediate delegate and function pointer for DeviceEventHandler
delegate void OnDeviceEventDelegate(Spinnaker::GenICam::gcstring eventName);
typedef void(__stdcall *OnDeviceEventNative)(Spinnaker::GenICam::gcstring eventName);
#pragma warning(push)
#pragma warning(disable : 4996)
// We declare an intermediate class which inherits from DeviceEventHandler (unmanaged abstract class).
// We provide definitions for the virtual functions. These functions are the callbacks that
// will be called from the unmanaged library. These functions call into the managed abstract
// class.
class DeviceEventRedirector : public Spinnaker::DeviceEventHandler
{
public:
DeviceEventRedirector(OnDeviceEventDelegate^ eventDelegate)
{
m_OnDeviceEventDelegate = eventDelegate;
m_OnDeviceEventNative = (OnDeviceEventNative)Marshal::GetFunctionPointerForDelegate(m_OnDeviceEventDelegate).ToPointer();
}
protected:
virtual void OnDeviceEvent(Spinnaker::GenICam::gcstring eventName);
private:
gcroot<OnDeviceEventDelegate^> m_OnDeviceEventDelegate;
OnDeviceEventNative m_OnDeviceEventNative;
};
#pragma warning(pop)
[Obsolete("Use Node::Updated() event instead.")]
public ref class ManagedDeviceEventHandler abstract : public ManagedEventHandler
{
public:
ManagedDeviceEventHandler();
~ManagedDeviceEventHandler();
!ManagedDeviceEventHandler();
const uint8_t* GetDeviceEventPayloadData();
UInt64 GetDeviceEventID();
String^ GetDeviceEventName();
protected:
// Empty body so user can override only the one's they need
virtual void OnDeviceEvent(String^ /*eventName*/) {};
internal:
void CallOnDeviceEvent(Spinnaker::GenICam::gcstring eventName);
};
}
#endif // FLIR_SPINNAKER_MANAGED_DEVICE_EVENT_HANDLER_H