cec: added a callback that is called when libCEC's configuration changed.
[deb_libcec.git] / src / LibCecSharp / CecSharpTypes.h
CommitLineData
4ef3b314
LOK
1#pragma once
2/*
3 * This file is part of the libCEC(R) library.
4 *
5 * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited. All rights reserved.
6 * libCEC(R) is an original work, containing original code.
7 *
8 * libCEC(R) is a trademark of Pulse-Eight Limited.
9 *
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.
14 *
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.
19 *
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.
23 *
24 *
25 * Alternatively, you can license this library under a commercial license,
26 * please contact Pulse-Eight Licensing for more information.
27 *
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/
32 */
33
34#include <windows.h>
35#include <vcclr.h>
36#include <msclr/marshal.h>
37#include "../../include/cec.h"
38
39#using <System.dll>
40
41namespace CecSharp
42{
43 public enum class CecDeviceType
44 {
45 Tv = 0,
46 RecordingDevice = 1,
47 Reserved = 2,
48 Tuner = 3,
49 PlaybackDevice = 4,
50 AudioSystem = 5
51 };
52
53 public enum class CecLogLevel
54 {
55 None = 0,
56 Error = 1,
57 Warning = 2,
58 Notice = 4,
59 Traffic = 8,
60 Debug = 16,
61 All = 31
62 };
63
64 public enum class CecLogicalAddress
65 {
66 Unknown = -1, //not a valid logical address
67 Tv = 0,
68 RecordingDevice1 = 1,
69 RecordingDevice2 = 2,
70 Tuner1 = 3,
71 PlaybackDevice1 = 4,
72 AudioSystem = 5,
73 Tuner2 = 6,
74 Tuner3 = 7,
75 PlaybackDevice2 = 8,
76 RecordingDevice3 = 9,
77 Tuner4 = 10,
78 PlaybackDevice3 = 11,
79 Reserved1 = 12,
80 Reserved2 = 13,
81 FreeUse = 14,
82 Unregistered = 15,
83 Broadcast = 15
84 };
85
86 public enum class CecPowerStatus
87 {
88 On = 0x00,
89 Standby = 0x01,
90 InTransitionStandbyToOn = 0x02,
91 InTransitionOnToStandby = 0x03,
92 Unknown = 0x99
93 };
94
95 public enum class CecVersion
96 {
97 Unknown = 0x00,
98 V1_2 = 0x01,
99 V1_2A = 0x02,
100 V1_3 = 0x03,
101 V1_3A = 0x04,
102 V1_4 = 0x05
103 };
104
105 public enum class CecDisplayControl
106 {
107 DisplayForDefaultTime = 0x00,
108 DisplayUntilCleared = 0x40,
109 ClearPreviousMessage = 0x80,
110 ReservedForFutureUse = 0xC0
111 };
112
113 public enum class CecMenuState
114 {
115 Activated = 0,
116 Deactivated = 1
117 };
118
119 public enum class CecDeckControlMode
120 {
121 SkipForwardWind = 1,
122 SkipReverseRewind = 2,
123 Stop = 3,
124 Eject = 4
125 };
126
127 public enum class CecDeckInfo
128 {
129 Play = 0x11,
130 Record = 0x12,
131 Reverse = 0x13,
132 Still = 0x14,
133 Slow = 0x15,
134 SlowReverse = 0x16,
135 FastForward = 0x17,
136 FastReverse = 0x18,
137 NoMedia = 0x19,
138 Stop = 0x1A,
139 SkipForwardWind = 0x1B,
140 SkipReverseRewind = 0x1C,
141 IndexSearchForward = 0x1D,
142 IndexSearchReverse = 0x1E,
143 OtherStatus = 0x1F
144 };
145
146 public enum class CecUserControlCode
147 {
148 Select = 0x00,
149 Up = 0x01,
150 Down = 0x02,
151 Left = 0x03,
152 Right = 0x04,
153 RightUp = 0x05,
154 RightDown = 0x06,
155 LeftUp = 0x07,
156 LeftDown = 0x08,
157 RootMenu = 0x09,
158 SetupMenu = 0x0A,
159 ContentsMenu = 0x0B,
160 FavoriteMenu = 0x0C,
161 Exit = 0x0D,
162 Number0 = 0x20,
163 Number1 = 0x21,
164 Number2 = 0x22,
165 Number3 = 0x23,
166 Number4 = 0x24,
167 Number5 = 0x25,
168 Number6 = 0x26,
169 Number7 = 0x27,
170 Number8 = 0x28,
171 Number9 = 0x29,
172 Dot = 0x2A,
173 Enter = 0x2B,
174 Clear = 0x2C,
175 NextFavorite = 0x2F,
176 ChannelUp = 0x30,
177 ChannelDown = 0x31,
178 PreviousChannel = 0x32,
179 SoundSelect = 0x33,
180 InputSelect = 0x34,
181 DisplayInformation = 0x35,
182 Help = 0x36,
183 PageUp = 0x37,
184 PageDown = 0x38,
185 Power = 0x40,
186 VolumeUp = 0x41,
187 VolumeDown = 0x42,
188 Mute = 0x43,
189 Play = 0x44,
190 Stop = 0x45,
191 Pause = 0x46,
192 Record = 0x47,
193 Rewind = 0x48,
194 FastForward = 0x49,
195 Eject = 0x4A,
196 Forward = 0x4B,
197 Backward = 0x4C,
198 StopRecord = 0x4D,
199 PauseRecord = 0x4E,
200 Angle = 0x50,
201 SubPicture = 0x51,
202 VideoOnDemand = 0x52,
203 ElectronicProgramGuide = 0x53,
204 TimerProgramming = 0x54,
205 InitialConfiguration = 0x55,
206 PlayFunction = 0x60,
207 PausePlayFunction = 0x61,
208 RecordFunction = 0x62,
209 PauseRecordFunction = 0x63,
210 StopFunction = 0x64,
211 MuteFunction = 0x65,
212 RestoreVolumeFunction = 0x66,
213 TuneFunction = 0x67,
214 SelectMediaFunction = 0x68,
215 SelectAVInputFunction = 0x69,
216 SelectAudioInputFunction = 0x6A,
217 PowerToggleFunction = 0x6B,
218 PowerOffFunction = 0x6C,
219 PowerOnFunction = 0x6D,
220 F1Blue = 0x71,
221 F2Red = 0X72,
222 F3Green = 0x73,
223 F4Yellow = 0x74,
224 F5 = 0x75,
225 Data = 0x76,
226 Max = 0x76,
227 Unknown
228 };
229
230 public enum class CecVendorId
231 {
232 Samsung = 0x00F0,
233 LG = 0xE091,
234 Panasonic = 0x8045,
235 Pioneer = 0xE036,
236 Onkyo = 0x09B0,
237 Yamaha = 0xA0DE,
238 Philips = 0x903E,
239 Unknown = 0
240 };
241
242 public enum class CecAudioStatus
243 {
244 MuteStatusMask = 0x80,
245 VolumeStatusMask = 0x7F,
246 VolumeMin = 0x00,
247 VolumeMax = 0x64,
248 VolumeStatusUnknown = 0x7F
249 };
250
251 public enum class CecOpcode
252 {
253 ActiveSource = 0x82,
254 ImageViewOn = 0x04,
255 TextViewOn = 0x0D,
256 InactiveSource = 0x9D,
257 RequestActiveSource = 0x85,
258 RoutingChange = 0x80,
259 RoutingInformation = 0x81,
260 SetStreamPath = 0x86,
261 Standby = 0x36,
262 RecordOff = 0x0B,
263 RecordOn = 0x09,
264 RecordStatus = 0x0A,
265 RecordTvScreen = 0x0F,
266 ClearAnalogueTimer = 0x33,
267 ClearDigitalTimer = 0x99,
268 ClearExternalTimer = 0xA1,
269 SetAnalogueTimer = 0x34,
270 SetDigitalTimer = 0x97,
271 SetExternalTimer = 0xA2,
272 SetTimerProgramTitle = 0x67,
273 TimerClearedStatus = 0x43,
274 TimerStatus = 0x35,
275 CecVersion = 0x9E,
276 GetCecVersion = 0x9F,
277 GivePhysicalAddress = 0x83,
278 GetMenuLanguage = 0x91,
279 ReportPhysicalAddress = 0x84,
280 SetMenuLanguage = 0x32,
281 DeckControl = 0x42,
282 DeckStatus = 0x1B,
283 GiveDeckStatus = 0x1A,
284 Play = 0x41,
285 GiveTunerDeviceStatus = 0x08,
286 SelectAnalogueService = 0x92,
287 SelectDigtalService = 0x93,
288 TunerDeviceStatus = 0x07,
289 TunerStepDecrement = 0x06,
290 TunerStepIncrement = 0x05,
291 DeviceVendorId = 0x87,
292 GiveDeviceVendorId = 0x8C,
293 VendorCommand = 0x89,
294 VendorCommandWithId = 0xA0,
295 VendorRemoteButtonDown = 0x8A,
296 VendorRemoteButtonUp = 0x8B,
297 SetOsdString = 0x64,
298 GiveOsdName = 0x46,
299 SetOsdName = 0x47,
300 MenuRequest = 0x8D,
301 MenuStatus = 0x8E,
302 UserControlPressed = 0x44,
303 UserControlRelease = 0x45,
304 GiveDevicePowerStatus = 0x8F,
305 ReportPowerStatus = 0x90,
306 FeatureAbort = 0x00,
307 Abort = 0xFF,
308 GiveAudioStatus = 0x71,
309 GiveSystemAudioMode = 0x7D,
310 ReportAudioStatus = 0x7A,
311 SetSystemAudioMode = 0x72,
312 SystemAudioModeRequest = 0x70,
313 SystemAudioModeStatus = 0x7E,
314 SetAudioRate = 0x9A,
315 /* when this opcode is set, no opcode will be sent to the device. this is one of the reserved numbers */
316 None = 0xFD
317 };
318
319 public enum class CecSystemAudioStatus
320 {
321 Off = 0,
322 On = 1
323 };
324
325 public enum class CecClientVersion
326 {
327 VersionPre1_5 = 0,
32403cc3 328 Version1_5_0 = 0x1500
4ef3b314
LOK
329 };
330
331 public ref class CecAdapter
332 {
333 public:
334 CecAdapter(System::String ^ strPath, System::String ^ strComPort)
335 {
336 Path = strPath;
337 ComPort = strComPort;
338 }
339
340 property System::String ^ Path;
341 property System::String ^ ComPort;
342 };
343
344 public ref class CecDeviceTypeList
345 {
346 public:
347 CecDeviceTypeList(void)
348 {
349 Types = gcnew array<CecDeviceType>(5);
350 for (unsigned int iPtr = 0; iPtr < 5; iPtr++)
351 Types[iPtr] = CecDeviceType::Reserved;
352 }
353
354 property array<CecDeviceType> ^ Types;
355 };
356
357 public ref class CecLogicalAddresses
358 {
359 public:
360 CecLogicalAddresses(void)
361 {
362 Addresses = gcnew array<CecLogicalAddress>(16);
363 for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
364 Addresses[iPtr] = CecLogicalAddress::Unregistered;
365 }
366
367 bool IsSet(CecLogicalAddress iAddress)
368 {
369 return Addresses[(unsigned int)iAddress] != CecLogicalAddress::Unregistered;
370 }
371
a9fb46b4 372 property CecLogicalAddress Primary;
4ef3b314
LOK
373 property array<CecLogicalAddress> ^ Addresses;
374 };
375
376 public ref class CecDatapacket
377 {
378 public:
379 CecDatapacket(void)
380 {
381 Data = gcnew array<uint8_t>(100);
382 Size = 0;
383 }
384
385 void PushBack(uint8_t data)
386 {
387 if (Size < 100)
388 {
389 Data[Size] = data;
390 Size++;
391 }
392 }
393
394 property array<uint8_t> ^ Data;
395 property uint8_t Size;
396 };
397
398 public ref class CecCommand
399 {
400 public:
401 CecCommand(CecLogicalAddress iInitiator, CecLogicalAddress iDestination, bool bAck, bool bEom, CecOpcode iOpcode, int32_t iTransmitTimeout)
402 {
403 Initiator = iInitiator;
404 Destination = iDestination;
405 Ack = bAck;
406 Eom = bEom;
407 Opcode = iOpcode;
408 OpcodeSet = true;
409 TransmitTimeout = iTransmitTimeout;
410 Parameters = gcnew CecDatapacket;
411 Empty = false;
412 }
413
414 CecCommand(void)
415 {
416 Initiator = CecLogicalAddress::Unknown;
417 Destination = CecLogicalAddress::Unknown;
418 Ack = false;
419 Eom = false;
420 Opcode = CecOpcode::None;
421 OpcodeSet = false;
422 TransmitTimeout = 0;
423 Parameters = gcnew CecDatapacket;
424 Empty = true;
425 }
426
427 void PushBack(uint8_t data)
428 {
429 if (Initiator == CecLogicalAddress::Unknown && Destination == CecLogicalAddress::Unknown)
430 {
431 Initiator = (CecLogicalAddress) (data >> 4);
432 Destination = (CecLogicalAddress) (data & 0xF);
433 }
434 else if (!OpcodeSet)
435 {
436 OpcodeSet = true;
437 Opcode = (CecOpcode)data;
438 }
439 else
440 {
441 Parameters->PushBack(data);
442 }
443 }
444
445 property bool Empty;
446 property CecLogicalAddress Initiator;
447 property CecLogicalAddress Destination;
448 property bool Ack;
449 property bool Eom;
450 property CecOpcode Opcode;
451 property CecDatapacket ^ Parameters;
452 property bool OpcodeSet;
453 property int32_t TransmitTimeout;
454 };
455
456 public ref class CecKeypress
457 {
458 public:
459 CecKeypress(int iKeycode, unsigned int iDuration)
460 {
461 Keycode = iKeycode;
462 Duration = iDuration;
463 Empty = false;
464 }
465
466 CecKeypress(void)
467 {
468 Keycode = 0;
469 Duration = 0;
470 Empty = true;
471 }
472
473 property bool Empty;
474 property int Keycode;
475 property unsigned int Duration;
476 };
477
478 public ref class CecLogMessage
479 {
480 public:
481 CecLogMessage(System::String ^ strMessage, CecLogLevel iLevel, int64_t iTime)
482 {
483 Message = strMessage;
484 Level = iLevel;
485 Time = iTime;
486 Empty = false;
487 }
488
489 CecLogMessage(void)
490 {
491 Message = "";
492 Level = CecLogLevel::None;
493 Time = 0;
494 Empty = true;
495 }
496
497 property bool Empty;
498 property System::String ^Message;
499 property CecLogLevel Level;
500 property int64_t Time;
501 };
502
32403cc3
LOK
503 ref class CecCallbackMethods; //forward
504 public ref class LibCECConfiguration
505 {
506 public:
507 LibCECConfiguration(void)
508 {
509 DeviceName = "";
510 DeviceTypes = gcnew CecDeviceTypeList();
511 PhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS;
512 BaseDevice = (CecLogicalAddress)CEC_DEFAULT_BASE_DEVICE;
513 HDMIPort = CEC_DEFAULT_HDMI_PORT;
514 ClientVersion = CecClientVersion::VersionPre1_5;
515
516 GetSettingsFromROM = false;
517 UseTVMenuLanguage = CEC_DEFAULT_SETTING_USE_TV_MENU_LANGUAGE == 1;
518 PowerOnStartup = CEC_DEFAULT_SETTING_POWER_ON_STARTUP == 1;
519 PowerOffShutdown = CEC_DEFAULT_SETTING_POWER_OFF_SHUTDOWN == 1;
520 PowerOffScreensaver = CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER == 1;
521 PowerOffOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY == 1;
522 }
523
524 void SetCallbacks(CecCallbackMethods ^callbacks)
525 {
526 Callbacks = callbacks;
527 }
528
529 property System::String ^ DeviceName;
530 property CecDeviceTypeList ^ DeviceTypes;
531 property uint16_t PhysicalAddress;
532 property CecLogicalAddress BaseDevice;
533 property uint8_t HDMIPort;
534 property CecClientVersion ClientVersion;
535
536 // player specific settings
537 property bool GetSettingsFromROM;
538 property bool UseTVMenuLanguage;
539 property bool PowerOnStartup;
540 property bool PowerOffShutdown;
541 property bool PowerOffScreensaver;
542 property bool PowerOffOnStandby;
543
544 property CecCallbackMethods ^Callbacks;
545 };
546
4ef3b314
LOK
547 // the callback methods are called by unmanaged code, so we need some delegates for this
548 #pragma unmanaged
549 // unmanaged callback methods
550 typedef int (__stdcall *LOGCB) (const CEC::cec_log_message &message);
551 typedef int (__stdcall *KEYCB) (const CEC::cec_keypress &key);
552 typedef int (__stdcall *COMMANDCB)(const CEC::cec_command &command);
32403cc3 553 typedef int (__stdcall *CONFIGCB) (const CEC::libcec_configuration &config);
4ef3b314
LOK
554
555 static LOGCB g_logCB;
556 static KEYCB g_keyCB;
557 static COMMANDCB g_commandCB;
32403cc3 558 static CONFIGCB g_configCB;
4ef3b314
LOK
559 static CEC::ICECCallbacks g_cecCallbacks;
560
561 int CecLogMessageCB(void *cbParam, const CEC::cec_log_message &message)
562 {
563 if (g_logCB)
564 return g_logCB(message);
565 return 0;
566 }
567
568 int CecKeyPressCB(void *cbParam, const CEC::cec_keypress &key)
569 {
570 if (g_keyCB)
571 return g_keyCB(key);
572 return 0;
573 }
574
575 int CecCommandCB(void *cbParam, const CEC::cec_command &command)
576 {
577 if (g_commandCB)
578 return g_commandCB(command);
579 return 0;
580 }
581
32403cc3
LOK
582 int CecConfigCB(void *cbParam, const CEC::libcec_configuration &config)
583 {
584 if (g_configCB)
585 return g_configCB(config);
586 return 0;
587 }
588
4ef3b314
LOK
589 #pragma managed
590 // delegates for the unmanaged callback methods
591 public delegate int CecLogMessageManagedDelegate(const CEC::cec_log_message &);
592 public delegate int CecKeyPressManagedDelegate(const CEC::cec_keypress &);
593 public delegate int CecCommandManagedDelegate(const CEC::cec_command &);
32403cc3 594 public delegate int CecConfigManagedDelegate(const CEC::libcec_configuration &);
4ef3b314
LOK
595
596 // callback method interface
597 public ref class CecCallbackMethods
598 {
599 public:
600 CecCallbackMethods(void)
601 {
602 m_bHasCallbacks = false;
603 msclr::interop::marshal_context ^ context = gcnew msclr::interop::marshal_context();
604
605 // create the delegate method for the log message callback
606 m_logMessageDelegate = gcnew CecLogMessageManagedDelegate(this, &CecCallbackMethods::CecLogMessageManaged);
607 m_logMessageGCHandle = System::Runtime::InteropServices::GCHandle::Alloc(m_logMessageDelegate);
608 g_logCB = static_cast<LOGCB>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_logMessageDelegate).ToPointer());
609 g_cecCallbacks.CBCecLogMessage = CecLogMessageCB;
610
611 // create the delegate method for the keypress callback
612 m_keypressDelegate = gcnew CecKeyPressManagedDelegate(this, &CecCallbackMethods::CecKeyPressManaged);
613 m_keypressGCHandle = System::Runtime::InteropServices::GCHandle::Alloc(m_keypressDelegate);
614 g_keyCB = static_cast<KEYCB>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_keypressDelegate).ToPointer());
615 g_cecCallbacks.CBCecKeyPress = CecKeyPressCB;
616
617 // create the delegate method for the command callback
618 m_commandDelegate = gcnew CecCommandManagedDelegate(this, &CecCallbackMethods::CecCommandManaged);
619 m_commandGCHandle = System::Runtime::InteropServices::GCHandle::Alloc(m_commandDelegate);
620 g_commandCB = static_cast<COMMANDCB>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_commandDelegate).ToPointer());
621 g_cecCallbacks.CBCecCommand = CecCommandCB;
622
32403cc3
LOK
623 // create the delegate method for the configuration change callback
624 m_configDelegate = gcnew CecConfigManagedDelegate(this, &CecCallbackMethods::CecConfigManaged);
625 m_configGCHandle = System::Runtime::InteropServices::GCHandle::Alloc(m_configDelegate);
626 g_configCB = static_cast<CONFIGCB>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_configDelegate).ToPointer());
627 g_cecCallbacks.CBCecConfigurationChanged = CecConfigCB;
628
4ef3b314
LOK
629 delete context;
630 }
631
632 ~CecCallbackMethods(void)
633 {
634 DestroyDelegates();
635 }
636
637 protected:
638 !CecCallbackMethods(void)
639 {
640 DestroyDelegates();
641 }
642
643 public:
644 virtual bool EnableCallbacks(CecCallbackMethods ^ callbacks)
645 {
646 if (!m_bHasCallbacks)
647 {
648 m_bHasCallbacks = true;
649 m_callbacks = callbacks;
650 return true;
651 }
652
653 return false;
654 }
655
656 virtual int ReceiveLogMessage(CecLogMessage ^ message)
657 {
658 return 0;
659 }
660
661 virtual int ReceiveKeypress(CecKeypress ^ key)
662 {
663 return 0;
664 }
665
666 virtual int ReceiveCommand(CecCommand ^ command)
667 {
668 return 0;
669 }
670
32403cc3
LOK
671 virtual int ConfigurationChanged(LibCECConfiguration ^ config)
672 {
673 return 0;
674 }
4ef3b314
LOK
675 protected:
676 // managed callback methods
677 int CecLogMessageManaged(const CEC::cec_log_message &message)
678 {
679 int iReturn(0);
680 if (m_bHasCallbacks)
681 iReturn = m_callbacks->ReceiveLogMessage(gcnew CecLogMessage(gcnew System::String(message.message), (CecLogLevel)message.level, message.time));
682 return iReturn;
683 }
684
685 int CecKeyPressManaged(const CEC::cec_keypress &key)
686 {
687 int iReturn(0);
688 if (m_bHasCallbacks)
689 iReturn = m_callbacks->ReceiveKeypress(gcnew CecKeypress(key.keycode, key.duration));
690 return iReturn;
691 }
692
693 int CecCommandManaged(const CEC::cec_command &command)
694 {
695 int iReturn(0);
696 if (m_bHasCallbacks)
697 {
698 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);
699 for (uint8_t iPtr = 0; iPtr < command.parameters.size; iPtr++)
700 newCommand->Parameters->PushBack(command.parameters[iPtr]);
701 iReturn = m_callbacks->ReceiveCommand(newCommand);
702 }
703 return iReturn;
704 }
705
32403cc3
LOK
706 int CecConfigManaged(const CEC::libcec_configuration &config)
707 {
708 int iReturn(0);
709 if (m_bHasCallbacks)
710 {
711 LibCECConfiguration ^netConfig = gcnew LibCECConfiguration();
712 netConfig->DeviceName = gcnew System::String(config.strDeviceName);
713 for (unsigned int iPtr = 0; iPtr < 5; iPtr++)
714 netConfig->DeviceTypes->Types[iPtr] = (CecDeviceType)config.deviceTypes.types[iPtr];
715
716 netConfig->PhysicalAddress = config.iPhysicalAddress;
717 netConfig->BaseDevice = (CecLogicalAddress)config.baseDevice;
718 netConfig->HDMIPort = config.iHDMIPort;
719 netConfig->ClientVersion = (CecClientVersion)config.clientVersion;
720 netConfig->GetSettingsFromROM = config.bGetSettingsFromROM == 1;
721 netConfig->PowerOnStartup = config.bPowerOnStartup == 1;
722 netConfig->PowerOffShutdown = config.bPowerOffShutdown == 1;
723 netConfig->PowerOffScreensaver = config.bPowerOffScreensaver == 1;
724 netConfig->PowerOffOnStandby = config.bPowerOffOnStandby == 1;
725
726 iReturn = m_callbacks->ConfigurationChanged(netConfig);
727 }
728 return iReturn;
729 }
730
4ef3b314
LOK
731 void DestroyDelegates()
732 {
006b76b9
LOK
733 if (m_bHasCallbacks)
734 {
735 m_bHasCallbacks = false;
736 delete m_callbacks;
737 m_logMessageGCHandle.Free();
738 m_keypressGCHandle.Free();
739 m_commandGCHandle.Free();
740 }
4ef3b314
LOK
741 }
742
743 CecLogMessageManagedDelegate ^ m_logMessageDelegate;
744 static System::Runtime::InteropServices::GCHandle m_logMessageGCHandle;
745 LOGCB m_logMessageCallback;
746
747 CecKeyPressManagedDelegate ^ m_keypressDelegate;
748 static System::Runtime::InteropServices::GCHandle m_keypressGCHandle;
749 KEYCB m_keypressCallback;
750
751 CecCommandManagedDelegate ^ m_commandDelegate;
752 static System::Runtime::InteropServices::GCHandle m_commandGCHandle;
753 COMMANDCB m_commandCallback;
754
32403cc3
LOK
755 CecConfigManagedDelegate ^ m_configDelegate;
756 static System::Runtime::InteropServices::GCHandle m_configGCHandle;
757 CONFIGCB m_configCallback;
758
4ef3b314
LOK
759 CecCallbackMethods ^ m_callbacks;
760 bool m_bHasCallbacks;
761 };
4ef3b314 762}