bump to v2.1.3
[deb_libcec.git] / src / LibCecSharp / CecSharpTypes.h
CommitLineData
4ef3b314
LOK
1#pragma once
2/*
f9717bcc
LOK
3* This file is part of the libCEC(R) library.
4*
16f47961 5* libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved.
f9717bcc
LOK
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*/
4ef3b314 33
dc6366e8 34#include "../lib/platform/threads/mutex.h"
4ef3b314
LOK
35#include <vcclr.h>
36#include <msclr/marshal.h>
37#include "../../include/cec.h"
dc6366e8 38#include <vector>
4ef3b314
LOK
39
40#using <System.dll>
41
1c7cd8f8
LOK
42/// <summary>
43/// LibCecSharp namespace
44/// </summary>
45/// <see cref="LibCecSharp" />
4ef3b314
LOK
46namespace CecSharp
47{
8438c41f
LOK
48 /// <summary>
49 /// The device type. For client applications, libCEC only supports RecordingDevice, PlaybackDevice or Tuner.
50 /// libCEC uses RecordingDevice by default.
51 /// </summary>
f9717bcc
LOK
52 public enum class CecDeviceType
53 {
8438c41f
LOK
54 /// <summary>
55 /// Television
56 /// </summary>
f9717bcc 57 Tv = 0,
8438c41f
LOK
58 /// <summary>
59 /// Recording device
60 /// </summary>
f9717bcc 61 RecordingDevice = 1,
8438c41f
LOK
62 /// <summary>
63 /// Reserved / do not use
64 /// </summary>
f9717bcc 65 Reserved = 2,
8438c41f
LOK
66 /// <summary>
67 /// Tuner
68 /// </summary>
f9717bcc 69 Tuner = 3,
8438c41f
LOK
70 /// <summary>
71 /// Playback device
72 /// </summary>
f9717bcc 73 PlaybackDevice = 4,
8438c41f
LOK
74 /// <summary>
75 /// Audio system / AVR
76 /// </summary>
f9717bcc
LOK
77 AudioSystem = 5
78 };
79
8438c41f
LOK
80 /// <summary>
81 /// Log level that can be used by the logging callback method to filter messages from libCEC.
82 /// </summary>
f9717bcc
LOK
83 public enum class CecLogLevel
84 {
8438c41f
LOK
85 /// <summary>
86 /// No logging
87 /// </summary>
f9717bcc 88 None = 0,
8438c41f
LOK
89 /// <summary>
90 /// libCEC encountered a serious problem, and couldn't complete an action.
91 /// </summary>
f9717bcc 92 Error = 1,
8438c41f
LOK
93 /// <summary>
94 /// libCEC warns that it encountered a problem, but recovered.
95 /// </summary>
f9717bcc 96 Warning = 2,
8438c41f
LOK
97 /// <summary>
98 /// libCEC informs the client about a CEC state change.
99 /// </summary>
f9717bcc 100 Notice = 4,
8438c41f
LOK
101 /// <summary>
102 /// Raw CEC data traffic
103 /// </summary>
f9717bcc 104 Traffic = 8,
8438c41f
LOK
105 /// <summary>
106 /// Debugging messages
107 /// </summary>
f9717bcc 108 Debug = 16,
8438c41f
LOK
109 /// <summary>
110 /// Display all messages
111 /// </summary>
f9717bcc
LOK
112 All = 31
113 };
114
8438c41f
LOK
115 /// <summary>
116 /// A logical address on the CEC bus
117 /// </summary>
f9717bcc
LOK
118 public enum class CecLogicalAddress
119 {
8438c41f
LOK
120 /// <summary>
121 /// Not a valid logical address
122 /// </summary>
123 Unknown = -1,
124 /// <summary>
125 /// Television
126 /// </summary>
f9717bcc 127 Tv = 0,
8438c41f
LOK
128 /// <summary>
129 /// Recording device 1
130 /// </summary>
f9717bcc 131 RecordingDevice1 = 1,
8438c41f
LOK
132 /// <summary>
133 /// Recording device 2
134 /// </summary>
f9717bcc 135 RecordingDevice2 = 2,
8438c41f
LOK
136 /// <summary>
137 /// Tuner 1
138 /// </summary>
f9717bcc 139 Tuner1 = 3,
8438c41f
LOK
140 /// <summary>
141 /// Playback device 1
142 /// </summary>
f9717bcc 143 PlaybackDevice1 = 4,
8438c41f
LOK
144 /// <summary>
145 /// Audio system / AVR
146 /// </summary>
f9717bcc 147 AudioSystem = 5,
8438c41f
LOK
148 /// <summary>
149 /// Tuner 2
150 /// </summary>
f9717bcc 151 Tuner2 = 6,
8438c41f
LOK
152 /// <summary>
153 /// Tuner 3
154 /// </summary>
f9717bcc 155 Tuner3 = 7,
8438c41f
LOK
156 /// <summary>
157 /// Playback device 2
158 /// </summary>
f9717bcc 159 PlaybackDevice2 = 8,
8438c41f
LOK
160 /// <summary>
161 /// Recording device 3
162 /// </summary>
f9717bcc 163 RecordingDevice3 = 9,
8438c41f
LOK
164 /// <summary>
165 /// Tuner 4
166 /// </summary>
f9717bcc 167 Tuner4 = 10,
8438c41f
LOK
168 /// <summary>
169 /// Playback device 3
170 /// </summary>
f9717bcc 171 PlaybackDevice3 = 11,
8438c41f
LOK
172 /// <summary>
173 /// Reserved address 1
174 /// </summary>
f9717bcc 175 Reserved1 = 12,
8438c41f
LOK
176 /// <summary>
177 /// Reserved address 2
178 /// </summary>
f9717bcc 179 Reserved2 = 13,
8438c41f
LOK
180 /// <summary>
181 /// Free to use
182 /// </summary>
f9717bcc 183 FreeUse = 14,
8438c41f
LOK
184 /// <summary>
185 /// Unregistered / new device
186 /// </summary>
f9717bcc 187 Unregistered = 15,
8438c41f
LOK
188 /// <summary>
189 /// Broadcast address
190 /// </summary>
f9717bcc
LOK
191 Broadcast = 15
192 };
193
8438c41f
LOK
194 /// <summary>
195 /// The type of alert when libCEC calls the CecAlert callback
196 /// </summary>
f9717bcc
LOK
197 public enum class CecAlert
198 {
8438c41f
LOK
199 /// <summary>
200 /// The device needs servicing. This is set when the firmware can be upgraded, or when a problem with the firmware is detected.
201 /// The latest firmware flash tool can be downloaded from http://packages.pulse-eight.net/
202 /// </summary>
5b431288
LOK
203 ServiceDevice = 0,
204 /// <summary>
205 /// The connection to the adapter was lost, probably because the device got unplugged.
206 /// </summary>
207 ConnectionLost,
208 /// <summary>
209 /// No permission from the OS to access the adapter.
210 /// </summary>
211 PermissionError,
212 /// <summary>
213 /// The device is being used by another program.
214 /// </summary>
215 PortBusy,
216 /// <summary>
217 /// The physical address that is assigned to the adapter is already being used.
218 /// </summary>
219 PhysicalAddressError,
220 /// <summary>
221 /// The TV does not respond to polls.
222 /// </summary>
223 TVPollFailed
f9717bcc
LOK
224 };
225
8438c41f
LOK
226 /// <summary>
227 /// The type of parameter that is sent with the CecAlert callback
228 /// </summary>
f9717bcc
LOK
229 public enum class CecParameterType
230 {
8438c41f
LOK
231 /// <summary>
232 /// The parameter is a string
233 /// </summary>
f9717bcc
LOK
234 ParameterTypeString = 1
235 };
236
8438c41f
LOK
237 /// <summary>
238 /// A parameter for the CecAlert callback
239 /// </summary>
f9717bcc
LOK
240 public ref class CecParameter
241 {
242 public:
8438c41f
LOK
243 /// <summary>
244 /// Create a new parameter
245 /// </summary>
246 /// <param name="type">The type of this parameter.</param>
247 /// <param name="data">The value of this parameter.</param>
248 CecParameter(CecParameterType type, System::String ^ data)
f9717bcc
LOK
249 {
250 Type = type;
8438c41f 251 Data = data;
f9717bcc
LOK
252 }
253
8438c41f
LOK
254 /// <summary>
255 /// The type of this parameter
256 /// </summary>
f9717bcc 257 property CecParameterType Type;
8438c41f
LOK
258 /// <summary>
259 /// The value of this parameter
260 /// </summary>
f9717bcc
LOK
261 property System::String ^ Data;
262 };
263
8438c41f
LOK
264 /// <summary>
265 /// The power status of a CEC device
266 /// </summary>
f9717bcc
LOK
267 public enum class CecPowerStatus
268 {
8438c41f
LOK
269 /// <summary>
270 /// Powered on
271 /// </summary>
f9717bcc 272 On = 0x00,
8438c41f
LOK
273 /// <summary>
274 /// In standby mode
275 /// </summary>
f9717bcc 276 Standby = 0x01,
8438c41f
LOK
277 /// <summary>
278 /// In transition from standby to on
279 /// </summary>
f9717bcc 280 InTransitionStandbyToOn = 0x02,
8438c41f
LOK
281 /// <summary>
282 /// In transition from on to standby
283 /// </summary>
f9717bcc 284 InTransitionOnToStandby = 0x03,
8438c41f
LOK
285 /// <summary>
286 /// Unknown status
287 /// </summary>
f9717bcc
LOK
288 Unknown = 0x99
289 };
290
8438c41f
LOK
291 /// <summary>
292 /// The CEC version of a CEC device
293 /// </summary>
f9717bcc
LOK
294 public enum class CecVersion
295 {
8438c41f
LOK
296 /// <summary>
297 /// Unknown version
298 /// </summary>
f9717bcc 299 Unknown = 0x00,
8438c41f
LOK
300 /// <summary>
301 /// Version 1.2
302 /// </summary>
f9717bcc 303 V1_2 = 0x01,
8438c41f
LOK
304 /// <summary>
305 /// Version 1.2a
306 /// </summary>
f9717bcc 307 V1_2A = 0x02,
8438c41f
LOK
308 /// <summary>
309 /// Version 1.3
310 /// </summary>
f9717bcc 311 V1_3 = 0x03,
8438c41f
LOK
312 /// <summary>
313 /// Version 1.3a
314 /// </summary>
f9717bcc 315 V1_3A = 0x04,
8438c41f
LOK
316 /// <summary>
317 /// Version 1.4
318 /// </summary>
f9717bcc
LOK
319 V1_4 = 0x05
320 };
321
8438c41f
LOK
322 /// <summary>
323 /// Parameter for OSD string display, that controls how to display the string
324 /// </summary>
f9717bcc
LOK
325 public enum class CecDisplayControl
326 {
8438c41f
LOK
327 /// <summary>
328 /// Display for the default time
329 /// </summary>
f9717bcc 330 DisplayForDefaultTime = 0x00,
8438c41f
LOK
331 /// <summary>
332 /// Display until it is cleared by ClearPreviousMessage
333 /// </summary>
f9717bcc 334 DisplayUntilCleared = 0x40,
8438c41f
LOK
335 /// <summary>
336 /// Clear message displayed by DisplayUntilCleared
337 /// </summary>
f9717bcc 338 ClearPreviousMessage = 0x80,
8438c41f
LOK
339 /// <summary>
340 /// Reserved / do not use
341 /// </summary>
f9717bcc
LOK
342 ReservedForFutureUse = 0xC0
343 };
344
8438c41f
LOK
345 /// <summary>
346 /// The menu state of a CEC device
347 /// </summary>
f9717bcc
LOK
348 public enum class CecMenuState
349 {
8438c41f
LOK
350 /// <summary>
351 /// Menu active
352 /// </summary>
f9717bcc 353 Activated = 0,
8438c41f
LOK
354 /// <summary>
355 /// Menu not active
356 /// </summary>
f9717bcc
LOK
357 Deactivated = 1
358 };
359
8438c41f
LOK
360 /// <summary>
361 /// Deck control mode for playback and recording devices
362 /// </summary>
f9717bcc
LOK
363 public enum class CecDeckControlMode
364 {
8438c41f
LOK
365 /// <summary>
366 /// Skip forward / wind
367 /// </summary>
f9717bcc 368 SkipForwardWind = 1,
8438c41f
LOK
369 /// <summary>
370 /// Skip reverse / rewind
371 /// </summary>
f9717bcc 372 SkipReverseRewind = 2,
8438c41f
LOK
373 /// <summary>
374 /// Stop
375 /// </summary>
f9717bcc 376 Stop = 3,
8438c41f
LOK
377 /// <summary>
378 /// Eject
379 /// </summary>
f9717bcc
LOK
380 Eject = 4
381 };
382
8438c41f
LOK
383 /// <summary>
384 /// Deck status for playback and recording devices
385 /// </summary>
f9717bcc
LOK
386 public enum class CecDeckInfo
387 {
8438c41f
LOK
388 /// <summary>
389 /// Playing
390 /// </summary>
f9717bcc 391 Play = 0x11,
8438c41f
LOK
392 /// <summary>
393 /// Recording
394 /// </summary>
f9717bcc 395 Record = 0x12,
8438c41f
LOK
396 /// <summary>
397 /// Reverse
398 /// </summary>
f9717bcc 399 Reverse = 0x13,
8438c41f
LOK
400 /// <summary>
401 /// Showing still frame
402 /// </summary>
f9717bcc 403 Still = 0x14,
8438c41f
LOK
404 /// <summary>
405 /// Playing slow
406 /// </summary>
f9717bcc 407 Slow = 0x15,
8438c41f
LOK
408 /// <summary>
409 /// Playing slow reverse
410 /// </summary>
f9717bcc 411 SlowReverse = 0x16,
8438c41f
LOK
412 /// <summary>
413 /// Fast forward
414 /// </summary>
f9717bcc 415 FastForward = 0x17,
8438c41f
LOK
416 /// <summary>
417 /// Fast reverse
418 /// </summary>
f9717bcc 419 FastReverse = 0x18,
8438c41f
LOK
420 /// <summary>
421 /// No media detected
422 /// </summary>
f9717bcc 423 NoMedia = 0x19,
8438c41f
LOK
424 /// <summary>
425 /// Stop / not playing
426 /// </summary>
f9717bcc 427 Stop = 0x1A,
8438c41f
LOK
428 /// <summary>
429 /// Skip forward / wind
430 /// </summary>
f9717bcc 431 SkipForwardWind = 0x1B,
8438c41f
LOK
432 /// <summary>
433 /// Skip reverse / rewind
434 /// </summary>
f9717bcc 435 SkipReverseRewind = 0x1C,
8438c41f
LOK
436 /// <summary>
437 /// Index search forward
438 /// </summary>
f9717bcc 439 IndexSearchForward = 0x1D,
8438c41f
LOK
440 /// <summary>
441 /// Index search reverse
442 /// </summary>
f9717bcc 443 IndexSearchReverse = 0x1E,
8438c41f
LOK
444 /// <summary>
445 /// Other / unknown status
446 /// </summary>
f9717bcc
LOK
447 OtherStatus = 0x1F
448 };
449
8438c41f
LOK
450 /// <summary>
451 /// User control code, the key code when the user presses or releases a button on the remote.
1c7cd8f8 452 /// Used by SendKeypress() and the CecKey callback.
8438c41f 453 /// </summary>
f9717bcc
LOK
454 public enum class CecUserControlCode
455 {
8438c41f
LOK
456 /// <summary>
457 /// Select / OK
458 /// </summary>
f9717bcc 459 Select = 0x00,
8438c41f
LOK
460 /// <summary>
461 /// Direction up
462 /// </summary>
f9717bcc 463 Up = 0x01,
8438c41f
LOK
464 /// <summary>
465 /// Direction down
466 /// </summary>
f9717bcc 467 Down = 0x02,
8438c41f
LOK
468 /// <summary>
469 /// Direction left
470 /// </summary>
f9717bcc 471 Left = 0x03,
8438c41f
LOK
472 /// <summary>
473 /// Direction right
474 /// </summary>
f9717bcc 475 Right = 0x04,
8438c41f
LOK
476 /// <summary>
477 /// Direction right + up
478 /// </summary>
f9717bcc 479 RightUp = 0x05,
8438c41f
LOK
480 /// <summary>
481 /// Direction right + down
482 /// </summary>
f9717bcc 483 RightDown = 0x06,
8438c41f
LOK
484 /// <summary>
485 /// Direction left + up
486 /// </summary>
f9717bcc 487 LeftUp = 0x07,
8438c41f
LOK
488 /// <summary>
489 /// Direction left + down
490 /// </summary>
f9717bcc 491 LeftDown = 0x08,
8438c41f
LOK
492 /// <summary>
493 /// Root menu
494 /// </summary>
f9717bcc 495 RootMenu = 0x09,
8438c41f
LOK
496 /// <summary>
497 /// Setup menu
498 /// </summary>
f9717bcc 499 SetupMenu = 0x0A,
8438c41f
LOK
500 /// <summary>
501 /// Contents menu
502 /// </summary>
f9717bcc 503 ContentsMenu = 0x0B,
8438c41f
LOK
504 /// <summary>
505 /// Favourite menu
506 /// </summary>
f9717bcc 507 FavoriteMenu = 0x0C,
8438c41f
LOK
508 /// <summary>
509 /// Exit / back
510 /// </summary>
f9717bcc 511 Exit = 0x0D,
8438c41f
LOK
512 /// <summary>
513 /// Number 0
514 /// </summary>
f9717bcc 515 Number0 = 0x20,
8438c41f
LOK
516 /// <summary>
517 /// Number 1
518 /// </summary>
f9717bcc 519 Number1 = 0x21,
8438c41f
LOK
520 /// <summary>
521 /// Number 2
522 /// </summary>
f9717bcc 523 Number2 = 0x22,
8438c41f
LOK
524 /// <summary>
525 /// Number 3
526 /// </summary>
f9717bcc 527 Number3 = 0x23,
8438c41f
LOK
528 /// <summary>
529 /// Number 4
530 /// </summary>
f9717bcc 531 Number4 = 0x24,
8438c41f
LOK
532 /// <summary>
533 /// Number 5
534 /// </summary>
f9717bcc 535 Number5 = 0x25,
8438c41f
LOK
536 /// <summary>
537 /// Number 6
538 /// </summary>
f9717bcc 539 Number6 = 0x26,
8438c41f
LOK
540 /// <summary>
541 /// Number 7
542 /// </summary>
f9717bcc 543 Number7 = 0x27,
8438c41f
LOK
544 /// <summary>
545 /// Number 8
546 /// </summary>
f9717bcc 547 Number8 = 0x28,
8438c41f
LOK
548 /// <summary>
549 /// Number 9
550 /// </summary>
f9717bcc 551 Number9 = 0x29,
8438c41f
LOK
552 /// <summary>
553 /// .
554 /// </summary>
f9717bcc 555 Dot = 0x2A,
8438c41f
LOK
556 /// <summary>
557 /// Enter input
558 /// </summary>
f9717bcc 559 Enter = 0x2B,
8438c41f
LOK
560 /// <summary>
561 /// Clear input
562 /// </summary>
f9717bcc 563 Clear = 0x2C,
8438c41f
LOK
564 /// <summary>
565 /// Next favourite
566 /// </summary>
f9717bcc 567 NextFavorite = 0x2F,
8438c41f
LOK
568 /// <summary>
569 /// Channel up
570 /// </summary>
f9717bcc 571 ChannelUp = 0x30,
8438c41f
LOK
572 /// <summary>
573 /// Channel down
574 /// </summary>
f9717bcc 575 ChannelDown = 0x31,
8438c41f
LOK
576 /// <summary>
577 /// Previous channel
578 /// </summary>
f9717bcc 579 PreviousChannel = 0x32,
8438c41f
LOK
580 /// <summary>
581 /// Select sound track
582 /// </summary>
f9717bcc 583 SoundSelect = 0x33,
8438c41f
LOK
584 /// <summary>
585 /// Select input
586 /// </summary>
f9717bcc 587 InputSelect = 0x34,
8438c41f
LOK
588 /// <summary>
589 /// Display information
590 /// </summary>
f9717bcc 591 DisplayInformation = 0x35,
8438c41f
LOK
592 /// <summary>
593 /// Show help
594 /// </summary>
f9717bcc 595 Help = 0x36,
8438c41f
LOK
596 /// <summary>
597 /// Page up
598 /// </summary>
f9717bcc 599 PageUp = 0x37,
8438c41f
LOK
600 /// <summary>
601 /// Page down
602 /// </summary>
f9717bcc 603 PageDown = 0x38,
8438c41f
LOK
604 /// <summary>
605 /// Toggle powered on / standby
606 /// </summary>
f9717bcc 607 Power = 0x40,
8438c41f
LOK
608 /// <summary>
609 /// Volume up
610 /// </summary>
f9717bcc 611 VolumeUp = 0x41,
8438c41f
LOK
612 /// <summary>
613 /// Volume down
614 /// </summary>
f9717bcc 615 VolumeDown = 0x42,
8438c41f
LOK
616 /// <summary>
617 /// Mute audio
618 /// </summary>
f9717bcc 619 Mute = 0x43,
8438c41f
LOK
620 /// <summary>
621 /// Start playback
622 /// </summary>
f9717bcc 623 Play = 0x44,
8438c41f
LOK
624 /// <summary>
625 /// Stop playback
626 /// </summary>
f9717bcc 627 Stop = 0x45,
8438c41f
LOK
628 /// <summary>
629 /// Pause playback
630 /// </summary>
f9717bcc 631 Pause = 0x46,
8438c41f
LOK
632 /// <summary>
633 /// Toggle recording
634 /// </summary>
f9717bcc 635 Record = 0x47,
8438c41f
LOK
636 /// <summary>
637 /// Rewind
638 /// </summary>
f9717bcc 639 Rewind = 0x48,
8438c41f
LOK
640 /// <summary>
641 /// Fast forward
642 /// </summary>
f9717bcc 643 FastForward = 0x49,
8438c41f
LOK
644 /// <summary>
645 /// Eject media
646 /// </summary>
f9717bcc 647 Eject = 0x4A,
8438c41f
LOK
648 /// <summary>
649 /// Forward
650 /// </summary>
f9717bcc 651 Forward = 0x4B,
8438c41f
LOK
652 /// <summary>
653 /// Backward
654 /// </summary>
f9717bcc 655 Backward = 0x4C,
8438c41f
LOK
656 /// <summary>
657 /// Stop recording
658 /// </summary>
f9717bcc 659 StopRecord = 0x4D,
8438c41f
LOK
660 /// <summary>
661 /// Pause recording
662 /// </summary>
f9717bcc 663 PauseRecord = 0x4E,
8438c41f
LOK
664 /// <summary>
665 /// Change angle
666 /// </summary>
f9717bcc 667 Angle = 0x50,
8438c41f
LOK
668 /// <summary>
669 /// Toggle sub picture
670 /// </summary>
f9717bcc 671 SubPicture = 0x51,
8438c41f
LOK
672 /// <summary>
673 /// Toggle video on demand
674 /// </summary>
f9717bcc 675 VideoOnDemand = 0x52,
8438c41f
LOK
676 /// <summary>
677 /// Toggle electronic program guide (EPG)
678 /// </summary>
f9717bcc 679 ElectronicProgramGuide = 0x53,
8438c41f
LOK
680 /// <summary>
681 /// Toggle timer programming
682 /// </summary>
f9717bcc 683 TimerProgramming = 0x54,
8438c41f
LOK
684 /// <summary>
685 /// Set initial configuration
686 /// </summary>
f9717bcc 687 InitialConfiguration = 0x55,
8438c41f
LOK
688 /// <summary>
689 /// Start playback function
690 /// </summary>
f9717bcc 691 PlayFunction = 0x60,
8438c41f
LOK
692 /// <summary>
693 /// Pause playback function
694 /// </summary>
f9717bcc 695 PausePlayFunction = 0x61,
8438c41f
LOK
696 /// <summary>
697 /// Toggle recording function
698 /// </summary>
f9717bcc 699 RecordFunction = 0x62,
8438c41f
LOK
700 /// <summary>
701 /// Pause recording function
702 /// </summary>
f9717bcc 703 PauseRecordFunction = 0x63,
8438c41f
LOK
704 /// <summary>
705 /// Stop playback function
706 /// </summary>
f9717bcc 707 StopFunction = 0x64,
8438c41f
LOK
708 /// <summary>
709 /// Mute audio function
710 /// </summary>
f9717bcc 711 MuteFunction = 0x65,
8438c41f
LOK
712 /// <summary>
713 /// Restore volume function
714 /// </summary>
f9717bcc 715 RestoreVolumeFunction = 0x66,
8438c41f
LOK
716 /// <summary>
717 /// Tune function
718 /// </summary>
f9717bcc 719 TuneFunction = 0x67,
8438c41f
LOK
720 /// <summary>
721 /// Select media function
722 /// </summary>
f9717bcc 723 SelectMediaFunction = 0x68,
8438c41f
LOK
724 /// <summary>
725 /// Select AV input function
726 /// </summary>
f9717bcc 727 SelectAVInputFunction = 0x69,
8438c41f
LOK
728 /// <summary>
729 /// Select audio input function
730 /// </summary>
f9717bcc 731 SelectAudioInputFunction = 0x6A,
8438c41f
LOK
732 /// <summary>
733 /// Toggle powered on / standby function
734 /// </summary>
f9717bcc 735 PowerToggleFunction = 0x6B,
8438c41f
LOK
736 /// <summary>
737 /// Power off function
738 /// </summary>
f9717bcc 739 PowerOffFunction = 0x6C,
8438c41f
LOK
740 /// <summary>
741 /// Power on function
742 /// </summary>
f9717bcc 743 PowerOnFunction = 0x6D,
8438c41f
LOK
744 /// <summary>
745 /// F1 / blue button
746 /// </summary>
f9717bcc 747 F1Blue = 0x71,
8438c41f
LOK
748 /// <summary>
749 /// F2 / red button
750 /// </summary>
f9717bcc 751 F2Red = 0X72,
8438c41f
LOK
752 /// <summary>
753 /// F3 / green button
754 /// </summary>
f9717bcc 755 F3Green = 0x73,
8438c41f
LOK
756 /// <summary>
757 /// F4 / yellow button
758 /// </summary>
f9717bcc 759 F4Yellow = 0x74,
8438c41f
LOK
760 /// <summary>
761 /// F5
762 /// </summary>
f9717bcc 763 F5 = 0x75,
8438c41f
LOK
764 /// <summary>
765 /// Data / teletext
766 /// </summary>
f9717bcc 767 Data = 0x76,
8438c41f
LOK
768 /// <summary>
769 /// Max. valid key code for standard buttons
770 /// </summary>
f9717bcc 771 Max = 0x76,
8438c41f
LOK
772 /// <summary>
773 /// Extra return button on Samsung remotes
774 /// </summary>
f9717bcc 775 SamsungReturn = 0x91,
8438c41f
LOK
776 /// <summary>
777 /// Unknown / invalid key code
778 /// </summary>
f9717bcc
LOK
779 Unknown
780 };
781
8438c41f
LOK
782 /// <summary>
783 /// Vendor IDs for CEC devices
784 /// </summary>
f9717bcc
LOK
785 public enum class CecVendorId
786 {
32e33ada 787 Toshiba = 0x000039,
f9717bcc 788 Samsung = 0x0000F0,
32e33ada
LOK
789 Denon = 0x0005CD,
790 Loewe = 0x000982,
f9717bcc 791 Onkyo = 0x0009B0,
32e33ada 792 Medion = 0x000CB8,
f9717bcc 793 Akai = 0x0020C7,
32e33ada
LOK
794 AOC = 0x002467,
795 Panasonic = 0x008045,
796 Philips = 0x00903E,
f9717bcc 797 Daewoo = 0x009053,
32e33ada 798 Yamaha = 0x00A0DE,
f9717bcc 799 Grundig = 0x00D0D5,
32e33ada
LOK
800 Pioneer = 0x00E036,
801 LG = 0x00E091,
f9717bcc 802 Sharp = 0x08001F,
32e33ada
LOK
803 Sony = 0x080046,
804 Broadcom = 0x18C086,
f9717bcc 805 Vizio = 0x6B746D,
32e33ada 806 Benq = 0x8065E9,
f9717bcc
LOK
807 Unknown = 0
808 };
809
8438c41f
LOK
810 /// <summary>
811 /// Audio status of audio system / AVR devices
812 /// </summary>
f9717bcc
LOK
813 public enum class CecAudioStatus
814 {
8438c41f
LOK
815 /// <summary>
816 /// Muted
817 /// </summary>
f9717bcc 818 MuteStatusMask = 0x80,
8438c41f
LOK
819 /// <summary>
820 /// Not muted, volume status mask
821 /// </summary>
f9717bcc 822 VolumeStatusMask = 0x7F,
8438c41f
LOK
823 /// <summary>
824 /// Minumum volume
825 /// </summary>
f9717bcc 826 VolumeMin = 0x00,
8438c41f
LOK
827 /// <summary>
828 /// Maximum volume
829 /// </summary>
f9717bcc 830 VolumeMax = 0x64,
8438c41f
LOK
831 /// <summary>
832 /// Unknown status
833 /// </summary>
f9717bcc
LOK
834 VolumeStatusUnknown = 0x7F
835 };
836
8438c41f
LOK
837 /// <summary>
838 /// CEC opcodes, as described in the HDMI CEC specification
839 /// </summary>
f9717bcc
LOK
840 public enum class CecOpcode
841 {
8438c41f
LOK
842 /// <summary>
843 /// Active source
844 /// </summary>
f9717bcc 845 ActiveSource = 0x82,
8438c41f
LOK
846 /// <summary>
847 /// Image view on: power on display for image display
848 /// </summary>
f9717bcc 849 ImageViewOn = 0x04,
8438c41f
LOK
850 /// <summary>
851 /// Text view on: power on display for text display
852 /// </summary>
f9717bcc 853 TextViewOn = 0x0D,
8438c41f
LOK
854 /// <summary>
855 /// Device no longer is the active source
856 /// </summary>
f9717bcc 857 InactiveSource = 0x9D,
8438c41f
LOK
858 /// <summary>
859 /// Request which device has the active source status
860 /// </summary>
f9717bcc 861 RequestActiveSource = 0x85,
8438c41f
LOK
862 /// <summary>
863 /// Routing change for HDMI switches
864 /// </summary>
f9717bcc 865 RoutingChange = 0x80,
8438c41f
LOK
866 /// <summary>
867 /// Routing information for HDMI switches
868 /// </summary>
f9717bcc 869 RoutingInformation = 0x81,
8438c41f
LOK
870 /// <summary>
871 /// Change the stream path to the given physical address
872 /// </summary>
f9717bcc 873 SetStreamPath = 0x86,
8438c41f
LOK
874 /// <summary>
875 /// Inform that a device went into standby mode
876 /// </summary>
f9717bcc 877 Standby = 0x36,
8438c41f
LOK
878 /// <summary>
879 /// Stop recording
880 /// </summary>
f9717bcc 881 RecordOff = 0x0B,
8438c41f
LOK
882 /// <summary>
883 /// Start recording
884 /// </summary>
f9717bcc 885 RecordOn = 0x09,
8438c41f
LOK
886 /// <summary>
887 /// Recording status information
888 /// </summary>
f9717bcc 889 RecordStatus = 0x0A,
8438c41f
LOK
890 /// <summary>
891 /// Record current display
892 /// </summary>
f9717bcc 893 RecordTvScreen = 0x0F,
8438c41f
LOK
894 /// <summary>
895 /// Clear analogue timer
896 /// </summary>
f9717bcc 897 ClearAnalogueTimer = 0x33,
8438c41f
LOK
898 /// <summary>
899 /// Clear digital timer
900 /// </summary>
f9717bcc 901 ClearDigitalTimer = 0x99,
8438c41f
LOK
902 /// <summary>
903 /// Clear external timer
904 /// </summary>
f9717bcc 905 ClearExternalTimer = 0xA1,
8438c41f
LOK
906 /// <summary>
907 /// Set analogue timer
908 /// </summary>
f9717bcc 909 SetAnalogueTimer = 0x34,
8438c41f
LOK
910 /// <summary>
911 /// Set digital timer
912 /// </summary>
f9717bcc 913 SetDigitalTimer = 0x97,
8438c41f
LOK
914 /// <summary>
915 /// Set external timer
916 /// </summary>
f9717bcc 917 SetExternalTimer = 0xA2,
8438c41f
LOK
918 /// <summary>
919 /// Set program title of a timer
920 /// </summary>
f9717bcc 921 SetTimerProgramTitle = 0x67,
8438c41f
LOK
922 /// <summary>
923 /// Timer status cleared
924 /// </summary>
f9717bcc 925 TimerClearedStatus = 0x43,
8438c41f
LOK
926 /// <summary>
927 /// Timer status information
928 /// </summary>
f9717bcc 929 TimerStatus = 0x35,
8438c41f
LOK
930 /// <summary>
931 /// CEC version used by a device
932 /// </summary>
f9717bcc 933 CecVersion = 0x9E,
8438c41f
LOK
934 /// <summary>
935 /// Request CEC version of a device
936 /// </summary>
f9717bcc 937 GetCecVersion = 0x9F,
8438c41f
LOK
938 /// <summary>
939 /// Request physical address of a device
940 /// </summary>
f9717bcc 941 GivePhysicalAddress = 0x83,
8438c41f
LOK
942 /// <summary>
943 /// Request language code of the menu language of a device
f81c0652 944 /// 3 character ISO 639-2 country code. see http://http://www.loc.gov/standards/iso639-2/
8438c41f 945 /// </summary>
f9717bcc 946 GetMenuLanguage = 0x91,
8438c41f
LOK
947 /// <summary>
948 /// Report the physical address
949 /// </summary>
f9717bcc 950 ReportPhysicalAddress = 0x84,
8438c41f
LOK
951 /// <summary>
952 /// Report the language code of the menu language
f81c0652 953 /// 3 character ISO 639-2 country code. see http://http://www.loc.gov/standards/iso639-2/
8438c41f 954 /// </summary>
f9717bcc 955 SetMenuLanguage = 0x32,
8438c41f
LOK
956 /// <summary>
957 /// Deck control for playback and recording devices
958 /// </summary>
f9717bcc 959 DeckControl = 0x42,
8438c41f
LOK
960 /// <summary>
961 /// Deck status for playback and recording devices
962 /// </summary>
f9717bcc 963 DeckStatus = 0x1B,
8438c41f
LOK
964 /// <summary>
965 /// Request deck status from playback and recording devices
966 /// </summary>
f9717bcc 967 GiveDeckStatus = 0x1A,
8438c41f
LOK
968 /// <summary>
969 /// Start playback on playback and recording devices
970 /// </summary>
f9717bcc 971 Play = 0x41,
8438c41f
LOK
972 /// <summary>
973 /// Request tuner status
974 /// </summary>
f9717bcc 975 GiveTunerDeviceStatus = 0x08,
8438c41f
LOK
976 /// <summary>
977 /// Select analogue service on a tuner
978 /// </summary>
f9717bcc 979 SelectAnalogueService = 0x92,
8438c41f
LOK
980 /// <summary>
981 /// Select digital service on a tuner
982 /// </summary>
f9717bcc 983 SelectDigtalService = 0x93,
8438c41f
LOK
984 /// <summary>
985 /// Report tuner device status
986 /// </summary>
f9717bcc 987 TunerDeviceStatus = 0x07,
8438c41f
LOK
988 /// <summary>
989 /// Tuner step decrement
990 /// </summary>
f9717bcc 991 TunerStepDecrement = 0x06,
8438c41f
LOK
992 /// <summary>
993 /// Tuner step increment
994 /// </summary>
f9717bcc 995 TunerStepIncrement = 0x05,
8438c41f
LOK
996 /// <summary>
997 /// Report device vendor ID
998 /// </summary>
f9717bcc 999 DeviceVendorId = 0x87,
8438c41f
LOK
1000 /// <summary>
1001 /// Request device vendor ID
1002 /// </summary>
f9717bcc 1003 GiveDeviceVendorId = 0x8C,
8438c41f
LOK
1004 /// <summary>
1005 /// Vendor specific command
1006 /// </summary>
f9717bcc 1007 VendorCommand = 0x89,
8438c41f
LOK
1008 /// <summary>
1009 /// Vendor specific command with vendor ID
1010 /// </summary>
f9717bcc 1011 VendorCommandWithId = 0xA0,
8438c41f
LOK
1012 /// <summary>
1013 /// Vendor specific remote button pressed
1014 /// </summary>
f9717bcc 1015 VendorRemoteButtonDown = 0x8A,
8438c41f
LOK
1016 /// <summary>
1017 /// Vendor specific remote button released
1018 /// </summary>
f9717bcc 1019 VendorRemoteButtonUp = 0x8B,
8438c41f
LOK
1020 /// <summary>
1021 /// Display / clear OSD string
1022 /// </summary>
f9717bcc 1023 SetOsdString = 0x64,
8438c41f
LOK
1024 /// <summary>
1025 /// Request device OSD name
1026 /// </summary>
f9717bcc 1027 GiveOsdName = 0x46,
8438c41f
LOK
1028 /// <summary>
1029 /// Report device OSD name
1030 /// </summary>
f9717bcc 1031 SetOsdName = 0x47,
8438c41f
LOK
1032 /// <summary>
1033 /// Request device menu status
1034 /// </summary>
f9717bcc 1035 MenuRequest = 0x8D,
8438c41f
LOK
1036 /// <summary>
1037 /// Report device menu status
1038 /// </summary>
f9717bcc 1039 MenuStatus = 0x8E,
8438c41f
LOK
1040 /// <summary>
1041 /// Remote button pressed
1042 /// </summary>
f9717bcc 1043 UserControlPressed = 0x44,
8438c41f
LOK
1044 /// <summary>
1045 /// Remote button released
1046 /// </summary>
f9717bcc 1047 UserControlRelease = 0x45,
8438c41f
LOK
1048 /// <summary>
1049 /// Request device power status
1050 /// </summary>
f9717bcc 1051 GiveDevicePowerStatus = 0x8F,
8438c41f
LOK
1052 /// <summary>
1053 /// Report device power status
1054 /// </summary>
f9717bcc 1055 ReportPowerStatus = 0x90,
8438c41f
LOK
1056 /// <summary>
1057 /// Feature abort / unsupported command
1058 /// </summary>
f9717bcc 1059 FeatureAbort = 0x00,
8438c41f
LOK
1060 /// <summary>
1061 /// Abort command
1062 /// </summary>
f9717bcc 1063 Abort = 0xFF,
8438c41f
LOK
1064 /// <summary>
1065 /// Give audio status
1066 /// </summary>
f9717bcc 1067 GiveAudioStatus = 0x71,
8438c41f
LOK
1068 /// <summary>
1069 /// Give audiosystem mode
1070 /// </summary>
f9717bcc 1071 GiveSystemAudioMode = 0x7D,
8438c41f
LOK
1072 /// <summary>
1073 /// Report device audio status
1074 /// </summary>
f9717bcc 1075 ReportAudioStatus = 0x7A,
8438c41f
LOK
1076 /// <summary>
1077 /// Set audiosystem mode
1078 /// </summary>
f9717bcc 1079 SetSystemAudioMode = 0x72,
8438c41f
LOK
1080 /// <summary>
1081 /// Request audiosystem mode
1082 /// </summary>
f9717bcc 1083 SystemAudioModeRequest = 0x70,
8438c41f
LOK
1084 /// <summary>
1085 /// Report audiosystem mode
1086 /// </summary>
f9717bcc 1087 SystemAudioModeStatus = 0x7E,
8438c41f
LOK
1088 /// <summary>
1089 /// Set audio bitrate
1090 /// </summary>
f9717bcc 1091 SetAudioRate = 0x9A,
8438c41f
LOK
1092 /// <summary>
1093 /// When this opcode is set, no opcode will be sent to the device / poll message
1094 /// This is one of the reserved numbers
1095 /// </summary>
f9717bcc
LOK
1096 None = 0xFD
1097 };
1098
8438c41f
LOK
1099 /// <summary>
1100 /// Audiosystem status
1101 /// </summary>
f9717bcc
LOK
1102 public enum class CecSystemAudioStatus
1103 {
8438c41f
LOK
1104 /// <summary>
1105 /// Turned off
1106 /// </summary>
f9717bcc 1107 Off = 0,
8438c41f
LOK
1108 /// <summary>
1109 /// Turned on
1110 /// </summary>
f9717bcc
LOK
1111 On = 1
1112 };
1113
8438c41f
LOK
1114 /// <summary>
1115 /// libCEC client application version
1116 /// </summary>
f9717bcc
LOK
1117 public enum class CecClientVersion
1118 {
8438c41f
LOK
1119 /// <summary>
1120 /// before v1.5.0
1121 /// </summary>
f9717bcc 1122 VersionPre1_5 = 0,
8438c41f
LOK
1123 /// <summary>
1124 /// v1.5.0
1125 /// </summary>
f9717bcc 1126 Version1_5_0 = 0x1500,
8438c41f
LOK
1127 /// <summary>
1128 /// v1.5.1
1129 /// </summary>
f9717bcc 1130 Version1_5_1 = 0x1501,
8438c41f
LOK
1131 /// <summary>
1132 /// v1.5.2
1133 /// </summary>
f9717bcc 1134 Version1_5_2 = 0x1502,
8438c41f
LOK
1135 /// <summary>
1136 /// v1.5.3
1137 /// </summary>
f9717bcc 1138 Version1_5_3 = 0x1503,
8438c41f
LOK
1139 /// <summary>
1140 /// v1.6.0
1141 /// </summary>
f9717bcc 1142 Version1_6_0 = 0x1600,
8438c41f
LOK
1143 /// <summary>
1144 /// v1.6.1
1145 /// </summary>
f9717bcc 1146 Version1_6_1 = 0x1601,
8438c41f
LOK
1147 /// <summary>
1148 /// v1.6.2
1149 /// </summary>
f9717bcc 1150 Version1_6_2 = 0x1602,
8438c41f
LOK
1151 /// <summary>
1152 /// v1.6.3
1153 /// </summary>
f9717bcc 1154 Version1_6_3 = 0x1603,
8438c41f
LOK
1155 /// <summary>
1156 /// v1.7.0
1157 /// </summary>
f9717bcc 1158 Version1_7_0 = 0x1700,
8438c41f
LOK
1159 /// <summary>
1160 /// v1.7.1
1161 /// </summary>
f9717bcc 1162 Version1_7_1 = 0x1701,
8438c41f
LOK
1163 /// <summary>
1164 /// v1.7.2
1165 /// </summary>
f9717bcc 1166 Version1_7_2 = 0x1702,
8438c41f
LOK
1167 /// <summary>
1168 /// v1.8.0
1169 /// </summary>
f9717bcc 1170 Version1_8_0 = 0x1800,
8438c41f
LOK
1171 /// <summary>
1172 /// v1.8.1
1173 /// </summary>
f9717bcc 1174 Version1_8_1 = 0x1801,
8438c41f
LOK
1175 /// <summary>
1176 /// v1.8.2
1177 /// </summary>
f9717bcc 1178 Version1_8_2 = 0x1802,
8438c41f
LOK
1179 /// <summary>
1180 /// v1.9.0
1181 /// </summary>
f81c0652
LOK
1182 Version1_9_0 = 0x1900,
1183 /// <summary>
1184 /// v2.0.0-pre
1185 /// </summary>
999665e3
LOK
1186 Version1_99_0 = 0x1990,
1187 /// <summary>
1188 /// v2.0.0
1189 /// </summary>
20fd14a9
LOK
1190 Version2_0_0 = 0x2000,
1191 /// <summary>
1192 /// v2.0.1
1193 /// </summary>
784a6a79
LOK
1194 Version2_0_1 = 0x2001,
1195 /// <summary>
1196 /// v2.0.2
1197 /// </summary>
83715833
LOK
1198 Version2_0_2 = 0x2002,
1199 /// <summary>
1200 /// v2.0.3
1201 /// </summary>
0c271bd0
LOK
1202 Version2_0_3 = 0x2003,
1203 /// <summary>
1204 /// v2.0.4
1205 /// </summary>
6fb1aefd
LOK
1206 Version2_0_4 = 0x2004,
1207 /// <summary>
1208 /// v2.0.5
1209 /// </summary>
9b56a19a
LOK
1210 Version2_0_5 = 0x2005,
1211 /// <summary>
1212 /// v2.1.0
1213 /// </summary>
331d659e
LOK
1214 Version2_1_0 = 0x2100,
1215 /// <summary>
1216 /// v2.1.1
1217 /// </summary>
f6db051e
LOK
1218 Version2_1_1 = 0x2101,
1219 /// <summary>
b53bfc2d
LOK
1220 /// v2.1.2
1221 /// </summary>
1222 Version2_1_2 = 0x2102,
1223 /// <summary>
1224 /// v2.1.3
1225 /// </summary>
1226 Version2_1_3 = 0x2103,
1227 /// <summary>
f6db051e
LOK
1228 /// The current version
1229 /// </summary>
b53bfc2d 1230 CurrentVersion = 0x2103
f9717bcc
LOK
1231 };
1232
8438c41f
LOK
1233 /// <summary>
1234 /// libCEC version
1235 /// </summary>
f9717bcc
LOK
1236 public enum class CecServerVersion
1237 {
8438c41f
LOK
1238 /// <summary>
1239 /// before v1.5.0
1240 /// </summary>
f9717bcc 1241 VersionPre1_5 = 0,
8438c41f
LOK
1242 /// <summary>
1243 /// v1.5.0
1244 /// </summary>
f9717bcc 1245 Version1_5_0 = 0x1500,
8438c41f
LOK
1246 /// <summary>
1247 /// v1.5.1
1248 /// </summary>
f9717bcc 1249 Version1_5_1 = 0x1501,
8438c41f
LOK
1250 /// <summary>
1251 /// v1.5.2
1252 /// </summary>
f9717bcc 1253 Version1_5_2 = 0x1502,
8438c41f
LOK
1254 /// <summary>
1255 /// v1.5.3
1256 /// </summary>
f9717bcc 1257 Version1_5_3 = 0x1503,
8438c41f
LOK
1258 /// <summary>
1259 /// v1.6.0
1260 /// </summary>
f9717bcc 1261 Version1_6_0 = 0x1600,
8438c41f
LOK
1262 /// <summary>
1263 /// v1.6.1
1264 /// </summary>
f9717bcc 1265 Version1_6_1 = 0x1601,
8438c41f
LOK
1266 /// <summary>
1267 /// v1.6.2
1268 /// </summary>
f9717bcc 1269 Version1_6_2 = 0x1602,
8438c41f
LOK
1270 /// <summary>
1271 /// v1.6.3
1272 /// </summary>
f9717bcc 1273 Version1_6_3 = 0x1603,
8438c41f
LOK
1274 /// <summary>
1275 /// v1.7.0
1276 /// </summary>
f9717bcc 1277 Version1_7_0 = 0x1700,
8438c41f
LOK
1278 /// <summary>
1279 /// v1.7.1
1280 /// </summary>
f9717bcc 1281 Version1_7_1 = 0x1701,
8438c41f
LOK
1282 /// <summary>
1283 /// v1.7.2
1284 /// </summary>
f9717bcc 1285 Version1_7_2 = 0x1702,
8438c41f
LOK
1286 /// <summary>
1287 /// v1.8.0
1288 /// </summary>
f9717bcc 1289 Version1_8_0 = 0x1800,
8438c41f
LOK
1290 /// <summary>
1291 /// v1.8.1
1292 /// </summary>
f9717bcc 1293 Version1_8_1 = 0x1801,
8438c41f
LOK
1294 /// <summary>
1295 /// v1.8.2
1296 /// </summary>
f9717bcc 1297 Version1_8_2 = 0x1802,
8438c41f
LOK
1298 /// <summary>
1299 /// v1.9.0
1300 /// </summary>
f81c0652
LOK
1301 Version1_9_0 = 0x1900,
1302 /// <summary>
1303 /// v2.0.0-pre
1304 /// </summary>
999665e3
LOK
1305 Version1_99_0 = 0x1990,
1306 /// <summary>
1307 /// v2.0.0
1308 /// </summary>
20fd14a9
LOK
1309 Version2_0_0 = 0x2000,
1310 /// <summary>
1311 /// v2.0.1
1312 /// </summary>
784a6a79
LOK
1313 Version2_0_1 = 0x2001,
1314 /// <summary>
1315 /// v2.0.2
1316 /// </summary>
83715833
LOK
1317 Version2_0_2 = 0x2002,
1318 /// <summary>
1319 /// v2.0.3
1320 /// </summary>
0c271bd0
LOK
1321 Version2_0_3 = 0x2003,
1322 /// <summary>
1323 /// v2.0.4
1324 /// </summary>
6fb1aefd
LOK
1325 Version2_0_4 = 0x2004,
1326 /// <summary>
1327 /// v2.0.5
1328 /// </summary>
9b56a19a
LOK
1329 Version2_0_5 = 0x2005,
1330 /// <summary>
1331 /// v2.1.0
1332 /// </summary>
331d659e
LOK
1333 Version2_1_0 = 0x2100,
1334 /// <summary>
1335 /// v2.1.1
1336 /// </summary>
f6db051e
LOK
1337 Version2_1_1 = 0x2101,
1338 /// <summary>
b53bfc2d
LOK
1339 /// v2.1.2
1340 /// </summary>
1341 Version2_1_2 = 0x2102,
1342 /// <summary>
1343 /// v2.1.3
1344 /// </summary>
1345 Version2_1_3 = 0x2103,
1346 /// <summary>
f6db051e
LOK
1347 /// The current version
1348 /// </summary>
b53bfc2d 1349 CurrentVersion = 0x2103
f9717bcc
LOK
1350 };
1351
8438c41f
LOK
1352 /// <summary>
1353 /// Type of adapter to which libCEC is connected
1354 /// </summary>
22190f06
LOK
1355 public enum class CecAdapterType
1356 {
8438c41f
LOK
1357 /// <summary>
1358 /// Unknown adapter type
1359 /// </summary>
22190f06 1360 Unknown = 0,
8438c41f
LOK
1361 /// <summary>
1362 /// Pulse-Eight USB-CEC adapter
1363 /// </summary>
22190f06 1364 PulseEightExternal = 0x1,
8438c41f
LOK
1365 /// <summary>
1366 /// Pulse-Eight CEC daughterboard
1367 /// </summary>
22190f06 1368 PulseEightDaughterboard = 0x2,
8438c41f
LOK
1369 /// <summary>
1370 /// Raspberry Pi
1371 /// </summary>
9b56a19a
LOK
1372 RaspberryPi = 0x100,
1373 /// <summary>
1374 /// TDA995x
1375 /// </summary>
1376 TDA995x = 0x200
22190f06
LOK
1377 };
1378
f9717bcc 1379 /// <summary>
8438c41f 1380 /// Descriptor of a CEC adapter, returned when scanning for adapters that are connected to the system
f9717bcc
LOK
1381 /// </summary>
1382 public ref class CecAdapter
1383 {
1384 public:
1385 /// <summary>
1386 /// Create a new CEC adapter descriptor
1387 /// </summary>
1388 /// <param name="path"> The path descriptor for this CEC adapter</param>
1389 /// <param name="comPort">The COM port of this CEC adapter</param>
1390 CecAdapter(System::String ^ path, System::String ^ comPort)
1391 {
1392 Path = path;
1393 ComPort = comPort;
1394 }
1395
1396 /// <summary>
1397 /// The path descriptor for this CEC adapter
1398 /// </summary>
1399 property System::String ^ Path;
1400
1401 /// <summary>
1402 /// The COM port of this CEC adapter
1403 /// </summary>
1404 property System::String ^ ComPort;
1405 };
1406
1407 /// <summary>
1408 /// A list of CEC device types
1409 /// </summary>
1410 public ref class CecDeviceTypeList
1411 {
1412 public:
1413 /// <summary>
1414 /// Create a new empty list of CEC device types
1415 /// </summary>
1416 CecDeviceTypeList(void)
1417 {
1418 Types = gcnew array<CecDeviceType>(5);
1419 for (unsigned int iPtr = 0; iPtr < 5; iPtr++)
1420 Types[iPtr] = CecDeviceType::Reserved;
1421 }
1422
1423 /// <summary>
1424 /// The array with CecDeviceType instances in this list.
1425 /// </summary>
1426 property array<CecDeviceType> ^ Types;
1427 };
1428
1429 /// <summary>
1430 /// A list of logical addresses
1431 /// </summary>
1432 public ref class CecLogicalAddresses
1433 {
1434 public:
1435 /// <summary>
1436 /// Create a new empty list of logical addresses
1437 /// </summary>
1438 CecLogicalAddresses(void)
1439 {
1440 Addresses = gcnew array<CecLogicalAddress>(16);
1441 Clear();
1442 }
1443
1444 /// <summary>
1445 /// Clears this list
1446 /// </summary>
1447 void Clear(void)
1448 {
1449 Primary = CecLogicalAddress::Unknown;
1450 for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
1451 Addresses[iPtr] = CecLogicalAddress::Unknown;
1452 }
1453
1454 /// <summary>
1455 /// Checks whether a logical address is set in this list.
1456 /// </summary>
1457 /// <param name="address">The address to check.</param>
1458 /// <returns>True when set, false otherwise</returns>
1459 bool IsSet(CecLogicalAddress address)
1460 {
1461 return Addresses[(unsigned int)address] != CecLogicalAddress::Unknown;
1462 }
1463
1464 /// <summary>
1465 /// Add a logical address to this list (if it's not set already)
1466 /// </summary>
1467 /// <param name="address">The address to add.</param>
1468 void Set(CecLogicalAddress address)
1469 {
1470 Addresses[(unsigned int)address] = address;
1471 if (Primary == CecLogicalAddress::Unknown)
1472 Primary = address;
1473 }
1474
1475 /// <summary>
1476 /// The primary (first) address in this list
1477 /// </summary>
1478 property CecLogicalAddress Primary;
1479
1480 /// <summary>
1481 /// The list of addresses
1482 /// </summary>
1483 property array<CecLogicalAddress> ^ Addresses;
1484 };
1485
1486
1487 /// <summary>
1488 /// Byte array used for CEC command parameters
1489 /// </summary>
1490 public ref class CecDatapacket
1491 {
1492 public:
1493 /// <summary>
1494 /// Create a new byte array with maximum size 100
1495 /// </summary>
1496 CecDatapacket(void)
1497 {
1498 Data = gcnew array<uint8_t>(100);
1499 Size = 0;
1500 }
1501
1502 /// <summary>
1503 /// Adds a byte to this byte array
1504 /// </summary>
1505 /// <param name="data">The byte to add.</param>
1506 void PushBack(uint8_t data)
1507 {
1508 if (Size < 100)
1509 {
1510 Data[Size] = data;
1511 Size++;
1512 }
1513 }
1514
1515 /// <summary>
1516 /// Array data
1517 /// </summary>
1518 property array<uint8_t> ^ Data;
1519
1520 /// <summary>
1521 /// Current data size
1522 /// </summary>
1523 property uint8_t Size;
1524 };
1525
1526 /// <summary>
1527 /// A CEC command that is received or transmitted over the CEC bus
1528 /// </summary>
1529 public ref class CecCommand
1530 {
1531 public:
1532 /// <summary>
1533 /// Create a new CEC command instance
1534 /// </summary>
1535 /// <param name="initiator">The initiator of the command</param>
1536 /// <param name="destination">The receiver of the command</param>
1537 /// <param name="ack">True when the ack bit is set, false otherwise</param>
1538 /// <param name="eom">True when the eom bit is set, false otherwise</param>
1539 /// <param name="opcode">The CEC opcode of this command</param>
1540 /// <param name="transmitTimeout">The timeout to use when transmitting a command</param>
1541 CecCommand(CecLogicalAddress initiator, CecLogicalAddress destination, bool ack, bool eom, CecOpcode opcode, int32_t transmitTimeout)
1542 {
1543 Initiator = initiator;
1544 Destination = destination;
1545 Ack = ack;
1546 Eom = eom;
1547 Opcode = opcode;
1548 OpcodeSet = true;
1549 TransmitTimeout = transmitTimeout;
1550 Parameters = gcnew CecDatapacket;
1551 Empty = false;
1552 }
1553
1554 /// <summary>
1555 /// Create a new empty CEC command instance
1556 /// </summary>
1557 CecCommand(void)
1558 {
1559 Initiator = CecLogicalAddress::Unknown;
1560 Destination = CecLogicalAddress::Unknown;
1561 Ack = false;
1562 Eom = false;
1563 Opcode = CecOpcode::None;
1564 OpcodeSet = false;
1565 TransmitTimeout = 0;
1566 Parameters = gcnew CecDatapacket;
1567 Empty = true;
1568 }
1569
1570 /// <summary>
1571 /// Pushes a byte of data to this CEC command
1572 /// </summary>
1573 /// <param name="data">The byte to add</param>
1574 void PushBack(uint8_t data)
1575 {
1576 if (Initiator == CecLogicalAddress::Unknown && Destination == CecLogicalAddress::Unknown)
1577 {
1578 Initiator = (CecLogicalAddress) (data >> 4);
1579 Destination = (CecLogicalAddress) (data & 0xF);
1580 }
1581 else if (!OpcodeSet)
1582 {
1583 OpcodeSet = true;
1584 Opcode = (CecOpcode)data;
1585 }
1586 else
1587 {
1588 Parameters->PushBack(data);
1589 }
1590 }
1591
1592 /// <summary>
1593 /// True when this command is empty, false otherwise.
1594 /// </summary>
1595 property bool Empty;
1596 /// <summary>
1597 /// The initiator of the command
1598 /// </summary>
1599 property CecLogicalAddress Initiator;
1600 /// <summary>
1601 /// The destination of the command
1602 /// </summary>
1603 property CecLogicalAddress Destination;
1604 /// <summary>
1605 /// True when the ack bit is set, false otherwise
1606 /// </summary>
1607 property bool Ack;
1608 /// <summary>
1609 /// True when the eom bit is set, false otherwise
1610 /// </summary>
1611 property bool Eom;
1612 /// <summary>
1613 /// The CEC opcode of the command
1614 /// </summary>
1615 property CecOpcode Opcode;
1616 /// <summary>
1617 /// The parameters of this command
1618 /// </summary>
1619 property CecDatapacket ^ Parameters;
1620 /// <summary>
1621 /// True when an opcode is set, false otherwise (poll message)
1622 /// </summary>
1623 property bool OpcodeSet;
1624 /// <summary>
1625 /// The timeout to use when transmitting a command
1626 /// </summary>
1627 property int32_t TransmitTimeout;
1628 };
1629
1630 /// <summary>
1631 /// A key press that was received
1632 /// </summary>
1633 public ref class CecKeypress
1634 {
1635 public:
1636 /// <summary>
1637 /// Create a new key press instance
1638 /// </summary>
1639 /// <param name="keycode">The key code of this key press</param>
1640 /// <param name="duration">The duration of this key press in milliseconds</param>
1641 CecKeypress(CecUserControlCode keycode, unsigned int duration)
1642 {
1643 Keycode = keycode;
1644 Duration = duration;
1645 Empty = false;
1646 }
1647
1648 /// <summary>
1649 /// Create a new empty key press instance
1650 /// </summary>
1651 CecKeypress(void)
1652 {
1653 Keycode = CecUserControlCode::Unknown;
1654 Duration = 0;
1655 Empty = true;
1656 }
1657
1658 /// <summary>
1659 /// True when empty, false otherwise
1660 /// </summary>
1661 property bool Empty;
1662 /// <summary>
1663 /// The key code of this key press
1664 /// </summary>
1665 property CecUserControlCode Keycode;
1666 /// <summary>
1667 /// The duration of this key press in milliseconds
1668 /// </summary>
1669 property unsigned int Duration;
1670 };
1671
1672 /// <summary>
1673 /// A log message that libCEC generated
1674 /// </summary>
1675 public ref class CecLogMessage
1676 {
1677 public:
1678 /// <summary>
1679 /// Create a new log message
1680 /// </summary>
1681 /// <param name="message">The actual message</param>
1682 /// <param name="level">The log level, so the application can choose what type information to display</param>
1683 /// <param name="time">The timestamp of this message, in milliseconds after connecting</param>
1684 CecLogMessage(System::String ^ message, CecLogLevel level, int64_t time)
1685 {
1686 Message = message;
1687 Level = level;
1688 Time = time;
1689 Empty = false;
1690 }
1691
1692 /// <summary>
1693 /// Create a new empty log message
1694 /// </summary>
1695 CecLogMessage(void)
1696 {
1697 Message = "";
1698 Level = CecLogLevel::None;
1699 Time = 0;
1700 Empty = true;
1701 }
1702
1703 /// <summary>
1704 /// True when empty, false otherwise.
1705 /// </summary>
1706 property bool Empty;
1707 /// <summary>
1708 /// The actual message
1709 /// </summary>
1710 property System::String ^Message;
1711 /// <summary>
1712 /// The log level, so the application can choose what type information to display
1713 /// </summary>
1714 property CecLogLevel Level;
1715 /// <summary>
1716 /// The timestamp of this message, in milliseconds after connecting
1717 /// </summary>
1718 property int64_t Time;
1719 };
1720
1721 ref class CecCallbackMethods; //forward declaration
1722
1723 /// <summary>
1724 /// The configuration that libCEC uses.
1725 /// </summary>
1726 public ref class LibCECConfiguration
1727 {
1728 public:
1729 /// <summary>
1730 /// Create a new configuration instance with default settings.
1731 /// </summary>
1732 LibCECConfiguration(void)
1733 {
1734 DeviceName = "";
1735 DeviceTypes = gcnew CecDeviceTypeList();
1736 AutodetectAddress = true;
1737 PhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS;
1738 BaseDevice = (CecLogicalAddress)CEC_DEFAULT_BASE_DEVICE;
1739 HDMIPort = CEC_DEFAULT_HDMI_PORT;
b53bfc2d
LOK
1740 ClientVersion = CecClientVersion::CurrentVersion;
1741 ServerVersion = CecServerVersion::CurrentVersion;
f9717bcc
LOK
1742 TvVendor = CecVendorId::Unknown;
1743
1744 GetSettingsFromROM = false;
1745 UseTVMenuLanguage = CEC_DEFAULT_SETTING_USE_TV_MENU_LANGUAGE == 1;
1746 ActivateSource = CEC_DEFAULT_SETTING_ACTIVATE_SOURCE == 1;
1747
1748 WakeDevices = gcnew CecLogicalAddresses();
1749 if (CEC_DEFAULT_SETTING_ACTIVATE_SOURCE == 1)
1750 WakeDevices->Set(CecLogicalAddress::Tv);
1751
1752 PowerOffDevices = gcnew CecLogicalAddresses();
1753 if (CEC_DEFAULT_SETTING_POWER_OFF_SHUTDOWN == 1)
1754 PowerOffDevices->Set(CecLogicalAddress::Broadcast);
1755
1756 PowerOffScreensaver = CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER == 1;
1757 PowerOffOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY == 1;
1758
1759 SendInactiveSource = CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE == 1;
1760 LogicalAddresses = gcnew CecLogicalAddresses();
1761 FirmwareVersion = 1;
1762 PowerOffDevicesOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_DEVICES_STANDBY == 1;
1763 ShutdownOnStandby = CEC_DEFAULT_SETTING_SHUTDOWN_ON_STANDBY == 1;
1764 DeviceLanguage = "";
22190f06
LOK
1765 FirmwareBuildDate = gcnew System::DateTime(1970,1,1,0,0,0,0);
1766 CECVersion = (CecVersion)CEC_DEFAULT_SETTING_CEC_VERSION;
1767 AdapterType = CecAdapterType::Unknown;
f9717bcc
LOK
1768 }
1769
1770 /// <summary>
1771 /// Change the callback method pointers in this configuration instance.
1772 /// </summary>
1773 /// <param name="callbacks">The new callbacks</param>
1774 void SetCallbacks(CecCallbackMethods ^callbacks)
1775 {
1776 Callbacks = callbacks;
1777 }
1778
1779 /// <summary>
1780 /// Update this configuration with data received from libCEC
1781 /// </summary>
1782 /// <param name="config">The configuration that was received from libCEC</param>
1783 void Update(const CEC::libcec_configuration &config)
1784 {
1785 DeviceName = gcnew System::String(config.strDeviceName);
1786
1787 for (unsigned int iPtr = 0; iPtr < 5; iPtr++)
1788 DeviceTypes->Types[iPtr] = (CecDeviceType)config.deviceTypes.types[iPtr];
1789
1790 AutodetectAddress = config.bAutodetectAddress == 1;
1791 PhysicalAddress = config.iPhysicalAddress;
1792 BaseDevice = (CecLogicalAddress)config.baseDevice;
1793 HDMIPort = config.iHDMIPort;
1794 ClientVersion = (CecClientVersion)config.clientVersion;
1795 ServerVersion = (CecServerVersion)config.serverVersion;
1796 TvVendor = (CecVendorId)config.tvVendor;
1797
1798 // player specific settings
1799 GetSettingsFromROM = config.bGetSettingsFromROM == 1;
1800 UseTVMenuLanguage = config.bUseTVMenuLanguage == 1;
1801 ActivateSource = config.bActivateSource == 1;
1802
1803 WakeDevices->Clear();
1804 for (uint8_t iPtr = 0; iPtr <= 16; iPtr++)
1805 if (config.wakeDevices[iPtr])
1806 WakeDevices->Set((CecLogicalAddress)iPtr);
1807
1808 PowerOffDevices->Clear();
1809 for (uint8_t iPtr = 0; iPtr <= 16; iPtr++)
1810 if (config.powerOffDevices[iPtr])
1811 PowerOffDevices->Set((CecLogicalAddress)iPtr);
1812
1813 PowerOffScreensaver = config.bPowerOffScreensaver == 1;
1814 PowerOffOnStandby = config.bPowerOffOnStandby == 1;
1815
1816 if (ServerVersion >= CecServerVersion::Version1_5_1)
1817 SendInactiveSource = config.bSendInactiveSource == 1;
1818
1819 if (ServerVersion >= CecServerVersion::Version1_5_3)
1820 {
1821 LogicalAddresses->Clear();
1822 for (uint8_t iPtr = 0; iPtr <= 16; iPtr++)
1823 if (config.logicalAddresses[iPtr])
1824 LogicalAddresses->Set((CecLogicalAddress)iPtr);
1825 }
1826
1827 if (ServerVersion >= CecServerVersion::Version1_6_0)
1828 {
1829 FirmwareVersion = config.iFirmwareVersion;
1830 PowerOffDevicesOnStandby = config.bPowerOffDevicesOnStandby == 1;
1831 ShutdownOnStandby = config.bShutdownOnStandby == 1;
1832 }
1833
1834 if (ServerVersion >= CecServerVersion::Version1_6_2)
22190f06 1835 {
f9717bcc 1836 DeviceLanguage = gcnew System::String(config.strDeviceLanguage);
22190f06
LOK
1837 FirmwareBuildDate = gcnew System::DateTime(1970,1,1,0,0,0,0);
1838 FirmwareBuildDate = FirmwareBuildDate->AddSeconds(config.iFirmwareBuildDate);
1839 }
f9717bcc
LOK
1840
1841 if (ServerVersion >= CecServerVersion::Version1_6_3)
1842 MonitorOnlyClient = config.bMonitorOnly == 1;
22190f06
LOK
1843
1844 if (ServerVersion >= CecServerVersion::Version1_8_0)
1845 CECVersion = (CecVersion)config.cecVersion;
1846
1847 if (ServerVersion >= CecServerVersion::Version1_8_2)
1848 AdapterType = (CecAdapterType)config.adapterType;
d18ea27b
JM
1849
1850 if (ServerVersion >= CecServerVersion::Version2_1_0)
1851 PowerOnScreensaver = config.bPowerOnScreensaver == 1;
f9717bcc
LOK
1852 }
1853
1854 /// <summary>
1855 /// The device name to use on the CEC bus
1856 /// </summary>
1857 property System::String ^ DeviceName;
1858
1859 /// <summary>
1860 /// The device type(s) to use on the CEC bus for libCEC
1861 /// </summary>
1862 property CecDeviceTypeList ^ DeviceTypes;
1863
1864 /// <summary>
f81c0652 1865 /// (read only) set to true by libCEC when the physical address was autodetected
f9717bcc
LOK
1866 /// </summary>
1867 property bool AutodetectAddress;
1868
1869 /// <summary>
f81c0652 1870 /// The physical address of the CEC adapter
f9717bcc
LOK
1871 /// </summary>
1872 property uint16_t PhysicalAddress;
1873
1874 /// <summary>
f81c0652 1875 /// The logical address of the device to which the adapter is connected. Only used when PhysicalAddress = 0 or when the adapter doesn't support autodetection
f9717bcc
LOK
1876 /// </summary>
1877 property CecLogicalAddress BaseDevice;
1878
1879 /// <summary>
f81c0652 1880 /// The HDMI port to which the adapter is connected. Only used when iPhysicalAddress = 0 or when the adapter doesn't support autodetection
f9717bcc
LOK
1881 /// </summary>
1882 property uint8_t HDMIPort;
1883
1884 /// <summary>
1885 /// The client API version to use
1886 /// </summary>
1887 property CecClientVersion ClientVersion;
1888
1889 /// <summary>
1890 /// The version of libCEC
1891 /// </summary>
1892 property CecServerVersion ServerVersion;
1893
1894 /// <summary>
f81c0652 1895 /// Override the vendor ID of the TV. Leave this untouched to autodetect
f9717bcc
LOK
1896 /// </summary>
1897 property CecVendorId TvVendor;
1898
1899 /// <summary>
1900 /// True to read the settings from the EEPROM, which possibly override the settings passed here
1901 /// </summary>
1902 property bool GetSettingsFromROM;
1903
1904 /// <summary>
1905 /// Use the language setting of the TV in the client application. Must be implemented by the client application.
f81c0652 1906 /// 3 character ISO 639-2 country code. see http://http://www.loc.gov/standards/iso639-2/
f9717bcc
LOK
1907 /// </summary>
1908 property bool UseTVMenuLanguage;
1909
1910 /// <summary>
1911 /// Make libCEC the active source when starting the client application
1912 /// </summary>
1913 property bool ActivateSource;
1914
1915 /// <summary>
f81c0652 1916 /// List of devices to wake when initialising libCEC or when calling PowerOnDevices() without any parameter.
f9717bcc
LOK
1917 /// </summary>
1918 property CecLogicalAddresses ^WakeDevices;
1919
1920 /// <summary>
f81c0652 1921 /// List of devices to power off when calling StandbyDevices() without any parameter.
f9717bcc
LOK
1922 /// </summary>
1923 property CecLogicalAddresses ^PowerOffDevices;
1924
1925 /// <summary>
1926 /// Send standby commands when the client application activates the screensaver. Must be implemented by the client application.
1927 /// </summary>
1928 property bool PowerOffScreensaver;
1929
1930 /// <summary>
1931 /// Power off the PC when the TV powers off. Must be implemented by the client application.
1932 /// </summary>
1933 property bool PowerOffOnStandby;
1934
1935 /// <summary>
1936 /// Send an inactive source message when exiting the client application.
1937 /// </summary>
1938 property bool SendInactiveSource;
1939
1940 /// <summary>
1941 /// The list of logical addresses that libCEC is using
1942 /// </summary>
1943 property CecLogicalAddresses ^LogicalAddresses;
1944
1945 /// <summary>
1946 /// The firmware version of the adapter to which libCEC is connected
1947 /// </summary>
1948 property uint16_t FirmwareVersion;
1949
1950 /// <summary>
1951 /// Send standby commands when the client application activates standby mode (S3). Must be implemented by the client application.
1952 /// </summary>
1953 property bool PowerOffDevicesOnStandby;
f81c0652
LOK
1954
1955 /// <summary>
1956 /// Shutdown this PC when the TV is switched off. only used when PowerOffOnStandby = false
1957 /// </summary>
f9717bcc
LOK
1958 property bool ShutdownOnStandby;
1959
1960 /// <summary>
1961 /// True to start a monitor-only client, false to start a standard client.
1962 /// </summary>
1963 property bool MonitorOnlyClient;
1964
1965 /// <summary>
1966 /// The language code of the menu language that libCEC reports to other devices.
f81c0652 1967 /// 3 character ISO 639-2 country code. see http://http://www.loc.gov/standards/iso639-2/
f9717bcc
LOK
1968 /// </summary>
1969 property System::String ^ DeviceLanguage;
1970
1971 /// <summary>
1972 /// The callback methods to use.
1973 /// </summary>
1974 property CecCallbackMethods ^ Callbacks;
22190f06
LOK
1975
1976 /// <summary>
1977 /// The build date of the firmware.
1978 /// </summary>
1979 property System::DateTime ^ FirmwareBuildDate;
1980
1981 /// <summary>
1982 /// The CEC version that libCEC uses.
1983 /// </summary>
1984 property CecVersion CECVersion;
1985
1986 /// <summary>
1987 /// The type of adapter that libCEC is connected to.
1988 /// </summary>
1989 property CecAdapterType AdapterType;
f2658b50
LOK
1990
1991 /// <summary>
1992 /// True to power on when quitting the screensaver.
1993 /// </summary>
1994 property bool PowerOnScreensaver;
f9717bcc
LOK
1995 };
1996
1997 // the callback methods are called by unmanaged code, so we need some delegates for this
1998#pragma unmanaged
1999 // unmanaged callback methods
2000 typedef int (__stdcall *LOGCB) (const CEC::cec_log_message &message);
2001 typedef int (__stdcall *KEYCB) (const CEC::cec_keypress &key);
2002 typedef int (__stdcall *COMMANDCB)(const CEC::cec_command &command);
2003 typedef int (__stdcall *CONFIGCB) (const CEC::libcec_configuration &config);
2004 typedef int (__stdcall *ALERTCB) (const CEC::libcec_alert, const CEC::libcec_parameter &data);
2005 typedef int (__stdcall *MENUCB) (const CEC::cec_menu_state newVal);
2006 typedef void (__stdcall *ACTICB) (const CEC::cec_logical_address logicalAddress, const uint8_t bActivated);
2007
8438c41f
LOK
2008 /// <summary>
2009 /// libCEC callback methods. Unmanaged code.
2010 /// </summary>
f9717bcc
LOK
2011 typedef struct
2012 {
8438c41f
LOK
2013 /// <summary>
2014 /// Log message callback
2015 /// </summary>
f9717bcc 2016 LOGCB logCB;
8438c41f
LOK
2017 /// <summary>
2018 /// Key press/release callback
2019 /// </summary>
f9717bcc 2020 KEYCB keyCB;
8438c41f
LOK
2021 /// <summary>
2022 /// Raw CEC data callback
2023 /// </summary>
f9717bcc 2024 COMMANDCB commandCB;
8438c41f
LOK
2025 /// <summary>
2026 /// Updated configuration callback
2027 /// </summary>
f9717bcc 2028 CONFIGCB configCB;
8438c41f
LOK
2029 /// <summary>
2030 /// Alert message callback
2031 /// </summary>
f9717bcc 2032 ALERTCB alertCB;
8438c41f
LOK
2033 /// <summary>
2034 /// Menu status change callback
2035 /// </summary>
f9717bcc 2036 MENUCB menuCB;
8438c41f
LOK
2037 /// <summary>
2038 /// Source (de)activated callback
2039 /// </summary>
f9717bcc
LOK
2040 ACTICB sourceActivatedCB;
2041 } UnmanagedCecCallbacks;
2042
2043 static PLATFORM::CMutex g_callbackMutex;
2044 static std::vector<UnmanagedCecCallbacks> g_unmanagedCallbacks;
dc6366e8 2045 static CEC::ICECCallbacks g_cecCallbacks;
4ef3b314 2046
8438c41f
LOK
2047 /// <summary>
2048 /// Called by libCEC to send back a log message to the application
2049 /// </summary>
2050 /// <param name="cbParam">Pointer to the callback struct</param>
2051 /// <param name="message">The log message</param>
2052 /// <return>1 when handled, 0 otherwise</return>
ecc38cdd 2053 int CecLogMessageCB(void *cbParam, const CEC::cec_log_message message)
f9717bcc
LOK
2054 {
2055 if (cbParam)
2056 {
2057 size_t iPtr = (size_t)cbParam;
2058 PLATFORM::CLockObject lock(g_callbackMutex);
2059 if (iPtr >= 0 && iPtr < g_unmanagedCallbacks.size())
2060 return g_unmanagedCallbacks[iPtr].logCB(message);
2061 }
2062 return 0;
2063 }
2064
8438c41f
LOK
2065 /// <summary>
2066 /// Called by libCEC to send back a key press or release to the application
2067 /// </summary>
2068 /// <param name="cbParam">Pointer to the callback struct</param>
2069 /// <param name="key">The key press command that libCEC received</param>
2070 /// <return>1 when handled, 0 otherwise</return>
ecc38cdd 2071 int CecKeyPressCB(void *cbParam, const CEC::cec_keypress key)
f9717bcc
LOK
2072 {
2073 if (cbParam)
2074 {
2075 size_t iPtr = (size_t)cbParam;
2076 PLATFORM::CLockObject lock(g_callbackMutex);
2077 if (iPtr >= 0 && iPtr < g_unmanagedCallbacks.size())
2078 return g_unmanagedCallbacks[iPtr].keyCB(key);
2079 }
2080 return 0;
2081 }
2082
8438c41f
LOK
2083 /// <summary>
2084 /// Called by libCEC to send back raw CEC data to the application
2085 /// </summary>
2086 /// <param name="cbParam">Pointer to the callback struct</param>
2087 /// <param name="command">The raw CEC data</param>
2088 /// <return>1 when handled, 0 otherwise</return>
ecc38cdd 2089 int CecCommandCB(void *cbParam, const CEC::cec_command command)
f9717bcc
LOK
2090 {
2091 if (cbParam)
2092 {
2093 size_t iPtr = (size_t)cbParam;
2094 PLATFORM::CLockObject lock(g_callbackMutex);
2095 if (iPtr >= 0 && iPtr < g_unmanagedCallbacks.size())
2096 return g_unmanagedCallbacks[iPtr].commandCB(command);
2097 }
2098 return 0;
2099 }
4ef3b314 2100
8438c41f
LOK
2101 /// <summary>
2102 /// Called by libCEC to send back an updated configuration to the application
2103 /// </summary>
2104 /// <param name="cbParam">Pointer to the callback struct</param>
2105 /// <param name="config">The new configuration</param>
2106 /// <return>1 when handled, 0 otherwise</return>
ecc38cdd 2107 int CecConfigCB(void *cbParam, const CEC::libcec_configuration config)
f9717bcc
LOK
2108 {
2109 if (cbParam)
2110 {
2111 size_t iPtr = (size_t)cbParam;
2112 PLATFORM::CLockObject lock(g_callbackMutex);
2113 if (iPtr >= 0 && iPtr < g_unmanagedCallbacks.size())
2114 return g_unmanagedCallbacks[iPtr].configCB(config);
2115 }
2116 return 0;
2117 }
2118
8438c41f
LOK
2119 /// <summary>
2120 /// Called by libCEC to send back an alert message to the application
2121 /// </summary>
2122 /// <param name="cbParam">Pointer to the callback struct</param>
2123 /// <param name="data">The alert message</param>
2124 /// <return>1 when handled, 0 otherwise</return>
ecc38cdd 2125 int CecAlertCB(void *cbParam, const CEC::libcec_alert alert, const CEC::libcec_parameter data)
f9717bcc
LOK
2126 {
2127 if (cbParam)
2128 {
2129 size_t iPtr = (size_t)cbParam;
2130 PLATFORM::CLockObject lock(g_callbackMutex);
2131 if (iPtr >= 0 && iPtr < g_unmanagedCallbacks.size())
2132 return g_unmanagedCallbacks[iPtr].alertCB(alert, data);
2133 }
2134 return 0;
2135 }
2136
8438c41f
LOK
2137 /// <summary>
2138 /// Called by libCEC to send back a menu state change to the application
2139 /// </summary>
2140 /// <param name="cbParam">Pointer to the callback struct</param>
2141 /// <param name="newVal">The new menu state</param>
2142 /// <return>1 when handled, 0 otherwise</return>
f9717bcc
LOK
2143 int CecMenuCB(void *cbParam, const CEC::cec_menu_state newVal)
2144 {
2145 if (cbParam)
2146 {
2147 size_t iPtr = (size_t)cbParam;
2148 PLATFORM::CLockObject lock(g_callbackMutex);
2149 if (iPtr >= 0 && iPtr < g_unmanagedCallbacks.size())
2150 return g_unmanagedCallbacks[iPtr].menuCB(newVal);
2151 }
2152 return 0;
2153 }
dc6366e8 2154
8438c41f
LOK
2155 /// <summary>
2156 /// Called by libCEC to notify the application that the source that is handled by libCEC was (de)activated
2157 /// </summary>
2158 /// <param name="cbParam">Pointer to the callback struct</param>
2159 /// <param name="logicalAddress">The logical address that was (de)activated</param>
2160 /// <param name="activated">True when activated, false when deactivated</param>
2161 void CecSourceActivatedCB(void *cbParam, const CEC::cec_logical_address logicalAddress, const uint8_t activated)
f9717bcc
LOK
2162 {
2163 if (cbParam)
2164 {
2165 size_t iPtr = (size_t)cbParam;
2166 PLATFORM::CLockObject lock(g_callbackMutex);
2167 if (iPtr >= 0 && iPtr < g_unmanagedCallbacks.size())
8438c41f 2168 g_unmanagedCallbacks[iPtr].sourceActivatedCB(logicalAddress, activated);
f9717bcc
LOK
2169 }
2170 }
2171
2172#pragma managed
1c7cd8f8
LOK
2173 /// <summary>
2174 /// Delegate method for the CecLogMessageCB callback in CecCallbackMethods
2175 /// </summary>
f9717bcc 2176 public delegate int CecLogMessageManagedDelegate(const CEC::cec_log_message &);
1c7cd8f8
LOK
2177 /// <summary>
2178 /// Delegate method for the CecKeyPressCB callback in CecCallbackMethods
2179 /// </summary>
f9717bcc 2180 public delegate int CecKeyPressManagedDelegate(const CEC::cec_keypress &);
1c7cd8f8
LOK
2181 /// <summary>
2182 /// Delegate method for the CecCommandCB callback in CecCallbackMethods
2183 /// </summary>
f9717bcc 2184 public delegate int CecCommandManagedDelegate(const CEC::cec_command &);
1c7cd8f8
LOK
2185 /// <summary>
2186 /// Delegate method for the CecConfigCB callback in CecCallbackMethods
2187 /// </summary>
f9717bcc 2188 public delegate int CecConfigManagedDelegate(const CEC::libcec_configuration &);
1c7cd8f8
LOK
2189 /// <summary>
2190 /// Delegate method for the CecAlertCB callback in CecCallbackMethods
2191 /// </summary>
f9717bcc 2192 public delegate int CecAlertManagedDelegate(const CEC::libcec_alert, const CEC::libcec_parameter &);
1c7cd8f8
LOK
2193 /// <summary>
2194 /// Delegate method for the CecMenuCB callback in CecCallbackMethods
2195 /// </summary>
2196 public delegate int CecMenuManagedDelegate(const CEC::cec_menu_state);
2197 /// <summary>
2198 /// Delegate method for the CecSourceActivatedCB callback in CecCallbackMethods
2199 /// </summary>
2200 public delegate void CecSourceActivatedManagedDelegate(const CEC::cec_logical_address, const uint8_t);
f9717bcc 2201
8438c41f
LOK
2202 /// <summary>
2203 /// Assign the callback methods in the g_cecCallbacks struct
2204 /// </summary>
f9717bcc
LOK
2205 void AssignCallbacks()
2206 {
2207 g_cecCallbacks.CBCecLogMessage = CecLogMessageCB;
2208 g_cecCallbacks.CBCecKeyPress = CecKeyPressCB;
2209 g_cecCallbacks.CBCecCommand = CecCommandCB;
2210 g_cecCallbacks.CBCecConfigurationChanged = CecConfigCB;
2211 g_cecCallbacks.CBCecAlert = CecAlertCB;
2212 g_cecCallbacks.CBCecMenuStateChanged = CecMenuCB;
2213 g_cecCallbacks.CBCecSourceActivated = CecSourceActivatedCB;
2214 }
2215
2216 /// <summary>
2217 /// The callback methods that libCEC uses
2218 /// </summary>
2219 public ref class CecCallbackMethods
2220 {
2221 public:
11fea069
LOK
2222 CecCallbackMethods(void)
2223 {
f9717bcc
LOK
2224 m_iCallbackPtr = -1;
2225 AssignCallbacks();
11fea069
LOK
2226 m_bHasCallbacks = false;
2227 m_bDelegatesCreated = false;
2228 }
4ef3b314 2229
f9717bcc 2230 ~CecCallbackMethods(void)
dc6366e8
LOK
2231 {
2232 DestroyDelegates();
2233 }
2234
8438c41f
LOK
2235 /// <summary>
2236 /// Pointer to the callbacks struct entry
2237 /// </summary>
f9717bcc
LOK
2238 size_t GetCallbackPtr(void)
2239 {
2240 PLATFORM::CLockObject lock(g_callbackMutex);
2241 return m_iCallbackPtr;
2242 }
2243
2244 protected:
2245 !CecCallbackMethods(void)
2246 {
2247 DestroyDelegates();
2248 }
2249
2250 public:
8438c41f
LOK
2251 /// <summary>
2252 /// Disable callback methods
2253 /// </summary>
f9717bcc
LOK
2254 virtual void DisableCallbacks(void)
2255 {
2256 DestroyDelegates();
2257 }
2258
8438c41f
LOK
2259 /// <summary>
2260 /// Enable callback methods
2261 /// </summary>
2262 /// <param name="callbacks">Callback methods to activate</param>
2263 /// <return>true when handled, false otherwise</return>
f9717bcc
LOK
2264 virtual bool EnableCallbacks(CecCallbackMethods ^ callbacks)
2265 {
11fea069 2266 CreateDelegates();
f9717bcc
LOK
2267 if (!m_bHasCallbacks)
2268 {
2269 m_bHasCallbacks = true;
2270 m_callbacks = callbacks;
2271 return true;
2272 }
2273
2274 return false;
2275 }
2276
2277 /// <summary>
8438c41f
LOK
2278 /// Called by libCEC to send back a log message to the application.
2279 /// Override in the application to handle this callback.
f9717bcc
LOK
2280 /// </summary>
2281 /// <param name="message">The log message</param>
8438c41f 2282 /// <return>1 when handled, 0 otherwise</return>
f9717bcc
LOK
2283 virtual int ReceiveLogMessage(CecLogMessage ^ message)
2284 {
2285 return 0;
2286 }
2287
2288 /// <summary>
8438c41f
LOK
2289 /// Called by libCEC to send back a key press or release to the application.
2290 /// Override in the application to handle this callback.
f9717bcc
LOK
2291 /// </summary>
2292 /// <param name="key">The key press command that libCEC received</param>
8438c41f 2293 /// <return>1 when handled, 0 otherwise</return>
f9717bcc
LOK
2294 virtual int ReceiveKeypress(CecKeypress ^ key)
2295 {
2296 return 0;
2297 }
2298
2299 /// <summary>
8438c41f
LOK
2300 /// Called by libCEC to send back raw CEC data to the application.
2301 /// Override in the application to handle this callback.
f9717bcc
LOK
2302 /// </summary>
2303 /// <param name="command">The raw CEC data</param>
8438c41f 2304 /// <return>1 when handled, 0 otherwise</return>
f9717bcc
LOK
2305 virtual int ReceiveCommand(CecCommand ^ command)
2306 {
2307 return 0;
2308 }
2309
2310 /// <summary>
8438c41f
LOK
2311 /// Called by libCEC to send back an updated configuration to the application.
2312 /// Override in the application to handle this callback.
f9717bcc
LOK
2313 /// </summary>
2314 /// <param name="config">The new configuration</param>
8438c41f 2315 /// <return>1 when handled, 0 otherwise</return>
f9717bcc
LOK
2316 virtual int ConfigurationChanged(LibCECConfiguration ^ config)
2317 {
2318 return 0;
2319 }
2320
2321 /// <summary>
8438c41f
LOK
2322 /// Called by libCEC to send back an alert message to the application.
2323 /// Override in the application to handle this callback.
f9717bcc
LOK
2324 /// </summary>
2325 /// <param name="data">The alert message</param>
8438c41f 2326 /// <return>1 when handled, 0 otherwise</return>
f9717bcc
LOK
2327 virtual int ReceiveAlert(CecAlert alert, CecParameter ^ data)
2328 {
2329 return 0;
2330 }
2331
2332 /// <summary>
8438c41f
LOK
2333 /// Called by libCEC to send back a menu state change to the application.
2334 /// Override in the application to handle this callback.
f9717bcc
LOK
2335 /// </summary>
2336 /// <param name="newVal">The new menu state</param>
8438c41f 2337 /// <return>1 when handled, 0 otherwise</return>
f9717bcc
LOK
2338 virtual int ReceiveMenuStateChange(CecMenuState newVal)
2339 {
2340 return 0;
2341 }
2342
2343 /// <summary>
8438c41f
LOK
2344 /// Called by libCEC to notify the application that the source that is handled by libCEC was (de)activated.
2345 /// Override in the application to handle this callback.
f9717bcc
LOK
2346 /// </summary>
2347 /// <param name="logicalAddress">The logical address that was (de)activated</param>
2348 /// <param name="activated">True when activated, false when deactivated</param>
2349 virtual void SourceActivated(CecLogicalAddress logicalAddress, bool activated)
2350 {
2351 }
2352
2353 protected:
2354 // managed callback methods
2355 int CecLogMessageManaged(const CEC::cec_log_message &message)
2356 {
2357 int iReturn(0);
2358 if (m_bHasCallbacks)
2359 iReturn = m_callbacks->ReceiveLogMessage(gcnew CecLogMessage(gcnew System::String(message.message), (CecLogLevel)message.level, message.time));
2360 return iReturn;
2361 }
2362
2363 int CecKeyPressManaged(const CEC::cec_keypress &key)
2364 {
2365 int iReturn(0);
2366 if (m_bHasCallbacks)
2367 iReturn = m_callbacks->ReceiveKeypress(gcnew CecKeypress((CecUserControlCode)key.keycode, key.duration));
2368 return iReturn;
2369 }
2370
2371 int CecCommandManaged(const CEC::cec_command &command)
2372 {
2373 int iReturn(0);
2374 if (m_bHasCallbacks)
2375 {
2376 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);
2377 for (uint8_t iPtr = 0; iPtr < command.parameters.size; iPtr++)
2378 newCommand->Parameters->PushBack(command.parameters[iPtr]);
2379 iReturn = m_callbacks->ReceiveCommand(newCommand);
2380 }
2381 return iReturn;
2382 }
2383
2384 int CecConfigManaged(const CEC::libcec_configuration &config)
2385 {
2386 int iReturn(0);
2387 if (m_bHasCallbacks)
2388 {
2389 LibCECConfiguration ^netConfig = gcnew LibCECConfiguration();
2390 netConfig->Update(config);
2391 iReturn = m_callbacks->ConfigurationChanged(netConfig);
2392 }
2393 return iReturn;
2394 }
2395
2396 int CecAlertManaged(const CEC::libcec_alert alert, const CEC::libcec_parameter &data)
2397 {
2398 int iReturn(0);
2399 if (m_bHasCallbacks)
2400 {
2401 CecParameterType newType = (CecParameterType)data.paramType;
2402 if (newType == CecParameterType::ParameterTypeString)
2403 {
2404 System::String ^ newData = gcnew System::String((const char *)data.paramData, 0, 128);
2405 CecParameter ^ newParam = gcnew CecParameter(newType, newData);
2406 iReturn = m_callbacks->ReceiveAlert((CecAlert)alert, newParam);
2407 }
2408 }
2409 return iReturn;
2410 }
2411
2412 int CecMenuManaged(const CEC::cec_menu_state newVal)
2413 {
2414 int iReturn(0);
2415 if (m_bHasCallbacks)
2416 {
2417 iReturn = m_callbacks->ReceiveMenuStateChange((CecMenuState)newVal);
2418 }
2419 return iReturn;
2420 }
2421
2422 void CecSourceActivatedManaged(const CEC::cec_logical_address logicalAddress, const uint8_t bActivated)
2423 {
2424 if (m_bHasCallbacks)
2425 m_callbacks->SourceActivated((CecLogicalAddress)logicalAddress, bActivated == 1);
2426 }
2427
2428 void DestroyDelegates()
2429 {
11fea069 2430 m_bHasCallbacks = false;
f9717bcc
LOK
2431 if (m_bDelegatesCreated)
2432 {
11fea069 2433 m_bDelegatesCreated = false;
f9717bcc
LOK
2434 m_logMessageGCHandle.Free();
2435 m_keypressGCHandle.Free();
2436 m_commandGCHandle.Free();
2437 m_alertGCHandle.Free();
2438 m_menuGCHandle.Free();
2439 m_sourceActivatedGCHandle.Free();
2440 }
2441 }
4ef3b314 2442
11fea069
LOK
2443 void CreateDelegates()
2444 {
2445 DestroyDelegates();
2446
2447 if (!m_bDelegatesCreated)
2448 {
2449 msclr::interop::marshal_context ^ context = gcnew msclr::interop::marshal_context();
2450
2451 // create the delegate method for the log message callback
dc6366e8
LOK
2452 m_logMessageDelegate = gcnew CecLogMessageManagedDelegate(this, &CecCallbackMethods::CecLogMessageManaged);
2453 m_logMessageGCHandle = System::Runtime::InteropServices::GCHandle::Alloc(m_logMessageDelegate);
f9717bcc 2454 m_logMessageCallback = static_cast<LOGCB>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_logMessageDelegate).ToPointer());
11fea069
LOK
2455
2456 // create the delegate method for the keypress callback
dc6366e8
LOK
2457 m_keypressDelegate = gcnew CecKeyPressManagedDelegate(this, &CecCallbackMethods::CecKeyPressManaged);
2458 m_keypressGCHandle = System::Runtime::InteropServices::GCHandle::Alloc(m_keypressDelegate);
f9717bcc 2459 m_keypressCallback = static_cast<KEYCB>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_keypressDelegate).ToPointer());
11fea069
LOK
2460
2461 // create the delegate method for the command callback
dc6366e8
LOK
2462 m_commandDelegate = gcnew CecCommandManagedDelegate(this, &CecCallbackMethods::CecCommandManaged);
2463 m_commandGCHandle = System::Runtime::InteropServices::GCHandle::Alloc(m_commandDelegate);
f9717bcc 2464 m_commandCallback = static_cast<COMMANDCB>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_commandDelegate).ToPointer());
11fea069
LOK
2465
2466 // create the delegate method for the configuration change callback
dc6366e8
LOK
2467 m_configDelegate = gcnew CecConfigManagedDelegate(this, &CecCallbackMethods::CecConfigManaged);
2468 m_configGCHandle = System::Runtime::InteropServices::GCHandle::Alloc(m_configDelegate);
f9717bcc 2469 m_configCallback = static_cast<CONFIGCB>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_configDelegate).ToPointer());
11fea069 2470
5ee37222 2471 // create the delegate method for the alert callback
dc6366e8
LOK
2472 m_alertDelegate = gcnew CecAlertManagedDelegate(this, &CecCallbackMethods::CecAlertManaged);
2473 m_alertGCHandle = System::Runtime::InteropServices::GCHandle::Alloc(m_alertDelegate);
f9717bcc 2474 m_alertCallback = static_cast<ALERTCB>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_alertDelegate).ToPointer());
5ee37222 2475
c3a20edb 2476 // create the delegate method for the menu callback
dc6366e8
LOK
2477 m_menuDelegate = gcnew CecMenuManagedDelegate(this, &CecCallbackMethods::CecMenuManaged);
2478 m_menuGCHandle = System::Runtime::InteropServices::GCHandle::Alloc(m_menuDelegate);
f9717bcc 2479 m_menuCallback = static_cast<MENUCB>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_menuDelegate).ToPointer());
c3a20edb 2480
f9717bcc 2481 // create the delegate method for the source activated callback
dc6366e8
LOK
2482 m_sourceActivatedDelegate = gcnew CecSourceActivatedManagedDelegate(this, &CecCallbackMethods::CecSourceActivatedManaged);
2483 m_sourceActivatedGCHandle = System::Runtime::InteropServices::GCHandle::Alloc(m_sourceActivatedDelegate);
f9717bcc 2484 m_sourceActivatedCallback = static_cast<ACTICB>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_sourceActivatedDelegate).ToPointer());
29d5198c 2485
11fea069 2486 delete context;
dc6366e8 2487
f9717bcc
LOK
2488 UnmanagedCecCallbacks unmanagedCallbacks;
2489 unmanagedCallbacks.logCB = m_logMessageCallback;
2490 unmanagedCallbacks.keyCB = m_keypressCallback;
2491 unmanagedCallbacks.commandCB = m_commandCallback;
2492 unmanagedCallbacks.configCB = m_configCallback;
2493 unmanagedCallbacks.alertCB = m_alertCallback;
2494 unmanagedCallbacks.menuCB = m_menuCallback;
2495 unmanagedCallbacks.sourceActivatedCB = m_sourceActivatedCallback;
2496
2497 PLATFORM::CLockObject lock(g_callbackMutex);
2498 g_unmanagedCallbacks.push_back(unmanagedCallbacks);
2499 m_iCallbackPtr = g_unmanagedCallbacks.size() - 1;
2500 m_bDelegatesCreated = true;
11fea069
LOK
2501 }
2502 }
2503
f9717bcc
LOK
2504 CecLogMessageManagedDelegate ^ m_logMessageDelegate;
2505 static System::Runtime::InteropServices::GCHandle m_logMessageGCHandle;
2506 LOGCB m_logMessageCallback;
4ef3b314 2507
f9717bcc
LOK
2508 CecKeyPressManagedDelegate ^ m_keypressDelegate;
2509 static System::Runtime::InteropServices::GCHandle m_keypressGCHandle;
2510 KEYCB m_keypressCallback;
4ef3b314 2511
f9717bcc
LOK
2512 CecCommandManagedDelegate ^ m_commandDelegate;
2513 static System::Runtime::InteropServices::GCHandle m_commandGCHandle;
2514 COMMANDCB m_commandCallback;
4ef3b314 2515
f9717bcc
LOK
2516 CecConfigManagedDelegate ^ m_configDelegate;
2517 static System::Runtime::InteropServices::GCHandle m_configGCHandle;
2518 CONFIGCB m_configCallback;
32403cc3 2519
f9717bcc
LOK
2520 CecAlertManagedDelegate ^ m_alertDelegate;
2521 static System::Runtime::InteropServices::GCHandle m_alertGCHandle;
2522 ALERTCB m_alertCallback;
5ee37222 2523
f9717bcc
LOK
2524 CecMenuManagedDelegate ^ m_menuDelegate;
2525 static System::Runtime::InteropServices::GCHandle m_menuGCHandle;
2526 MENUCB m_menuCallback;
c3a20edb 2527
f9717bcc
LOK
2528 CecSourceActivatedManagedDelegate ^ m_sourceActivatedDelegate;
2529 static System::Runtime::InteropServices::GCHandle m_sourceActivatedGCHandle;
2530 ACTICB m_sourceActivatedCallback;
29d5198c 2531
f9717bcc
LOK
2532 CecCallbackMethods ^ m_callbacks;
2533 bool m_bHasCallbacks;
11fea069 2534 bool m_bDelegatesCreated;
f9717bcc
LOK
2535 size_t m_iCallbackPtr;
2536 };
4ef3b314 2537}