X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2FLibCecSharp%2FCecSharpTypes.h;h=a7316f8babdad2755d8216c5185832a17b8c144d;hb=5ee37222777c8f0712ffa75ceff7a4102583b432;hp=d9fcc9d2a0fcc7cde1c312b685a2c6f071596ce7;hpb=1bfdc9bd15dc0056dedac3e9425edd4b2d25a96a;p=deb_libcec.git diff --git a/src/LibCecSharp/CecSharpTypes.h b/src/LibCecSharp/CecSharpTypes.h index d9fcc9d..a7316f8 100644 --- a/src/LibCecSharp/CecSharpTypes.h +++ b/src/LibCecSharp/CecSharpTypes.h @@ -685,12 +685,20 @@ namespace CecSharp return 0; } + int CecAlertCB(void *cbParam, const CEC::libcec_alert alert, const libcec_parameter &data) + { + if (g_alertCB) + return g_alertCB(alert, data); + return 0; + } + #pragma managed // delegates for the unmanaged callback methods public delegate int CecLogMessageManagedDelegate(const CEC::cec_log_message &); public delegate int CecKeyPressManagedDelegate(const CEC::cec_keypress &); public delegate int CecCommandManagedDelegate(const CEC::cec_command &); public delegate int CecConfigManagedDelegate(const CEC::libcec_configuration &); + public delegate int CecAlertManagedDelegate(const CEC::libcec_alert, const CEC::libcec_parameter &); // callback method interface public ref class CecCallbackMethods @@ -838,6 +846,12 @@ namespace CecSharp g_configCB = static_cast(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_configDelegate).ToPointer()); g_cecCallbacks.CBCecConfigurationChanged = CecConfigCB; + // create the delegate method for the alert callback + m_alertDelegate = gcnew CecAlertManagedDelegate(this, &CecCallbackMethods::CecAlertManaged); + m_alertGCHandle = System::Runtime::InteropServices::GCHandle::Alloc(m_alertDelegate); + g_alertCB = static_cast(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_alertDelegate).ToPointer()); + g_cecCallbacks.CBCecAlert = CecAlertCB; + delete context; m_bDelegatesCreated = true; } @@ -859,6 +873,10 @@ namespace CecSharp static System::Runtime::InteropServices::GCHandle m_configGCHandle; CONFIGCB m_configCallback; + CecAlertManagedDelegate ^ m_alertDelegate; + static System::Runtime::InteropServices::GCHandle m_alertGCHandle; + CONFIGCB m_alertCallback; + CecCallbackMethods ^ m_callbacks; bool m_bHasCallbacks; bool m_bDelegatesCreated;