From: Lars Op den Kamp Date: Tue, 2 Oct 2012 10:24:42 +0000 (+0200) Subject: added more documentation X-Git-Tag: upstream/2.2.0~1^2~17^2^2~55 X-Git-Url: https://git.piment-noir.org/?p=deb_libcec.git;a=commitdiff_plain;h=8438c41fc8c7ee216ccc774005f862f42cf7f0df added more documentation --- diff --git a/src/LibCecSharp/CecSharpTypes.h b/src/LibCecSharp/CecSharpTypes.h index 433685a..adef54d 100644 --- a/src/LibCecSharp/CecSharpTypes.h +++ b/src/LibCecSharp/CecSharpTypes.h @@ -41,217 +41,723 @@ namespace CecSharp { + /// + /// The device type. For client applications, libCEC only supports RecordingDevice, PlaybackDevice or Tuner. + /// libCEC uses RecordingDevice by default. + /// public enum class CecDeviceType { + /// + /// Television + /// Tv = 0, + /// + /// Recording device + /// RecordingDevice = 1, + /// + /// Reserved / do not use + /// Reserved = 2, + /// + /// Tuner + /// Tuner = 3, + /// + /// Playback device + /// PlaybackDevice = 4, + /// + /// Audio system / AVR + /// AudioSystem = 5 }; + /// + /// Log level that can be used by the logging callback method to filter messages from libCEC. + /// public enum class CecLogLevel { + /// + /// No logging + /// None = 0, + /// + /// libCEC encountered a serious problem, and couldn't complete an action. + /// Error = 1, + /// + /// libCEC warns that it encountered a problem, but recovered. + /// Warning = 2, + /// + /// libCEC informs the client about a CEC state change. + /// Notice = 4, + /// + /// Raw CEC data traffic + /// Traffic = 8, + /// + /// Debugging messages + /// Debug = 16, + /// + /// Display all messages + /// All = 31 }; + /// + /// A logical address on the CEC bus + /// public enum class CecLogicalAddress { - Unknown = -1, //not a valid logical address + /// + /// Not a valid logical address + /// + Unknown = -1, + /// + /// Television + /// Tv = 0, + /// + /// Recording device 1 + /// RecordingDevice1 = 1, + /// + /// Recording device 2 + /// RecordingDevice2 = 2, + /// + /// Tuner 1 + /// Tuner1 = 3, + /// + /// Playback device 1 + /// PlaybackDevice1 = 4, + /// + /// Audio system / AVR + /// AudioSystem = 5, + /// + /// Tuner 2 + /// Tuner2 = 6, + /// + /// Tuner 3 + /// Tuner3 = 7, + /// + /// Playback device 2 + /// PlaybackDevice2 = 8, + /// + /// Recording device 3 + /// RecordingDevice3 = 9, + /// + /// Tuner 4 + /// Tuner4 = 10, + /// + /// Playback device 3 + /// PlaybackDevice3 = 11, + /// + /// Reserved address 1 + /// Reserved1 = 12, + /// + /// Reserved address 2 + /// Reserved2 = 13, + /// + /// Free to use + /// FreeUse = 14, + /// + /// Unregistered / new device + /// Unregistered = 15, + /// + /// Broadcast address + /// Broadcast = 15 }; + /// + /// The type of alert when libCEC calls the CecAlert callback + /// public enum class CecAlert { + /// + /// The device needs servicing. This is set when the firmware can be upgraded, or when a problem with the firmware is detected. + /// The latest firmware flash tool can be downloaded from http://packages.pulse-eight.net/ + /// ServiceDevice = 1 }; + /// + /// The type of parameter that is sent with the CecAlert callback + /// public enum class CecParameterType { + /// + /// The parameter is a string + /// ParameterTypeString = 1 }; + /// + /// A parameter for the CecAlert callback + /// public ref class CecParameter { public: - CecParameter(CecParameterType type, System::String ^ strData) + /// + /// Create a new parameter + /// + /// The type of this parameter. + /// The value of this parameter. + CecParameter(CecParameterType type, System::String ^ data) { Type = type; - Data = strData; + Data = data; } + /// + /// The type of this parameter + /// property CecParameterType Type; + /// + /// The value of this parameter + /// property System::String ^ Data; }; + /// + /// The power status of a CEC device + /// public enum class CecPowerStatus { + /// + /// Powered on + /// On = 0x00, + /// + /// In standby mode + /// Standby = 0x01, + /// + /// In transition from standby to on + /// InTransitionStandbyToOn = 0x02, + /// + /// In transition from on to standby + /// InTransitionOnToStandby = 0x03, + /// + /// Unknown status + /// Unknown = 0x99 }; + /// + /// The CEC version of a CEC device + /// public enum class CecVersion { + /// + /// Unknown version + /// Unknown = 0x00, + /// + /// Version 1.2 + /// V1_2 = 0x01, + /// + /// Version 1.2a + /// V1_2A = 0x02, + /// + /// Version 1.3 + /// V1_3 = 0x03, + /// + /// Version 1.3a + /// V1_3A = 0x04, + /// + /// Version 1.4 + /// V1_4 = 0x05 }; + /// + /// Parameter for OSD string display, that controls how to display the string + /// public enum class CecDisplayControl { + /// + /// Display for the default time + /// DisplayForDefaultTime = 0x00, + /// + /// Display until it is cleared by ClearPreviousMessage + /// DisplayUntilCleared = 0x40, + /// + /// Clear message displayed by DisplayUntilCleared + /// ClearPreviousMessage = 0x80, + /// + /// Reserved / do not use + /// ReservedForFutureUse = 0xC0 }; + /// + /// The menu state of a CEC device + /// public enum class CecMenuState { + /// + /// Menu active + /// Activated = 0, + /// + /// Menu not active + /// Deactivated = 1 }; + /// + /// Deck control mode for playback and recording devices + /// public enum class CecDeckControlMode { + /// + /// Skip forward / wind + /// SkipForwardWind = 1, + /// + /// Skip reverse / rewind + /// SkipReverseRewind = 2, + /// + /// Stop + /// Stop = 3, + /// + /// Eject + /// Eject = 4 }; + /// + /// Deck status for playback and recording devices + /// public enum class CecDeckInfo { + /// + /// Playing + /// Play = 0x11, + /// + /// Recording + /// Record = 0x12, + /// + /// Reverse + /// Reverse = 0x13, + /// + /// Showing still frame + /// Still = 0x14, + /// + /// Playing slow + /// Slow = 0x15, + /// + /// Playing slow reverse + /// SlowReverse = 0x16, + /// + /// Fast forward + /// FastForward = 0x17, + /// + /// Fast reverse + /// FastReverse = 0x18, + /// + /// No media detected + /// NoMedia = 0x19, + /// + /// Stop / not playing + /// Stop = 0x1A, + /// + /// Skip forward / wind + /// SkipForwardWind = 0x1B, + /// + /// Skip reverse / rewind + /// SkipReverseRewind = 0x1C, + /// + /// Index search forward + /// IndexSearchForward = 0x1D, + /// + /// Index search reverse + /// IndexSearchReverse = 0x1E, + /// + /// Other / unknown status + /// OtherStatus = 0x1F }; + /// + /// User control code, the key code when the user presses or releases a button on the remote. + /// Used by SendKeypress() and the CecKeyPress() callback. + /// public enum class CecUserControlCode { + /// + /// Select / OK + /// Select = 0x00, + /// + /// Direction up + /// Up = 0x01, + /// + /// Direction down + /// Down = 0x02, + /// + /// Direction left + /// Left = 0x03, + /// + /// Direction right + /// Right = 0x04, + /// + /// Direction right + up + /// RightUp = 0x05, + /// + /// Direction right + down + /// RightDown = 0x06, + /// + /// Direction left + up + /// LeftUp = 0x07, + /// + /// Direction left + down + /// LeftDown = 0x08, + /// + /// Root menu + /// RootMenu = 0x09, + /// + /// Setup menu + /// SetupMenu = 0x0A, + /// + /// Contents menu + /// ContentsMenu = 0x0B, + /// + /// Favourite menu + /// FavoriteMenu = 0x0C, + /// + /// Exit / back + /// Exit = 0x0D, + /// + /// Number 0 + /// Number0 = 0x20, + /// + /// Number 1 + /// Number1 = 0x21, + /// + /// Number 2 + /// Number2 = 0x22, + /// + /// Number 3 + /// Number3 = 0x23, + /// + /// Number 4 + /// Number4 = 0x24, + /// + /// Number 5 + /// Number5 = 0x25, + /// + /// Number 6 + /// Number6 = 0x26, + /// + /// Number 7 + /// Number7 = 0x27, + /// + /// Number 8 + /// Number8 = 0x28, + /// + /// Number 9 + /// Number9 = 0x29, + /// + /// . + /// Dot = 0x2A, + /// + /// Enter input + /// Enter = 0x2B, + /// + /// Clear input + /// Clear = 0x2C, + /// + /// Next favourite + /// NextFavorite = 0x2F, + /// + /// Channel up + /// ChannelUp = 0x30, + /// + /// Channel down + /// ChannelDown = 0x31, + /// + /// Previous channel + /// PreviousChannel = 0x32, + /// + /// Select sound track + /// SoundSelect = 0x33, + /// + /// Select input + /// InputSelect = 0x34, + /// + /// Display information + /// DisplayInformation = 0x35, + /// + /// Show help + /// Help = 0x36, + /// + /// Page up + /// PageUp = 0x37, + /// + /// Page down + /// PageDown = 0x38, + /// + /// Toggle powered on / standby + /// Power = 0x40, + /// + /// Volume up + /// VolumeUp = 0x41, + /// + /// Volume down + /// VolumeDown = 0x42, + /// + /// Mute audio + /// Mute = 0x43, + /// + /// Start playback + /// Play = 0x44, + /// + /// Stop playback + /// Stop = 0x45, + /// + /// Pause playback + /// Pause = 0x46, + /// + /// Toggle recording + /// Record = 0x47, + /// + /// Rewind + /// Rewind = 0x48, + /// + /// Fast forward + /// FastForward = 0x49, + /// + /// Eject media + /// Eject = 0x4A, + /// + /// Forward + /// Forward = 0x4B, + /// + /// Backward + /// Backward = 0x4C, + /// + /// Stop recording + /// StopRecord = 0x4D, + /// + /// Pause recording + /// PauseRecord = 0x4E, + /// + /// Change angle + /// Angle = 0x50, + /// + /// Toggle sub picture + /// SubPicture = 0x51, + /// + /// Toggle video on demand + /// VideoOnDemand = 0x52, + /// + /// Toggle electronic program guide (EPG) + /// ElectronicProgramGuide = 0x53, + /// + /// Toggle timer programming + /// TimerProgramming = 0x54, + /// + /// Set initial configuration + /// InitialConfiguration = 0x55, + /// + /// Start playback function + /// PlayFunction = 0x60, + /// + /// Pause playback function + /// PausePlayFunction = 0x61, + /// + /// Toggle recording function + /// RecordFunction = 0x62, + /// + /// Pause recording function + /// PauseRecordFunction = 0x63, + /// + /// Stop playback function + /// StopFunction = 0x64, + /// + /// Mute audio function + /// MuteFunction = 0x65, + /// + /// Restore volume function + /// RestoreVolumeFunction = 0x66, + /// + /// Tune function + /// TuneFunction = 0x67, + /// + /// Select media function + /// SelectMediaFunction = 0x68, + /// + /// Select AV input function + /// SelectAVInputFunction = 0x69, + /// + /// Select audio input function + /// SelectAudioInputFunction = 0x6A, + /// + /// Toggle powered on / standby function + /// PowerToggleFunction = 0x6B, + /// + /// Power off function + /// PowerOffFunction = 0x6C, + /// + /// Power on function + /// PowerOnFunction = 0x6D, + /// + /// F1 / blue button + /// F1Blue = 0x71, + /// + /// F2 / red button + /// F2Red = 0X72, + /// + /// F3 / green button + /// F3Green = 0x73, + /// + /// F4 / yellow button + /// F4Yellow = 0x74, + /// + /// F5 + /// F5 = 0x75, + /// + /// Data / teletext + /// Data = 0x76, + /// + /// Max. valid key code for standard buttons + /// Max = 0x76, + /// + /// Extra return button on Samsung remotes + /// SamsungReturn = 0x91, + /// + /// Unknown / invalid key code + /// Unknown }; + /// + /// Vendor IDs for CEC devices + /// public enum class CecVendorId { Samsung = 0x0000F0, @@ -273,139 +779,475 @@ namespace CecSharp Unknown = 0 }; + /// + /// Audio status of audio system / AVR devices + /// public enum class CecAudioStatus { + /// + /// Muted + /// MuteStatusMask = 0x80, + /// + /// Not muted, volume status mask + /// VolumeStatusMask = 0x7F, + /// + /// Minumum volume + /// VolumeMin = 0x00, + /// + /// Maximum volume + /// VolumeMax = 0x64, + /// + /// Unknown status + /// VolumeStatusUnknown = 0x7F }; + /// + /// CEC opcodes, as described in the HDMI CEC specification + /// public enum class CecOpcode { + /// + /// Active source + /// ActiveSource = 0x82, + /// + /// Image view on: power on display for image display + /// ImageViewOn = 0x04, + /// + /// Text view on: power on display for text display + /// TextViewOn = 0x0D, + /// + /// Device no longer is the active source + /// InactiveSource = 0x9D, + /// + /// Request which device has the active source status + /// RequestActiveSource = 0x85, + /// + /// Routing change for HDMI switches + /// RoutingChange = 0x80, + /// + /// Routing information for HDMI switches + /// RoutingInformation = 0x81, + /// + /// Change the stream path to the given physical address + /// SetStreamPath = 0x86, + /// + /// Inform that a device went into standby mode + /// Standby = 0x36, + /// + /// Stop recording + /// RecordOff = 0x0B, + /// + /// Start recording + /// RecordOn = 0x09, + /// + /// Recording status information + /// RecordStatus = 0x0A, + /// + /// Record current display + /// RecordTvScreen = 0x0F, + /// + /// Clear analogue timer + /// ClearAnalogueTimer = 0x33, + /// + /// Clear digital timer + /// ClearDigitalTimer = 0x99, + /// + /// Clear external timer + /// ClearExternalTimer = 0xA1, + /// + /// Set analogue timer + /// SetAnalogueTimer = 0x34, + /// + /// Set digital timer + /// SetDigitalTimer = 0x97, + /// + /// Set external timer + /// SetExternalTimer = 0xA2, + /// + /// Set program title of a timer + /// SetTimerProgramTitle = 0x67, + /// + /// Timer status cleared + /// TimerClearedStatus = 0x43, + /// + /// Timer status information + /// TimerStatus = 0x35, + /// + /// CEC version used by a device + /// CecVersion = 0x9E, + /// + /// Request CEC version of a device + /// GetCecVersion = 0x9F, + /// + /// Request physical address of a device + /// GivePhysicalAddress = 0x83, + /// + /// Request language code of the menu language of a device + /// GetMenuLanguage = 0x91, + /// + /// Report the physical address + /// ReportPhysicalAddress = 0x84, + /// + /// Report the language code of the menu language + /// SetMenuLanguage = 0x32, + /// + /// Deck control for playback and recording devices + /// DeckControl = 0x42, + /// + /// Deck status for playback and recording devices + /// DeckStatus = 0x1B, + /// + /// Request deck status from playback and recording devices + /// GiveDeckStatus = 0x1A, + /// + /// Start playback on playback and recording devices + /// Play = 0x41, + /// + /// Request tuner status + /// GiveTunerDeviceStatus = 0x08, + /// + /// Select analogue service on a tuner + /// SelectAnalogueService = 0x92, + /// + /// Select digital service on a tuner + /// SelectDigtalService = 0x93, + /// + /// Report tuner device status + /// TunerDeviceStatus = 0x07, + /// + /// Tuner step decrement + /// TunerStepDecrement = 0x06, + /// + /// Tuner step increment + /// TunerStepIncrement = 0x05, + /// + /// Report device vendor ID + /// DeviceVendorId = 0x87, + /// + /// Request device vendor ID + /// GiveDeviceVendorId = 0x8C, + /// + /// Vendor specific command + /// VendorCommand = 0x89, + /// + /// Vendor specific command with vendor ID + /// VendorCommandWithId = 0xA0, + /// + /// Vendor specific remote button pressed + /// VendorRemoteButtonDown = 0x8A, + /// + /// Vendor specific remote button released + /// VendorRemoteButtonUp = 0x8B, + /// + /// Display / clear OSD string + /// SetOsdString = 0x64, + /// + /// Request device OSD name + /// GiveOsdName = 0x46, + /// + /// Report device OSD name + /// SetOsdName = 0x47, + /// + /// Request device menu status + /// MenuRequest = 0x8D, + /// + /// Report device menu status + /// MenuStatus = 0x8E, + /// + /// Remote button pressed + /// UserControlPressed = 0x44, + /// + /// Remote button released + /// UserControlRelease = 0x45, + /// + /// Request device power status + /// GiveDevicePowerStatus = 0x8F, + /// + /// Report device power status + /// ReportPowerStatus = 0x90, + /// + /// Feature abort / unsupported command + /// FeatureAbort = 0x00, + /// + /// Abort command + /// Abort = 0xFF, + /// + /// Give audio status + /// GiveAudioStatus = 0x71, + /// + /// Give audiosystem mode + /// GiveSystemAudioMode = 0x7D, + /// + /// Report device audio status + /// ReportAudioStatus = 0x7A, + /// + /// Set audiosystem mode + /// SetSystemAudioMode = 0x72, + /// + /// Request audiosystem mode + /// SystemAudioModeRequest = 0x70, + /// + /// Report audiosystem mode + /// SystemAudioModeStatus = 0x7E, + /// + /// Set audio bitrate + /// SetAudioRate = 0x9A, - /* when this opcode is set, no opcode will be sent to the device. this is one of the reserved numbers */ + /// + /// When this opcode is set, no opcode will be sent to the device / poll message + /// This is one of the reserved numbers + /// None = 0xFD }; + /// + /// Audiosystem status + /// public enum class CecSystemAudioStatus { + /// + /// Turned off + /// Off = 0, + /// + /// Turned on + /// On = 1 }; + /// + /// libCEC client application version + /// public enum class CecClientVersion { + /// + /// before v1.5.0 + /// VersionPre1_5 = 0, + /// + /// v1.5.0 + /// Version1_5_0 = 0x1500, + /// + /// v1.5.1 + /// Version1_5_1 = 0x1501, + /// + /// v1.5.2 + /// Version1_5_2 = 0x1502, + /// + /// v1.5.3 + /// Version1_5_3 = 0x1503, + /// + /// v1.6.0 + /// Version1_6_0 = 0x1600, + /// + /// v1.6.1 + /// Version1_6_1 = 0x1601, + /// + /// v1.6.2 + /// Version1_6_2 = 0x1602, + /// + /// v1.6.3 + /// Version1_6_3 = 0x1603, + /// + /// v1.7.0 + /// Version1_7_0 = 0x1700, + /// + /// v1.7.1 + /// Version1_7_1 = 0x1701, + /// + /// v1.7.2 + /// Version1_7_2 = 0x1702, + /// + /// v1.8.0 + /// Version1_8_0 = 0x1800, + /// + /// v1.8.1 + /// Version1_8_1 = 0x1801, + /// + /// v1.8.2 + /// Version1_8_2 = 0x1802, + /// + /// v1.9.0 + /// Version1_9_0 = 0x1900 }; + /// + /// libCEC version + /// public enum class CecServerVersion { + /// + /// before v1.5.0 + /// VersionPre1_5 = 0, + /// + /// v1.5.0 + /// Version1_5_0 = 0x1500, + /// + /// v1.5.1 + /// Version1_5_1 = 0x1501, + /// + /// v1.5.2 + /// Version1_5_2 = 0x1502, + /// + /// v1.5.3 + /// Version1_5_3 = 0x1503, + /// + /// v1.6.0 + /// Version1_6_0 = 0x1600, + /// + /// v1.6.1 + /// Version1_6_1 = 0x1601, + /// + /// v1.6.2 + /// Version1_6_2 = 0x1602, + /// + /// v1.6.3 + /// Version1_6_3 = 0x1603, + /// + /// v1.7.0 + /// Version1_7_0 = 0x1700, + /// + /// v1.7.1 + /// Version1_7_1 = 0x1701, + /// + /// v1.7.2 + /// Version1_7_2 = 0x1702, + /// + /// v1.8.0 + /// Version1_8_0 = 0x1800, + /// + /// v1.8.1 + /// Version1_8_1 = 0x1801, + /// + /// v1.8.2 + /// Version1_8_2 = 0x1802, + /// + /// v1.9.0 + /// Version1_9_0 = 0x1900 }; + /// + /// Type of adapter to which libCEC is connected + /// public enum class CecAdapterType { + /// + /// Unknown adapter type + /// Unknown = 0, + /// + /// Pulse-Eight USB-CEC adapter + /// PulseEightExternal = 0x1, + /// + /// Pulse-Eight CEC daughterboard + /// PulseEightDaughterboard = 0x2, + /// + /// Raspberry Pi + /// RaspberryPi = 0x100 }; /// - /// Descriptor of a CEC adapter, + /// Descriptor of a CEC adapter, returned when scanning for adapters that are connected to the system /// public ref class CecAdapter { @@ -1019,14 +1861,38 @@ namespace CecSharp typedef int (__stdcall *MENUCB) (const CEC::cec_menu_state newVal); typedef void (__stdcall *ACTICB) (const CEC::cec_logical_address logicalAddress, const uint8_t bActivated); + /// + /// libCEC callback methods. Unmanaged code. + /// typedef struct { + /// + /// Log message callback + /// LOGCB logCB; + /// + /// Key press/release callback + /// KEYCB keyCB; + /// + /// Raw CEC data callback + /// COMMANDCB commandCB; + /// + /// Updated configuration callback + /// CONFIGCB configCB; + /// + /// Alert message callback + /// ALERTCB alertCB; + /// + /// Menu status change callback + /// MENUCB menuCB; + /// + /// Source (de)activated callback + /// ACTICB sourceActivatedCB; } UnmanagedCecCallbacks; @@ -1034,6 +1900,12 @@ namespace CecSharp static std::vector g_unmanagedCallbacks; static CEC::ICECCallbacks g_cecCallbacks; + /// + /// Called by libCEC to send back a log message to the application + /// + /// Pointer to the callback struct + /// The log message + /// 1 when handled, 0 otherwise int CecLogMessageCB(void *cbParam, const CEC::cec_log_message &message) { if (cbParam) @@ -1046,6 +1918,12 @@ namespace CecSharp return 0; } + /// + /// Called by libCEC to send back a key press or release to the application + /// + /// Pointer to the callback struct + /// The key press command that libCEC received + /// 1 when handled, 0 otherwise int CecKeyPressCB(void *cbParam, const CEC::cec_keypress &key) { if (cbParam) @@ -1058,6 +1936,12 @@ namespace CecSharp return 0; } + /// + /// Called by libCEC to send back raw CEC data to the application + /// + /// Pointer to the callback struct + /// The raw CEC data + /// 1 when handled, 0 otherwise int CecCommandCB(void *cbParam, const CEC::cec_command &command) { if (cbParam) @@ -1070,6 +1954,12 @@ namespace CecSharp return 0; } + /// + /// Called by libCEC to send back an updated configuration to the application + /// + /// Pointer to the callback struct + /// The new configuration + /// 1 when handled, 0 otherwise int CecConfigCB(void *cbParam, const CEC::libcec_configuration &config) { if (cbParam) @@ -1082,6 +1972,12 @@ namespace CecSharp return 0; } + /// + /// Called by libCEC to send back an alert message to the application + /// + /// Pointer to the callback struct + /// The alert message + /// 1 when handled, 0 otherwise int CecAlertCB(void *cbParam, const CEC::libcec_alert alert, const CEC::libcec_parameter &data) { if (cbParam) @@ -1094,6 +1990,12 @@ namespace CecSharp return 0; } + /// + /// Called by libCEC to send back a menu state change to the application + /// + /// Pointer to the callback struct + /// The new menu state + /// 1 when handled, 0 otherwise int CecMenuCB(void *cbParam, const CEC::cec_menu_state newVal) { if (cbParam) @@ -1106,14 +2008,20 @@ namespace CecSharp return 0; } - void CecSourceActivatedCB(void *cbParam, const CEC::cec_logical_address logicalAddress, const uint8_t bActivated) + /// + /// Called by libCEC to notify the application that the source that is handled by libCEC was (de)activated + /// + /// Pointer to the callback struct + /// The logical address that was (de)activated + /// True when activated, false when deactivated + void CecSourceActivatedCB(void *cbParam, const CEC::cec_logical_address logicalAddress, const uint8_t activated) { if (cbParam) { size_t iPtr = (size_t)cbParam; PLATFORM::CLockObject lock(g_callbackMutex); if (iPtr >= 0 && iPtr < g_unmanagedCallbacks.size()) - g_unmanagedCallbacks[iPtr].sourceActivatedCB(logicalAddress, bActivated); + g_unmanagedCallbacks[iPtr].sourceActivatedCB(logicalAddress, activated); } } @@ -1127,6 +2035,9 @@ namespace CecSharp public delegate int CecMenuManagedDelegate(const CEC::cec_menu_state newVal); public delegate void CecSourceActivatedManagedDelegate(const CEC::cec_logical_address logicalAddress, const uint8_t bActivated); + /// + /// Assign the callback methods in the g_cecCallbacks struct + /// void AssignCallbacks() { g_cecCallbacks.CBCecLogMessage = CecLogMessageCB; @@ -1157,6 +2068,9 @@ namespace CecSharp DestroyDelegates(); } + /// + /// Pointer to the callbacks struct entry + /// size_t GetCallbackPtr(void) { PLATFORM::CLockObject lock(g_callbackMutex); @@ -1170,11 +2084,19 @@ namespace CecSharp } public: + /// + /// Disable callback methods + /// virtual void DisableCallbacks(void) { DestroyDelegates(); } + /// + /// Enable callback methods + /// + /// Callback methods to activate + /// true when handled, false otherwise virtual bool EnableCallbacks(CecCallbackMethods ^ callbacks) { CreateDelegates(); @@ -1189,61 +2111,74 @@ namespace CecSharp } /// - /// Called by libCEC to send back a log message to the application + /// Called by libCEC to send back a log message to the application. + /// Override in the application to handle this callback. /// /// The log message + /// 1 when handled, 0 otherwise virtual int ReceiveLogMessage(CecLogMessage ^ message) { return 0; } /// - /// Called by libCEC to send back a key press to the application + /// Called by libCEC to send back a key press or release to the application. + /// Override in the application to handle this callback. /// /// The key press command that libCEC received + /// 1 when handled, 0 otherwise virtual int ReceiveKeypress(CecKeypress ^ key) { return 0; } /// - /// Called by libCEC to send back raw CEC data to the application + /// Called by libCEC to send back raw CEC data to the application. + /// Override in the application to handle this callback. /// /// The raw CEC data + /// 1 when handled, 0 otherwise virtual int ReceiveCommand(CecCommand ^ command) { return 0; } /// - /// Called by libCEC to send back an updated configuration to the application + /// Called by libCEC to send back an updated configuration to the application. + /// Override in the application to handle this callback. /// /// The new configuration + /// 1 when handled, 0 otherwise virtual int ConfigurationChanged(LibCECConfiguration ^ config) { return 0; } /// - /// Called by libCEC to send back an alert message to the application + /// Called by libCEC to send back an alert message to the application. + /// Override in the application to handle this callback. /// /// The alert message + /// 1 when handled, 0 otherwise virtual int ReceiveAlert(CecAlert alert, CecParameter ^ data) { return 0; } /// - /// Called by libCEC to send back a menu stata change to the application + /// Called by libCEC to send back a menu state change to the application. + /// Override in the application to handle this callback. /// /// The new menu state + /// 1 when handled, 0 otherwise virtual int ReceiveMenuStateChange(CecMenuState newVal) { return 0; } /// - /// Called by libCEC to notify the application that the source that is handled by libCEC was (de)activated + /// Called by libCEC to notify the application that the source that is handled by libCEC was (de)activated. + /// Override in the application to handle this callback. /// /// The logical address that was (de)activated /// True when activated, false when deactivated