X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2FLibCecSharp%2FLibCecSharp.cpp;h=caf60542859622a1576a42c342dc85f9eed197b4;hb=11fea069b79880253a450a74a53b31356598d57a;hp=d6154c36cfe09ddb733b9d37bd08bd0dca4cc0aa;hpb=a42ad439ecc9eccae64404ae8124d17308ce2c96;p=deb_libcec.git diff --git a/src/LibCecSharp/LibCecSharp.cpp b/src/LibCecSharp/LibCecSharp.cpp index d6154c3..caf6054 100644 --- a/src/LibCecSharp/LibCecSharp.cpp +++ b/src/LibCecSharp/LibCecSharp.cpp @@ -45,13 +45,15 @@ namespace CecSharp public: LibCecSharp(LibCECConfiguration ^config) { - CecCallbackMethods::EnableCallbacks(config->Callbacks); + m_callbacks = config->Callbacks; + CecCallbackMethods::EnableCallbacks(m_callbacks); if (!InitialiseLibCec(config)) throw gcnew Exception("Could not initialise LibCecSharp"); } LibCecSharp(String ^ strDeviceName, CecDeviceTypeList ^ deviceTypes) { + m_callbacks = gcnew CecCallbackMethods(); LibCECConfiguration ^config = gcnew LibCECConfiguration(); config->SetCallbacks(this); config->DeviceName = strDeviceName; @@ -139,6 +141,8 @@ namespace CecSharp bool Open(String ^ strPort, int iTimeoutMs) { + CecCallbackMethods::EnableCallbacks(m_callbacks); + EnableCallbacks(m_callbacks); marshal_context ^ context = gcnew marshal_context(); const char* strPortC = context->marshal_as(strPort); bool bReturn = m_libCec->Open(strPortC, iTimeoutMs); @@ -550,5 +554,6 @@ namespace CecSharp private: ICECAdapter * m_libCec; + CecCallbackMethods ^ m_callbacks; }; }