/dpinst-x86.exe
/dpinst-amd64.exe
+
+/documentation
+libcec (1.6-3) unstable; urgency=low
+
+ * changed/added:
+ * cec-client: show the firmware build date if available in cec-client -l
+ * cec-client: don't activate the source when starting
+ * cec-client: group up the output of the 'scan' command, and add the
+ currently active source to the output
+ * log the libCEC version in the 'connected to the CEC adapter' log entry,
+ and add the firmware build date to the line if it's available, so all
+ relevant version info is available in 1 log line.
+ * async writes for CUSBCECAdapterCommunication. less locks and polls, more
+ speed
+ * added 'make docs' target, that updates the doxygen documentation
+
+ * interface changes:
+ * added operator == and != for libcec_configuration
+ * added GetResponseOpcode(cec_opcode opcode) to cec_command
+ * added the firmware build date to libcec_configuration, so it can be
+ displayed by the client too.
+ * added static CLibCEC::Alert() method and CEC_ALERT_CONNECTION_LOST value
+ * added a callback to handle menu state changes. if the callback method
+ returns 1, then the change is processed by the CCECBusDevice too. if 0,
+ then the CCECBusDevice will always have menu state 'activated', so
+ keypresses are routed. bugzid: 724
+ * added a default menu language to libcec_configuration and set this
+ language for devices controlled by libcec. bugzid: 69
+
+ * fixed
+ * CCECProcessor::IsActiveSource() - TV was never checked
+ * don't call the deprecated SetActiveView() method in cec-client
+ * request the active source if unknown in CCECProcessor::GetActiveSource()
+ * don't try to match a device with PA 0xFFFF.
+ * don't change the power status of a device when changing the stream path
+ * don't set the power status to 'powered off' when marking the source
+ managed by libcec as inactive, or the tv will might send a power control
+ keycode when making it active again, potentially shutting down the system
+ * potential segfault in CCECProcessor::GetDeviceByPhysicalAddress()
+ * stream path changes when changed to the TV source (PA 0)
+ * clear the unsupported features list in CCECBusDevice::ResetDeviceStatus()
+ * never mark vendor commands as unsupported (only some may be unsupported),
+ as well as some others that should never be marked unsupported
+ * don't retry in CCECCommandHandler if the command has been marked as
+ unsupported
+ * don't request the PA of devices when handling an incoming CEC command, or
+ it'll block things while waiting for a response. if that response never
+ comes, or comes late, then other incoming commands will be timed out
+ before they are handled
+ * optimisation - strip unneeded virtual keywords from top level
+ implementations
+ * use the vlcommandhandler for the primary device that is handled by libCEC
+ when a panasonic tv is detected, so delayed activate source commands are
+ using the correct handler. bugzid: 723
+ * set the power status of device controlled by libCEC to
+ CEC_POWER_STATUS_ON
+ instead of IN_TRANSITION_STANDBY_TO_ON. reset the device status of a
+ device if it was detected as removed. bugzid: 755
+ * potentially uninitialised values in cec_command
+ * delay the 'active source' command for panasonic, until the vendor command
+ that reports that the TV is powered on has been received. bugzid: 723
+ * only respond to Give Physical Address with Report Physical Address.
+ bugzid: 592
+ This fixes several reports of the TV improperly switching to the libcec
+ device after it has previously switched to another source. Fix confirmed
+ with Panasonic and also reported to be an issue with Samsung and
+ Philips.
+ * check whether callback methods are set to a valid ptr
+ * number of retries for polls
+ * win32: fix build in paths with spaces. bugzid: 730
+ * LibCecSharp: free the alert GC callback when cleaning up
+ * the wrong setting was being read when powering on devices
+ * close the connection when a comm error was detected, and notify the
+ client via an alert
+ * don't segfault when calling ThreadsWait() without a valid thread
+ * lib/platform: fixed memleak
+ * leak in CCECAdapterMessageQueue::Write
+ * don't send commands if we know them to be unsupported. bugzid: 725
+
+ -- Pulse-Eight Packaging <packaging@pulse-eight.com> Wed, 18 Apr 2012 11:30:00 +0100
+
+libcec (1.6-2) unstable; urgency=low
+
+ * fixed:
+ * fixed typo in CUSBCECAdapterCommands::RequestSettings() that prevented
+ the settings from being read. the settings were still written, but never
+ read when bGetSettingsFromROM = 1.
+
+ -- Pulse-Eight Packaging <packaging@pulse-eight.com> Wed, 18 Apr 2012 11:30:00 +0100
+
libcec (1.6-1) unstable; urgency=medium
* changed/added:
--- /dev/null
+# Doxyfile 1.6.3
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = libCEC
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = documentation
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 2
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it parses.
+# With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this tag.
+# The format is ext=language, where ext is a file extension, and language is one of
+# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
+# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C. Note that for custom extensions you also need to set
+# FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = YES
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page. This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
+# doxygen. The layout file controls the global structure of the generated output files
+# in an output format independent way. The create the layout file that represents
+# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
+# file name after the option, if omitted DoxygenLayout.xml will be used as the name
+# of the layout file.
+
+LAYOUT_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = include
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output. If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code. Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
+# are set, an additional index file will be generated that can be used as input for
+# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
+# HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
+# For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a PHP enabled web server instead of at the web client
+# using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server
+# based approach is that it scales better to large projects and allows
+# full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader. This is useful
+# if you want to understand what is going on. On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED = __cplusplus
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = NO
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
-SUBDIRS = src/lib src/testclient src/cec-config
\ No newline at end of file
+SUBDIRS = src/lib src/testclient src/cec-config
+
+docs:
+ echo "Updating documentation (if doxygen is present)"
+ doxygen
The installer needs the Windows DDK (Driver Development Kit) and Nullsoft's
NSIS.
+To compile LibCecSharp on Windows, you'll need Visual C++ 2008 or Visual Studio
+2008, because it is compiled against .NET 2.0.
+
To compile libCEC, follow these instructions:
* open /project/libcec.sln with Visual C++ 2010 or Visual Studio 2010.
* build the project.
To build an installer on Windows:
-* download and install the Windows DDK.
* download and install NSIS.
-* go to /project and execute create-installer.cmd to create the installer.
-* the installer is stored as /project/libCEC-installer.exe
+* go to /project and execute create-installer.bat to create the installer.
+* the installer is stored as /build/libCEC-installer.exe
+
+You will need both Visual Studio 2008 and Visual Studio 2010 to build the
+installer from the command line. To build with Visual C++ 2008 and 2010,
+you will need to manually build libcec with Visual C++ 2010 and then
+build LibCecSharp.sln with Visual Studio 2008. See create-installer.bat
+for the required steps.
===============================================================================
=== Debugging / Testing ===
+libcec (1.6-3) unstable; urgency=low
+
+ * changed/added:
+ * cec-client: show the firmware build date if available in cec-client -l
+ * cec-client: don't activate the source when starting
+ * cec-client: group up the output of the 'scan' command, and add the
+ currently active source to the output
+ * log the libCEC version in the 'connected to the CEC adapter' log entry,
+ and add the firmware build date to the line if it's available, so all
+ relevant version info is available in 1 log line.
+ * async writes for CUSBCECAdapterCommunication. less locks and polls, more
+ speed
+ * added 'make docs' target, that updates the doxygen documentation
+
+ * interface changes:
+ * added operator == and != for libcec_configuration
+ * added GetResponseOpcode(cec_opcode opcode) to cec_command
+ * added the firmware build date to libcec_configuration, so it can be
+ displayed by the client too.
+ * added static CLibCEC::Alert() method and CEC_ALERT_CONNECTION_LOST value
+ * added a callback to handle menu state changes. if the callback method
+ returns 1, then the change is processed by the CCECBusDevice too. if 0,
+ then the CCECBusDevice will always have menu state 'activated', so
+ keypresses are routed. bugzid: 724
+ * added a default menu language to libcec_configuration and set this
+ language for devices controlled by libcec. bugzid: 69
+
+ * fixed
+ * CCECProcessor::IsActiveSource() - TV was never checked
+ * don't call the deprecated SetActiveView() method in cec-client
+ * request the active source if unknown in CCECProcessor::GetActiveSource()
+ * don't try to match a device with PA 0xFFFF.
+ * don't change the power status of a device when changing the stream path
+ * don't set the power status to 'powered off' when marking the source
+ managed by libcec as inactive, or the tv will might send a power control
+ keycode when making it active again, potentially shutting down the system
+ * potential segfault in CCECProcessor::GetDeviceByPhysicalAddress()
+ * stream path changes when changed to the TV source (PA 0)
+ * clear the unsupported features list in CCECBusDevice::ResetDeviceStatus()
+ * never mark vendor commands as unsupported (only some may be unsupported),
+ as well as some others that should never be marked unsupported
+ * don't retry in CCECCommandHandler if the command has been marked as
+ unsupported
+ * don't request the PA of devices when handling an incoming CEC command, or
+ it'll block things while waiting for a response. if that response never
+ comes, or comes late, then other incoming commands will be timed out
+ before they are handled
+ * optimisation - strip unneeded virtual keywords from top level
+ implementations
+ * use the vlcommandhandler for the primary device that is handled by libCEC
+ when a panasonic tv is detected, so delayed activate source commands are
+ using the correct handler. bugzid: 723
+ * set the power status of device controlled by libCEC to
+ CEC_POWER_STATUS_ON
+ instead of IN_TRANSITION_STANDBY_TO_ON. reset the device status of a
+ device if it was detected as removed. bugzid: 755
+ * potentially uninitialised values in cec_command
+ * delay the 'active source' command for panasonic, until the vendor command
+ that reports that the TV is powered on has been received. bugzid: 723
+ * only respond to Give Physical Address with Report Physical Address.
+ bugzid: 592
+ This fixes several reports of the TV improperly switching to the libcec
+ device after it has previously switched to another source. Fix confirmed
+ with Panasonic and also reported to be an issue with Samsung and
+ Philips.
+ * check whether callback methods are set to a valid ptr
+ * number of retries for polls
+ * win32: fix build in paths with spaces. bugzid: 730
+ * LibCecSharp: free the alert GC callback when cleaning up
+ * the wrong setting was being read when powering on devices
+ * close the connection when a comm error was detected, and notify the
+ client via an alert
+ * don't segfault when calling ThreadsWait() without a valid thread
+ * lib/platform: fixed memleak
+ * leak in CCECAdapterMessageQueue::Write
+ * don't send commands if we know them to be unsupported. bugzid: 725
+
+ -- Pulse-Eight Packaging <packaging@pulse-eight.com> Wed, 18 Apr 2012 11:30:00 +0100
+
libcec (1.6-2) unstable; urgency=low
* fixed:
#include "cectypes.h"
+#define LIBCEC_VERSION_CURRENT CEC_SERVER_VERSION_1_6_2
+
namespace CEC
{
class ICECAdapter
/*!
* @brief Open a connection to the CEC adapter.
* @param strPort The path to the port.
- * @param iTimeout Connection timeout in ms.
+ * @param iTimeoutMs Connection timeout in ms.
* @return True when connected, false otherwise.
*/
virtual bool Open(const char *strPort, uint32_t iTimeoutMs = 10000) = 0;
/*!
* @deprecated Use callback methods instead
* @brief Get the next CEC command that was received by the adapter.
- * @param action The next command.
+ * @param command The next command.
* @return True when a command was passed, false otherwise.
*/
virtual bool GetNextCommand(cec_command *command) = 0;
/*!
* @brief Change the deck info, if this adapter is a playback device.
* @param info The new deck info.
+ * @param bSendUpdate True to send the status over the CEC line.
* @return True if set, false otherwise.
*/
virtual bool SetDeckInfo(cec_deck_info info, bool bSendUpdate = true) = 0;
/*!
* @brief Display a message on the device with the given logical address.
- * @param iLogicalAddres The device to display the message on.
+ * @param iLogicalAddress The device to display the message on.
* @param duration The duration of the message
* @param strMessage The message to display.
* @return True when the command was sent, false otherwise.
* @param iLogicalAddress The device to get the CEC version for.
* @return The version or CEC_VERSION_UNKNOWN when the version couldn't be fetched.
*/
- virtual cec_version GetDeviceCecVersion(cec_logical_address iAddress) = 0;
+ virtual cec_version GetDeviceCecVersion(cec_logical_address iLogicalAddress) = 0;
/*!
* @brief Get the menu language of the device with the given logical address
* @param language The requested menu language.
* @return True when fetched succesfully, false otherwise.
*/
- virtual bool GetDeviceMenuLanguage(cec_logical_address iAddress, cec_menu_language *language) = 0;
+ virtual bool GetDeviceMenuLanguage(cec_logical_address iLogicalAddress, cec_menu_language *language) = 0;
/*!
* @brief Get the vendor ID of the device with the given logical address.
* @param iLogicalAddress The device to get the vendor id for.
* @return The vendor ID or 0 if it wasn't found.
*/
- virtual uint64_t GetDeviceVendorId(cec_logical_address iAddress) = 0;
+ virtual uint64_t GetDeviceVendorId(cec_logical_address iLogicalAddress) = 0;
/*!
* @brief Get the power status of the device with the given logical address.
* @param iLogicalAddress The device to get the power status for.
* @return The power status or CEC_POWER_STATUS_UNKNOWN if it wasn't found.
*/
- virtual cec_power_status GetDevicePowerStatus(cec_logical_address iAddress) = 0;
+ virtual cec_power_status GetDevicePowerStatus(cec_logical_address iLogicalAddress) = 0;
/*!
* @brief Get the physical address of the device with the given logical address.
* @param iLogicalAddress The device to get the vendor id for.
* @return The physical address or 0 if it wasn't found.
*/
- virtual uint16_t GetDevicePhysicalAddress(cec_logical_address iAddress) = 0;
+ virtual uint16_t GetDevicePhysicalAddress(cec_logical_address iLogicalAddress) = 0;
/*!
* @brief Sends a POLL message to a device.
- * @param iAddress The device to send the message to.
+ * @param iLogicalAddress The device to send the message to.
* @return True if the POLL was acked, false otherwise.
*/
- virtual bool PollDevice(cec_logical_address iAddress) = 0;
+ virtual bool PollDevice(cec_logical_address iLogicalAddress) = 0;
/*!
* @return The devices that are active on the bus and not handled by libcec.
/*!
* @brief Check whether a device is active on the bus.
- * @param iAddress The address to check.
+ * @param iLogicalAddress The address to check.
* @return True when active, false otherwise.
*/
- virtual bool IsActiveDevice(cec_logical_address iAddress) = 0;
+ virtual bool IsActiveDevice(cec_logical_address iLogicalAddress) = 0;
/*!
* @brief Check whether a device of the given type is active on the bus.
/*!
* @brief Get the OSD name of a device on the CEC bus.
- * @param iAddress The device to get the OSD name for.
+ * @param iLogicalAddress The device to get the OSD name for.
* @return The OSD name.
*/
- virtual cec_osd_name GetDeviceOSDName(cec_logical_address iAddress) = 0;
+ virtual cec_osd_name GetDeviceOSDName(cec_logical_address iLogicalAddress) = 0;
/*!
* @brief Get the logical address of the device that is currently the active source on the CEC bus.
/*!
* @brief Check whether a device is currently the active source on the CEC bus.
- * @param iAddress The address to check.
+ * @param iLogicalAddress The address to check.
* @return True when it is the active source, false otherwise.
*/
- virtual bool IsActiveSource(cec_logical_address iAddress) = 0;
+ virtual bool IsActiveSource(cec_logical_address iLogicalAddress) = 0;
/*!
* @brief Sets the stream path to the device on the given logical address.
- * @param iAddress The address to activate.
+ * @param iLogicalAddress The address to activate.
* @return True when the command was sent, false otherwise.
*/
- virtual bool SetStreamPath(cec_logical_address iAddress) = 0;
+ virtual bool SetStreamPath(cec_logical_address iLogicalAddress) = 0;
/*!
* @brief Sets the stream path to the device on the given logical address.
#define CEC_BUTTON_TIMEOUT 500
#define CEC_POWER_STATE_REFRESH_TIME 30000
#define CEC_FW_VERSION_UNKNOWN 0xFFFF
+#define CEC_FW_BUILD_UNKNOWN 0
#define CEC_CONNECT_TRIES 3
-#define CEC_DEFAULT_SETTING_USE_TV_MENU_LANGUAGE 1
-#define CEC_DEFAULT_SETTING_ACTIVATE_SOURCE 1
-#define CEC_DEFAULT_SETTING_POWER_OFF_SHUTDOWN 1
-#define CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER 1
-#define CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY 1
-#define CEC_DEFAULT_SETTING_SHUTDOWN_ON_STANDBY 0
-#define CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE 1
+#define CEC_PHYSICAL_ADDRESS_TV 0
+#define CEC_MIN_PHYSICAL_ADDRESS 0x1000
+#define CEC_MAX_PHYSICAL_ADDRESS 0xFFFE
+#define CEC_INVALID_PHYSICAL_ADDRESS 0xFFFF
+
+#define CEC_MIN_VENDORID 1
+#define CEC_MAX_VENDORID 0xFFFFFE
+#define CEC_INVALID_VENDORID 0xFFFFFF
+
+#define CEC_MIN_HDMI_PORTNUMBER 1
+#define CEC_MAX_HDMI_PORTNUMBER 15
+#define CEC_HDMI_PORTNUMBER_NONE 0
+
+#define CEC_DEFAULT_SETTING_USE_TV_MENU_LANGUAGE 1
+#define CEC_DEFAULT_SETTING_ACTIVATE_SOURCE 1
+#define CEC_DEFAULT_SETTING_POWER_OFF_SHUTDOWN 1
+#define CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER 1
+#define CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY 1
+#define CEC_DEFAULT_SETTING_SHUTDOWN_ON_STANDBY 0
+#define CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE 1
#define CEC_DEFAULT_SETTING_POWER_OFF_DEVICES_STANDBY 1
+#define CEC_DEFAULT_DEVICE_LANGUAGE "eng"
+#define CEC_DEFAULT_SETTING_AUTODETECT_ADDRESS 1
+#define CEC_DEFAULT_SETTING_GET_SETTINGS_FROM_ROM 0
#define CEC_DEFAULT_TRANSMIT_RETRY_WAIT 500
#define CEC_DEFAULT_TRANSMIT_TIMEOUT 1000
-#define CEC_DEFAULT_TRANSMIT_WAIT 2000
+#define CEC_DEFAULT_TRANSMIT_WAIT 1000
#define CEC_DEFAULT_TRANSMIT_RETRIES 1
+#define CEC_DEFAULT_CONNECT_TIMEOUT 10000
+#define CEC_DEFAULT_CONNECT_RETRY_WAIT 1000
+#define CEC_SERIAL_DEFAULT_BAUDRATE 38400
+#define CEC_CLEAR_INPUT_DEFAULT_WAIT 1000
+
#define CEC_MIN_LIB_VERSION 1
#define CEC_LIB_VERSION_MAJOR 1
#define CEC_LIB_VERSION_MINOR 6
MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE,
MSGCODE_FIRMWARE_VERSION,
MSGCODE_START_BOOTLOADER,
- MSGCODE_SET_POWERSTATE,
+ MSGCODE_GET_BUILDDATE,
MSGCODE_SET_CONTROLLED,
MSGCODE_GET_AUTO_ENABLED,
MSGCODE_SET_AUTO_ENABLED,
typedef struct cec_menu_language
{
- char language[4];
- cec_logical_address device;
+ char language[4]; /**< the iso language code. @bug the language code is only 3 chars long, not 4. will be changed in v2.0, because changing it now would break backwards compat */
+ cec_logical_address device; /**< the logical address of the device */
} cec_menu_language;
typedef struct cec_osd_name
{
- char name[14];
- cec_logical_address device;
+ char name[14]; /**< the name of the device */
+ cec_logical_address device; /**< the logical address of the device */
} cec_osd_name;
typedef struct cec_log_message
{
- char message[1024];
- cec_log_level level;
- int64_t time;
+ char message[1024]; /**< the actual message */
+ cec_log_level level; /**< log level of the message */
+ int64_t time; /**< the timestamp of this message */
} cec_log_message;
typedef struct cec_keypress
{
- cec_user_control_code keycode;
- unsigned int duration;
+ cec_user_control_code keycode; /**< the keycode */
+ unsigned int duration; /**< the duration of the keypress */
} cec_keypress;
typedef struct cec_adapter
{
- char path[1024];
- char comm[1024];
+ char path[1024]; /**< the path to the com port */
+ char comm[1024]; /**< the name of the com port */
} cec_adapter;
typedef struct cec_datapacket
{
- uint8_t data[100];
- uint8_t size;
+ uint8_t data[100]; /**< the actual data */
+ uint8_t size; /**< the size of the data */
#ifdef __cplusplus
cec_datapacket &operator =(const struct cec_datapacket &packet)
return *this;
}
- bool IsEmpty(void) const { return size == 0; }
- bool IsFull(void) const { return size == 100; }
+ bool IsEmpty(void) const { return size == 0; } /**< @return True when this packet is empty, false otherwise. */
+ bool IsFull(void) const { return size == 100; } /**< @return True when this packet is false, false otherwise. */
+
+ /*!
+ * @brief Get the byte at the requested position.
+ * @param pos The position.
+ * @return The byte, or 0 when out of bounds.
+ */
uint8_t operator[](uint8_t pos) const { return pos < size ? data[pos] : 0; }
+ /*!
+ * @brief Get the byte at the requested position.
+ * @param pos The position.
+ * @return The byte, or 0 when out of bounds.
+ */
uint8_t At(uint8_t pos) const { return pos < size ? data[pos] : 0; }
+ /*!
+ * @brief Shift the contents of this packet.
+ * @param iShiftBy The number of positions to shift.
+ */
void Shift(uint8_t iShiftBy)
{
if (iShiftBy >= size)
}
}
+ /*!
+ * @brief Push a byte to the end of this packet.
+ * @param add The byte to add.
+ */
void PushBack(uint8_t add)
{
if (size < 100)
data[size++] = add;
}
+ /*!
+ * @brief Clear this packet.
+ */
void Clear(void)
{
memset(data, 0, sizeof(data));
typedef struct cec_command
{
- cec_logical_address initiator;
- cec_logical_address destination;
- int8_t ack;
- int8_t eom;
- cec_opcode opcode;
- cec_datapacket parameters;
- int8_t opcode_set;
- int32_t transmit_timeout;
+ cec_logical_address initiator; /**< the logical address of the initiator of this message */
+ cec_logical_address destination; /**< the logical address of the destination of this message */
+ int8_t ack; /**< 1 when the ACK bit is set, 0 otherwise */
+ int8_t eom; /**< 1 when the EOM bit is set, 0 otherwise */
+ cec_opcode opcode; /**< the opcode of this message */
+ cec_datapacket parameters; /**< the parameters attached to this message */
+ int8_t opcode_set; /**< 1 when an opcode is set, 0 otherwise (POLL message) */
+ int32_t transmit_timeout; /**< the timeout to use in ms */
#ifdef __cplusplus
+ cec_command(void)
+ {
+ Clear();
+ }
+
cec_command &operator =(const struct cec_command &command)
{
initiator = command.initiator;
return *this;
}
+ /*!
+ * @brief Formats a cec_command.
+ * @param command The command to format.
+ * @param initiator The logical address of the initiator.
+ * @param destination The logical addres of the destination.
+ * @param opcode The opcode of the command.
+ * @param timeout The transmission timeout.
+ */
static void Format(cec_command &command, cec_logical_address initiator, cec_logical_address destination, cec_opcode opcode, int32_t timeout = CEC_DEFAULT_TRANSMIT_TIMEOUT)
{
command.Clear();
}
}
+ /*!
+ * @brief Push a byte to the back of this command.
+ * @param data The byte to push.
+ */
void PushBack(uint8_t data)
{
if (initiator == CECDEVICE_UNKNOWN && destination == CECDEVICE_UNKNOWN)
parameters.PushBack(data);
}
+ /*!
+ * @brief Clear this command, resetting everything to the default values.
+ */
void Clear(void)
{
initiator = CECDEVICE_UNKNOWN;
transmit_timeout = CEC_DEFAULT_TRANSMIT_TIMEOUT;
parameters.Clear();
};
+
+ static cec_opcode GetResponseOpcode(cec_opcode opcode)
+ {
+ switch (opcode)
+ {
+ case CEC_OPCODE_REQUEST_ACTIVE_SOURCE:
+ return CEC_OPCODE_ACTIVE_SOURCE;
+ case CEC_OPCODE_GET_CEC_VERSION:
+ return CEC_OPCODE_CEC_VERSION;
+ case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS:
+ return CEC_OPCODE_REPORT_PHYSICAL_ADDRESS;
+ case CEC_OPCODE_GET_MENU_LANGUAGE:
+ return CEC_OPCODE_SET_MENU_LANGUAGE;
+ case CEC_OPCODE_GIVE_DECK_STATUS:
+ return CEC_OPCODE_DECK_STATUS;
+ case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS:
+ return CEC_OPCODE_TUNER_DEVICE_STATUS;
+ case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID:
+ return CEC_OPCODE_DEVICE_VENDOR_ID;
+ case CEC_OPCODE_GIVE_OSD_NAME:
+ return CEC_OPCODE_SET_OSD_NAME;
+ case CEC_OPCODE_MENU_REQUEST:
+ return CEC_OPCODE_MENU_STATUS;
+ case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS:
+ return CEC_OPCODE_REPORT_POWER_STATUS;
+ case CEC_OPCODE_GIVE_AUDIO_STATUS:
+ return CEC_OPCODE_REPORT_AUDIO_STATUS;
+ case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS:
+ return CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS;
+ case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST:
+ return CEC_OPCODE_SET_SYSTEM_AUDIO_MODE;
+ default:
+ break;
+ }
+
+ return CEC_OPCODE_NONE;
+ }
#endif
} cec_command;
typedef struct cec_device_type_list
{
- cec_device_type types[5];
+ cec_device_type types[5]; /**< the list of device types */
#ifdef __cplusplus
/*!
- * @deprecated
+ * @deprecated Use Clear() instead.
+ * @brief Clear this list.
*/
void clear(void) { Clear(); }
/*!
- * @deprecated
+ * @deprecated Use Add() instead.
+ * @brief Add a type to this list.
+ * @param type The type to add.
*/
void add(const cec_device_type type) { Add(type); }
+ /*!
+ * @brief Clear this list.
+ */
void Clear(void)
{
for (unsigned int iPtr = 0; iPtr < 5; iPtr++)
types[iPtr] = CEC_DEVICE_TYPE_RESERVED;
}
+ /*!
+ * @brief Add a type to this list.
+ * @param type The type to add.
+ */
void Add(const cec_device_type type)
{
for (unsigned int iPtr = 0; iPtr < 5; iPtr++)
}
}
+ /*!
+ * @brief Check whether a type is set in this list.
+ * @param type The type to check.
+ * @return True when set, false otherwise.
+ */
bool IsSet(cec_device_type type)
{
bool bReturn(false);
return bReturn;
}
+ /*!
+ * @return True when this list is empty, false otherwise.
+ */
bool IsEmpty() const
{
bool bReturn(true);
return bReturn;
}
+ /*!
+ * @brief Get the type at the requested position.
+ * @param pos The position.
+ * @return The type, or CEC_DEVICE_TYPE_RESERVED when out of bounds.
+ */
cec_device_type operator[](uint8_t pos) const { return pos < 5 ? types[pos] : CEC_DEVICE_TYPE_RESERVED; }
+
bool operator==(const cec_device_type_list &other) const
{
bool bEqual(true);
typedef struct cec_logical_addresses
{
- cec_logical_address primary;
- int addresses[16];
+ cec_logical_address primary; /**< the primary logical address to use */
+ int addresses[16]; /**< the list of addresses */
#ifdef __cplusplus
+ /*!
+ * @brief Clear this list.
+ */
void Clear(void)
{
primary = CECDEVICE_UNKNOWN;
addresses[iPtr] = 0;
}
+ /*!
+ * @return True when empty, false otherwise.
+ */
bool IsEmpty(void) const
{
return primary == CECDEVICE_UNKNOWN;
}
+ /*!
+ * @brief Calculate the ack-mask for this list, the mask to use when determining whether to send an ack message or not.
+ * @return The ack-mask.
+ */
uint16_t AckMask(void) const
{
uint16_t mask = 0;
return mask;
}
+ /*!
+ * @brief Mark a logical address as 'set'
+ * @param address The logical address to add to this list.
+ */
void Set(cec_logical_address address)
{
if (primary == CECDEVICE_UNKNOWN)
addresses[(int) address] = 1;
}
+ /*!
+ * @brief Mark a logical address as 'unset'
+ * @param address The logical address to remove from this list.
+ */
void Unset(cec_logical_address address)
{
if (primary == address)
addresses[(int) address] = 0;
}
+ /*!
+ * @brief Check whether an address is set in this list.
+ * @param address The address to check.
+ * @return True when set, false otherwise.
+ */
bool IsSet(cec_logical_address address) const { return addresses[(int) address] == 1; }
+
+ /*!
+ * @brief Check whether an address is set in this list.
+ * @param pos The address to check.
+ * @return True when set, false otherwise.
+ */
bool operator[](uint8_t pos) const { return pos < 16 ? IsSet((cec_logical_address) pos) : false; }
bool operator==(const cec_logical_addresses &other) const
typedef enum libcec_alert
{
- CEC_ALERT_SERVICE_DEVICE
+ CEC_ALERT_SERVICE_DEVICE,
+ CEC_ALERT_CONNECTION_LOST
} libcec_alert;
typedef enum libcec_parameter_type
struct libcec_parameter
{
- libcec_parameter_type paramType;
- void* paramData;
+ libcec_parameter_type paramType; /**< the type of this parameter */
+ void* paramData; /**< the value of this parameter */
};
struct libcec_configuration;
typedef int (CEC_CDECL* CBCecCommandType)(void *param, const cec_command &);
typedef int (CEC_CDECL* CBCecConfigurationChangedType)(void *param, const libcec_configuration &);
typedef int (CEC_CDECL* CBCecAlertType)(void *param, const libcec_alert, const libcec_parameter &);
+typedef int (CEC_CDECL* CBCecMenuStateChangedType)(void *param, const cec_menu_state);
typedef struct ICECCallbacks
{
CBCecConfigurationChangedType CBCecConfigurationChanged;
/*!
- * @Brief Transfer a libcec alert message from libCEC to the client
- * @Param alert The alert type transfer.
- * @Param data Misc. additional information.
+ * @brief Transfer a libcec alert message from libCEC to the client
+ * @param alert The alert type transfer.
+ * @param data Misc. additional information.
* @return 1 when ok, 0 otherwise
*/
CBCecAlertType CBCecAlert;
+
+ /*!
+ * @brief Transfer a menu state change to the client.
+ * Transfer a menu state change to the client. If the command returns 1, then the change will be processed by
+ * the busdevice. If 0, then the state of the busdevice won't be changed, and will always be kept 'activated',
+ * @warning CEC does not allow the player to suppress the menu state change on the TV, so the menu on the TV will always be displayed, whatever the return value of this method is.
+ * so keypresses are always routed.
+ * @param newVal The new value.
+ * @return 1 when libCEC should use this new value, 0 otherwise.
+ */
+ CBCecMenuStateChangedType CBCecMenuStateChanged;
+
+#ifdef __cplusplus
+ ICECCallbacks(void) { Clear(); }
+ ~ICECCallbacks(void) { Clear(); };
+
+ void Clear(void)
+ {
+ CBCecLogMessage = NULL;
+ CBCecKeyPress = NULL;
+ CBCecCommand = NULL;
+ CBCecConfigurationChanged = NULL;
+ CBCecAlert = NULL;
+ CBCecMenuStateChanged = NULL;
+ }
+#endif
} ICECCallbacks;
typedef enum cec_client_version
CEC_CLIENT_VERSION_1_5_2 = 0x1502,
CEC_CLIENT_VERSION_1_5_3 = 0x1503,
CEC_CLIENT_VERSION_1_6_0 = 0x1600,
- CEC_CLIENT_VERSION_1_6_1 = 0x1601
+ CEC_CLIENT_VERSION_1_6_1 = 0x1601,
+ CEC_CLIENT_VERSION_1_6_2 = 0x1602
} cec_client_version;
typedef enum cec_server_version
CEC_SERVER_VERSION_1_5_2 = 0x1502,
CEC_SERVER_VERSION_1_5_3 = 0x1503,
CEC_SERVER_VERSION_1_6_0 = 0x1600,
- CEC_SERVER_VERSION_1_6_1 = 0x1601
+ CEC_SERVER_VERSION_1_6_1 = 0x1601,
+ CEC_SERVER_VERSION_1_6_2 = 0x1602
} cec_server_version;
typedef struct libcec_configuration
uint16_t iFirmwareVersion; /*!< the firmware version of the adapter. added in 1.6.0 */
uint8_t bPowerOffDevicesOnStandby; /*!< put devices in standby when the PC/player is put in standby. added in 1.6.0 */
uint8_t bShutdownOnStandby; /*!< shutdown this PC when the TV is switched off. only used when bPowerOffOnStandby = 0. added in 1.6.0 */
+ char strDeviceLanguage[3]; /*!< the menu language used by the client. 3 character ISO 639-2 country code. see http://http://www.loc.gov/standards/iso639-2/ added in 1.6.2 */
+ uint32_t iFirmwareBuildDate; /*!< the build date of the firmware, in seconds since epoch. if not available, this value will be set to 0. added in 1.6.2 */
#ifdef __cplusplus
+ libcec_configuration(void) { Clear(); }
+ ~libcec_configuration(void) { Clear(); }
+
+ bool operator==(const libcec_configuration &other) const
+ {
+ return ( clientVersion == other.clientVersion &&
+ !strncmp(strDeviceName, other.strDeviceName, 13) &&
+ deviceTypes == other.deviceTypes &&
+ bAutodetectAddress == other.bAutodetectAddress &&
+ iPhysicalAddress == other.iPhysicalAddress &&
+ baseDevice == other.baseDevice &&
+ iHDMIPort == other.iHDMIPort &&
+ tvVendor == other.tvVendor &&
+ wakeDevices == other.wakeDevices &&
+ powerOffDevices == other.powerOffDevices &&
+ serverVersion == other.serverVersion &&
+ bGetSettingsFromROM == other.bGetSettingsFromROM &&
+ bUseTVMenuLanguage == other.bUseTVMenuLanguage &&
+ bActivateSource == other.bActivateSource &&
+ bPowerOffScreensaver == other.bPowerOffScreensaver &&
+ bPowerOffOnStandby == other.bPowerOffOnStandby &&
+ bSendInactiveSource == other.bSendInactiveSource &&
+ /* libcec 1.5.3+ */
+ (other.serverVersion < CEC_SERVER_VERSION_1_5_3 || logicalAddresses == other.logicalAddresses) &&
+ /* libcec 1.6.0+ */
+ (other.serverVersion < CEC_SERVER_VERSION_1_6_0 || iFirmwareVersion == other.iFirmwareVersion) &&
+ (other.serverVersion < CEC_SERVER_VERSION_1_6_0 || bPowerOffDevicesOnStandby == other.bPowerOffDevicesOnStandby) &&
+ (other.serverVersion < CEC_SERVER_VERSION_1_6_0 || bShutdownOnStandby == other.bShutdownOnStandby) &&
+ /* libcec 1.6.2+ */
+ (other.serverVersion < CEC_SERVER_VERSION_1_6_2 || !strncmp(strDeviceLanguage, other.strDeviceLanguage, 3)) &&
+ (other.serverVersion < CEC_SERVER_VERSION_1_6_2 || iFirmwareBuildDate == other.iFirmwareBuildDate));
+ }
+
+ bool operator!=(const libcec_configuration &other) const
+ {
+ return !(*this == other);
+ }
+
+ /*!
+ * @brief Reset this configution struct to the default values.
+ */
void Clear(void)
{
+ iPhysicalAddress = CEC_PHYSICAL_ADDRESS_TV;
+ baseDevice = (cec_logical_address)CEC_DEFAULT_BASE_DEVICE;
+ iHDMIPort = CEC_DEFAULT_HDMI_PORT;
+ tvVendor = (uint64_t)CEC_VENDOR_UNKNOWN;
+ clientVersion = (uint32_t)CEC_CLIENT_VERSION_PRE_1_5;
+ serverVersion = (uint32_t)CEC_SERVER_VERSION_PRE_1_5;
+ bAutodetectAddress = CEC_DEFAULT_SETTING_AUTODETECT_ADDRESS;
+ bGetSettingsFromROM = CEC_DEFAULT_SETTING_GET_SETTINGS_FROM_ROM;
+ bUseTVMenuLanguage = CEC_DEFAULT_SETTING_USE_TV_MENU_LANGUAGE;
+ bActivateSource = CEC_DEFAULT_SETTING_ACTIVATE_SOURCE;
+ bPowerOffScreensaver = CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER;
+ bPowerOffOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY;
+ bShutdownOnStandby = CEC_DEFAULT_SETTING_SHUTDOWN_ON_STANDBY;
+ bSendInactiveSource = CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE;
+ iFirmwareVersion = CEC_FW_VERSION_UNKNOWN;
+ bPowerOffDevicesOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_DEVICES_STANDBY;
+ memcpy(strDeviceLanguage, CEC_DEFAULT_DEVICE_LANGUAGE, 3);
+ iFirmwareBuildDate = CEC_FW_BUILD_UNKNOWN;
+
memset(strDeviceName, 0, 13);
deviceTypes.clear();
- iPhysicalAddress = 0;
- baseDevice = (cec_logical_address)CEC_DEFAULT_BASE_DEVICE;
- iHDMIPort = CEC_DEFAULT_HDMI_PORT;
- tvVendor = (uint64_t)CEC_VENDOR_UNKNOWN;
- clientVersion = (uint32_t)CEC_CLIENT_VERSION_PRE_1_5;
- serverVersion = (uint32_t)CEC_SERVER_VERSION_PRE_1_5;
+ logicalAddresses.Clear();
wakeDevices.Clear();
powerOffDevices.Clear();
- bAutodetectAddress = 1;
- bGetSettingsFromROM = 0;
- bUseTVMenuLanguage = CEC_DEFAULT_SETTING_USE_TV_MENU_LANGUAGE;
- bActivateSource = CEC_DEFAULT_SETTING_ACTIVATE_SOURCE;
#if CEC_DEFAULT_SETTING_POWER_OFF_SHUTDOWN == 1
powerOffDevices.Set(CECDEVICE_BROADCAST);
#endif
#if CEC_DEFAULT_SETTING_ACTIVATE_SOURCE == 1
wakeDevices.Set(CECDEVICE_TV);
#endif
- bPowerOffScreensaver = CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER;
- bPowerOffOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY;
- bShutdownOnStandby = CEC_DEFAULT_SETTING_SHUTDOWN_ON_STANDBY;
- bSendInactiveSource = CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE;
- logicalAddresses.Clear();
- iFirmwareVersion = CEC_FW_VERSION_UNKNOWN;
- bPowerOffDevicesOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_DEVICES_STANDBY;
- callbackParam = NULL;
- callbacks = NULL;
+ callbackParam = NULL;
+ callbacks = NULL;
}
#endif
} libcec_configuration;
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="$(OutDir)libcec.x64.lib"
- OutputFile="$(OutDir)\$(ProjectName).x64.dll"
+ AdditionalDependencies=""$(OutDir)libcec.x64.lib""
+ OutputFile=""$(OutDir)\$(ProjectName).x64.dll""
LinkIncremental="2"
GenerateDebugInformation="true"
AssemblyDebug="1"
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="$(OutDir)libcec.x64.lib"
+ AdditionalDependencies=""$(OutDir)libcec.x64.lib""
/>
<Tool
Name="VCALinkTool"
InstallDirRegKey HKLM "Software\Pulse-Eight\USB-CEC Adapter software" ""
RequestExecutionLevel admin
Var StartMenuFolder
+Var VSRedistSetupError
+Var VSRedistInstalled
!define MUI_FINISHPAGE_LINK "Visit http://www.pulse-eight.com/ for more information."
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.pulse-eight.com/"
SectionEnd
+!define REDISTRIBUTABLE_SECTIONNAME "Microsoft Visual C++ 2010 Redistributable Package"
+Section "" SecVCRedist
+ SetShellVarContext current
+ SectionIn 1 3
+
+
+ ${If} $VSRedistInstalled != "Yes"
+ ; Download redistributable
+ SetOutPath "$TEMP\vc20XX"
+ ${If} ${RunningX64}
+ NSISdl::download http://packages.pulse-eight.net/windows/vcredist_x64.exe vcredist_x64.exe
+ ExecWait '"$TEMP\vc20XX\vcredist_x64.exe" /q' $VSRedistSetupError
+ ${Else}
+ NSISdl::download http://packages.pulse-eight.net/windows/vcredist_x86.exe vcredist_x86.exe
+ ExecWait '"$TEMP\vc20XX\vcredist_x86.exe" /q' $VSRedistSetupError
+ ${Endif}
+ RMDIR /r "$TEMP\vc20XX"
+ ${Endif}
+
+SectionEnd
+
+Function .onInit
+
+ ; SP0 x86
+ ReadRegDword $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{196BB40D-1578-3D01-B289-BEFC77A11A1E}" "Version"
+ ${If} $1 != ""
+ StrCpy $VSRedistInstalled "Yes"
+ ${Endif}
+
+ ; SP0 x64
+ ReadRegDword $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}" "Version"
+ ${If} $1 != ""
+ StrCpy $VSRedistInstalled "Yes"
+ ${Endif}
+
+ ; SP0 ia64
+ ReadRegDword $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C1A35166-4301-38E9-BA67-02823AD72A1B}" "Version"
+ ${If} $1 != ""
+ StrCpy $VSRedistInstalled "Yes"
+ ${Endif}
+
+ ; SP1 x86
+ ReadRegDword $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{F0C3E5D1-1ADE-321E-8167-68EF0DE699A5}" "Version"
+ ${If} $1 != ""
+ StrCpy $VSRedistInstalled "Yes"
+ ${Endif}
+
+ ; SP1 x64
+ ReadRegDword $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1D8E6291-B0D5-35EC-8441-6616F567A0F7}" "Version"
+ ${If} $1 != ""
+ StrCpy $VSRedistInstalled "Yes"
+ ${Endif}
+
+ ; SP1 ia64
+ ReadRegDword $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{88C73C1C-2DE5-3B01-AFB8-B46EF4AB41CD}" "Version"
+ ${If} $1 != ""
+ StrCpy $VSRedistInstalled "Yes"
+ ${Endif}
+
+ ${If} $VSRedistInstalled == "Yes"
+ !insertMacro UnSelectSection ${SecVCRedist}
+ SectionSetText ${SecVCRedist} ""
+ ${Else}
+ !insertMacro SelectSection ${SecVCRedist}
+ SectionSetText ${SecVCRedist} "${REDISTRIBUTABLE_SECTIONNAME}"
+ ${Endif}
+
+FunctionEnd
+
;--------------------------------
;Uninstaller Section
Config = new LibCECConfiguration();
Config.DeviceTypes.Types[0] = CecDeviceType.RecordingDevice;
Config.DeviceName = "CEC Tester";
- Config.ClientVersion = CecClientVersion.Version1_6_1;
+ Config.ClientVersion = CecClientVersion.Version1_6_2;
Config.SetCallbacks(this);
LogLevel = (int)CecLogLevel.All;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.6.1.0")]
-[assembly: AssemblyFileVersion("1.6.1.0")]
+[assembly: AssemblyVersion("1.6.2.0")]
+[assembly: AssemblyFileVersion("1.6.2.0")]
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];
-[assembly:AssemblyVersionAttribute("1.6.1.0")];
+[assembly:AssemblyVersionAttribute("1.6.2.0")];
[assembly:ComVisible(false)];
[assembly:CLSCompliantAttribute(true)];
Version1_5_2 = 0x1502,
Version1_5_3 = 0x1503,
Version1_6_0 = 0x1600,
- Version1_6_1 = 0x1601
+ Version1_6_1 = 0x1601,
+ Version1_6_2 = 0x1602
};
public enum class CecServerVersion
Version1_5_2 = 0x1502,
Version1_5_3 = 0x1503,
Version1_6_0 = 0x1600,
- Version1_6_1 = 0x1601
+ Version1_6_1 = 0x1601,
+ Version1_6_2 = 0x1602
};
public ref class CecAdapter
PowerOffScreensaver = CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER == 1;
PowerOffOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY == 1;
- SendInactiveSource = CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE == 1;
- LogicalAddresses = gcnew CecLogicalAddresses();
- FirmwareVersion = 1;
- PowerOffDevicesOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_DEVICES_STANDBY == 1;
+
+ SendInactiveSource = CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE == 1;
+ LogicalAddresses = gcnew CecLogicalAddresses();
+ FirmwareVersion = 1;
+ PowerOffDevicesOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_DEVICES_STANDBY == 1;
+ ShutdownOnStandby = CEC_DEFAULT_SETTING_SHUTDOWN_ON_STANDBY == 1;
+ DeviceLanguage = "";
}
void SetCallbacks(CecCallbackMethods ^callbacks)
PowerOffScreensaver = config.bPowerOffScreensaver == 1;
PowerOffOnStandby = config.bPowerOffOnStandby == 1;
- if (ServerVersion >= CecServerVersion::Version1_5_1)
- SendInactiveSource = config.bSendInactiveSource == 1;
+ if (ServerVersion >= CecServerVersion::Version1_5_1)
+ SendInactiveSource = config.bSendInactiveSource == 1;
- if (ServerVersion >= CecServerVersion::Version1_5_3)
- {
- LogicalAddresses->Clear();
- for (uint8_t iPtr = 0; iPtr <= 16; iPtr++)
- if (config.logicalAddresses[iPtr])
- LogicalAddresses->Set((CecLogicalAddress)iPtr);
- }
+ if (ServerVersion >= CecServerVersion::Version1_5_3)
+ {
+ LogicalAddresses->Clear();
+ for (uint8_t iPtr = 0; iPtr <= 16; iPtr++)
+ if (config.logicalAddresses[iPtr])
+ LogicalAddresses->Set((CecLogicalAddress)iPtr);
+ }
- if (ServerVersion >= CecServerVersion::Version1_6_0)
- {
- FirmwareVersion = config.iFirmwareVersion;
- PowerOffDevicesOnStandby = config.bPowerOffDevicesOnStandby == 1;
- }
+ if (ServerVersion >= CecServerVersion::Version1_6_0)
+ {
+ FirmwareVersion = config.iFirmwareVersion;
+ PowerOffDevicesOnStandby = config.bPowerOffDevicesOnStandby == 1;
+ ShutdownOnStandby = config.bShutdownOnStandby == 1;
+ }
+
+ if (ServerVersion >= CecServerVersion::Version1_6_2)
+ DeviceLanguage = gcnew System::String(config.strDeviceLanguage);
}
property System::String ^ DeviceName;
property CecLogicalAddresses ^PowerOffDevices;
property bool PowerOffScreensaver;
property bool PowerOffOnStandby;
- property bool SendInactiveSource;
- property CecLogicalAddresses ^LogicalAddresses;
- property uint16_t FirmwareVersion;
- property bool PowerOffDevicesOnStandby;
-
+ property bool SendInactiveSource;
+ property CecLogicalAddresses ^LogicalAddresses;
+ property uint16_t FirmwareVersion;
+ property bool PowerOffDevicesOnStandby;
+ property bool ShutdownOnStandby;
+ property System::String ^ DeviceLanguage;
property CecCallbackMethods ^ Callbacks;
};
typedef int (__stdcall *COMMANDCB)(const CEC::cec_command &command);
typedef int (__stdcall *CONFIGCB) (const CEC::libcec_configuration &config);
typedef int (__stdcall *ALERTCB) (const CEC::libcec_alert, const CEC::libcec_parameter &data);
+ typedef int (__stdcall *MENUCB) (const CEC::cec_menu_state newVal);
static LOGCB g_logCB;
static KEYCB g_keyCB;
static COMMANDCB g_commandCB;
static CONFIGCB g_configCB;
static ALERTCB g_alertCB;
+ static MENUCB g_menuCB;
static CEC::ICECCallbacks g_cecCallbacks;
int CecLogMessageCB(void *cbParam, const CEC::cec_log_message &message)
return 0;
}
+ int CecMenuCB(void *cbParam, const CEC::cec_menu_state newVal)
+ {
+ if (g_menuCB)
+ return g_menuCB(newVal);
+ return 0;
+ }
+
#pragma managed
// delegates for the unmanaged callback methods
public delegate int CecLogMessageManagedDelegate(const CEC::cec_log_message &);
public delegate int CecCommandManagedDelegate(const CEC::cec_command &);
public delegate int CecConfigManagedDelegate(const CEC::libcec_configuration &);
public delegate int CecAlertManagedDelegate(const CEC::libcec_alert, const CEC::libcec_parameter &);
+ public delegate int CecMenuManagedDelegate(const CEC::cec_menu_state newVal);
// callback method interface
public ref class CecCallbackMethods
return 0;
}
+ virtual int ReceiveMenuStateChange(CecMenuState newVal)
+ {
+ return 0;
+ }
+
protected:
// managed callback methods
int CecLogMessageManaged(const CEC::cec_log_message &message)
return iReturn;
}
+ int CecMenuManaged(const CEC::cec_menu_state newVal)
+ {
+ int iReturn(0);
+ if (m_bHasCallbacks)
+ {
+ iReturn = m_callbacks->ReceiveMenuStateChange((CecMenuState)newVal);
+ }
+ return iReturn;
+ }
+
void DestroyDelegates()
{
m_bHasCallbacks = false;
m_logMessageGCHandle.Free();
m_keypressGCHandle.Free();
m_commandGCHandle.Free();
+ m_alertGCHandle.Free();
+ m_menuGCHandle.Free();
}
}
g_alertCB = static_cast<ALERTCB>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_alertDelegate).ToPointer());
g_cecCallbacks.CBCecAlert = CecAlertCB;
+ // create the delegate method for the menu callback
+ m_menuDelegate = gcnew CecMenuManagedDelegate(this, &CecCallbackMethods::CecMenuManaged);
+ m_menuGCHandle = System::Runtime::InteropServices::GCHandle::Alloc(m_menuDelegate);
+ g_menuCB = static_cast<MENUCB>(System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(m_menuDelegate).ToPointer());
+ g_cecCallbacks.CBCecMenuStateChanged = CecMenuCB;
+
delete context;
m_bDelegatesCreated = true;
}
static System::Runtime::InteropServices::GCHandle m_alertGCHandle;
CONFIGCB m_alertCallback;
+ CecMenuManagedDelegate ^ m_menuDelegate;
+ static System::Runtime::InteropServices::GCHandle m_menuGCHandle;
+ MENUCB m_menuCallback;
+
CecCallbackMethods ^ m_callbacks;
bool m_bHasCallbacks;
bool m_bDelegatesCreated;
config.bPowerOffScreensaver = netConfig->PowerOffScreensaver ? 1 : 0;
config.bPowerOffOnStandby = netConfig->PowerOffOnStandby ? 1 : 0;
- if (netConfig->ServerVersion >= CecServerVersion::Version1_5_1)
- config.bSendInactiveSource = netConfig->SendInactiveSource ? 1 : 0;
+ if (netConfig->ServerVersion >= CecServerVersion::Version1_5_1)
+ config.bSendInactiveSource = netConfig->SendInactiveSource ? 1 : 0;
- if (netConfig->ServerVersion >= CecServerVersion::Version1_6_0)
- config.bPowerOffDevicesOnStandby = netConfig->PowerOffDevicesOnStandby ? 1 : 0;
+ if (netConfig->ServerVersion >= CecServerVersion::Version1_6_0)
+ {
+ config.bPowerOffDevicesOnStandby = netConfig->PowerOffDevicesOnStandby ? 1 : 0;
+ config.bShutdownOnStandby = netConfig->ShutdownOnStandby ? 1 : 0;
+ }
+
+ if (netConfig->ServerVersion >= CecServerVersion::Version1_6_2)
+ _snprintf_s(config.strDeviceLanguage, 3, context->marshal_as<const char*>(netConfig->DeviceLanguage));
config.callbacks = &g_cecCallbacks;
}
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.6.1.0")]
-[assembly: AssemblyFileVersion("1.6.1.0")]
+[assembly: AssemblyVersion("1.6.2.0")]
+[assembly: AssemblyFileVersion("1.6.2.0")]
g_callbacks.CBCecLogMessage = &CecLogMessage;
g_callbacks.CBCecKeyPress = &CecKeyPress;
g_callbacks.CBCecCommand = &CecCommand;
- g_callbacks.CBCecConfigurationChanged = NULL;
- g_callbacks.CBCecAlert = NULL;
adapter->EnableCallbacks(NULL, &g_callbacks);
}
uint16_t FindPhysicalAddress(void)
{
PrintToStdOut("=== Physical Address Configuration ===\n");
- uint16_t iAddress(0xFFFF);
+ uint16_t iAddress(CEC_INVALID_PHYSICAL_ADDRESS);
PrintToStdOut("Do you want to let libCEC try to autodetect the address (y/n)?");
string input;
else
{
iAddress = g_parser->GetDevicePhysicalAddress(g_primaryAddress);
- if (iAddress == 0 || iAddress == 0xFFFF)
+ if (iAddress == 0 || iAddress == CEC_INVALID_PHYSICAL_ADDRESS)
PrintToStdOut("Failed. Please enter the address manually, or restart this wizard and use different settings.");
}
}
- if (iAddress == 0 || iAddress == 0xFFFF)
+ if (iAddress == 0 || iAddress == CEC_INVALID_PHYSICAL_ADDRESS)
{
- PrintToStdOut("Please enter the physical address (0000 - FFFF), followed by <enter>.");
+ PrintToStdOut("Please enter the physical address (0001 - FFFE), followed by <enter>.");
getline(cin, input);
cin.clear();
int iAddressTmp;
if (sscanf(input.c_str(), "%x", &iAddressTmp) == 1)
{
- if (iAddressTmp < 0 || iAddressTmp > 0xFFFF)
- iAddressTmp = 0xFFFF;
+ if (iAddressTmp <= CEC_PHYSICAL_ADDRESS_TV || iAddressTmp > CEC_MAX_PHYSICAL_ADDRESS)
+ iAddressTmp = CEC_INVALID_PHYSICAL_ADDRESS;
iAddress = (uint16_t)iAddressTmp;
}
}
using namespace std;
using namespace PLATFORM;
+#define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000
+
CCECProcessor::CCECProcessor(CLibCEC *controller, libcec_configuration *configuration) :
m_bConnectionOpened(false),
m_bInitialised(false),
{
CreateBusDevices();
m_configuration.Clear();
- m_configuration.serverVersion = CEC_SERVER_VERSION_1_6_1;
+ m_configuration.serverVersion = LIBCEC_VERSION_CURRENT;
SetConfiguration(configuration);
if (m_configuration.tvVendor != CEC_VENDOR_UNKNOWN)
m_iLastTransmission(0)
{
m_configuration.Clear();
- m_configuration.serverVersion = CEC_SERVER_VERSION_1_6_1;
+ m_configuration.serverVersion = LIBCEC_VERSION_CURRENT;
// client version < 1.5.0
m_configuration.clientVersion = (uint32_t)CEC_CLIENT_VERSION_PRE_1_5;
void CCECProcessor::CreateBusDevices(void)
{
- for (int iPtr = 0; iPtr < 16; iPtr++)
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr <= CECDEVICE_BROADCAST; iPtr++)
{
switch(iPtr)
{
case CECDEVICE_AUDIOSYSTEM:
- m_busDevices[iPtr] = new CCECAudioSystem(this, (cec_logical_address) iPtr, 0xFFFF);
+ m_busDevices[iPtr] = new CCECAudioSystem(this, (cec_logical_address) iPtr);
break;
case CECDEVICE_PLAYBACKDEVICE1:
case CECDEVICE_PLAYBACKDEVICE2:
case CECDEVICE_PLAYBACKDEVICE3:
- m_busDevices[iPtr] = new CCECPlaybackDevice(this, (cec_logical_address) iPtr, 0xFFFF);
+ m_busDevices[iPtr] = new CCECPlaybackDevice(this, (cec_logical_address) iPtr);
break;
case CECDEVICE_RECORDINGDEVICE1:
case CECDEVICE_RECORDINGDEVICE2:
case CECDEVICE_RECORDINGDEVICE3:
- m_busDevices[iPtr] = new CCECRecordingDevice(this, (cec_logical_address) iPtr, 0xFFFF);
+ m_busDevices[iPtr] = new CCECRecordingDevice(this, (cec_logical_address) iPtr);
break;
case CECDEVICE_TUNER1:
case CECDEVICE_TUNER2:
case CECDEVICE_TUNER3:
case CECDEVICE_TUNER4:
- m_busDevices[iPtr] = new CCECTuner(this, (cec_logical_address) iPtr, 0xFFFF);
+ m_busDevices[iPtr] = new CCECTuner(this, (cec_logical_address) iPtr);
break;
case CECDEVICE_TV:
- m_busDevices[iPtr] = new CCECTV(this, (cec_logical_address) iPtr, 0);
+ m_busDevices[iPtr] = new CCECTV(this, (cec_logical_address) iPtr);
break;
default:
- m_busDevices[iPtr] = new CCECBusDevice(this, (cec_logical_address) iPtr, 0xFFFF);
+ m_busDevices[iPtr] = new CCECBusDevice(this, (cec_logical_address) iPtr);
break;
}
}
{
Close();
- for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr <= CECDEVICE_BROADCAST; iPtr++)
{
delete m_busDevices[iPtr];
m_busDevices[iPtr] = NULL;
{
CLibCEC::AddLog(CEC_LOG_ERROR, "could not open a connection (try %d)", ++iConnectTry);
m_communication->Close();
- CEvent::Sleep(1000);
+ CEvent::Sleep(CEC_DEFAULT_CONNECT_RETRY_WAIT);
}
if (bReturn)
{
m_configuration.iFirmwareVersion = m_communication->GetFirmwareVersion();
- CLibCEC::AddLog(CEC_LOG_NOTICE, "connected to the CEC adapter. firmware version = %d, client version = %s", m_configuration.iFirmwareVersion, ToString((cec_client_version)m_configuration.clientVersion));
+ m_configuration.iFirmwareBuildDate = m_communication->GetFirmwareBuildDate();
+ CStdString strLog;
+ strLog.Format("connected to the CEC adapter. libCEC version = %s, client version = %s, firmware version = %d", ToString((cec_server_version)m_configuration.serverVersion), ToString((cec_client_version)m_configuration.clientVersion), m_configuration.iFirmwareVersion);
+ if (m_configuration.iFirmwareBuildDate != CEC_FW_BUILD_UNKNOWN)
+ {
+ time_t buildTime = (time_t)m_configuration.iFirmwareBuildDate;
+ strLog.AppendFormat(", firmware build date: %s", asctime(gmtime(&buildTime)));
+ strLog = strLog.Left((int)strLog.length() - 1); // strip \n added by asctime
+ strLog.append(" +0000");
+ }
+ CLibCEC::AddLog(CEC_LOG_NOTICE, strLog);
}
if (m_configuration.bGetSettingsFromROM == 1)
CLockObject lock(m_mutex);
if (!config.deviceTypes.IsEmpty())
m_configuration.deviceTypes = config.deviceTypes;
- if (config.iPhysicalAddress > 0)
+ if (IsValidPhysicalAddress(config.iPhysicalAddress))
m_configuration.iPhysicalAddress = config.iPhysicalAddress;
snprintf(m_configuration.strDeviceName, 13, "%s", config.strDeviceName);
}
bool CCECProcessor::IsInitialised(void)
{
- CLockObject lock(m_mutex);
+ CLockObject lock(m_threadMutex);
return m_bInitialised;
}
/* make the primary device the active source if the option is set */
if (m_configuration.bActivateSource == 1)
m_busDevices[m_configuration.logicalAddresses.primary]->m_bActiveSource = true;
+
+ /* set the default menu language for devices we control */
+ cec_menu_language language;
+ language.device = m_configuration.logicalAddresses.primary;
+ memcpy(language.language, m_configuration.strDeviceLanguage, 3);
+ language.language[3] = 0;
+
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr < CECDEVICE_BROADCAST; iPtr++)
+ {
+ if (m_configuration.logicalAddresses[iPtr])
+ {
+ language.device = (cec_logical_address) iPtr;
+ m_busDevices[iPtr]->SetMenuLanguage(language);
+ }
+ }
}
/* get the vendor id from the TV, so we are using the correct handler */
m_busDevices[CECDEVICE_TV]->GetVendorId();
- if (m_configuration.iPhysicalAddress != 0)
+ if (IsValidPhysicalAddress(m_configuration.iPhysicalAddress))
{
- CLibCEC::AddLog(CEC_LOG_NOTICE, "setting the physical address to %4x", m_configuration.iPhysicalAddress);
+ CLibCEC::AddLog(CEC_LOG_NOTICE, "setting the physical address to %04X", m_configuration.iPhysicalAddress);
m_busDevices[m_configuration.logicalAddresses.primary]->m_iPhysicalAddress = m_configuration.iPhysicalAddress;
if ((bReturn = m_busDevices[m_configuration.logicalAddresses.primary]->TransmitPhysicalAddress()) == false)
- CLibCEC::AddLog(CEC_LOG_ERROR, "unable to set the physical address to %4x", m_configuration.iPhysicalAddress);
+ CLibCEC::AddLog(CEC_LOG_ERROR, "unable to set the physical address to %04X", m_configuration.iPhysicalAddress);
+ }
+ else
+ {
+ if (!SetHDMIPort(m_configuration.baseDevice, m_configuration.iHDMIPort, true))
+ CLibCEC::AddLog(CEC_LOG_ERROR, "unable to set HDMI port %d on %s (%x)", m_configuration.iHDMIPort, ToString(m_configuration.baseDevice), (uint8_t)m_configuration.baseDevice);
+ bReturn = true;
}
- else if (m_configuration.iPhysicalAddress == 0 && (bReturn = SetHDMIPort(m_configuration.baseDevice, m_configuration.iHDMIPort, true)) == false)
- CLibCEC::AddLog(CEC_LOG_ERROR, "unable to set HDMI port %d on %s (%x)", m_configuration.iHDMIPort, ToString(m_configuration.baseDevice), (uint8_t)m_configuration.baseDevice);
if (bReturn && m_configuration.bActivateSource == 1)
m_busDevices[m_configuration.logicalAddresses.primary]->ActivateSource();
return bReturn;
}
-bool CCECProcessor::Start(const char *strPort, uint16_t iBaudRate /* = 38400 */, uint32_t iTimeoutMs /* = 10000 */)
+bool CCECProcessor::Start(const char *strPort, uint16_t iBaudRate /* = CEC_SERIAL_DEFAULT_BAUDRATE */, uint32_t iTimeoutMs /* = CEC_DEFAULT_CONNECT_TIMEOUT */)
{
bool bReturn(false);
CCECBusDevice *previousDevice = GetDeviceByType(from);
m_configuration.logicalAddresses.primary = CECDEVICE_UNKNOWN;
- for (unsigned int iPtr = 0; iPtr < 5; iPtr++)
+ for (uint8_t iPtr = 0; iPtr < 5; iPtr++)
{
if (m_configuration.deviceTypes.types[iPtr] == CEC_DEVICE_TYPE_RESERVED)
continue;
previousDevice->SetCecVersion(CEC_VERSION_UNKNOWN);
newDevice->SetMenuLanguage(previousDevice->GetMenuLanguage(false));
- cec_menu_language lang;
- lang.device = previousDevice->GetLogicalAddress();
- for (unsigned int iPtr = 0; iPtr < 4; iPtr++)
- lang.language[iPtr] = '?';
- lang.language[3] = 0;
- previousDevice->SetMenuLanguage(lang);
newDevice->SetMenuState(previousDevice->GetMenuState());
previousDevice->SetMenuState(CEC_MENU_STATE_DEACTIVATED);
newDevice->SetOSDName(previousDevice->GetOSDName(false));
previousDevice->SetOSDName(ToString(previousDevice->GetLogicalAddress()));
- newDevice->SetPhysicalAddress(previousDevice->GetPhysicalAddress(false));
- previousDevice->SetPhysicalAddress(0xFFFF);
+ newDevice->SetPhysicalAddress(previousDevice->GetPhysicalAddress());
+ previousDevice->SetPhysicalAddress(CEC_INVALID_PHYSICAL_ADDRESS);
newDevice->SetPowerStatus(previousDevice->GetPowerStatus(false));
previousDevice->SetPowerStatus(CEC_POWER_STATUS_UNKNOWN);
return false;
}
- for (unsigned int iPtr = 0; iPtr < 5; iPtr++)
+ for (uint8_t iPtr = 0; iPtr < 5; iPtr++)
{
if (m_configuration.deviceTypes.types[iPtr] == CEC_DEVICE_TYPE_RESERVED)
continue;
{
if (!IsInitialised())
return;
- for (uint8_t iPtr = 0; iPtr <= CECDEVICE_PLAYBACKDEVICE3; iPtr++)
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr <= CECDEVICE_PLAYBACKDEVICE3; iPtr++)
m_busDevices[iPtr]->ReplaceHandler(m_bInitialised);
}
while (!IsStopped() && m_communication->IsOpen())
{
- if (m_inBuffer.Pop(command, 500))
+ if (m_inBuffer.Pop(command, CEC_PROCESSOR_SIGNAL_WAIT_TIME))
ParseCommand(command);
if (IsInitialised())
if (type != CEC_DEVICE_TYPE_RESERVED)
{
- for (uint8_t iPtr = 0; iPtr <= 11; iPtr++)
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr <= CECDEVICE_PLAYBACKDEVICE3; iPtr++)
{
if (m_configuration.logicalAddresses[iPtr] && m_busDevices[iPtr]->m_type == type)
{
}
m_busDevices[addr]->SetActiveSource();
- if (m_busDevices[addr]->GetPhysicalAddress(false) != 0xFFFF)
+ if (IsValidPhysicalAddress(m_busDevices[addr]->GetPhysicalAddress()))
bReturn = m_busDevices[addr]->ActivateSource();
return bReturn;
bool bReturn(false);
// suppress polls when searching for a device
- CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamPath, false, true);
+ CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamPath);
if (device)
{
device->SetActiveSource();
bReturn = true;
}
+ else
+ {
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "device with PA '%04x' not found", iStreamPath);
+ }
return bReturn;
}
bool bReturn(false);
// limit the HDMI port range to 1-15
- if (iPort < 1)
- iPort = 1;
- if (iPort > 15)
- iPort = 15;
+ if (iPort < CEC_MIN_HDMI_PORTNUMBER ||
+ iPort > CEC_MAX_HDMI_PORTNUMBER)
+ return bReturn;
{
CLockObject lock(m_mutex);
m_configuration.baseDevice = iBaseDevice;
- m_configuration.iHDMIPort = iPort;
+ m_configuration.iHDMIPort = iPort;
}
if (!IsRunning() && !bForce)
uint16_t iPhysicalAddress(0);
if (iBaseDevice > CECDEVICE_TV)
- {
- iPhysicalAddress = m_busDevices[iBaseDevice]->GetPhysicalAddress();
- }
+ iPhysicalAddress = m_busDevices[iBaseDevice]->GetPhysicalAddress(false);
- if (iPhysicalAddress < 0xffff)
+ if (iPhysicalAddress <= CEC_MAX_PHYSICAL_ADDRESS)
{
if (iPhysicalAddress == 0)
iPhysicalAddress += 0x1000 * iPort;
}
if (!bReturn)
- CLibCEC::AddLog(CEC_LOG_ERROR, "failed to set the physical address");
- else
- SetPhysicalAddress(iPhysicalAddress);
+ {
+ CLibCEC::AddLog(CEC_LOG_WARNING, "failed to set the physical address to %04X, setting it to the default value %04X", iPhysicalAddress, CEC_DEFAULT_PHYSICAL_ADDRESS);
+ iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS;
+ }
+
+ SetPhysicalAddress(iPhysicalAddress);
return bReturn;
}
bool CCECProcessor::PhysicalAddressInUse(uint16_t iPhysicalAddress)
{
- for (unsigned int iPtr = 0; iPtr < 15; iPtr++)
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr < CECDEVICE_BROADCAST; iPtr++)
{
- if (m_busDevices[iPtr]->GetPhysicalAddress(false) == iPhysicalAddress)
+ if (m_busDevices[iPtr]->GetPhysicalAddress() == iPhysicalAddress)
return true;
}
return false;
bool CCECProcessor::SetMenuState(cec_menu_state state, bool bSendUpdate /* = true */)
{
- for (uint8_t iPtr = 0; iPtr < 16; iPtr++)
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr < CECDEVICE_BROADCAST; iPtr++)
{
if (m_configuration.logicalAddresses[iPtr])
m_busDevices[iPtr]->SetMenuState(state);
{
CLockObject lock(m_mutex);
m_configuration.iPhysicalAddress = iPhysicalAddress;
- CLibCEC::AddLog(CEC_LOG_DEBUG, "setting physical address to '%4x'", iPhysicalAddress);
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "setting physical address to '%04X'", iPhysicalAddress);
if (!m_configuration.logicalAddresses.IsEmpty())
{
bool bWasActiveSource(false);
- for (uint8_t iPtr = 0; iPtr < 15; iPtr++)
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr < CECDEVICE_BROADCAST; iPtr++)
if (m_configuration.logicalAddresses[iPtr])
{
bWasActiveSource |= m_busDevices[iPtr]->IsActiveSource();
}
}
- for (uint8_t iPtr = 0; iPtr < 15; iPtr++)
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr < CECDEVICE_BROADCAST; iPtr++)
if (sendUpdatesTo[iPtr])
m_busDevices[iPtr]->TransmitPhysicalAddress();
uint8_t CCECProcessor::VolumeUp(bool bSendRelease /* = true */)
{
- uint8_t status = 0;
+ uint8_t status(CEC_AUDIO_VOLUME_STATUS_UNKNOWN);
if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM))
status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->VolumeUp(bSendRelease);
uint8_t CCECProcessor::VolumeDown(bool bSendRelease /* = true */)
{
- uint8_t status = 0;
+ uint8_t status(CEC_AUDIO_VOLUME_STATUS_UNKNOWN);
if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM))
status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->VolumeDown(bSendRelease);
uint8_t CCECProcessor::MuteAudio(bool bSendRelease /* = true */)
{
- uint8_t status = 0;
+ uint8_t status(CEC_AUDIO_VOLUME_STATUS_UNKNOWN);
if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM))
status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->MuteAudio(bSendRelease);
return status;
}
-CCECBusDevice *CCECProcessor::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress, bool bRefresh /* = false */, bool bSuppressPoll /* = false */) const
+CCECBusDevice *CCECProcessor::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress, bool bSuppressUpdate /* = true */)
{
- if (m_busDevices[m_configuration.logicalAddresses.primary]->GetPhysicalAddress(false) == iPhysicalAddress)
- return m_busDevices[m_configuration.logicalAddresses.primary];
+ CCECBusDevice *device(NULL);
- CCECBusDevice *device = NULL;
- for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
+ // check each device until we found a match
+ for (uint8_t iPtr = CECDEVICE_TV; !device && iPtr < CECDEVICE_BROADCAST; iPtr++)
{
- if (m_busDevices[iPtr]->GetPhysicalAddress(bRefresh, bSuppressPoll) == iPhysicalAddress)
- {
+ if (m_busDevices[iPtr]->GetPhysicalAddress(bSuppressUpdate) == iPhysicalAddress)
device = m_busDevices[iPtr];
- break;
- }
}
return device;
{
CCECBusDevice *device = NULL;
- for (uint8_t iPtr = 0; iPtr < 16; iPtr++)
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr < CECDEVICE_BROADCAST; iPtr++)
{
if (m_busDevices[iPtr]->m_type == type && m_configuration.logicalAddresses[iPtr])
{
return false;
}
+CStdString CCECProcessor::GetDeviceName(void) const
+{
+ CStdString strName;
+ strName = m_configuration.strDeviceName;
+ return strName;
+}
+
uint64_t CCECProcessor::GetDeviceVendorId(cec_logical_address iAddress)
{
if (m_busDevices[iAddress])
return CEC_POWER_STATUS_UNKNOWN;
}
-cec_logical_address CCECProcessor::GetActiveSource(void)
+cec_logical_address CCECProcessor::GetActiveSource(bool bRequestActiveSource /* = true */)
{
- for (uint8_t iPtr = 0; iPtr <= 11; iPtr++)
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr <= CECDEVICE_PLAYBACKDEVICE3; iPtr++)
{
if (m_busDevices[iPtr]->IsActiveSource())
return (cec_logical_address)iPtr;
}
+ if (bRequestActiveSource && m_configuration.logicalAddresses.primary != CECDEVICE_UNKNOWN)
+ {
+ CCECBusDevice *primary = m_busDevices[m_configuration.logicalAddresses.primary];
+ if (primary)
+ primary->RequestActiveSource();
+
+ return GetActiveSource(false);
+ }
+
return CECDEVICE_UNKNOWN;
}
bool CCECProcessor::IsActiveSource(cec_logical_address iAddress)
{
- return iAddress > CECDEVICE_TV && iAddress < CECDEVICE_BROADCAST ?
+ return iAddress >= CECDEVICE_TV && iAddress < CECDEVICE_BROADCAST ?
m_busDevices[iAddress]->IsActiveSource() :
false;
}
iMaxTries = m_busDevices[data.initiator]->GetHandler()->GetTransmitRetries() + 1;
}
- return m_communication->Write(data, iMaxTries, m_iStandardLineTimeout, m_iRetryLineTimeout)
- == ADAPTER_MESSAGE_STATE_SENT_ACKED;
+ bool bRetry(true);
+ uint8_t iTries(0);
+ uint8_t iLineTimeout = m_iStandardLineTimeout;
+ cec_adapter_message_state adapterState = ADAPTER_MESSAGE_STATE_UNKNOWN;
+
+ while (bRetry && ++iTries < iMaxTries)
+ {
+ if (m_busDevices[data.initiator]->IsUnsupportedFeature(data.opcode))
+ return false;
+
+ adapterState = m_communication->Write(data, bRetry, iLineTimeout);
+ iLineTimeout = m_iRetryLineTimeout;
+ }
+
+ return adapterState == ADAPTER_MESSAGE_STATE_SENT_ACKED;
}
void CCECProcessor::TransmitAbort(cec_logical_address address, cec_opcode opcode, cec_abort_reason reason /* = CEC_ABORT_REASON_UNRECOGNIZED_OPCODE */)
{
cec_logical_addresses addresses;
addresses.Clear();
- for (unsigned int iPtr = 0; iPtr < 15; iPtr++)
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr < CECDEVICE_BROADCAST; iPtr++)
{
if (m_busDevices[iPtr]->GetStatus() == CEC_DEVICE_STATUS_PRESENT)
addresses.Set((cec_logical_address) iPtr);
bool CCECProcessor::IsPresentDeviceType(cec_device_type type)
{
- for (unsigned int iPtr = 0; iPtr < 15; iPtr++)
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr < CECDEVICE_BROADCAST; iPtr++)
{
if (m_busDevices[iPtr]->GetType() == type && m_busDevices[iPtr]->GetStatus() == CEC_DEVICE_STATUS_PRESENT)
return true;
uint16_t CCECProcessor::GetPhysicalAddress(void) const
{
if (!m_configuration.logicalAddresses.IsEmpty() && m_busDevices[m_configuration.logicalAddresses.primary])
- return m_busDevices[m_configuration.logicalAddresses.primary]->GetPhysicalAddress(false);
+ return m_busDevices[m_configuration.logicalAddresses.primary]->GetPhysicalAddress();
return false;
}
bool CCECProcessor::SetAckMask(uint16_t iMask)
{
- return m_communication->SetAckMask(iMask);
+ return m_communication ? m_communication->SetAckMask(iMask) : false;
}
bool CCECProcessor::TransmitKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait /* = true */)
{
CLibCEC::AddLog(CEC_LOG_WARNING, "deprecated method %s called", __FUNCTION__);
uint16_t iPhysicalAddress = m_communication->GetPhysicalAddress();
- if (iPhysicalAddress != 0)
+ if (IsValidPhysicalAddress(iPhysicalAddress))
{
m_configuration.bAutodetectAddress = 1;
- m_configuration.iPhysicalAddress = iPhysicalAddress;
- m_configuration.baseDevice = CECDEVICE_UNKNOWN;
- m_configuration.iHDMIPort = 0;
+ m_configuration.iPhysicalAddress = iPhysicalAddress;
+ m_configuration.baseDevice = CECDEVICE_UNKNOWN;
+ m_configuration.iHDMIPort = CEC_HDMI_PORTNUMBER_NONE;
return SetPhysicalAddress(iPhysicalAddress);
}
return false;
if (address == CECDEVICE_BROADCAST && m_configuration.clientVersion >= CEC_CLIENT_VERSION_1_5_0)
{
bool bReturn(true);
- for (uint8_t iPtr = 0; iPtr <= 0xF; iPtr++)
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr <= CECDEVICE_BROADCAST; iPtr++)
{
if (m_configuration.powerOffDevices[iPtr])
+ {
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - putting '%s' in standby mode", __FUNCTION__, ToString((cec_logical_address)iPtr));
bReturn &= m_busDevices[iPtr]->Standby();
+ }
}
return bReturn;
}
if (address == CECDEVICE_BROADCAST && m_configuration.clientVersion >= CEC_CLIENT_VERSION_1_5_0)
{
bool bReturn(true);
- for (uint8_t iPtr = 0; iPtr <= 0xF; iPtr++)
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr <= CECDEVICE_BROADCAST; iPtr++)
{
- if (m_configuration.powerOffDevices[iPtr])
+ if (m_configuration.wakeDevices[iPtr])
+ {
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - powering on '%s'", __FUNCTION__, ToString((cec_logical_address)iPtr));
bReturn &= m_busDevices[iPtr]->PowerOn();
+ }
}
return bReturn;
}
return "info index search reverse";
case CEC_DECK_INFO_OTHER_STATUS:
return "other";
+ case CEC_DECK_INFO_OTHER_STATUS_LG:
+ return "LG other";
default:
return "unknown";
}
return "1.6.0";
case CEC_CLIENT_VERSION_1_6_1:
return "1.6.1";
+ case CEC_CLIENT_VERSION_1_6_2:
+ return "1.6.2";
default:
return "Unknown";
}
return "1.6.0";
case CEC_SERVER_VERSION_1_6_1:
return "1.6.1";
+ case CEC_SERVER_VERSION_1_6_2:
+ return "1.6.2";
default:
return "Unknown";
}
}
-void *CCECBusScan::Process(void)
-{
- CCECBusDevice *device(NULL);
- uint8_t iCounter(0);
-
- while (!IsStopped())
- {
- if (++iCounter < 10)
- {
- Sleep(1000);
- continue;
- }
- for (unsigned int iPtr = 0; iPtr <= 11 && !IsStopped(); iPtr++)
- {
- device = m_processor->m_busDevices[iPtr];
- WaitUntilIdle();
- if (device && device->GetStatus(true) == CEC_DEVICE_STATUS_PRESENT)
- {
- WaitUntilIdle();
- if (!IsStopped())
- device->GetVendorId();
-
- WaitUntilIdle();
- if (!IsStopped())
- device->GetPowerStatus(true);
- }
- }
- }
-
- return NULL;
-}
-
-void CCECBusScan::WaitUntilIdle(void)
-{
- if (IsStopped())
- return;
-
- int32_t iWaitTime = 3000 - (int32_t)(GetTimeMs() - m_processor->GetLastTransmission());
- while (iWaitTime > 0)
- {
- Sleep(iWaitTime);
- iWaitTime = 3000 - (int32_t)(GetTimeMs() - m_processor->GetLastTransmission());
- }
-}
-
bool CCECProcessor::StartBootloader(const char *strPort /* = NULL */)
{
+ bool bReturn(false);
if (!m_communication && strPort)
{
- bool bReturn(false);
IAdapterCommunication *comm = new CUSBCECAdapterCommunication(this, strPort);
- CTimeout timeout(10000);
+ CTimeout timeout(CEC_DEFAULT_CONNECT_TIMEOUT);
int iConnectTry(0);
while (timeout.TimeLeft() > 0 && (bReturn = comm->Open(timeout.TimeLeft() / CEC_CONNECT_TRIES, true)) == false)
{
CLibCEC::AddLog(CEC_LOG_ERROR, "could not open a connection (try %d)", ++iConnectTry);
comm->Close();
- Sleep(500);
+ Sleep(CEC_DEFAULT_TRANSMIT_RETRY_WAIT);
}
if (comm->IsOpen())
{
}
else
{
- return m_communication->StartBootloader();
+ m_communication->StartBootloader();
+ Close();
+ bReturn = true;
}
+
+ return bReturn;
}
bool CCECProcessor::PingAdapter(void)
if (IsRunning() && configuration->bAutodetectAddress == 1)
{
uint16_t iPhysicalAddress = m_communication->GetPhysicalAddress();
- if (iPhysicalAddress != 0)
+ if (IsValidPhysicalAddress(iPhysicalAddress))
{
if (IsRunning())
- CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - autodetected physical address '%4x'", __FUNCTION__, iPhysicalAddress);
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - autodetected physical address '%04X'", __FUNCTION__, iPhysicalAddress);
else
- CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - using physical address '%x'", __FUNCTION__, iPhysicalAddress);
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - using physical address '%04X'", __FUNCTION__, iPhysicalAddress);
bPhysicalAddressChanged = (m_configuration.iPhysicalAddress != iPhysicalAddress);
m_configuration.iPhysicalAddress = iPhysicalAddress;
- m_configuration.iHDMIPort = 0;
- m_configuration.baseDevice = CECDEVICE_UNKNOWN;
- bPhysicalAutodetected = true;
+ m_configuration.iHDMIPort = CEC_HDMI_PORTNUMBER_NONE;
+ m_configuration.baseDevice = CECDEVICE_UNKNOWN;
+ bPhysicalAutodetected = true;
}
}
// physical address
if (!bPhysicalAutodetected)
{
- if (configuration->iPhysicalAddress != 0)
- bPhysicalAddressChanged = IsRunning() && m_configuration.iPhysicalAddress != configuration->iPhysicalAddress;
+ uint16_t iPhysicalAddress(IsValidPhysicalAddress(configuration->iPhysicalAddress) ? configuration->iPhysicalAddress : CEC_PHYSICAL_ADDRESS_TV);
+ bPhysicalAddressChanged = IsRunning() && m_configuration.iPhysicalAddress != iPhysicalAddress;
if (bPhysicalAddressChanged)
{
- CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - physical address '%x'", __FUNCTION__, configuration->iPhysicalAddress);
- m_configuration.iPhysicalAddress = configuration->iPhysicalAddress;
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - physical address '%04X'", __FUNCTION__, iPhysicalAddress);
+ m_configuration.iPhysicalAddress = iPhysicalAddress;
}
}
bool bHdmiPortChanged(false);
- if (!bPhysicalAutodetected && !bPhysicalAddressChanged)
+ if (!bPhysicalAutodetected && !IsValidPhysicalAddress(configuration->iPhysicalAddress))
{
// base device
bHdmiPortChanged = IsRunning() && m_configuration.baseDevice != configuration->baseDevice;
{
CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - resetting HDMI port and base device to defaults", __FUNCTION__);
m_configuration.baseDevice = CECDEVICE_UNKNOWN;
- m_configuration.iHDMIPort = 0;
+ m_configuration.iHDMIPort = CEC_HDMI_PORTNUMBER_NONE;
}
bReinit = bPhysicalAddressChanged || bHdmiPortChanged || bDeviceTypeChanged;
m_configuration.bShutdownOnStandby = configuration->bShutdownOnStandby;
}
+ // client version 1.6.2
+ if (configuration->clientVersion >= CEC_CLIENT_VERSION_1_6_2)
+ {
+ memcpy(m_configuration.strDeviceLanguage, configuration->strDeviceLanguage, 3);
+ }
+
// ensure that there is at least 1 device type set
if (m_configuration.deviceTypes.IsEmpty())
m_configuration.deviceTypes.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE);
- // persist the configuration
- if (IsRunning())
- m_communication->PersistConfiguration(&m_configuration);
-
+ bool bReturn(true);
if (bReinit || m_configuration.logicalAddresses.IsEmpty())
{
if (bDeviceTypeChanged)
- return ChangeDeviceType(oldPrimaryType, m_configuration.deviceTypes[0]);
- else if (bPhysicalAddressChanged)
- return SetPhysicalAddress(m_configuration.iPhysicalAddress);
- else
- return SetHDMIPort(m_configuration.baseDevice, m_configuration.iHDMIPort);
+ bReturn = ChangeDeviceType(oldPrimaryType, m_configuration.deviceTypes[0]);
+ else if (IsValidPhysicalAddress(m_configuration.iPhysicalAddress))
+ bReturn = SetPhysicalAddress(m_configuration.iPhysicalAddress);
+ else if (m_configuration.baseDevice != CECDEVICE_UNKNOWN && m_configuration.iHDMIPort != CEC_HDMI_PORTNUMBER_NONE)
+ bReturn = SetHDMIPort(m_configuration.baseDevice, m_configuration.iHDMIPort);
}
else if (m_configuration.bActivateSource == 1 && IsRunning() && !IsActiveSource(m_configuration.logicalAddresses.primary))
{
SetActiveSource(m_configuration.deviceTypes.types[0]);
}
- return true;
+ // persist the configuration
+ if (IsRunning())
+ m_communication->PersistConfiguration(&m_configuration);
+
+ return bReturn;
}
bool CCECProcessor::GetCurrentConfiguration(libcec_configuration *configuration)
configuration->bShutdownOnStandby = m_configuration.bShutdownOnStandby;
}
+ // client version 1.6.2
+ if (configuration->clientVersion >= CEC_CLIENT_VERSION_1_6_2)
+ {
+ memcpy(configuration->strDeviceLanguage, m_configuration.strDeviceLanguage, 3);
+ configuration->iFirmwareBuildDate = m_configuration.iFirmwareBuildDate;
+ }
return true;
}
bool CCECProcessor::CanPersistConfiguration(void)
{
- return m_communication->GetFirmwareVersion() >= 2;
+ return m_communication ? m_communication->GetFirmwareVersion() >= 2 : false;
}
bool CCECProcessor::PersistConfiguration(libcec_configuration *configuration)
{
- return m_communication->PersistConfiguration(configuration);
+ return m_communication ? m_communication->PersistConfiguration(configuration) : false;
}
void CCECProcessor::RescanActiveDevices(void)
{
- for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr < CECDEVICE_BROADCAST; iPtr++)
m_busDevices[iPtr]->GetStatus(true);
}
-bool CCECProcessor::GetDeviceInformation(const char *strPort, libcec_configuration *config, uint32_t iTimeoutMs /* = 10000 */)
+bool CCECProcessor::GetDeviceInformation(const char *strPort, libcec_configuration *config, uint32_t iTimeoutMs /* = CEC_DEFAULT_CONNECT_TIMEOUT */)
{
- if (!OpenConnection(strPort, 38400, iTimeoutMs, false))
+ if (!OpenConnection(strPort, CEC_SERIAL_DEFAULT_BAUDRATE, iTimeoutMs, false))
return false;
- config->iFirmwareVersion = m_communication->GetFirmwareVersion();
- config->iPhysicalAddress = m_communication->GetPhysicalAddress();
+ config->iFirmwareVersion = m_communication->GetFirmwareVersion();
+ config->iPhysicalAddress = m_communication->GetPhysicalAddress();
+ config->iFirmwareBuildDate = m_communication->GetFirmwareBuildDate();
- delete m_communication;
- m_communication = NULL;
return true;
}
+
+bool CCECProcessor::TransmitPendingActiveSourceCommands(void)
+{
+ bool bReturn(true);
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr < CECDEVICE_BROADCAST; iPtr++)
+ bReturn &= m_busDevices[iPtr]->TransmitPendingActiveSourceCommands();
+ return bReturn;
+}
+
+bool CCECProcessor::IsValidPhysicalAddress(uint16_t iPhysicalAddress)
+{
+ return iPhysicalAddress >= CEC_MIN_PHYSICAL_ADDRESS &&
+ iPhysicalAddress <= CEC_MAX_PHYSICAL_ADDRESS;
+}
return bReturn;
}
- bool Pop(cec_command &command, uint16_t iTimeout = 10000)
+ bool Pop(cec_command &command, uint16_t iTimeout)
{
bool bReturn(false);
PLATFORM::CLockObject lock(m_mutex);
CCECProcessor(CLibCEC *controller, libcec_configuration *configuration);
virtual ~CCECProcessor(void);
- virtual bool Start(const char *strPort, uint16_t iBaudRate = 38400, uint32_t iTimeoutMs = 10000);
- virtual void *Process(void);
- virtual void Close(void);
-
- virtual bool OnCommandReceived(const cec_command &command);
-
- virtual bool IsMonitoring(void) const { return m_bMonitor; }
- virtual CCECBusDevice * GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress, bool bRefresh = false, bool bSuppressPoll = false) const;
- virtual CCECBusDevice * GetDeviceByType(cec_device_type type) const;
- virtual CCECBusDevice * GetPrimaryDevice(void) const;
- virtual cec_version GetDeviceCecVersion(cec_logical_address iAddress);
- virtual bool GetDeviceMenuLanguage(cec_logical_address iAddress, cec_menu_language *language);
- virtual CStdString GetDeviceName(void) const
- {
- CStdString strName;
- strName = m_configuration.strDeviceName;
- return strName;
- }
- virtual cec_osd_name GetDeviceOSDName(cec_logical_address iAddress);
- virtual uint64_t GetDeviceVendorId(cec_logical_address iAddress);
- virtual cec_power_status GetDevicePowerStatus(cec_logical_address iAddress);
- virtual cec_logical_address GetLogicalAddress(void) const { return m_configuration.logicalAddresses.primary; }
- virtual cec_logical_addresses GetLogicalAddresses(void) const { return m_configuration.logicalAddresses; }
- virtual cec_logical_addresses GetActiveDevices(void);
- virtual uint16_t GetDevicePhysicalAddress(cec_logical_address iAddress);
- virtual bool HasLogicalAddress(cec_logical_address address) const { return m_configuration.logicalAddresses.IsSet(address); }
- virtual bool IsPresentDevice(cec_logical_address address);
- virtual bool IsPresentDeviceType(cec_device_type type);
- virtual uint16_t GetPhysicalAddress(void) const;
- virtual uint64_t GetLastTransmission(void) const { return m_iLastTransmission; }
- virtual cec_logical_address GetActiveSource(void);
- virtual bool IsActiveSource(cec_logical_address iAddress);
- virtual bool IsInitialised(void);
- virtual bool SetStreamPath(uint16_t iPhysicalAddress);
- virtual cec_client_version GetClientVersion(void) const { return (cec_client_version)m_configuration.clientVersion; };
- virtual bool StandbyDevices(cec_logical_address address = CECDEVICE_BROADCAST);
- virtual bool PowerOnDevices(cec_logical_address address = CECDEVICE_BROADCAST);
-
- virtual bool SetActiveView(void);
- virtual bool SetActiveSource(cec_device_type type = CEC_DEVICE_TYPE_RESERVED);
- virtual bool SetDeckControlMode(cec_deck_control_mode mode, bool bSendUpdate = true);
- virtual bool SetDeckInfo(cec_deck_info info, bool bSendUpdate = true);
- virtual bool SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort, bool bForce = false);
- virtual bool TransmitInactiveSource(void);
- virtual bool SetLogicalAddress(cec_logical_address iLogicalAddress);
- virtual bool SetMenuState(cec_menu_state state, bool bSendUpdate = true);
- virtual bool SetPhysicalAddress(uint16_t iPhysicalAddress, bool bSendUpdate = true);
- virtual bool SetActiveSource(uint16_t iStreamPath);
- virtual bool SwitchMonitoring(bool bEnable);
- virtual bool PollDevice(cec_logical_address iAddress);
- virtual uint8_t VolumeUp(bool bSendRelease = true);
- virtual uint8_t VolumeDown(bool bSendRelease = true);
- virtual uint8_t MuteAudio(bool bSendRelease = true);
- virtual bool TransmitKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait = true);
- virtual bool TransmitKeyRelease(cec_logical_address iDestination, bool bWait = true);
- virtual bool EnablePhysicalAddressDetection(void);
+ bool Start(const char *strPort, uint16_t iBaudRate = CEC_SERIAL_DEFAULT_BAUDRATE, uint32_t iTimeoutMs = CEC_DEFAULT_CONNECT_TIMEOUT);
+ void *Process(void);
+ void Close(void);
+
+ bool OnCommandReceived(const cec_command &command);
+
+ bool IsMonitoring(void) const { return m_bMonitor; }
+ CCECBusDevice * GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress, bool bSuppressUpdate = true);
+ CCECBusDevice * GetDeviceByType(cec_device_type type) const;
+ CCECBusDevice * GetPrimaryDevice(void) const;
+ cec_version GetDeviceCecVersion(cec_logical_address iAddress);
+ bool GetDeviceMenuLanguage(cec_logical_address iAddress, cec_menu_language *language);
+ CStdString GetDeviceName(void) const;
+ cec_osd_name GetDeviceOSDName(cec_logical_address iAddress);
+ uint64_t GetDeviceVendorId(cec_logical_address iAddress);
+ cec_power_status GetDevicePowerStatus(cec_logical_address iAddress);
+ cec_logical_address GetLogicalAddress(void) const { return m_configuration.logicalAddresses.primary; }
+ cec_logical_addresses GetLogicalAddresses(void) const { return m_configuration.logicalAddresses; }
+ cec_logical_addresses GetActiveDevices(void);
+ uint16_t GetDevicePhysicalAddress(cec_logical_address iAddress);
+ bool HasLogicalAddress(cec_logical_address address) const { return m_configuration.logicalAddresses.IsSet(address); }
+ bool IsPresentDevice(cec_logical_address address);
+ bool IsPresentDeviceType(cec_device_type type);
+ uint16_t GetPhysicalAddress(void) const;
+ uint64_t GetLastTransmission(void) const { return m_iLastTransmission; }
+ cec_logical_address GetActiveSource(bool bRequestActiveSource = true);
+ bool IsActiveSource(cec_logical_address iAddress);
+ bool IsInitialised(void);
+ bool SetStreamPath(uint16_t iPhysicalAddress);
+ cec_client_version GetClientVersion(void) const { return (cec_client_version)m_configuration.clientVersion; };
+ bool StandbyDevices(cec_logical_address address = CECDEVICE_BROADCAST);
+ bool PowerOnDevices(cec_logical_address address = CECDEVICE_BROADCAST);
+
+ bool SetActiveView(void);
+ bool SetActiveSource(cec_device_type type = CEC_DEVICE_TYPE_RESERVED);
+ bool SetDeckControlMode(cec_deck_control_mode mode, bool bSendUpdate = true);
+ bool SetDeckInfo(cec_deck_info info, bool bSendUpdate = true);
+ bool SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort, bool bForce = false);
+ bool TransmitInactiveSource(void);
+ bool SetLogicalAddress(cec_logical_address iLogicalAddress);
+ bool SetMenuState(cec_menu_state state, bool bSendUpdate = true);
+ bool SetPhysicalAddress(uint16_t iPhysicalAddress, bool bSendUpdate = true);
+ bool SetActiveSource(uint16_t iStreamPath);
+ bool SwitchMonitoring(bool bEnable);
+ bool PollDevice(cec_logical_address iAddress);
+ uint8_t VolumeUp(bool bSendRelease = true);
+ uint8_t VolumeDown(bool bSendRelease = true);
+ uint8_t MuteAudio(bool bSendRelease = true);
+ bool TransmitKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait = true);
+ bool TransmitKeyRelease(cec_logical_address iDestination, bool bWait = true);
+ bool EnablePhysicalAddressDetection(void);
void SetStandardLineTimeout(uint8_t iTimeout);
void SetRetryLineTimeout(uint8_t iTimeout);
- virtual bool GetCurrentConfiguration(libcec_configuration *configuration);
- virtual bool SetConfiguration(const libcec_configuration *configuration);
- virtual bool CanPersistConfiguration(void);
- virtual bool PersistConfiguration(libcec_configuration *configuration);
- virtual void RescanActiveDevices(void);
+ bool GetCurrentConfiguration(libcec_configuration *configuration);
+ bool SetConfiguration(const libcec_configuration *configuration);
+ bool CanPersistConfiguration(void);
+ bool PersistConfiguration(libcec_configuration *configuration);
+ void RescanActiveDevices(void);
bool SetLineTimeout(uint8_t iTimeout);
const char *ToString(const cec_client_version version);
const char *ToString(const cec_server_version version);
- virtual bool Transmit(const cec_command &data);
- virtual void TransmitAbort(cec_logical_address address, cec_opcode opcode, cec_abort_reason reason = CEC_ABORT_REASON_UNRECOGNIZED_OPCODE);
+ static bool IsValidPhysicalAddress(uint16_t iPhysicalAddress);
- virtual bool ChangeDeviceType(cec_device_type from, cec_device_type to);
- virtual bool FindLogicalAddresses(void);
- virtual bool SetAckMask(uint16_t iMask);
+ bool Transmit(const cec_command &data);
+ void TransmitAbort(cec_logical_address address, cec_opcode opcode, cec_abort_reason reason = CEC_ABORT_REASON_UNRECOGNIZED_OPCODE);
- virtual bool StartBootloader(const char *strPort = NULL);
- virtual bool PingAdapter(void);
- virtual void HandlePoll(cec_logical_address initiator, cec_logical_address destination);
- virtual bool HandleReceiveFailed(cec_logical_address initiator);
+ bool ChangeDeviceType(cec_device_type from, cec_device_type to);
+ bool FindLogicalAddresses(void);
+ bool SetAckMask(uint16_t iMask);
- virtual bool GetDeviceInformation(const char *strPort, libcec_configuration *config, uint32_t iTimeoutMs = 10000);
+ bool StartBootloader(const char *strPort = NULL);
+ bool PingAdapter(void);
+ void HandlePoll(cec_logical_address initiator, cec_logical_address destination);
+ bool HandleReceiveFailed(cec_logical_address initiator);
+
+ bool GetDeviceInformation(const char *strPort, libcec_configuration *config, uint32_t iTimeoutMs = CEC_DEFAULT_CONNECT_TIMEOUT);
+
+ bool TransmitPendingActiveSourceCommands(void);
CCECBusDevice * m_busDevices[16];
CCECInputBuffer m_inBuffer;
libcec_configuration m_configuration;
};
-
- class CCECBusScan : public PLATFORM::CThread
- {
- public:
- CCECBusScan(CCECProcessor *processor) { m_processor = processor; }
- virtual ~CCECBusScan(void) { StopThread(true); }
- virtual void *Process(void);
-
- private:
- void WaitUntilIdle(void);
-
- CCECProcessor *m_processor;
- };
};
m_callbacks(configuration->callbacks),
m_cbParam(configuration->callbackParam)
{
- configuration->serverVersion = CEC_SERVER_VERSION_1_6_1;
m_cec = new CCECProcessor(this, configuration);
}
delete m_cec;
}
-bool CLibCEC::Open(const char *strPort, uint32_t iTimeoutMs /* = 10000 */)
+bool CLibCEC::Open(const char *strPort, uint32_t iTimeoutMs /* = CEC_DEFAULT_CONNECT_TIMEOUT */)
{
if (m_cec->IsRunning())
{
return false;
}
- if (!m_cec->Start(strPort, 38400, iTimeoutMs))
+ if (!m_cec->Start(strPort, CEC_SERIAL_DEFAULT_BAUDRATE, iTimeoutMs))
{
AddLog(CEC_LOG_ERROR, "could not start CEC communications");
return false;
CLibCEC *instance = CLibCEC::GetInstance();
if (!instance)
return;
- CLockObject lock(instance->m_mutex);
+ CLockObject lock(instance->m_logMutex);
cec_log_message message;
message.level = level;
message.time = GetTimeMs() - instance->m_iStartTime;
snprintf(message.message, sizeof(message.message), "%s", strLog.c_str());
- if (instance->m_callbacks)
+ if (instance->m_callbacks && instance->m_callbacks->CBCecLogMessage)
instance->m_callbacks->CBCecLogMessage(instance->m_cbParam, message);
else
instance->m_logBuffer.Push(message);
AddLog(CEC_LOG_DEBUG, "key pressed: %1x", key.keycode);
- if (instance->m_callbacks)
+ if (instance->m_callbacks && instance->m_callbacks->CBCecKeyPress)
instance->m_callbacks->CBCecKeyPress(instance->m_cbParam, key);
else
instance->m_keyBuffer.Push(key);
if (instance->m_callbacks &&
config.clientVersion >= CEC_CLIENT_VERSION_1_5_0 &&
- instance->m_callbacks->CBCecConfigurationChanged != NULL &&
+ instance->m_callbacks->CBCecConfigurationChanged &&
instance->m_cec->IsInitialised())
instance->m_callbacks->CBCecConfigurationChanged(instance->m_cbParam, config);
}
key.keycode = instance->m_iCurrentButton;
AddLog(CEC_LOG_DEBUG, "key released: %1x", key.keycode);
- if (instance->m_callbacks)
+ if (instance->m_callbacks && instance->m_callbacks->CBCecKeyPress)
instance->m_callbacks->CBCecKeyPress(instance->m_cbParam, key);
else
instance->m_keyBuffer.Push(key);
AddLog(CEC_LOG_NOTICE, ">> %s (%X) -> %s (%X): %s (%2X)", instance->m_cec->ToString(command.initiator), command.initiator, instance->m_cec->ToString(command.destination), command.destination, instance->m_cec->ToString(command.opcode), command.opcode);
- if (instance->m_callbacks)
+ if (instance->m_callbacks && instance->m_callbacks->CBCecCommand)
instance->m_callbacks->CBCecCommand(instance->m_cbParam, command);
else if (!instance->m_commandBuffer.Push(command))
AddLog(CEC_LOG_WARNING, "command buffer is full");
}
+void CLibCEC::Alert(const libcec_alert type, const libcec_parameter ¶m)
+{
+ CLibCEC *instance = CLibCEC::GetInstance();
+ if (!instance)
+ return;
+ CLockObject lock(instance->m_mutex);
+
+ libcec_configuration config;
+ instance->GetCurrentConfiguration(&config);
+
+ if (instance->m_callbacks &&
+ config.clientVersion >= CEC_CLIENT_VERSION_1_6_0 &&
+ instance->m_cec->IsInitialised() &&
+ instance->m_callbacks->CBCecAlert)
+ instance->m_callbacks->CBCecAlert(instance->m_cbParam, type, param);
+
+ if (type == CEC_ALERT_CONNECTION_LOST)
+ instance->Close();
+}
+
void CLibCEC::CheckKeypressTimeout(void)
{
if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && GetTimeMs() - m_buttontime > CEC_BUTTON_TIMEOUT)
}
}
+int CLibCEC::MenuStateChanged(const cec_menu_state newState)
+{
+ int iReturn(0);
+
+ CLibCEC *instance = CLibCEC::GetInstance();
+ if (!instance)
+ return iReturn;
+ CLockObject lock(instance->m_mutex);
+
+ AddLog(CEC_LOG_NOTICE, ">> %s: %s", instance->m_cec->ToString(CEC_OPCODE_MENU_REQUEST), instance->m_cec->ToString(newState));
+
+ libcec_configuration config;
+ instance->GetCurrentConfiguration(&config);
+
+ if (instance->m_callbacks &&
+ config.clientVersion >= CEC_CLIENT_VERSION_1_6_2 &&
+ instance->m_callbacks->CBCecMenuStateChanged)
+ iReturn = instance->m_callbacks->CBCecMenuStateChanged(instance->m_cbParam, newState);
+
+ return iReturn;
+}
+
bool CLibCEC::SetStreamPath(cec_logical_address iAddress)
{
uint16_t iPhysicalAddress = GetDevicePhysicalAddress(iAddress);
- if (iPhysicalAddress != 0xFFFF)
+ if (iPhysicalAddress != CEC_INVALID_PHYSICAL_ADDRESS)
return SetStreamPath(iPhysicalAddress);
return false;
}
{
CLibCEC *lib = new CLibCEC(configuration);
CLibCEC::SetInstance(lib);
+ lib->GetCurrentConfiguration(configuration);
return static_cast< void* > (lib);
}
if (CUSBCECAdapterDetection::FindAdapters(deviceList, 1) > 0)
{
CUSBCECAdapterCommunication comm(NULL, deviceList[0].comm);
- CTimeout timeout(10000);
+ CTimeout timeout(CEC_DEFAULT_CONNECT_TIMEOUT);
while (timeout.TimeLeft() > 0 && (bReturn = comm.Open(timeout.TimeLeft() / CEC_CONNECT_TRIES, true)) == false)
{
comm.Close();
bool CLibCEC::GetCurrentConfiguration(libcec_configuration *configuration)
{
- return m_cec->IsInitialised() && m_cec->GetCurrentConfiguration(configuration);
+ return m_cec->GetCurrentConfiguration(configuration);
}
bool CLibCEC::SetConfiguration(const libcec_configuration *configuration)
}
}
-bool CLibCEC::GetDeviceInformation(const char *strPort, libcec_configuration *config, uint32_t iTimeoutMs /* = 10000 */)
+bool CLibCEC::GetDeviceInformation(const char *strPort, libcec_configuration *config, uint32_t iTimeoutMs /* = CEC_DEFAULT_CONNECT_TIMEOUT */)
{
if (m_cec->IsRunning())
return false;
CLibCEC(libcec_configuration *configuration);
virtual ~CLibCEC(void);
- virtual bool Open(const char *strPort, uint32_t iTimeout = 10000);
- virtual void Close(void);
- virtual bool EnableCallbacks(void *cbParam, ICECCallbacks *callbacks);
- virtual int8_t FindAdapters(cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath = NULL);
- virtual bool PingAdapter(void);
- virtual bool StartBootloader(void);
+ bool Open(const char *strPort, uint32_t iTimeout = CEC_DEFAULT_CONNECT_TIMEOUT);
+ void Close(void);
+ bool EnableCallbacks(void *cbParam, ICECCallbacks *callbacks);
+ int8_t FindAdapters(cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath = NULL);
+ bool PingAdapter(void);
+ bool StartBootloader(void);
- virtual int8_t GetMinLibVersion(void) const { return CEC_MIN_LIB_VERSION; };
- virtual int8_t GetLibVersionMajor(void) const { return CEC_LIB_VERSION_MAJOR; };
- virtual int8_t GetLibVersionMinor(void) const { return CEC_LIB_VERSION_MINOR; };
+ int8_t GetMinLibVersion(void) const { return CEC_MIN_LIB_VERSION; };
+ int8_t GetLibVersionMajor(void) const { return CEC_LIB_VERSION_MAJOR; };
+ int8_t GetLibVersionMinor(void) const { return CEC_LIB_VERSION_MINOR; };
- virtual bool GetNextLogMessage(cec_log_message *message);
- virtual bool GetNextKeypress(cec_keypress *key);
- virtual bool GetNextCommand(cec_command *command);
+ bool GetNextLogMessage(cec_log_message *message);
+ bool GetNextKeypress(cec_keypress *key);
+ bool GetNextCommand(cec_command *command);
- virtual bool Transmit(const cec_command &data);
- virtual bool SetLogicalAddress(cec_logical_address iLogicalAddress = CECDEVICE_PLAYBACKDEVICE1);
- virtual bool SetPhysicalAddress(uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS);
+ bool Transmit(const cec_command &data);
+ bool SetLogicalAddress(cec_logical_address iLogicalAddress = CECDEVICE_PLAYBACKDEVICE1);
+ bool SetPhysicalAddress(uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS);
- virtual bool PowerOnDevices(cec_logical_address address = CECDEVICE_TV);
- virtual bool StandbyDevices(cec_logical_address address = CECDEVICE_BROADCAST);
- virtual bool SetActiveView(void);
- virtual bool SetActiveSource(cec_device_type type = CEC_DEVICE_TYPE_RESERVED);
- virtual bool SetDeckControlMode(cec_deck_control_mode mode, bool bSendUpdate = true);
- virtual bool SetDeckInfo(cec_deck_info info, bool bSendUpdate = true);
- virtual bool SetInactiveView(void);
- virtual bool SetMenuState(cec_menu_state state, bool bSendUpdate = true);
- virtual bool SetOSDString(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage);
- virtual bool SwitchMonitoring(bool bEnable);
- virtual cec_version GetDeviceCecVersion(cec_logical_address iAddress);
- virtual bool GetDeviceMenuLanguage(cec_logical_address iAddress, cec_menu_language *language);
- virtual uint64_t GetDeviceVendorId(cec_logical_address iAddress);
- virtual uint16_t GetDevicePhysicalAddress(cec_logical_address iAddress);
- virtual cec_power_status GetDevicePowerStatus(cec_logical_address iAddress);
- virtual bool PollDevice(cec_logical_address iAddress);
- virtual cec_logical_addresses GetActiveDevices(void);
- virtual bool IsActiveDevice(cec_logical_address iAddress);
- virtual bool IsActiveDeviceType(cec_device_type type);
- virtual bool SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort = CEC_DEFAULT_HDMI_PORT);
- virtual uint8_t VolumeUp(bool bSendRelease = true);
- virtual uint8_t VolumeDown(bool bSendRelease = true);
- virtual uint8_t MuteAudio(bool bSendRelease = true);
- virtual bool SendKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait = true);
- virtual bool SendKeyRelease(cec_logical_address iDestination, bool bWait = true);
- virtual cec_osd_name GetDeviceOSDName(cec_logical_address iAddress);
- virtual bool EnablePhysicalAddressDetection(void);
- virtual cec_logical_address GetActiveSource(void);
- virtual bool IsActiveSource(cec_logical_address iAddress);
- virtual bool SetStreamPath(cec_logical_address iAddress);
- virtual bool SetStreamPath(uint16_t iPhysicalAddress);
- virtual cec_logical_addresses GetLogicalAddresses(void);
- virtual bool GetCurrentConfiguration(libcec_configuration *configuration);
- virtual bool SetConfiguration(const libcec_configuration *configuration);
- virtual bool CanPersistConfiguration(void);
- virtual bool PersistConfiguration(libcec_configuration *configuration);
- virtual void RescanActiveDevices(void);
- virtual bool IsLibCECActiveSource(void);
+ bool PowerOnDevices(cec_logical_address address = CECDEVICE_TV);
+ bool StandbyDevices(cec_logical_address address = CECDEVICE_BROADCAST);
+ bool SetActiveView(void);
+ bool SetActiveSource(cec_device_type type = CEC_DEVICE_TYPE_RESERVED);
+ bool SetDeckControlMode(cec_deck_control_mode mode, bool bSendUpdate = true);
+ bool SetDeckInfo(cec_deck_info info, bool bSendUpdate = true);
+ bool SetInactiveView(void);
+ bool SetMenuState(cec_menu_state state, bool bSendUpdate = true);
+ bool SetOSDString(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage);
+ bool SwitchMonitoring(bool bEnable);
+ cec_version GetDeviceCecVersion(cec_logical_address iAddress);
+ bool GetDeviceMenuLanguage(cec_logical_address iAddress, cec_menu_language *language);
+ uint64_t GetDeviceVendorId(cec_logical_address iAddress);
+ uint16_t GetDevicePhysicalAddress(cec_logical_address iAddress);
+ cec_power_status GetDevicePowerStatus(cec_logical_address iAddress);
+ bool PollDevice(cec_logical_address iAddress);
+ cec_logical_addresses GetActiveDevices(void);
+ bool IsActiveDevice(cec_logical_address iAddress);
+ bool IsActiveDeviceType(cec_device_type type);
+ bool SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort = CEC_DEFAULT_HDMI_PORT);
+ uint8_t VolumeUp(bool bSendRelease = true);
+ uint8_t VolumeDown(bool bSendRelease = true);
+ uint8_t MuteAudio(bool bSendRelease = true);
+ bool SendKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait = true);
+ bool SendKeyRelease(cec_logical_address iDestination, bool bWait = true);
+ cec_osd_name GetDeviceOSDName(cec_logical_address iAddress);
+ bool EnablePhysicalAddressDetection(void);
+ cec_logical_address GetActiveSource(void);
+ bool IsActiveSource(cec_logical_address iAddress);
+ bool SetStreamPath(cec_logical_address iAddress);
+ bool SetStreamPath(uint16_t iPhysicalAddress);
+ cec_logical_addresses GetLogicalAddresses(void);
+ bool GetCurrentConfiguration(libcec_configuration *configuration);
+ bool SetConfiguration(const libcec_configuration *configuration);
+ bool CanPersistConfiguration(void);
+ bool PersistConfiguration(libcec_configuration *configuration);
+ void RescanActiveDevices(void);
+ bool IsLibCECActiveSource(void);
const char *ToString(const cec_menu_state state);
const char *ToString(const cec_version version);
static uint16_t GetMaskForType(cec_logical_address address);
static uint16_t GetMaskForType(cec_device_type type);
- virtual bool GetDeviceInformation(const char *strPort, libcec_configuration *config, uint32_t iTimeoutMs = 10000);
+ bool GetDeviceInformation(const char *strPort, libcec_configuration *config, uint32_t iTimeoutMs = CEC_DEFAULT_CONNECT_TIMEOUT);
//@}
static void AddLog(const cec_log_level level, const char *strFormat, ...);
static void AddCommand(const cec_command &command);
static void ConfigurationChanged(const libcec_configuration &config);
static void SetCurrentButton(cec_user_control_code iButtonCode);
- virtual void CheckKeypressTimeout(void);
+ void CheckKeypressTimeout(void);
+ static int MenuStateChanged(const cec_menu_state newState);
+ static void Alert(const libcec_alert type, const libcec_parameter ¶m);
static CLibCEC *GetInstance(void);
static void SetInstance(CLibCEC *instance);
ICECCallbacks * m_callbacks;
void * m_cbParam;
PLATFORM::CMutex m_mutex;
+ PLATFORM::CMutex m_logMutex;
};
};
* @param bStartListening Start a listener thread when true. False to just open a connection, read the device info, and close the connection.
* @return True when connected, false otherwise
*/
- virtual bool Open(uint32_t iTimeoutMs = 10000, bool bSkipChecks = false, bool bStartListening = true) = 0;
+ virtual bool Open(uint32_t iTimeoutMs = CEC_DEFAULT_CONNECT_TIMEOUT, bool bSkipChecks = false, bool bStartListening = true) = 0;
/*!
* @brief Close an open connection
/*!
* @brief Write a cec_command to the adapter
* @param data The command to write
- * @param iMaxTries The maximum number of tries
- * @param iLineTimeout The line timeout for the first try
- * @param iRetryLineTimeout The line timeout for each next try
+ * @param bRetry The command can be retried
+ * @param iLineTimeout The line timeout to be used
* @return The last state of the transmitted command
*/
- virtual cec_adapter_message_state Write(const cec_command &data, uint8_t iMaxTries, uint8_t iLineTimeout = 3, uint8_t iRetryLineTimeout = 3) = 0;
+ virtual cec_adapter_message_state Write(const cec_command &data, bool &bRetry, uint8_t iLineTimeout = 3) = 0;
/*!
* @brief Change the current line timeout on the CEC bus
*/
virtual uint16_t GetFirmwareVersion(void) = 0;
+ /*!
+ * @return The build date in seconds since epoch, or 0 when no (valid) reply was received.
+ */
+ virtual uint32_t GetFirmwareBuildDate(void) = 0;
+
/*!
* @return True when the control mode has been set, false otherwise.
*/
m_bSettingAutoEnabled(false),
m_settingCecVersion(CEC_VERSION_UNKNOWN),
m_iSettingLAMask(0),
- m_bNeedsWrite(false)
+ m_bNeedsWrite(false),
+ m_iBuildDate(CEC_FW_BUILD_UNKNOWN)
{
m_persistedConfiguration.Clear();
}
if (response.size == 1)
{
m_bSettingAutoEnabled = response[0] == 1;
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted autonomous mode setting: '%s'", m_bSettingAutoEnabled ? "enabled" : "disabled");
return true;
}
return false;
if (response.size == 1)
{
m_settingCecVersion = (cec_version)response[0];
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted CEC version setting: '%s'", CLibCEC::GetInstance()->ToString(m_settingCecVersion));
return true;
}
return false;
}
+uint32_t CUSBCECAdapterCommands::RequestBuildDate(void)
+{
+ if (m_iBuildDate == CEC_FW_BUILD_UNKNOWN)
+ {
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "requesting firmware build date");
+
+ cec_datapacket response = RequestSetting(MSGCODE_GET_BUILDDATE);
+ if (response.size == 4)
+ m_iBuildDate = (uint32_t)response[0] << 24 | (uint32_t)response[1] << 16 | (uint32_t)response[2] << 8 | (uint32_t)response[3];
+ }
+ return m_iBuildDate;
+}
+
bool CUSBCECAdapterCommands::RequestSettingDefaultLogicalAddress(void)
{
CLibCEC::AddLog(CEC_LOG_DEBUG, "requesting default logical address setting");
if (response.size == 1)
{
m_persistedConfiguration.logicalAddresses.primary = (cec_logical_address)response[0];
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted logical address setting: '%s'", CLibCEC::GetInstance()->ToString(m_persistedConfiguration.logicalAddresses.primary));
return true;
}
return false;
if (response.size == 1)
{
m_persistedConfiguration.deviceTypes.Add((cec_device_type)response[0]);
- CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted device type setting %s", CLibCEC::GetInstance()->ToString((cec_device_type)response[0]));
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted device type setting: '%s'", CLibCEC::GetInstance()->ToString((cec_device_type)response[0]));
return true;
}
CLibCEC::AddLog(CEC_LOG_DEBUG, "no persisted device type setting");
if (response.size == 2)
{
m_iSettingLAMask = ((uint16_t)response[0] << 8) | ((uint16_t)response[1]);
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted logical address mask setting: '%x'", m_iSettingLAMask);
return true;
}
return false;
buf[response.size] = 0;
snprintf(m_persistedConfiguration.strDeviceName, 13, "%s", buf);
- CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted device name setting %s", buf);
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted device name setting: '%s'", buf);
return true;
}
if (response.size == 2)
{
m_persistedConfiguration.iPhysicalAddress = ((uint16_t)response[0] << 8) | ((uint16_t)response[1]);
- CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted physical address setting %4x", m_persistedConfiguration.iPhysicalAddress);
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted physical address setting: '%4x'", m_persistedConfiguration.iPhysicalAddress);
return true;
}
CLibCEC::AddLog(CEC_LOG_DEBUG, "no persisted physical address setting");
}
m_bNeedsWrite = true;
- CLibCEC::AddLog(CEC_LOG_DEBUG, "setting the device type to %X", (uint8_t)type);
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "setting the device type to %X (previous: %X)", (uint8_t)type, (uint8_t)m_persistedConfiguration.deviceTypes.types[0]);
CCECAdapterMessage params;
params.PushEscaped((uint8_t)type);
}
m_bNeedsWrite = true;
- CLibCEC::AddLog(CEC_LOG_DEBUG, "setting the default logical address to %X", (uint8_t)address);
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "setting the default logical address to %X (previous: %X)", (uint8_t)address, (uint8_t)m_persistedConfiguration.logicalAddresses.primary);
CCECAdapterMessage params;
params.PushEscaped((uint8_t)address);
}
m_bNeedsWrite = true;
- CLibCEC::AddLog(CEC_LOG_DEBUG, "setting the logical address mask to %2X", iMask);
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "setting the logical address mask to %2X (previous: %2X)", iMask, m_iSettingLAMask);
CCECAdapterMessage params;
params.PushEscaped(iMask >> 8);
}
m_bNeedsWrite = true;
- CLibCEC::AddLog(CEC_LOG_DEBUG, "setting the physical address to %04X", iPhysicalAddress);
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "setting the physical address to %04X (previous: %04X)", iPhysicalAddress, m_persistedConfiguration.iPhysicalAddress);
CCECAdapterMessage params;
params.PushEscaped(iPhysicalAddress >> 8);
}
m_bNeedsWrite = true;
- CLibCEC::AddLog(CEC_LOG_DEBUG, "setting the CEC version to %s", CLibCEC::GetInstance()->ToString(version));
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "setting the CEC version to %s (previous: %s)", CLibCEC::GetInstance()->ToString(version), CLibCEC::GetInstance()->ToString(m_settingCecVersion));
CCECAdapterMessage params;
params.PushEscaped((uint8_t)version);
return bReturn;
}
- CLibCEC::AddLog(CEC_LOG_DEBUG, "setting the OSD name to %s", strOSDName);
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "setting the OSD name to %s (previous: %s)", strOSDName, m_persistedConfiguration.strDeviceName);
CCECAdapterMessage params;
for (size_t iPtr = 0; iPtr < strlen(strOSDName); iPtr++)
*/
bool SetControlledMode(bool controlled);
+ /*!
+ * @brief Request the firmware build date from the device.
+ * @return The build date in seconds since epoch, or 0 when no (valid) reply was received.
+ */
+ uint32_t RequestBuildDate(void);
+
private:
/*!
* @brief Reads all settings from the eeprom.
uint16_t m_iSettingLAMask; /**< the value of the LA mask setting */
bool m_bNeedsWrite; /**< true when we sent changed settings to the adapter that have not been persisted */
libcec_configuration m_persistedConfiguration; /**< the configuration that is persisted in the eeprom */
+ uint32_t m_iBuildDate; /**< the build date of the firmware */
};
}
#define CEC_ADAPTER_PING_TIMEOUT 15000
-CUSBCECAdapterCommunication::CUSBCECAdapterCommunication(IAdapterCommunicationCallback *callback, const char *strPort, uint16_t iBaudRate /* = 38400 */) :
+CUSBCECAdapterCommunication::CUSBCECAdapterCommunication(IAdapterCommunicationCallback *callback, const char *strPort, uint16_t iBaudRate /* = CEC_SERIAL_DEFAULT_BAUDRATE */) :
IAdapterCommunication(callback),
m_port(NULL),
m_iLineTimeout(0),
m_commands(NULL),
m_adapterMessageQueue(NULL)
{
- for (unsigned int iPtr = 0; iPtr < 15; iPtr++)
+ for (unsigned int iPtr = CECDEVICE_TV; iPtr < CECDEVICE_BROADCAST; iPtr++)
m_bWaitingForAck[iPtr] = false;
m_port = new CSerialPort(strPort, iBaudRate);
}
delete m_port;
}
-bool CUSBCECAdapterCommunication::Open(uint32_t iTimeoutMs /* = 10000 */, bool bSkipChecks /* = false */, bool bStartListening /* = true */)
+bool CUSBCECAdapterCommunication::Open(uint32_t iTimeoutMs /* = CEC_DEFAULT_CONNECT_TIMEOUT */, bool bSkipChecks /* = false */, bool bStartListening /* = true */)
{
bool bConnectionOpened(false);
{
m_commands = new CUSBCECAdapterCommands(this);
if (!m_adapterMessageQueue)
+ {
m_adapterMessageQueue = new CCECAdapterMessageQueue(this);
+ m_adapterMessageQueue->CreateThread();
+ }
/* try to open the connection */
CStdString strError;
void CUSBCECAdapterCommunication::Close(void)
{
+ /* stop the reader thread */
+ StopThread(0);
+
+ CLockObject lock(m_mutex);
+
/* set the ackmask to 0 before closing the connection */
- if (IsRunning())
+ if (IsRunning() && m_port->IsOpen() && m_port->GetErrorNumber() == 0)
{
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - closing the connection", __FUNCTION__);
SetAckMask(0);
if (m_commands->GetFirmwareVersion() >= 2)
SetControlledMode(false);
}
+ m_adapterMessageQueue->Clear();
+
/* stop and delete the ping thread */
if (m_pingThread)
m_pingThread->StopThread(0);
delete m_pingThread;
m_pingThread = NULL;
- /* stop the reader thread */
- StopThread(0);
-
/* close and delete the com port connection */
if (m_port)
m_port->Close();
+
+ libcec_parameter param;
+ CLibCEC::Alert(CEC_ALERT_CONNECTION_LOST, param);
}
-cec_adapter_message_state CUSBCECAdapterCommunication::Write(const cec_command &data, uint8_t iMaxTries, uint8_t iLineTimeout /* = 3 */, uint8_t iRetryLineTimeout /* = 3 */)
+cec_adapter_message_state CUSBCECAdapterCommunication::Write(const cec_command &data, bool &bRetry, uint8_t iLineTimeout)
{
cec_adapter_message_state retVal(ADAPTER_MESSAGE_STATE_UNKNOWN);
if (!IsRunning())
return retVal;
- CCECAdapterMessage *output = new CCECAdapterMessage(data, iMaxTries, iLineTimeout, iRetryLineTimeout);
+ CCECAdapterMessage *output = new CCECAdapterMessage(data, iLineTimeout);
/* mark as waiting for an ack from the destination */
MarkAsWaiting(data.destination);
/* send the message */
- bool bRetry(true);
- while (bRetry && ++output->tries < output->maxTries)
- {
- bRetry = (!m_adapterMessageQueue->Write(output) || output->NeedsRetry()) && output->transmit_timeout > 0;
- if (bRetry)
- Sleep(CEC_DEFAULT_TRANSMIT_RETRY_WAIT);
- }
+ bRetry = (!m_adapterMessageQueue->Write(output) || output->NeedsRetry()) && output->transmit_timeout > 0;
+ if (bRetry)
+ Sleep(CEC_DEFAULT_TRANSMIT_RETRY_WAIT);
retVal = output->state;
delete output;
}
}
-void CUSBCECAdapterCommunication::ClearInputBytes(uint32_t iTimeout /* = 1000 */)
+void CUSBCECAdapterCommunication::ClearInputBytes(uint32_t iTimeout /* = CEC_CLEAR_INPUT_DEFAULT_WAIT */)
{
CTimeout timeout(iTimeout);
uint8_t buff[1024];
CLockObject adapterLock(m_mutex);
if (!m_port->IsOpen())
{
- CLibCEC::AddLog(CEC_LOG_DEBUG, "error writing command '%s' to the serial port: the connection is closed", CCECAdapterMessage::ToString(message->Message()));
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "error writing command '%s' to serial port '%s': the connection is closed", CCECAdapterMessage::ToString(message->Message()), m_port->GetName().c_str());
message->state = ADAPTER_MESSAGE_STATE_ERROR;
return false;
}
/* write the message */
if (m_port->Write(message->packet.data, message->Size()) != (ssize_t) message->Size())
{
- CLibCEC::AddLog(CEC_LOG_DEBUG, "error writing command '%s' to the serial port: %s", CCECAdapterMessage::ToString(message->Message()), m_port->GetError().c_str());
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "error writing command '%s' to serial port '%s': %s", CCECAdapterMessage::ToString(message->Message()), m_port->GetName().c_str(), m_port->GetError().c_str());
message->state = ADAPTER_MESSAGE_STATE_ERROR;
+ Close();
return false;
}
/* read from the serial port */
{
CLockObject lock(m_mutex);
- if (!m_port)
+ if (!m_port || !m_port->IsOpen())
return false;
+
iBytesRead = m_port->Read(buff, sizeof(uint8_t) * iSize, iTimeout);
+
+ if (m_port->GetErrorNumber())
+ {
+ CLibCEC::AddLog(CEC_LOG_ERROR, "error reading from serial port: %s", m_port->GetError().c_str());
+ m_port->Close();
+ return false;
+ }
}
if (iBytesRead < 0 || iBytesRead > 256)
- {
- CLibCEC::AddLog(CEC_LOG_ERROR, "error reading from serial port: %s", m_port->GetError().c_str());
- StopThread(false);
return false;
- }
else if (iBytesRead > 0)
{
/* add the data to the current frame */
/* write the command */
if (!m_adapterMessageQueue->Write(output))
{
- // timed out
+ if (output->state == ADAPTER_MESSAGE_STATE_ERROR)
+ Close();
return output;
}
else
{
- if (!bIsRetry && output->Reply() == MSGCODE_COMMAND_REJECTED && msgCode != MSGCODE_SET_CONTROLLED)
+ if (!bIsRetry && output->Reply() == MSGCODE_COMMAND_REJECTED && msgCode != MSGCODE_SET_CONTROLLED &&
+ msgCode != MSGCODE_GET_BUILDDATE /* same messagecode value had a different meaning in older fw builds */)
{
/* if the controller reported that the command was rejected, and we didn't send the command
to set controlled mode, then the controller probably switched to auto mode. set controlled
return output;
}
-bool CUSBCECAdapterCommunication::CheckAdapter(uint32_t iTimeoutMs /* = 10000 */)
+bool CUSBCECAdapterCommunication::CheckAdapter(uint32_t iTimeoutMs /* = CEC_DEFAULT_CONNECT_TIMEOUT */)
{
bool bReturn(false);
CTimeout timeout(iTimeoutMs > 0 ? iTimeoutMs : CEC_DEFAULT_TRANSMIT_WAIT);
else
bReturn = true;
+ /* try to read the build date */
+ m_commands->RequestBuildDate();
+
SetInitialised(bReturn);
return bReturn;
}
bool CUSBCECAdapterCommunication::StartBootloader(void)
{
- if (!IsRunning())
- return false;
-
- return m_commands->StartBootloader();
+ if (m_port->IsOpen() && m_commands->StartBootloader())
+ {
+ Close();
+ return true;
+ }
+ return false;
}
bool CUSBCECAdapterCommunication::SetAckMask(uint16_t iMask)
{
- return m_commands->SetAckMask(iMask);
+ return m_port->IsOpen() ? m_commands->SetAckMask(iMask) : false;
}
bool CUSBCECAdapterCommunication::PingAdapter(void)
{
- return m_commands->PingAdapter();
+ return m_port->IsOpen() ? m_commands->PingAdapter() : false;
}
uint16_t CUSBCECAdapterCommunication::GetFirmwareVersion(void)
return m_commands->GetFirmwareVersion();
}
+uint32_t CUSBCECAdapterCommunication::GetFirmwareBuildDate(void)
+{
+ return m_commands->RequestBuildDate();
+}
+
bool CUSBCECAdapterCommunication::PersistConfiguration(libcec_configuration *configuration)
{
- return m_commands->PersistConfiguration(configuration);
+ return m_port->IsOpen() ? m_commands->PersistConfiguration(configuration) : false;
}
bool CUSBCECAdapterCommunication::GetConfiguration(libcec_configuration *configuration)
{
- return m_commands->GetConfiguration(configuration);
+ return m_port->IsOpen() ? m_commands->GetConfiguration(configuration) : false;
}
CStdString CUSBCECAdapterCommunication::GetPortName(void)
bool CUSBCECAdapterCommunication::SetControlledMode(bool controlled)
{
- return m_commands->SetControlledMode(controlled);
+ return m_port->IsOpen() ? m_commands->SetControlledMode(controlled) : false;
}
void *CAdapterPingThread::Process(void)
{
if (!m_com->PingAdapter())
{
- /* sleep 1 second and retry */
- Sleep(1000);
+ /* sleep and retry */
+ Sleep(CEC_DEFAULT_TRANSMIT_RETRY_WAIT);
++iFailedCounter;
}
else
* @param strPort The name of the com port to use.
* @param iBaudRate The baudrate to use on the com port connection.
*/
- CUSBCECAdapterCommunication(IAdapterCommunicationCallback *callback, const char *strPort, uint16_t iBaudRate = 38400);
+ CUSBCECAdapterCommunication(IAdapterCommunicationCallback *callback, const char *strPort, uint16_t iBaudRate = CEC_SERIAL_DEFAULT_BAUDRATE);
virtual ~CUSBCECAdapterCommunication(void);
/** @name IAdapterCommunication implementation */
///{
- bool Open(uint32_t iTimeoutMs = 10000, bool bSkipChecks = false, bool bStartListening = true);
+ bool Open(uint32_t iTimeoutMs = CEC_DEFAULT_CONNECT_TIMEOUT, bool bSkipChecks = false, bool bStartListening = true);
void Close(void);
bool IsOpen(void);
CStdString GetError(void) const;
- cec_adapter_message_state Write(const cec_command &data, uint8_t iMaxTries, uint8_t iLineTimeout = 3, uint8_t iRetryLineTimeout = 3);
+ cec_adapter_message_state Write(const cec_command &data, bool &bRetry, uint8_t iLineTimeout = 3);
bool StartBootloader(void);
bool SetAckMask(uint16_t iMask);
bool PingAdapter(void);
uint16_t GetFirmwareVersion(void);
+ uint32_t GetFirmwareBuildDate(void);
bool PersistConfiguration(libcec_configuration *configuration);
bool GetConfiguration(libcec_configuration *configuration);
CStdString GetPortName(void);
* @brief Clear all input bytes.
* @param iTimeout Timeout when anything was received.
*/
- void ClearInputBytes(uint32_t iTimeout = 1000);
+ void ClearInputBytes(uint32_t iTimeout = CEC_CLEAR_INPUT_DEFAULT_WAIT);
/*!
* @brief Change the current CEC line timeout.
* @param iTimeoutMs The timeout after which this fails if no proper data was received.
* @return True when the checks passed, false otherwise.
*/
- bool CheckAdapter(uint32_t iTimeoutMs = 10000);
+ bool CheckAdapter(uint32_t iTimeoutMs = CEC_DEFAULT_CONNECT_TIMEOUT);
/*!
* @brief Handle a poll message inside the adapter message (checks if one is present).
Clear();
}
-CCECAdapterMessage::CCECAdapterMessage(const cec_command &command, uint8_t iMaxTries /* = 1 */, uint8_t iLineTimeout /* = 3 */, uint8_t iRetryLineTimeout /* = 3 */)
+CCECAdapterMessage::CCECAdapterMessage(const cec_command &command, uint8_t iLineTimeout /* = 3 */)
{
Clear();
// set timeout
transmit_timeout = command.transmit_timeout;
- /* set the number of retries */
- if (command.opcode == CEC_OPCODE_NONE) //TODO
- maxTries = 1;
- else if (command.initiator != CECDEVICE_BROADCAST)
- maxTries = iMaxTries;
-
lineTimeout = iLineTimeout;
- retryTimeout = iRetryLineTimeout;
- tries = 0;
}
CStdString CCECAdapterMessage::ToString(void) const
strMsg.AppendFormat(" %02x %s", At(2), IsEOM() ? "eom" : "");
break;
default:
+ for (uint8_t iPtr = 2; iPtr < Size(); iPtr++)
+ if (At(iPtr) != MSGEND)
+ strMsg.AppendFormat(" %02x", At(iPtr));
break;
}
}
return "FRAME_EOM";
case MSGCODE_FRAME_ACK:
return "FRAME_ACK";
- case MSGCODE_SET_POWERSTATE:
- return "SET_POWERSTATE";
+ case MSGCODE_GET_BUILDDATE:
+ return "GET_BUILDDATE";
case MSGCODE_SET_CONTROLLED:
return "SET_CONTROLLED";
case MSGCODE_GET_AUTO_ENABLED:
return "SET_OSD_NAME";
case MSGCODE_WRITE_EEPROM:
return "WRITE_EEPROM";
+ default:
+ break;
}
return "unknown";
transmit_timeout = CEC_DEFAULT_TRANSMIT_TIMEOUT;
response.Clear();
packet.Clear();
- maxTries = CEC_DEFAULT_TRANSMIT_RETRIES + 1;
- tries = 0;
lineTimeout = 3;
- retryTimeout = 3;
bNextByteIsEscaped = false;
}
/*!
* @brief Create a message with a command that is to be transmitted over the CEC line.
* @param command The command to transmit.
- * @param iMaxTries The maximum number of tries.
- * @param iLineTimeout The line timeout to use when sending this message the first time.
- * @param iRetryLineTimeout The line timeout to use when retrying to send this message.
+ * @param iLineTimeout The line timeout to use when sending this message.
*/
- CCECAdapterMessage(const cec_command &command, uint8_t iMaxTries = 1, uint8_t iLineTimeout = 3, uint8_t iRetryLineTimeout = 3);
+ CCECAdapterMessage(const cec_command &command, uint8_t iLineTimeout = 3);
/*!
* @return the message as human readable string.
cec_adapter_messagecode Reply(void) const;
uint8_t maxTries; /**< the maximum number of times to try to send this message */
- uint8_t tries; /**< the amount of times this message has been sent */
cec_datapacket response; /**< the response to this message */
cec_datapacket packet; /**< the actual data */
cec_adapter_message_state state; /**< the current state of this message */
int32_t transmit_timeout; /**< the timeout to use when sending this message */
uint8_t lineTimeout; /**< the default CEC line timeout to use when sending this message */
- uint8_t retryTimeout; /**< the CEC line timeout to use when retrying to send this message */
private:
bool bNextByteIsEscaped; /**< true when the next byte that is added will be escaped, false otherwise */
using namespace PLATFORM;
using namespace std;
+#define MESSAGE_QUEUE_SIGNAL_WAIT_TIME 1000
+
CCECAdapterMessageQueueEntry::CCECAdapterMessageQueueEntry(CCECAdapterMessage *message) :
m_message(message),
m_iPacketsLeft(message->IsTranmission() ? message->Size() / 4 : 1),
{
{
CLockObject lock(m_mutex);
- CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - received response", ToString());
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - received response - %s", ToString(), message.ToString().c_str());
m_message->response = message.packet;
if (m_message->IsTranmission())
m_message->state = message.Message() == MSGCODE_TRANSMIT_SUCCEEDED ? ADAPTER_MESSAGE_STATE_SENT_ACKED : ADAPTER_MESSAGE_STATE_SENT_NOT_ACKED;
CCECAdapterMessageQueue::~CCECAdapterMessageQueue(void)
{
Clear();
+ StopThread(0);
}
void CCECAdapterMessageQueue::Clear(void)
{
+ StopThread(5);
CLockObject lock(m_mutex);
+ m_writeQueue.Clear();
m_messages.clear();
}
+void *CCECAdapterMessageQueue::Process(void)
+{
+ CCECAdapterMessageQueueEntry *message(NULL);
+ while (!IsStopped())
+ {
+ /* wait for a new message */
+ if (m_writeQueue.Pop(message, MESSAGE_QUEUE_SIGNAL_WAIT_TIME) && message)
+ {
+ /* write this message */
+ {
+ CLockObject lock(m_mutex);
+ m_com->WriteToDevice(message->m_message);
+ }
+ if (message->m_message->state == ADAPTER_MESSAGE_STATE_ERROR ||
+ message->m_message->Message() == MSGCODE_START_BOOTLOADER)
+ {
+ message->Signal();
+ Clear();
+ break;
+ }
+ }
+ }
+ return NULL;
+}
+
void CCECAdapterMessageQueue::MessageReceived(const CCECAdapterMessage &msg)
{
bool bHandled(false);
/* set the correct line timeout */
if (msg->IsTranmission())
{
- if (msg->tries == 1)
- m_com->SetLineTimeout(msg->lineTimeout);
- else
- m_com->SetLineTimeout(msg->retryTimeout);
+ m_com->SetLineTimeout(msg->lineTimeout);
}
- CCECAdapterMessageQueueEntry *entry(NULL);
+ CCECAdapterMessageQueueEntry *entry = new CCECAdapterMessageQueueEntry(msg);
uint64_t iEntryId(0);
/* add to the wait for ack queue */
if (msg->Message() != MSGCODE_START_BOOTLOADER)
{
CLockObject lock(m_mutex);
- entry = new CCECAdapterMessageQueueEntry(msg);
iEntryId = m_iNextMessage++;
m_messages.insert(make_pair(iEntryId, entry));
}
- /* TODO write the message async */
- if (!m_com->WriteToDevice(msg))
- {
- /* error! */
- Clear();
- return false;
- }
+ /* add the message to the write queue */
+ m_writeQueue.Push(entry);
bool bReturn(true);
if (entry)
bReturn = false;
}
- CLockObject lock(m_mutex);
- m_messages.erase(iEntryId);
+ if (msg->Message() != MSGCODE_START_BOOTLOADER)
+ {
+ CLockObject lock(m_mutex);
+ m_messages.erase(iEntryId);
+ }
+ delete entry;
}
return bReturn;
*/
#include "USBCECAdapterMessage.h"
+#include "../platform/threads/threads.h"
#include <map>
namespace CEC
*/
const char *ToString(void) const;
- private:
/*!
* @brief Called when a 'command accepted' message was received.
* @param message The message that was received.
PLATFORM::CMutex m_mutex; /**< mutex for changes to this class */
};
- class CCECAdapterMessageQueue
+ class CCECAdapterMessageQueue : public PLATFORM::CThread
{
friend class CUSBCECAdapterCommunication;
* @param iQueueSize The outgoing message queue size.
*/
CCECAdapterMessageQueue(CUSBCECAdapterCommunication *com) :
+ PLATFORM::CThread(),
m_com(com),
m_iNextMessage(0) {}
virtual ~CCECAdapterMessageQueue(void);
*/
bool Write(CCECAdapterMessage *msg);
+ virtual void *Process(void);
+
private:
CUSBCECAdapterCommunication * m_com; /**< the communication handler */
PLATFORM::CMutex m_mutex; /**< mutex for changes to this class */
std::map<uint64_t, CCECAdapterMessageQueueEntry *> m_messages; /**< the outgoing message queue */
+ PLATFORM::SyncedBuffer<CCECAdapterMessageQueueEntry *> m_writeQueue; /**< the queue for messages that are to be written */
uint64_t m_iNextMessage; /**< the index of the next message */
CCECAdapterMessage m_incomingAdapterMessage; /**< the current incoming message that's being assembled */
cec_command m_currentCECFrame; /**< the current incoming CEC command that's being assembled */
#define ToString(p) m_processor->ToString(p)
-CCECAudioSystem::CCECAudioSystem(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = 0 */) :
+CCECAudioSystem::CCECAudioSystem(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */) :
CCECBusDevice(processor, address, iPhysicalAddress),
m_systemAudioStatus(CEC_SYSTEM_AUDIO_STATUS_ON),
m_audioStatus(CEC_AUDIO_MUTE_STATUS_MASK)
class CCECAudioSystem : public CCECBusDevice
{
public:
- CCECAudioSystem(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = 0);
+ CCECAudioSystem(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = CEC_INVALID_PHYSICAL_ADDRESS);
virtual ~CCECAudioSystem(void) {};
- virtual bool SetAudioStatus(uint8_t status);
- virtual bool SetSystemAudioModeStatus(const cec_system_audio_status mode);
- virtual bool TransmitAudioStatus(cec_logical_address dest);
- virtual bool TransmitSetSystemAudioMode(cec_logical_address dest);
- virtual bool TransmitSystemAudioModeStatus(cec_logical_address dest);
+ bool SetAudioStatus(uint8_t status);
+ bool SetSystemAudioModeStatus(const cec_system_audio_status mode);
+ bool TransmitAudioStatus(cec_logical_address dest);
+ bool TransmitSetSystemAudioMode(cec_logical_address dest);
+ bool TransmitSystemAudioModeStatus(cec_logical_address dest);
- virtual uint8_t VolumeUp(bool bSendRelease = true);
- virtual uint8_t VolumeDown(bool bSendRelease = true);
- virtual uint8_t MuteAudio(bool bSendRelease = true);
+ uint8_t VolumeUp(bool bSendRelease = true);
+ uint8_t VolumeDown(bool bSendRelease = true);
+ uint8_t MuteAudio(bool bSendRelease = true);
- virtual bool TransmitActiveSource(void) { return false; }
+ bool TransmitActiveSource(void) { return false; }
protected:
cec_system_audio_status m_systemAudioStatus;
#define ToString(p) m_processor->ToString(p)
-CCECBusDevice::CCECBusDevice(CCECProcessor *processor, cec_logical_address iLogicalAddress, uint16_t iPhysicalAddress) :
- m_type(CEC_DEVICE_TYPE_RESERVED),
- m_iPhysicalAddress(iPhysicalAddress),
- m_iStreamPath(0),
- m_iLogicalAddress(iLogicalAddress),
- m_powerStatus(CEC_POWER_STATUS_UNKNOWN),
- m_processor(processor),
- m_vendor(CEC_VENDOR_UNKNOWN),
- m_bReplaceHandler(false),
- m_menuState(CEC_MENU_STATE_ACTIVATED),
- m_bActiveSource(false),
- m_iLastActive(0),
- m_iLastPowerStateUpdate(0),
- m_cecVersion(CEC_VERSION_UNKNOWN),
- m_deviceStatus(CEC_DEVICE_STATUS_UNKNOWN),
- m_iHandlerUseCount(0),
+CCECBusDevice::CCECBusDevice(CCECProcessor *processor, cec_logical_address iLogicalAddress, uint16_t iPhysicalAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */) :
+ m_type (CEC_DEVICE_TYPE_RESERVED),
+ m_iPhysicalAddress (iPhysicalAddress),
+ m_iStreamPath (CEC_INVALID_PHYSICAL_ADDRESS),
+ m_iLogicalAddress (iLogicalAddress),
+ m_powerStatus (CEC_POWER_STATUS_UNKNOWN),
+ m_processor (processor),
+ m_vendor (CEC_VENDOR_UNKNOWN),
+ m_bReplaceHandler (false),
+ m_menuState (CEC_MENU_STATE_ACTIVATED),
+ m_bActiveSource (false),
+ m_iLastActive (0),
+ m_iLastPowerStateUpdate (0),
+ m_cecVersion (CEC_VERSION_UNKNOWN),
+ m_deviceStatus (CEC_DEVICE_STATUS_UNKNOWN),
+ m_iHandlerUseCount (0),
m_bAwaitingReceiveFailed(false),
- m_bVendorIdRequested(false)
+ m_bVendorIdRequested (false)
{
m_handler = new CCECCommandHandler(this);
return m_cecVersion;
}
+bool CCECBusDevice::RequestActiveSource(bool bWaitForResponse /* = true */)
+{
+ bool bReturn(false);
+
+ if (MyLogicalAddressContains(m_iLogicalAddress))
+ {
+ MarkBusy();
+ CLibCEC::AddLog(CEC_LOG_NOTICE, "<< requesting active source");
+
+ bReturn = m_handler->TransmitRequestActiveSource(GetMyLogicalAddress(), bWaitForResponse);
+ MarkReady();
+ }
+ return bReturn;
+}
+
bool CCECBusDevice::RequestCecVersion(bool bWaitForResponse /* = true */)
{
bool bReturn(false);
return bReturn;
}
-uint16_t CCECBusDevice::GetPhysicalAddress(bool bUpdate /* = false */, bool bSuppressPoll /* = false */)
+uint16_t CCECBusDevice::GetPhysicalAddress(bool bSuppressUpdate /* = true */)
{
- bool bIsPresent(GetStatus(false, bSuppressPoll) == CEC_DEVICE_STATUS_PRESENT);
- bool bRequestUpdate(false);
+ if (!bSuppressUpdate)
{
- CLockObject lock(m_mutex);
- bRequestUpdate = bIsPresent &&
- (m_iPhysicalAddress == 0xFFFF || bUpdate);
- }
+ bool bIsPresent(GetStatus() == CEC_DEVICE_STATUS_PRESENT);
+ bool bRequestUpdate(false);
+ {
+ CLockObject lock(m_mutex);
+ bRequestUpdate = bIsPresent && m_iPhysicalAddress == CEC_INVALID_PHYSICAL_ADDRESS;
+ }
- if (bRequestUpdate)
- {
- CheckVendorIdRequested();
- if (!RequestPhysicalAddress())
- CLibCEC::AddLog(CEC_LOG_ERROR, "failed to request the physical address");
+ if (bRequestUpdate)
+ {
+ CheckVendorIdRequested();
+ if (!RequestPhysicalAddress())
+ CLibCEC::AddLog(CEC_LOG_ERROR, "failed to request the physical address");
+ }
}
CLockObject lock(m_mutex);
//@{
void CCECBusDevice::SetCecVersion(const cec_version newVersion)
{
+ if (m_cecVersion != newVersion)
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "%s (%X): CEC version %s", GetLogicalAddressName(), m_iLogicalAddress, ToString(newVersion));
m_cecVersion = newVersion;
- CLibCEC::AddLog(CEC_LOG_DEBUG, "%s (%X): CEC version %s", GetLogicalAddressName(), m_iLogicalAddress, ToString(newVersion));
}
void CCECBusDevice::SetMenuLanguage(const cec_menu_language &language)
{
CLockObject lock(m_mutex);
- if (language.device == m_iLogicalAddress)
+ if (language.device == m_iLogicalAddress &&
+ strcmp(language.language, m_menuLanguage.language))
{
CLibCEC::AddLog(CEC_LOG_DEBUG, ">> %s (%X): menu language set to '%s'", GetLogicalAddressName(), m_iLogicalAddress, language.language);
m_menuLanguage = language;
CLibCEC::AddLog(CEC_LOG_DEBUG, "marking %s (%X) as inactive source", GetLogicalAddressName(), m_iLogicalAddress);
m_bActiveSource = false;
}
-
- if (MyLogicalAddressContains(m_iLogicalAddress))
- SetPowerStatus(CEC_POWER_STATUS_STANDBY);
}
void CCECBusDevice::SetActiveSource(void)
CLockObject lock(m_mutex);
if (!m_bActiveSource)
CLibCEC::AddLog(CEC_LOG_DEBUG, "making %s (%x) the active source", GetLogicalAddressName(), m_iLogicalAddress);
+ else
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "%s (%x) was already marked as active source", GetLogicalAddressName(), m_iLogicalAddress);
for (int iPtr = 0; iPtr < 16; iPtr++)
if (iPtr != m_iLogicalAddress)
return false;
}
+void CCECBusDevice::ResetDeviceStatus(void)
+{
+ CLockObject lock(m_mutex);
+ SetPowerStatus (CEC_POWER_STATUS_UNKNOWN);
+ SetVendorId (CEC_VENDOR_UNKNOWN);
+ SetMenuState (CEC_MENU_STATE_ACTIVATED);
+ SetCecVersion (CEC_VERSION_UNKNOWN);
+ SetStreamPath (CEC_INVALID_PHYSICAL_ADDRESS);
+ SetOSDName (ToString(m_iLogicalAddress));
+ SetInactiveSource();
+ m_iLastActive = 0;
+ m_unsupportedFeatures.clear();
+}
+
void CCECBusDevice::SetDeviceStatus(const cec_bus_device_status newStatus)
{
{
case CEC_DEVICE_STATUS_UNKNOWN:
if (m_deviceStatus != newStatus)
CLibCEC::AddLog(CEC_LOG_DEBUG, "device status of %s changed into 'unknown'", ToString(m_iLogicalAddress));
- m_iStreamPath = 0;
- m_powerStatus = CEC_POWER_STATUS_UNKNOWN;
- m_vendor = CEC_VENDOR_UNKNOWN;
- m_menuState = CEC_MENU_STATE_ACTIVATED;
- m_bActiveSource = false;
- m_iLastActive = 0;
- m_cecVersion = CEC_VERSION_UNKNOWN;
- m_deviceStatus = newStatus;
+ ResetDeviceStatus();
+ m_deviceStatus = newStatus;
break;
case CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC:
if (m_deviceStatus != newStatus)
CLibCEC::AddLog(CEC_LOG_DEBUG, "device status of %s changed into 'handled by libCEC'", ToString(m_iLogicalAddress));
- m_iStreamPath = 0;
- m_powerStatus = CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON;
- m_vendor = CEC_VENDOR_UNKNOWN;
- m_menuState = CEC_MENU_STATE_ACTIVATED;
- m_bActiveSource = false;
- m_iLastActive = 0;
- m_cecVersion = CEC_VERSION_1_3A;
- m_deviceStatus = newStatus;
+ SetPowerStatus (CEC_POWER_STATUS_ON);
+ SetVendorId (CEC_VENDOR_UNKNOWN);
+ SetMenuState (CEC_MENU_STATE_ACTIVATED);
+ SetCecVersion (CEC_VERSION_1_3A);
+ SetStreamPath (CEC_INVALID_PHYSICAL_ADDRESS);
+ SetInactiveSource();
+ m_iLastActive = 0;
+ m_deviceStatus = newStatus;
break;
case CEC_DEVICE_STATUS_PRESENT:
if (m_deviceStatus != newStatus)
break;
case CEC_DEVICE_STATUS_NOT_PRESENT:
if (m_deviceStatus != newStatus)
+ {
CLibCEC::AddLog(CEC_LOG_DEBUG, "device status of %s changed into 'not present'", ToString(m_iLogicalAddress));
- m_deviceStatus = newStatus;
+ ResetDeviceStatus();
+ m_deviceStatus = newStatus;
+ }
break;
}
}
}
}
-void CCECBusDevice::SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress /* = 0 */)
+void CCECBusDevice::SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */)
{
CLockObject lock(m_mutex);
- if (iNewAddress > 0)
+ if (iNewAddress != m_iStreamPath)
{
CLibCEC::AddLog(CEC_LOG_DEBUG, ">> %s (%X): stream path changed from %04x to %04x", GetLogicalAddressName(), m_iLogicalAddress, iOldAddress == 0 ? m_iStreamPath : iOldAddress, iNewAddress);
m_iStreamPath = iNewAddress;
+ }
- // suppress polls when searching for a device
- CCECBusDevice *device = m_processor->GetDeviceByPhysicalAddress(iNewAddress, false, true);
+ CCECBusDevice *device = m_processor->GetDeviceByPhysicalAddress(iNewAddress);
+ if (device)
+ {
+ // if a device is found with the new physical address, mark it as active, which will automatically mark all other devices as inactive
+ device->SetActiveSource();
+ }
+ else
+ {
+ // try to find the device with the old address, and mark it as inactive when found
+ device = m_processor->GetDeviceByPhysicalAddress(iOldAddress);
if (device)
- {
- // if a device is found with the new physical address, mark it as active, which will automatically mark all other devices as inactive
- device->SetActiveSource();
- }
- else
- {
- // try to find the device with the old address, and mark it as inactive when found
- device = m_processor->GetDeviceByPhysicalAddress(iOldAddress, false, true);
- if (device)
- device->SetInactiveSource();
- }
-
- if (iNewAddress > 0)
- {
- lock.Unlock();
- SetPowerStatus(CEC_POWER_STATUS_ON);
- }
+ device->SetInactiveSource();
}
}
m_vendor = (cec_vendor_id)iVendorId;
}
- CLibCEC::AddLog(CEC_LOG_DEBUG, "%s (%X): vendor = %s (%06x)", GetLogicalAddressName(), m_iLogicalAddress, ToString(m_vendor), m_vendor);
+ if (bVendorChanged)
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "%s (%X): vendor = %s (%06x)", GetLogicalAddressName(), m_iLogicalAddress, ToString(m_vendor), m_vendor);
return bVendorChanged;
}
cec_device_type type;
{
CLockObject lock(m_mutex);
- if (m_iPhysicalAddress == 0xffff)
+ if (m_iPhysicalAddress == CEC_INVALID_PHYSICAL_ADDRESS)
return false;
CLibCEC::AddLog(CEC_LOG_NOTICE, "<< %s (%X) -> broadcast (F): physical adddress %4x", GetLogicalAddressName(), m_iLogicalAddress, m_iPhysicalAddress);
cec_power_status state;
{
CLockObject lock(m_mutex);
- if (!IsActiveSource())
- {
- CLibCEC::AddLog(CEC_LOG_NOTICE, "power state requested of %s (%X), but we are not the active source. setting power state to standby", GetLogicalAddressName(), m_iLogicalAddress);
- SetPowerStatus(CEC_POWER_STATUS_STANDBY);
- }
-
CLibCEC::AddLog(CEC_LOG_NOTICE, "<< %s (%X) -> %s (%X): %s", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, ToString(m_powerStatus));
state = m_powerStatus;
}
return bReturn;
}
-bool CCECBusDevice::IsUnsupportedFeature(cec_opcode opcode) const
+bool CCECBusDevice::IsUnsupportedFeature(cec_opcode opcode)
{
+ CLockObject lock(m_mutex);
bool bUnsupported = (m_unsupportedFeatures.find(opcode) != m_unsupportedFeatures.end());
if (bUnsupported)
- CLibCEC::AddLog(CEC_LOG_NOTICE, "'%s' is marked as unsupported feature for device '%s'", ToString(opcode), GetLogicalAddressName());
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "'%s' is marked as unsupported feature for device '%s'", ToString(opcode), GetLogicalAddressName());
return bUnsupported;
}
void CCECBusDevice::SetUnsupportedFeature(cec_opcode opcode)
{
- CLibCEC::AddLog(CEC_LOG_DEBUG, "marking opcode '%s' as unsupported feature for device '%s'", ToString(opcode), GetLogicalAddressName());
- m_unsupportedFeatures.insert(opcode);
+ // some commands should never be marked as unsupported
+ if (opcode == CEC_OPCODE_VENDOR_COMMAND ||
+ opcode == CEC_OPCODE_VENDOR_COMMAND_WITH_ID ||
+ opcode == CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN ||
+ opcode == CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP ||
+ opcode == CEC_OPCODE_ABORT ||
+ opcode == CEC_OPCODE_FEATURE_ABORT ||
+ opcode == CEC_OPCODE_NONE)
+ return;
+
+ {
+ CLockObject lock(m_mutex);
+ if (m_unsupportedFeatures.find(opcode) == m_unsupportedFeatures.end())
+ {
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "marking opcode '%s' as unsupported feature for device '%s'", ToString(opcode), GetLogicalAddressName());
+ m_unsupportedFeatures.insert(opcode);
+ }
+ }
+
+ // signal threads that are waiting for a reponse
+ MarkBusy();
+ m_handler->SignalOpcode(cec_command::GetResponseOpcode(opcode));
+ MarkReady();
}
bool CCECBusDevice::ActivateSource(void)
{
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "activating source '%s'", ToString(m_iLogicalAddress));
MarkBusy();
bool bReturn = m_handler->ActivateSource();
MarkReady();
}
}
+bool CCECBusDevice::TransmitPendingActiveSourceCommands(void)
+{
+ MarkBusy();
+ bool bReturn = m_handler->TransmitPendingActiveSourceCommands();
+ MarkReady();
+ return bReturn;
+}
+
//@}
friend class CCECProcessor;
public:
- CCECBusDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = 0);
+ CCECBusDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = CEC_INVALID_PHYSICAL_ADDRESS);
virtual ~CCECBusDevice(void);
virtual bool HandleCommand(const cec_command &command);
virtual cec_logical_address GetMyLogicalAddress(void) const;
virtual uint16_t GetMyPhysicalAddress(void) const;
virtual CStdString GetOSDName(bool bUpdate = false);
- virtual uint16_t GetPhysicalAddress(bool bUpdate = false, bool bSuppressPoll = false);
+ virtual uint16_t GetPhysicalAddress(bool bSuppressUpdate = true);
virtual cec_power_status GetPowerStatus(bool bUpdate = false);
virtual CCECProcessor * GetProcessor(void) const { return m_processor; }
virtual cec_device_type GetType(void) const { return m_type; }
virtual bool MyLogicalAddressContains(cec_logical_address address) const;
virtual cec_bus_device_status GetStatus(bool bForcePoll = false, bool bSuppressPoll = false);
virtual bool IsActiveSource(void) const { return m_bActiveSource; }
- virtual bool IsUnsupportedFeature(cec_opcode opcode) const;
+ virtual bool IsUnsupportedFeature(cec_opcode opcode);
virtual void SetUnsupportedFeature(cec_opcode opcode);
virtual void HandlePoll(cec_logical_address destination);
virtual void HandlePollFrom(cec_logical_address initiator);
virtual void SetDeviceStatus(const cec_bus_device_status newStatus);
virtual void SetPhysicalAddress(uint16_t iNewAddress);
- virtual void SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress = 0);
+ virtual void SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress = CEC_INVALID_PHYSICAL_ADDRESS);
virtual void SetCecVersion(const cec_version newVersion);
virtual void SetMenuLanguage(const cec_menu_language &menuLanguage);
virtual void SetOSDName(CStdString strName);
virtual bool TransmitKeyRelease(bool bWait = true);
bool ReplaceHandler(bool bActivateSource = true);
+ virtual bool TransmitPendingActiveSourceCommands(void);
+
+ virtual bool RequestActiveSource(bool bWaitForResponse = true);
protected:
+ void ResetDeviceStatus(void);
void CheckVendorIdRequested(void);
void MarkBusy(void);
void MarkReady(void);
#define ToString(p) m_processor->ToString(p)
-CCECPlaybackDevice::CCECPlaybackDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = 0 */) :
+CCECPlaybackDevice::CCECPlaybackDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */) :
CCECBusDevice(processor, address, iPhysicalAddress),
m_deckStatus(CEC_DECK_INFO_STOP),
m_deckControlMode(CEC_DECK_CONTROL_MODE_STOP)
class CCECPlaybackDevice : public CCECBusDevice
{
public:
- CCECPlaybackDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = 0);
+ CCECPlaybackDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = CEC_INVALID_PHYSICAL_ADDRESS);
virtual ~CCECPlaybackDevice(void) {};
- virtual cec_deck_info GetDeckStatus(void);
- virtual cec_deck_control_mode GetDeckControlMode(void);
+ cec_deck_info GetDeckStatus(void);
+ cec_deck_control_mode GetDeckControlMode(void);
- virtual void SetDeckStatus(cec_deck_info deckStatus);
- virtual void SetDeckControlMode(cec_deck_control_mode mode);
+ void SetDeckStatus(cec_deck_info deckStatus);
+ void SetDeckControlMode(cec_deck_control_mode mode);
- virtual bool TransmitDeckStatus(cec_logical_address dest);
+ bool TransmitDeckStatus(cec_logical_address dest);
protected:
cec_deck_info m_deckStatus;
using namespace CEC;
-CCECRecordingDevice::CCECRecordingDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = 0 */) :
+CCECRecordingDevice::CCECRecordingDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */) :
CCECBusDevice(processor, address, iPhysicalAddress),
m_playbackDevice(processor, address, iPhysicalAddress),
m_tuner(processor, address, iPhysicalAddress)
class CCECRecordingDevice : public CCECBusDevice
{
public:
- CCECRecordingDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = 0);
+ CCECRecordingDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = CEC_INVALID_PHYSICAL_ADDRESS);
virtual ~CCECRecordingDevice(void) {};
/* playback device methods */
- virtual cec_deck_info GetDeckStatus(void);
- virtual cec_deck_control_mode GetDeckControlMode(void);
+ cec_deck_info GetDeckStatus(void);
+ cec_deck_control_mode GetDeckControlMode(void);
- virtual void SetDeckStatus(cec_deck_info deckStatus);
- virtual void SetDeckControlMode(cec_deck_control_mode mode);
+ void SetDeckStatus(cec_deck_info deckStatus);
+ void SetDeckControlMode(cec_deck_control_mode mode);
- virtual bool TransmitDeckStatus(cec_logical_address dest);
+ bool TransmitDeckStatus(cec_logical_address dest);
/* tuner methods */
//TODO
using namespace CEC;
-CCECTV::CCECTV(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = 0 */) :
- CCECBusDevice(processor, address, iPhysicalAddress)
+CCECTV::CCECTV(CCECProcessor *processor, cec_logical_address address) :
+ CCECBusDevice(processor, address, CEC_PHYSICAL_ADDRESS_TV)
{
- m_type = CEC_DEVICE_TYPE_TV;
+ m_type = CEC_DEVICE_TYPE_TV;
}
class CCECTV : public CCECBusDevice
{
public:
- CCECTV(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = 0);
+ CCECTV(CCECProcessor *processor, cec_logical_address address);
virtual ~CCECTV(void) {};
};
}
using namespace CEC;
-CCECTuner::CCECTuner(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = 0 */) :
+CCECTuner::CCECTuner(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */) :
CCECBusDevice(processor, address, iPhysicalAddress)
{
m_type = CEC_DEVICE_TYPE_TUNER;
class CCECTuner : public CCECBusDevice
{
public:
- CCECTuner(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = 0);
+ CCECTuner(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = CEC_INVALID_PHYSICAL_ADDRESS);
virtual ~CCECTuner(void) {};
};
}
CANCommandHandler(CCECBusDevice *busDevice);
virtual ~CANCommandHandler(void) {};
- virtual bool HandleCommand(const cec_command &command);
+ bool HandleCommand(const cec_command &command);
+
protected:
- virtual bool HandleVendorRemoteButtonDown(const cec_command &command);
- virtual bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination);
+ bool HandleVendorRemoteButtonDown(const cec_command &command);
+ bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination);
};
};
{
CCECBusDevice *device = GetDevice(command.destination);
if (device)
- {
- device->SetActiveSource();
- return device->TransmitPhysicalAddress() &&
- device->TransmitImageViewOn() &&
- device->TransmitActiveSource();
- }
+ return device->TransmitPhysicalAddress();
}
return false;
{
if (m_processor->IsRunning() && m_busDevice->MyLogicalAddressContains(command.destination))
{
- if (command.parameters[0] == CEC_MENU_REQUEST_TYPE_QUERY)
+ CCECBusDevice *device = GetDevice(command.destination);
+ if (device)
{
- CCECBusDevice *device = GetDevice(command.destination);
- if (device)
- return device->TransmitMenuState(command.initiator);
+ if (command.parameters[0] == CEC_MENU_REQUEST_TYPE_ACTIVATE)
+ {
+ if (CLibCEC::MenuStateChanged(CEC_MENU_STATE_ACTIVATED) == 1)
+ device->SetMenuState(CEC_MENU_STATE_ACTIVATED);
+ }
+ else if (command.parameters[0] == CEC_MENU_REQUEST_TYPE_DEACTIVATE)
+ {
+ if (CLibCEC::MenuStateChanged(CEC_MENU_STATE_DEACTIVATED) == 1)
+ device->SetMenuState(CEC_MENU_STATE_DEACTIVATED);
+ }
+ return device->TransmitMenuState(command.initiator);
}
}
if (m_processor->IsRunning())
{
CLibCEC::AddLog(CEC_LOG_DEBUG, ">> %i requests active source", (uint8_t) command.initiator);
+ m_processor->m_busDevices[command.initiator]->SetPowerStatus(CEC_POWER_STATUS_ON);
vector<CCECBusDevice *> devices;
for (size_t iDevicePtr = 0; iDevicePtr < GetMyDevices(devices); iDevicePtr++)
size_t iReturn(0);
cec_logical_addresses addresses = m_processor->GetLogicalAddresses();
- for (uint8_t iPtr = 0; iPtr < 16; iPtr++)
+ for (uint8_t iPtr = CECDEVICE_TV; iPtr < CECDEVICE_BROADCAST; iPtr++)
{
if (addresses[iPtr])
{
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_IMAGE_VIEW_ON);
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitStandby(const cec_logical_address iInitiator, const cec_logical_address iDestination)
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_STANDBY);
- return Transmit(command, false);
+ return Transmit(command);
+}
+
+bool CCECCommandHandler::TransmitRequestActiveSource(const cec_logical_address iInitiator, bool bWaitForResponse /* = true */)
+{
+ cec_command command;
+ cec_command::Format(command, iInitiator, CECDEVICE_BROADCAST, CEC_OPCODE_REQUEST_ACTIVE_SOURCE);
+
+ return Transmit(command, !bWaitForResponse);
}
bool CCECCommandHandler::TransmitRequestCecVersion(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GET_CEC_VERSION);
- return Transmit(command, bWaitForResponse, CEC_OPCODE_CEC_VERSION);
+ return Transmit(command, !bWaitForResponse);
}
bool CCECCommandHandler::TransmitRequestMenuLanguage(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GET_MENU_LANGUAGE);
- return Transmit(command, bWaitForResponse, CEC_OPCODE_SET_MENU_LANGUAGE);
+ return Transmit(command, !bWaitForResponse);
}
bool CCECCommandHandler::TransmitRequestOSDName(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_OSD_NAME);
- return Transmit(command, bWaitForResponse, CEC_OPCODE_SET_OSD_NAME);
+ return Transmit(command, !bWaitForResponse);
}
bool CCECCommandHandler::TransmitRequestPhysicalAddress(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_PHYSICAL_ADDRESS);
- return Transmit(command, bWaitForResponse, CEC_OPCODE_REPORT_PHYSICAL_ADDRESS);
+ return Transmit(command, !bWaitForResponse);
}
bool CCECCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_DEVICE_POWER_STATUS);
- return Transmit(command, bWaitForResponse, CEC_OPCODE_REPORT_POWER_STATUS);
+ return Transmit(command, !bWaitForResponse);
}
bool CCECCommandHandler::TransmitRequestVendorId(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID);
- return Transmit(command, bWaitForResponse, CEC_OPCODE_DEVICE_VENDOR_ID);
+ return Transmit(command, !bWaitForResponse);
}
bool CCECCommandHandler::TransmitActiveSource(const cec_logical_address iInitiator, uint16_t iPhysicalAddress)
command.parameters.PushBack((uint8_t) ((iPhysicalAddress >> 8) & 0xFF));
command.parameters.PushBack((uint8_t) (iPhysicalAddress & 0xFF));
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitCECVersion(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_version cecVersion)
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_CEC_VERSION);
command.parameters.PushBack((uint8_t)cecVersion);
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitInactiveSource(const cec_logical_address iInitiator, uint16_t iPhysicalAddress)
command.parameters.PushBack((iPhysicalAddress >> 8) & 0xFF);
command.parameters.PushBack(iPhysicalAddress & 0xFF);
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitMenuState(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_menu_state menuState)
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_MENU_STATUS);
command.parameters.PushBack((uint8_t)menuState);
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitOSDName(const cec_logical_address iInitiator, const cec_logical_address iDestination, CStdString strDeviceName)
for (size_t iPtr = 0; iPtr < strDeviceName.length(); iPtr++)
command.parameters.PushBack(strDeviceName.at(iPtr));
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitOSDString(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_display_control duration, const char *strMessage)
for (size_t iPtr = 0; iPtr < iLen; iPtr++)
command.parameters.PushBack(strMessage[iPtr]);
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitPhysicalAddress(const cec_logical_address iInitiator, uint16_t iPhysicalAddress, cec_device_type type)
command.parameters.PushBack((uint8_t) (iPhysicalAddress & 0xFF));
command.parameters.PushBack((uint8_t) (type));
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitSetMenuLanguage(const cec_logical_address iInitiator, const char lang[3])
command.parameters.PushBack((uint8_t) lang[1]);
command.parameters.PushBack((uint8_t) lang[2]);
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitPoll(const cec_logical_address iInitiator, const cec_logical_address iDestination)
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_NONE);
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitPowerState(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_power_status state)
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_REPORT_POWER_STATUS);
command.parameters.PushBack((uint8_t) state);
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitVendorID(const cec_logical_address iInitiator, uint64_t iVendorId)
command.parameters.PushBack((uint8_t) (((uint64_t)iVendorId >> 8) & 0xFF));
command.parameters.PushBack((uint8_t) ((uint64_t)iVendorId & 0xFF));
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitAudioStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, uint8_t state)
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_REPORT_AUDIO_STATUS);
command.parameters.PushBack(state);
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitSetSystemAudioMode(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_system_audio_status state)
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_SET_SYSTEM_AUDIO_MODE);
command.parameters.PushBack((uint8_t)state);
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitSetStreamPath(uint16_t iStreamPath)
command.parameters.PushBack((uint8_t) ((iStreamPath >> 8) & 0xFF));
command.parameters.PushBack((uint8_t) (iStreamPath & 0xFF));
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitSystemAudioModeStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_system_audio_status state)
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS);
command.parameters.PushBack((uint8_t)state);
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitDeckStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_deck_info state)
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_DECK_STATUS);
command.PushBack((uint8_t)state);
- return Transmit(command, false);
+ return Transmit(command);
}
bool CCECCommandHandler::TransmitKeypress(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_user_control_code key, bool bWait /* = true */)
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_USER_CONTROL_PRESSED);
command.parameters.PushBack((uint8_t)key);
- return Transmit(command, bWait);
+ return Transmit(command, !bWait);
}
bool CCECCommandHandler::TransmitKeyRelease(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWait /* = true */)
cec_command command;
cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_USER_CONTROL_RELEASE);
- return Transmit(command, bWait);
+ return Transmit(command, !bWait);
}
-bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /* = true */, cec_opcode expectedResponse /* = CEC_OPCODE_NONE */)
+bool CCECCommandHandler::Transmit(cec_command &command, bool bSuppressWait /* = false */)
{
bool bReturn(false);
+ cec_opcode expectedResponse(cec_command::GetResponseOpcode(command.opcode));
+ bool bExpectResponse(expectedResponse != CEC_OPCODE_NONE && !bSuppressWait);
command.transmit_timeout = m_iTransmitTimeout;
if (command.initiator == CECDEVICE_UNKNOWN)
}
{
- uint8_t iTries(0), iMaxTries(command.opcode == CEC_OPCODE_NONE ? 1 : m_iTransmitRetries + 1);
- while (!bReturn && ++iTries <= iMaxTries)
+ uint8_t iTries(0), iMaxTries(!command.opcode_set ? 1 : m_iTransmitRetries + 1);
+ while (!bReturn && ++iTries <= iMaxTries && !m_busDevice->IsUnsupportedFeature(command.opcode))
{
if ((bReturn = m_processor->Transmit(command)) == true)
{
}
return true;
}
+
+void CCECCommandHandler::SignalOpcode(cec_opcode opcode)
+{
+ m_waitForResponse->Received(opcode);
+}
m_waitingFor.clear();
}
- bool Wait(cec_opcode opcode, uint32_t iTimeout = 2000)
+ bool Wait(cec_opcode opcode, uint32_t iTimeout = CEC_DEFAULT_TRANSMIT_WAIT)
{
CResponse *response = GetEvent(opcode);
return response ? response->Wait(iTimeout) : false;
virtual bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination);
virtual bool TransmitImageViewOn(const cec_logical_address iInitiator, const cec_logical_address iDestination);
virtual bool TransmitStandby(const cec_logical_address iInitiator, const cec_logical_address iDestination);
+ virtual bool TransmitRequestActiveSource(const cec_logical_address iInitiator, bool bWaitForResponse = true);
virtual bool TransmitRequestCecVersion(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
virtual bool TransmitRequestMenuLanguage(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
virtual bool TransmitRequestOSDName(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
virtual bool TransmitKeyRelease(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWait = true);
virtual bool TransmitSetStreamPath(uint16_t iStreamPath);
virtual bool SendDeckStatusUpdateOnActiveSource(void) const { return m_bOPTSendDeckStatusUpdateOnActiveSource; };
+ virtual bool TransmitPendingActiveSourceCommands(void) { return true; }
+
+ virtual void SignalOpcode(cec_opcode opcode);
protected:
virtual bool HandleActiveSource(const cec_command &command);
virtual bool SetVendorId(const cec_command &command);
virtual void SetPhysicalAddress(cec_logical_address iAddress, uint16_t iNewAddress);
- virtual bool Transmit(cec_command &command, bool bExpectResponse = true, cec_opcode expectedResponse = CEC_OPCODE_NONE);
+ virtual bool Transmit(cec_command &command, bool bSuppressWait = false);
CCECBusDevice * m_busDevice;
CCECProcessor * m_processor;
CRLCommandHandler(CCECBusDevice *busDevice);
virtual ~CRLCommandHandler(void) {};
- virtual bool InitHandler(void);
+ bool InitHandler(void);
};
};
{
uint16_t iAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]);
CCECBusDevice *primary = m_processor->GetPrimaryDevice();
- bool bSendPowerOffState(iAddress != primary->GetPhysicalAddress(false) && primary->IsActiveSource());
+ bool bSendPowerOffState(iAddress != primary->GetPhysicalAddress() && primary->IsActiveSource());
m_processor->SetActiveSource(iAddress);
if (bSendPowerOffState)
{
cec_command response;
cec_command::Format(response, m_processor->GetLogicalAddress(), command.initiator, CEC_OPCODE_FEATURE_ABORT);
- return Transmit(response, false);
+ return Transmit(response);
}
return true;
}
-bool CSLCommandHandler::HandleGivePhysicalAddress(const cec_command &command)
-{
- if (m_processor->IsRunning() && m_busDevice->MyLogicalAddressContains(command.destination))
- {
- CCECBusDevice *device = GetDevice(command.destination);
- if (device)
- return device->TransmitPhysicalAddress(); // only the physical address, don't send image view on
- }
-
- return false;
-}
-
bool CSLCommandHandler::HandleVendorCommand(const cec_command &command)
{
if (!m_busDevice->MyLogicalAddressContains(command.destination))
response.PushBack(SL_COMMAND_UNKNOWN_02);
response.PushBack(SL_COMMAND_TYPE_HDDRECORDER);
- Transmit(response, false);
+ Transmit(response);
}
void CSLCommandHandler::HandleVendorCommandPowerOn(const cec_command &command)
cec_command::Format(response, iSource, iDestination, CEC_OPCODE_VENDOR_COMMAND);
response.PushBack(SL_COMMAND_SET_DEVICE_MODE);
response.PushBack((uint8_t)type);
- Transmit(response, false);
+ Transmit(response);
}
bool CSLCommandHandler::HandleGiveDeckStatus(const cec_command &command)
cec_command::Format(command, CECDEVICE_TV, iDestination, CEC_OPCODE_VENDOR_COMMAND);
command.PushBack(SL_COMMAND_POWER_ON);
command.PushBack(0);
- return Transmit(command, false);
+ return Transmit(command);
}
return CCECCommandHandler::PowerOn(iInitiator, iDestination);
CSLCommandHandler(CCECBusDevice *busDevice);
virtual ~CSLCommandHandler(void) {};
- virtual bool InitHandler(void);
- virtual bool ActivateSource(void);
+ bool InitHandler(void);
+ bool ActivateSource(void);
protected:
- virtual bool HandleActiveSource(const cec_command &command);
- virtual bool HandleDeviceVendorId(const cec_command &command);
- virtual bool HandleGivePhysicalAddress(const cec_command &command);
- virtual bool HandleVendorCommand(const cec_command &command);
+ bool HandleActiveSource(const cec_command &command);
+ bool HandleDeviceVendorId(const cec_command &command);
+ bool HandleVendorCommand(const cec_command &command);
- virtual void HandleVendorCommand01(const cec_command &command);
- virtual void TransmitVendorCommand0205(const cec_logical_address iSource, const cec_logical_address iDestination);
+ void HandleVendorCommand01(const cec_command &command);
+ void TransmitVendorCommand0205(const cec_logical_address iSource, const cec_logical_address iDestination);
- virtual void HandleVendorCommandPowerOn(const cec_command &command);
- virtual void HandleVendorCommandPowerOnStatus(const cec_command &command);
+ void HandleVendorCommandPowerOn(const cec_command &command);
+ void HandleVendorCommandPowerOnStatus(const cec_command &command);
- virtual void HandleVendorCommandSLConnect(const cec_command &command);
- virtual void TransmitVendorCommandSetDeviceMode(const cec_logical_address iSource, const cec_logical_address iDestination, const cec_device_type type);
+ void HandleVendorCommandSLConnect(const cec_command &command);
+ void TransmitVendorCommandSetDeviceMode(const cec_logical_address iSource, const cec_logical_address iDestination, const cec_device_type type);
- virtual bool HandleGiveDevicePowerStatus(const cec_command &command);
- virtual bool HandleGiveDeckStatus(const cec_command &command);
- virtual bool HandleRequestActiveSource(const cec_command &command);
- virtual bool HandleFeatureAbort(const cec_command &command);
- virtual bool HandleStandby(const cec_command &command);
- virtual bool TransmitMenuState(const cec_logical_address UNUSED(iInitiator), const cec_logical_address UNUSED(iDestination), cec_menu_state UNUSED(menuState)) { return true; }
- virtual bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination);
+ bool HandleGiveDevicePowerStatus(const cec_command &command);
+ bool HandleGiveDeckStatus(const cec_command &command);
+ bool HandleRequestActiveSource(const cec_command &command);
+ bool HandleFeatureAbort(const cec_command &command);
+ bool HandleStandby(const cec_command &command);
+ bool TransmitMenuState(const cec_logical_address UNUSED(iInitiator), const cec_logical_address UNUSED(iDestination), cec_menu_state UNUSED(menuState)) { return true; }
+ bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination);
- virtual void ResetSLState(void);
- virtual bool SLInitialised(void);
- virtual void SetSLInitialised(void);
- virtual bool ActiveSourceSent(void);
+ void ResetSLState(void);
+ bool SLInitialised(void);
+ void SetSLInitialised(void);
+ bool ActiveSourceSent(void);
bool m_bSLEnabled;
bool m_bActiveSourceSent;
#include "VLCommandHandler.h"
#include "../devices/CECBusDevice.h"
#include "../CECProcessor.h"
+#include "../LibCEC.h"
+
+#define VL_POWER_CHANGE 0x20
+#define VL_POWERED_UP 0x00
+#define VL_POWERED_DOWN 0x01
using namespace CEC;
+using namespace PLATFORM;
CVLCommandHandler::CVLCommandHandler(CCECBusDevice *busDevice) :
- CCECCommandHandler(busDevice)
+ CCECCommandHandler(busDevice),
+ m_bActiveSourcePending(false),
+ m_bPowerUpEventReceived(false)
{
m_vendorId = CEC_VENDOR_PANASONIC;
+
+ /* use the VL commandhandler for the primary device that is handled by libCEC */
+ if (busDevice->GetLogicalAddress() == CECDEVICE_TV)
+ {
+ CCECBusDevice *primary = m_processor->GetPrimaryDevice();
+ if (primary && m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
+ {
+ primary->SetVendorId(CEC_VENDOR_PANASONIC);
+ primary->ReplaceHandler(false);
+ }
+ }
}
bool CVLCommandHandler::InitHandler(void)
{
CCECBusDevice *primary = m_processor->GetPrimaryDevice();
if (primary->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE)
- {
return m_processor->ChangeDeviceType(CEC_DEVICE_TYPE_RECORDING_DEVICE, CEC_DEVICE_TYPE_PLAYBACK_DEVICE);
- }
+
return CCECCommandHandler::InitHandler();
}
+
+bool CVLCommandHandler::HandleDeviceVendorCommandWithId(const cec_command &command)
+{
+ if (command.initiator == CECDEVICE_TV &&
+ command.destination == CECDEVICE_BROADCAST &&
+ command.parameters.At(3) == VL_POWER_CHANGE)
+ {
+ if (command.parameters.At(4) == VL_POWERED_UP)
+ {
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "TV powered up");
+ {
+ CLockObject lock(m_mutex);
+ m_bPowerUpEventReceived = true;
+ }
+ m_processor->TransmitPendingActiveSourceCommands();
+ }
+ else if (command.parameters.At(4) == VL_POWERED_DOWN)
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "TV powered down");
+ else if (command.parameters.At(4) == VL_POWERED_DOWN)
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "unknown vendor command");
+
+ return true;
+ }
+
+ return CCECCommandHandler::HandleDeviceVendorCommandWithId(command);
+}
+
+bool CVLCommandHandler::TransmitActiveSource(const cec_logical_address iInitiator, uint16_t iPhysicalAddress)
+{
+ bool bPowerUpEventReceived(false);
+
+ CCECBusDevice *tv = m_processor->m_busDevices[CECDEVICE_TV];
+ if (tv && tv->GetVendorId(false) == CEC_VENDOR_PANASONIC)
+ {
+ CVLCommandHandler *handler = static_cast<CVLCommandHandler *>(tv->GetHandler());
+ bPowerUpEventReceived = handler ? handler->PowerUpEventReceived() : false;
+ }
+
+ if (!bPowerUpEventReceived)
+ {
+ CLockObject lock(m_mutex);
+ // wait until we received the event
+ m_bActiveSourcePending = true;
+ return true;
+ }
+ else
+ {
+ // transmit standard active source message
+ return CCECCommandHandler::TransmitActiveSource(iInitiator, iPhysicalAddress);
+ }
+}
+
+bool CVLCommandHandler::TransmitPendingActiveSourceCommands(void)
+{
+ bool bTransmitCommand(false);
+ {
+ CLockObject lock(m_mutex);
+ bTransmitCommand = m_bActiveSourcePending;
+ m_bActiveSourcePending = false;
+ }
+
+ if (bTransmitCommand)
+ {
+ CLibCEC::AddLog(CEC_LOG_DEBUG, "transmitting delayed activate source command");
+ return CCECCommandHandler::TransmitActiveSource(m_busDevice->GetLogicalAddress(), m_busDevice->GetPhysicalAddress());
+ }
+ return true;
+}
+
+bool CVLCommandHandler::PowerUpEventReceived(void)
+{
+ {
+ CLockObject lock(m_mutex);
+ if (m_bPowerUpEventReceived)
+ return true;
+ }
+
+ cec_power_status powerStatus = m_busDevice->GetPowerStatus();
+
+ CLockObject lock(m_mutex);
+ m_bPowerUpEventReceived = (powerStatus == CEC_POWER_STATUS_ON);
+ return m_bPowerUpEventReceived;
+}
public:
CVLCommandHandler(CCECBusDevice *busDevice);
virtual ~CVLCommandHandler(void) {};
- virtual bool InitHandler(void);
+
+ bool InitHandler(void);
+
+ bool HandleDeviceVendorCommandWithId(const cec_command &command);
+ bool TransmitActiveSource(const cec_logical_address iInitiator, uint16_t iPhysicalAddress);
+ bool TransmitPendingActiveSourceCommands(void);
+
+ bool PowerUpEventReceived(void);
+
+ private:
+ PLATFORM::CMutex m_mutex;
+ bool m_bActiveSourcePending;
+ bool m_bPowerUpEventReceived;
};
};
typedef pthread_t thread_t;
#define ThreadsCreate(thread, func, arg) (pthread_create(&thread, NULL, (void *(*) (void *))func, (void *)arg) == 0)
- #define ThreadsWait(thread, retval) (pthread_join(thread, retval) == 0)
+ #define ThreadsWait(thread, retval) (thread ? pthread_join(thread, retval) == 0 : true)
typedef pthread_mutex_t mutex_t;
#define MutexCreate(mutex) pthread_mutex_init(&mutex, GetRecursiveMutexAttribute());
virtual ~CThread(void)
{
StopThread(0);
+ void *retVal;
+ ThreadsWait(m_thread, &retVal);
+ #if defined(__WINDOWS__)
+ (void *)retVal; //"unreferenced local variable" warning
+ #endif
}
static void *ThreadHandler(CThread *thread)
virtual bool CreateThread(bool bWait = true)
{
- bool bReturn(false);
- CLockObject lock(m_threadMutex);
- if (!IsRunning())
+ bool bReturn(false);
+ CLockObject lock(m_threadMutex);
+ if (!IsRunning())
+ {
+ m_bStop = false;
+ if (ThreadsCreate(m_thread, CThread::ThreadHandler, ((void*)static_cast<CThread *>(this))))
{
- m_bStop = false;
- if (ThreadsCreate(m_thread, CThread::ThreadHandler, ((void*)static_cast<CThread *>(this))))
- {
- if (bWait)
- m_threadCondition.Wait(m_threadMutex, m_bRunning);
- bReturn = true;
- }
+ if (bWait)
+ m_threadCondition.Wait(m_threadMutex, m_bRunning);
+ bReturn = true;
}
+ }
return bReturn;
}
protected:
void SetRunning(bool bSetTo);
+ CMutex m_threadMutex;
private:
bool m_bStop;
bool m_bRunning;
bool m_bStopped;
CCondition<bool> m_threadCondition;
- CMutex m_threadMutex;
thread_t m_thread;
};
};
{
public:
SyncedBuffer(size_t iMaxSize = 100) :
- m_maxSize(iMaxSize) {}
+ m_maxSize(iMaxSize),
+ m_bHasMessages(false) {}
virtual ~SyncedBuffer(void)
{
CLockObject lock(m_mutex);
while (!m_buffer.empty())
m_buffer.pop();
+ m_condition.Broadcast();
}
size_t Size(void)
return false;
m_buffer.push(entry);
+ m_bHasMessages = true;
+ m_condition.Signal();
return true;
}
- bool Pop(_BType &entry)
+ bool Pop(_BType &entry, uint32_t iTimeoutMs = 0)
{
bool bReturn(false);
CLockObject lock(m_mutex);
+
+ // wait for a signal if the buffer is empty
+ if (m_buffer.empty() && iTimeoutMs > 0)
+ {
+ if (!m_condition.Wait(m_mutex, m_bHasMessages, iTimeoutMs))
+ return bReturn;
+ }
+
+ // pop the first item
if (!m_buffer.empty())
{
entry = m_buffer.front();
m_buffer.pop();
+ m_bHasMessages = !m_buffer.empty();
bReturn = true;
}
return bReturn;
size_t m_maxSize;
std::queue<_BType> m_buffer;
CMutex m_mutex;
+ CCondition<bool> m_condition;
+ bool m_bHasMessages;
};
};
return 0;
}
-void EnableCallbacks(ICECAdapter *adapter)
+int CecAlert(void *UNUSED(cbParam), const libcec_alert type, const libcec_parameter &UNUSED(param))
{
- g_callbacks.CBCecLogMessage = &CecLogMessage;
- g_callbacks.CBCecKeyPress = &CecKeyPress;
- g_callbacks.CBCecCommand = &CecCommand;
- g_callbacks.CBCecConfigurationChanged = NULL;
- g_callbacks.CBCecAlert = NULL;
- adapter->EnableCallbacks(NULL, &g_callbacks);
+ switch (type)
+ {
+ case CEC_ALERT_CONNECTION_LOST:
+ PrintToStdOut("Connection lost - exiting\n");
+ g_bExit = true;
+ break;
+ default:
+ break;
+ }
+ return 0;
}
void ListDevices(ICECAdapter *parser)
for (int8_t iDevicePtr = 0; iDevicePtr < iDevicesFound; iDevicePtr++)
{
- strDeviceInfo.AppendFormat("device: %d\ncom port: %s\n", iDevicePtr + 1, devices[iDevicePtr].comm);
+ strDeviceInfo.AppendFormat("device: %d\ncom port: %s\n", iDevicePtr + 1, devices[iDevicePtr].comm);
libcec_configuration config;
config.Clear();
if (!parser->GetDeviceInformation(devices[iDevicePtr].comm, &config))
PrintToStdOut("WARNING: unable to open the device on port %s", devices[iDevicePtr].comm);
else
- strDeviceInfo.AppendFormat("firmware version: %d\n", config.iFirmwareVersion);
+ {
+ strDeviceInfo.AppendFormat("firmware version: %d\n", config.iFirmwareVersion);
+
+ if (config.iFirmwareBuildDate != CEC_FW_BUILD_UNKNOWN)
+ {
+ time_t buildTime = (time_t)config.iFirmwareBuildDate;
+ strDeviceInfo.AppendFormat("firmware build date: %s", asctime(gmtime(&buildTime)));
+ strDeviceInfo = strDeviceInfo.Left((int)strDeviceInfo.length() - 1); // strip \n added by asctime
+ strDeviceInfo.append(" +0000");
+ }
+ }
strDeviceInfo.append("\n");
}
PrintToStdOut(strDeviceInfo.c_str());
if (GetWord(arguments, strAddress))
{
sscanf(strAddress.c_str(), "%x", &iAddress);
- if (iAddress >= 0 && iAddress <= 0xFFFF)
+ if (iAddress >= 0 && iAddress <= CEC_INVALID_PHYSICAL_ADDRESS)
parser->SetStreamPath((uint16_t)iAddress);
return true;
}
{
if (command == "as")
{
- parser->SetActiveView();
+ parser->SetActiveSource();
return true;
}
{
if (command == "scan")
{
- PrintToStdOut("CEC bus information");
- PrintToStdOut("===================");
+ CStdString strLog;
+ PrintToStdOut("requesting CEC bus information ...");
+
+ strLog.append("CEC bus information\n===================\n");
cec_logical_addresses addresses = parser->GetActiveDevices();
for (uint8_t iPtr = 0; iPtr < 16; iPtr++)
{
if (addresses[iPtr])
{
- CStdString strLog;
uint64_t iVendorId = parser->GetDeviceVendorId((cec_logical_address)iPtr);
bool bActive = parser->IsActiveSource((cec_logical_address)iPtr);
uint16_t iPhysicalAddress = parser->GetDevicePhysicalAddress((cec_logical_address)iPtr);
strLog.AppendFormat("power status: %s\n", parser->ToString(power));
if ((uint8_t)lang.device == iPtr)
strLog.AppendFormat("language: %s\n", lang.language);
- strLog.append("\n");
- PrintToStdOut(strLog);
+ strLog.append("\n\n");
}
}
+
+ cec_logical_address activeSource = parser->GetActiveSource();
+ strLog.AppendFormat("currently active source: %s (%d)", parser->ToString(activeSource), (int)activeSource);
+
+ PrintToStdOut(strLog);
return true;
}
{
g_config.Clear();
snprintf(g_config.strDeviceName, 13, "CECTester");
- g_config.callbackParam = NULL;
- g_config.clientVersion = CEC_CLIENT_VERSION_1_6_1;
+ g_config.clientVersion = CEC_CLIENT_VERSION_1_6_2;
+ g_config.bActivateSource = 0;
g_callbacks.CBCecLogMessage = &CecLogMessage;
g_callbacks.CBCecKeyPress = &CecKeyPress;
g_callbacks.CBCecCommand = &CecCommand;
+ g_callbacks.CBCecAlert = &CecAlert;
g_config.callbacks = &g_callbacks;
if (!ProcessCommandLineArguments(argc, argv))
rem Check for VC9
IF "%VS90COMNTOOLS%"=="" (
set COMPILER9="%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe"
-) ELSE IF EXIST "%VS90COMNTOOLS%\..\IDE\VCExpress.exe" (
- set COMPILER9="%VS90COMNTOOLS%\..\IDE\VCExpress.exe"
) ELSE IF EXIST "%VS90COMNTOOLS%\..\IDE\devenv.exe" (
set COMPILER9="%VS90COMNTOOLS%\..\IDE\devenv.exe"
) ELSE GOTO NOSDK9
rmdir ..\build\x64
cd ..\support
-exit %EXITCODE%
+IF "%1%"=="" (
+ echo. exitcode = %EXITCODE%
+) ELSE (
+ exit %EXITCODE%
+)
+