3 * This file is part of the libCEC(R) library.
5 * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited. All rights reserved.
6 * libCEC(R) is an original work, containing original code.
8 * libCEC(R) is a trademark of Pulse-Eight Limited.
10 * This program is dual-licensed; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 * Alternatively, you can license this library under a commercial license,
26 * please contact Pulse-Eight Licensing for more information.
28 * For more information contact:
29 * Pulse-Eight Licensing <license@pulse-eight.com>
30 * http://www.pulse-eight.com/
31 * http://www.pulse-eight.net/
36 #include <msclr/marshal.h>
37 #include "../../include/cec.h"
43 public enum class CecDeviceType
53 public enum class CecLogLevel
64 public enum class CecLogicalAddress
66 Unknown
= -1, //not a valid logical address
86 public enum class CecAlert
91 public enum class CecParameterType
93 ParameterTypeString
= 1
96 public ref
class CecParameter
99 CecParameter(CecParameterType type
, System::String
^ strData
)
105 property CecParameterType Type
;
106 property
System::String
^ Data
;
109 public enum class CecPowerStatus
113 InTransitionStandbyToOn
= 0x02,
114 InTransitionOnToStandby
= 0x03,
118 public enum class CecVersion
128 public enum class CecDisplayControl
130 DisplayForDefaultTime
= 0x00,
131 DisplayUntilCleared
= 0x40,
132 ClearPreviousMessage
= 0x80,
133 ReservedForFutureUse
= 0xC0
136 public enum class CecMenuState
142 public enum class CecDeckControlMode
145 SkipReverseRewind
= 2,
150 public enum class CecDeckInfo
162 SkipForwardWind
= 0x1B,
163 SkipReverseRewind
= 0x1C,
164 IndexSearchForward
= 0x1D,
165 IndexSearchReverse
= 0x1E,
169 public enum class CecUserControlCode
201 PreviousChannel
= 0x32,
204 DisplayInformation
= 0x35,
225 VideoOnDemand
= 0x52,
226 ElectronicProgramGuide
= 0x53,
227 TimerProgramming
= 0x54,
228 InitialConfiguration
= 0x55,
230 PausePlayFunction
= 0x61,
231 RecordFunction
= 0x62,
232 PauseRecordFunction
= 0x63,
235 RestoreVolumeFunction
= 0x66,
237 SelectMediaFunction
= 0x68,
238 SelectAVInputFunction
= 0x69,
239 SelectAudioInputFunction
= 0x6A,
240 PowerToggleFunction
= 0x6B,
241 PowerOffFunction
= 0x6C,
242 PowerOnFunction
= 0x6D,
253 public enum class CecVendorId
266 public enum class CecAudioStatus
268 MuteStatusMask
= 0x80,
269 VolumeStatusMask
= 0x7F,
272 VolumeStatusUnknown
= 0x7F
275 public enum class CecOpcode
280 InactiveSource
= 0x9D,
281 RequestActiveSource
= 0x85,
282 RoutingChange
= 0x80,
283 RoutingInformation
= 0x81,
284 SetStreamPath
= 0x86,
289 RecordTvScreen
= 0x0F,
290 ClearAnalogueTimer
= 0x33,
291 ClearDigitalTimer
= 0x99,
292 ClearExternalTimer
= 0xA1,
293 SetAnalogueTimer
= 0x34,
294 SetDigitalTimer
= 0x97,
295 SetExternalTimer
= 0xA2,
296 SetTimerProgramTitle
= 0x67,
297 TimerClearedStatus
= 0x43,
300 GetCecVersion
= 0x9F,
301 GivePhysicalAddress
= 0x83,
302 GetMenuLanguage
= 0x91,
303 ReportPhysicalAddress
= 0x84,
304 SetMenuLanguage
= 0x32,
307 GiveDeckStatus
= 0x1A,
309 GiveTunerDeviceStatus
= 0x08,
310 SelectAnalogueService
= 0x92,
311 SelectDigtalService
= 0x93,
312 TunerDeviceStatus
= 0x07,
313 TunerStepDecrement
= 0x06,
314 TunerStepIncrement
= 0x05,
315 DeviceVendorId
= 0x87,
316 GiveDeviceVendorId
= 0x8C,
317 VendorCommand
= 0x89,
318 VendorCommandWithId
= 0xA0,
319 VendorRemoteButtonDown
= 0x8A,
320 VendorRemoteButtonUp
= 0x8B,
326 UserControlPressed
= 0x44,
327 UserControlRelease
= 0x45,
328 GiveDevicePowerStatus
= 0x8F,
329 ReportPowerStatus
= 0x90,
332 GiveAudioStatus
= 0x71,
333 GiveSystemAudioMode
= 0x7D,
334 ReportAudioStatus
= 0x7A,
335 SetSystemAudioMode
= 0x72,
336 SystemAudioModeRequest
= 0x70,
337 SystemAudioModeStatus
= 0x7E,
339 /* when this opcode is set, no opcode will be sent to the device. this is one of the reserved numbers */
343 public enum class CecSystemAudioStatus
349 public enum class CecClientVersion
352 Version1_5_0
= 0x1500,
353 Version1_5_1
= 0x1501,
354 Version1_5_2
= 0x1502,
355 Version1_5_3
= 0x1503,
356 Version1_6_0
= 0x1600,
357 Version1_6_1
= 0x1601,
358 Version1_6_2
= 0x1602,
359 Version1_6_3
= 0x1603
362 public enum class CecServerVersion
365 Version1_5_0
= 0x1500,
366 Version1_5_1
= 0x1501,
367 Version1_5_2
= 0x1502,
368 Version1_5_3
= 0x1503,
369 Version1_6_0
= 0x1600,
370 Version1_6_1
= 0x1601,
371 Version1_6_2
= 0x1602,
372 Version1_6_3
= 0x1603
375 public ref
class CecAdapter
378 CecAdapter(System::String
^ strPath
, System::String
^ strComPort
)
381 ComPort
= strComPort
;
384 property
System::String
^ Path
;
385 property
System::String
^ ComPort
;
388 public ref
class CecDeviceTypeList
391 CecDeviceTypeList(void)
393 Types
= gcnew array
<CecDeviceType
>(5);
394 for (unsigned int iPtr
= 0; iPtr
< 5; iPtr
++)
395 Types
[iPtr
] = CecDeviceType::Reserved
;
398 property array
<CecDeviceType
> ^ Types
;
401 public ref
class CecLogicalAddresses
404 CecLogicalAddresses(void)
406 Addresses
= gcnew array
<CecLogicalAddress
>(16);
412 for (unsigned int iPtr
= 0; iPtr
< 16; iPtr
++)
413 Addresses
[iPtr
] = CecLogicalAddress::Unknown
;
416 bool IsSet(CecLogicalAddress iAddress
)
418 return Addresses
[(unsigned int)iAddress
] != CecLogicalAddress::Unknown
;
421 void Set(CecLogicalAddress iAddress
)
423 Addresses
[(unsigned int)iAddress
] = iAddress
;
426 property CecLogicalAddress Primary
;
427 property array
<CecLogicalAddress
> ^ Addresses
;
430 public ref
class CecDatapacket
435 Data
= gcnew array
<uint8_t>(100);
439 void PushBack(uint8_t data
)
448 property array
<uint8_t> ^ Data
;
449 property
uint8_t Size
;
452 public ref
class CecCommand
455 CecCommand(CecLogicalAddress iInitiator
, CecLogicalAddress iDestination
, bool bAck
, bool bEom
, CecOpcode iOpcode
, int32_t iTransmitTimeout
)
457 Initiator
= iInitiator
;
458 Destination
= iDestination
;
463 TransmitTimeout
= iTransmitTimeout
;
464 Parameters
= gcnew CecDatapacket
;
470 Initiator
= CecLogicalAddress::Unknown
;
471 Destination
= CecLogicalAddress::Unknown
;
474 Opcode
= CecOpcode::None
;
477 Parameters
= gcnew CecDatapacket
;
481 void PushBack(uint8_t data
)
483 if (Initiator
== CecLogicalAddress::Unknown
&& Destination
== CecLogicalAddress::Unknown
)
485 Initiator
= (CecLogicalAddress
) (data
>> 4);
486 Destination
= (CecLogicalAddress
) (data
& 0xF);
491 Opcode
= (CecOpcode
)data
;
495 Parameters
->PushBack(data
);
500 property CecLogicalAddress Initiator
;
501 property CecLogicalAddress Destination
;
504 property CecOpcode Opcode
;
505 property CecDatapacket
^ Parameters
;
506 property
bool OpcodeSet
;
507 property
int32_t TransmitTimeout
;
510 public ref
class CecKeypress
513 CecKeypress(int iKeycode
, unsigned int iDuration
)
516 Duration
= iDuration
;
528 property
int Keycode
;
529 property
unsigned int Duration
;
532 public ref
class CecLogMessage
535 CecLogMessage(System::String
^ strMessage
, CecLogLevel iLevel
, int64_t iTime
)
537 Message
= strMessage
;
546 Level
= CecLogLevel::None
;
552 property
System::String
^Message
;
553 property CecLogLevel Level
;
554 property
int64_t Time
;
557 ref
class CecCallbackMethods
; //forward
558 public ref
class LibCECConfiguration
561 LibCECConfiguration(void)
564 DeviceTypes
= gcnew
CecDeviceTypeList();
565 AutodetectAddress
= true;
566 PhysicalAddress
= CEC_DEFAULT_PHYSICAL_ADDRESS
;
567 BaseDevice
= (CecLogicalAddress
)CEC_DEFAULT_BASE_DEVICE
;
568 HDMIPort
= CEC_DEFAULT_HDMI_PORT
;
569 ClientVersion
= CecClientVersion::VersionPre1_5
;
570 ServerVersion
= CecServerVersion::VersionPre1_5
;
571 TvVendor
= CecVendorId::Unknown
;
573 GetSettingsFromROM
= false;
574 UseTVMenuLanguage
= CEC_DEFAULT_SETTING_USE_TV_MENU_LANGUAGE
== 1;
575 ActivateSource
= CEC_DEFAULT_SETTING_ACTIVATE_SOURCE
== 1;
577 WakeDevices
= gcnew
CecLogicalAddresses();
578 if (CEC_DEFAULT_SETTING_ACTIVATE_SOURCE
== 1)
579 WakeDevices
->Set(CecLogicalAddress::Tv
);
581 PowerOffDevices
= gcnew
CecLogicalAddresses();
582 if (CEC_DEFAULT_SETTING_POWER_OFF_SHUTDOWN
== 1)
583 PowerOffDevices
->Set(CecLogicalAddress::Broadcast
);
585 PowerOffScreensaver
= CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER
== 1;
586 PowerOffOnStandby
= CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY
== 1;
588 SendInactiveSource
= CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE
== 1;
589 LogicalAddresses
= gcnew
CecLogicalAddresses();
591 PowerOffDevicesOnStandby
= CEC_DEFAULT_SETTING_POWER_OFF_DEVICES_STANDBY
== 1;
592 ShutdownOnStandby
= CEC_DEFAULT_SETTING_SHUTDOWN_ON_STANDBY
== 1;
596 void SetCallbacks(CecCallbackMethods
^callbacks
)
598 Callbacks
= callbacks
;
601 void Update(const CEC::libcec_configuration
&config
)
603 DeviceName
= gcnew
System::String(config
.strDeviceName
);
605 for (unsigned int iPtr
= 0; iPtr
< 5; iPtr
++)
606 DeviceTypes
->Types
[iPtr
] = (CecDeviceType
)config
.deviceTypes
.types
[iPtr
];
608 AutodetectAddress
= config
.bAutodetectAddress
== 1;
609 PhysicalAddress
= config
.iPhysicalAddress
;
610 BaseDevice
= (CecLogicalAddress
)config
.baseDevice
;
611 HDMIPort
= config
.iHDMIPort
;
612 ClientVersion
= (CecClientVersion
)config
.clientVersion
;
613 ServerVersion
= (CecServerVersion
)config
.serverVersion
;
614 TvVendor
= (CecVendorId
)config
.tvVendor
;
616 // player specific settings
617 GetSettingsFromROM
= config
.bGetSettingsFromROM
== 1;
618 UseTVMenuLanguage
= config
.bUseTVMenuLanguage
== 1;
619 ActivateSource
= config
.bActivateSource
== 1;
621 WakeDevices
->Clear();
622 for (uint8_t iPtr
= 0; iPtr
<= 16; iPtr
++)
623 if (config
.wakeDevices
[iPtr
])
624 WakeDevices
->Set((CecLogicalAddress
)iPtr
);
626 PowerOffDevices
->Clear();
627 for (uint8_t iPtr
= 0; iPtr
<= 16; iPtr
++)
628 if (config
.powerOffDevices
[iPtr
])
629 PowerOffDevices
->Set((CecLogicalAddress
)iPtr
);
631 PowerOffScreensaver
= config
.bPowerOffScreensaver
== 1;
632 PowerOffOnStandby
= config
.bPowerOffOnStandby
== 1;
634 if (ServerVersion
>= CecServerVersion::Version1_5_1
)
635 SendInactiveSource
= config
.bSendInactiveSource
== 1;
637 if (ServerVersion
>= CecServerVersion::Version1_5_3
)
639 LogicalAddresses
->Clear();
640 for (uint8_t iPtr
= 0; iPtr
<= 16; iPtr
++)
641 if (config
.logicalAddresses
[iPtr
])
642 LogicalAddresses
->Set((CecLogicalAddress
)iPtr
);
645 if (ServerVersion
>= CecServerVersion::Version1_6_0
)
647 FirmwareVersion
= config
.iFirmwareVersion
;
648 PowerOffDevicesOnStandby
= config
.bPowerOffDevicesOnStandby
== 1;
649 ShutdownOnStandby
= config
.bShutdownOnStandby
== 1;
652 if (ServerVersion
>= CecServerVersion::Version1_6_2
)
653 DeviceLanguage
= gcnew
System::String(config
.strDeviceLanguage
);
655 if (ServerVersion
>= CecServerVersion::Version1_6_3
)
656 MonitorOnlyClient
= config
.bMonitorOnly
== 1;
659 property
System::String
^ DeviceName
;
660 property CecDeviceTypeList
^ DeviceTypes
;
661 property
bool AutodetectAddress
;
662 property
uint16_t PhysicalAddress
;
663 property CecLogicalAddress BaseDevice
;
664 property
uint8_t HDMIPort
;
665 property CecClientVersion ClientVersion
;
666 property CecServerVersion ServerVersion
;
667 property CecVendorId TvVendor
;
669 // player specific settings
670 property
bool GetSettingsFromROM
;
671 property
bool UseTVMenuLanguage
;
672 property
bool ActivateSource
;
673 property CecLogicalAddresses
^WakeDevices
;
674 property CecLogicalAddresses
^PowerOffDevices
;
675 property
bool PowerOffScreensaver
;
676 property
bool PowerOffOnStandby
;
677 property
bool SendInactiveSource
;
678 property CecLogicalAddresses
^LogicalAddresses
;
679 property
uint16_t FirmwareVersion
;
680 property
bool PowerOffDevicesOnStandby
;
681 property
bool ShutdownOnStandby
;
682 property
bool MonitorOnlyClient
;
683 property
System::String
^ DeviceLanguage
;
684 property CecCallbackMethods
^ Callbacks
;
687 // the callback methods are called by unmanaged code, so we need some delegates for this
689 // unmanaged callback methods
690 typedef int (__stdcall
*LOGCB
) (const CEC::cec_log_message
&message
);
691 typedef int (__stdcall
*KEYCB
) (const CEC::cec_keypress
&key
);
692 typedef int (__stdcall
*COMMANDCB
)(const CEC::cec_command
&command
);
693 typedef int (__stdcall
*CONFIGCB
) (const CEC::libcec_configuration
&config
);
694 typedef int (__stdcall
*ALERTCB
) (const CEC::libcec_alert
, const CEC::libcec_parameter
&data
);
695 typedef int (__stdcall
*MENUCB
) (const CEC::cec_menu_state newVal
);
697 static LOGCB g_logCB
;
698 static KEYCB g_keyCB
;
699 static COMMANDCB g_commandCB
;
700 static CONFIGCB g_configCB
;
701 static ALERTCB g_alertCB
;
702 static MENUCB g_menuCB
;
703 static CEC::ICECCallbacks g_cecCallbacks
;
705 int CecLogMessageCB(void *cbParam
, const CEC::cec_log_message
&message
)
708 return g_logCB(message
);
712 int CecKeyPressCB(void *cbParam
, const CEC::cec_keypress
&key
)
719 int CecCommandCB(void *cbParam
, const CEC::cec_command
&command
)
722 return g_commandCB(command
);
726 int CecConfigCB(void *cbParam
, const CEC::libcec_configuration
&config
)
729 return g_configCB(config
);
733 int CecAlertCB(void *cbParam
, const CEC::libcec_alert alert
, const CEC::libcec_parameter
&data
)
736 return g_alertCB(alert
, data
);
740 int CecMenuCB(void *cbParam
, const CEC::cec_menu_state newVal
)
743 return g_menuCB(newVal
);
748 // delegates for the unmanaged callback methods
749 public delegate
int CecLogMessageManagedDelegate(const CEC::cec_log_message
&);
750 public delegate
int CecKeyPressManagedDelegate(const CEC::cec_keypress
&);
751 public delegate
int CecCommandManagedDelegate(const CEC::cec_command
&);
752 public delegate
int CecConfigManagedDelegate(const CEC::libcec_configuration
&);
753 public delegate
int CecAlertManagedDelegate(const CEC::libcec_alert
, const CEC::libcec_parameter
&);
754 public delegate
int CecMenuManagedDelegate(const CEC::cec_menu_state newVal
);
756 // callback method interface
757 public ref
class CecCallbackMethods
760 CecCallbackMethods(void)
762 m_bHasCallbacks
= false;
763 m_bDelegatesCreated
= false;
766 ~CecCallbackMethods(void)
772 !CecCallbackMethods(void)
778 virtual void DisableCallbacks(void)
783 virtual bool EnableCallbacks(CecCallbackMethods
^ callbacks
)
786 if (!m_bHasCallbacks
)
788 m_bHasCallbacks
= true;
789 m_callbacks
= callbacks
;
796 virtual int ReceiveLogMessage(CecLogMessage
^ message
)
801 virtual int ReceiveKeypress(CecKeypress
^ key
)
806 virtual int ReceiveCommand(CecCommand
^ command
)
811 virtual int ConfigurationChanged(LibCECConfiguration
^ config
)
816 virtual int ReceiveAlert(CecAlert alert
, CecParameter
^ data
)
821 virtual int ReceiveMenuStateChange(CecMenuState newVal
)
827 // managed callback methods
828 int CecLogMessageManaged(const CEC::cec_log_message
&message
)
832 iReturn
= m_callbacks
->ReceiveLogMessage(gcnew
CecLogMessage(gcnew
System::String(message
.message
), (CecLogLevel
)message
.level
, message
.time
));
836 int CecKeyPressManaged(const CEC::cec_keypress
&key
)
840 iReturn
= m_callbacks
->ReceiveKeypress(gcnew
CecKeypress(key
.keycode
, key
.duration
));
844 int CecCommandManaged(const CEC::cec_command
&command
)
849 CecCommand
^ newCommand
= gcnew
CecCommand((CecLogicalAddress
)command
.initiator
, (CecLogicalAddress
)command
.destination
, command
.ack
== 1 ? true : false, command
.eom
== 1 ? true : false, (CecOpcode
)command
.opcode
, command
.transmit_timeout
);
850 for (uint8_t iPtr
= 0; iPtr
< command
.parameters
.size
; iPtr
++)
851 newCommand
->Parameters
->PushBack(command
.parameters
[iPtr
]);
852 iReturn
= m_callbacks
->ReceiveCommand(newCommand
);
857 int CecConfigManaged(const CEC::libcec_configuration
&config
)
862 LibCECConfiguration
^netConfig
= gcnew
LibCECConfiguration();
863 netConfig
->Update(config
);
864 iReturn
= m_callbacks
->ConfigurationChanged(netConfig
);
869 int CecAlertManaged(const CEC::libcec_alert alert
, const CEC::libcec_parameter
&data
)
874 CecParameterType newType
= (CecParameterType
)data
.paramType
;
875 if (newType
== CecParameterType::ParameterTypeString
)
877 System::String
^ newData
= gcnew
System::String((const char *)data
.paramData
, 0, 128);
878 CecParameter
^ newParam
= gcnew
CecParameter(newType
, newData
);
879 iReturn
= m_callbacks
->ReceiveAlert((CecAlert
)alert
, newParam
);
885 int CecMenuManaged(const CEC::cec_menu_state newVal
)
890 iReturn
= m_callbacks
->ReceiveMenuStateChange((CecMenuState
)newVal
);
895 void DestroyDelegates()
897 m_bHasCallbacks
= false;
898 if (m_bDelegatesCreated
)
900 m_bDelegatesCreated
= false;
901 m_logMessageGCHandle
.Free();
902 m_keypressGCHandle
.Free();
903 m_commandGCHandle
.Free();
904 m_alertGCHandle
.Free();
905 m_menuGCHandle
.Free();
909 void CreateDelegates()
913 if (!m_bDelegatesCreated
)
915 msclr::interop::marshal_context
^ context
= gcnew
msclr::interop::marshal_context();
917 // create the delegate method for the log message callback
918 m_logMessageDelegate
= gcnew
CecLogMessageManagedDelegate(this, &CecCallbackMethods::CecLogMessageManaged
);
919 m_logMessageGCHandle
= System::Runtime::InteropServices::GCHandle::Alloc(m_logMessageDelegate
);
920 g_logCB
= static_cast<LOGCB
>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_logMessageDelegate
).ToPointer());
921 g_cecCallbacks
.CBCecLogMessage
= CecLogMessageCB
;
923 // create the delegate method for the keypress callback
924 m_keypressDelegate
= gcnew
CecKeyPressManagedDelegate(this, &CecCallbackMethods::CecKeyPressManaged
);
925 m_keypressGCHandle
= System::Runtime::InteropServices::GCHandle::Alloc(m_keypressDelegate
);
926 g_keyCB
= static_cast<KEYCB
>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_keypressDelegate
).ToPointer());
927 g_cecCallbacks
.CBCecKeyPress
= CecKeyPressCB
;
929 // create the delegate method for the command callback
930 m_commandDelegate
= gcnew
CecCommandManagedDelegate(this, &CecCallbackMethods::CecCommandManaged
);
931 m_commandGCHandle
= System::Runtime::InteropServices::GCHandle::Alloc(m_commandDelegate
);
932 g_commandCB
= static_cast<COMMANDCB
>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_commandDelegate
).ToPointer());
933 g_cecCallbacks
.CBCecCommand
= CecCommandCB
;
935 // create the delegate method for the configuration change callback
936 m_configDelegate
= gcnew
CecConfigManagedDelegate(this, &CecCallbackMethods::CecConfigManaged
);
937 m_configGCHandle
= System::Runtime::InteropServices::GCHandle::Alloc(m_configDelegate
);
938 g_configCB
= static_cast<CONFIGCB
>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_configDelegate
).ToPointer());
939 g_cecCallbacks
.CBCecConfigurationChanged
= CecConfigCB
;
941 // create the delegate method for the alert callback
942 m_alertDelegate
= gcnew
CecAlertManagedDelegate(this, &CecCallbackMethods::CecAlertManaged
);
943 m_alertGCHandle
= System::Runtime::InteropServices::GCHandle::Alloc(m_alertDelegate
);
944 g_alertCB
= static_cast<ALERTCB
>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_alertDelegate
).ToPointer());
945 g_cecCallbacks
.CBCecAlert
= CecAlertCB
;
947 // create the delegate method for the menu callback
948 m_menuDelegate
= gcnew
CecMenuManagedDelegate(this, &CecCallbackMethods::CecMenuManaged
);
949 m_menuGCHandle
= System::Runtime::InteropServices::GCHandle::Alloc(m_menuDelegate
);
950 g_menuCB
= static_cast<MENUCB
>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_menuDelegate
).ToPointer());
951 g_cecCallbacks
.CBCecMenuStateChanged
= CecMenuCB
;
954 m_bDelegatesCreated
= true;
958 CecLogMessageManagedDelegate
^ m_logMessageDelegate
;
959 static System::Runtime::InteropServices::GCHandle m_logMessageGCHandle
;
960 LOGCB m_logMessageCallback
;
962 CecKeyPressManagedDelegate
^ m_keypressDelegate
;
963 static System::Runtime::InteropServices::GCHandle m_keypressGCHandle
;
964 KEYCB m_keypressCallback
;
966 CecCommandManagedDelegate
^ m_commandDelegate
;
967 static System::Runtime::InteropServices::GCHandle m_commandGCHandle
;
968 COMMANDCB m_commandCallback
;
970 CecConfigManagedDelegate
^ m_configDelegate
;
971 static System::Runtime::InteropServices::GCHandle m_configGCHandle
;
972 CONFIGCB m_configCallback
;
974 CecAlertManagedDelegate
^ m_alertDelegate
;
975 static System::Runtime::InteropServices::GCHandle m_alertGCHandle
;
976 CONFIGCB m_alertCallback
;
978 CecMenuManagedDelegate
^ m_menuDelegate
;
979 static System::Runtime::InteropServices::GCHandle m_menuGCHandle
;
980 MENUCB m_menuCallback
;
982 CecCallbackMethods
^ m_callbacks
;
983 bool m_bHasCallbacks
;
984 bool m_bDelegatesCreated
;