diff options
author | Petre Eftime <[email protected]> | 2015-11-26 13:49:50 +0200 |
---|---|---|
committer | Petre Eftime <[email protected]> | 2015-11-27 14:45:15 +0200 |
commit | 8bd02d2a96c31eac64fb4144cf928462c74f4623 (patch) | |
tree | 7be6c3b1bd26d383da55b46facc89acf1911b31d |
Version 0.2.0v0.2.0
Signed-off-by: Petre Eftime <[email protected]>
46 files changed, 20260 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..6612c266 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +build/ + +# Object files +*.o +*.lib +*.so +*.so.* +*.lo +*.la +*.pyc + +# Temp files +*.swp +*.swo +*~ + +# Eclipse files +.cproject +.project diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..66dcdb67 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,78 @@ +cmake_minimum_required (VERSION 3.1) +project (tinyb) + +FIND_PACKAGE (Threads REQUIRED) +FIND_PACKAGE (PkgConfig REQUIRED) +FIND_PACKAGE (Git) + +PKG_CHECK_MODULES (GLIB2 REQUIRED glib-2.0) +PKG_CHECK_MODULES (GIO REQUIRED gio-2.0) +PKG_CHECK_MODULES (GIO-UNIX REQUIRED gio-unix-2.0) + +set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -fno-omit-frame-pointer -DDEBUG") +set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall") +set (LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "Installation path for libraries") + +# Set CMAKE_LIB_INSTALL_DIR if not defined +include(GNUInstallDirs) + +# Appends the cmake/modules path to MAKE_MODULE_PATH variable. +set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) + +# Make a version file containing the current version from git. +include (GetGitRevisionDescription) +git_describe (VERSION "--tags") +if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND" OR "x_${VERSION}" STREQUAL "x_HEAD-HASH-NOTFOUND" OR "x_${VERSION}" STREQUAL "x_-128-NOTFOUND") + message (WARNING " - Install git to compile a production libtinyb!") + set (VERSION "v0.1.0-dirty") +endif () + +message (INFO " - libtinyb Version ${VERSION}") + +#parse the version information into pieces. +string (REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${VERSION}") +string (REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${VERSION}") +string (REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${VERSION}") +string (REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+\\-([0-9]+).*" "\\1" VERSION_COMMIT "${VERSION}") +string (REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+-[0-9]+\\-(.*)" "\\1" VERSION_SHA1 "${VERSION}") +set (VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") + +if ("${VERSION_COMMIT}" MATCHES "^v.*") + set (VERSION_COMMIT "") +endif() + +configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/version.c.in + ${CMAKE_CURRENT_BINARY_DIR}/src/version.c) + +# this is the library version, independant of git revision +set (tinyb_VERSION_MAJOR ${VERSION_MAJOR}) +set (tinyb_VERSION_MINOR ${VERSION_MINOR}) +set (tinyb_VERSION_PATCH ${VERSION_PATCH}) +set (tinyb_VERSION_STRING ${mraa_VERSION_MAJOR}.${mraa_VERSION_MINOR}.${mraa_VERSION_PATCH}) + +set (CMAKE_SWIG_FLAGS "") + +IF(WARNINGS) + IF(UNIX) + IF(CMAKE_COMPILER_IS_GNUCC) + ADD_DEFINITIONS(-Wall -Wextra) + ENDIF(CMAKE_COMPILER_IS_GNUCC) + ENDIF(UNIX) + ENDIF(WARNINGS) + +IF(DEBUG) + IF(UNIX) + IF(CMAKE_COMPILER_IS_GNUCC) + ADD_DEFINITIONS(-g -ggdb) + ENDIF(CMAKE_COMPILER_IS_GNUCC) + ENDIF(UNIX) +ENDIF(DEBUG) + +find_path (SYSTEM_USR_DIR "stdlib.h") +include_directories (${SYSTEM_USR_DIR}) + +option (BUILDSWIG "Build swig modules." ON) +option (BUILDSWIGJAVA "Build Java API." OFF) + +add_subdirectory (src) +add_subdirectory (examples) diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..16b6316a --- /dev/null +++ b/COPYING @@ -0,0 +1,20 @@ +Copyright © 2015 Intel Corporation + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 00000000..d5d713b2 --- /dev/null +++ b/Doxyfile @@ -0,0 +1,2362 @@ +# Doxyfile 1.8.9.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single 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. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "TinyB" + +# 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 = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. 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 = + +# 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 causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = 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. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, 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. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, 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. +# The default value is: YES. + +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 and 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. +# The default value is: NO. + +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. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, 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 +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# 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. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +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 list of 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. +# The default value is: NO. + +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-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +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 Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +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 behavior. 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 behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +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. +# The default value is: NO. + +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. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act 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 = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# 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. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +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. +# The default value is: NO. + +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 (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. 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: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# 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); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) 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. +# The default value is: NO. + +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 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. +# The default value is: YES. + +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. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES 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. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag 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. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_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 respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# 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. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If 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, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# 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. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO 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. +# The default value is: NO. + +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, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +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, these declarations will be +# included in the documentation. +# The default value is: NO. + +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, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +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 then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +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. +# The default value is: system dependent. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# 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. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES 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. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +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 constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: 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 group names will +# appear in their defined order. +# The default value is: NO. + +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 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. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = 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. +# The default value is: YES. + +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. +# The default value is: YES. + +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. +# The default value is: YES. + +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. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if <section_label> ... \endif and \cond <section_label> +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have 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 value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +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. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# 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 value 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 value 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. For an example see the documentation. + +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. To 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. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag 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. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag 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. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. +# The default value is: NO. + +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) +# The default value is: $file:$line: $text. + +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 standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is 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. +# Note: If this tag is empty the current directory is searched. + +INPUT = api/ + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +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 patterns (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, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, +# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, +# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, +# *.qsf, *.as and *.js. + +FILE_PATTERNS = *.hpp + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# 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. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +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 +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */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. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be 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. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. + +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 information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# 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 that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +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. +# The default value is: NO. + +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. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES 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. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = 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. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES 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. +# See also: Section \class. +# The default value is: YES. + +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. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +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 a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: NO. + +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. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +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). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +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 left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# 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. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# 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. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# 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 (see: http://developer.apple.com/tools/xcode/), 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. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset 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. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# 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. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# 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. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# 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. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# 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). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# 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. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +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. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +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. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +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 Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# 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. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they 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. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +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. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# 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. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# 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. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. 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. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# 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. It is possible to +# search using the keyboard; to jump to the search box use <access key> + S +# (what the <access key> is depends on the OS and browser, but it is typically +# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down +# key> to jump into the search results window, the results can be navigated +# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel +# the search. The filter options can be selected when the cursor is inside the +# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys> +# to select a filter and <Enter> or <escape> to activate or cancel the filter +# option. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a web server instead of a web client using Javascript. There +# are two flavors of web server based searching depending on the EXTERNAL_SEARCH +# setting. When disabled, doxygen will generate a PHP script for searching and +# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing +# and searching needs to be provided by external tools. See the section +# "External Indexing and Searching" for details. +# The default value is: NO. +# This tag requires that the tag SEARCHENGINE is set to YES. + +SERVER_BASED_SEARCH = NO + +# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP +# script for searching. Instead the search results are written to an XML file +# which needs to be processed by an external indexer. Doxygen will invoke an +# external search engine pointed to by the SEARCHENGINE_URL option to obtain the +# search results. +# +# Doxygen ships with an example indexer (doxyindexer) and search engine +# (doxysearch.cgi) which are based on the open source search engine library +# Xapian (see: http://xapian.org/). +# +# See the section "External Indexing and Searching" for details. +# The default value is: NO. +# This tag requires that the tag SEARCHENGINE is set to YES. + +EXTERNAL_SEARCH = NO + +# The SEARCHENGINE_URL should point to a search engine hosted by a web server +# which will return the search results when EXTERNAL_SEARCH is enabled. +# +# Doxygen ships with an example indexer (doxyindexer) and search engine +# (doxysearch.cgi) which are based on the open source search engine library +# Xapian (see: http://xapian.org/). See the section "External Indexing and +# Searching" for details. +# This tag requires that the tag SEARCHENGINE is set to YES. + +SEARCHENGINE_URL = + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed +# search data is written to a file for indexing by an external tool. With the +# SEARCHDATA_FILE tag the name of this file can be specified. +# The default file is: searchdata.xml. +# This tag requires that the tag SEARCHENGINE is set to YES. + +SEARCHDATA_FILE = searchdata.xml + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the +# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is +# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple +# projects and redirect the results back to the right project. +# This tag requires that the tag SEARCHENGINE is set to YES. + +EXTERNAL_SEARCH_ID = + +# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen +# projects other than the one defined by this configuration file, but that are +# all added to the same external search index. Each project needs to have a +# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of +# to a relative location where the documentation can be found. The format is: +# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ... +# This tag requires that the tag SEARCHENGINE is set to YES. + +EXTRA_SEARCH_MAPPINGS = + +#--------------------------------------------------------------------------- +# Configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output. +# The default value is: YES. + +GENERATE_LATEX = YES + +# 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. +# The default directory is: latex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. +# +# 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. +# The default file is: latex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate +# index for LaTeX. +# The default file is: makeindex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +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. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +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 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x +# 14 inches) and executive (7.25 x 10.5 inches). +# The default value is: a4. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names +# that should be included in the LaTeX output. To get the times font for +# instance you can specify +# EXTRA_PACKAGES=times +# If left blank no extra packages will be included. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +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. See +# section "Doxygen usage" for information on how to let doxygen write the +# default header to a separate file. +# +# Note: Only use a user-defined header if you know what you are doing! The +# following commands have a special meaning inside the header: $title, +# $datetime, $date, $doxygenversion, $projectname, $projectnumber, +# $projectbrief, $projectlogo. Doxygen will replace $title with the empty +# string, for the replacement values of the other commands the user is referred +# to HTML_HEADER. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the +# generated LaTeX document. The footer should contain everything after the last +# chapter. If it is left blank doxygen will generate a standard footer. See +# LATEX_HEADER for more information on how to generate a default footer and what +# special commands can be used inside the footer. +# +# Note: Only use a user-defined footer if you know what you are doing! +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_FOOTER = + +# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# LaTeX style sheets that are included after the standard style sheets created +# by doxygen. Using this option one can overrule certain style aspects. Doxygen +# will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_EXTRA_STYLESHEET = + +# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the LATEX_OUTPUT output +# directory. Note that the files will be copied as-is; there are no commands or +# markers available. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_EXTRA_FILES = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is +# prepared for conversion to PDF (using ps2pdf or pdflatex). 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. +# The default value is: YES. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate +# the PDF file directly from the LaTeX files. Set this option to YES, to get a +# higher quality PDF documentation. +# The default value is: YES. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +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. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_BATCHMODE = NO + +# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the +# index chapters (such as File Index, Compound Index, etc.) in the output. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_HIDE_INDICES = NO + +# If the LATEX_SOURCE_CODE tag 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. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. See +# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# The default value is: plain. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# 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 too pretty with other RTF +# readers/editors. +# The default value is: NO. + +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. +# The default directory is: rtf. +# This tag requires that the tag GENERATE_RTF is set to YES. + +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. +# The default value is: NO. +# This tag requires that the tag GENERATE_RTF is set to YES. + +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 some other Word compatible readers that support those +# fields. +# +# Note: WordPad (write) and others do not support links. +# The default value is: NO. +# This tag requires that the tag GENERATE_RTF is set to YES. + +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. +# +# See also section "Doxygen usage" for information on how to generate the +# default style sheet that doxygen normally uses. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an RTF document. Syntax is +# similar to doxygen's config file. A template extensions file can be generated +# using doxygen -e rtf extensionFile. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_EXTENSIONS_FILE = + +# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code +# with syntax highlighting in the RTF output. +# +# Note that which sources are shown also depends on other settings such as +# SOURCE_BROWSER. +# The default value is: NO. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for +# classes and files. +# The default value is: NO. + +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. A directory man3 will be created inside the directory specified by +# MAN_OUTPUT. +# The default directory is: man. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to the generated +# man pages. In case the manual section does not start with a number, the number +# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is +# optional. +# The default value is: .3. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_EXTENSION = .3 + +# The MAN_SUBDIR tag determines the name of the directory created within +# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by +# MAN_EXTENSION with the initial . removed. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_SUBDIR = + +# 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 value is: NO. +# This tag requires that the tag GENERATE_MAN is set to YES. + +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. +# The default value is: NO. + +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. +# The default directory is: xml. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_OUTPUT = xml + +# 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. +# The default value is: YES. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# Configuration options related to the DOCBOOK output +#--------------------------------------------------------------------------- + +# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files +# that can be used to generate PDF. +# The default value is: NO. + +GENERATE_DOCBOOK = NO + +# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in +# front of it. +# The default directory is: docbook. +# This tag requires that the tag GENERATE_DOCBOOK is set to YES. + +DOCBOOK_OUTPUT = docbook + +# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the +# program listings (including syntax highlighting and cross-referencing +# information) to the DOCBOOK output. Note that enabling this will significantly +# increase the size of the DOCBOOK output. +# The default value is: NO. +# This tag requires that the tag GENERATE_DOCBOOK is set to YES. + +DOCBOOK_PROGRAMLISTING = NO + +#--------------------------------------------------------------------------- +# Configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an +# AutoGen Definitions (see http://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. +# The default value is: NO. + +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. +# The default value is: NO. + +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. +# The default value is: NO. +# This tag requires that the tag GENERATE_PERLMOD is set to YES. + +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. +# The default value is: YES. +# This tag requires that the tag GENERATE_PERLMOD is set to YES. + +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. +# This tag requires that the tag GENERATE_PERLMOD is set to YES. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all +# C-preprocessor directives found in the sources and include files. +# The default value is: YES. + +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, only conditional compilation will be +# performed. Macro expansion can be done in a controlled way by setting +# EXPAND_ONLY_PREDEF to YES. +# The default value is: NO. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +MACRO_EXPANSION = NO + +# 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. +# The default value is: NO. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES, the include files in the +# INCLUDE_PATH will be searched if a #include is found. +# The default value is: YES. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +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. +# This tag requires that the tag SEARCH_INCLUDES is set to YES. + +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. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +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 e.g. +# 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. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +PREDEFINED = + +# 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 that overrules the +# definition found in the source code. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will +# remove all references to 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. +# The default value is: YES. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES tag can be used to specify one or more tag files. For each tag +# file the location of the external documentation should be added. 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. See the +# section "Linking to external documentation" for more information about the use +# of tag files. +# Note: 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. See section "Linking to +# external documentation" for more information about the usage of tag files. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES, all external class will be listed in +# the class index. If set to NO, only the inherited external classes will be +# listed. +# The default value is: NO. + +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. +# The default value is: YES. + +EXTERNAL_GROUPS = YES + +# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in +# the related pages index. If set to NO, only the current project's pages will +# be listed. +# The default value is: YES. + +EXTERNAL_PAGES = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of 'which perl'). +# The default file (with absolute path) is: /usr/bin/perl. + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram +# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to +# NO turns the diagrams off. Note that this option also works with HAVE_DOT +# disabled, but it is recommended to install and use dot, since it yields more +# powerful graphs. +# The default value is: YES. + +CLASS_DIAGRAMS = YES + +# 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 = + +# You can include diagrams made with dia in doxygen documentation. Doxygen will +# then run dia to produce the diagram and insert it in the documentation. The +# DIA_PATH tag allows you to specify the directory where the dia binary resides. +# If left empty dia is assumed to be found in the default search path. + +DIA_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. +# The default value is: YES. + +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 (see: +# http://www.graphviz.org/), 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 value is: NO. + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed +# to run in parallel. When set to 0 doxygen will base this on the number of +# processors available in the system. You can set it explicitly to a value +# larger than 0 to get control over the balance between CPU load and processing +# speed. +# Minimum value: 0, maximum value: 32, default value: 0. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_NUM_THREADS = 0 + +# When you want a differently looking font in the dot files that doxygen +# generates you can specify the font name using DOT_FONTNAME. You 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. +# The default value is: Helvetica. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of +# dot graphs. +# Minimum value: 4, maximum value: 24, default value: 10. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the default font as specified with +# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set +# the path where dot can find it using this tag. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_FONTPATH = + +# If the CLASS_GRAPH tag is 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 CLASS_DIAGRAMS tag to NO. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH tag is 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. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for +# groups, showing the direct groups dependencies. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +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. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside the +# class node. If there are many fields or methods and many nodes the graph may +# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the +# number of items for each type to make the size more manageable. Set this to 0 +# for no limit. Note that the threshold may be exceeded by 50% before the limit +# is enforced. So when you set the threshold to 10, up to 15 fields may appear, +# but if the number exceeds 15, the total amount of fields shown is limited to +# 10. +# Minimum value: 0, maximum value: 100, default value: 10. +# This tag requires that the tag HAVE_DOT is set to YES. + +UML_LIMIT_NUM_FIELDS = 10 + +# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and +# collaboration graphs will show the relations between templates and their +# instances. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +TEMPLATE_RELATIONS = NO + +# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES 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. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +INCLUDE_GRAPH = YES + +# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES 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. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH tag is 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. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH tag is 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. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical +# hierarchy of all classes instead of a textual one. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH tag is 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. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. +# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order +# to make the SVG files visible in IE 9+ (other browsers do not have this +# requirement). +# Possible values are: png, jpg, gif and svg. +# The default value is: png. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# +# Note that this requires a modern browser other than Internet Explorer. Tested +# and working are Firefox, Chrome, Safari, and Opera. +# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make +# the SVG files visible. Older versions of IE do not have SVG support. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +INTERACTIVE_SVG = NO + +# The DOT_PATH tag 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. +# This tag requires that the tag HAVE_DOT is set to YES. + +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). +# This tag requires that the tag HAVE_DOT is set to YES. + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the \mscfile +# command). + +MSCFILE_DIRS = + +# The DIAFILE_DIRS tag can be used to specify one or more directories that +# contain dia files that are included in the documentation (see the \diafile +# command). + +DIAFILE_DIRS = + +# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the +# path where java can find the plantuml.jar file. If left blank, it is assumed +# PlantUML is not used or called during a preprocessing step. Doxygen will +# generate a warning when it encounters a \startuml command in this case and +# will not generate output for the diagram. + +PLANTUML_JAR_PATH = + +# When using plantuml, the specified paths are searched for files specified by +# the !include statement in a plantuml block. + +PLANTUML_INCLUDE_PATH = + +# 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. +# Minimum value: 0, maximum value: 10000, default value: 50. +# This tag requires that the tag HAVE_DOT is set to YES. + +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. +# Minimum value: 0, maximum value: 1000, default value: 0. +# This tag requires that the tag HAVE_DOT is set to YES. + +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). +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES to 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. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page +# explaining the meaning of the various boxes and arrows in the dot generated +# graphs. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot +# files that are used to generate the various graphs. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_CLEANUP = YES @@ -0,0 +1 @@ +BFI - Bluetooth for IoT diff --git a/README.md b/README.md new file mode 100644 index 00000000..9e630271 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +Tiny Bluetooth Library + +This project aims to create Bluetooth GATT bindings for C++, Java and other +languages, using BlueZ over DBus. Most of the code is automatically +generated using gdbus-codegen, including a few additions to the default +behaviour, such that it also generates the C++ classes, which wrap the functions +normally generated by gdbus-codegen. diff --git a/api/tinyb.hpp b/api/tinyb.hpp new file mode 100644 index 00000000..8dfdabab --- /dev/null +++ b/api/tinyb.hpp @@ -0,0 +1,32 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#include "tinyb/BluetoothObject.hpp" +#include "tinyb/BluetoothManager.hpp" +#include "tinyb/BluetoothAdapter.hpp" +#include "tinyb/BluetoothDevice.hpp" +#include "tinyb/BluetoothGattService.hpp" +#include "tinyb/BluetoothGattCharacteristic.hpp" +#include "tinyb/BluetoothGattDescriptor.hpp" diff --git a/api/tinyb/BluetoothAdapter.hpp b/api/tinyb/BluetoothAdapter.hpp new file mode 100644 index 00000000..c8555e49 --- /dev/null +++ b/api/tinyb/BluetoothAdapter.hpp @@ -0,0 +1,183 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#include "BluetoothObject.hpp" +#include <vector> + +/* Forward declaration of types */ +struct _Object; +typedef struct _Object Object; +struct _Adapter1; +typedef struct _Adapter1 Adapter1; + +/** + * Provides access to Bluetooth adapters. Follows the BlueZ adapter API + * available at: http://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/adapter-api.txt + */ +class tinyb::BluetoothAdapter: public BluetoothObject +{ + +friend class tinyb::BluetoothManager; +friend class tinyb::BluetoothEventManager; +friend class tinyb::BluetoothDevice; + +private: + Adapter1 *object; + /** Removes a device from the list of devices available on this adapter. + * @param[in] arg_device The path of the device on DBus + * @return TRUE if device was successfully removed + */ + bool remove_device ( + const std::string &arg_device + ); + + +protected: + BluetoothAdapter(Adapter1 *object); + + static std::unique_ptr<BluetoothAdapter> make(Object *object, + BluetoothType type = BluetoothType::ADAPTER, + std::string *name = nullptr, + std::string *identifier = nullptr, + BluetoothObject *parent = nullptr); +public: + + virtual std::string get_java_class() const; + virtual std::string get_class_name() const; + virtual std::string get_object_path() const; + virtual BluetoothType get_bluetooth_type() const; + + BluetoothAdapter(const BluetoothAdapter &object); + ~BluetoothAdapter(); + virtual BluetoothAdapter *clone() const; + + /* D-Bus method calls: */ + + /** Turns on device discovery if it is disabled. + * @return TRUE if discovery was successfully enabled + */ + bool start_discovery ( + ); + + /** Turns off device discovery if it is enabled. + * @return TRUE if discovery was successfully disabled + */ + bool stop_discovery ( + ); + + + /** Returns a list of BluetoothDevices visible from this adapter. + * @return A list of BluetoothDevices visible on this adapter, + * NULL if an error occurred + */ + std::vector<std::unique_ptr<BluetoothDevice>> get_devices ( + ); + + /* D-Bus property accessors: */ + /** Returns the hardware address of this adapter. + * @return The hardware address of this adapter. + */ + std::string get_address (); + + /** Returns the system name of this adapter. + * @return The system name of this adapter. + */ + std::string get_name (); + + /** Returns the friendly name of this adapter. + * @return The friendly name of this adapter, or NULL if not set. + */ + std::string get_alias (); + + /** Sets the friendly name of this adapter. + */ + void set_alias (const std::string &value); + + /** Returns the Bluetooth class of the adapter. + * @return The Bluetooth class of the adapter. + */ + unsigned int get_class (); + + /** Returns the power state the adapter. + * @return The power state of the adapter. + */ + bool get_powered (); + /** Sets the power state the adapter. + */ + void set_powered (bool value); + + /** Returns the discoverable state the adapter. + * @return The discoverable state of the adapter. + */ + bool get_discoverable (); + /** Sets the discoverable state the adapter. + */ + void set_discoverable (bool value); + + /** Returns the discoverable timeout the adapter. + * @return The discoverable timeout of the adapter. + */ + unsigned int get_discoverable_timeout (); + /** Sets the discoverable timeout the adapter. A value of 0 disables + * the timeout. + */ + void set_discoverable_timeout (unsigned int value); + + /** Returns the pairable state the adapter. + * @return The pairable state of the adapter. + */ + bool get_pairable (); + /** Sets the discoverable state the adapter. + */ + void set_pairable (bool value); + + /** Returns the timeout in seconds after which pairable state turns off + * automatically, 0 means never. + * @return The pairable timeout of the adapter. + */ + unsigned int get_pairable_timeout (); + + /** Sets the timeout after which pairable state turns off automatically, 0 means never. + */ + void set_pairable_timeout (unsigned int value); + + + /** Returns the discovering state the adapter. It can be modified through + * start_discovery/stop_discovery functions. + * @return The discovering state of the adapter. + */ + bool get_discovering (); + + /** Returns the UUIDs of the adapter. + * @return Array containing the UUIDs of the adapter, ends with NULL. + */ + std::vector<std::string> get_uuids (); + + /** Returns the local ID of the adapter. + * @return The local ID of the adapter. + */ + std::string get_modalias (); + +}; diff --git a/api/tinyb/BluetoothDevice.hpp b/api/tinyb/BluetoothDevice.hpp new file mode 100644 index 00000000..ce3dbc74 --- /dev/null +++ b/api/tinyb/BluetoothDevice.hpp @@ -0,0 +1,210 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#include "BluetoothObject.hpp" +#include <cstdint> +#include <vector> + +/* Forward declaration of types */ +struct _Object; +typedef struct _Object Object; +struct _Device1; +typedef struct _Device1 Device1; + +/** + * Provides access to Bluetooth devices. Follows the BlueZ adapter API + * available at: http://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/device-api.txt + */ +class tinyb::BluetoothDevice: public BluetoothObject +{ + +friend class tinyb::BluetoothManager; +friend class tinyb::BluetoothEventManager; +friend class tinyb::BluetoothAdapter; +friend class tinyb::BluetoothGattService; + +private: + Device1 *object; + +protected: + BluetoothDevice(Device1 *object); + + static std::unique_ptr<BluetoothDevice> make(Object *object, + BluetoothType type = BluetoothType::DEVICE, + std::string *name = nullptr, + std::string *identifier = nullptr, + BluetoothObject *parent = nullptr); +public: + + virtual std::string get_java_class() const; + virtual std::string get_class_name() const; + virtual std::string get_object_path() const; + virtual BluetoothType get_bluetooth_type() const; + + BluetoothDevice(const BluetoothDevice &object); + ~BluetoothDevice(); + virtual BluetoothDevice *clone() const; + + /* D-Bus method calls: */ + + /** The connection to this device is removed, removing all connected + * profiles. + * @return TRUE if the device disconnected + */ + bool disconnect ( + ); + + /** A connection to this device is established, connecting each profile + * flagged as auto-connectable. + * @return TRUE if the device connected + */ + bool connect ( + ); + + /** Connects a specific profile available on the device, given by UUID + * @param arg_UUID The UUID of the profile to be connected + * @return TRUE if the profile connected successfully + */ + bool connect_profile ( + const std::string &arg_UUID + ); + + /** Disconnects a specific profile available on the device, given by UUID + * @param arg_UUID The UUID of the profile to be disconnected + * @return TRUE if the profile disconnected successfully + */ + bool disconnect_profile ( + const std::string &arg_UUID + ); + + /** A connection to this device is established, and the device is then + * paired. + * @return TRUE if the device connected and paired + */ + bool pair ( + ); + + /** Cancels an initiated pairing operation + * @return TRUE if the paring is cancelled successfully + */ + bool cancel_pairing ( + ); + + /** Returns a list of BluetoothGattServices available on this device. + * @return A list of BluetoothGattServices available on this device, + * NULL if an error occurred + */ + std::vector<std::unique_ptr<BluetoothGattService>> get_services ( + ); + + /* D-Bus property accessors: */ + /** Returns the hardware address of this device. + * @return The hardware address of this device. + */ + std::string get_address (); + + /** Returns the remote friendly name of this device. + * @return The remote friendly name of this device, or NULL if not set. + */ + std::string get_name (); + + /** Returns an alternative friendly name of this device. + * @return The alternative friendly name of this device, or NULL if not set. + */ + std::string get_alias (); + + /** Sets an alternative friendly name of this device. + */ + void set_alias (const std::string &value); + + /** Returns the Bluetooth class of the device. + * @return The Bluetooth class of the device. + */ + unsigned int get_class (); + + /** Returns the appearance of the device, as found by GAP service. + @return The appearance of the device, as found by GAP service. + */ + uint16_t get_appearance (); + + /** Returns the proposed icon name of the device. + @return The proposed icon name, or NULL if not set. + */ + std::string get_icon (); + + /** Returns the paired state the device. + * @return The paired state of the device. + */ + bool get_paired (); + + /** Returns the trusted state the device. + * @return The trusted state of the device. + */ + bool get_trusted (); + + /** Sets the trusted state the device. + */ + void set_trusted (bool value); + + /** Returns the blocked state the device. + * @return The blocked state of the device. + */ + bool get_blocked (); + + /** Sets the blocked state the device. + */ + void set_blocked (bool value); + + /** Returns if device uses only pre-Bluetooth 2.1 pairing mechanism. + * @return True if device uses only pre-Bluetooth 2.1 pairing mechanism. + */ + bool get_legacy_pairing (); + + /** Returns the Received Signal Strength Indicator of the device. + * @return The Received Signal Strength Indicator of the device. + */ + int16_t get_rssi (); + + /** Returns the connected state of the device. + * @return The connected state of the device. + */ + bool get_connected (); + + /** Returns the UUIDs of the device. + * @return Array containing the UUIDs of the device, ends with NULL. + */ + std::vector<std::string> get_uuids (); + + /** Returns the local ID of the adapter. + * @return The local ID of the adapter. + */ + std::string get_modalias (); + + /** Returns the adapter on which this device was discovered or + * connected. + * @return The adapter. + */ + BluetoothAdapter get_adapter (); +}; diff --git a/api/tinyb/BluetoothEvent.hpp b/api/tinyb/BluetoothEvent.hpp new file mode 100644 index 00000000..1ad27a7a --- /dev/null +++ b/api/tinyb/BluetoothEvent.hpp @@ -0,0 +1,63 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include <string> +#include <condition_variable> +#include "BluetoothObject.hpp" +#pragma once + +using namespace tinyb; + +typedef void (*BluetoothCallback)(BluetoothObject &, void *); + +class tinyb::BluetoothEvent { +private: + std::string *name; + std::string *identifier; + BluetoothObject *parent; + BluetoothType type; + BluetoothCallback cb; + void *data; + +static void generic_callback(BluetoothObject &object, void *data); + +struct generic_callback_data { + std::condition_variable cv; + BluetoothObject *result; +}; + +public: + + BluetoothEvent(BluetoothType type, std::string *name, std::string *identifier, + BluetoothObject *parent, BluetoothCallback cb = generic_callback, + void *data = NULL); + + BluetoothType get_type(); + std::string get_name(); + std::string get_identifier(); + bool execute_callback(); + bool has_callback(); + + bool operator==(BluetoothEvent const &other); +}; diff --git a/api/tinyb/BluetoothGattCharacteristic.hpp b/api/tinyb/BluetoothGattCharacteristic.hpp new file mode 100644 index 00000000..4aa78ecb --- /dev/null +++ b/api/tinyb/BluetoothGattCharacteristic.hpp @@ -0,0 +1,122 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#include "BluetoothObject.hpp" +#include <string> +#include <vector> + +/* Forward declaration of types */ +struct _Object; +typedef struct _Object Object; +struct _GattCharacteristic1; +typedef struct _GattCharacteristic1 GattCharacteristic1; + +/** + * Provides access to Bluetooth GATT characteristic. Follows the BlueZ adapter API + * available at: http://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/gatt-api.txt + */ +class tinyb::BluetoothGattCharacteristic: public BluetoothObject +{ + +friend class tinyb::BluetoothGattService; +friend class tinyb::BluetoothGattDescriptor; +friend class tinyb::BluetoothManager; +friend class tinyb::BluetoothEventManager; + +private: + GattCharacteristic1 *object; + +protected: + BluetoothGattCharacteristic(GattCharacteristic1 *object); + + static std::unique_ptr<BluetoothGattCharacteristic> make(Object *object, + BluetoothType type = BluetoothType::GATT_CHARACTERISTIC, + std::string *name = nullptr, + std::string *identifier = nullptr, + BluetoothObject *parent = nullptr); +public: + virtual std::string get_java_class() const; + virtual std::string get_class_name() const ; + virtual std::string get_object_path() const; + virtual BluetoothType get_bluetooth_type() const; + + BluetoothGattCharacteristic(const BluetoothGattCharacteristic &object); + ~BluetoothGattCharacteristic(); + virtual BluetoothGattCharacteristic *clone() const; + + /* D-Bus method calls: */ + /** Reads the value of this characteristic. + * @return A std::vector<unsgined char> containing the value of this characteristic. + */ + std::vector<unsigned char> read_value ( + ); + + /** Writes the value of this characteristic. + * @param[in] arg_value The data as vector<uchar> + * to be written packed in a GBytes struct + * @return TRUE if value was written succesfully + */ + bool write_value (const std::vector<unsigned char> &arg_value); + + bool start_notify ( + ); + + bool stop_notify ( + ); + + /* D-Bus property accessors: */ + /** Get the UUID of this characteristic. + * @return The 128 byte UUID of this characteristic, NULL if an error occurred + */ + std::string get_uuid (); + + /** Returns the service to which this characteristic belongs to. + * @return The service. + */ + BluetoothGattService get_service (); + + /** Returns the cached value of this characteristic, if any. + * @return The cached value of this characteristic. + */ + std::vector<unsigned char> get_value (); + + /** Returns true if notification for changes of this characteristic are + * activated. + * @return True if notificatios are activated. + */ + bool get_notifying (); + + /** Returns the flags this characterstic has. + * @return A list of flags for this characteristic. + */ + std::vector<std::string> get_flags (); + + /** Returns a list of BluetoothGattDescriptors this characteristic exposes. + * @return A list of BluetoothGattDescriptors exposed by this characteristic + * NULL if an error occurred + */ + std::vector<std::unique_ptr<BluetoothGattDescriptor>> get_descriptors (); + +}; diff --git a/api/tinyb/BluetoothGattDescriptor.hpp b/api/tinyb/BluetoothGattDescriptor.hpp new file mode 100644 index 00000000..dc281295 --- /dev/null +++ b/api/tinyb/BluetoothGattDescriptor.hpp @@ -0,0 +1,101 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#include "BluetoothObject.hpp" +#include <vector> + +/* Forward declaration of types */ +struct _Object; +typedef struct _Object Object; +struct _GattDescriptor1; +typedef struct _GattDescriptor1 GattDescriptor1; + +/** + * Provides access to Bluetooth GATT descriptor. Follows the BlueZ adapter API + * available at: http://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/gatt-api.txt + */ +class tinyb::BluetoothGattDescriptor: public BluetoothObject +{ + +friend class tinyb::BluetoothGattCharacteristic; +friend class tinyb::BluetoothManager; +friend class tinyb::BluetoothEventManager; + +private: + GattDescriptor1 *object; + + +protected: + BluetoothGattDescriptor(GattDescriptor1 *object); + + static std::unique_ptr<BluetoothGattDescriptor> make(Object *object, + BluetoothType type = BluetoothType::GATT_DESCRIPTOR, + std::string *name = nullptr, + std::string *identifier = nullptr, + BluetoothObject *parent = nullptr); + +public: + virtual std::string get_java_class() const; + virtual std::string get_class_name() const; + virtual std::string get_object_path() const; + virtual BluetoothType get_bluetooth_type() const; + + BluetoothGattDescriptor(const BluetoothGattDescriptor &object); + ~BluetoothGattDescriptor(); + virtual BluetoothGattDescriptor *clone() const; + + /* D-Bus method calls: */ + /** Reads the value of this descriptor + * @return A vector<uchar> containing data from this descriptor + */ + std::vector<unsigned char> read_value ( + ); + + /** Writes the value of this descriptor. + * @param[in] arg_value The data as vector<uchar> + * to be written packed in a GBytes struct + * @return TRUE if value was written succesfully + */ + bool write_value ( + const std::vector<unsigned char> &arg_value + ); + + /* D-Bus property accessors: */ + /** Get the UUID of this descriptor. + * @return The 128 byte UUID of this descriptor, NULL if an error occurred + */ + std::string get_uuid (); + + /** Returns the characteristic to which this descriptor belongs to. + * @return The characteristic. + */ + BluetoothGattCharacteristic get_characteristic (); + + /** Returns the cached value of this descriptor, if any. + * @return The cached value of this descriptor. + */ + std::vector<unsigned char> get_value (); + +}; diff --git a/api/tinyb/BluetoothGattService.hpp b/api/tinyb/BluetoothGattService.hpp new file mode 100644 index 00000000..e947e1ae --- /dev/null +++ b/api/tinyb/BluetoothGattService.hpp @@ -0,0 +1,92 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#include "BluetoothObject.hpp" +#include "BluetoothManager.hpp" +#include <vector> + +/* Forward declaration of types */ +struct _Object; +typedef struct _Object Object; +struct _GattService1; +typedef struct _GattService1 GattService1; + +/** + * Provides access to Bluetooth GATT characteristic. Follows the BlueZ adapter API + * available at: http://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/gatt-api.txt + */ +class tinyb::BluetoothGattService: public BluetoothObject +{ + +friend class tinyb::BluetoothManager; +friend class tinyb::BluetoothEventManager; +friend class tinyb::BluetoothDevice; +friend class tinyb::BluetoothGattCharacteristic; + +private: + GattService1 *object; + +protected: + BluetoothGattService(GattService1 *object); + + static std::unique_ptr<BluetoothGattService> make(Object *object, + BluetoothType type = BluetoothType::GATT_SERVICE, + std::string *name = nullptr, + std::string *identifier = nullptr, + BluetoothObject *parent = nullptr); + +public: + virtual std::string get_java_class() const; + virtual std::string get_class_name() const; + virtual std::string get_object_path() const; + virtual BluetoothType get_bluetooth_type() const; + + BluetoothGattService(const BluetoothGattService &object); + ~BluetoothGattService(); + virtual BluetoothGattService *clone() const; + + /* D-Bus property accessors: */ + + /** Get the UUID of this service + * @return The 128 byte UUID of this service, NULL if an error occurred + */ + std::string get_uuid (); + + /** Returns the device to which this service belongs to. + * @return The device. + */ + BluetoothDevice get_device (); + + /** Returns true if this service is a primary service, false if secondary. + * @return true if this service is a primary service, false if secondary. + */ + bool get_primary (); + + /** Returns a list of BluetoothGattCharacteristics this service exposes. + * @return A list of BluetoothGattCharacteristics exposed by this service + */ + std::vector<std::unique_ptr<BluetoothGattCharacteristic>> get_characteristics (); + +}; diff --git a/api/tinyb/BluetoothManager.hpp b/api/tinyb/BluetoothManager.hpp new file mode 100644 index 00000000..199cbda4 --- /dev/null +++ b/api/tinyb/BluetoothManager.hpp @@ -0,0 +1,104 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#include "BluetoothObject.hpp" +#include "BluetoothAdapter.hpp" +#include "BluetoothEvent.hpp" +#include <vector> +#include <list> + +class tinyb::BluetoothManager: public BluetoothObject +{ +friend class BluetoothAdapter; +friend class BluetoothDevice; +friend class BluetoothGattService; +friend class BluetoothGattCharacteristic; +friend class BluetoothGattDescriptor; + +private: + BluetoothAdapter *default_adapter = NULL; + static BluetoothManager *bluetooth_manager; + std::list<std::shared_ptr<BluetoothEvent>> event_list; + + BluetoothManager(); + BluetoothManager(const BluetoothManager &object); + +public: + virtual std::string get_java_class() const; + virtual std::string get_class_name() const; + virtual std::string get_object_path() const; + virtual BluetoothType get_bluetooth_type() const; + + ~BluetoothManager(); + /** Returns an instance of BluetoothManager, to be used instead of constructor. + * @return An initialized BluetoothManager instance. + */ + static BluetoothManager *get_bluetooth_manager(); + + std::unique_ptr<BluetoothObject> get_object(BluetoothType type, + std::string *name, std::string *identifier, BluetoothObject *parent); + + std::vector<std::unique_ptr<BluetoothObject>> get_objects( + BluetoothType type = BluetoothType::NONE, + std::string *name = nullptr, std::string *identifier = nullptr, + BluetoothObject *parent = nullptr); + + /** Returns a list of BluetoothAdapters available in the system + * @return A list of BluetoothAdapters available in the system + */ + std::vector<std::unique_ptr<BluetoothAdapter>> get_adapters( + ); + + /** Returns a list of discovered BluetoothDevices + * @return A list of discovered BluetoothDevices + */ + std::vector<std::unique_ptr<BluetoothDevice>> get_devices( + ); + + /** Returns a list of available BluetoothGattServices + * @return A list of available BluetoothGattServices + */ + std::vector<std::unique_ptr<BluetoothGattService>> get_services( + ); + + /** Sets a default adapter to use for discovery. + * @return TRUE if the device was set + */ + bool set_default_adapter( + BluetoothAdapter *adapter + ); + + /** Turns on device discovery on the default adapter if it is disabled. + * @return TRUE if discovery was successfully enabled + */ + bool start_discovery( + ); + + /** Turns off device discovery on the default adapter if it is enabled. + * @return TRUE if discovery was successfully disabled + */ + bool stop_discovery( + ); +}; diff --git a/api/tinyb/BluetoothObject.hpp b/api/tinyb/BluetoothObject.hpp new file mode 100644 index 00000000..0be38cbb --- /dev/null +++ b/api/tinyb/BluetoothObject.hpp @@ -0,0 +1,87 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include <memory> +#pragma once + +#define JAVA_PACKAGE "io/mraa/tinyb" + +namespace tinyb { +enum class BluetoothType { + NONE, + ADAPTER, + DEVICE, + GATT_SERVICE, + GATT_CHARACTERISTIC, + GATT_DESCRIPTOR +}; + + class BluetoothEvent; + class BluetoothEventManager; + class BluetoothObject; + class BluetoothManager; + class BluetoothAdapter; + class BluetoothDevice; + class BluetoothGattService; + class BluetoothGattCharacteristic; + class BluetoothGattDescriptor; +} + +class tinyb::BluetoothObject +{ +public: + + /** Returns the complete Java class of this object + * @return A std::string containing the java class of this object + */ + virtual std::string get_java_class() const; + + /** Returns the class name of this object + * @return A std::string containing the class name of this object + */ + virtual std::string get_class_name() const; + + /** Returns the DBus object path of this object + * @return A std::string containing the DBus object path of this object + */ + virtual std::string get_object_path() const; + + /** Returns the BluetoothType of this object + * @return The BluetoothType of this object + */ + virtual BluetoothType get_bluetooth_type() const; + + virtual ~BluetoothObject() { }; + + + /** Returns a raw pointer to a clone of the object + * @return A raw pointer to a clone of the object + */ + virtual BluetoothObject *clone() const; + + /** Returns true if this object and the other point to the same DBus Object + * @return True if this object and the other point to the same DBus Object + */ + virtual bool operator==(const BluetoothObject &other) const; +}; diff --git a/cmake/Toolchains/oe-sdk_cross.cmake b/cmake/Toolchains/oe-sdk_cross.cmake new file mode 100644 index 00000000..8a82c296 --- /dev/null +++ b/cmake/Toolchains/oe-sdk_cross.cmake @@ -0,0 +1,25 @@ +# this toolchain file comes from gnuradio project + +set( CMAKE_SYSTEM_NAME Linux ) +#set( CMAKE_C_COMPILER $ENV{CC} ) +#set( CMAKE_CXX_COMPILER $ENV{CXX} ) +string(REGEX MATCH "sysroots/([a-zA-Z0-9]+)" CMAKE_SYSTEM_PROCESSOR $ENV{SDKTARGETSYSROOT}) +string(REGEX REPLACE "sysroots/" "" CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}) +set( CMAKE_CXX_FLAGS $ENV{CXXFLAGS} CACHE STRING "" FORCE ) +set( CMAKE_C_FLAGS $ENV{CFLAGS} CACHE STRING "" FORCE ) #same flags for C sources +set( CMAKE_LDFLAGS_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE ) #same flags for C sources +set( CMAKE_LIBRARY_PATH ${OECORE_TARGET_SYSROOT}/usr/lib ) +set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} $ENV{OECORE_NATIVE_SYSROOT} ) +set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) +set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) +set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) +set( CMAKE_INSTALL_PREFIX $ENV{OECORE_TARGET_SYSROOT}/usr CACHE STRING "" FORCE) +set( ORC_INCLUDE_DIRS $ENV{OECORE_TARGET_SYSROOT}/usr/include/orc-0.4 ) +set( ORC_LIBRARY_DIRS $ENV{OECORE_TARGET_SYSROOT}/usr/lib ) + +# for java +set( JAVA_AWT_INCLUDE_PATH $ENV{JAVA_HOME}/include CACHE PATH "" FORCE) +set( JAVA_AWT_LIBRARY $ENV{JAVA_HOME}/jre/lib/amd64/libjawt.so CACHE FILEPATH "" FORCE) +set( JAVA_INCLUDE_PATH $ENV{JAVA_HOME}/include CACHE PATH "" FORCE) +set( JAVA_INCLUDE_PATH2 $ENV{JAVA_HOME}/include/linux CACHE PATH "" FORCE) +set( JAVA_JVM_LIBRARY $ENV{JAVA_HOME}/jre/lib/amd64/libjvm.so CACHE FILEPATH "" FORCE) diff --git a/cmake/modules/CPackDeb.cmake b/cmake/modules/CPackDeb.cmake new file mode 100644 index 00000000..e924f549 --- /dev/null +++ b/cmake/modules/CPackDeb.cmake @@ -0,0 +1,222 @@ +# - The builtin (binary) CPack Deb generator (Unix only) +# CPackDeb may be used to create Deb package using CPack. +# CPackDeb is a CPack generator thus it uses the CPACK_XXX variables +# used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration +# +# However CPackRPM has specific features which are controlled by +# the specifics CPACK_RPM_XXX variables.You'll find a detailed usage on +# the wiki: +# http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 +# However as a handy reminder here comes the list of specific variables: +# +# CPACK_DEBIAN_PACKAGE_NAME +# Mandatory : YES +# Default : CPACK_PACKAGE_NAME (lower case) +# The debian package summary +# CPACK_DEBIAN_PACKAGE_VERSION +# Mandatory : YES +# Default : CPACK_PACKAGE_VERSION +# The debian package version +# CPACK_DEBIAN_PACKAGE_ARCHITECTURE) +# Mandatory : YES +# Default : Output of dpkg --print-architecture or i386 +# The debian package architecture +# CPACK_DEBIAN_PACKAGE_DEPENDS +# Mandatory : NO +# Default : - +# May be used to set deb dependencies. +# CPACK_DEBIAN_PACKAGE_MAINTAINER +# Mandatory : YES +# Default : CPACK_PACKAGE_CONTACT +# The debian package maintainer +# CPACK_DEBIAN_PACKAGE_DESCRIPTION +# Mandatory : YES +# Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY +# The debian package description +# CPACK_DEBIAN_PACKAGE_SECTION +# Mandatory : YES +# Default : 'devel' +# The debian package section +# CPACK_DEBIAN_PACKAGE_PRIORITY +# Mandatory : YES +# Default : 'optional' +# The debian package priority + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# Copyright 2007-2009 Mathieu Malaterre <[email protected]> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# CPack script for creating Debian package +# Author: Mathieu Malaterre +# +# http://wiki.debian.org/HowToPackageForDebian + +IF(CMAKE_BINARY_DIR) + MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used by CPack internally.") +ENDIF(CMAKE_BINARY_DIR) + +IF(NOT UNIX) + MESSAGE(FATAL_ERROR "CPackDeb.cmake may only be used under UNIX.") +ENDIF(NOT UNIX) + +# Let's define the control file found in debian package: + +# Binary package: +# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-binarycontrolfiles + +# DEBIAN/control +# debian policy enforce lower case for package name +# Package: (mandatory) +IF(NOT CPACK_DEBIAN_PACKAGE_NAME) + STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME) +ENDIF(NOT CPACK_DEBIAN_PACKAGE_NAME) + +# Version: (mandatory) +IF(NOT CPACK_DEBIAN_PACKAGE_VERSION) + IF(NOT CPACK_PACKAGE_VERSION) + MESSAGE(FATAL_ERROR "Debian package requires a package version") + ENDIF(NOT CPACK_PACKAGE_VERSION) + SET(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) +ENDIF(NOT CPACK_DEBIAN_PACKAGE_VERSION) + +# Architecture: (mandatory) +IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE) + # There is no such thing as i686 architecture on debian, you should use i386 instead + # $ dpkg --print-architecture + FIND_PROGRAM(DPKG_CMD dpkg) + IF(NOT DPKG_CMD) + MESSAGE(STATUS "Can not find dpkg in your path, default to i386.") + SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386) + ENDIF(NOT DPKG_CMD) + EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture + OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE) + +# have a look at GET_PROPERTY(result GLOBAL PROPERTY ENABLED_FEATURES), +# this returns the successful FIND_PACKAGE() calls, maybe this can help +# Depends: +# You should set: DEBIAN_PACKAGE_DEPENDS +# TODO: automate 'objdump -p | grep NEEDED' +IF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS) + MESSAGE(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.") +ENDIF(NOT CPACK_DEBIAN_PACKAGE_DEPENDS) + +# Maintainer: (mandatory) +IF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER) + IF(NOT CPACK_PACKAGE_CONTACT) + MESSAGE(FATAL_ERROR "Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER") + ENDIF(NOT CPACK_PACKAGE_CONTACT) + SET(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT}) +ENDIF(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER) + +# Description: (mandatory) +IF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) + IF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) + MESSAGE(FATAL_ERROR "Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION") + ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) + SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) +ENDIF(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) + +# Section: (recommended) +IF(NOT CPACK_DEBIAN_PACKAGE_SECTION) + SET(CPACK_DEBIAN_PACKAGE_SECTION "devel") +ENDIF(NOT CPACK_DEBIAN_PACKAGE_SECTION) + +# Priority: (recommended) +IF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY) + SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") +ENDIF(NOT CPACK_DEBIAN_PACKAGE_PRIORITY ) + +# Recommends: +# You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS + +# Suggests: +# You should set: CPACK_DEBIAN_PACKAGE_SUGGESTS + +# CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA +# This variable allow advanced user to add custom script to the control.tar.gz (inside the .deb archive) +# Typical examples are: +# - conffiles +# - postinst +# - postrm +# - prerm" +# Usage: +# SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA +# "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm") + + +# For debian source packages: +# debian/control +# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-sourcecontrolfiles + +# .dsc +# http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-debiansourcecontrolfiles + +# Builds-Depends: +#IF(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS) +# SET(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS +# "debhelper (>> 5.0.0), libncurses5-dev, tcl8.4" +# ) +#ENDIF(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS) + +# Description: (mandatory) +#if(NOT CPACK_SECTION) +# message(FATAL_ERROR "opkg package requires a package section") +#endif(NOT CPACK_SECTION) + +# Package for opkg +FIND_PROGRAM(OPKG_CMD opkg-build) +if( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" ) + message("CPack: opkg-build not found. Skipping packaging") +else( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" ) + SET(CPACK_OPKG_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}") + FILE(MAKE_DIRECTORY ${CPACK_OPKG_ROOTDIR}/CONTROL) + set(CPACK_OPKG_CONTROL_FILE "${CPACK_OPKG_ROOTDIR}/CONTROL/control") + # Write controlfile + FILE(WRITE ${CPACK_OPKG_CONTROL_FILE} + "Package: ${CPACK_PACKAGE_NAME} +Version: ${CPACK_PACKAGE_VERSION} +Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY} +Architecture: ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE} +Section: ${CPACK_DEBIAN_PACKAGE_SECTION} +Priority: optional +Maintainer: ${CPACK_DEBIAN_PACKAGE_MAINTAINER} +Depends: +Provides: ${CPACK_DEBIAN_PACKAGE_PROVIDES} +Replaces: ${CPACK_DEBIAN_PACKAGE_REPLACES} +Conflicts: ${CPACK_DEBIAN_PACKAGE_CONFLICTS} +Source: https://github.com/intel-iot-devkit/mraa +#Essential: no +") + +set(OPKG_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") + execute_process( + COMMAND "${OPKG_CMD}" "-o" "0" "${CPACK_PACKAGE_FILE_NAME}" "." + RESULT_VARIABLE _result + OUTPUT_VARIABLE _res_output + ERROR_VARIABLE _res_error + WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY} + ) + + if(${_result}) + message("Result '${_result}'") + message("Output '${_res_output}'") + message("Error '${_res_error}'") + else(${_result}) + message("CPack: Package ${OPKG_FILE_NAME}.ipk generated.") + set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}") + file(RENAME ${CPACK_TOPLEVEL_DIRECTORY}/${OPKG_FILE_NAME}.ipk ${CPACK_BINARY_DIR}/${OPKG_FILE_NAME}.ipk) + endif(${_result}) +endif( ${OPKG_CMD} STREQUAL "OPKG_CMD-NOTFOUND" ) diff --git a/cmake/modules/Copyright.txt b/cmake/modules/Copyright.txt new file mode 100644 index 00000000..6c9fb093 --- /dev/null +++ b/cmake/modules/Copyright.txt @@ -0,0 +1,57 @@ +CMake - Cross Platform Makefile Generator +Copyright 2000-2015 Kitware, Inc. +Copyright 2000-2011 Insight Software Consortium +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* Neither the names of Kitware, Inc., the Insight Software Consortium, + nor the names of their contributors may be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ + +The above copyright and license notice applies to distributions of +CMake in source and binary form. Some source files contain additional +notices of original copyright by their contributors; see each source +for details. Third-party software packages supplied with CMake under +compatible licenses provide their own copyright notices documented in +corresponding subdirectories. + +------------------------------------------------------------------------------ + +CMake was initially developed by Kitware with the following sponsorship: + + * National Library of Medicine at the National Institutes of Health + as part of the Insight Segmentation and Registration Toolkit (ITK). + + * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel + Visualization Initiative. + + * National Alliance for Medical Image Computing (NAMIC) is funded by the + National Institutes of Health through the NIH Roadmap for Medical Research, + Grant U54 EB005149. + + * Kitware, Inc. diff --git a/cmake/modules/FindNodejs.cmake b/cmake/modules/FindNodejs.cmake new file mode 100644 index 00000000..51024fb0 --- /dev/null +++ b/cmake/modules/FindNodejs.cmake @@ -0,0 +1,59 @@ +find_program (NODE_EXECUTABLE NAMES node nodejs + HINTS + $ENV{NODE_DIR} + PATH_SUFFIXES bin + DOC "Node.js interpreter" +) + +include (FindPackageHandleStandardArgs) + +find_path (NODE_ROOT_DIR "node/node.h" "src/node.h" + PATHS /usr/include/nodejs /usr/local/include/nodejs /usr/local/include) + +set (NODE_INCLUDE_DIRS + ${NODE_ROOT_DIR}/src + ${NODE_ROOT_DIR}/node + ${NODE_ROOT_DIR}/deps/v8/include + ${NODE_ROOT_DIR}/deps/uv/include +) + +find_package_handle_standard_args (Node DEFAULT_MSG + NODE_EXECUTABLE + NODE_INCLUDE_DIRS +) + +if (NODE_EXECUTABLE) + execute_process(COMMAND ${NODE_EXECUTABLE} --version + OUTPUT_VARIABLE _VERSION + RESULT_VARIABLE _NODE_VERSION_RESULT) + execute_process(COMMAND ${NODE_EXECUTABLE} -e "console.log(process.versions.v8)" + OUTPUT_VARIABLE _V8_VERSION + RESULT_VARIABLE _V8_RESULT) + if (NOT _NODE_VERSION_RESULT AND NOT _V8_RESULT) + string (REPLACE "v" "" NODE_VERSION_STRING "${_VERSION}") + string (REPLACE "." ";" _VERSION_LIST "${NODE_VERSION_STRING}") + list (GET _VERSION_LIST 0 NODE_VERSION_MAJOR) + list (GET _VERSION_LIST 1 NODE_VERSION_MINOR) + list (GET _VERSION_LIST 2 NODE_VERSION_PATCH) + set (V8_VERSION_STRING ${_V8_VERSION}) + string (REPLACE "." ";" _V8_VERSION_LIST "${_V8_VERSION}") + list (GET _V8_VERSION_LIST 0 V8_VERSION_MAJOR) + list (GET _V8_VERSION_LIST 1 V8_VERSION_MINOR) + list (GET _V8_VERSION_LIST 2 V8_VERSION_PATCH) + # we end up with a nasty newline so strip everything that isn't a number + string (REGEX MATCH "^[0-9]*" V8_VERSION_PATCH ${V8_VERSION_PATCH}) + else () + set (NODE_VERSION_STRING "0.10.30") + set (NODE_VERSION_MAJOR "0") + set (NODE_VERSION_MINOR "10") + set (NODE_VERSION_PATCH "30") + set (V8_VERSION_MAJOR "3") + set (V8_VERSION_MAJOR "14") + set (V8_VERSION_MAJOR "5") + set (V8_VERSION_STRING "3.28.72") + message ("defaulted to node 0.10.30") + endif () + message ("INFO - Node version is " ${NODE_VERSION_STRING} "INFO - Node using v8 " ${V8_VERSION_STRING}) +endif () + +mark_as_advanced (NODE_EXECUTABLE) diff --git a/cmake/modules/FindSphinx.cmake b/cmake/modules/FindSphinx.cmake new file mode 100644 index 00000000..4a3fb138 --- /dev/null +++ b/cmake/modules/FindSphinx.cmake @@ -0,0 +1,14 @@ +find_program (SPHINX_EXECUTABLE NAMES sphinx-build + HINTS + $ENV{SPHINX_DIR} + PATH_SUFFIXES bin + DOC "Sphinx documentation generator" +) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args (Sphinx DEFAULT_MSG + SPHINX_EXECUTABLE +) + +mark_as_advanced (SPHINX_EXECUTABLE) diff --git a/cmake/modules/FindYuidoc.cmake b/cmake/modules/FindYuidoc.cmake new file mode 100644 index 00000000..23175ce2 --- /dev/null +++ b/cmake/modules/FindYuidoc.cmake @@ -0,0 +1,21 @@ +find_program (YUIDOC_EXECUTABLE NAMES yuidoc + HINTS $ENV{YUIDOC_DIR} + PATHS usr usr/local + PATH_SUFFIXES bin + DOC "Yuidoc documentation generator" +) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args (Yuidoc DEFAULT_MSG + YUIDOC_EXECUTABLE +) + +# Get Yuidoc version +if (YUIDOC_EXECUTABLE) + execute_process(COMMAND ${YUIDOC_EXECUTABLE} --version + ERROR_VARIABLE YUIDOC_VERSION) + message ("INFO - Yuidoc version is " ${YUIDOC_VERSION}) +endif () + +mark_as_advanced (YUIDOC_EXECUTABLE) diff --git a/cmake/modules/GetGitRevisionDescription.cmake b/cmake/modules/GetGitRevisionDescription.cmake new file mode 100644 index 00000000..c8d27f2e --- /dev/null +++ b/cmake/modules/GetGitRevisionDescription.cmake @@ -0,0 +1,130 @@ +# - Returns a version string from Git +# +# These functions force a re-configure on each git commit so that you can +# trust the values of the variables in your build system. +# +# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...]) +# +# Returns the refspec and sha hash of the current head revision +# +# git_describe(<var> [<additional arguments to git describe> ...]) +# +# Returns the results of git describe on the source tree, and adjusting +# the output so that it tests false if an error occurs. +# +# git_get_exact_tag(<var> [<additional arguments to git describe> ...]) +# +# Returns the results of git describe --exact-match on the source tree, +# and adjusting the output so that it tests false if there was no exact +# matching tag. +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik <[email protected]> <[email protected]> +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__get_git_revision_description) + return() +endif() +set(__get_git_revision_description YES) + +# We must run the following at "include" time, not at function call time, +# to find the path to this module rather than the path to a calling list file +get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) + +function(get_git_head_revision _refspecvar _hashvar) + set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories + set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") + get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) + if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) + # We have reached the root directory, we are not in git + set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + return() + endif() + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + endwhile() + # check if this is a submodule + if(NOT IS_DIRECTORY ${GIT_DIR}) + file(READ ${GIT_DIR} submodule) + string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule}) + get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH) + get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE) + endif() + set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") + if(NOT EXISTS "${GIT_DATA}") + file(MAKE_DIRECTORY "${GIT_DATA}") + endif() + + if(NOT EXISTS "${GIT_DIR}/HEAD") + return() + endif() + set(HEAD_FILE "${GIT_DATA}/HEAD") + configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) + + configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" + "${GIT_DATA}/grabRef.cmake" + @ONLY) + include("${GIT_DATA}/grabRef.cmake") + + set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE) + set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) +endfunction() + +function(git_describe _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(refspec hash) + if(NOT GIT_FOUND) + set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) + return() + endif() + if(NOT hash) + set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) + return() + endif() + + # TODO sanitize + #if((${ARGN}" MATCHES "&&") OR + # (ARGN MATCHES "||") OR + # (ARGN MATCHES "\\;")) + # message("Please report the following error to the project!") + # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") + #endif() + + #message(STATUS "Arguments to execute_process: ${ARGN}") + + execute_process(COMMAND + "${GIT_EXECUTABLE}" + describe + ${hash} + ${ARGN} + WORKING_DIRECTORY + "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE + res + OUTPUT_VARIABLE + out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT res EQUAL 0) + set(out "${out}-${res}-NOTFOUND") + endif() + + set(${_var} "${out}" PARENT_SCOPE) +endfunction() + +function(git_get_exact_tag _var) + git_describe(out --exact-match ${ARGN}) + set(${_var} "${out}" PARENT_SCOPE) +endfunction() diff --git a/cmake/modules/GetGitRevisionDescription.cmake.in b/cmake/modules/GetGitRevisionDescription.cmake.in new file mode 100644 index 00000000..888ce13a --- /dev/null +++ b/cmake/modules/GetGitRevisionDescription.cmake.in @@ -0,0 +1,38 @@ +# +# Internal file for GetGitRevisionDescription.cmake +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik <[email protected]> <[email protected]> +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(HEAD_HASH) + +file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) + +string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) +if(HEAD_CONTENTS MATCHES "ref") + # named branch + string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") + if(EXISTS "@GIT_DIR@/${HEAD_REF}") + configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) + elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}") + configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) + set(HEAD_HASH "${HEAD_REF}") + endif() +else() + # detached HEAD + configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) +endif() + +if(NOT HEAD_HASH) + file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) + string(STRIP "${HEAD_HASH}" HEAD_HASH) +endif() diff --git a/cmake/modules/LGPL_EXCEPTION.txt b/cmake/modules/LGPL_EXCEPTION.txt new file mode 100644 index 00000000..5cdacb9a --- /dev/null +++ b/cmake/modules/LGPL_EXCEPTION.txt @@ -0,0 +1,22 @@ +The Qt Company Qt LGPL Exception version 1.1 + +As an additional permission to the GNU Lesser General Public License version +2.1, the object code form of a "work that uses the Library" may incorporate +material from a header file that is part of the Library. You may distribute +such object code under terms of your choice, provided that: + (i) the header files of the Library have not been modified; and + (ii) the incorporated material is limited to numerical parameters, data + structure layouts, accessors, macros, inline functions and + templates; and + (iii) you comply with the terms of Section 6 of the GNU Lesser General + Public License version 2.1. + +Moreover, you may apply this exception to a modified version of the Library, +provided that such modification does not involve copying material from the +Library into the modified Library's header files unless such material is +limited to (i) numerical parameters; (ii) data structure layouts; +(iii) accessors; and (iv) small macros, templates and inline functions of +five lines or less in length. + +Furthermore, you are not required to apply this additional permission to a +modified version of the Library. diff --git a/cmake/modules/LICENSE.LGPL b/cmake/modules/LICENSE.LGPL new file mode 100644 index 00000000..5ab7695a --- /dev/null +++ b/cmake/modules/LICENSE.LGPL @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/cmake/modules/LICENSE_1_0.txt b/cmake/modules/LICENSE_1_0.txt new file mode 100644 index 00000000..36b7cd93 --- /dev/null +++ b/cmake/modules/LICENSE_1_0.txt @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/cmake/modules/TargetArch.cmake b/cmake/modules/TargetArch.cmake new file mode 100644 index 00000000..1e9c7596 --- /dev/null +++ b/cmake/modules/TargetArch.cmake @@ -0,0 +1,143 @@ +# Based on the Qt 5 processor detection code, so should be very accurate +# https://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/global/qprocessordetection.h +# Currently handles arm (v5, v6, v7), x86 (32/64), ia64, and ppc (32/64) + +# This file is under the terms of the GNU Lesser General Public License version +# 2.1 as published by the Free Software Foundation and appearing in the file +# LICENSE.LGPL included in the packaging of this file. Please review the +# following information to ensure the GNU Lesser General Public License version +# 2.1 requirements will be met: +# http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + +# Regarding POWER/PowerPC, just as is noted in the Qt source, +# "There are many more known variants/revisions that we do not handle/detect." + +set(archdetect_c_code " +#if defined(__arm__) || defined(__TARGET_ARCH_ARM) + #if defined(__ARM_ARCH_7__) \\ + || defined(__ARM_ARCH_7A__) \\ + || defined(__ARM_ARCH_7R__) \\ + || defined(__ARM_ARCH_7M__) \\ + || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7) + #error cmake_ARCH armv7 + #elif defined(__ARM_ARCH_6__) \\ + || defined(__ARM_ARCH_6J__) \\ + || defined(__ARM_ARCH_6T2__) \\ + || defined(__ARM_ARCH_6Z__) \\ + || defined(__ARM_ARCH_6K__) \\ + || defined(__ARM_ARCH_6ZK__) \\ + || defined(__ARM_ARCH_6M__) \\ + || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6) + #error cmake_ARCH armv6 + #elif defined(__ARM_ARCH_5TEJ__) \\ + || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5) + #error cmake_ARCH armv5 + #else + #error cmake_ARCH arm + #endif +#elif defined(__i586) || defined(__i586__) + #error cmake_ARCH i586 +#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) + #error cmake_ARCH i386 +#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64) + #error cmake_ARCH x86_64 +#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) + #error cmake_ARCH ia64 +#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \\ + || defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \\ + || defined(_M_MPPC) || defined(_M_PPC) + #if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__) + #error cmake_ARCH ppc64 + #else + #error cmake_ARCH ppc + #endif +#endif + +#error cmake_ARCH unknown +") + +# Set ppc_support to TRUE before including this file or ppc and ppc64 +# will be treated as invalid architectures since they are no longer supported by Apple + +function(target_architecture output_var) + if(APPLE AND CMAKE_OSX_ARCHITECTURES) + # On OS X we use CMAKE_OSX_ARCHITECTURES *if* it was set + # First let's normalize the order of the values + + # Note that it's not possible to compile PowerPC applications if you are using + # the OS X SDK version 10.6 or later - you'll need 10.4/10.5 for that, so we + # disable it by default + # See this page for more information: + # http://stackoverflow.com/questions/5333490/how-can-we-restore-ppc-ppc64-as-well-as-full-10-4-10-5-sdk-support-to-xcode-4 + + # Architecture defaults to i386 or ppc on OS X 10.5 and earlier, depending on the CPU type detected at runtime. + # On OS X 10.6+ the default is x86_64 if the CPU supports it, i386 otherwise. + + foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES}) + if("${osx_arch}" STREQUAL "ppc" AND ppc_support) + set(osx_arch_ppc TRUE) + elseif("${osx_arch}" STREQUAL "i386") + set(osx_arch_i386 TRUE) + elseif("${osx_arch}" STREQUAL "x86_64") + set(osx_arch_x86_64 TRUE) + elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support) + set(osx_arch_ppc64 TRUE) + else() + message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}") + endif() + endforeach() + + # Now add all the architectures in our normalized order + if(osx_arch_ppc) + list(APPEND ARCH ppc) + endif() + + if(osx_arch_i386) + list(APPEND ARCH i386) + endif() + + if(osx_arch_x86_64) + list(APPEND ARCH x86_64) + endif() + + if(osx_arch_ppc64) + list(APPEND ARCH ppc64) + endif() + else() + file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}") + + enable_language(C) + + # Detect the architecture in a rather creative way... + # This compiles a small C program which is a series of ifdefs that selects a + # particular #error preprocessor directive whose message string contains the + # target architecture. The program will always fail to compile (both because + # file is not a valid C program, and obviously because of the presence of the + # #error preprocessor directives... but by exploiting the preprocessor in this + # way, we can detect the correct target architecture even when cross-compiling, + # since the program itself never needs to be run (only the compiler/preprocessor) + try_run( + run_result_unused + compile_result_unused + "${CMAKE_BINARY_DIR}" + "${CMAKE_BINARY_DIR}/arch.c" + COMPILE_OUTPUT_VARIABLE ARCH + CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + ) + + # Parse the architecture name from the compiler output + string(REGEX MATCH "cmake_ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}") + + # Get rid of the value marker leaving just the architecture name + string(REPLACE "cmake_ARCH " "" ARCH "${ARCH}") + + # If we are compiling with an unknown architecture this variable should + # already be set to "unknown" but in the case that it's empty (i.e. due + # to a typo in the code), then set it to unknown + if (NOT ARCH) + set(ARCH unknown) + endif() + endif() + + set(${output_var} "${ARCH}" PARENT_SCOPE) +endfunction() diff --git a/cmake/modules/version.c.in b/cmake/modules/version.c.in new file mode 100644 index 00000000..0fdf8534 --- /dev/null +++ b/cmake/modules/version.c.in @@ -0,0 +1,4 @@ +#include "version.h" + +const char* gVERSION = "@VERSION@"; +const char* gVERSION_SHORT = "@VERSION_SHORT@"; diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 00000000..d6995c28 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,16 @@ +include_directories( + ${tinyb_LIB_INCLUDE_DIRS} + ${GLIB2_INCLUDE_DIRS} + ${GIO_INCLUDE_DIRS} + ${GIO-UNIX_INCLUDE_DIRS} +) + + +add_executable (hellotinyb hellotinyb.cpp) +set_target_properties(hellotinyb + PROPERTIES + CXX_STANDARD 11) + +include_directories(${PROJECT_SOURCE_DIR}/api) + +target_link_libraries (hellotinyb tinyb) diff --git a/examples/hellotinyb.cpp b/examples/hellotinyb.cpp new file mode 100644 index 00000000..7471debd --- /dev/null +++ b/examples/hellotinyb.cpp @@ -0,0 +1,173 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include <tinyb.hpp> + +#include <vector> +#include <iostream> +#include <thread> + +using namespace tinyb; + +/** Converts a raw temperature read from the sensor to a Celsius value. + * @param[in] raw_temp The temperature read from the sensor (two bytes) + * @return The Celsius value of the temperature + */ +static float celsius_temp(uint16_t raw_temp) +{ + const float SCALE_LSB = 0.03125; + return ((float)(raw_temp >> 2)) * SCALE_LSB; +} + +int main(int argc, char **argv) +{ + BluetoothManager *manager = BluetoothManager::get_bluetooth_manager(); + + if (argc < 2) { + std::cerr << "Run as: " << argv[0] << " <device_address>" << std::endl; + exit(1); + } + + /* Start the discovery of devices */ + bool ret = manager->start_discovery(); + std::cout << "Started = " << (ret ? "true" : "false") << std::endl; + + BluetoothDevice *sensor_tag = NULL; + BluetoothGattService *temperature_service = NULL; + + for (int i = 0; i < 15; ++i) { + std::cout << "Discovered devices: " << std::endl; + /* Get the list of devices */ + auto list = manager->get_devices(); + + for (auto it = list.begin(); it != list.end(); ++it) { + + std::cout << "Class = " << (*it)->get_class_name() << " "; + std::cout << "Path = " << (*it)->get_object_path() << " "; + std::cout << "Name = " << (*it)->get_name() << " "; + std::cout << "Connected = " << (*it)->get_connected() << " "; + std::cout << std::endl; + + /* Search for the device with the address given as a parameter to the program */ + if ((*it)->get_address() == argv[1]) + sensor_tag = (*it).release(); + } + + /* Free the list of devices and stop if the device was found */ + if (sensor_tag != NULL) + break; + /* If not, wait and try again */ + std::this_thread::sleep_for(std::chrono::seconds(4)); + std::cout << std::endl; + } + + /* Stop the discovery (the device was found or number of tries ran out */ + ret = manager->stop_discovery(); + std::cout << "Stopped = " << (ret ? "true" : "false") << std::endl; + + if (sensor_tag != NULL) { + /* Connect to the device and get the list of services exposed by it */ + sensor_tag->connect(); + std::cout << "Discovered services: " << std::endl; + std::vector<std::unique_ptr<BluetoothGattService>> list; + do { + /* Wait for the device to come online */ + std::this_thread::sleep_for(std::chrono::seconds(4)); + + list = sensor_tag->get_services(); + + for (auto it = list.begin(); it != list.end(); ++it) { + std::cout << "Class = " << (*it)->get_class_name() << " "; + std::cout << "Path = " << (*it)->get_object_path() << " "; + std::cout << "UUID = " << (*it)->get_uuid() << " "; + std::cout << "Device = " << (*it)->get_device().get_object_path() << " "; + std::cout << std::endl; + + /* Search for the temperature service, by UUID */ + if ((*it)->get_uuid() == "f000aa00-0451-4000-b000-000000000000") + temperature_service = (*it).release(); + } + } while (list.empty()); + } + + BluetoothGattCharacteristic *temp_value = NULL; + BluetoothGattCharacteristic *temp_config = NULL; + BluetoothGattCharacteristic *temp_period = NULL; + + if (temperature_service != NULL) { + /* If there is a temperature service on the device with the given UUID, + * get it's characteristics, by UUID again */ + auto list = temperature_service->get_characteristics(); + std::cout << "Discovered characteristics: " << std::endl; + for (auto it = list.begin(); it != list.end(); ++it) { + + std::cout << "Class = " << (*it)->get_class_name() << " "; + std::cout << "Path = " << (*it)->get_object_path() << " "; + std::cout << "UUID = " << (*it)->get_uuid() << " "; + std::cout << "Service = " << (*it)->get_service().get_object_path() << " "; + std::cout << std::endl; + + if ((*it)->get_uuid() == "f000aa01-0451-4000-b000-000000000000") + temp_value = (*it).release(); + else if ((*it)->get_uuid() =="f000aa02-0451-4000-b000-000000000000") + temp_config = (*it).release(); + else if ((*it)->get_uuid() == "f000aa03-0451-4000-b000-000000000000") + temp_period = (*it).release(); + } + } + + if (temp_config != NULL && temp_value != NULL && temp_period != NULL) { + /* Activate the temperature measurements */ + std::vector<unsigned char> config_on {0x01}; + temp_config->write_value(config_on); + while (true) { + /* Read temperature data and display it */ + std::vector<unsigned char> response = temp_value->read_value(); + unsigned char *data; + unsigned int size = response.size(); + if (size > 0) { + data = response.data(); + + std::cout << "Raw data=["; + for (int i = 0; i < response.size(); i++) + std::cout << std::hex << static_cast<int>(data[i]) << ", "; + std::cout << "] "; + + uint16_t ambient_temp, object_temp; + object_temp = data[0] + (data[1] << 8); + ambient_temp = data[2] + (data[3] << 8); + + std::cout << "Ambient temp: " << celsius_temp(ambient_temp) << "C "; + std::cout << "Object temp: " << celsius_temp(object_temp) << "C "; + std::cout << std::endl; + } + + std::this_thread::sleep_for(std::chrono::seconds(1)); + } + } + + /* Disconnect from the device */ + if (sensor_tag != NULL) + sensor_tag->disconnect(); +} diff --git a/include/generated-code.h b/include/generated-code.h new file mode 100644 index 00000000..00054ec7 --- /dev/null +++ b/include/generated-code.h @@ -0,0 +1,1413 @@ +/* + * Generated by gdbus-codegen 2.45.4. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifndef __GENERATED_CODE_H__ +#define __GENERATED_CODE_H__ + +#include <gio/gio.h> + +G_BEGIN_DECLS + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.bluez.Adapter1 */ + +#define TYPE_ADAPTER1 (adapter1_get_type ()) +#define ADAPTER1(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ADAPTER1, Adapter1)) +#define IS_ADAPTER1(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ADAPTER1)) +#define ADAPTER1_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_ADAPTER1, Adapter1Iface)) + +struct _Adapter1; +typedef struct _Adapter1 Adapter1; +typedef struct _Adapter1Iface Adapter1Iface; + +struct _Adapter1Iface +{ + GTypeInterface parent_iface; + + + gboolean (*handle_remove_device) ( + Adapter1 *object, + GDBusMethodInvocation *invocation, + const gchar *arg_device); + + gboolean (*handle_start_discovery) ( + Adapter1 *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_stop_discovery) ( + Adapter1 *object, + GDBusMethodInvocation *invocation); + + const gchar * (*get_address) (Adapter1 *object); + + const gchar * (*get_alias) (Adapter1 *object); + + guint (*get_class) (Adapter1 *object); + + gboolean (*get_discoverable) (Adapter1 *object); + + guint (*get_discoverable_timeout) (Adapter1 *object); + + gboolean (*get_discovering) (Adapter1 *object); + + const gchar * (*get_modalias) (Adapter1 *object); + + const gchar * (*get_name) (Adapter1 *object); + + gboolean (*get_pairable) (Adapter1 *object); + + guint (*get_pairable_timeout) (Adapter1 *object); + + gboolean (*get_powered) (Adapter1 *object); + + const gchar *const * (*get_uuids) (Adapter1 *object); + +}; + +GType adapter1_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *adapter1_interface_info (void); +guint adapter1_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus method call completion functions: */ +void adapter1_complete_start_discovery ( + Adapter1 *object, + GDBusMethodInvocation *invocation); + +void adapter1_complete_stop_discovery ( + Adapter1 *object, + GDBusMethodInvocation *invocation); + +void adapter1_complete_remove_device ( + Adapter1 *object, + GDBusMethodInvocation *invocation); + + + +/* D-Bus method calls: */ +void adapter1_call_start_discovery ( + Adapter1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean adapter1_call_start_discovery_finish ( + Adapter1 *proxy, + GAsyncResult *res, + GError **error); + +gboolean adapter1_call_start_discovery_sync ( + Adapter1 *proxy, + GCancellable *cancellable, + GError **error); + +void adapter1_call_stop_discovery ( + Adapter1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean adapter1_call_stop_discovery_finish ( + Adapter1 *proxy, + GAsyncResult *res, + GError **error); + +gboolean adapter1_call_stop_discovery_sync ( + Adapter1 *proxy, + GCancellable *cancellable, + GError **error); + +void adapter1_call_remove_device ( + Adapter1 *proxy, + const gchar *arg_device, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean adapter1_call_remove_device_finish ( + Adapter1 *proxy, + GAsyncResult *res, + GError **error); + +gboolean adapter1_call_remove_device_sync ( + Adapter1 *proxy, + const gchar *arg_device, + GCancellable *cancellable, + GError **error); + + + +/* D-Bus property accessors: */ +const gchar *adapter1_get_address (Adapter1 *object); +gchar *adapter1_dup_address (Adapter1 *object); +void adapter1_set_address (Adapter1 *object, const gchar *value); + +const gchar *adapter1_get_name (Adapter1 *object); +gchar *adapter1_dup_name (Adapter1 *object); +void adapter1_set_name (Adapter1 *object, const gchar *value); + +const gchar *adapter1_get_alias (Adapter1 *object); +gchar *adapter1_dup_alias (Adapter1 *object); +void adapter1_set_alias (Adapter1 *object, const gchar *value); + +guint adapter1_get_class (Adapter1 *object); +void adapter1_set_class (Adapter1 *object, guint value); + +gboolean adapter1_get_powered (Adapter1 *object); +void adapter1_set_powered (Adapter1 *object, gboolean value); + +gboolean adapter1_get_discoverable (Adapter1 *object); +void adapter1_set_discoverable (Adapter1 *object, gboolean value); + +guint adapter1_get_discoverable_timeout (Adapter1 *object); +void adapter1_set_discoverable_timeout (Adapter1 *object, guint value); + +gboolean adapter1_get_pairable (Adapter1 *object); +void adapter1_set_pairable (Adapter1 *object, gboolean value); + +guint adapter1_get_pairable_timeout (Adapter1 *object); +void adapter1_set_pairable_timeout (Adapter1 *object, guint value); + +gboolean adapter1_get_discovering (Adapter1 *object); +void adapter1_set_discovering (Adapter1 *object, gboolean value); + +const gchar *const *adapter1_get_uuids (Adapter1 *object); +gchar **adapter1_dup_uuids (Adapter1 *object); +void adapter1_set_uuids (Adapter1 *object, const gchar *const *value); + +const gchar *adapter1_get_modalias (Adapter1 *object); +gchar *adapter1_dup_modalias (Adapter1 *object); +void adapter1_set_modalias (Adapter1 *object, const gchar *value); + + +/* ---- */ + +#define TYPE_ADAPTER1_PROXY (adapter1_proxy_get_type ()) +#define ADAPTER1_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ADAPTER1_PROXY, Adapter1Proxy)) +#define ADAPTER1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_ADAPTER1_PROXY, Adapter1ProxyClass)) +#define ADAPTER1_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_ADAPTER1_PROXY, Adapter1ProxyClass)) +#define IS_ADAPTER1_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ADAPTER1_PROXY)) +#define IS_ADAPTER1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_ADAPTER1_PROXY)) + +typedef struct _Adapter1Proxy Adapter1Proxy; +typedef struct _Adapter1ProxyClass Adapter1ProxyClass; +typedef struct _Adapter1ProxyPrivate Adapter1ProxyPrivate; + +struct _Adapter1Proxy +{ + /*< private >*/ + GDBusProxy parent_instance; + Adapter1ProxyPrivate *priv; +}; + +struct _Adapter1ProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType adapter1_proxy_get_type (void) G_GNUC_CONST; + +void adapter1_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +Adapter1 *adapter1_proxy_new_finish ( + GAsyncResult *res, + GError **error); +Adapter1 *adapter1_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void adapter1_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +Adapter1 *adapter1_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +Adapter1 *adapter1_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define TYPE_ADAPTER1_SKELETON (adapter1_skeleton_get_type ()) +#define ADAPTER1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_ADAPTER1_SKELETON, Adapter1Skeleton)) +#define ADAPTER1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_ADAPTER1_SKELETON, Adapter1SkeletonClass)) +#define ADAPTER1_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_ADAPTER1_SKELETON, Adapter1SkeletonClass)) +#define IS_ADAPTER1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_ADAPTER1_SKELETON)) +#define IS_ADAPTER1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_ADAPTER1_SKELETON)) + +typedef struct _Adapter1Skeleton Adapter1Skeleton; +typedef struct _Adapter1SkeletonClass Adapter1SkeletonClass; +typedef struct _Adapter1SkeletonPrivate Adapter1SkeletonPrivate; + +struct _Adapter1Skeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + Adapter1SkeletonPrivate *priv; +}; + +struct _Adapter1SkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType adapter1_skeleton_get_type (void) G_GNUC_CONST; + +Adapter1 *adapter1_skeleton_new (void); + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.bluez.Device1 */ + +#define TYPE_DEVICE1 (device1_get_type ()) +#define DEVICE1(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_DEVICE1, Device1)) +#define IS_DEVICE1(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_DEVICE1)) +#define DEVICE1_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_DEVICE1, Device1Iface)) + +struct _Device1; +typedef struct _Device1 Device1; +typedef struct _Device1Iface Device1Iface; + +struct _Device1Iface +{ + GTypeInterface parent_iface; + + + gboolean (*handle_cancel_pairing) ( + Device1 *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_connect) ( + Device1 *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_connect_profile) ( + Device1 *object, + GDBusMethodInvocation *invocation, + const gchar *arg_UUID); + + gboolean (*handle_disconnect) ( + Device1 *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_disconnect_profile) ( + Device1 *object, + GDBusMethodInvocation *invocation, + const gchar *arg_UUID); + + gboolean (*handle_pair) ( + Device1 *object, + GDBusMethodInvocation *invocation); + + const gchar * (*get_adapter) (Device1 *object); + + const gchar * (*get_address) (Device1 *object); + + const gchar * (*get_alias) (Device1 *object); + + guint16 (*get_appearance) (Device1 *object); + + gboolean (*get_blocked) (Device1 *object); + + guint (*get_class) (Device1 *object); + + gboolean (*get_connected) (Device1 *object); + + const gchar * (*get_icon) (Device1 *object); + + gboolean (*get_legacy_pairing) (Device1 *object); + + const gchar * (*get_modalias) (Device1 *object); + + const gchar * (*get_name) (Device1 *object); + + gboolean (*get_paired) (Device1 *object); + + gint16 (*get_rssi) (Device1 *object); + + gboolean (*get_trusted) (Device1 *object); + + const gchar *const * (*get_uuids) (Device1 *object); + +}; + +GType device1_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *device1_interface_info (void); +guint device1_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus method call completion functions: */ +void device1_complete_disconnect ( + Device1 *object, + GDBusMethodInvocation *invocation); + +void device1_complete_connect ( + Device1 *object, + GDBusMethodInvocation *invocation); + +void device1_complete_connect_profile ( + Device1 *object, + GDBusMethodInvocation *invocation); + +void device1_complete_disconnect_profile ( + Device1 *object, + GDBusMethodInvocation *invocation); + +void device1_complete_pair ( + Device1 *object, + GDBusMethodInvocation *invocation); + +void device1_complete_cancel_pairing ( + Device1 *object, + GDBusMethodInvocation *invocation); + + + +/* D-Bus method calls: */ +void device1_call_disconnect ( + Device1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean device1_call_disconnect_finish ( + Device1 *proxy, + GAsyncResult *res, + GError **error); + +gboolean device1_call_disconnect_sync ( + Device1 *proxy, + GCancellable *cancellable, + GError **error); + +void device1_call_connect ( + Device1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean device1_call_connect_finish ( + Device1 *proxy, + GAsyncResult *res, + GError **error); + +gboolean device1_call_connect_sync ( + Device1 *proxy, + GCancellable *cancellable, + GError **error); + +void device1_call_connect_profile ( + Device1 *proxy, + const gchar *arg_UUID, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean device1_call_connect_profile_finish ( + Device1 *proxy, + GAsyncResult *res, + GError **error); + +gboolean device1_call_connect_profile_sync ( + Device1 *proxy, + const gchar *arg_UUID, + GCancellable *cancellable, + GError **error); + +void device1_call_disconnect_profile ( + Device1 *proxy, + const gchar *arg_UUID, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean device1_call_disconnect_profile_finish ( + Device1 *proxy, + GAsyncResult *res, + GError **error); + +gboolean device1_call_disconnect_profile_sync ( + Device1 *proxy, + const gchar *arg_UUID, + GCancellable *cancellable, + GError **error); + +void device1_call_pair ( + Device1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean device1_call_pair_finish ( + Device1 *proxy, + GAsyncResult *res, + GError **error); + +gboolean device1_call_pair_sync ( + Device1 *proxy, + GCancellable *cancellable, + GError **error); + +void device1_call_cancel_pairing ( + Device1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean device1_call_cancel_pairing_finish ( + Device1 *proxy, + GAsyncResult *res, + GError **error); + +gboolean device1_call_cancel_pairing_sync ( + Device1 *proxy, + GCancellable *cancellable, + GError **error); + + + +/* D-Bus property accessors: */ +const gchar *device1_get_address (Device1 *object); +gchar *device1_dup_address (Device1 *object); +void device1_set_address (Device1 *object, const gchar *value); + +const gchar *device1_get_name (Device1 *object); +gchar *device1_dup_name (Device1 *object); +void device1_set_name (Device1 *object, const gchar *value); + +const gchar *device1_get_alias (Device1 *object); +gchar *device1_dup_alias (Device1 *object); +void device1_set_alias (Device1 *object, const gchar *value); + +guint device1_get_class (Device1 *object); +void device1_set_class (Device1 *object, guint value); + +guint16 device1_get_appearance (Device1 *object); +void device1_set_appearance (Device1 *object, guint16 value); + +const gchar *device1_get_icon (Device1 *object); +gchar *device1_dup_icon (Device1 *object); +void device1_set_icon (Device1 *object, const gchar *value); + +gboolean device1_get_paired (Device1 *object); +void device1_set_paired (Device1 *object, gboolean value); + +gboolean device1_get_trusted (Device1 *object); +void device1_set_trusted (Device1 *object, gboolean value); + +gboolean device1_get_blocked (Device1 *object); +void device1_set_blocked (Device1 *object, gboolean value); + +gboolean device1_get_legacy_pairing (Device1 *object); +void device1_set_legacy_pairing (Device1 *object, gboolean value); + +gint16 device1_get_rssi (Device1 *object); +void device1_set_rssi (Device1 *object, gint16 value); + +gboolean device1_get_connected (Device1 *object); +void device1_set_connected (Device1 *object, gboolean value); + +const gchar *const *device1_get_uuids (Device1 *object); +gchar **device1_dup_uuids (Device1 *object); +void device1_set_uuids (Device1 *object, const gchar *const *value); + +const gchar *device1_get_modalias (Device1 *object); +gchar *device1_dup_modalias (Device1 *object); +void device1_set_modalias (Device1 *object, const gchar *value); + +const gchar *device1_get_adapter (Device1 *object); +gchar *device1_dup_adapter (Device1 *object); +void device1_set_adapter (Device1 *object, const gchar *value); + + +/* ---- */ + +#define TYPE_DEVICE1_PROXY (device1_proxy_get_type ()) +#define DEVICE1_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_DEVICE1_PROXY, Device1Proxy)) +#define DEVICE1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_DEVICE1_PROXY, Device1ProxyClass)) +#define DEVICE1_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_DEVICE1_PROXY, Device1ProxyClass)) +#define IS_DEVICE1_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_DEVICE1_PROXY)) +#define IS_DEVICE1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_DEVICE1_PROXY)) + +typedef struct _Device1Proxy Device1Proxy; +typedef struct _Device1ProxyClass Device1ProxyClass; +typedef struct _Device1ProxyPrivate Device1ProxyPrivate; + +struct _Device1Proxy +{ + /*< private >*/ + GDBusProxy parent_instance; + Device1ProxyPrivate *priv; +}; + +struct _Device1ProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType device1_proxy_get_type (void) G_GNUC_CONST; + +void device1_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +Device1 *device1_proxy_new_finish ( + GAsyncResult *res, + GError **error); +Device1 *device1_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void device1_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +Device1 *device1_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +Device1 *device1_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define TYPE_DEVICE1_SKELETON (device1_skeleton_get_type ()) +#define DEVICE1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_DEVICE1_SKELETON, Device1Skeleton)) +#define DEVICE1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_DEVICE1_SKELETON, Device1SkeletonClass)) +#define DEVICE1_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_DEVICE1_SKELETON, Device1SkeletonClass)) +#define IS_DEVICE1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_DEVICE1_SKELETON)) +#define IS_DEVICE1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_DEVICE1_SKELETON)) + +typedef struct _Device1Skeleton Device1Skeleton; +typedef struct _Device1SkeletonClass Device1SkeletonClass; +typedef struct _Device1SkeletonPrivate Device1SkeletonPrivate; + +struct _Device1Skeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + Device1SkeletonPrivate *priv; +}; + +struct _Device1SkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType device1_skeleton_get_type (void) G_GNUC_CONST; + +Device1 *device1_skeleton_new (void); + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.bluez.GattService1 */ + +#define TYPE_GATT_SERVICE1 (gatt_service1_get_type ()) +#define GATT_SERVICE1(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_GATT_SERVICE1, GattService1)) +#define IS_GATT_SERVICE1(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_GATT_SERVICE1)) +#define GATT_SERVICE1_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_GATT_SERVICE1, GattService1Iface)) + +struct _GattService1; +typedef struct _GattService1 GattService1; +typedef struct _GattService1Iface GattService1Iface; + +struct _GattService1Iface +{ + GTypeInterface parent_iface; + + const gchar *const * (*get_characteristics) (GattService1 *object); + + const gchar * (*get_device) (GattService1 *object); + + gboolean (*get_primary) (GattService1 *object); + + const gchar * (*get_uuid) (GattService1 *object); + +}; + +GType gatt_service1_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *gatt_service1_interface_info (void); +guint gatt_service1_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus property accessors: */ +const gchar *gatt_service1_get_uuid (GattService1 *object); +gchar *gatt_service1_dup_uuid (GattService1 *object); +void gatt_service1_set_uuid (GattService1 *object, const gchar *value); + +const gchar *gatt_service1_get_device (GattService1 *object); +gchar *gatt_service1_dup_device (GattService1 *object); +void gatt_service1_set_device (GattService1 *object, const gchar *value); + +gboolean gatt_service1_get_primary (GattService1 *object); +void gatt_service1_set_primary (GattService1 *object, gboolean value); + +const gchar *const *gatt_service1_get_characteristics (GattService1 *object); +gchar **gatt_service1_dup_characteristics (GattService1 *object); +void gatt_service1_set_characteristics (GattService1 *object, const gchar *const *value); + + +/* ---- */ + +#define TYPE_GATT_SERVICE1_PROXY (gatt_service1_proxy_get_type ()) +#define GATT_SERVICE1_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_GATT_SERVICE1_PROXY, GattService1Proxy)) +#define GATT_SERVICE1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_GATT_SERVICE1_PROXY, GattService1ProxyClass)) +#define GATT_SERVICE1_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_GATT_SERVICE1_PROXY, GattService1ProxyClass)) +#define IS_GATT_SERVICE1_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_GATT_SERVICE1_PROXY)) +#define IS_GATT_SERVICE1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_GATT_SERVICE1_PROXY)) + +typedef struct _GattService1Proxy GattService1Proxy; +typedef struct _GattService1ProxyClass GattService1ProxyClass; +typedef struct _GattService1ProxyPrivate GattService1ProxyPrivate; + +struct _GattService1Proxy +{ + /*< private >*/ + GDBusProxy parent_instance; + GattService1ProxyPrivate *priv; +}; + +struct _GattService1ProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType gatt_service1_proxy_get_type (void) G_GNUC_CONST; + +void gatt_service1_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GattService1 *gatt_service1_proxy_new_finish ( + GAsyncResult *res, + GError **error); +GattService1 *gatt_service1_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void gatt_service1_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GattService1 *gatt_service1_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +GattService1 *gatt_service1_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define TYPE_GATT_SERVICE1_SKELETON (gatt_service1_skeleton_get_type ()) +#define GATT_SERVICE1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_GATT_SERVICE1_SKELETON, GattService1Skeleton)) +#define GATT_SERVICE1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_GATT_SERVICE1_SKELETON, GattService1SkeletonClass)) +#define GATT_SERVICE1_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_GATT_SERVICE1_SKELETON, GattService1SkeletonClass)) +#define IS_GATT_SERVICE1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_GATT_SERVICE1_SKELETON)) +#define IS_GATT_SERVICE1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_GATT_SERVICE1_SKELETON)) + +typedef struct _GattService1Skeleton GattService1Skeleton; +typedef struct _GattService1SkeletonClass GattService1SkeletonClass; +typedef struct _GattService1SkeletonPrivate GattService1SkeletonPrivate; + +struct _GattService1Skeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + GattService1SkeletonPrivate *priv; +}; + +struct _GattService1SkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType gatt_service1_skeleton_get_type (void) G_GNUC_CONST; + +GattService1 *gatt_service1_skeleton_new (void); + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.bluez.GattCharacteristic1 */ + +#define TYPE_GATT_CHARACTERISTIC1 (gatt_characteristic1_get_type ()) +#define GATT_CHARACTERISTIC1(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_GATT_CHARACTERISTIC1, GattCharacteristic1)) +#define IS_GATT_CHARACTERISTIC1(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_GATT_CHARACTERISTIC1)) +#define GATT_CHARACTERISTIC1_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_GATT_CHARACTERISTIC1, GattCharacteristic1Iface)) + +struct _GattCharacteristic1; +typedef struct _GattCharacteristic1 GattCharacteristic1; +typedef struct _GattCharacteristic1Iface GattCharacteristic1Iface; + +struct _GattCharacteristic1Iface +{ + GTypeInterface parent_iface; + + + gboolean (*handle_read_value) ( + GattCharacteristic1 *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_start_notify) ( + GattCharacteristic1 *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_stop_notify) ( + GattCharacteristic1 *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_write_value) ( + GattCharacteristic1 *object, + GDBusMethodInvocation *invocation, + const gchar *arg_value); + + const gchar *const * (*get_descriptors) (GattCharacteristic1 *object); + + const gchar *const * (*get_flags) (GattCharacteristic1 *object); + + gboolean (*get_notifying) (GattCharacteristic1 *object); + + const gchar * (*get_service) (GattCharacteristic1 *object); + + const gchar * (*get_uuid) (GattCharacteristic1 *object); + + const GBytes * (*get_value) (GattCharacteristic1 *object); + +}; + +GType gatt_characteristic1_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *gatt_characteristic1_interface_info (void); +guint gatt_characteristic1_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus method call completion functions: */ +void gatt_characteristic1_complete_read_value ( + GattCharacteristic1 *object, + GDBusMethodInvocation *invocation, + const gchar *value); + +void gatt_characteristic1_complete_write_value ( + GattCharacteristic1 *object, + GDBusMethodInvocation *invocation); + +void gatt_characteristic1_complete_start_notify ( + GattCharacteristic1 *object, + GDBusMethodInvocation *invocation); + +void gatt_characteristic1_complete_stop_notify ( + GattCharacteristic1 *object, + GDBusMethodInvocation *invocation); + + + +/* D-Bus method calls: */ +void gatt_characteristic1_call_read_value ( + GattCharacteristic1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean gatt_characteristic1_call_read_value_finish ( + GattCharacteristic1 *proxy, + GBytes **out_value, + GAsyncResult *res, + GError **error); + +gboolean gatt_characteristic1_call_read_value_sync ( + GattCharacteristic1 *proxy, + GBytes **out_value, + GCancellable *cancellable, + GError **error); + +void gatt_characteristic1_call_write_value ( + GattCharacteristic1 *proxy, + GBytes *arg_value, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean gatt_characteristic1_call_write_value_finish ( + GattCharacteristic1 *proxy, + GAsyncResult *res, + GError **error); + +gboolean gatt_characteristic1_call_write_value_sync ( + GattCharacteristic1 *proxy, + GBytes *arg_value, + GCancellable *cancellable, + GError **error); + +void gatt_characteristic1_call_start_notify ( + GattCharacteristic1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean gatt_characteristic1_call_start_notify_finish ( + GattCharacteristic1 *proxy, + GAsyncResult *res, + GError **error); + +gboolean gatt_characteristic1_call_start_notify_sync ( + GattCharacteristic1 *proxy, + GCancellable *cancellable, + GError **error); + +void gatt_characteristic1_call_stop_notify ( + GattCharacteristic1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean gatt_characteristic1_call_stop_notify_finish ( + GattCharacteristic1 *proxy, + GAsyncResult *res, + GError **error); + +gboolean gatt_characteristic1_call_stop_notify_sync ( + GattCharacteristic1 *proxy, + GCancellable *cancellable, + GError **error); + + + +/* D-Bus property accessors: */ +const gchar *gatt_characteristic1_get_uuid (GattCharacteristic1 *object); +gchar *gatt_characteristic1_dup_uuid (GattCharacteristic1 *object); +void gatt_characteristic1_set_uuid (GattCharacteristic1 *object, const gchar *value); + +const gchar *gatt_characteristic1_get_service (GattCharacteristic1 *object); +gchar *gatt_characteristic1_dup_service (GattCharacteristic1 *object); +void gatt_characteristic1_set_service (GattCharacteristic1 *object, const gchar *value); + +const GBytes *gatt_characteristic1_get_value (GattCharacteristic1 *object); +GBytes *gatt_characteristic1_dup_value (GattCharacteristic1 *object); +void gatt_characteristic1_set_value (GattCharacteristic1 *object, const GBytes *value); + +gboolean gatt_characteristic1_get_notifying (GattCharacteristic1 *object); +void gatt_characteristic1_set_notifying (GattCharacteristic1 *object, gboolean value); + +const gchar *const *gatt_characteristic1_get_flags (GattCharacteristic1 *object); +gchar **gatt_characteristic1_dup_flags (GattCharacteristic1 *object); +void gatt_characteristic1_set_flags (GattCharacteristic1 *object, const gchar *const *value); + +const gchar *const *gatt_characteristic1_get_descriptors (GattCharacteristic1 *object); +gchar **gatt_characteristic1_dup_descriptors (GattCharacteristic1 *object); +void gatt_characteristic1_set_descriptors (GattCharacteristic1 *object, const gchar *const *value); + + +/* ---- */ + +#define TYPE_GATT_CHARACTERISTIC1_PROXY (gatt_characteristic1_proxy_get_type ()) +#define GATT_CHARACTERISTIC1_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_GATT_CHARACTERISTIC1_PROXY, GattCharacteristic1Proxy)) +#define GATT_CHARACTERISTIC1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_GATT_CHARACTERISTIC1_PROXY, GattCharacteristic1ProxyClass)) +#define GATT_CHARACTERISTIC1_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_GATT_CHARACTERISTIC1_PROXY, GattCharacteristic1ProxyClass)) +#define IS_GATT_CHARACTERISTIC1_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_GATT_CHARACTERISTIC1_PROXY)) +#define IS_GATT_CHARACTERISTIC1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_GATT_CHARACTERISTIC1_PROXY)) + +typedef struct _GattCharacteristic1Proxy GattCharacteristic1Proxy; +typedef struct _GattCharacteristic1ProxyClass GattCharacteristic1ProxyClass; +typedef struct _GattCharacteristic1ProxyPrivate GattCharacteristic1ProxyPrivate; + +struct _GattCharacteristic1Proxy +{ + /*< private >*/ + GDBusProxy parent_instance; + GattCharacteristic1ProxyPrivate *priv; +}; + +struct _GattCharacteristic1ProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType gatt_characteristic1_proxy_get_type (void) G_GNUC_CONST; + +void gatt_characteristic1_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GattCharacteristic1 *gatt_characteristic1_proxy_new_finish ( + GAsyncResult *res, + GError **error); +GattCharacteristic1 *gatt_characteristic1_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void gatt_characteristic1_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GattCharacteristic1 *gatt_characteristic1_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +GattCharacteristic1 *gatt_characteristic1_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define TYPE_GATT_CHARACTERISTIC1_SKELETON (gatt_characteristic1_skeleton_get_type ()) +#define GATT_CHARACTERISTIC1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_GATT_CHARACTERISTIC1_SKELETON, GattCharacteristic1Skeleton)) +#define GATT_CHARACTERISTIC1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_GATT_CHARACTERISTIC1_SKELETON, GattCharacteristic1SkeletonClass)) +#define GATT_CHARACTERISTIC1_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_GATT_CHARACTERISTIC1_SKELETON, GattCharacteristic1SkeletonClass)) +#define IS_GATT_CHARACTERISTIC1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_GATT_CHARACTERISTIC1_SKELETON)) +#define IS_GATT_CHARACTERISTIC1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_GATT_CHARACTERISTIC1_SKELETON)) + +typedef struct _GattCharacteristic1Skeleton GattCharacteristic1Skeleton; +typedef struct _GattCharacteristic1SkeletonClass GattCharacteristic1SkeletonClass; +typedef struct _GattCharacteristic1SkeletonPrivate GattCharacteristic1SkeletonPrivate; + +struct _GattCharacteristic1Skeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + GattCharacteristic1SkeletonPrivate *priv; +}; + +struct _GattCharacteristic1SkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType gatt_characteristic1_skeleton_get_type (void) G_GNUC_CONST; + +GattCharacteristic1 *gatt_characteristic1_skeleton_new (void); + + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.bluez.GattDescriptor1 */ + +#define TYPE_GATT_DESCRIPTOR1 (gatt_descriptor1_get_type ()) +#define GATT_DESCRIPTOR1(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_GATT_DESCRIPTOR1, GattDescriptor1)) +#define IS_GATT_DESCRIPTOR1(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_GATT_DESCRIPTOR1)) +#define GATT_DESCRIPTOR1_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_GATT_DESCRIPTOR1, GattDescriptor1Iface)) + +struct _GattDescriptor1; +typedef struct _GattDescriptor1 GattDescriptor1; +typedef struct _GattDescriptor1Iface GattDescriptor1Iface; + +struct _GattDescriptor1Iface +{ + GTypeInterface parent_iface; + + + gboolean (*handle_read_value) ( + GattDescriptor1 *object, + GDBusMethodInvocation *invocation); + + gboolean (*handle_write_value) ( + GattDescriptor1 *object, + GDBusMethodInvocation *invocation, + const gchar *arg_value); + + const gchar * (*get_characteristic) (GattDescriptor1 *object); + + const gchar * (*get_uuid) (GattDescriptor1 *object); + + const GBytes * (*get_value) (GattDescriptor1 *object); + +}; + +GType gatt_descriptor1_get_type (void) G_GNUC_CONST; + +GDBusInterfaceInfo *gatt_descriptor1_interface_info (void); +guint gatt_descriptor1_override_properties (GObjectClass *klass, guint property_id_begin); + + +/* D-Bus method call completion functions: */ +void gatt_descriptor1_complete_read_value ( + GattDescriptor1 *object, + GDBusMethodInvocation *invocation, + const gchar *value); + +void gatt_descriptor1_complete_write_value ( + GattDescriptor1 *object, + GDBusMethodInvocation *invocation); + + + +/* D-Bus method calls: */ +void gatt_descriptor1_call_read_value ( + GattDescriptor1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean gatt_descriptor1_call_read_value_finish ( + GattDescriptor1 *proxy, + GBytes **out_value, + GAsyncResult *res, + GError **error); + +gboolean gatt_descriptor1_call_read_value_sync ( + GattDescriptor1 *proxy, + GBytes **out_value, + GCancellable *cancellable, + GError **error); + +void gatt_descriptor1_call_write_value ( + GattDescriptor1 *proxy, + GBytes *arg_value, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean gatt_descriptor1_call_write_value_finish ( + GattDescriptor1 *proxy, + GAsyncResult *res, + GError **error); + +gboolean gatt_descriptor1_call_write_value_sync ( + GattDescriptor1 *proxy, + GBytes *arg_value, + GCancellable *cancellable, + GError **error); + + + +/* D-Bus property accessors: */ +const gchar *gatt_descriptor1_get_uuid (GattDescriptor1 *object); +gchar *gatt_descriptor1_dup_uuid (GattDescriptor1 *object); +void gatt_descriptor1_set_uuid (GattDescriptor1 *object, const gchar *value); + +const gchar *gatt_descriptor1_get_characteristic (GattDescriptor1 *object); +gchar *gatt_descriptor1_dup_characteristic (GattDescriptor1 *object); +void gatt_descriptor1_set_characteristic (GattDescriptor1 *object, const gchar *value); + +const GBytes *gatt_descriptor1_get_value (GattDescriptor1 *object); +GBytes *gatt_descriptor1_dup_value (GattDescriptor1 *object); +void gatt_descriptor1_set_value (GattDescriptor1 *object, const GBytes *value); + + +/* ---- */ + +#define TYPE_GATT_DESCRIPTOR1_PROXY (gatt_descriptor1_proxy_get_type ()) +#define GATT_DESCRIPTOR1_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_GATT_DESCRIPTOR1_PROXY, GattDescriptor1Proxy)) +#define GATT_DESCRIPTOR1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_GATT_DESCRIPTOR1_PROXY, GattDescriptor1ProxyClass)) +#define GATT_DESCRIPTOR1_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_GATT_DESCRIPTOR1_PROXY, GattDescriptor1ProxyClass)) +#define IS_GATT_DESCRIPTOR1_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_GATT_DESCRIPTOR1_PROXY)) +#define IS_GATT_DESCRIPTOR1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_GATT_DESCRIPTOR1_PROXY)) + +typedef struct _GattDescriptor1Proxy GattDescriptor1Proxy; +typedef struct _GattDescriptor1ProxyClass GattDescriptor1ProxyClass; +typedef struct _GattDescriptor1ProxyPrivate GattDescriptor1ProxyPrivate; + +struct _GattDescriptor1Proxy +{ + /*< private >*/ + GDBusProxy parent_instance; + GattDescriptor1ProxyPrivate *priv; +}; + +struct _GattDescriptor1ProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType gatt_descriptor1_proxy_get_type (void) G_GNUC_CONST; + +void gatt_descriptor1_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GattDescriptor1 *gatt_descriptor1_proxy_new_finish ( + GAsyncResult *res, + GError **error); +GattDescriptor1 *gatt_descriptor1_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void gatt_descriptor1_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GattDescriptor1 *gatt_descriptor1_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +GattDescriptor1 *gatt_descriptor1_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +/* ---- */ + +#define TYPE_GATT_DESCRIPTOR1_SKELETON (gatt_descriptor1_skeleton_get_type ()) +#define GATT_DESCRIPTOR1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_GATT_DESCRIPTOR1_SKELETON, GattDescriptor1Skeleton)) +#define GATT_DESCRIPTOR1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_GATT_DESCRIPTOR1_SKELETON, GattDescriptor1SkeletonClass)) +#define GATT_DESCRIPTOR1_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_GATT_DESCRIPTOR1_SKELETON, GattDescriptor1SkeletonClass)) +#define IS_GATT_DESCRIPTOR1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_GATT_DESCRIPTOR1_SKELETON)) +#define IS_GATT_DESCRIPTOR1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_GATT_DESCRIPTOR1_SKELETON)) + +typedef struct _GattDescriptor1Skeleton GattDescriptor1Skeleton; +typedef struct _GattDescriptor1SkeletonClass GattDescriptor1SkeletonClass; +typedef struct _GattDescriptor1SkeletonPrivate GattDescriptor1SkeletonPrivate; + +struct _GattDescriptor1Skeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + GattDescriptor1SkeletonPrivate *priv; +}; + +struct _GattDescriptor1SkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType gatt_descriptor1_skeleton_get_type (void) G_GNUC_CONST; + +GattDescriptor1 *gatt_descriptor1_skeleton_new (void); + + +/* ---- */ + +#define TYPE_OBJECT (object_get_type ()) +#define OBJECT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OBJECT, Object)) +#define IS_OBJECT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OBJECT)) +#define OBJECT_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_OBJECT, Object)) + +struct _Object; +typedef struct _Object Object; +typedef struct _ObjectIface ObjectIface; + +struct _ObjectIface +{ + GTypeInterface parent_iface; +}; + +GType object_get_type (void) G_GNUC_CONST; + +Adapter1 *object_get_adapter1 (Object *object); +Device1 *object_get_device1 (Object *object); +GattService1 *object_get_gatt_service1 (Object *object); +GattCharacteristic1 *object_get_gatt_characteristic1 (Object *object); +GattDescriptor1 *object_get_gatt_descriptor1 (Object *object); +Adapter1 *object_peek_adapter1 (Object *object); +Device1 *object_peek_device1 (Object *object); +GattService1 *object_peek_gatt_service1 (Object *object); +GattCharacteristic1 *object_peek_gatt_characteristic1 (Object *object); +GattDescriptor1 *object_peek_gatt_descriptor1 (Object *object); + +#define TYPE_OBJECT_PROXY (object_proxy_get_type ()) +#define OBJECT_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OBJECT_PROXY, ObjectProxy)) +#define OBJECT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_OBJECT_PROXY, ObjectProxyClass)) +#define OBJECT_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_OBJECT_PROXY, ObjectProxyClass)) +#define IS_OBJECT_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OBJECT_PROXY)) +#define IS_OBJECT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_OBJECT_PROXY)) + +typedef struct _ObjectProxy ObjectProxy; +typedef struct _ObjectProxyClass ObjectProxyClass; +typedef struct _ObjectProxyPrivate ObjectProxyPrivate; + +struct _ObjectProxy +{ + /*< private >*/ + GDBusObjectProxy parent_instance; + ObjectProxyPrivate *priv; +}; + +struct _ObjectProxyClass +{ + GDBusObjectProxyClass parent_class; +}; + +GType object_proxy_get_type (void) G_GNUC_CONST; +ObjectProxy *object_proxy_new (GDBusConnection *connection, const gchar *object_path); + +#define TYPE_OBJECT_SKELETON (object_skeleton_get_type ()) +#define OBJECT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OBJECT_SKELETON, ObjectSkeleton)) +#define OBJECT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_OBJECT_SKELETON, ObjectSkeletonClass)) +#define OBJECT_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_OBJECT_SKELETON, ObjectSkeletonClass)) +#define IS_OBJECT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OBJECT_SKELETON)) +#define IS_OBJECT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_OBJECT_SKELETON)) + +typedef struct _ObjectSkeleton ObjectSkeleton; +typedef struct _ObjectSkeletonClass ObjectSkeletonClass; +typedef struct _ObjectSkeletonPrivate ObjectSkeletonPrivate; + +struct _ObjectSkeleton +{ + /*< private >*/ + GDBusObjectSkeleton parent_instance; + ObjectSkeletonPrivate *priv; +}; + +struct _ObjectSkeletonClass +{ + GDBusObjectSkeletonClass parent_class; +}; + +GType object_skeleton_get_type (void) G_GNUC_CONST; +ObjectSkeleton *object_skeleton_new (const gchar *object_path); +void object_skeleton_set_adapter1 (ObjectSkeleton *object, Adapter1 *interface_); +void object_skeleton_set_device1 (ObjectSkeleton *object, Device1 *interface_); +void object_skeleton_set_gatt_service1 (ObjectSkeleton *object, GattService1 *interface_); +void object_skeleton_set_gatt_characteristic1 (ObjectSkeleton *object, GattCharacteristic1 *interface_); +void object_skeleton_set_gatt_descriptor1 (ObjectSkeleton *object, GattDescriptor1 *interface_); + +/* ---- */ + +#define TYPE_OBJECT_MANAGER_CLIENT (object_manager_client_get_type ()) +#define OBJECT_MANAGER_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OBJECT_MANAGER_CLIENT, ObjectManagerClient)) +#define OBJECT_MANAGER_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_OBJECT_MANAGER_CLIENT, ObjectManagerClientClass)) +#define OBJECT_MANAGER_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_OBJECT_MANAGER_CLIENT, ObjectManagerClientClass)) +#define IS_OBJECT_MANAGER_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OBJECT_MANAGER_CLIENT)) +#define IS_OBJECT_MANAGER_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_OBJECT_MANAGER_CLIENT)) + +typedef struct _ObjectManagerClient ObjectManagerClient; +typedef struct _ObjectManagerClientClass ObjectManagerClientClass; +typedef struct _ObjectManagerClientPrivate ObjectManagerClientPrivate; + +struct _ObjectManagerClient +{ + /*< private >*/ + GDBusObjectManagerClient parent_instance; + ObjectManagerClientPrivate *priv; +}; + +struct _ObjectManagerClientClass +{ + GDBusObjectManagerClientClass parent_class; +}; + +GType object_manager_client_get_type (void) G_GNUC_CONST; + +GType object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager, const gchar *object_path, const gchar *interface_name, gpointer user_data); + +void object_manager_client_new ( + GDBusConnection *connection, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GDBusObjectManager *object_manager_client_new_finish ( + GAsyncResult *res, + GError **error); +GDBusObjectManager *object_manager_client_new_sync ( + GDBusConnection *connection, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + +void object_manager_client_new_for_bus ( + GBusType bus_type, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GDBusObjectManager *object_manager_client_new_for_bus_finish ( + GAsyncResult *res, + GError **error); +GDBusObjectManager *object_manager_client_new_for_bus_sync ( + GBusType bus_type, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error); + + +G_END_DECLS + +#endif /* __GENERATED_CODE_H__ */ diff --git a/include/tinyb_utils.hpp b/include/tinyb_utils.hpp new file mode 100644 index 00000000..addcc469 --- /dev/null +++ b/include/tinyb_utils.hpp @@ -0,0 +1,37 @@ +/* + * Author: Andrei Vasiliu <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#pragma once + +#include "BluetoothObject.hpp" +#include "generated-code.h" + +#include <vector> + +extern GDBusObjectManager *gdbus_manager; + +namespace tinyb { + std::vector<unsigned char> from_gbytes_to_vector(const GBytes *bytes); + GBytes *from_vector_to_gbytes(const std::vector<unsigned char>& array); +}; diff --git a/include/version.h b/include/version.h new file mode 100644 index 00000000..5dbf12e0 --- /dev/null +++ b/include/version.h @@ -0,0 +1,4 @@ +#pragma once + +extern const char* gVERSION; +extern const char* gVERSION_SHORT; diff --git a/src/BluetoothAdapter.cpp b/src/BluetoothAdapter.cpp new file mode 100644 index 00000000..505e46cf --- /dev/null +++ b/src/BluetoothAdapter.cpp @@ -0,0 +1,248 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "generated-code.h" +#include "tinyb_utils.hpp" +#include "BluetoothAdapter.hpp" +#include "BluetoothDevice.hpp" +#include "BluetoothManager.hpp" + +using namespace tinyb; + +std::string BluetoothAdapter::get_class_name() const +{ + return std::string("BluetoothAdapter"); +} + +std::string BluetoothAdapter::get_java_class() const +{ + return std::string(JAVA_PACKAGE "/BluetoothAdapter"); +} + +std::string BluetoothAdapter::get_object_path() const +{ + return std::string(g_dbus_proxy_get_object_path(G_DBUS_PROXY(object))); +} + +BluetoothType BluetoothAdapter::get_bluetooth_type() const +{ + return BluetoothType::ADAPTER; +} + +BluetoothAdapter::BluetoothAdapter(Adapter1 *object) +{ + this->object = object; + g_object_ref(object); +} + +BluetoothAdapter::BluetoothAdapter(const BluetoothAdapter &object) +{ + BluetoothAdapter(object.object); +} + +BluetoothAdapter *BluetoothAdapter::clone() const +{ + return new BluetoothAdapter(object); +} + +BluetoothAdapter::~BluetoothAdapter() +{ + g_object_unref(object); +} + +std::unique_ptr<BluetoothAdapter> BluetoothAdapter::make(Object *object, + BluetoothType type, std::string *name, std::string *identifier, + BluetoothObject *parent) +{ + Adapter1 *adapter; + if((type == BluetoothType::NONE || type == BluetoothType::ADAPTER) && + (adapter = object_get_adapter1(object)) != NULL) { + + std::unique_ptr<BluetoothAdapter> p(new BluetoothAdapter(adapter)); + + if ((name == nullptr || *name == p->get_name()) && + (identifier == nullptr || *identifier == p->get_address()) && + (parent == nullptr)) + return p; + } + + return std::unique_ptr<BluetoothAdapter>(); +} + +std::vector<std::unique_ptr<BluetoothDevice>> BluetoothAdapter::get_devices() +{ + std::vector<std::unique_ptr<BluetoothDevice>> vector; + BluetoothManager *manager = BluetoothManager::get_bluetooth_manager(); + GList *l, *objects = g_dbus_object_manager_get_objects(gdbus_manager); + + for (l = objects; l != NULL; l = l->next) { + Object *object = OBJECT(l->data); + + auto p = BluetoothDevice::make(object, + BluetoothType::DEVICE, NULL, NULL, this); + if (p != nullptr) + vector.push_back(std::move(p)); + } + + return vector; +} + +/* D-Bus method calls: */ +bool BluetoothAdapter::start_discovery () +{ + GError *error = NULL; + bool result = adapter1_call_start_discovery_sync( + object, + NULL, + &error + ); + if (error) + g_printerr("Error: %s\n", error->message); + return result; +} + +bool BluetoothAdapter::stop_discovery () +{ + GError *error = NULL; + bool result = adapter1_call_stop_discovery_sync( + object, + NULL, + &error + ); + if (error) + g_printerr("Error: %s\n", error->message); + return result; +} + +bool BluetoothAdapter::remove_device ( + const std::string &arg_device) +{ + GError *error = NULL; + bool result = adapter1_call_remove_device_sync( + object, + arg_device.c_str(), + NULL, + &error + ); + if (error) + g_printerr("Error: %s\n", error->message); + return result; +} + + + +/* D-Bus property accessors: */ +std::string BluetoothAdapter::get_address () +{ + return std::string(adapter1_get_address (object)); +} + +std::string BluetoothAdapter::get_name () +{ + return std::string(adapter1_get_name (object)); +} + +std::string BluetoothAdapter::get_alias () +{ + return std::string(adapter1_get_alias (object)); +} + +void BluetoothAdapter::set_alias (const std::string &value) +{ + adapter1_set_alias (object, value.c_str()); +} + +unsigned int BluetoothAdapter::get_class () +{ + return adapter1_get_class (object); +} + +bool BluetoothAdapter::get_powered () +{ + return adapter1_get_powered (object); +} + +void BluetoothAdapter::set_powered (bool value) +{ + adapter1_set_powered (object, value); +} + +bool BluetoothAdapter::get_discoverable () +{ + return adapter1_get_discoverable (object); +} + +void BluetoothAdapter::set_discoverable (bool value) +{ + adapter1_set_discoverable (object, value); +} + +unsigned int BluetoothAdapter::get_discoverable_timeout () +{ + return adapter1_get_discoverable_timeout (object); +} + +void BluetoothAdapter::set_discoverable_timeout (unsigned int value) +{ + adapter1_set_discoverable_timeout (object, value); +} + +bool BluetoothAdapter::get_pairable () +{ + return adapter1_get_pairable (object); +} + +void BluetoothAdapter::set_pairable (bool value) +{ + adapter1_set_pairable (object, value); +} + +unsigned int BluetoothAdapter::get_pairable_timeout () +{ + return adapter1_get_pairable_timeout (object); +} + +void BluetoothAdapter::set_pairable_timeout (unsigned int value) +{ + adapter1_set_pairable_timeout (object, value); +} + +bool BluetoothAdapter::get_discovering () +{ + return adapter1_get_discovering (object); +} + +std::vector<std::string> BluetoothAdapter::get_uuids () +{ + const char * const *uuids_c = adapter1_get_uuids (object); + std::vector<std::string> uuids; + for (int i = 0; uuids_c[i] != NULL ;i++) + uuids.push_back(std::string(uuids_c[i])); + return uuids; +} + +std::string BluetoothAdapter::get_modalias () +{ + return std::string(adapter1_get_modalias (object)); +} diff --git a/src/BluetoothDevice.cpp b/src/BluetoothDevice.cpp new file mode 100644 index 00000000..089a9309 --- /dev/null +++ b/src/BluetoothDevice.cpp @@ -0,0 +1,313 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "generated-code.h" +#include "tinyb_utils.hpp" +#include "BluetoothDevice.hpp" +#include "BluetoothGattService.hpp" +#include "BluetoothManager.hpp" + +using namespace tinyb; + +std::string BluetoothDevice::get_class_name() const +{ + return std::string("BluetoothDevice"); +} + +std::string BluetoothDevice::get_java_class() const +{ + return std::string(JAVA_PACKAGE "/BluetoothDevice"); +} + +std::string BluetoothDevice::get_object_path() const +{ + return std::string(g_dbus_proxy_get_object_path(G_DBUS_PROXY(object))); +} + +BluetoothType BluetoothDevice::get_bluetooth_type() const +{ + return BluetoothType::DEVICE; +} + +BluetoothDevice::BluetoothDevice(Device1 *object) +{ + this->object = object; + g_object_ref(object); +} + +BluetoothDevice::BluetoothDevice(const BluetoothDevice &object) +{ + BluetoothDevice(object.object); +} + +BluetoothDevice::~BluetoothDevice() +{ + g_object_unref(object); +} + +std::unique_ptr<BluetoothDevice> BluetoothDevice::make(Object *object, + BluetoothType type, std::string *name, std::string *identifier, + BluetoothObject *parent) +{ + Device1 *device; + if((type == BluetoothType::NONE || type == BluetoothType::DEVICE) && + (device = object_get_device1(object)) != NULL) { + + std::unique_ptr<BluetoothDevice> p(new BluetoothDevice(device)); + + if ((name == nullptr || *name == p->get_name()) && + (identifier == nullptr || *identifier == p->get_address()) && + (parent == nullptr || *parent == p->get_adapter())) + return p; + } + + return std::unique_ptr<BluetoothDevice>(); +} + +BluetoothDevice *BluetoothDevice::clone() const +{ + return new BluetoothDevice(object); +} + +std::vector<std::unique_ptr<BluetoothGattService>> BluetoothDevice::get_services() +{ + std::vector<std::unique_ptr<BluetoothGattService>> vector; + BluetoothManager *manager = BluetoothManager::get_bluetooth_manager(); + GList *l, *objects = g_dbus_object_manager_get_objects(gdbus_manager); + + for (l = objects; l != NULL; l = l->next) { + Object *object = OBJECT(l->data); + + auto p = BluetoothGattService::make(object, + BluetoothType::GATT_SERVICE, NULL, NULL, this); + if (p != nullptr) + vector.push_back(std::move(p)); + } + + return vector; +} + +/* D-Bus method calls: */ +bool BluetoothDevice::disconnect () +{ + GError *error = NULL; + bool result; + result = device1_call_disconnect_sync( + object, + NULL, + &error + ); + if (error) + g_printerr("Error: %s\n", error->message); + return result; +} + +bool BluetoothDevice::connect () +{ + GError *error = NULL; + bool result; + result = device1_call_connect_sync( + object, + NULL, + &error + ); + if (error) + g_printerr("Error: %s\n", error->message); + return result; +} + +bool BluetoothDevice::connect_profile ( + const std::string &arg_UUID) +{ + GError *error = NULL; + bool result; + result = device1_call_connect_profile_sync( + object, + arg_UUID.c_str(), + NULL, + &error + ); + if (error) + g_printerr("Error: %s\n", error->message); + return result; +} + +bool BluetoothDevice::disconnect_profile ( + const std::string &arg_UUID) +{ + GError *error = NULL; + bool result; + result = device1_call_disconnect_profile_sync( + object, + arg_UUID.c_str(), + NULL, + &error + ); + if (error) + g_printerr("Error: %s\n", error->message); + return result; +} + +bool BluetoothDevice::pair () +{ + GError *error = NULL; + bool result; + result = device1_call_pair_sync( + object, + NULL, + &error + ); + if (error) + g_printerr("Error: %s\n", error->message); + return result; +} + +bool BluetoothDevice::cancel_pairing () +{ + GError *error = NULL; + bool result; + result = device1_call_cancel_pairing_sync( + object, + NULL, + &error + ); + if (error) + g_printerr("Error: %s\n", error->message); + return result; +} + + + +/* D-Bus property accessors: */ +std::string BluetoothDevice::get_address () +{ + return std::string(device1_get_address (object)); +} + +std::string BluetoothDevice::get_name () +{ + return std::string(device1_get_name (object)); +} + +std::string BluetoothDevice::get_alias () +{ + return device1_get_alias (object); +} + +void BluetoothDevice::set_alias (const std::string &value) +{ + device1_set_alias (object, value.c_str()); +} + +unsigned int BluetoothDevice::get_class () +{ + return device1_get_class (object); +} + +uint16_t BluetoothDevice::get_appearance () +{ + return device1_get_appearance (object); +} + +std::string BluetoothDevice::get_icon () +{ + return std::string(device1_get_icon (object)); +} + +bool BluetoothDevice::get_paired () +{ + return device1_get_paired (object); +} + +bool BluetoothDevice::get_trusted () +{ + return device1_get_trusted (object); +} + +void BluetoothDevice::set_trusted (bool value) +{ + device1_set_trusted (object, value); +} + +bool BluetoothDevice::get_blocked () +{ + return device1_get_blocked (object); +} + +void BluetoothDevice::set_blocked (bool value) +{ + device1_set_blocked (object, value); +} + +bool BluetoothDevice::get_legacy_pairing () +{ + return device1_get_legacy_pairing (object); +} + +int16_t BluetoothDevice::get_rssi () +{ + return device1_get_rssi (object); +} + +bool BluetoothDevice::get_connected () +{ + return device1_get_connected (object); +} + +std::vector<std::string> BluetoothDevice::get_uuids () +{ + + const char * const *uuids_c = device1_get_uuids (object); + std::vector<std::string> uuids; + for (int i = 0; uuids_c[i] != NULL ;i++) + uuids.push_back(std::string(uuids_c[i])); + return uuids; +} + +std::string BluetoothDevice::get_modalias () +{ + return std::string(device1_get_modalias (object)); +} + +BluetoothAdapter BluetoothDevice::get_adapter () +{ + GError *error = NULL; + + Adapter1 *adapter = adapter1_proxy_new_for_bus_sync( + G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + "org.bluez", + device1_get_adapter (object), + NULL, + &error); + + if (adapter == NULL) { + g_printerr("Error instantiating adapter: %s", + error->message); + g_error_free(error); + throw std::exception(); + } + + return BluetoothAdapter(adapter); +} diff --git a/src/BluetoothEvent.cpp b/src/BluetoothEvent.cpp new file mode 100644 index 00000000..4a92880f --- /dev/null +++ b/src/BluetoothEvent.cpp @@ -0,0 +1,29 @@ +#include "BluetoothEvent.hpp" + +void BluetoothEvent::generic_callback(BluetoothObject &object, void *data) +{ +} + +BluetoothEvent::BluetoothEvent(BluetoothType type, std::string *name, + std::string *identifier, BluetoothObject *parent, + BluetoothCallback cb, void *data) +{ + this->type = type; + if (name != NULL) + this->name = new std::string(*name); + else + this->name = NULL; + + if (identifier != NULL) + this->identifier = new std::string(*identifier); + else + this->identifier = NULL; + + if (parent != NULL) + this->parent = parent->clone(); + else + this->parent = NULL; + + this->cb = cb; + this->data = data; +} diff --git a/src/BluetoothGattCharacteristic.cpp b/src/BluetoothGattCharacteristic.cpp new file mode 100644 index 00000000..2af7c822 --- /dev/null +++ b/src/BluetoothGattCharacteristic.cpp @@ -0,0 +1,239 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "generated-code.h" +#include "tinyb_utils.hpp" +#include "BluetoothGattCharacteristic.hpp" +#include "BluetoothGattService.hpp" +#include "BluetoothGattDescriptor.hpp" + +using namespace tinyb; + +std::string BluetoothGattCharacteristic::get_class_name() const +{ + return std::string("BluetoothGattCharacteristic"); +} + +std::string BluetoothGattCharacteristic::get_java_class() const +{ + return std::string(JAVA_PACKAGE "/BluetoothGattCharacteristic"); +} + +std::string BluetoothGattCharacteristic::get_object_path() const +{ + return std::string(g_dbus_proxy_get_object_path(G_DBUS_PROXY(object))); +} + +BluetoothType BluetoothGattCharacteristic::get_bluetooth_type() const +{ + return BluetoothType::GATT_CHARACTERISTIC; +} + +BluetoothGattCharacteristic::BluetoothGattCharacteristic(GattCharacteristic1 *object) +{ + this->object = object; + g_object_ref(object); +} + +BluetoothGattCharacteristic::BluetoothGattCharacteristic(const BluetoothGattCharacteristic &object) +{ + BluetoothGattCharacteristic(object.object); +} + +BluetoothGattCharacteristic::~BluetoothGattCharacteristic() +{ + g_object_unref(object); +} + +BluetoothGattCharacteristic *BluetoothGattCharacteristic::clone() const +{ + return new BluetoothGattCharacteristic(object); +} + +std::unique_ptr<BluetoothGattCharacteristic> BluetoothGattCharacteristic::make( + Object *object, BluetoothType type, std::string *name, + std::string *identifier, BluetoothObject *parent) +{ + GattCharacteristic1 *characteristic; + if((type == BluetoothType::NONE || type == BluetoothType::GATT_CHARACTERISTIC) && + (characteristic = object_get_gatt_characteristic1(object)) != NULL) { + + std::unique_ptr<BluetoothGattCharacteristic> p( + new BluetoothGattCharacteristic(characteristic)); + + if ((name == nullptr) && + (identifier == nullptr || *identifier == p->get_uuid()) && + (parent == nullptr || *parent == p->get_service())) + return p; + } + + return std::unique_ptr<BluetoothGattCharacteristic>(); +} + +/* D-Bus method calls: */ +std::vector<unsigned char> BluetoothGattCharacteristic::read_value () +{ + GError *error = NULL; + GBytes *result_gbytes; + gatt_characteristic1_call_read_value_sync( + object, + &result_gbytes, + NULL, + &error + ); + if (error) + g_printerr("Error: %s\n", error->message); + + std::vector<unsigned char> result = from_gbytes_to_vector(result_gbytes); + + /* free the gbytes array */ + g_bytes_unref(result_gbytes); + + return result; +} + +bool BluetoothGattCharacteristic::write_value ( + const std::vector<unsigned char> &arg_value) +{ + GError *error = NULL; + bool result = true; + + GBytes *arg_value_gbytes = from_vector_to_gbytes(arg_value); + + result = gatt_characteristic1_call_write_value_sync( + object, + arg_value_gbytes, + NULL, + &error + ); + if (error) + g_printerr("Error: %s\n", error->message); + + /* freeing the GBytes allocated inside from_vector_to_gbytes function */ + g_bytes_unref(arg_value_gbytes); + + return result; +} + +bool BluetoothGattCharacteristic::start_notify () +{ + GError *error = NULL; + bool result; + result = gatt_characteristic1_call_start_notify_sync( + object, + NULL, + &error + ); + if (error) + g_printerr("Error: %s\n", error->message); + return result; +} + +bool BluetoothGattCharacteristic::stop_notify () +{ + GError *error = NULL; + bool result; + result = gatt_characteristic1_call_stop_notify_sync( + object, + NULL, + &error + ); + if (error) + g_printerr("Error: %s\n", error->message); + return result; +} + + + +/* D-Bus property accessors: */ +std::string BluetoothGattCharacteristic::get_uuid () +{ + return std::string(gatt_characteristic1_get_uuid (object)); +} + +BluetoothGattService BluetoothGattCharacteristic::get_service () +{ + GError *error = NULL; + + GattService1 *service = gatt_service1_proxy_new_for_bus_sync( + G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + "org.bluez", + gatt_characteristic1_get_service (object), + NULL, + &error); + + if (service == NULL) { + g_printerr("Error instantiating: %s", + error->message); + g_error_free(error); + throw std::exception(); + } + + return BluetoothGattService(service); +} + +std::vector<unsigned char> BluetoothGattCharacteristic::get_value () +{ + GBytes *value_gbytes = const_cast<GBytes *>(gatt_characteristic1_get_value (object)); + std::vector<unsigned char> result = from_gbytes_to_vector(value_gbytes); + + g_bytes_unref(value_gbytes); + + return result; +} + +bool BluetoothGattCharacteristic::get_notifying () +{ + return gatt_characteristic1_get_notifying (object); +} + +std::vector<std::string> BluetoothGattCharacteristic::get_flags () +{ + const char * const *flags_c = gatt_characteristic1_get_flags (object); + std::vector<std::string> flags; + for (int i = 0; flags_c[i] != NULL ;i++) + flags.push_back(std::string(flags_c[i])); + return flags; + +} + +std::vector<std::unique_ptr<BluetoothGattDescriptor>> BluetoothGattCharacteristic::get_descriptors () +{ + std::vector<std::unique_ptr<BluetoothGattDescriptor>> vector; + BluetoothManager *manager = BluetoothManager::get_bluetooth_manager(); + GList *l, *objects = g_dbus_object_manager_get_objects(gdbus_manager); + + for (l = objects; l != NULL; l = l->next) { + Object *object = OBJECT(l->data); + + auto p = BluetoothGattDescriptor::make(object, + BluetoothType::GATT_DESCRIPTOR, NULL, NULL, this); + if (p != nullptr) + vector.push_back(std::move(p)); + } + + return vector; +} + diff --git a/src/BluetoothGattDescriptor.cpp b/src/BluetoothGattDescriptor.cpp new file mode 100644 index 00000000..b0edfcba --- /dev/null +++ b/src/BluetoothGattDescriptor.cpp @@ -0,0 +1,178 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "generated-code.h" +#include "tinyb_utils.hpp" +#include "BluetoothGattDescriptor.hpp" +#include "BluetoothGattCharacteristic.hpp" + +using namespace tinyb; + +std::string BluetoothGattDescriptor::get_class_name() const +{ + return std::string("BluetoothGattDescriptor"); +} + +std::string BluetoothGattDescriptor::get_java_class() const +{ + return std::string(JAVA_PACKAGE "/BluetoothGattDescriptor"); +} + +std::string BluetoothGattDescriptor::get_object_path() const +{ + return std::string(g_dbus_proxy_get_object_path(G_DBUS_PROXY(object))); +} + +BluetoothType BluetoothGattDescriptor::get_bluetooth_type() const +{ + return BluetoothType::GATT_DESCRIPTOR; +} + +BluetoothGattDescriptor::BluetoothGattDescriptor(GattDescriptor1 *object) +{ + this->object = object; + g_object_ref(object); +} + +BluetoothGattDescriptor::BluetoothGattDescriptor(const BluetoothGattDescriptor &object) +{ + BluetoothGattDescriptor(object.object); +} + +BluetoothGattDescriptor::~BluetoothGattDescriptor() +{ + g_object_unref(object); +} + +std::unique_ptr<BluetoothGattDescriptor> BluetoothGattDescriptor::make( + Object *object, BluetoothType type, std::string *name, + std::string *identifier, BluetoothObject *parent) +{ + GattDescriptor1 *descriptor; + if((type == BluetoothType::NONE || type == BluetoothType::GATT_DESCRIPTOR) && + (descriptor = object_get_gatt_descriptor1(object)) != NULL) { + + std::unique_ptr<BluetoothGattDescriptor> p( + new BluetoothGattDescriptor(descriptor)); + + if ((name == nullptr) && + (identifier == nullptr || *identifier == p->get_uuid()) && + (parent == nullptr || *parent == p->get_characteristic())) + return p; + } + + return std::unique_ptr<BluetoothGattDescriptor>(); +} + + + +BluetoothGattDescriptor *BluetoothGattDescriptor::clone() const +{ + return new BluetoothGattDescriptor(object); +} + +/* D-Bus method calls: */ +std::vector<unsigned char> BluetoothGattDescriptor::read_value () +{ + GError *error = NULL; + GBytes *result_gbytes; + gatt_descriptor1_call_read_value_sync( + object, + &result_gbytes, + NULL, + &error + ); + if (error) + g_printerr("Error: %s\n", error->message); + + std::vector<unsigned char> result = from_gbytes_to_vector(result_gbytes); + + /* unref the gbytes pointer */ + g_bytes_unref(result_gbytes); + + return result; +} + +bool BluetoothGattDescriptor::write_value ( + const std::vector<unsigned char> &arg_value) +{ + GError *error = NULL; + bool result; + + GBytes *arg_value_gbytes = from_vector_to_gbytes(arg_value); + + result = gatt_descriptor1_call_write_value_sync( + object, + arg_value_gbytes, + NULL, + &error + ); + if (error) + g_printerr("Error: %s\n", error->message); + + /* unref the GBytes allocated inside from_vector_to_gbytes function */ + g_bytes_unref(arg_value_gbytes); + + return result; +} + + + +/* D-Bus property accessors: */ +std::string BluetoothGattDescriptor::get_uuid () +{ + return std::string(gatt_descriptor1_get_uuid (object)); +} + +BluetoothGattCharacteristic BluetoothGattDescriptor::get_characteristic () +{ + GError *error = NULL; + + GattCharacteristic1* characteristic = gatt_characteristic1_proxy_new_for_bus_sync( + G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + "org.bluez", + gatt_descriptor1_get_characteristic (object), + NULL, + &error); + + if (characteristic == NULL) { + g_printerr("Error instantiating: %s", + error->message); + g_error_free(error); + throw std::exception(); + } + + return BluetoothGattCharacteristic(characteristic); +} + +std::vector<unsigned char> BluetoothGattDescriptor::get_value () +{ + GBytes *value_gbytes = const_cast<GBytes *>(gatt_descriptor1_get_value (object)); + std::vector<unsigned char> result = from_gbytes_to_vector(value_gbytes); + + g_bytes_unref(value_gbytes); + + return result; +} diff --git a/src/BluetoothGattService.cpp b/src/BluetoothGattService.cpp new file mode 100644 index 00000000..cd6b83a1 --- /dev/null +++ b/src/BluetoothGattService.cpp @@ -0,0 +1,144 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "generated-code.h" +#include "tinyb_utils.hpp" +#include "BluetoothGattService.hpp" +#include "BluetoothGattCharacteristic.hpp" +#include "BluetoothDevice.hpp" + +using namespace tinyb; + +std::string BluetoothGattService::get_class_name() const +{ + return std::string("BluetoothGattService"); +} + +std::string BluetoothGattService::get_java_class() const +{ + return std::string(JAVA_PACKAGE "/BluetoothGattService"); +} + +std::string BluetoothGattService::get_object_path() const +{ + return std::string(g_dbus_proxy_get_object_path(G_DBUS_PROXY(object))); +} + +BluetoothType BluetoothGattService::get_bluetooth_type() const +{ + return BluetoothType::GATT_SERVICE; +} + +BluetoothGattService::BluetoothGattService(GattService1 *object) +{ + this->object = object; + g_object_ref(object); +} + +BluetoothGattService::BluetoothGattService(const BluetoothGattService &object) +{ + BluetoothGattService(object.object); +} + +BluetoothGattService::~BluetoothGattService() +{ + g_object_unref(object); +} + +std::unique_ptr<BluetoothGattService> BluetoothGattService::make( + Object *object, BluetoothType type, std::string *name, + std::string *identifier, BluetoothObject *parent) +{ + GattService1 *service; + if((type == BluetoothType::NONE || type == BluetoothType::GATT_SERVICE) && + (service = object_get_gatt_service1(object)) != NULL) { + + std::unique_ptr<BluetoothGattService> p( + new BluetoothGattService(service)); + + if ((name == nullptr) && + (identifier == nullptr || *identifier == p->get_uuid()) && + (parent == nullptr || *parent == p->get_device())) + return p; + } + + return std::unique_ptr<BluetoothGattService>(); +} + +BluetoothGattService *BluetoothGattService::clone() const +{ + return new BluetoothGattService(object); +} + +/* D-Bus property accessors: */ +std::string BluetoothGattService::get_uuid () +{ + return std::string(gatt_service1_get_uuid (object)); +} + +BluetoothDevice BluetoothGattService::get_device () +{ + GError *error = NULL; + + Device1 *device = device1_proxy_new_for_bus_sync( + G_BUS_TYPE_SYSTEM, + G_DBUS_PROXY_FLAGS_NONE, + "org.bluez", + gatt_service1_get_device (object), + NULL, + &error); + + if (device == NULL) { + g_printerr("Error instantiating: %s", + error->message); + g_error_free(error); + throw std::exception(); + } + + return BluetoothDevice(device); +} + +bool BluetoothGattService::get_primary () +{ + return gatt_service1_get_primary (object); +} + +std::vector<std::unique_ptr<BluetoothGattCharacteristic>> BluetoothGattService::get_characteristics () +{ + std::vector<std::unique_ptr<BluetoothGattCharacteristic>> vector; + BluetoothManager *manager = BluetoothManager::get_bluetooth_manager(); + GList *l, *objects = g_dbus_object_manager_get_objects(gdbus_manager); + + for (l = objects; l != NULL; l = l->next) { + Object *object = OBJECT(l->data); + + auto p = BluetoothGattCharacteristic::make(object, + BluetoothType::GATT_CHARACTERISTIC, NULL, NULL, this); + if (p != nullptr) + vector.push_back(std::move(p)); + } + + return vector; +} + diff --git a/src/BluetoothManager.cpp b/src/BluetoothManager.cpp new file mode 100644 index 00000000..b3a97a85 --- /dev/null +++ b/src/BluetoothManager.cpp @@ -0,0 +1,309 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "generated-code.h" +#include "BluetoothManager.hpp" +#include "BluetoothAdapter.hpp" +#include "BluetoothDevice.hpp" +#include "BluetoothGattService.hpp" +#include "BluetoothGattCharacteristic.hpp" +#include "BluetoothGattDescriptor.hpp" +#include "BluetoothEvent.hpp" + +#include <pthread.h> +#include <cassert> +#include <iostream> + +using namespace tinyb; + +class tinyb::BluetoothEventManager { +public: + static void on_interface_added (GDBusObject *object, + GDBusInterface *interface, gpointer user_data) { + GDBusInterfaceInfo *info = g_dbus_interface_get_info(interface); + BluetoothType type = BluetoothType::NONE; + std::string *name = NULL; + std::string *identifier = NULL; + BluetoothObject *bobj = NULL; + + /* Unknown interface, ignore */ + if (info == NULL) + return; + + if(IS_GATT_SERVICE1_PROXY(interface)) { + type = BluetoothType::GATT_SERVICE; + bobj = new BluetoothGattService(GATT_SERVICE1(object)); + g_print("Object %s - Interface added: %s\n", g_dbus_object_get_object_path(object), info->name); + } + else if(IS_GATT_CHARACTERISTIC1_PROXY(interface)) { + type = BluetoothType::GATT_CHARACTERISTIC; + bobj = new BluetoothGattCharacteristic(GATT_CHARACTERISTIC1(object)); + g_print("Object %s - Interface added: %s\n", g_dbus_object_get_object_path(object), info->name); + } + else if(IS_GATT_DESCRIPTOR1_PROXY(interface)) { + type = BluetoothType::GATT_DESCRIPTOR; + bobj = new BluetoothGattDescriptor(GATT_DESCRIPTOR1(object)); + g_print("Object %s - Interface added: %s\n", g_dbus_object_get_object_path(object), info->name); + } + else if(IS_DEVICE1_PROXY(interface)) { + type = BluetoothType::DEVICE; + bobj = new BluetoothDevice(DEVICE1(object)); + g_print("Object %s - Interface added: %s\n", g_dbus_object_get_object_path(object), info->name); + } + else if(IS_ADAPTER1_PROXY(interface)) { + type = BluetoothType::ADAPTER; + bobj = new BluetoothAdapter(ADAPTER1(object)); + g_print("Object %s - Interface added: %s\n", g_dbus_object_get_object_path(object), info->name); + } + + if (type == BluetoothType::NONE) /* It does not match anything */ + return; + + //BluetoothEvent event = BluetoothEvent(type, ); + } + + static void on_object_added (GDBusObjectManager *manager, + GDBusObject *object, gpointer user_data) { + GList *l, *interfaces = g_dbus_object_get_interfaces(object); + + for(l = interfaces; l != NULL; l = l->next) + on_interface_added(object, (GDBusInterface *)l->data, user_data); + + g_list_free_full(interfaces, g_object_unref); + } +}; + +GDBusObjectManager *gdbus_manager = NULL; + +std::string BluetoothManager::get_class_name() const +{ + return std::string("BluetoothManager"); +} + +std::string BluetoothManager::get_java_class() const +{ + return std::string(JAVA_PACKAGE "/BluetoothManager"); +} + +std::string BluetoothManager::get_object_path() const +{ + return std::string("/"); +} + +BluetoothType BluetoothManager::get_bluetooth_type() const +{ + return BluetoothType::NONE; +} + +std::unique_ptr<BluetoothObject> BluetoothManager::get_object( + BluetoothType type, std::string *name, std::string *identifier, + BluetoothObject *parent) +{ + auto list = get_objects(type, name, identifier, parent); + if (list.empty()) + return std::unique_ptr<BluetoothObject>(); + return std::move(list.front()); +} + +std::vector<std::unique_ptr<BluetoothObject>> BluetoothManager::get_objects( + BluetoothType type, std::string *name, std::string *identifier, + BluetoothObject *parent) +{ + std::vector<std::unique_ptr<BluetoothObject>> vector; + GList *l, *objects = g_dbus_object_manager_get_objects(gdbus_manager); + + for (l = objects; l != NULL; l = l->next) { + Object *object = OBJECT(l->data); + + auto p_service = BluetoothGattService::make(object, type, name, identifier, parent); + if (p_service != nullptr) + vector.push_back(std::move(p_service)); + + auto p_characteristic = BluetoothGattCharacteristic::make(object, type, name, identifier, parent); + if (p_characteristic != nullptr) + vector.push_back(std::move(p_characteristic)); + + auto p_descriptor = BluetoothGattDescriptor::make(object, type, name, identifier, parent); + if (p_descriptor != nullptr) + vector.push_back(std::move(p_descriptor)); + + auto p_device = BluetoothDevice::make(object, type, name, identifier, parent); + if (p_device != nullptr) + vector.push_back(std::move(p_device)); + + auto p_adapter = BluetoothAdapter::make(object, type, name, identifier, parent); + if (p_adapter != nullptr) + vector.push_back(std::move(p_adapter)); + } + return vector; +} + +static void *init_manager_thread(void *data) +{ + GMainLoop *loop; + GDBusObjectManager *gdbus_manager = (GDBusObjectManager *) data; + + loop = g_main_loop_new(NULL, FALSE); + + /* Not completely implemented + g_signal_connect(gdbus_manager, + "interface-added", + G_CALLBACK(BluetoothEventManager::on_interface_added), + NULL); + + g_signal_connect(gdbus_manager, + "object-added", + G_CALLBACK(BluetoothEventManager::on_object_added), + NULL); + */ + + g_main_loop_run(loop); + return NULL; +} + +BluetoothManager::BluetoothManager() : event_list() +{ + GError *error = NULL; + GList *objects, *l; + + + gdbus_manager = object_manager_client_new_for_bus_sync( + G_BUS_TYPE_SYSTEM, + G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, + "org.bluez", + "/", + NULL, /* GCancellable */ + &error); + + if (gdbus_manager == NULL) { + g_printerr("Error getting object manager client: %s", + error->message); + g_error_free(error); + } + + g_thread_new(NULL, init_manager_thread, gdbus_manager); + + objects = g_dbus_object_manager_get_objects(gdbus_manager); + + for (l = objects; l != NULL; l = l->next) { + Object *object = (Object *) l->data; + Adapter1 *adapter = object_get_adapter1(object); + if (adapter != NULL) { + default_adapter = new BluetoothAdapter(adapter); + break; + } + } + g_list_free_full(objects, g_object_unref); +} + +BluetoothManager *BluetoothManager::get_bluetooth_manager() +{ + static BluetoothManager bluetooth_manager; + return &bluetooth_manager; +} + +BluetoothManager::BluetoothManager(const BluetoothManager &) +{ + /* Should not be called */ +} + +BluetoothManager::~BluetoothManager() +{ + /* Should not be called */ +} + +std::vector<std::unique_ptr<BluetoothAdapter>> BluetoothManager::get_adapters() +{ + std::vector<std::unique_ptr<BluetoothAdapter>> vector; + GList *l, *objects = g_dbus_object_manager_get_objects(gdbus_manager); + + for (l = objects; l != NULL; l = l->next) { + Object *object = OBJECT(l->data); + + auto p = BluetoothAdapter::make(object); + if (p != nullptr) + vector.push_back(std::move(p)); + } + + return vector; +} + +std::vector<std::unique_ptr<BluetoothDevice>> BluetoothManager::get_devices() +{ + std::vector<std::unique_ptr<BluetoothDevice>> vector; + GList *l, *objects = g_dbus_object_manager_get_objects(gdbus_manager); + + for (l = objects; l != NULL; l = l->next) { + Object *object = OBJECT(l->data); + + auto p = BluetoothDevice::make(object); + if (p != nullptr) + vector.push_back(std::move(p)); + } + + return vector; +} + +std::vector<std::unique_ptr<BluetoothGattService>> BluetoothManager::get_services() +{ + std::vector<std::unique_ptr<BluetoothGattService>> vector; + GList *l, *objects = g_dbus_object_manager_get_objects(gdbus_manager); + + for (l = objects; l != NULL; l = l->next) { + Object *object = OBJECT(l->data); + + auto p = BluetoothGattService::make(object); + if (p != nullptr) + vector.push_back(std::move(p)); + } + + return vector; +} + +bool BluetoothManager::set_default_adapter(BluetoothAdapter *adapter) +{ + if (adapter != NULL) { + BluetoothAdapter *prev_adapter = default_adapter; + default_adapter = new BluetoothAdapter(*adapter); + delete prev_adapter; + return true; + } + return false; +} + +bool BluetoothManager::start_discovery() +{ + if (default_adapter != NULL) + return default_adapter->start_discovery(); + else + return false; +} + +bool BluetoothManager::stop_discovery() +{ + if (default_adapter != NULL) + return default_adapter->stop_discovery(); + else + return false; +} diff --git a/src/BluetoothObject.cpp b/src/BluetoothObject.cpp new file mode 100644 index 00000000..68960184 --- /dev/null +++ b/src/BluetoothObject.cpp @@ -0,0 +1,59 @@ +/* + * Author: Petre Eftime <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "BluetoothObject.hpp" +#include <glib.h> + +using namespace tinyb; + +std::string BluetoothObject::get_java_class() const +{ + return std::string(JAVA_PACKAGE "/BluetoothObject"); +} + +std::string BluetoothObject::get_class_name() const +{ + return std::string("BluetoothObject"); +} + +std::string BluetoothObject::get_object_path() const +{ + return std::string(); +} + +BluetoothType BluetoothObject::get_bluetooth_type() const +{ + return BluetoothType::NONE; +} + +BluetoothObject *BluetoothObject::clone() const +{ + return NULL; +} + +bool BluetoothObject::operator==(const BluetoothObject &other) const +{ + return (this->get_bluetooth_type() == other.get_bluetooth_type()) + && (this->get_object_path() == other.get_object_path()); +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..3a016b30 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,69 @@ +set (tinyb_LIB_INCLUDE_DIRS + ${PROJECT_SOURCE_DIR}/api + ${PROJECT_SOURCE_DIR}/api/tinyb + ${PROJECT_SOURCE_DIR}/include +) + +include_directories( + ${tinyb_LIB_INCLUDE_DIRS} + ${GLIB2_INCLUDE_DIRS} + ${GIO_INCLUDE_DIRS} + ${GIO-UNIX_INCLUDE_DIRS} +) + +set (tinyb_LIB_SRCS + ${PROJECT_SOURCE_DIR}/src/BluetoothObject.cpp + ${PROJECT_SOURCE_DIR}/src/BluetoothEvent.cpp + ${PROJECT_SOURCE_DIR}/src/BluetoothManager.cpp + ${PROJECT_SOURCE_DIR}/src/BluetoothAdapter.cpp + ${PROJECT_SOURCE_DIR}/src/BluetoothDevice.cpp + ${PROJECT_SOURCE_DIR}/src/BluetoothGattService.cpp + ${PROJECT_SOURCE_DIR}/src/BluetoothGattCharacteristic.cpp + ${PROJECT_SOURCE_DIR}/src/BluetoothGattDescriptor.cpp + ${PROJECT_SOURCE_DIR}/src/tinyb_utils.cpp + ${PROJECT_SOURCE_DIR}/src/generated-code.c +# autogenerated version file + ${CMAKE_CURRENT_BINARY_DIR}/version.c +) + +set (tinyb_LIB_GLOB_HEADERS + ${PROJECT_SOURCE_DIR}/api/tinyb.hpp +) + +add_library (tinyb SHARED ${tinyb_LIB_SRCS}) +target_link_libraries ( + tinyb + ${CMAKE_THREAD_LIBS_INIT} + ${GLIB2_LIBRARIES} + ${GIO_LIBRARIES} +) + +set_target_properties( + tinyb + PROPERTIES + SOVERSION ${tinyb_VERSION_MAJOR} + VERSION ${tinyb_VERSION_STRING} + CXX_STANDARD 11 +) +install (FILES ${tinyb_LIB_GLOB_HEADERS} DESTINATION include/) +install (DIRECTORY ${PROJECT_SOURCE_DIR}/api/tinyb/ DESTINATION include/tinyb) + +macro (tinyb_CREATE_INSTALL_PKGCONFIG generated_file install_location) + configure_file (${generated_file}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY) + install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location}) +endmacro (tinyb_CREATE_INSTALL_PKGCONFIG) +tinyb_create_install_pkgconfig (tinyb.pc lib${LIB_SUFFIX}/pkgconfig) + +install(TARGETS tinyb LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +if (BUILDSWIG) + find_package (SWIG) + if (SWIG_FOUND) + include (${SWIG_USE_FILE}) + set_source_files_properties (tinyb.i PROPERTIES SWIG_FLAGS "-I${CMAKE_BINARY_DIR}/src") + + if (BUILDSWIGJAVA) + add_subdirectory (java) + endif () + endif () +endif () diff --git a/src/generated-code.c b/src/generated-code.c new file mode 100644 index 00000000..15ae94d1 --- /dev/null +++ b/src/generated-code.c @@ -0,0 +1,12119 @@ +/* + * Generated by gdbus-codegen 2.45.4. DO NOT EDIT. + * + * The license of this code is the same as for the source it was derived from. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "generated-code.h" + +#include <string.h> +#ifdef G_OS_UNIX +# include <gio/gunixfdlist.h> +#endif + +typedef struct +{ + GDBusArgInfo parent_struct; + gboolean use_gvariant; +} _ExtendedGDBusArgInfo; + +typedef struct +{ + GDBusMethodInfo parent_struct; + const gchar *signal_name; + gboolean pass_fdlist; +} _ExtendedGDBusMethodInfo; + +typedef struct +{ + GDBusSignalInfo parent_struct; + const gchar *signal_name; +} _ExtendedGDBusSignalInfo; + +typedef struct +{ + GDBusPropertyInfo parent_struct; + const gchar *hyphen_name; + gboolean use_gvariant; +} _ExtendedGDBusPropertyInfo; + +typedef struct +{ + GDBusInterfaceInfo parent_struct; + const gchar *hyphen_name; +} _ExtendedGDBusInterfaceInfo; + +typedef struct +{ + const _ExtendedGDBusPropertyInfo *info; + guint prop_id; + GValue orig_value; /* the value before the change */ +} ChangedProperty; + +static void +_changed_property_free (ChangedProperty *data) +{ + g_value_unset (&data->orig_value); + g_free (data); +} + +static gboolean +_g_strv_equal0 (gchar **a, gchar **b) +{ + gboolean ret = FALSE; + guint n; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + if (g_strv_length (a) != g_strv_length (b)) + goto out; + for (n = 0; a[n] != NULL; n++) + if (g_strcmp0 (a[n], b[n]) != 0) + goto out; + ret = TRUE; +out: + return ret; +} + +static gboolean +_g_variant_equal0 (GVariant *a, GVariant *b) +{ + gboolean ret = FALSE; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + ret = g_variant_equal (a, b); +out: + return ret; +} + +G_GNUC_UNUSED static gboolean +_g_value_equal (const GValue *a, const GValue *b) +{ + gboolean ret = FALSE; + g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b)); + switch (G_VALUE_TYPE (a)) + { + case G_TYPE_BOOLEAN: + ret = (g_value_get_boolean (a) == g_value_get_boolean (b)); + break; + case G_TYPE_UCHAR: + ret = (g_value_get_uchar (a) == g_value_get_uchar (b)); + break; + case G_TYPE_INT: + ret = (g_value_get_int (a) == g_value_get_int (b)); + break; + case G_TYPE_UINT: + ret = (g_value_get_uint (a) == g_value_get_uint (b)); + break; + case G_TYPE_INT64: + ret = (g_value_get_int64 (a) == g_value_get_int64 (b)); + break; + case G_TYPE_UINT64: + ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b)); + break; + case G_TYPE_DOUBLE: + { + /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ + gdouble da = g_value_get_double (a); + gdouble db = g_value_get_double (b); + ret = memcmp (&da, &db, sizeof (gdouble)) == 0; + } + break; + case G_TYPE_STRING: + ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0); + break; + case G_TYPE_VARIANT: + ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b)); + break; + default: + if (G_VALUE_TYPE (a) == G_TYPE_STRV) + ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b)); + else + g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a))); + break; + } + return ret; +} + +/* ------------------------------------------------------------------------ + * Code for interface org.bluez.Adapter1 + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:Adapter1 + * @title: Adapter1 + * @short_description: Generated C code for the org.bluez.Adapter1 D-Bus interface + * + * This section contains code for working with the <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link> D-Bus interface in C. + */ + +/* ---- Introspection data for org.bluez.Adapter1 ---- */ + +static const _ExtendedGDBusMethodInfo _adapter1_method_info_start_discovery = +{ + { + -1, + (gchar *) "StartDiscovery", + NULL, + NULL, + NULL + }, + "handle-start-discovery", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _adapter1_method_info_stop_discovery = +{ + { + -1, + (gchar *) "StopDiscovery", + NULL, + NULL, + NULL + }, + "handle-stop-discovery", + FALSE +}; + +static const _ExtendedGDBusArgInfo _adapter1_method_info_remove_device_IN_ARG_device = +{ + { + -1, + (gchar *) "device", + (gchar *) "o", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _adapter1_method_info_remove_device_IN_ARG_pointers[] = +{ + &_adapter1_method_info_remove_device_IN_ARG_device, + NULL +}; + +static const _ExtendedGDBusMethodInfo _adapter1_method_info_remove_device = +{ + { + -1, + (gchar *) "RemoveDevice", + (GDBusArgInfo **) &_adapter1_method_info_remove_device_IN_ARG_pointers, + NULL, + NULL + }, + "handle-remove-device", + FALSE +}; + +static const _ExtendedGDBusMethodInfo * const _adapter1_method_info_pointers[] = +{ + &_adapter1_method_info_start_discovery, + &_adapter1_method_info_stop_discovery, + &_adapter1_method_info_remove_device, + NULL +}; + +static const _ExtendedGDBusPropertyInfo _adapter1_property_info_address = +{ + { + -1, + (gchar *) "Address", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "address", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _adapter1_property_info_name = +{ + { + -1, + (gchar *) "Name", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "name", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _adapter1_property_info_alias = +{ + { + -1, + (gchar *) "Alias", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "alias", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _adapter1_property_info_class = +{ + { + -1, + (gchar *) "Class", + (gchar *) "u", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "class", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _adapter1_property_info_powered = +{ + { + -1, + (gchar *) "Powered", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "powered", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _adapter1_property_info_discoverable = +{ + { + -1, + (gchar *) "Discoverable", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "discoverable", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _adapter1_property_info_discoverable_timeout = +{ + { + -1, + (gchar *) "DiscoverableTimeout", + (gchar *) "u", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "discoverable-timeout", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _adapter1_property_info_pairable = +{ + { + -1, + (gchar *) "Pairable", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "pairable", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _adapter1_property_info_pairable_timeout = +{ + { + -1, + (gchar *) "PairableTimeout", + (gchar *) "u", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "pairable-timeout", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _adapter1_property_info_discovering = +{ + { + -1, + (gchar *) "Discovering", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "discovering", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _adapter1_property_info_uuids = +{ + { + -1, + (gchar *) "UUIDs", + (gchar *) "as", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "uuids", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _adapter1_property_info_modalias = +{ + { + -1, + (gchar *) "Modalias", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "modalias", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo * const _adapter1_property_info_pointers[] = +{ + &_adapter1_property_info_address, + &_adapter1_property_info_name, + &_adapter1_property_info_alias, + &_adapter1_property_info_class, + &_adapter1_property_info_powered, + &_adapter1_property_info_discoverable, + &_adapter1_property_info_discoverable_timeout, + &_adapter1_property_info_pairable, + &_adapter1_property_info_pairable_timeout, + &_adapter1_property_info_discovering, + &_adapter1_property_info_uuids, + &_adapter1_property_info_modalias, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _adapter1_interface_info = +{ + { + -1, + (gchar *) "org.bluez.Adapter1", + (GDBusMethodInfo **) &_adapter1_method_info_pointers, + NULL, + (GDBusPropertyInfo **) &_adapter1_property_info_pointers, + NULL + }, + "adapter1", +}; + + +/** + * adapter1_interface_info: + * + * Gets a machine-readable description of the <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link> D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +adapter1_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_adapter1_interface_info.parent_struct; +} + +/** + * adapter1_override_properties: + * @klass: The class structure for a #GObject<!-- -->-derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #Adapter1 interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +adapter1_override_properties (GObjectClass *klass, guint property_id_begin) +{ + g_object_class_override_property (klass, property_id_begin++, "address"); + g_object_class_override_property (klass, property_id_begin++, "name"); + g_object_class_override_property (klass, property_id_begin++, "alias"); + g_object_class_override_property (klass, property_id_begin++, "class"); + g_object_class_override_property (klass, property_id_begin++, "powered"); + g_object_class_override_property (klass, property_id_begin++, "discoverable"); + g_object_class_override_property (klass, property_id_begin++, "discoverable-timeout"); + g_object_class_override_property (klass, property_id_begin++, "pairable"); + g_object_class_override_property (klass, property_id_begin++, "pairable-timeout"); + g_object_class_override_property (klass, property_id_begin++, "discovering"); + g_object_class_override_property (klass, property_id_begin++, "uuids"); + g_object_class_override_property (klass, property_id_begin++, "modalias"); + return property_id_begin - 1; +} + + + +/** + * Adapter1: + * + * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link>. + */ + +/** + * Adapter1Iface: + * @parent_iface: The parent interface. + * @handle_remove_device: Handler for the #Adapter1::handle-remove-device signal. + * @handle_start_discovery: Handler for the #Adapter1::handle-start-discovery signal. + * @handle_stop_discovery: Handler for the #Adapter1::handle-stop-discovery signal. + * @get_address: Getter for the #Adapter1:address property. + * @get_alias: Getter for the #Adapter1:alias property. + * @get_class: Getter for the #Adapter1:class property. + * @get_discoverable: Getter for the #Adapter1:discoverable property. + * @get_discoverable_timeout: Getter for the #Adapter1:discoverable-timeout property. + * @get_discovering: Getter for the #Adapter1:discovering property. + * @get_modalias: Getter for the #Adapter1:modalias property. + * @get_name: Getter for the #Adapter1:name property. + * @get_pairable: Getter for the #Adapter1:pairable property. + * @get_pairable_timeout: Getter for the #Adapter1:pairable-timeout property. + * @get_powered: Getter for the #Adapter1:powered property. + * @get_uuids: Getter for the #Adapter1:uuids property. + * + * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link>. + */ + +typedef Adapter1Iface Adapter1Interface; +G_DEFINE_INTERFACE (Adapter1, adapter1, G_TYPE_OBJECT); + +static void +adapter1_default_init (Adapter1Iface *iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * Adapter1::handle-start-discovery: + * @object: A #Adapter1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Adapter1.StartDiscovery">StartDiscovery()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call adapter1_complete_start_discovery() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-start-discovery", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (Adapter1Iface, handle_start_discovery), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * Adapter1::handle-stop-discovery: + * @object: A #Adapter1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Adapter1.StopDiscovery">StopDiscovery()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call adapter1_complete_stop_discovery() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-stop-discovery", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (Adapter1Iface, handle_stop_discovery), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * Adapter1::handle-remove-device: + * @object: A #Adapter1. + * @invocation: A #GDBusMethodInvocation. + * @arg_device: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Adapter1.RemoveDevice">RemoveDevice()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call adapter1_complete_remove_device() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-remove-device", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (Adapter1Iface, handle_remove_device), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /* GObject properties for D-Bus properties: */ + /** + * Adapter1:address: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Address">"Address"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("address", "Address", "Address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Adapter1:name: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Name">"Name"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("name", "Name", "Name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Adapter1:alias: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Alias">"Alias"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("alias", "Alias", "Alias", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Adapter1:class: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Class">"Class"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_uint ("class", "Class", "Class", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Adapter1:powered: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Powered">"Powered"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("powered", "Powered", "Powered", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Adapter1:discoverable: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Discoverable">"Discoverable"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("discoverable", "Discoverable", "Discoverable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Adapter1:discoverable-timeout: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.DiscoverableTimeout">"DiscoverableTimeout"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_uint ("discoverable-timeout", "DiscoverableTimeout", "DiscoverableTimeout", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Adapter1:pairable: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Pairable">"Pairable"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("pairable", "Pairable", "Pairable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Adapter1:pairable-timeout: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.PairableTimeout">"PairableTimeout"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_uint ("pairable-timeout", "PairableTimeout", "PairableTimeout", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Adapter1:discovering: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Discovering">"Discovering"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("discovering", "Discovering", "Discovering", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Adapter1:uuids: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.UUIDs">"UUIDs"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boxed ("uuids", "UUIDs", "UUIDs", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Adapter1:modalias: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Adapter1.Modalias">"Modalias"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("modalias", "Modalias", "Modalias", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +/** + * adapter1_get_address: (skip) + * @object: A #Adapter1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Address">"Address"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use adapter1_dup_address() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +adapter1_get_address (Adapter1 *object) +{ + return ADAPTER1_GET_IFACE (object)->get_address (object); +} + +/** + * adapter1_dup_address: (skip) + * @object: A #Adapter1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-Adapter1.Address">"Address"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +adapter1_dup_address (Adapter1 *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "address", &value, NULL); + return value; +} + +/** + * adapter1_set_address: (skip) + * @object: A #Adapter1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Address">"Address"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +adapter1_set_address (Adapter1 *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "address", value, NULL); +} + +/** + * adapter1_get_name: (skip) + * @object: A #Adapter1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Name">"Name"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use adapter1_dup_name() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +adapter1_get_name (Adapter1 *object) +{ + return ADAPTER1_GET_IFACE (object)->get_name (object); +} + +/** + * adapter1_dup_name: (skip) + * @object: A #Adapter1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-Adapter1.Name">"Name"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +adapter1_dup_name (Adapter1 *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "name", &value, NULL); + return value; +} + +/** + * adapter1_set_name: (skip) + * @object: A #Adapter1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Name">"Name"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +adapter1_set_name (Adapter1 *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "name", value, NULL); +} + +/** + * adapter1_get_alias: (skip) + * @object: A #Adapter1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Alias">"Alias"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use adapter1_dup_alias() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +adapter1_get_alias (Adapter1 *object) +{ + return ADAPTER1_GET_IFACE (object)->get_alias (object); +} + +/** + * adapter1_dup_alias: (skip) + * @object: A #Adapter1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-Adapter1.Alias">"Alias"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +adapter1_dup_alias (Adapter1 *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "alias", &value, NULL); + return value; +} + +/** + * adapter1_set_alias: (skip) + * @object: A #Adapter1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Alias">"Alias"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +adapter1_set_alias (Adapter1 *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "alias", value, NULL); +} + +/** + * adapter1_get_class: (skip) + * @object: A #Adapter1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Class">"Class"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guint +adapter1_get_class (Adapter1 *object) +{ + return ADAPTER1_GET_IFACE (object)->get_class (object); +} + +/** + * adapter1_set_class: (skip) + * @object: A #Adapter1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Class">"Class"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +adapter1_set_class (Adapter1 *object, guint value) +{ + g_object_set (G_OBJECT (object), "class", value, NULL); +} + +/** + * adapter1_get_powered: (skip) + * @object: A #Adapter1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Powered">"Powered"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +adapter1_get_powered (Adapter1 *object) +{ + return ADAPTER1_GET_IFACE (object)->get_powered (object); +} + +/** + * adapter1_set_powered: (skip) + * @object: A #Adapter1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Powered">"Powered"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +adapter1_set_powered (Adapter1 *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "powered", value, NULL); +} + +/** + * adapter1_get_discoverable: (skip) + * @object: A #Adapter1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Discoverable">"Discoverable"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +adapter1_get_discoverable (Adapter1 *object) +{ + return ADAPTER1_GET_IFACE (object)->get_discoverable (object); +} + +/** + * adapter1_set_discoverable: (skip) + * @object: A #Adapter1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Discoverable">"Discoverable"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +adapter1_set_discoverable (Adapter1 *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "discoverable", value, NULL); +} + +/** + * adapter1_get_discoverable_timeout: (skip) + * @object: A #Adapter1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.DiscoverableTimeout">"DiscoverableTimeout"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guint +adapter1_get_discoverable_timeout (Adapter1 *object) +{ + return ADAPTER1_GET_IFACE (object)->get_discoverable_timeout (object); +} + +/** + * adapter1_set_discoverable_timeout: (skip) + * @object: A #Adapter1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.DiscoverableTimeout">"DiscoverableTimeout"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +adapter1_set_discoverable_timeout (Adapter1 *object, guint value) +{ + g_object_set (G_OBJECT (object), "discoverable-timeout", value, NULL); +} + +/** + * adapter1_get_pairable: (skip) + * @object: A #Adapter1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Pairable">"Pairable"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +adapter1_get_pairable (Adapter1 *object) +{ + return ADAPTER1_GET_IFACE (object)->get_pairable (object); +} + +/** + * adapter1_set_pairable: (skip) + * @object: A #Adapter1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Pairable">"Pairable"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +adapter1_set_pairable (Adapter1 *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "pairable", value, NULL); +} + +/** + * adapter1_get_pairable_timeout: (skip) + * @object: A #Adapter1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.PairableTimeout">"PairableTimeout"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guint +adapter1_get_pairable_timeout (Adapter1 *object) +{ + return ADAPTER1_GET_IFACE (object)->get_pairable_timeout (object); +} + +/** + * adapter1_set_pairable_timeout: (skip) + * @object: A #Adapter1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.PairableTimeout">"PairableTimeout"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +adapter1_set_pairable_timeout (Adapter1 *object, guint value) +{ + g_object_set (G_OBJECT (object), "pairable-timeout", value, NULL); +} + +/** + * adapter1_get_discovering: (skip) + * @object: A #Adapter1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Discovering">"Discovering"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +adapter1_get_discovering (Adapter1 *object) +{ + return ADAPTER1_GET_IFACE (object)->get_discovering (object); +} + +/** + * adapter1_set_discovering: (skip) + * @object: A #Adapter1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Discovering">"Discovering"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +adapter1_set_discovering (Adapter1 *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "discovering", value, NULL); +} + +/** + * adapter1_get_uuids: (skip) + * @object: A #Adapter1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.UUIDs">"UUIDs"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use adapter1_dup_uuids() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar *const * +adapter1_get_uuids (Adapter1 *object) +{ + return ADAPTER1_GET_IFACE (object)->get_uuids (object); +} + +/** + * adapter1_dup_uuids: (skip) + * @object: A #Adapter1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-Adapter1.UUIDs">"UUIDs"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). + */ +gchar ** +adapter1_dup_uuids (Adapter1 *object) +{ + gchar **value; + g_object_get (G_OBJECT (object), "uuids", &value, NULL); + return value; +} + +/** + * adapter1_set_uuids: (skip) + * @object: A #Adapter1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.UUIDs">"UUIDs"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +adapter1_set_uuids (Adapter1 *object, const gchar *const *value) +{ + g_object_set (G_OBJECT (object), "uuids", value, NULL); +} + +/** + * adapter1_get_modalias: (skip) + * @object: A #Adapter1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Adapter1.Modalias">"Modalias"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use adapter1_dup_modalias() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +adapter1_get_modalias (Adapter1 *object) +{ + return ADAPTER1_GET_IFACE (object)->get_modalias (object); +} + +/** + * adapter1_dup_modalias: (skip) + * @object: A #Adapter1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-Adapter1.Modalias">"Modalias"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +adapter1_dup_modalias (Adapter1 *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "modalias", &value, NULL); + return value; +} + +/** + * adapter1_set_modalias: (skip) + * @object: A #Adapter1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Adapter1.Modalias">"Modalias"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +adapter1_set_modalias (Adapter1 *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "modalias", value, NULL); +} + +/** + * adapter1_call_start_discovery: + * @proxy: A #Adapter1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Adapter1.StartDiscovery">StartDiscovery()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call adapter1_call_start_discovery_finish() to get the result of the operation. + * + * See adapter1_call_start_discovery_sync() for the synchronous, blocking version of this method. + */ +void +adapter1_call_start_discovery ( + Adapter1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "StartDiscovery", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * adapter1_call_start_discovery_finish: + * @proxy: A #Adapter1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to adapter1_call_start_discovery(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with adapter1_call_start_discovery(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +adapter1_call_start_discovery_finish ( + Adapter1 *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * adapter1_call_start_discovery_sync: + * @proxy: A #Adapter1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Adapter1.StartDiscovery">StartDiscovery()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See adapter1_call_start_discovery() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +adapter1_call_start_discovery_sync ( + Adapter1 *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "StartDiscovery", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * adapter1_call_stop_discovery: + * @proxy: A #Adapter1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Adapter1.StopDiscovery">StopDiscovery()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call adapter1_call_stop_discovery_finish() to get the result of the operation. + * + * See adapter1_call_stop_discovery_sync() for the synchronous, blocking version of this method. + */ +void +adapter1_call_stop_discovery ( + Adapter1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "StopDiscovery", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * adapter1_call_stop_discovery_finish: + * @proxy: A #Adapter1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to adapter1_call_stop_discovery(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with adapter1_call_stop_discovery(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +adapter1_call_stop_discovery_finish ( + Adapter1 *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * adapter1_call_stop_discovery_sync: + * @proxy: A #Adapter1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Adapter1.StopDiscovery">StopDiscovery()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See adapter1_call_stop_discovery() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +adapter1_call_stop_discovery_sync ( + Adapter1 *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "StopDiscovery", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * adapter1_call_remove_device: + * @proxy: A #Adapter1Proxy. + * @arg_device: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Adapter1.RemoveDevice">RemoveDevice()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call adapter1_call_remove_device_finish() to get the result of the operation. + * + * See adapter1_call_remove_device_sync() for the synchronous, blocking version of this method. + */ +void +adapter1_call_remove_device ( + Adapter1 *proxy, + const gchar *arg_device, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "RemoveDevice", + g_variant_new ("(o)", + arg_device), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * adapter1_call_remove_device_finish: + * @proxy: A #Adapter1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to adapter1_call_remove_device(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with adapter1_call_remove_device(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +adapter1_call_remove_device_finish ( + Adapter1 *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * adapter1_call_remove_device_sync: + * @proxy: A #Adapter1Proxy. + * @arg_device: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Adapter1.RemoveDevice">RemoveDevice()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See adapter1_call_remove_device() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +adapter1_call_remove_device_sync ( + Adapter1 *proxy, + const gchar *arg_device, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "RemoveDevice", + g_variant_new ("(o)", + arg_device), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * adapter1_complete_start_discovery: + * @object: A #Adapter1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Adapter1.StartDiscovery">StartDiscovery()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +adapter1_complete_start_discovery ( + Adapter1 *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * adapter1_complete_stop_discovery: + * @object: A #Adapter1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Adapter1.StopDiscovery">StopDiscovery()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +adapter1_complete_stop_discovery ( + Adapter1 *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * adapter1_complete_remove_device: + * @object: A #Adapter1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Adapter1.RemoveDevice">RemoveDevice()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +adapter1_complete_remove_device ( + Adapter1 *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * Adapter1Proxy: + * + * The #Adapter1Proxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * Adapter1ProxyClass: + * @parent_class: The parent class. + * + * Class structure for #Adapter1Proxy. + */ + +struct _Adapter1ProxyPrivate +{ + GData *qdata; +}; + +static void adapter1_proxy_iface_init (Adapter1Iface *iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (Adapter1Proxy, adapter1_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE (Adapter1Proxy) + G_IMPLEMENT_INTERFACE (TYPE_ADAPTER1, adapter1_proxy_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (Adapter1Proxy, adapter1_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_ADAPTER1, adapter1_proxy_iface_init)); + +#endif +static void +adapter1_proxy_finalize (GObject *object) +{ + Adapter1Proxy *proxy = ADAPTER1_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (adapter1_proxy_parent_class)->finalize (object); +} + +static void +adapter1_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 12); + info = _adapter1_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant (value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue (variant, value); + } + if (variant != NULL) + g_variant_unref (variant); +} + +static void +adapter1_proxy_set_property_cb (GDBusProxy *proxy, + GAsyncResult *res, + gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo *info = user_data; + GError *error; + GVariant *_ret; + error = NULL; + _ret = g_dbus_proxy_call_finish (proxy, res, &error); + if (!_ret) + { + g_warning ("Error setting property '%s' on interface org.bluez.Adapter1: %s (%s, %d)", + info->parent_struct.name, + error->message, g_quark_to_string (error->domain), error->code); + g_error_free (error); + } + else + { + g_variant_unref (_ret); + } +} + +static void +adapter1_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 12); + info = _adapter1_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_dbus_proxy_call (G_DBUS_PROXY (object), + "org.freedesktop.DBus.Properties.Set", + g_variant_new ("(ssv)", "org.bluez.Adapter1", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, (GAsyncReadyCallback) adapter1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); + g_variant_unref (variant); +} + +static void +adapter1_proxy_g_signal (GDBusProxy *proxy, + const gchar *sender_name G_GNUC_UNUSED, + const gchar *signal_name, + GVariant *parameters) +{ + _ExtendedGDBusSignalInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_adapter1_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children (parameters); + paramv = g_new0 (GValue, num_params + 1); + g_value_init (¶mv[0], TYPE_ADAPTER1); + g_value_set_object (¶mv[0], proxy); + g_variant_iter_init (&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_ADAPTER1); + g_signal_emitv (paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static void +adapter1_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + Adapter1Proxy *proxy = ADAPTER1_PROXY (_proxy); + guint n; + const gchar *key; + GVariantIter *iter; + _ExtendedGDBusPropertyInfo *info; + g_variant_get (changed_properties, "a{sv}", &iter); + while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_adapter1_interface_info.parent_struct, key); + g_datalist_remove_data (&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } + g_variant_iter_free (iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_adapter1_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } +} + +static const gchar * +adapter1_proxy_get_address (Adapter1 *object) +{ + Adapter1Proxy *proxy = ADAPTER1_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Address"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +adapter1_proxy_get_name (Adapter1 *object) +{ + Adapter1Proxy *proxy = ADAPTER1_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Name"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +adapter1_proxy_get_alias (Adapter1 *object) +{ + Adapter1Proxy *proxy = ADAPTER1_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Alias"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static guint +adapter1_proxy_get_class (Adapter1 *object) +{ + Adapter1Proxy *proxy = ADAPTER1_PROXY (object); + GVariant *variant; + guint value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Class"); + if (variant != NULL) + { + value = g_variant_get_uint32 (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +adapter1_proxy_get_powered (Adapter1 *object) +{ + Adapter1Proxy *proxy = ADAPTER1_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Powered"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +adapter1_proxy_get_discoverable (Adapter1 *object) +{ + Adapter1Proxy *proxy = ADAPTER1_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Discoverable"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static guint +adapter1_proxy_get_discoverable_timeout (Adapter1 *object) +{ + Adapter1Proxy *proxy = ADAPTER1_PROXY (object); + GVariant *variant; + guint value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "DiscoverableTimeout"); + if (variant != NULL) + { + value = g_variant_get_uint32 (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +adapter1_proxy_get_pairable (Adapter1 *object) +{ + Adapter1Proxy *proxy = ADAPTER1_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Pairable"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static guint +adapter1_proxy_get_pairable_timeout (Adapter1 *object) +{ + Adapter1Proxy *proxy = ADAPTER1_PROXY (object); + GVariant *variant; + guint value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "PairableTimeout"); + if (variant != NULL) + { + value = g_variant_get_uint32 (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +adapter1_proxy_get_discovering (Adapter1 *object) +{ + Adapter1Proxy *proxy = ADAPTER1_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Discovering"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static const gchar *const * +adapter1_proxy_get_uuids (Adapter1 *object) +{ + Adapter1Proxy *proxy = ADAPTER1_PROXY (object); + GVariant *variant; + const gchar *const *value = NULL; + value = g_datalist_get_data (&proxy->priv->qdata, "UUIDs"); + if (value != NULL) + return value; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "UUIDs"); + if (variant != NULL) + { + value = g_variant_get_strv (variant, NULL); + g_datalist_set_data_full (&proxy->priv->qdata, "UUIDs", (gpointer) value, g_free); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +adapter1_proxy_get_modalias (Adapter1 *object) +{ + Adapter1Proxy *proxy = ADAPTER1_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Modalias"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static void +adapter1_proxy_init (Adapter1Proxy *proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = adapter1_proxy_get_instance_private (proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_ADAPTER1_PROXY, Adapter1ProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), adapter1_interface_info ()); +} + +static void +adapter1_proxy_class_init (Adapter1ProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = adapter1_proxy_finalize; + gobject_class->get_property = adapter1_proxy_get_property; + gobject_class->set_property = adapter1_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = adapter1_proxy_g_signal; + proxy_class->g_properties_changed = adapter1_proxy_g_properties_changed; + + adapter1_override_properties (gobject_class, 1); + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (Adapter1ProxyPrivate)); +#endif +} + +static void +adapter1_proxy_iface_init (Adapter1Iface *iface) +{ + iface->get_address = adapter1_proxy_get_address; + iface->get_name = adapter1_proxy_get_name; + iface->get_alias = adapter1_proxy_get_alias; + iface->get_class = adapter1_proxy_get_class; + iface->get_powered = adapter1_proxy_get_powered; + iface->get_discoverable = adapter1_proxy_get_discoverable; + iface->get_discoverable_timeout = adapter1_proxy_get_discoverable_timeout; + iface->get_pairable = adapter1_proxy_get_pairable; + iface->get_pairable_timeout = adapter1_proxy_get_pairable_timeout; + iface->get_discovering = adapter1_proxy_get_discovering; + iface->get_uuids = adapter1_proxy_get_uuids; + iface->get_modalias = adapter1_proxy_get_modalias; +} + +/** + * adapter1_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link>. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call adapter1_proxy_new_finish() to get the result of the operation. + * + * See adapter1_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +adapter1_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_ADAPTER1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.Adapter1", NULL); +} + +/** + * adapter1_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to adapter1_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with adapter1_proxy_new(). + * + * Returns: (transfer full) (type Adapter1Proxy): The constructed proxy object or %NULL if @error is set. + */ +Adapter1 * +adapter1_proxy_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return ADAPTER1 (ret); + else + return NULL; +} + +/** + * adapter1_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link>. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See adapter1_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type Adapter1Proxy): The constructed proxy object or %NULL if @error is set. + */ +Adapter1 * +adapter1_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_ADAPTER1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.Adapter1", NULL); + if (ret != NULL) + return ADAPTER1 (ret); + else + return NULL; +} + + +/** + * adapter1_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like adapter1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call adapter1_proxy_new_for_bus_finish() to get the result of the operation. + * + * See adapter1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +adapter1_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_ADAPTER1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.Adapter1", NULL); +} + +/** + * adapter1_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to adapter1_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with adapter1_proxy_new_for_bus(). + * + * Returns: (transfer full) (type Adapter1Proxy): The constructed proxy object or %NULL if @error is set. + */ +Adapter1 * +adapter1_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return ADAPTER1 (ret); + else + return NULL; +} + +/** + * adapter1_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like adapter1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See adapter1_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type Adapter1Proxy): The constructed proxy object or %NULL if @error is set. + */ +Adapter1 * +adapter1_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_ADAPTER1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.Adapter1", NULL); + if (ret != NULL) + return ADAPTER1 (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * Adapter1Skeleton: + * + * The #Adapter1Skeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * Adapter1SkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #Adapter1Skeleton. + */ + +struct _Adapter1SkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_adapter1_skeleton_handle_method_call ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (user_data); + _ExtendedGDBusMethodInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint num_extra; + guint n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); + g_assert (info != NULL); + num_params = g_variant_n_children (parameters); + num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); + n = 0; + g_value_init (¶mv[n], TYPE_ADAPTER1); + g_value_set_object (¶mv[n++], skeleton); + g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object (¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); +#else + g_assert_not_reached (); +#endif + } + g_variant_iter_init (&iter, parameters); + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_ADAPTER1); + g_value_init (&return_value, G_TYPE_BOOLEAN); + g_signal_emitv (paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean (&return_value)) + g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset (&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static GVariant * +_adapter1_skeleton_handle_get_property ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name G_GNUC_UNUSED, + const gchar *property_name, + GError **error, + gpointer user_data) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + GVariant *ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_adapter1_interface_info.parent_struct, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init (&value, pspec->value_type); + g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_value_unset (&value); + } + return ret; +} + +static gboolean +_adapter1_skeleton_handle_set_property ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name G_GNUC_UNUSED, + const gchar *property_name, + GVariant *variant, + GError **error, + gpointer user_data) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_adapter1_interface_info.parent_struct, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant (&value, variant); + else + g_dbus_gvariant_to_gvalue (variant, &value); + g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); + g_value_unset (&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _adapter1_skeleton_vtable = +{ + _adapter1_skeleton_handle_method_call, + _adapter1_skeleton_handle_get_property, + _adapter1_skeleton_handle_set_property, + {NULL} +}; + +static GDBusInterfaceInfo * +adapter1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return adapter1_interface_info (); +} + +static GDBusInterfaceVTable * +adapter1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_adapter1_skeleton_vtable; +} + +static GVariant * +adapter1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_adapter1_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _adapter1_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _adapter1_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + value = _adapter1_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.bluez.Adapter1", info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref (value); + g_variant_builder_add (&builder, "{sv}", info->name, value); + g_variant_unref (value); + } + } + } +out: + return g_variant_builder_end (&builder); +} + +static gboolean _adapter1_emit_changed (gpointer user_data); + +static void +adapter1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy (skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock (&skeleton->priv->lock); + + if (emit_changed) + _adapter1_emit_changed (skeleton); +} + +static void adapter1_skeleton_iface_init (Adapter1Iface *iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (Adapter1Skeleton, adapter1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE (Adapter1Skeleton) + G_IMPLEMENT_INTERFACE (TYPE_ADAPTER1, adapter1_skeleton_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (Adapter1Skeleton, adapter1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_ADAPTER1, adapter1_skeleton_iface_init)); + +#endif +static void +adapter1_skeleton_finalize (GObject *object) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); + guint n; + for (n = 0; n < 12; n++) + g_value_unset (&skeleton->priv->properties[n]); + g_free (skeleton->priv->properties); + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy (skeleton->priv->changed_properties_idle_source); + g_main_context_unref (skeleton->priv->context); + g_mutex_clear (&skeleton->priv->lock); + G_OBJECT_CLASS (adapter1_skeleton_parent_class)->finalize (object); +} + +static void +adapter1_skeleton_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 12); + g_mutex_lock (&skeleton->priv->lock); + g_value_copy (&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock (&skeleton->priv->lock); +} + +static gboolean +_adapter1_emit_changed (gpointer user_data) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (user_data); + GList *l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock (&skeleton->priv->lock); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty *cp = l->data; + GVariant *variant; + const GValue *cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal (cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); + g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref (variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *ll; + GVariant *signal_variant; + signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.bluez.Adapter1", + &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + for (ll = connections; ll != NULL; ll = ll->next) + { + GDBusConnection *connection = ll->data; + + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + signal_variant, + NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); + } + else + { + g_variant_builder_clear (&builder); + g_variant_builder_clear (&invalidated_builder); + } + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock (&skeleton->priv->lock); + return FALSE; +} + +static void +_adapter1_schedule_emit_changed (Adapter1Skeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) +{ + ChangedProperty *cp; + GList *l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty *i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0 (ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); + g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); + g_value_copy (orig_value, &cp->orig_value); + } +} + +static void +adapter1_skeleton_notify (GObject *object, + GParamSpec *pspec G_GNUC_UNUSED) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && + skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new (); + g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback (skeleton->priv->changed_properties_idle_source, _adapter1_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); + g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _adapter1_emit_changed"); + g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref (skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock (&skeleton->priv->lock); +} + +static void +adapter1_skeleton_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 12); + g_mutex_lock (&skeleton->priv->lock); + g_object_freeze_notify (object); + if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) + _adapter1_schedule_emit_changed (skeleton, _adapter1_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec (object, pspec); + } + g_mutex_unlock (&skeleton->priv->lock); + g_object_thaw_notify (object); +} + +static void +adapter1_skeleton_init (Adapter1Skeleton *skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = adapter1_skeleton_get_instance_private (skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_ADAPTER1_SKELETON, Adapter1SkeletonPrivate); +#endif + + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); + skeleton->priv->properties = g_new0 (GValue, 12); + g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[3], G_TYPE_UINT); + g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[5], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[6], G_TYPE_UINT); + g_value_init (&skeleton->priv->properties[7], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[8], G_TYPE_UINT); + g_value_init (&skeleton->priv->properties[9], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[10], G_TYPE_STRV); + g_value_init (&skeleton->priv->properties[11], G_TYPE_STRING); +} + +static const gchar * +adapter1_skeleton_get_address (Adapter1 *object) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[0])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +adapter1_skeleton_get_name (Adapter1 *object) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[1])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +adapter1_skeleton_get_alias (Adapter1 *object) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[2])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static guint +adapter1_skeleton_get_class (Adapter1 *object) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); + guint value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_uint (&(skeleton->priv->properties[3])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +adapter1_skeleton_get_powered (Adapter1 *object) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[4])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +adapter1_skeleton_get_discoverable (Adapter1 *object) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[5])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static guint +adapter1_skeleton_get_discoverable_timeout (Adapter1 *object) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); + guint value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_uint (&(skeleton->priv->properties[6])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +adapter1_skeleton_get_pairable (Adapter1 *object) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[7])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static guint +adapter1_skeleton_get_pairable_timeout (Adapter1 *object) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); + guint value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_uint (&(skeleton->priv->properties[8])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +adapter1_skeleton_get_discovering (Adapter1 *object) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[9])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar *const * +adapter1_skeleton_get_uuids (Adapter1 *object) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); + const gchar *const *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boxed (&(skeleton->priv->properties[10])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +adapter1_skeleton_get_modalias (Adapter1 *object) +{ + Adapter1Skeleton *skeleton = ADAPTER1_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[11])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static void +adapter1_skeleton_class_init (Adapter1SkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = adapter1_skeleton_finalize; + gobject_class->get_property = adapter1_skeleton_get_property; + gobject_class->set_property = adapter1_skeleton_set_property; + gobject_class->notify = adapter1_skeleton_notify; + + + adapter1_override_properties (gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = adapter1_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = adapter1_skeleton_dbus_interface_get_properties; + skeleton_class->flush = adapter1_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = adapter1_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (Adapter1SkeletonPrivate)); +#endif +} + +static void +adapter1_skeleton_iface_init (Adapter1Iface *iface) +{ + iface->get_address = adapter1_skeleton_get_address; + iface->get_name = adapter1_skeleton_get_name; + iface->get_alias = adapter1_skeleton_get_alias; + iface->get_class = adapter1_skeleton_get_class; + iface->get_powered = adapter1_skeleton_get_powered; + iface->get_discoverable = adapter1_skeleton_get_discoverable; + iface->get_discoverable_timeout = adapter1_skeleton_get_discoverable_timeout; + iface->get_pairable = adapter1_skeleton_get_pairable; + iface->get_pairable_timeout = adapter1_skeleton_get_pairable_timeout; + iface->get_discovering = adapter1_skeleton_get_discovering; + iface->get_uuids = adapter1_skeleton_get_uuids; + iface->get_modalias = adapter1_skeleton_get_modalias; +} + +/** + * adapter1_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link>. + * + * Returns: (transfer full) (type Adapter1Skeleton): The skeleton object. + */ +Adapter1 * +adapter1_skeleton_new (void) +{ + return ADAPTER1 (g_object_new (TYPE_ADAPTER1_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for interface org.bluez.Device1 + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:Device1 + * @title: Device1 + * @short_description: Generated C code for the org.bluez.Device1 D-Bus interface + * + * This section contains code for working with the <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link> D-Bus interface in C. + */ + +/* ---- Introspection data for org.bluez.Device1 ---- */ + +static const _ExtendedGDBusMethodInfo _device1_method_info_disconnect = +{ + { + -1, + (gchar *) "Disconnect", + NULL, + NULL, + NULL + }, + "handle-disconnect", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _device1_method_info_connect = +{ + { + -1, + (gchar *) "Connect", + NULL, + NULL, + NULL + }, + "handle-connect", + FALSE +}; + +static const _ExtendedGDBusArgInfo _device1_method_info_connect_profile_IN_ARG_UUID = +{ + { + -1, + (gchar *) "UUID", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _device1_method_info_connect_profile_IN_ARG_pointers[] = +{ + &_device1_method_info_connect_profile_IN_ARG_UUID, + NULL +}; + +static const _ExtendedGDBusMethodInfo _device1_method_info_connect_profile = +{ + { + -1, + (gchar *) "ConnectProfile", + (GDBusArgInfo **) &_device1_method_info_connect_profile_IN_ARG_pointers, + NULL, + NULL + }, + "handle-connect-profile", + FALSE +}; + +static const _ExtendedGDBusArgInfo _device1_method_info_disconnect_profile_IN_ARG_UUID = +{ + { + -1, + (gchar *) "UUID", + (gchar *) "s", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _device1_method_info_disconnect_profile_IN_ARG_pointers[] = +{ + &_device1_method_info_disconnect_profile_IN_ARG_UUID, + NULL +}; + +static const _ExtendedGDBusMethodInfo _device1_method_info_disconnect_profile = +{ + { + -1, + (gchar *) "DisconnectProfile", + (GDBusArgInfo **) &_device1_method_info_disconnect_profile_IN_ARG_pointers, + NULL, + NULL + }, + "handle-disconnect-profile", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _device1_method_info_pair = +{ + { + -1, + (gchar *) "Pair", + NULL, + NULL, + NULL + }, + "handle-pair", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _device1_method_info_cancel_pairing = +{ + { + -1, + (gchar *) "CancelPairing", + NULL, + NULL, + NULL + }, + "handle-cancel-pairing", + FALSE +}; + +static const _ExtendedGDBusMethodInfo * const _device1_method_info_pointers[] = +{ + &_device1_method_info_disconnect, + &_device1_method_info_connect, + &_device1_method_info_connect_profile, + &_device1_method_info_disconnect_profile, + &_device1_method_info_pair, + &_device1_method_info_cancel_pairing, + NULL +}; + +static const _ExtendedGDBusPropertyInfo _device1_property_info_address = +{ + { + -1, + (gchar *) "Address", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "address", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _device1_property_info_name = +{ + { + -1, + (gchar *) "Name", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "name", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _device1_property_info_alias = +{ + { + -1, + (gchar *) "Alias", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "alias", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _device1_property_info_class = +{ + { + -1, + (gchar *) "Class", + (gchar *) "u", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "class", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _device1_property_info_appearance = +{ + { + -1, + (gchar *) "Appearance", + (gchar *) "q", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "appearance", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _device1_property_info_icon = +{ + { + -1, + (gchar *) "Icon", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "icon", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _device1_property_info_paired = +{ + { + -1, + (gchar *) "Paired", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "paired", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _device1_property_info_trusted = +{ + { + -1, + (gchar *) "Trusted", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "trusted", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _device1_property_info_blocked = +{ + { + -1, + (gchar *) "Blocked", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL + }, + "blocked", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _device1_property_info_legacy_pairing = +{ + { + -1, + (gchar *) "LegacyPairing", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "legacy-pairing", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _device1_property_info_rssi = +{ + { + -1, + (gchar *) "RSSI", + (gchar *) "n", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "rssi", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _device1_property_info_connected = +{ + { + -1, + (gchar *) "Connected", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "connected", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _device1_property_info_uuids = +{ + { + -1, + (gchar *) "UUIDs", + (gchar *) "as", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "uuids", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _device1_property_info_modalias = +{ + { + -1, + (gchar *) "Modalias", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "modalias", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _device1_property_info_adapter = +{ + { + -1, + (gchar *) "Adapter", + (gchar *) "o", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "adapter", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo * const _device1_property_info_pointers[] = +{ + &_device1_property_info_address, + &_device1_property_info_name, + &_device1_property_info_alias, + &_device1_property_info_class, + &_device1_property_info_appearance, + &_device1_property_info_icon, + &_device1_property_info_paired, + &_device1_property_info_trusted, + &_device1_property_info_blocked, + &_device1_property_info_legacy_pairing, + &_device1_property_info_rssi, + &_device1_property_info_connected, + &_device1_property_info_uuids, + &_device1_property_info_modalias, + &_device1_property_info_adapter, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _device1_interface_info = +{ + { + -1, + (gchar *) "org.bluez.Device1", + (GDBusMethodInfo **) &_device1_method_info_pointers, + NULL, + (GDBusPropertyInfo **) &_device1_property_info_pointers, + NULL + }, + "device1", +}; + + +/** + * device1_interface_info: + * + * Gets a machine-readable description of the <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link> D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +device1_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_device1_interface_info.parent_struct; +} + +/** + * device1_override_properties: + * @klass: The class structure for a #GObject<!-- -->-derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #Device1 interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +device1_override_properties (GObjectClass *klass, guint property_id_begin) +{ + g_object_class_override_property (klass, property_id_begin++, "address"); + g_object_class_override_property (klass, property_id_begin++, "name"); + g_object_class_override_property (klass, property_id_begin++, "alias"); + g_object_class_override_property (klass, property_id_begin++, "class"); + g_object_class_override_property (klass, property_id_begin++, "appearance"); + g_object_class_override_property (klass, property_id_begin++, "icon"); + g_object_class_override_property (klass, property_id_begin++, "paired"); + g_object_class_override_property (klass, property_id_begin++, "trusted"); + g_object_class_override_property (klass, property_id_begin++, "blocked"); + g_object_class_override_property (klass, property_id_begin++, "legacy-pairing"); + g_object_class_override_property (klass, property_id_begin++, "rssi"); + g_object_class_override_property (klass, property_id_begin++, "connected"); + g_object_class_override_property (klass, property_id_begin++, "uuids"); + g_object_class_override_property (klass, property_id_begin++, "modalias"); + g_object_class_override_property (klass, property_id_begin++, "adapter"); + return property_id_begin - 1; +} + + + +/** + * Device1: + * + * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link>. + */ + +/** + * Device1Iface: + * @parent_iface: The parent interface. + * @handle_cancel_pairing: Handler for the #Device1::handle-cancel-pairing signal. + * @handle_connect: Handler for the #Device1::handle-connect signal. + * @handle_connect_profile: Handler for the #Device1::handle-connect-profile signal. + * @handle_disconnect: Handler for the #Device1::handle-disconnect signal. + * @handle_disconnect_profile: Handler for the #Device1::handle-disconnect-profile signal. + * @handle_pair: Handler for the #Device1::handle-pair signal. + * @get_adapter: Getter for the #Device1:adapter property. + * @get_address: Getter for the #Device1:address property. + * @get_alias: Getter for the #Device1:alias property. + * @get_appearance: Getter for the #Device1:appearance property. + * @get_blocked: Getter for the #Device1:blocked property. + * @get_class: Getter for the #Device1:class property. + * @get_connected: Getter for the #Device1:connected property. + * @get_icon: Getter for the #Device1:icon property. + * @get_legacy_pairing: Getter for the #Device1:legacy-pairing property. + * @get_modalias: Getter for the #Device1:modalias property. + * @get_name: Getter for the #Device1:name property. + * @get_paired: Getter for the #Device1:paired property. + * @get_rssi: Getter for the #Device1:rssi property. + * @get_trusted: Getter for the #Device1:trusted property. + * @get_uuids: Getter for the #Device1:uuids property. + * + * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link>. + */ + +typedef Device1Iface Device1Interface; +G_DEFINE_INTERFACE (Device1, device1, G_TYPE_OBJECT); + +static void +device1_default_init (Device1Iface *iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * Device1::handle-disconnect: + * @object: A #Device1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Device1.Disconnect">Disconnect()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call device1_complete_disconnect() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-disconnect", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (Device1Iface, handle_disconnect), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * Device1::handle-connect: + * @object: A #Device1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Device1.Connect">Connect()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call device1_complete_connect() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-connect", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (Device1Iface, handle_connect), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * Device1::handle-connect-profile: + * @object: A #Device1. + * @invocation: A #GDBusMethodInvocation. + * @arg_UUID: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Device1.ConnectProfile">ConnectProfile()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call device1_complete_connect_profile() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-connect-profile", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (Device1Iface, handle_connect_profile), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * Device1::handle-disconnect-profile: + * @object: A #Device1. + * @invocation: A #GDBusMethodInvocation. + * @arg_UUID: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Device1.DisconnectProfile">DisconnectProfile()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call device1_complete_disconnect_profile() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-disconnect-profile", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (Device1Iface, handle_disconnect_profile), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * Device1::handle-pair: + * @object: A #Device1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Device1.Pair">Pair()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call device1_complete_pair() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-pair", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (Device1Iface, handle_pair), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * Device1::handle-cancel-pairing: + * @object: A #Device1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-Device1.CancelPairing">CancelPairing()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call device1_complete_cancel_pairing() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-cancel-pairing", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (Device1Iface, handle_cancel_pairing), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /* GObject properties for D-Bus properties: */ + /** + * Device1:address: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Address">"Address"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("address", "Address", "Address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Device1:name: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Name">"Name"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("name", "Name", "Name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Device1:alias: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Alias">"Alias"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("alias", "Alias", "Alias", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Device1:class: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Class">"Class"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_uint ("class", "Class", "Class", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Device1:appearance: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Appearance">"Appearance"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_uint ("appearance", "Appearance", "Appearance", 0, G_MAXUINT16, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Device1:icon: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Icon">"Icon"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("icon", "Icon", "Icon", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Device1:paired: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Paired">"Paired"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("paired", "Paired", "Paired", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Device1:trusted: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Trusted">"Trusted"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("trusted", "Trusted", "Trusted", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Device1:blocked: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Blocked">"Blocked"</link>. + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("blocked", "Blocked", "Blocked", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Device1:legacy-pairing: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.LegacyPairing">"LegacyPairing"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("legacy-pairing", "LegacyPairing", "LegacyPairing", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Device1:rssi: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.RSSI">"RSSI"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_int ("rssi", "RSSI", "RSSI", G_MININT16, G_MAXINT16, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Device1:connected: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Connected">"Connected"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("connected", "Connected", "Connected", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Device1:uuids: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.UUIDs">"UUIDs"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boxed ("uuids", "UUIDs", "UUIDs", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Device1:modalias: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Modalias">"Modalias"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("modalias", "Modalias", "Modalias", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * Device1:adapter: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-Device1.Adapter">"Adapter"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("adapter", "Adapter", "Adapter", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +/** + * device1_get_address: (skip) + * @object: A #Device1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Address">"Address"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use device1_dup_address() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +device1_get_address (Device1 *object) +{ + return DEVICE1_GET_IFACE (object)->get_address (object); +} + +/** + * device1_dup_address: (skip) + * @object: A #Device1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-Device1.Address">"Address"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +device1_dup_address (Device1 *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "address", &value, NULL); + return value; +} + +/** + * device1_set_address: (skip) + * @object: A #Device1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Device1.Address">"Address"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +device1_set_address (Device1 *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "address", value, NULL); +} + +/** + * device1_get_name: (skip) + * @object: A #Device1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Name">"Name"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use device1_dup_name() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +device1_get_name (Device1 *object) +{ + return DEVICE1_GET_IFACE (object)->get_name (object); +} + +/** + * device1_dup_name: (skip) + * @object: A #Device1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-Device1.Name">"Name"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +device1_dup_name (Device1 *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "name", &value, NULL); + return value; +} + +/** + * device1_set_name: (skip) + * @object: A #Device1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Device1.Name">"Name"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +device1_set_name (Device1 *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "name", value, NULL); +} + +/** + * device1_get_alias: (skip) + * @object: A #Device1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Alias">"Alias"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use device1_dup_alias() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +device1_get_alias (Device1 *object) +{ + return DEVICE1_GET_IFACE (object)->get_alias (object); +} + +/** + * device1_dup_alias: (skip) + * @object: A #Device1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-Device1.Alias">"Alias"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +device1_dup_alias (Device1 *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "alias", &value, NULL); + return value; +} + +/** + * device1_set_alias: (skip) + * @object: A #Device1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Device1.Alias">"Alias"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +device1_set_alias (Device1 *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "alias", value, NULL); +} + +/** + * device1_get_class: (skip) + * @object: A #Device1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Class">"Class"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guint +device1_get_class (Device1 *object) +{ + return DEVICE1_GET_IFACE (object)->get_class (object); +} + +/** + * device1_set_class: (skip) + * @object: A #Device1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Device1.Class">"Class"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +device1_set_class (Device1 *object, guint value) +{ + g_object_set (G_OBJECT (object), "class", value, NULL); +} + +/** + * device1_get_appearance: (skip) + * @object: A #Device1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Appearance">"Appearance"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guint16 +device1_get_appearance (Device1 *object) +{ + return DEVICE1_GET_IFACE (object)->get_appearance (object); +} + +/** + * device1_set_appearance: (skip) + * @object: A #Device1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Device1.Appearance">"Appearance"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +device1_set_appearance (Device1 *object, guint16 value) +{ + g_object_set (G_OBJECT (object), "appearance", value, NULL); +} + +/** + * device1_get_icon: (skip) + * @object: A #Device1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Icon">"Icon"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use device1_dup_icon() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +device1_get_icon (Device1 *object) +{ + return DEVICE1_GET_IFACE (object)->get_icon (object); +} + +/** + * device1_dup_icon: (skip) + * @object: A #Device1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-Device1.Icon">"Icon"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +device1_dup_icon (Device1 *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "icon", &value, NULL); + return value; +} + +/** + * device1_set_icon: (skip) + * @object: A #Device1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Device1.Icon">"Icon"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +device1_set_icon (Device1 *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "icon", value, NULL); +} + +/** + * device1_get_paired: (skip) + * @object: A #Device1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Paired">"Paired"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +device1_get_paired (Device1 *object) +{ + return DEVICE1_GET_IFACE (object)->get_paired (object); +} + +/** + * device1_set_paired: (skip) + * @object: A #Device1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Device1.Paired">"Paired"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +device1_set_paired (Device1 *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "paired", value, NULL); +} + +/** + * device1_get_trusted: (skip) + * @object: A #Device1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Trusted">"Trusted"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +device1_get_trusted (Device1 *object) +{ + return DEVICE1_GET_IFACE (object)->get_trusted (object); +} + +/** + * device1_set_trusted: (skip) + * @object: A #Device1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Device1.Trusted">"Trusted"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +device1_set_trusted (Device1 *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "trusted", value, NULL); +} + +/** + * device1_get_blocked: (skip) + * @object: A #Device1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Blocked">"Blocked"</link> D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +device1_get_blocked (Device1 *object) +{ + return DEVICE1_GET_IFACE (object)->get_blocked (object); +} + +/** + * device1_set_blocked: (skip) + * @object: A #Device1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Device1.Blocked">"Blocked"</link> D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side. + */ +void +device1_set_blocked (Device1 *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "blocked", value, NULL); +} + +/** + * device1_get_legacy_pairing: (skip) + * @object: A #Device1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.LegacyPairing">"LegacyPairing"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +device1_get_legacy_pairing (Device1 *object) +{ + return DEVICE1_GET_IFACE (object)->get_legacy_pairing (object); +} + +/** + * device1_set_legacy_pairing: (skip) + * @object: A #Device1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Device1.LegacyPairing">"LegacyPairing"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +device1_set_legacy_pairing (Device1 *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "legacy-pairing", value, NULL); +} + +/** + * device1_get_rssi: (skip) + * @object: A #Device1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.RSSI">"RSSI"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gint16 +device1_get_rssi (Device1 *object) +{ + return DEVICE1_GET_IFACE (object)->get_rssi (object); +} + +/** + * device1_set_rssi: (skip) + * @object: A #Device1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Device1.RSSI">"RSSI"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +device1_set_rssi (Device1 *object, gint16 value) +{ + g_object_set (G_OBJECT (object), "rssi", value, NULL); +} + +/** + * device1_get_connected: (skip) + * @object: A #Device1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Connected">"Connected"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +device1_get_connected (Device1 *object) +{ + return DEVICE1_GET_IFACE (object)->get_connected (object); +} + +/** + * device1_set_connected: (skip) + * @object: A #Device1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Device1.Connected">"Connected"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +device1_set_connected (Device1 *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "connected", value, NULL); +} + +/** + * device1_get_uuids: (skip) + * @object: A #Device1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.UUIDs">"UUIDs"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use device1_dup_uuids() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar *const * +device1_get_uuids (Device1 *object) +{ + return DEVICE1_GET_IFACE (object)->get_uuids (object); +} + +/** + * device1_dup_uuids: (skip) + * @object: A #Device1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-Device1.UUIDs">"UUIDs"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). + */ +gchar ** +device1_dup_uuids (Device1 *object) +{ + gchar **value; + g_object_get (G_OBJECT (object), "uuids", &value, NULL); + return value; +} + +/** + * device1_set_uuids: (skip) + * @object: A #Device1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Device1.UUIDs">"UUIDs"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +device1_set_uuids (Device1 *object, const gchar *const *value) +{ + g_object_set (G_OBJECT (object), "uuids", value, NULL); +} + +/** + * device1_get_modalias: (skip) + * @object: A #Device1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Modalias">"Modalias"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use device1_dup_modalias() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +device1_get_modalias (Device1 *object) +{ + return DEVICE1_GET_IFACE (object)->get_modalias (object); +} + +/** + * device1_dup_modalias: (skip) + * @object: A #Device1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-Device1.Modalias">"Modalias"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +device1_dup_modalias (Device1 *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "modalias", &value, NULL); + return value; +} + +/** + * device1_set_modalias: (skip) + * @object: A #Device1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Device1.Modalias">"Modalias"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +device1_set_modalias (Device1 *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "modalias", value, NULL); +} + +/** + * device1_get_adapter: (skip) + * @object: A #Device1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-Device1.Adapter">"Adapter"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use device1_dup_adapter() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +device1_get_adapter (Device1 *object) +{ + return DEVICE1_GET_IFACE (object)->get_adapter (object); +} + +/** + * device1_dup_adapter: (skip) + * @object: A #Device1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-Device1.Adapter">"Adapter"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +device1_dup_adapter (Device1 *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "adapter", &value, NULL); + return value; +} + +/** + * device1_set_adapter: (skip) + * @object: A #Device1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-Device1.Adapter">"Adapter"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +device1_set_adapter (Device1 *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "adapter", value, NULL); +} + +/** + * device1_call_disconnect: + * @proxy: A #Device1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.Disconnect">Disconnect()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call device1_call_disconnect_finish() to get the result of the operation. + * + * See device1_call_disconnect_sync() for the synchronous, blocking version of this method. + */ +void +device1_call_disconnect ( + Device1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Disconnect", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * device1_call_disconnect_finish: + * @proxy: A #Device1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to device1_call_disconnect(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with device1_call_disconnect(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +device1_call_disconnect_finish ( + Device1 *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * device1_call_disconnect_sync: + * @proxy: A #Device1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.Disconnect">Disconnect()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See device1_call_disconnect() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +device1_call_disconnect_sync ( + Device1 *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Disconnect", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * device1_call_connect: + * @proxy: A #Device1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.Connect">Connect()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call device1_call_connect_finish() to get the result of the operation. + * + * See device1_call_connect_sync() for the synchronous, blocking version of this method. + */ +void +device1_call_connect ( + Device1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Connect", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * device1_call_connect_finish: + * @proxy: A #Device1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to device1_call_connect(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with device1_call_connect(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +device1_call_connect_finish ( + Device1 *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * device1_call_connect_sync: + * @proxy: A #Device1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.Connect">Connect()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See device1_call_connect() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +device1_call_connect_sync ( + Device1 *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Connect", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * device1_call_connect_profile: + * @proxy: A #Device1Proxy. + * @arg_UUID: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.ConnectProfile">ConnectProfile()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call device1_call_connect_profile_finish() to get the result of the operation. + * + * See device1_call_connect_profile_sync() for the synchronous, blocking version of this method. + */ +void +device1_call_connect_profile ( + Device1 *proxy, + const gchar *arg_UUID, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "ConnectProfile", + g_variant_new ("(s)", + arg_UUID), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * device1_call_connect_profile_finish: + * @proxy: A #Device1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to device1_call_connect_profile(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with device1_call_connect_profile(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +device1_call_connect_profile_finish ( + Device1 *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * device1_call_connect_profile_sync: + * @proxy: A #Device1Proxy. + * @arg_UUID: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.ConnectProfile">ConnectProfile()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See device1_call_connect_profile() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +device1_call_connect_profile_sync ( + Device1 *proxy, + const gchar *arg_UUID, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "ConnectProfile", + g_variant_new ("(s)", + arg_UUID), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * device1_call_disconnect_profile: + * @proxy: A #Device1Proxy. + * @arg_UUID: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.DisconnectProfile">DisconnectProfile()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call device1_call_disconnect_profile_finish() to get the result of the operation. + * + * See device1_call_disconnect_profile_sync() for the synchronous, blocking version of this method. + */ +void +device1_call_disconnect_profile ( + Device1 *proxy, + const gchar *arg_UUID, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "DisconnectProfile", + g_variant_new ("(s)", + arg_UUID), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * device1_call_disconnect_profile_finish: + * @proxy: A #Device1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to device1_call_disconnect_profile(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with device1_call_disconnect_profile(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +device1_call_disconnect_profile_finish ( + Device1 *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * device1_call_disconnect_profile_sync: + * @proxy: A #Device1Proxy. + * @arg_UUID: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.DisconnectProfile">DisconnectProfile()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See device1_call_disconnect_profile() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +device1_call_disconnect_profile_sync ( + Device1 *proxy, + const gchar *arg_UUID, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "DisconnectProfile", + g_variant_new ("(s)", + arg_UUID), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * device1_call_pair: + * @proxy: A #Device1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.Pair">Pair()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call device1_call_pair_finish() to get the result of the operation. + * + * See device1_call_pair_sync() for the synchronous, blocking version of this method. + */ +void +device1_call_pair ( + Device1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "Pair", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * device1_call_pair_finish: + * @proxy: A #Device1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to device1_call_pair(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with device1_call_pair(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +device1_call_pair_finish ( + Device1 *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * device1_call_pair_sync: + * @proxy: A #Device1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.Pair">Pair()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See device1_call_pair() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +device1_call_pair_sync ( + Device1 *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "Pair", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * device1_call_cancel_pairing: + * @proxy: A #Device1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.CancelPairing">CancelPairing()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call device1_call_cancel_pairing_finish() to get the result of the operation. + * + * See device1_call_cancel_pairing_sync() for the synchronous, blocking version of this method. + */ +void +device1_call_cancel_pairing ( + Device1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "CancelPairing", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * device1_call_cancel_pairing_finish: + * @proxy: A #Device1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to device1_call_cancel_pairing(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with device1_call_cancel_pairing(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +device1_call_cancel_pairing_finish ( + Device1 *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * device1_call_cancel_pairing_sync: + * @proxy: A #Device1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-bluez-Device1.CancelPairing">CancelPairing()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See device1_call_cancel_pairing() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +device1_call_cancel_pairing_sync ( + Device1 *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "CancelPairing", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * device1_complete_disconnect: + * @object: A #Device1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Device1.Disconnect">Disconnect()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +device1_complete_disconnect ( + Device1 *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * device1_complete_connect: + * @object: A #Device1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Device1.Connect">Connect()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +device1_complete_connect ( + Device1 *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * device1_complete_connect_profile: + * @object: A #Device1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Device1.ConnectProfile">ConnectProfile()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +device1_complete_connect_profile ( + Device1 *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * device1_complete_disconnect_profile: + * @object: A #Device1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Device1.DisconnectProfile">DisconnectProfile()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +device1_complete_disconnect_profile ( + Device1 *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * device1_complete_pair: + * @object: A #Device1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Device1.Pair">Pair()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +device1_complete_pair ( + Device1 *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * device1_complete_cancel_pairing: + * @object: A #Device1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-Device1.CancelPairing">CancelPairing()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +device1_complete_cancel_pairing ( + Device1 *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * Device1Proxy: + * + * The #Device1Proxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * Device1ProxyClass: + * @parent_class: The parent class. + * + * Class structure for #Device1Proxy. + */ + +struct _Device1ProxyPrivate +{ + GData *qdata; +}; + +static void device1_proxy_iface_init (Device1Iface *iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (Device1Proxy, device1_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE (Device1Proxy) + G_IMPLEMENT_INTERFACE (TYPE_DEVICE1, device1_proxy_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (Device1Proxy, device1_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_DEVICE1, device1_proxy_iface_init)); + +#endif +static void +device1_proxy_finalize (GObject *object) +{ + Device1Proxy *proxy = DEVICE1_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (device1_proxy_parent_class)->finalize (object); +} + +static void +device1_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 15); + info = _device1_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant (value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue (variant, value); + } + if (variant != NULL) + g_variant_unref (variant); +} + +static void +device1_proxy_set_property_cb (GDBusProxy *proxy, + GAsyncResult *res, + gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo *info = user_data; + GError *error; + GVariant *_ret; + error = NULL; + _ret = g_dbus_proxy_call_finish (proxy, res, &error); + if (!_ret) + { + g_warning ("Error setting property '%s' on interface org.bluez.Device1: %s (%s, %d)", + info->parent_struct.name, + error->message, g_quark_to_string (error->domain), error->code); + g_error_free (error); + } + else + { + g_variant_unref (_ret); + } +} + +static void +device1_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 15); + info = _device1_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_dbus_proxy_call (G_DBUS_PROXY (object), + "org.freedesktop.DBus.Properties.Set", + g_variant_new ("(ssv)", "org.bluez.Device1", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, (GAsyncReadyCallback) device1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); + g_variant_unref (variant); +} + +static void +device1_proxy_g_signal (GDBusProxy *proxy, + const gchar *sender_name G_GNUC_UNUSED, + const gchar *signal_name, + GVariant *parameters) +{ + _ExtendedGDBusSignalInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_device1_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children (parameters); + paramv = g_new0 (GValue, num_params + 1); + g_value_init (¶mv[0], TYPE_DEVICE1); + g_value_set_object (¶mv[0], proxy); + g_variant_iter_init (&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_DEVICE1); + g_signal_emitv (paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static void +device1_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + Device1Proxy *proxy = DEVICE1_PROXY (_proxy); + guint n; + const gchar *key; + GVariantIter *iter; + _ExtendedGDBusPropertyInfo *info; + g_variant_get (changed_properties, "a{sv}", &iter); + while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_device1_interface_info.parent_struct, key); + g_datalist_remove_data (&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } + g_variant_iter_free (iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_device1_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } +} + +static const gchar * +device1_proxy_get_address (Device1 *object) +{ + Device1Proxy *proxy = DEVICE1_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Address"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +device1_proxy_get_name (Device1 *object) +{ + Device1Proxy *proxy = DEVICE1_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Name"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +device1_proxy_get_alias (Device1 *object) +{ + Device1Proxy *proxy = DEVICE1_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Alias"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static guint +device1_proxy_get_class (Device1 *object) +{ + Device1Proxy *proxy = DEVICE1_PROXY (object); + GVariant *variant; + guint value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Class"); + if (variant != NULL) + { + value = g_variant_get_uint32 (variant); + g_variant_unref (variant); + } + return value; +} + +static guint16 +device1_proxy_get_appearance (Device1 *object) +{ + Device1Proxy *proxy = DEVICE1_PROXY (object); + GVariant *variant; + guint16 value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Appearance"); + if (variant != NULL) + { + value = g_variant_get_uint16 (variant); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +device1_proxy_get_icon (Device1 *object) +{ + Device1Proxy *proxy = DEVICE1_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Icon"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static gboolean +device1_proxy_get_paired (Device1 *object) +{ + Device1Proxy *proxy = DEVICE1_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Paired"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +device1_proxy_get_trusted (Device1 *object) +{ + Device1Proxy *proxy = DEVICE1_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Trusted"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +device1_proxy_get_blocked (Device1 *object) +{ + Device1Proxy *proxy = DEVICE1_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Blocked"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +device1_proxy_get_legacy_pairing (Device1 *object) +{ + Device1Proxy *proxy = DEVICE1_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "LegacyPairing"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static gint16 +device1_proxy_get_rssi (Device1 *object) +{ + Device1Proxy *proxy = DEVICE1_PROXY (object); + GVariant *variant; + gint16 value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "RSSI"); + if (variant != NULL) + { + value = g_variant_get_int16 (variant); + g_variant_unref (variant); + } + return value; +} + +static gboolean +device1_proxy_get_connected (Device1 *object) +{ + Device1Proxy *proxy = DEVICE1_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Connected"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static const gchar *const * +device1_proxy_get_uuids (Device1 *object) +{ + Device1Proxy *proxy = DEVICE1_PROXY (object); + GVariant *variant; + const gchar *const *value = NULL; + value = g_datalist_get_data (&proxy->priv->qdata, "UUIDs"); + if (value != NULL) + return value; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "UUIDs"); + if (variant != NULL) + { + value = g_variant_get_strv (variant, NULL); + g_datalist_set_data_full (&proxy->priv->qdata, "UUIDs", (gpointer) value, g_free); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +device1_proxy_get_modalias (Device1 *object) +{ + Device1Proxy *proxy = DEVICE1_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Modalias"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +device1_proxy_get_adapter (Device1 *object) +{ + Device1Proxy *proxy = DEVICE1_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Adapter"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static void +device1_proxy_init (Device1Proxy *proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = device1_proxy_get_instance_private (proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_DEVICE1_PROXY, Device1ProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), device1_interface_info ()); +} + +static void +device1_proxy_class_init (Device1ProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = device1_proxy_finalize; + gobject_class->get_property = device1_proxy_get_property; + gobject_class->set_property = device1_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = device1_proxy_g_signal; + proxy_class->g_properties_changed = device1_proxy_g_properties_changed; + + device1_override_properties (gobject_class, 1); + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (Device1ProxyPrivate)); +#endif +} + +static void +device1_proxy_iface_init (Device1Iface *iface) +{ + iface->get_address = device1_proxy_get_address; + iface->get_name = device1_proxy_get_name; + iface->get_alias = device1_proxy_get_alias; + iface->get_class = device1_proxy_get_class; + iface->get_appearance = device1_proxy_get_appearance; + iface->get_icon = device1_proxy_get_icon; + iface->get_paired = device1_proxy_get_paired; + iface->get_trusted = device1_proxy_get_trusted; + iface->get_blocked = device1_proxy_get_blocked; + iface->get_legacy_pairing = device1_proxy_get_legacy_pairing; + iface->get_rssi = device1_proxy_get_rssi; + iface->get_connected = device1_proxy_get_connected; + iface->get_uuids = device1_proxy_get_uuids; + iface->get_modalias = device1_proxy_get_modalias; + iface->get_adapter = device1_proxy_get_adapter; +} + +/** + * device1_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link>. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call device1_proxy_new_finish() to get the result of the operation. + * + * See device1_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +device1_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_DEVICE1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.Device1", NULL); +} + +/** + * device1_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to device1_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with device1_proxy_new(). + * + * Returns: (transfer full) (type Device1Proxy): The constructed proxy object or %NULL if @error is set. + */ +Device1 * +device1_proxy_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return DEVICE1 (ret); + else + return NULL; +} + +/** + * device1_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link>. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See device1_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type Device1Proxy): The constructed proxy object or %NULL if @error is set. + */ +Device1 * +device1_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_DEVICE1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.Device1", NULL); + if (ret != NULL) + return DEVICE1 (ret); + else + return NULL; +} + + +/** + * device1_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like device1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call device1_proxy_new_for_bus_finish() to get the result of the operation. + * + * See device1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +device1_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_DEVICE1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.Device1", NULL); +} + +/** + * device1_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to device1_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with device1_proxy_new_for_bus(). + * + * Returns: (transfer full) (type Device1Proxy): The constructed proxy object or %NULL if @error is set. + */ +Device1 * +device1_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return DEVICE1 (ret); + else + return NULL; +} + +/** + * device1_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like device1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See device1_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type Device1Proxy): The constructed proxy object or %NULL if @error is set. + */ +Device1 * +device1_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_DEVICE1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.Device1", NULL); + if (ret != NULL) + return DEVICE1 (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * Device1Skeleton: + * + * The #Device1Skeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * Device1SkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #Device1Skeleton. + */ + +struct _Device1SkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_device1_skeleton_handle_method_call ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (user_data); + _ExtendedGDBusMethodInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint num_extra; + guint n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); + g_assert (info != NULL); + num_params = g_variant_n_children (parameters); + num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); + n = 0; + g_value_init (¶mv[n], TYPE_DEVICE1); + g_value_set_object (¶mv[n++], skeleton); + g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object (¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); +#else + g_assert_not_reached (); +#endif + } + g_variant_iter_init (&iter, parameters); + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_DEVICE1); + g_value_init (&return_value, G_TYPE_BOOLEAN); + g_signal_emitv (paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean (&return_value)) + g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset (&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static GVariant * +_device1_skeleton_handle_get_property ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name G_GNUC_UNUSED, + const gchar *property_name, + GError **error, + gpointer user_data) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + GVariant *ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_device1_interface_info.parent_struct, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init (&value, pspec->value_type); + g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_value_unset (&value); + } + return ret; +} + +static gboolean +_device1_skeleton_handle_set_property ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name G_GNUC_UNUSED, + const gchar *property_name, + GVariant *variant, + GError **error, + gpointer user_data) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_device1_interface_info.parent_struct, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant (&value, variant); + else + g_dbus_gvariant_to_gvalue (variant, &value); + g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); + g_value_unset (&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _device1_skeleton_vtable = +{ + _device1_skeleton_handle_method_call, + _device1_skeleton_handle_get_property, + _device1_skeleton_handle_set_property, + {NULL} +}; + +static GDBusInterfaceInfo * +device1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return device1_interface_info (); +} + +static GDBusInterfaceVTable * +device1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_device1_skeleton_vtable; +} + +static GVariant * +device1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_device1_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _device1_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _device1_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + value = _device1_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.bluez.Device1", info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref (value); + g_variant_builder_add (&builder, "{sv}", info->name, value); + g_variant_unref (value); + } + } + } +out: + return g_variant_builder_end (&builder); +} + +static gboolean _device1_emit_changed (gpointer user_data); + +static void +device1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy (skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock (&skeleton->priv->lock); + + if (emit_changed) + _device1_emit_changed (skeleton); +} + +static void device1_skeleton_iface_init (Device1Iface *iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (Device1Skeleton, device1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE (Device1Skeleton) + G_IMPLEMENT_INTERFACE (TYPE_DEVICE1, device1_skeleton_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (Device1Skeleton, device1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_DEVICE1, device1_skeleton_iface_init)); + +#endif +static void +device1_skeleton_finalize (GObject *object) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + guint n; + for (n = 0; n < 15; n++) + g_value_unset (&skeleton->priv->properties[n]); + g_free (skeleton->priv->properties); + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy (skeleton->priv->changed_properties_idle_source); + g_main_context_unref (skeleton->priv->context); + g_mutex_clear (&skeleton->priv->lock); + G_OBJECT_CLASS (device1_skeleton_parent_class)->finalize (object); +} + +static void +device1_skeleton_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 15); + g_mutex_lock (&skeleton->priv->lock); + g_value_copy (&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock (&skeleton->priv->lock); +} + +static gboolean +_device1_emit_changed (gpointer user_data) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (user_data); + GList *l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock (&skeleton->priv->lock); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty *cp = l->data; + GVariant *variant; + const GValue *cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal (cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); + g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref (variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *ll; + GVariant *signal_variant; + signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.bluez.Device1", + &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + for (ll = connections; ll != NULL; ll = ll->next) + { + GDBusConnection *connection = ll->data; + + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + signal_variant, + NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); + } + else + { + g_variant_builder_clear (&builder); + g_variant_builder_clear (&invalidated_builder); + } + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock (&skeleton->priv->lock); + return FALSE; +} + +static void +_device1_schedule_emit_changed (Device1Skeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) +{ + ChangedProperty *cp; + GList *l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty *i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0 (ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); + g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); + g_value_copy (orig_value, &cp->orig_value); + } +} + +static void +device1_skeleton_notify (GObject *object, + GParamSpec *pspec G_GNUC_UNUSED) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && + skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new (); + g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback (skeleton->priv->changed_properties_idle_source, _device1_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); + g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _device1_emit_changed"); + g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref (skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock (&skeleton->priv->lock); +} + +static void +device1_skeleton_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 15); + g_mutex_lock (&skeleton->priv->lock); + g_object_freeze_notify (object); + if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) + _device1_schedule_emit_changed (skeleton, _device1_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec (object, pspec); + } + g_mutex_unlock (&skeleton->priv->lock); + g_object_thaw_notify (object); +} + +static void +device1_skeleton_init (Device1Skeleton *skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = device1_skeleton_get_instance_private (skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_DEVICE1_SKELETON, Device1SkeletonPrivate); +#endif + + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); + skeleton->priv->properties = g_new0 (GValue, 15); + g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[3], G_TYPE_UINT); + g_value_init (&skeleton->priv->properties[4], G_TYPE_UINT); + g_value_init (&skeleton->priv->properties[5], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[6], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[7], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[8], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[9], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[10], G_TYPE_INT); + g_value_init (&skeleton->priv->properties[11], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[12], G_TYPE_STRV); + g_value_init (&skeleton->priv->properties[13], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[14], G_TYPE_STRING); +} + +static const gchar * +device1_skeleton_get_address (Device1 *object) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[0])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +device1_skeleton_get_name (Device1 *object) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[1])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +device1_skeleton_get_alias (Device1 *object) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[2])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static guint +device1_skeleton_get_class (Device1 *object) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + guint value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_uint (&(skeleton->priv->properties[3])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static guint16 +device1_skeleton_get_appearance (Device1 *object) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + guint value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_uint (&(skeleton->priv->properties[4])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +device1_skeleton_get_icon (Device1 *object) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[5])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +device1_skeleton_get_paired (Device1 *object) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[6])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +device1_skeleton_get_trusted (Device1 *object) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[7])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +device1_skeleton_get_blocked (Device1 *object) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[8])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +device1_skeleton_get_legacy_pairing (Device1 *object) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[9])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gint16 +device1_skeleton_get_rssi (Device1 *object) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + gint value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_int (&(skeleton->priv->properties[10])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +device1_skeleton_get_connected (Device1 *object) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[11])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar *const * +device1_skeleton_get_uuids (Device1 *object) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + const gchar *const *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boxed (&(skeleton->priv->properties[12])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +device1_skeleton_get_modalias (Device1 *object) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[13])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +device1_skeleton_get_adapter (Device1 *object) +{ + Device1Skeleton *skeleton = DEVICE1_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[14])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static void +device1_skeleton_class_init (Device1SkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = device1_skeleton_finalize; + gobject_class->get_property = device1_skeleton_get_property; + gobject_class->set_property = device1_skeleton_set_property; + gobject_class->notify = device1_skeleton_notify; + + + device1_override_properties (gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = device1_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = device1_skeleton_dbus_interface_get_properties; + skeleton_class->flush = device1_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = device1_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (Device1SkeletonPrivate)); +#endif +} + +static void +device1_skeleton_iface_init (Device1Iface *iface) +{ + iface->get_address = device1_skeleton_get_address; + iface->get_name = device1_skeleton_get_name; + iface->get_alias = device1_skeleton_get_alias; + iface->get_class = device1_skeleton_get_class; + iface->get_appearance = device1_skeleton_get_appearance; + iface->get_icon = device1_skeleton_get_icon; + iface->get_paired = device1_skeleton_get_paired; + iface->get_trusted = device1_skeleton_get_trusted; + iface->get_blocked = device1_skeleton_get_blocked; + iface->get_legacy_pairing = device1_skeleton_get_legacy_pairing; + iface->get_rssi = device1_skeleton_get_rssi; + iface->get_connected = device1_skeleton_get_connected; + iface->get_uuids = device1_skeleton_get_uuids; + iface->get_modalias = device1_skeleton_get_modalias; + iface->get_adapter = device1_skeleton_get_adapter; +} + +/** + * device1_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link>. + * + * Returns: (transfer full) (type Device1Skeleton): The skeleton object. + */ +Device1 * +device1_skeleton_new (void) +{ + return DEVICE1 (g_object_new (TYPE_DEVICE1_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for interface org.bluez.GattService1 + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:GattService1 + * @title: GattService1 + * @short_description: Generated C code for the org.bluez.GattService1 D-Bus interface + * + * This section contains code for working with the <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link> D-Bus interface in C. + */ + +/* ---- Introspection data for org.bluez.GattService1 ---- */ + +static const _ExtendedGDBusPropertyInfo _gatt_service1_property_info_uuid = +{ + { + -1, + (gchar *) "UUID", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "uuid", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _gatt_service1_property_info_device = +{ + { + -1, + (gchar *) "Device", + (gchar *) "o", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "device", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _gatt_service1_property_info_primary = +{ + { + -1, + (gchar *) "Primary", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "primary", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _gatt_service1_property_info_characteristics = +{ + { + -1, + (gchar *) "Characteristics", + (gchar *) "ao", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "characteristics", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo * const _gatt_service1_property_info_pointers[] = +{ + &_gatt_service1_property_info_uuid, + &_gatt_service1_property_info_device, + &_gatt_service1_property_info_primary, + &_gatt_service1_property_info_characteristics, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _gatt_service1_interface_info = +{ + { + -1, + (gchar *) "org.bluez.GattService1", + NULL, + NULL, + (GDBusPropertyInfo **) &_gatt_service1_property_info_pointers, + NULL + }, + "gatt-service1", +}; + + +/** + * gatt_service1_interface_info: + * + * Gets a machine-readable description of the <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link> D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +gatt_service1_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_gatt_service1_interface_info.parent_struct; +} + +/** + * gatt_service1_override_properties: + * @klass: The class structure for a #GObject<!-- -->-derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #GattService1 interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +gatt_service1_override_properties (GObjectClass *klass, guint property_id_begin) +{ + g_object_class_override_property (klass, property_id_begin++, "uuid"); + g_object_class_override_property (klass, property_id_begin++, "device"); + g_object_class_override_property (klass, property_id_begin++, "primary"); + g_object_class_override_property (klass, property_id_begin++, "characteristics"); + return property_id_begin - 1; +} + + + +/** + * GattService1: + * + * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link>. + */ + +/** + * GattService1Iface: + * @parent_iface: The parent interface. + * @get_characteristics: Getter for the #GattService1:characteristics property. + * @get_device: Getter for the #GattService1:device property. + * @get_primary: Getter for the #GattService1:primary property. + * @get_uuid: Getter for the #GattService1:uuid property. + * + * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link>. + */ + +typedef GattService1Iface GattService1Interface; +G_DEFINE_INTERFACE (GattService1, gatt_service1, G_TYPE_OBJECT); + +static void +gatt_service1_default_init (GattService1Iface *iface) +{ + /* GObject properties for D-Bus properties: */ + /** + * GattService1:uuid: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattService1.UUID">"UUID"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("uuid", "UUID", "UUID", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * GattService1:device: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattService1.Device">"Device"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("device", "Device", "Device", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * GattService1:primary: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattService1.Primary">"Primary"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("primary", "Primary", "Primary", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * GattService1:characteristics: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattService1.Characteristics">"Characteristics"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boxed ("characteristics", "Characteristics", "Characteristics", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +/** + * gatt_service1_get_uuid: (skip) + * @object: A #GattService1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-GattService1.UUID">"UUID"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_service1_dup_uuid() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +gatt_service1_get_uuid (GattService1 *object) +{ + return GATT_SERVICE1_GET_IFACE (object)->get_uuid (object); +} + +/** + * gatt_service1_dup_uuid: (skip) + * @object: A #GattService1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattService1.UUID">"UUID"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +gatt_service1_dup_uuid (GattService1 *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "uuid", &value, NULL); + return value; +} + +/** + * gatt_service1_set_uuid: (skip) + * @object: A #GattService1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-GattService1.UUID">"UUID"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +gatt_service1_set_uuid (GattService1 *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "uuid", value, NULL); +} + +/** + * gatt_service1_get_device: (skip) + * @object: A #GattService1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-GattService1.Device">"Device"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_service1_dup_device() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +gatt_service1_get_device (GattService1 *object) +{ + return GATT_SERVICE1_GET_IFACE (object)->get_device (object); +} + +/** + * gatt_service1_dup_device: (skip) + * @object: A #GattService1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattService1.Device">"Device"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +gatt_service1_dup_device (GattService1 *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "device", &value, NULL); + return value; +} + +/** + * gatt_service1_set_device: (skip) + * @object: A #GattService1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-GattService1.Device">"Device"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +gatt_service1_set_device (GattService1 *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "device", value, NULL); +} + +/** + * gatt_service1_get_primary: (skip) + * @object: A #GattService1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-GattService1.Primary">"Primary"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +gatt_service1_get_primary (GattService1 *object) +{ + return GATT_SERVICE1_GET_IFACE (object)->get_primary (object); +} + +/** + * gatt_service1_set_primary: (skip) + * @object: A #GattService1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-GattService1.Primary">"Primary"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +gatt_service1_set_primary (GattService1 *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "primary", value, NULL); +} + +/** + * gatt_service1_get_characteristics: (skip) + * @object: A #GattService1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-GattService1.Characteristics">"Characteristics"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_service1_dup_characteristics() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar *const * +gatt_service1_get_characteristics (GattService1 *object) +{ + return GATT_SERVICE1_GET_IFACE (object)->get_characteristics (object); +} + +/** + * gatt_service1_dup_characteristics: (skip) + * @object: A #GattService1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattService1.Characteristics">"Characteristics"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). + */ +gchar ** +gatt_service1_dup_characteristics (GattService1 *object) +{ + gchar **value; + g_object_get (G_OBJECT (object), "characteristics", &value, NULL); + return value; +} + +/** + * gatt_service1_set_characteristics: (skip) + * @object: A #GattService1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-GattService1.Characteristics">"Characteristics"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +gatt_service1_set_characteristics (GattService1 *object, const gchar *const *value) +{ + g_object_set (G_OBJECT (object), "characteristics", value, NULL); +} + +/* ------------------------------------------------------------------------ */ + +/** + * GattService1Proxy: + * + * The #GattService1Proxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * GattService1ProxyClass: + * @parent_class: The parent class. + * + * Class structure for #GattService1Proxy. + */ + +struct _GattService1ProxyPrivate +{ + GData *qdata; +}; + +static void gatt_service1_proxy_iface_init (GattService1Iface *iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (GattService1Proxy, gatt_service1_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE (GattService1Proxy) + G_IMPLEMENT_INTERFACE (TYPE_GATT_SERVICE1, gatt_service1_proxy_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (GattService1Proxy, gatt_service1_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_GATT_SERVICE1, gatt_service1_proxy_iface_init)); + +#endif +static void +gatt_service1_proxy_finalize (GObject *object) +{ + GattService1Proxy *proxy = GATT_SERVICE1_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (gatt_service1_proxy_parent_class)->finalize (object); +} + +static void +gatt_service1_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 4); + info = _gatt_service1_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant (value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue (variant, value); + } + if (variant != NULL) + g_variant_unref (variant); +} + +static void +gatt_service1_proxy_set_property_cb (GDBusProxy *proxy, + GAsyncResult *res, + gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo *info = user_data; + GError *error; + GVariant *_ret; + error = NULL; + _ret = g_dbus_proxy_call_finish (proxy, res, &error); + if (!_ret) + { + g_warning ("Error setting property '%s' on interface org.bluez.GattService1: %s (%s, %d)", + info->parent_struct.name, + error->message, g_quark_to_string (error->domain), error->code); + g_error_free (error); + } + else + { + g_variant_unref (_ret); + } +} + +static void +gatt_service1_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 4); + info = _gatt_service1_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_dbus_proxy_call (G_DBUS_PROXY (object), + "org.freedesktop.DBus.Properties.Set", + g_variant_new ("(ssv)", "org.bluez.GattService1", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, (GAsyncReadyCallback) gatt_service1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); + g_variant_unref (variant); +} + +static void +gatt_service1_proxy_g_signal (GDBusProxy *proxy, + const gchar *sender_name G_GNUC_UNUSED, + const gchar *signal_name, + GVariant *parameters) +{ + _ExtendedGDBusSignalInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gatt_service1_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children (parameters); + paramv = g_new0 (GValue, num_params + 1); + g_value_init (¶mv[0], TYPE_GATT_SERVICE1); + g_value_set_object (¶mv[0], proxy); + g_variant_iter_init (&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_GATT_SERVICE1); + g_signal_emitv (paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static void +gatt_service1_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + GattService1Proxy *proxy = GATT_SERVICE1_PROXY (_proxy); + guint n; + const gchar *key; + GVariantIter *iter; + _ExtendedGDBusPropertyInfo *info; + g_variant_get (changed_properties, "a{sv}", &iter); + while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_service1_interface_info.parent_struct, key); + g_datalist_remove_data (&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } + g_variant_iter_free (iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_service1_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } +} + +static const gchar * +gatt_service1_proxy_get_uuid (GattService1 *object) +{ + GattService1Proxy *proxy = GATT_SERVICE1_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "UUID"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +gatt_service1_proxy_get_device (GattService1 *object) +{ + GattService1Proxy *proxy = GATT_SERVICE1_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Device"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static gboolean +gatt_service1_proxy_get_primary (GattService1 *object) +{ + GattService1Proxy *proxy = GATT_SERVICE1_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Primary"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static const gchar *const * +gatt_service1_proxy_get_characteristics (GattService1 *object) +{ + GattService1Proxy *proxy = GATT_SERVICE1_PROXY (object); + GVariant *variant; + const gchar *const *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Characteristics"); + if (variant != NULL) + { + value = g_variant_get_objv (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static void +gatt_service1_proxy_init (GattService1Proxy *proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = gatt_service1_proxy_get_instance_private (proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_GATT_SERVICE1_PROXY, GattService1ProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gatt_service1_interface_info ()); +} + +static void +gatt_service1_proxy_class_init (GattService1ProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = gatt_service1_proxy_finalize; + gobject_class->get_property = gatt_service1_proxy_get_property; + gobject_class->set_property = gatt_service1_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = gatt_service1_proxy_g_signal; + proxy_class->g_properties_changed = gatt_service1_proxy_g_properties_changed; + + gatt_service1_override_properties (gobject_class, 1); + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (GattService1ProxyPrivate)); +#endif +} + +static void +gatt_service1_proxy_iface_init (GattService1Iface *iface) +{ + iface->get_uuid = gatt_service1_proxy_get_uuid; + iface->get_device = gatt_service1_proxy_get_device; + iface->get_primary = gatt_service1_proxy_get_primary; + iface->get_characteristics = gatt_service1_proxy_get_characteristics; +} + +/** + * gatt_service1_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link>. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call gatt_service1_proxy_new_finish() to get the result of the operation. + * + * See gatt_service1_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +gatt_service1_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_GATT_SERVICE1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.GattService1", NULL); +} + +/** + * gatt_service1_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_service1_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with gatt_service1_proxy_new(). + * + * Returns: (transfer full) (type GattService1Proxy): The constructed proxy object or %NULL if @error is set. + */ +GattService1 * +gatt_service1_proxy_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return GATT_SERVICE1 (ret); + else + return NULL; +} + +/** + * gatt_service1_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link>. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See gatt_service1_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type GattService1Proxy): The constructed proxy object or %NULL if @error is set. + */ +GattService1 * +gatt_service1_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_GATT_SERVICE1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.GattService1", NULL); + if (ret != NULL) + return GATT_SERVICE1 (ret); + else + return NULL; +} + + +/** + * gatt_service1_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like gatt_service1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call gatt_service1_proxy_new_for_bus_finish() to get the result of the operation. + * + * See gatt_service1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +gatt_service1_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_GATT_SERVICE1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.GattService1", NULL); +} + +/** + * gatt_service1_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_service1_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with gatt_service1_proxy_new_for_bus(). + * + * Returns: (transfer full) (type GattService1Proxy): The constructed proxy object or %NULL if @error is set. + */ +GattService1 * +gatt_service1_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return GATT_SERVICE1 (ret); + else + return NULL; +} + +/** + * gatt_service1_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like gatt_service1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See gatt_service1_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type GattService1Proxy): The constructed proxy object or %NULL if @error is set. + */ +GattService1 * +gatt_service1_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_GATT_SERVICE1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.GattService1", NULL); + if (ret != NULL) + return GATT_SERVICE1 (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * GattService1Skeleton: + * + * The #GattService1Skeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * GattService1SkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #GattService1Skeleton. + */ + +struct _GattService1SkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_gatt_service1_skeleton_handle_method_call ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (user_data); + _ExtendedGDBusMethodInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint num_extra; + guint n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); + g_assert (info != NULL); + num_params = g_variant_n_children (parameters); + num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); + n = 0; + g_value_init (¶mv[n], TYPE_GATT_SERVICE1); + g_value_set_object (¶mv[n++], skeleton); + g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object (¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); +#else + g_assert_not_reached (); +#endif + } + g_variant_iter_init (&iter, parameters); + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_GATT_SERVICE1); + g_value_init (&return_value, G_TYPE_BOOLEAN); + g_signal_emitv (paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean (&return_value)) + g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset (&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static GVariant * +_gatt_service1_skeleton_handle_get_property ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name G_GNUC_UNUSED, + const gchar *property_name, + GError **error, + gpointer user_data) +{ + GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + GVariant *ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_service1_interface_info.parent_struct, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init (&value, pspec->value_type); + g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_value_unset (&value); + } + return ret; +} + +static gboolean +_gatt_service1_skeleton_handle_set_property ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name G_GNUC_UNUSED, + const gchar *property_name, + GVariant *variant, + GError **error, + gpointer user_data) +{ + GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_service1_interface_info.parent_struct, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant (&value, variant); + else + g_dbus_gvariant_to_gvalue (variant, &value); + g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); + g_value_unset (&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _gatt_service1_skeleton_vtable = +{ + _gatt_service1_skeleton_handle_method_call, + _gatt_service1_skeleton_handle_get_property, + _gatt_service1_skeleton_handle_set_property, + {NULL} +}; + +static GDBusInterfaceInfo * +gatt_service1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return gatt_service1_interface_info (); +} + +static GDBusInterfaceVTable * +gatt_service1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_gatt_service1_skeleton_vtable; +} + +static GVariant * +gatt_service1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_gatt_service1_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _gatt_service1_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _gatt_service1_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + value = _gatt_service1_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.bluez.GattService1", info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref (value); + g_variant_builder_add (&builder, "{sv}", info->name, value); + g_variant_unref (value); + } + } + } +out: + return g_variant_builder_end (&builder); +} + +static gboolean _gatt_service1_emit_changed (gpointer user_data); + +static void +gatt_service1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ + GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy (skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock (&skeleton->priv->lock); + + if (emit_changed) + _gatt_service1_emit_changed (skeleton); +} + +static void gatt_service1_skeleton_iface_init (GattService1Iface *iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (GattService1Skeleton, gatt_service1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE (GattService1Skeleton) + G_IMPLEMENT_INTERFACE (TYPE_GATT_SERVICE1, gatt_service1_skeleton_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (GattService1Skeleton, gatt_service1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_GATT_SERVICE1, gatt_service1_skeleton_iface_init)); + +#endif +static void +gatt_service1_skeleton_finalize (GObject *object) +{ + GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (object); + guint n; + for (n = 0; n < 4; n++) + g_value_unset (&skeleton->priv->properties[n]); + g_free (skeleton->priv->properties); + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy (skeleton->priv->changed_properties_idle_source); + g_main_context_unref (skeleton->priv->context); + g_mutex_clear (&skeleton->priv->lock); + G_OBJECT_CLASS (gatt_service1_skeleton_parent_class)->finalize (object); +} + +static void +gatt_service1_skeleton_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 4); + g_mutex_lock (&skeleton->priv->lock); + g_value_copy (&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock (&skeleton->priv->lock); +} + +static gboolean +_gatt_service1_emit_changed (gpointer user_data) +{ + GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (user_data); + GList *l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock (&skeleton->priv->lock); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty *cp = l->data; + GVariant *variant; + const GValue *cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal (cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); + g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref (variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *ll; + GVariant *signal_variant; + signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.bluez.GattService1", + &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + for (ll = connections; ll != NULL; ll = ll->next) + { + GDBusConnection *connection = ll->data; + + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + signal_variant, + NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); + } + else + { + g_variant_builder_clear (&builder); + g_variant_builder_clear (&invalidated_builder); + } + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock (&skeleton->priv->lock); + return FALSE; +} + +static void +_gatt_service1_schedule_emit_changed (GattService1Skeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) +{ + ChangedProperty *cp; + GList *l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty *i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0 (ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); + g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); + g_value_copy (orig_value, &cp->orig_value); + } +} + +static void +gatt_service1_skeleton_notify (GObject *object, + GParamSpec *pspec G_GNUC_UNUSED) +{ + GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (object); + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && + skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new (); + g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gatt_service1_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); + g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gatt_service1_emit_changed"); + g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref (skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock (&skeleton->priv->lock); +} + +static void +gatt_service1_skeleton_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 4); + g_mutex_lock (&skeleton->priv->lock); + g_object_freeze_notify (object); + if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) + _gatt_service1_schedule_emit_changed (skeleton, _gatt_service1_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec (object, pspec); + } + g_mutex_unlock (&skeleton->priv->lock); + g_object_thaw_notify (object); +} + +static void +gatt_service1_skeleton_init (GattService1Skeleton *skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = gatt_service1_skeleton_get_instance_private (skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_GATT_SERVICE1_SKELETON, GattService1SkeletonPrivate); +#endif + + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); + skeleton->priv->properties = g_new0 (GValue, 4); + g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[2], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[3], G_TYPE_STRV); +} + +static const gchar * +gatt_service1_skeleton_get_uuid (GattService1 *object) +{ + GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[0])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +gatt_service1_skeleton_get_device (GattService1 *object) +{ + GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[1])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +gatt_service1_skeleton_get_primary (GattService1 *object) +{ + GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[2])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar *const * +gatt_service1_skeleton_get_characteristics (GattService1 *object) +{ + GattService1Skeleton *skeleton = GATT_SERVICE1_SKELETON (object); + const gchar *const *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boxed (&(skeleton->priv->properties[3])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static void +gatt_service1_skeleton_class_init (GattService1SkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = gatt_service1_skeleton_finalize; + gobject_class->get_property = gatt_service1_skeleton_get_property; + gobject_class->set_property = gatt_service1_skeleton_set_property; + gobject_class->notify = gatt_service1_skeleton_notify; + + + gatt_service1_override_properties (gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = gatt_service1_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = gatt_service1_skeleton_dbus_interface_get_properties; + skeleton_class->flush = gatt_service1_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = gatt_service1_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (GattService1SkeletonPrivate)); +#endif +} + +static void +gatt_service1_skeleton_iface_init (GattService1Iface *iface) +{ + iface->get_uuid = gatt_service1_skeleton_get_uuid; + iface->get_device = gatt_service1_skeleton_get_device; + iface->get_primary = gatt_service1_skeleton_get_primary; + iface->get_characteristics = gatt_service1_skeleton_get_characteristics; +} + +/** + * gatt_service1_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link>. + * + * Returns: (transfer full) (type GattService1Skeleton): The skeleton object. + */ +GattService1 * +gatt_service1_skeleton_new (void) +{ + return GATT_SERVICE1 (g_object_new (TYPE_GATT_SERVICE1_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for interface org.bluez.GattCharacteristic1 + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:GattCharacteristic1 + * @title: GattCharacteristic1 + * @short_description: Generated C code for the org.bluez.GattCharacteristic1 D-Bus interface + * + * This section contains code for working with the <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link> D-Bus interface in C. + */ + +/* ---- Introspection data for org.bluez.GattCharacteristic1 ---- */ + +static const _ExtendedGDBusArgInfo _gatt_characteristic1_method_info_read_value_OUT_ARG_value = +{ + { + -1, + (gchar *) "value", + (gchar *) "ay", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _gatt_characteristic1_method_info_read_value_OUT_ARG_pointers[] = +{ + &_gatt_characteristic1_method_info_read_value_OUT_ARG_value, + NULL +}; + +static const _ExtendedGDBusMethodInfo _gatt_characteristic1_method_info_read_value = +{ + { + -1, + (gchar *) "ReadValue", + NULL, + (GDBusArgInfo **) &_gatt_characteristic1_method_info_read_value_OUT_ARG_pointers, + NULL + }, + "handle-read-value", + FALSE +}; + +static const _ExtendedGDBusArgInfo _gatt_characteristic1_method_info_write_value_IN_ARG_value = +{ + { + -1, + (gchar *) "value", + (gchar *) "ay", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _gatt_characteristic1_method_info_write_value_IN_ARG_pointers[] = +{ + &_gatt_characteristic1_method_info_write_value_IN_ARG_value, + NULL +}; + +static const _ExtendedGDBusMethodInfo _gatt_characteristic1_method_info_write_value = +{ + { + -1, + (gchar *) "WriteValue", + (GDBusArgInfo **) &_gatt_characteristic1_method_info_write_value_IN_ARG_pointers, + NULL, + NULL + }, + "handle-write-value", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _gatt_characteristic1_method_info_start_notify = +{ + { + -1, + (gchar *) "StartNotify", + NULL, + NULL, + NULL + }, + "handle-start-notify", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _gatt_characteristic1_method_info_stop_notify = +{ + { + -1, + (gchar *) "StopNotify", + NULL, + NULL, + NULL + }, + "handle-stop-notify", + FALSE +}; + +static const _ExtendedGDBusMethodInfo * const _gatt_characteristic1_method_info_pointers[] = +{ + &_gatt_characteristic1_method_info_read_value, + &_gatt_characteristic1_method_info_write_value, + &_gatt_characteristic1_method_info_start_notify, + &_gatt_characteristic1_method_info_stop_notify, + NULL +}; + +static const _ExtendedGDBusPropertyInfo _gatt_characteristic1_property_info_uuid = +{ + { + -1, + (gchar *) "UUID", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "uuid", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _gatt_characteristic1_property_info_service = +{ + { + -1, + (gchar *) "Service", + (gchar *) "o", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "service", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _gatt_characteristic1_property_info_value = +{ + { + -1, + (gchar *) "Value", + (gchar *) "ay", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "value", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _gatt_characteristic1_property_info_notifying = +{ + { + -1, + (gchar *) "Notifying", + (gchar *) "b", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "notifying", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _gatt_characteristic1_property_info_flags = +{ + { + -1, + (gchar *) "Flags", + (gchar *) "as", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "flags", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _gatt_characteristic1_property_info_descriptors = +{ + { + -1, + (gchar *) "Descriptors", + (gchar *) "ao", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "descriptors", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo * const _gatt_characteristic1_property_info_pointers[] = +{ + &_gatt_characteristic1_property_info_uuid, + &_gatt_characteristic1_property_info_service, + &_gatt_characteristic1_property_info_value, + &_gatt_characteristic1_property_info_notifying, + &_gatt_characteristic1_property_info_flags, + &_gatt_characteristic1_property_info_descriptors, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _gatt_characteristic1_interface_info = +{ + { + -1, + (gchar *) "org.bluez.GattCharacteristic1", + (GDBusMethodInfo **) &_gatt_characteristic1_method_info_pointers, + NULL, + (GDBusPropertyInfo **) &_gatt_characteristic1_property_info_pointers, + NULL + }, + "gatt-characteristic1", +}; + + +/** + * gatt_characteristic1_interface_info: + * + * Gets a machine-readable description of the <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link> D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +gatt_characteristic1_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_gatt_characteristic1_interface_info.parent_struct; +} + +/** + * gatt_characteristic1_override_properties: + * @klass: The class structure for a #GObject<!-- -->-derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #GattCharacteristic1 interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +gatt_characteristic1_override_properties (GObjectClass *klass, guint property_id_begin) +{ + g_object_class_override_property (klass, property_id_begin++, "uuid"); + g_object_class_override_property (klass, property_id_begin++, "service"); + g_object_class_override_property (klass, property_id_begin++, "value"); + g_object_class_override_property (klass, property_id_begin++, "notifying"); + g_object_class_override_property (klass, property_id_begin++, "flags"); + g_object_class_override_property (klass, property_id_begin++, "descriptors"); + return property_id_begin - 1; +} + + + +/** + * GattCharacteristic1: + * + * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link>. + */ + +/** + * GattCharacteristic1Iface: + * @parent_iface: The parent interface. + * @handle_read_value: Handler for the #GattCharacteristic1::handle-read-value signal. + * @handle_start_notify: Handler for the #GattCharacteristic1::handle-start-notify signal. + * @handle_stop_notify: Handler for the #GattCharacteristic1::handle-stop-notify signal. + * @handle_write_value: Handler for the #GattCharacteristic1::handle-write-value signal. + * @get_descriptors: Getter for the #GattCharacteristic1:descriptors property. + * @get_flags: Getter for the #GattCharacteristic1:flags property. + * @get_notifying: Getter for the #GattCharacteristic1:notifying property. + * @get_service: Getter for the #GattCharacteristic1:service property. + * @get_uuid: Getter for the #GattCharacteristic1:uuid property. + * @get_value: Getter for the #GattCharacteristic1:value property. + * + * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link>. + */ + +typedef GattCharacteristic1Iface GattCharacteristic1Interface; +G_DEFINE_INTERFACE (GattCharacteristic1, gatt_characteristic1, G_TYPE_OBJECT); + +static void +gatt_characteristic1_default_init (GattCharacteristic1Iface *iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * GattCharacteristic1::handle-read-value: + * @object: A #GattCharacteristic1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.ReadValue">ReadValue()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call gatt_characteristic1_complete_read_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-read-value", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GattCharacteristic1Iface, handle_read_value), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * GattCharacteristic1::handle-write-value: + * @object: A #GattCharacteristic1. + * @invocation: A #GDBusMethodInvocation. + * @arg_value: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.WriteValue">WriteValue()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call gatt_characteristic1_complete_write_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-write-value", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GattCharacteristic1Iface, handle_write_value), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * GattCharacteristic1::handle-start-notify: + * @object: A #GattCharacteristic1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.StartNotify">StartNotify()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call gatt_characteristic1_complete_start_notify() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-start-notify", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GattCharacteristic1Iface, handle_start_notify), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * GattCharacteristic1::handle-stop-notify: + * @object: A #GattCharacteristic1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.StopNotify">StopNotify()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call gatt_characteristic1_complete_stop_notify() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-stop-notify", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GattCharacteristic1Iface, handle_stop_notify), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /* GObject properties for D-Bus properties: */ + /** + * GattCharacteristic1:uuid: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattCharacteristic1.UUID">"UUID"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("uuid", "UUID", "UUID", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * GattCharacteristic1:service: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Service">"Service"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("service", "Service", "Service", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * GattCharacteristic1:value: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Value">"Value"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("value", "Value", "Value", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * GattCharacteristic1:notifying: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Notifying">"Notifying"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("notifying", "Notifying", "Notifying", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * GattCharacteristic1:flags: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Flags">"Flags"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boxed ("flags", "Flags", "Flags", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * GattCharacteristic1:descriptors: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Descriptors">"Descriptors"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_boxed ("descriptors", "Descriptors", "Descriptors", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +/** + * gatt_characteristic1_get_uuid: (skip) + * @object: A #GattCharacteristic1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.UUID">"UUID"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_characteristic1_dup_uuid() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +gatt_characteristic1_get_uuid (GattCharacteristic1 *object) +{ + return GATT_CHARACTERISTIC1_GET_IFACE (object)->get_uuid (object); +} + +/** + * gatt_characteristic1_dup_uuid: (skip) + * @object: A #GattCharacteristic1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.UUID">"UUID"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +gatt_characteristic1_dup_uuid (GattCharacteristic1 *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "uuid", &value, NULL); + return value; +} + +/** + * gatt_characteristic1_set_uuid: (skip) + * @object: A #GattCharacteristic1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.UUID">"UUID"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +gatt_characteristic1_set_uuid (GattCharacteristic1 *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "uuid", value, NULL); +} + +/** + * gatt_characteristic1_get_service: (skip) + * @object: A #GattCharacteristic1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Service">"Service"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_characteristic1_dup_service() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +gatt_characteristic1_get_service (GattCharacteristic1 *object) +{ + return GATT_CHARACTERISTIC1_GET_IFACE (object)->get_service (object); +} + +/** + * gatt_characteristic1_dup_service: (skip) + * @object: A #GattCharacteristic1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Service">"Service"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +gatt_characteristic1_dup_service (GattCharacteristic1 *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "service", &value, NULL); + return value; +} + +/** + * gatt_characteristic1_set_service: (skip) + * @object: A #GattCharacteristic1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Service">"Service"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +gatt_characteristic1_set_service (GattCharacteristic1 *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "service", value, NULL); +} + +/** + * gatt_characteristic1_get_value: (skip) + * @object: A #GattCharacteristic1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Value">"Value"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_characteristic1_dup_value() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const GBytes * +gatt_characteristic1_get_value (GattCharacteristic1 *object) +{ + return GATT_CHARACTERISTIC1_GET_IFACE (object)->get_value (object); +} + +/** + * gatt_characteristic1_dup_value: (skip) + * @object: A #GattCharacteristic1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Value">"Value"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +GBytes * +gatt_characteristic1_dup_value (GattCharacteristic1 *object) +{ + GBytes *value; + g_object_get (G_OBJECT (object), "value", &value, NULL); + return value; +} + +/** + * gatt_characteristic1_set_value: (skip) + * @object: A #GattCharacteristic1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Value">"Value"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +gatt_characteristic1_set_value (GattCharacteristic1 *object, const GBytes *value) +{ + g_object_set (G_OBJECT (object), "value", value, NULL); +} + +/** + * gatt_characteristic1_get_notifying: (skip) + * @object: A #GattCharacteristic1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Notifying">"Notifying"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean +gatt_characteristic1_get_notifying (GattCharacteristic1 *object) +{ + return GATT_CHARACTERISTIC1_GET_IFACE (object)->get_notifying (object); +} + +/** + * gatt_characteristic1_set_notifying: (skip) + * @object: A #GattCharacteristic1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Notifying">"Notifying"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +gatt_characteristic1_set_notifying (GattCharacteristic1 *object, gboolean value) +{ + g_object_set (G_OBJECT (object), "notifying", value, NULL); +} + +/** + * gatt_characteristic1_get_flags: (skip) + * @object: A #GattCharacteristic1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Flags">"Flags"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_characteristic1_dup_flags() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar *const * +gatt_characteristic1_get_flags (GattCharacteristic1 *object) +{ + return GATT_CHARACTERISTIC1_GET_IFACE (object)->get_flags (object); +} + +/** + * gatt_characteristic1_dup_flags: (skip) + * @object: A #GattCharacteristic1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Flags">"Flags"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). + */ +gchar ** +gatt_characteristic1_dup_flags (GattCharacteristic1 *object) +{ + gchar **value; + g_object_get (G_OBJECT (object), "flags", &value, NULL); + return value; +} + +/** + * gatt_characteristic1_set_flags: (skip) + * @object: A #GattCharacteristic1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Flags">"Flags"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +gatt_characteristic1_set_flags (GattCharacteristic1 *object, const gchar *const *value) +{ + g_object_set (G_OBJECT (object), "flags", value, NULL); +} + +/** + * gatt_characteristic1_get_descriptors: (skip) + * @object: A #GattCharacteristic1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Descriptors">"Descriptors"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_characteristic1_dup_descriptors() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar *const * +gatt_characteristic1_get_descriptors (GattCharacteristic1 *object) +{ + return GATT_CHARACTERISTIC1_GET_IFACE (object)->get_descriptors (object); +} + +/** + * gatt_characteristic1_dup_descriptors: (skip) + * @object: A #GattCharacteristic1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Descriptors">"Descriptors"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_strfreev(). + */ +gchar ** +gatt_characteristic1_dup_descriptors (GattCharacteristic1 *object) +{ + gchar **value; + g_object_get (G_OBJECT (object), "descriptors", &value, NULL); + return value; +} + +/** + * gatt_characteristic1_set_descriptors: (skip) + * @object: A #GattCharacteristic1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-GattCharacteristic1.Descriptors">"Descriptors"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +gatt_characteristic1_set_descriptors (GattCharacteristic1 *object, const gchar *const *value) +{ + g_object_set (G_OBJECT (object), "descriptors", value, NULL); +} + +/** + * gatt_characteristic1_call_read_value: + * @proxy: A #GattCharacteristic1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.ReadValue">ReadValue()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call gatt_characteristic1_call_read_value_finish() to get the result of the operation. + * + * See gatt_characteristic1_call_read_value_sync() for the synchronous, blocking version of this method. + */ +void +gatt_characteristic1_call_read_value ( + GattCharacteristic1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "ReadValue", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * gatt_characteristic1_call_read_value_finish: + * @proxy: A #GattCharacteristic1Proxy. + * @out_value: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_characteristic1_call_read_value(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with gatt_characteristic1_call_read_value(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +gatt_characteristic1_call_read_value_finish ( + GattCharacteristic1 *proxy, + GBytes **out_value, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + GVariantIter *iter; + guchar *array; + guint i = 0; + *out_value = NULL; + + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(ay)", + &iter); + if (iter == NULL) { + g_variant_unref (_ret); + return FALSE; + } + + array = g_malloc((g_variant_iter_n_children(iter)) * sizeof(guchar)); + while (g_variant_iter_loop(iter, "y", array[i++])); + *out_value = g_bytes_new_take(array, g_variant_iter_n_children(iter)); + g_variant_iter_free(iter); + + + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * gatt_characteristic1_call_read_value_sync: + * @proxy: A #GattCharacteristic1Proxy. + * @out_value: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.ReadValue">ReadValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See gatt_characteristic1_call_read_value() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +gatt_characteristic1_call_read_value_sync ( + GattCharacteristic1 *proxy, + GBytes **out_value, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + GVariantIter *iter; + guchar *array; + guint i = 0; + *out_value = NULL; + + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "ReadValue", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(ay)", + &iter); + if (iter == NULL) { + g_variant_unref (_ret); + return FALSE; + } + + array = g_malloc((g_variant_iter_n_children(iter)) * sizeof(guchar)); + while (g_variant_iter_next(iter, "y", &array[i++])); + *out_value = g_bytes_new_take(array, g_variant_iter_n_children(iter)); + g_variant_iter_free(iter); + + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * gatt_characteristic1_call_write_value: + * @proxy: A #GattCharacteristic1Proxy. + * @arg_value: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.WriteValue">WriteValue()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call gatt_characteristic1_call_write_value_finish() to get the result of the operation. + * + * See gatt_characteristic1_call_write_value_sync() for the synchronous, blocking version of this method. + */ +void +gatt_characteristic1_call_write_value ( + GattCharacteristic1 *proxy, + GBytes *arg_value, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + GVariantBuilder *builder; + guchar const *data; + gsize size; + guint i; + + builder = g_variant_builder_new(G_VARIANT_TYPE("ay")); + if (arg_value != NULL && (data = g_bytes_get_data(arg_value, &size)) != NULL) + for (i = 0; i < size; i++) + g_variant_builder_add(builder, "y", data[i]); + + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "WriteValue", + g_variant_new ("(ay)", + builder), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); + + g_variant_builder_unref(builder); +} + +/** + * gatt_characteristic1_call_write_value_finish: + * @proxy: A #GattCharacteristic1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_characteristic1_call_write_value(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with gatt_characteristic1_call_write_value(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +gatt_characteristic1_call_write_value_finish ( + GattCharacteristic1 *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * gatt_characteristic1_call_write_value_sync: + * @proxy: A #GattCharacteristic1Proxy. + * @arg_value: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.WriteValue">WriteValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See gatt_characteristic1_call_write_value() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +gatt_characteristic1_call_write_value_sync ( + GattCharacteristic1 *proxy, + GBytes *arg_value, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + GVariantBuilder *builder; + guchar const *data; + gsize size; + guint i; + + builder = g_variant_builder_new(G_VARIANT_TYPE("ay")); + if (arg_value != NULL && (data = g_bytes_get_data(arg_value, &size)) != NULL) + for (i = 0; i < size; i++) + g_variant_builder_add(builder, "y", data[i]); + + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "WriteValue", + g_variant_new ("(ay)", + builder), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + + g_variant_builder_unref(builder); + + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * gatt_characteristic1_call_start_notify: + * @proxy: A #GattCharacteristic1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.StartNotify">StartNotify()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call gatt_characteristic1_call_start_notify_finish() to get the result of the operation. + * + * See gatt_characteristic1_call_start_notify_sync() for the synchronous, blocking version of this method. + */ +void +gatt_characteristic1_call_start_notify ( + GattCharacteristic1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "StartNotify", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * gatt_characteristic1_call_start_notify_finish: + * @proxy: A #GattCharacteristic1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_characteristic1_call_start_notify(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with gatt_characteristic1_call_start_notify(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +gatt_characteristic1_call_start_notify_finish ( + GattCharacteristic1 *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * gatt_characteristic1_call_start_notify_sync: + * @proxy: A #GattCharacteristic1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.StartNotify">StartNotify()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See gatt_characteristic1_call_start_notify() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +gatt_characteristic1_call_start_notify_sync ( + GattCharacteristic1 *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "StartNotify", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * gatt_characteristic1_call_stop_notify: + * @proxy: A #GattCharacteristic1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.StopNotify">StopNotify()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call gatt_characteristic1_call_stop_notify_finish() to get the result of the operation. + * + * See gatt_characteristic1_call_stop_notify_sync() for the synchronous, blocking version of this method. + */ +void +gatt_characteristic1_call_stop_notify ( + GattCharacteristic1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "StopNotify", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * gatt_characteristic1_call_stop_notify_finish: + * @proxy: A #GattCharacteristic1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_characteristic1_call_stop_notify(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with gatt_characteristic1_call_stop_notify(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +gatt_characteristic1_call_stop_notify_finish ( + GattCharacteristic1 *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * gatt_characteristic1_call_stop_notify_sync: + * @proxy: A #GattCharacteristic1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.StopNotify">StopNotify()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See gatt_characteristic1_call_stop_notify() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +gatt_characteristic1_call_stop_notify_sync ( + GattCharacteristic1 *proxy, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "StopNotify", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * gatt_characteristic1_complete_read_value: + * @object: A #GattCharacteristic1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @value: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.ReadValue">ReadValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +gatt_characteristic1_complete_read_value ( + GattCharacteristic1 *object, + GDBusMethodInvocation *invocation, + const gchar *value) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(^ay)", + value)); +} + +/** + * gatt_characteristic1_complete_write_value: + * @object: A #GattCharacteristic1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.WriteValue">WriteValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +gatt_characteristic1_complete_write_value ( + GattCharacteristic1 *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * gatt_characteristic1_complete_start_notify: + * @object: A #GattCharacteristic1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.StartNotify">StartNotify()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +gatt_characteristic1_complete_start_notify ( + GattCharacteristic1 *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/** + * gatt_characteristic1_complete_stop_notify: + * @object: A #GattCharacteristic1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-GattCharacteristic1.StopNotify">StopNotify()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +gatt_characteristic1_complete_stop_notify ( + GattCharacteristic1 *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * GattCharacteristic1Proxy: + * + * The #GattCharacteristic1Proxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * GattCharacteristic1ProxyClass: + * @parent_class: The parent class. + * + * Class structure for #GattCharacteristic1Proxy. + */ + +struct _GattCharacteristic1ProxyPrivate +{ + GData *qdata; +}; + +static void gatt_characteristic1_proxy_iface_init (GattCharacteristic1Iface *iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (GattCharacteristic1Proxy, gatt_characteristic1_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE (GattCharacteristic1Proxy) + G_IMPLEMENT_INTERFACE (TYPE_GATT_CHARACTERISTIC1, gatt_characteristic1_proxy_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (GattCharacteristic1Proxy, gatt_characteristic1_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_GATT_CHARACTERISTIC1, gatt_characteristic1_proxy_iface_init)); + +#endif +static void +gatt_characteristic1_proxy_finalize (GObject *object) +{ + GattCharacteristic1Proxy *proxy = GATT_CHARACTERISTIC1_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (gatt_characteristic1_proxy_parent_class)->finalize (object); +} + +static void +gatt_characteristic1_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 6); + info = _gatt_characteristic1_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant (value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue (variant, value); + } + if (variant != NULL) + g_variant_unref (variant); +} + +static void +gatt_characteristic1_proxy_set_property_cb (GDBusProxy *proxy, + GAsyncResult *res, + gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo *info = user_data; + GError *error; + GVariant *_ret; + error = NULL; + _ret = g_dbus_proxy_call_finish (proxy, res, &error); + if (!_ret) + { + g_warning ("Error setting property '%s' on interface org.bluez.GattCharacteristic1: %s (%s, %d)", + info->parent_struct.name, + error->message, g_quark_to_string (error->domain), error->code); + g_error_free (error); + } + else + { + g_variant_unref (_ret); + } +} + +static void +gatt_characteristic1_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 6); + info = _gatt_characteristic1_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_dbus_proxy_call (G_DBUS_PROXY (object), + "org.freedesktop.DBus.Properties.Set", + g_variant_new ("(ssv)", "org.bluez.GattCharacteristic1", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, (GAsyncReadyCallback) gatt_characteristic1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); + g_variant_unref (variant); +} + +static void +gatt_characteristic1_proxy_g_signal (GDBusProxy *proxy, + const gchar *sender_name G_GNUC_UNUSED, + const gchar *signal_name, + GVariant *parameters) +{ + _ExtendedGDBusSignalInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gatt_characteristic1_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children (parameters); + paramv = g_new0 (GValue, num_params + 1); + g_value_init (¶mv[0], TYPE_GATT_CHARACTERISTIC1); + g_value_set_object (¶mv[0], proxy); + g_variant_iter_init (&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_GATT_CHARACTERISTIC1); + g_signal_emitv (paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static void +gatt_characteristic1_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + GattCharacteristic1Proxy *proxy = GATT_CHARACTERISTIC1_PROXY (_proxy); + guint n; + const gchar *key; + GVariantIter *iter; + _ExtendedGDBusPropertyInfo *info; + g_variant_get (changed_properties, "a{sv}", &iter); + while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_characteristic1_interface_info.parent_struct, key); + g_datalist_remove_data (&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } + g_variant_iter_free (iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_characteristic1_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } +} + +static const gchar * +gatt_characteristic1_proxy_get_uuid (GattCharacteristic1 *object) +{ + GattCharacteristic1Proxy *proxy = GATT_CHARACTERISTIC1_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "UUID"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +gatt_characteristic1_proxy_get_service (GattCharacteristic1 *object) +{ + GattCharacteristic1Proxy *proxy = GATT_CHARACTERISTIC1_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Service"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const GBytes * +gatt_characteristic1_proxy_get_value (GattCharacteristic1 *object) +{ + GattCharacteristic1Proxy *proxy = GATT_CHARACTERISTIC1_PROXY (object); + GVariant *variant; + GVariantIter *iter; + guchar *array; + guint i = 0; + GBytes *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Value"); + if (variant != NULL) + { + g_variant_get (variant, "(ay)", &iter); + + array = g_malloc((g_variant_iter_n_children(iter)) * sizeof(guchar)); + while (g_variant_iter_loop(iter, "y", array[i++])); + value = g_bytes_new_take(array, g_variant_iter_n_children(iter)); + g_variant_iter_free(iter); + + g_variant_unref (variant); + } + return value; +} + +static gboolean +gatt_characteristic1_proxy_get_notifying (GattCharacteristic1 *object) +{ + GattCharacteristic1Proxy *proxy = GATT_CHARACTERISTIC1_PROXY (object); + GVariant *variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Notifying"); + if (variant != NULL) + { + value = g_variant_get_boolean (variant); + g_variant_unref (variant); + } + return value; +} + +static const gchar *const * +gatt_characteristic1_proxy_get_flags (GattCharacteristic1 *object) +{ + GattCharacteristic1Proxy *proxy = GATT_CHARACTERISTIC1_PROXY (object); + GVariant *variant; + const gchar *const *value = NULL; + value = g_datalist_get_data (&proxy->priv->qdata, "Flags"); + if (value != NULL) + return value; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Flags"); + if (variant != NULL) + { + value = g_variant_get_strv (variant, NULL); + g_datalist_set_data_full (&proxy->priv->qdata, "Flags", (gpointer) value, g_free); + g_variant_unref (variant); + } + return value; +} + +static const gchar *const * +gatt_characteristic1_proxy_get_descriptors (GattCharacteristic1 *object) +{ + GattCharacteristic1Proxy *proxy = GATT_CHARACTERISTIC1_PROXY (object); + GVariant *variant; + const gchar *const *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Descriptors"); + if (variant != NULL) + { + value = g_variant_get_objv (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static void +gatt_characteristic1_proxy_init (GattCharacteristic1Proxy *proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = gatt_characteristic1_proxy_get_instance_private (proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_GATT_CHARACTERISTIC1_PROXY, GattCharacteristic1ProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gatt_characteristic1_interface_info ()); +} + +static void +gatt_characteristic1_proxy_class_init (GattCharacteristic1ProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = gatt_characteristic1_proxy_finalize; + gobject_class->get_property = gatt_characteristic1_proxy_get_property; + gobject_class->set_property = gatt_characteristic1_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = gatt_characteristic1_proxy_g_signal; + proxy_class->g_properties_changed = gatt_characteristic1_proxy_g_properties_changed; + + gatt_characteristic1_override_properties (gobject_class, 1); + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (GattCharacteristic1ProxyPrivate)); +#endif +} + +static void +gatt_characteristic1_proxy_iface_init (GattCharacteristic1Iface *iface) +{ + iface->get_uuid = gatt_characteristic1_proxy_get_uuid; + iface->get_service = gatt_characteristic1_proxy_get_service; + iface->get_value = gatt_characteristic1_proxy_get_value; + iface->get_notifying = gatt_characteristic1_proxy_get_notifying; + iface->get_flags = gatt_characteristic1_proxy_get_flags; + iface->get_descriptors = gatt_characteristic1_proxy_get_descriptors; +} + +/** + * gatt_characteristic1_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link>. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call gatt_characteristic1_proxy_new_finish() to get the result of the operation. + * + * See gatt_characteristic1_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +gatt_characteristic1_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_GATT_CHARACTERISTIC1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.GattCharacteristic1", NULL); +} + +/** + * gatt_characteristic1_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_characteristic1_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with gatt_characteristic1_proxy_new(). + * + * Returns: (transfer full) (type GattCharacteristic1Proxy): The constructed proxy object or %NULL if @error is set. + */ +GattCharacteristic1 * +gatt_characteristic1_proxy_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return GATT_CHARACTERISTIC1 (ret); + else + return NULL; +} + +/** + * gatt_characteristic1_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link>. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See gatt_characteristic1_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type GattCharacteristic1Proxy): The constructed proxy object or %NULL if @error is set. + */ +GattCharacteristic1 * +gatt_characteristic1_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_GATT_CHARACTERISTIC1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.GattCharacteristic1", NULL); + if (ret != NULL) + return GATT_CHARACTERISTIC1 (ret); + else + return NULL; +} + + +/** + * gatt_characteristic1_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like gatt_characteristic1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call gatt_characteristic1_proxy_new_for_bus_finish() to get the result of the operation. + * + * See gatt_characteristic1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +gatt_characteristic1_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_GATT_CHARACTERISTIC1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.GattCharacteristic1", NULL); +} + +/** + * gatt_characteristic1_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_characteristic1_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with gatt_characteristic1_proxy_new_for_bus(). + * + * Returns: (transfer full) (type GattCharacteristic1Proxy): The constructed proxy object or %NULL if @error is set. + */ +GattCharacteristic1 * +gatt_characteristic1_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return GATT_CHARACTERISTIC1 (ret); + else + return NULL; +} + +/** + * gatt_characteristic1_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like gatt_characteristic1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See gatt_characteristic1_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type GattCharacteristic1Proxy): The constructed proxy object or %NULL if @error is set. + */ +GattCharacteristic1 * +gatt_characteristic1_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_GATT_CHARACTERISTIC1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.GattCharacteristic1", NULL); + if (ret != NULL) + return GATT_CHARACTERISTIC1 (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * GattCharacteristic1Skeleton: + * + * The #GattCharacteristic1Skeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * GattCharacteristic1SkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #GattCharacteristic1Skeleton. + */ + +struct _GattCharacteristic1SkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_gatt_characteristic1_skeleton_handle_method_call ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (user_data); + _ExtendedGDBusMethodInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint num_extra; + guint n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); + g_assert (info != NULL); + num_params = g_variant_n_children (parameters); + num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); + n = 0; + g_value_init (¶mv[n], TYPE_GATT_CHARACTERISTIC1); + g_value_set_object (¶mv[n++], skeleton); + g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object (¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); +#else + g_assert_not_reached (); +#endif + } + g_variant_iter_init (&iter, parameters); + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_GATT_CHARACTERISTIC1); + g_value_init (&return_value, G_TYPE_BOOLEAN); + g_signal_emitv (paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean (&return_value)) + g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset (&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static GVariant * +_gatt_characteristic1_skeleton_handle_get_property ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name G_GNUC_UNUSED, + const gchar *property_name, + GError **error, + gpointer user_data) +{ + GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + GVariant *ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_characteristic1_interface_info.parent_struct, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init (&value, pspec->value_type); + g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_value_unset (&value); + } + return ret; +} + +static gboolean +_gatt_characteristic1_skeleton_handle_set_property ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name G_GNUC_UNUSED, + const gchar *property_name, + GVariant *variant, + GError **error, + gpointer user_data) +{ + GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_characteristic1_interface_info.parent_struct, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant (&value, variant); + else + g_dbus_gvariant_to_gvalue (variant, &value); + g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); + g_value_unset (&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _gatt_characteristic1_skeleton_vtable = +{ + _gatt_characteristic1_skeleton_handle_method_call, + _gatt_characteristic1_skeleton_handle_get_property, + _gatt_characteristic1_skeleton_handle_set_property, + {NULL} +}; + +static GDBusInterfaceInfo * +gatt_characteristic1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return gatt_characteristic1_interface_info (); +} + +static GDBusInterfaceVTable * +gatt_characteristic1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_gatt_characteristic1_skeleton_vtable; +} + +static GVariant * +gatt_characteristic1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_gatt_characteristic1_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _gatt_characteristic1_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _gatt_characteristic1_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + value = _gatt_characteristic1_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.bluez.GattCharacteristic1", info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref (value); + g_variant_builder_add (&builder, "{sv}", info->name, value); + g_variant_unref (value); + } + } + } +out: + return g_variant_builder_end (&builder); +} + +static gboolean _gatt_characteristic1_emit_changed (gpointer user_data); + +static void +gatt_characteristic1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ + GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy (skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock (&skeleton->priv->lock); + + if (emit_changed) + _gatt_characteristic1_emit_changed (skeleton); +} + +static void gatt_characteristic1_skeleton_iface_init (GattCharacteristic1Iface *iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (GattCharacteristic1Skeleton, gatt_characteristic1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE (GattCharacteristic1Skeleton) + G_IMPLEMENT_INTERFACE (TYPE_GATT_CHARACTERISTIC1, gatt_characteristic1_skeleton_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (GattCharacteristic1Skeleton, gatt_characteristic1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_GATT_CHARACTERISTIC1, gatt_characteristic1_skeleton_iface_init)); + +#endif +static void +gatt_characteristic1_skeleton_finalize (GObject *object) +{ + GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); + guint n; + for (n = 0; n < 6; n++) + g_value_unset (&skeleton->priv->properties[n]); + g_free (skeleton->priv->properties); + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy (skeleton->priv->changed_properties_idle_source); + g_main_context_unref (skeleton->priv->context); + g_mutex_clear (&skeleton->priv->lock); + G_OBJECT_CLASS (gatt_characteristic1_skeleton_parent_class)->finalize (object); +} + +static void +gatt_characteristic1_skeleton_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 6); + g_mutex_lock (&skeleton->priv->lock); + g_value_copy (&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock (&skeleton->priv->lock); +} + +static gboolean +_gatt_characteristic1_emit_changed (gpointer user_data) +{ + GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (user_data); + GList *l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock (&skeleton->priv->lock); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty *cp = l->data; + GVariant *variant; + const GValue *cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal (cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); + g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref (variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *ll; + GVariant *signal_variant; + signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.bluez.GattCharacteristic1", + &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + for (ll = connections; ll != NULL; ll = ll->next) + { + GDBusConnection *connection = ll->data; + + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + signal_variant, + NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); + } + else + { + g_variant_builder_clear (&builder); + g_variant_builder_clear (&invalidated_builder); + } + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock (&skeleton->priv->lock); + return FALSE; +} + +static void +_gatt_characteristic1_schedule_emit_changed (GattCharacteristic1Skeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) +{ + ChangedProperty *cp; + GList *l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty *i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0 (ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); + g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); + g_value_copy (orig_value, &cp->orig_value); + } +} + +static void +gatt_characteristic1_skeleton_notify (GObject *object, + GParamSpec *pspec G_GNUC_UNUSED) +{ + GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && + skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new (); + g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gatt_characteristic1_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); + g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gatt_characteristic1_emit_changed"); + g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref (skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock (&skeleton->priv->lock); +} + +static void +gatt_characteristic1_skeleton_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 6); + g_mutex_lock (&skeleton->priv->lock); + g_object_freeze_notify (object); + if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) + _gatt_characteristic1_schedule_emit_changed (skeleton, _gatt_characteristic1_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec (object, pspec); + } + g_mutex_unlock (&skeleton->priv->lock); + g_object_thaw_notify (object); +} + +static void +gatt_characteristic1_skeleton_init (GattCharacteristic1Skeleton *skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = gatt_characteristic1_skeleton_get_instance_private (skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_GATT_CHARACTERISTIC1_SKELETON, GattCharacteristic1SkeletonPrivate); +#endif + + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); + skeleton->priv->properties = g_new0 (GValue, 6); + g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[3], G_TYPE_BOOLEAN); + g_value_init (&skeleton->priv->properties[4], G_TYPE_STRV); + g_value_init (&skeleton->priv->properties[5], G_TYPE_STRV); +} + +static const gchar * +gatt_characteristic1_skeleton_get_uuid (GattCharacteristic1 *object) +{ + GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[0])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +gatt_characteristic1_skeleton_get_service (GattCharacteristic1 *object) +{ + GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[1])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const GBytes * +gatt_characteristic1_skeleton_get_value (GattCharacteristic1 *object) +{ + GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); + const GBytes *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boxed (&(skeleton->priv->properties[2])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static gboolean +gatt_characteristic1_skeleton_get_notifying (GattCharacteristic1 *object) +{ + GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); + gboolean value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boolean (&(skeleton->priv->properties[3])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar *const * +gatt_characteristic1_skeleton_get_flags (GattCharacteristic1 *object) +{ + GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); + const gchar *const *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boxed (&(skeleton->priv->properties[4])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar *const * +gatt_characteristic1_skeleton_get_descriptors (GattCharacteristic1 *object) +{ + GattCharacteristic1Skeleton *skeleton = GATT_CHARACTERISTIC1_SKELETON (object); + const gchar *const *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boxed (&(skeleton->priv->properties[5])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static void +gatt_characteristic1_skeleton_class_init (GattCharacteristic1SkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = gatt_characteristic1_skeleton_finalize; + gobject_class->get_property = gatt_characteristic1_skeleton_get_property; + gobject_class->set_property = gatt_characteristic1_skeleton_set_property; + gobject_class->notify = gatt_characteristic1_skeleton_notify; + + + gatt_characteristic1_override_properties (gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = gatt_characteristic1_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = gatt_characteristic1_skeleton_dbus_interface_get_properties; + skeleton_class->flush = gatt_characteristic1_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = gatt_characteristic1_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (GattCharacteristic1SkeletonPrivate)); +#endif +} + +static void +gatt_characteristic1_skeleton_iface_init (GattCharacteristic1Iface *iface) +{ + iface->get_uuid = gatt_characteristic1_skeleton_get_uuid; + iface->get_service = gatt_characteristic1_skeleton_get_service; + iface->get_value = gatt_characteristic1_skeleton_get_value; + iface->get_notifying = gatt_characteristic1_skeleton_get_notifying; + iface->get_flags = gatt_characteristic1_skeleton_get_flags; + iface->get_descriptors = gatt_characteristic1_skeleton_get_descriptors; +} + +/** + * gatt_characteristic1_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link>. + * + * Returns: (transfer full) (type GattCharacteristic1Skeleton): The skeleton object. + */ +GattCharacteristic1 * +gatt_characteristic1_skeleton_new (void) +{ + return GATT_CHARACTERISTIC1 (g_object_new (TYPE_GATT_CHARACTERISTIC1_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for interface org.bluez.GattDescriptor1 + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:GattDescriptor1 + * @title: GattDescriptor1 + * @short_description: Generated C code for the org.bluez.GattDescriptor1 D-Bus interface + * + * This section contains code for working with the <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link> D-Bus interface in C. + */ + +/* ---- Introspection data for org.bluez.GattDescriptor1 ---- */ + +static const _ExtendedGDBusArgInfo _gatt_descriptor1_method_info_read_value_OUT_ARG_value = +{ + { + -1, + (gchar *) "value", + (gchar *) "ay", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _gatt_descriptor1_method_info_read_value_OUT_ARG_pointers[] = +{ + &_gatt_descriptor1_method_info_read_value_OUT_ARG_value, + NULL +}; + +static const _ExtendedGDBusMethodInfo _gatt_descriptor1_method_info_read_value = +{ + { + -1, + (gchar *) "ReadValue", + NULL, + (GDBusArgInfo **) &_gatt_descriptor1_method_info_read_value_OUT_ARG_pointers, + NULL + }, + "handle-read-value", + FALSE +}; + +static const _ExtendedGDBusArgInfo _gatt_descriptor1_method_info_write_value_IN_ARG_value = +{ + { + -1, + (gchar *) "value", + (gchar *) "ay", + NULL + }, + FALSE +}; + +static const _ExtendedGDBusArgInfo * const _gatt_descriptor1_method_info_write_value_IN_ARG_pointers[] = +{ + &_gatt_descriptor1_method_info_write_value_IN_ARG_value, + NULL +}; + +static const _ExtendedGDBusMethodInfo _gatt_descriptor1_method_info_write_value = +{ + { + -1, + (gchar *) "WriteValue", + (GDBusArgInfo **) &_gatt_descriptor1_method_info_write_value_IN_ARG_pointers, + NULL, + NULL + }, + "handle-write-value", + FALSE +}; + +static const _ExtendedGDBusMethodInfo * const _gatt_descriptor1_method_info_pointers[] = +{ + &_gatt_descriptor1_method_info_read_value, + &_gatt_descriptor1_method_info_write_value, + NULL +}; + +static const _ExtendedGDBusPropertyInfo _gatt_descriptor1_property_info_uuid = +{ + { + -1, + (gchar *) "UUID", + (gchar *) "s", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "uuid", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _gatt_descriptor1_property_info_characteristic = +{ + { + -1, + (gchar *) "Characteristic", + (gchar *) "o", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "characteristic", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo _gatt_descriptor1_property_info_value = +{ + { + -1, + (gchar *) "Value", + (gchar *) "ay", + G_DBUS_PROPERTY_INFO_FLAGS_READABLE, + NULL + }, + "value", + FALSE +}; + +static const _ExtendedGDBusPropertyInfo * const _gatt_descriptor1_property_info_pointers[] = +{ + &_gatt_descriptor1_property_info_uuid, + &_gatt_descriptor1_property_info_characteristic, + &_gatt_descriptor1_property_info_value, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _gatt_descriptor1_interface_info = +{ + { + -1, + (gchar *) "org.bluez.GattDescriptor1", + (GDBusMethodInfo **) &_gatt_descriptor1_method_info_pointers, + NULL, + (GDBusPropertyInfo **) &_gatt_descriptor1_property_info_pointers, + NULL + }, + "gatt-descriptor1", +}; + + +/** + * gatt_descriptor1_interface_info: + * + * Gets a machine-readable description of the <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link> D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * +gatt_descriptor1_interface_info (void) +{ + return (GDBusInterfaceInfo *) &_gatt_descriptor1_interface_info.parent_struct; +} + +/** + * gatt_descriptor1_override_properties: + * @klass: The class structure for a #GObject<!-- -->-derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #GattDescriptor1 interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint +gatt_descriptor1_override_properties (GObjectClass *klass, guint property_id_begin) +{ + g_object_class_override_property (klass, property_id_begin++, "uuid"); + g_object_class_override_property (klass, property_id_begin++, "characteristic"); + g_object_class_override_property (klass, property_id_begin++, "value"); + return property_id_begin - 1; +} + + + +/** + * GattDescriptor1: + * + * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link>. + */ + +/** + * GattDescriptor1Iface: + * @parent_iface: The parent interface. + * @handle_read_value: Handler for the #GattDescriptor1::handle-read-value signal. + * @handle_write_value: Handler for the #GattDescriptor1::handle-write-value signal. + * @get_characteristic: Getter for the #GattDescriptor1:characteristic property. + * @get_uuid: Getter for the #GattDescriptor1:uuid property. + * @get_value: Getter for the #GattDescriptor1:value property. + * + * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link>. + */ + +typedef GattDescriptor1Iface GattDescriptor1Interface; +G_DEFINE_INTERFACE (GattDescriptor1, gatt_descriptor1, G_TYPE_OBJECT); + +static void +gatt_descriptor1_default_init (GattDescriptor1Iface *iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * GattDescriptor1::handle-read-value: + * @object: A #GattDescriptor1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-GattDescriptor1.ReadValue">ReadValue()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call gatt_descriptor1_complete_read_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-read-value", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GattDescriptor1Iface, handle_read_value), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * GattDescriptor1::handle-write-value: + * @object: A #GattDescriptor1. + * @invocation: A #GDBusMethodInvocation. + * @arg_value: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-bluez-GattDescriptor1.WriteValue">WriteValue()</link> D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call gatt_descriptor1_complete_write_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new ("handle-write-value", + G_TYPE_FROM_INTERFACE (iface), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GattDescriptor1Iface, handle_write_value), + g_signal_accumulator_true_handled, + NULL, + g_cclosure_marshal_generic, + G_TYPE_BOOLEAN, + 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /* GObject properties for D-Bus properties: */ + /** + * GattDescriptor1:uuid: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattDescriptor1.UUID">"UUID"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("uuid", "UUID", "UUID", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * GattDescriptor1:characteristic: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattDescriptor1.Characteristic">"Characteristic"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("characteristic", "Characteristic", "Characteristic", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * GattDescriptor1:value: + * + * Represents the D-Bus property <link linkend="gdbus-property-org-bluez-GattDescriptor1.Value">"Value"</link>. + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property (iface, + g_param_spec_string ("value", "Value", "Value", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +/** + * gatt_descriptor1_get_uuid: (skip) + * @object: A #GattDescriptor1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-GattDescriptor1.UUID">"UUID"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_descriptor1_dup_uuid() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +gatt_descriptor1_get_uuid (GattDescriptor1 *object) +{ + return GATT_DESCRIPTOR1_GET_IFACE (object)->get_uuid (object); +} + +/** + * gatt_descriptor1_dup_uuid: (skip) + * @object: A #GattDescriptor1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattDescriptor1.UUID">"UUID"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +gatt_descriptor1_dup_uuid (GattDescriptor1 *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "uuid", &value, NULL); + return value; +} + +/** + * gatt_descriptor1_set_uuid: (skip) + * @object: A #GattDescriptor1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-GattDescriptor1.UUID">"UUID"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +gatt_descriptor1_set_uuid (GattDescriptor1 *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "uuid", value, NULL); +} + +/** + * gatt_descriptor1_get_characteristic: (skip) + * @object: A #GattDescriptor1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-GattDescriptor1.Characteristic">"Characteristic"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_descriptor1_dup_characteristic() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const gchar * +gatt_descriptor1_get_characteristic (GattDescriptor1 *object) +{ + return GATT_DESCRIPTOR1_GET_IFACE (object)->get_characteristic (object); +} + +/** + * gatt_descriptor1_dup_characteristic: (skip) + * @object: A #GattDescriptor1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattDescriptor1.Characteristic">"Characteristic"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +gchar * +gatt_descriptor1_dup_characteristic (GattDescriptor1 *object) +{ + gchar *value; + g_object_get (G_OBJECT (object), "characteristic", &value, NULL); + return value; +} + +/** + * gatt_descriptor1_set_characteristic: (skip) + * @object: A #GattDescriptor1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-GattDescriptor1.Characteristic">"Characteristic"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +gatt_descriptor1_set_characteristic (GattDescriptor1 *object, const gchar *value) +{ + g_object_set (G_OBJECT (object), "characteristic", value, NULL); +} + +/** + * gatt_descriptor1_get_value: (skip) + * @object: A #GattDescriptor1. + * + * Gets the value of the <link linkend="gdbus-property-org-bluez-GattDescriptor1.Value">"Value"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use gatt_descriptor1_dup_value() if on another thread.</warning> + * + * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object. + */ +const GBytes * +gatt_descriptor1_get_value (GattDescriptor1 *object) +{ + return GATT_DESCRIPTOR1_GET_IFACE (object)->get_value (object); +} + +/** + * gatt_descriptor1_dup_value: (skip) + * @object: A #GattDescriptor1. + * + * Gets a copy of the <link linkend="gdbus-property-org-bluez-GattDescriptor1.Value">"Value"</link> D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free(). + */ +GBytes * +gatt_descriptor1_dup_value (GattDescriptor1 *object) +{ + GBytes *value; + g_object_get (G_OBJECT (object), "value", &value, NULL); + return value; +} + +/** + * gatt_descriptor1_set_value: (skip) + * @object: A #GattDescriptor1. + * @value: The value to set. + * + * Sets the <link linkend="gdbus-property-org-bluez-GattDescriptor1.Value">"Value"</link> D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void +gatt_descriptor1_set_value (GattDescriptor1 *object, const GBytes *value) +{ + g_object_set (G_OBJECT (object), "value", value, NULL); +} + +/** + * gatt_descriptor1_call_read_value: + * @proxy: A #GattDescriptor1Proxy. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-GattDescriptor1.ReadValue">ReadValue()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call gatt_descriptor1_call_read_value_finish() to get the result of the operation. + * + * See gatt_descriptor1_call_read_value_sync() for the synchronous, blocking version of this method. + */ +void +gatt_descriptor1_call_read_value ( + GattDescriptor1 *proxy, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "ReadValue", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); +} + +/** + * gatt_descriptor1_call_read_value_finish: + * @proxy: A #GattDescriptor1Proxy. + * @out_value: (out): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_descriptor1_call_read_value(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with gatt_descriptor1_call_read_value(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +gatt_descriptor1_call_read_value_finish ( + GattDescriptor1 *proxy, + GBytes **out_value, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + GVariantIter *iter; + guchar *array; + guint i = 0; + *out_value = NULL; + + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(ay)", + &iter); + + array = g_malloc((g_variant_iter_n_children(iter)) * sizeof(guchar)); + while (g_variant_iter_loop(iter, "y", array[i++])); + *out_value = g_bytes_new_take(array, g_variant_iter_n_children(iter)); + g_variant_iter_free(iter); + + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * gatt_descriptor1_call_read_value_sync: + * @proxy: A #GattDescriptor1Proxy. + * @out_value: (out): Return location for return parameter or %NULL to ignore. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-bluez-GattDescriptor1.ReadValue">ReadValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See gatt_descriptor1_call_read_value() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +gatt_descriptor1_call_read_value_sync ( + GattDescriptor1 *proxy, + GBytes **out_value, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + GVariantIter *iter; + guchar *array; + guint i = 0; + *out_value = NULL; + + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "ReadValue", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "(ay)", + &iter); + + array = g_malloc((g_variant_iter_n_children(iter)) * sizeof(guchar)); + while (g_variant_iter_loop(iter, "y", array[i++])); + *out_value = g_bytes_new_take(array, g_variant_iter_n_children(iter)); + g_variant_iter_free(iter); + + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * gatt_descriptor1_call_write_value: + * @proxy: A #GattDescriptor1Proxy. + * @arg_value: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the <link linkend="gdbus-method-org-bluez-GattDescriptor1.WriteValue">WriteValue()</link> D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call gatt_descriptor1_call_write_value_finish() to get the result of the operation. + * + * See gatt_descriptor1_call_write_value_sync() for the synchronous, blocking version of this method. + */ +void +gatt_descriptor1_call_write_value ( + GattDescriptor1 *proxy, + GBytes *arg_value, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + GVariantBuilder *builder; + guchar const *data; + gsize size; + guint i; + + builder = g_variant_builder_new(G_VARIANT_TYPE("ay")); + if (arg_value != NULL && (data = g_bytes_get_data(arg_value, &size)) != NULL) + for (i = 0; i < size; i++) + g_variant_builder_add(builder, "y", data[i]); + + g_dbus_proxy_call (G_DBUS_PROXY (proxy), + "WriteValue", + g_variant_new ("(ay)", + builder), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + callback, + user_data); + + g_variant_builder_unref(builder); +} + +/** + * gatt_descriptor1_call_write_value_finish: + * @proxy: A #GattDescriptor1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_descriptor1_call_write_value(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with gatt_descriptor1_call_write_value(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +gatt_descriptor1_call_write_value_finish ( + GattDescriptor1 *proxy, + GAsyncResult *res, + GError **error) +{ + GVariant *_ret; + _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * gatt_descriptor1_call_write_value_sync: + * @proxy: A #GattDescriptor1Proxy. + * @arg_value: Argument to pass with the method invocation. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the <link linkend="gdbus-method-org-bluez-GattDescriptor1.WriteValue">WriteValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See gatt_descriptor1_call_write_value() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean +gatt_descriptor1_call_write_value_sync ( + GattDescriptor1 *proxy, + GBytes *arg_value, + GCancellable *cancellable, + GError **error) +{ + GVariant *_ret; + GVariantBuilder *builder; + guchar const *data; + gsize size; + guint i; + + builder = g_variant_builder_new(G_VARIANT_TYPE("ay")); + if (arg_value != NULL && (data = g_bytes_get_data(arg_value, &size)) != NULL) + for (i = 0; i < size; i++) + g_variant_builder_add(builder, "y", data[i]); + + _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), + "WriteValue", + g_variant_new ("(ay)", + builder), + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, + error); + + g_variant_builder_unref(builder); + + if (_ret == NULL) + goto _out; + g_variant_get (_ret, + "()"); + g_variant_unref (_ret); +_out: + return _ret != NULL; +} + +/** + * gatt_descriptor1_complete_read_value: + * @object: A #GattDescriptor1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @value: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-GattDescriptor1.ReadValue">ReadValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +gatt_descriptor1_complete_read_value ( + GattDescriptor1 *object, + GDBusMethodInvocation *invocation, + const gchar *value) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("(^ay)", + value)); +} + +/** + * gatt_descriptor1_complete_write_value: + * @object: A #GattDescriptor1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-bluez-GattDescriptor1.WriteValue">WriteValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void +gatt_descriptor1_complete_write_value ( + GattDescriptor1 *object, + GDBusMethodInvocation *invocation) +{ + g_dbus_method_invocation_return_value (invocation, + g_variant_new ("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * GattDescriptor1Proxy: + * + * The #GattDescriptor1Proxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * GattDescriptor1ProxyClass: + * @parent_class: The parent class. + * + * Class structure for #GattDescriptor1Proxy. + */ + +struct _GattDescriptor1ProxyPrivate +{ + GData *qdata; +}; + +static void gatt_descriptor1_proxy_iface_init (GattDescriptor1Iface *iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (GattDescriptor1Proxy, gatt_descriptor1_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE (GattDescriptor1Proxy) + G_IMPLEMENT_INTERFACE (TYPE_GATT_DESCRIPTOR1, gatt_descriptor1_proxy_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (GattDescriptor1Proxy, gatt_descriptor1_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_GATT_DESCRIPTOR1, gatt_descriptor1_proxy_iface_init)); + +#endif +static void +gatt_descriptor1_proxy_finalize (GObject *object) +{ + GattDescriptor1Proxy *proxy = GATT_DESCRIPTOR1_PROXY (object); + g_datalist_clear (&proxy->priv->qdata); + G_OBJECT_CLASS (gatt_descriptor1_proxy_parent_class)->finalize (object); +} + +static void +gatt_descriptor1_proxy_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 3); + info = _gatt_descriptor1_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant (value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue (variant, value); + } + if (variant != NULL) + g_variant_unref (variant); +} + +static void +gatt_descriptor1_proxy_set_property_cb (GDBusProxy *proxy, + GAsyncResult *res, + gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo *info = user_data; + GError *error; + GVariant *_ret; + error = NULL; + _ret = g_dbus_proxy_call_finish (proxy, res, &error); + if (!_ret) + { + g_warning ("Error setting property '%s' on interface org.bluez.GattDescriptor1: %s (%s, %d)", + info->parent_struct.name, + error->message, g_quark_to_string (error->domain), error->code); + g_error_free (error); + } + else + { + g_variant_unref (_ret); + } +} + +static void +gatt_descriptor1_proxy_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo *info; + GVariant *variant; + g_assert (prop_id != 0 && prop_id - 1 < 3); + info = _gatt_descriptor1_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_dbus_proxy_call (G_DBUS_PROXY (object), + "org.freedesktop.DBus.Properties.Set", + g_variant_new ("(ssv)", "org.bluez.GattDescriptor1", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, (GAsyncReadyCallback) gatt_descriptor1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); + g_variant_unref (variant); +} + +static void +gatt_descriptor1_proxy_g_signal (GDBusProxy *proxy, + const gchar *sender_name G_GNUC_UNUSED, + const gchar *signal_name, + GVariant *parameters) +{ + _ExtendedGDBusSignalInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_gatt_descriptor1_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children (parameters); + paramv = g_new0 (GValue, num_params + 1); + g_value_init (¶mv[0], TYPE_GATT_DESCRIPTOR1); + g_value_set_object (¶mv[0], proxy); + g_variant_iter_init (&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_GATT_DESCRIPTOR1); + g_signal_emitv (paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static void +gatt_descriptor1_proxy_g_properties_changed (GDBusProxy *_proxy, + GVariant *changed_properties, + const gchar *const *invalidated_properties) +{ + GattDescriptor1Proxy *proxy = GATT_DESCRIPTOR1_PROXY (_proxy); + guint n; + const gchar *key; + GVariantIter *iter; + _ExtendedGDBusPropertyInfo *info; + g_variant_get (changed_properties, "a{sv}", &iter); + while (g_variant_iter_next (iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_descriptor1_interface_info.parent_struct, key); + g_datalist_remove_data (&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } + g_variant_iter_free (iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_descriptor1_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify (G_OBJECT (proxy), info->hyphen_name); + } +} + +static const gchar * +gatt_descriptor1_proxy_get_uuid (GattDescriptor1 *object) +{ + GattDescriptor1Proxy *proxy = GATT_DESCRIPTOR1_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "UUID"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const gchar * +gatt_descriptor1_proxy_get_characteristic (GattDescriptor1 *object) +{ + GattDescriptor1Proxy *proxy = GATT_DESCRIPTOR1_PROXY (object); + GVariant *variant; + const gchar *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Characteristic"); + if (variant != NULL) + { + value = g_variant_get_string (variant, NULL); + g_variant_unref (variant); + } + return value; +} + +static const GBytes * +gatt_descriptor1_proxy_get_value (GattDescriptor1 *object) +{ + GattDescriptor1Proxy *proxy = GATT_DESCRIPTOR1_PROXY (object); + GVariant *variant; + GVariantIter *iter; + guchar *array; + guint i = 0; + GBytes *value = NULL; + variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Value"); + if (variant != NULL) + { + g_variant_get (variant, "(ay)", &iter); + + array = g_malloc((g_variant_iter_n_children(iter)) * sizeof(guchar)); + while (g_variant_iter_loop(iter, "y", array[i++])); + value = g_bytes_new_take(array, g_variant_iter_n_children(iter)); + g_variant_iter_free(iter); + + g_variant_unref (variant); + } + return value; +} + +static void +gatt_descriptor1_proxy_init (GattDescriptor1Proxy *proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = gatt_descriptor1_proxy_get_instance_private (proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_GATT_DESCRIPTOR1_PROXY, GattDescriptor1ProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), gatt_descriptor1_interface_info ()); +} + +static void +gatt_descriptor1_proxy_class_init (GattDescriptor1ProxyClass *klass) +{ + GObjectClass *gobject_class; + GDBusProxyClass *proxy_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = gatt_descriptor1_proxy_finalize; + gobject_class->get_property = gatt_descriptor1_proxy_get_property; + gobject_class->set_property = gatt_descriptor1_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS (klass); + proxy_class->g_signal = gatt_descriptor1_proxy_g_signal; + proxy_class->g_properties_changed = gatt_descriptor1_proxy_g_properties_changed; + + gatt_descriptor1_override_properties (gobject_class, 1); + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (GattDescriptor1ProxyPrivate)); +#endif +} + +static void +gatt_descriptor1_proxy_iface_init (GattDescriptor1Iface *iface) +{ + iface->get_uuid = gatt_descriptor1_proxy_get_uuid; + iface->get_characteristic = gatt_descriptor1_proxy_get_characteristic; + iface->get_value = gatt_descriptor1_proxy_get_value; +} + +/** + * gatt_descriptor1_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link>. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call gatt_descriptor1_proxy_new_finish() to get the result of the operation. + * + * See gatt_descriptor1_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void +gatt_descriptor1_proxy_new ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_GATT_DESCRIPTOR1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.GattDescriptor1", NULL); +} + +/** + * gatt_descriptor1_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_descriptor1_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with gatt_descriptor1_proxy_new(). + * + * Returns: (transfer full) (type GattDescriptor1Proxy): The constructed proxy object or %NULL if @error is set. + */ +GattDescriptor1 * +gatt_descriptor1_proxy_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return GATT_DESCRIPTOR1 (ret); + else + return NULL; +} + +/** + * gatt_descriptor1_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link>. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See gatt_descriptor1_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type GattDescriptor1Proxy): The constructed proxy object or %NULL if @error is set. + */ +GattDescriptor1 * +gatt_descriptor1_proxy_new_sync ( + GDBusConnection *connection, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_GATT_DESCRIPTOR1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.bluez.GattDescriptor1", NULL); + if (ret != NULL) + return GATT_DESCRIPTOR1 (ret); + else + return NULL; +} + + +/** + * gatt_descriptor1_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like gatt_descriptor1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call gatt_descriptor1_proxy_new_for_bus_finish() to get the result of the operation. + * + * See gatt_descriptor1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +gatt_descriptor1_proxy_new_for_bus ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_GATT_DESCRIPTOR1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.GattDescriptor1", NULL); +} + +/** + * gatt_descriptor1_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to gatt_descriptor1_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with gatt_descriptor1_proxy_new_for_bus(). + * + * Returns: (transfer full) (type GattDescriptor1Proxy): The constructed proxy object or %NULL if @error is set. + */ +GattDescriptor1 * +gatt_descriptor1_proxy_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return GATT_DESCRIPTOR1 (ret); + else + return NULL; +} + +/** + * gatt_descriptor1_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like gatt_descriptor1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See gatt_descriptor1_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type GattDescriptor1Proxy): The constructed proxy object or %NULL if @error is set. + */ +GattDescriptor1 * +gatt_descriptor1_proxy_new_for_bus_sync ( + GBusType bus_type, + GDBusProxyFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_GATT_DESCRIPTOR1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.GattDescriptor1", NULL); + if (ret != NULL) + return GATT_DESCRIPTOR1 (ret); + else + return NULL; +} + + +/* ------------------------------------------------------------------------ */ + +/** + * GattDescriptor1Skeleton: + * + * The #GattDescriptor1Skeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * GattDescriptor1SkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #GattDescriptor1Skeleton. + */ + +struct _GattDescriptor1SkeletonPrivate +{ + GValue *properties; + GList *changed_properties; + GSource *changed_properties_idle_source; + GMainContext *context; + GMutex lock; +}; + +static void +_gatt_descriptor1_skeleton_handle_method_call ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data) +{ + GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (user_data); + _ExtendedGDBusMethodInfo *info; + GVariantIter iter; + GVariant *child; + GValue *paramv; + guint num_params; + guint num_extra; + guint n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation); + g_assert (info != NULL); + num_params = g_variant_n_children (parameters); + num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra); + n = 0; + g_value_init (¶mv[n], TYPE_GATT_DESCRIPTOR1); + g_value_set_object (¶mv[n++], skeleton); + g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object (¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation))); +#else + g_assert_not_reached (); +#endif + } + g_variant_iter_init (&iter, parameters); + while ((child = g_variant_iter_next_value (&iter)) != NULL) + { + _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init (¶mv[n], G_TYPE_VARIANT); + g_value_set_variant (¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue (child, ¶mv[n++]); + g_variant_unref (child); + } + signal_id = g_signal_lookup (info->signal_name, TYPE_GATT_DESCRIPTOR1); + g_value_init (&return_value, G_TYPE_BOOLEAN); + g_signal_emitv (paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean (&return_value)) + g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset (&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset (¶mv[n]); + g_free (paramv); +} + +static GVariant * +_gatt_descriptor1_skeleton_handle_get_property ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name G_GNUC_UNUSED, + const gchar *property_name, + GError **error, + gpointer user_data) +{ + GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + GVariant *ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_descriptor1_interface_info.parent_struct, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init (&value, pspec->value_type); + g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature)); + g_value_unset (&value); + } + return ret; +} + +static gboolean +_gatt_descriptor1_skeleton_handle_set_property ( + GDBusConnection *connection G_GNUC_UNUSED, + const gchar *sender G_GNUC_UNUSED, + const gchar *object_path G_GNUC_UNUSED, + const gchar *interface_name G_GNUC_UNUSED, + const gchar *property_name, + GVariant *variant, + GError **error, + gpointer user_data) +{ + GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (user_data); + GValue value = G_VALUE_INIT; + GParamSpec *pspec; + _ExtendedGDBusPropertyInfo *info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_gatt_descriptor1_interface_info.parent_struct, property_name); + g_assert (info != NULL); + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant (&value, variant); + else + g_dbus_gvariant_to_gvalue (variant, &value); + g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value); + g_value_unset (&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _gatt_descriptor1_skeleton_vtable = +{ + _gatt_descriptor1_skeleton_handle_method_call, + _gatt_descriptor1_skeleton_handle_get_property, + _gatt_descriptor1_skeleton_handle_set_property, + {NULL} +}; + +static GDBusInterfaceInfo * +gatt_descriptor1_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return gatt_descriptor1_interface_info (); +} + +static GDBusInterfaceVTable * +gatt_descriptor1_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_gatt_descriptor1_skeleton_vtable; +} + +static GVariant * +gatt_descriptor1_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton) +{ + GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (_gatt_descriptor1_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _gatt_descriptor1_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo *info = _gatt_descriptor1_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant *value; + value = _gatt_descriptor1_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.bluez.GattDescriptor1", info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref (value); + g_variant_builder_add (&builder, "{sv}", info->name, value); + g_variant_unref (value); + } + } + } +out: + return g_variant_builder_end (&builder); +} + +static gboolean _gatt_descriptor1_emit_changed (gpointer user_data); + +static void +gatt_descriptor1_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton) +{ + GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy (skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock (&skeleton->priv->lock); + + if (emit_changed) + _gatt_descriptor1_emit_changed (skeleton); +} + +static void gatt_descriptor1_skeleton_iface_init (GattDescriptor1Iface *iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE (GattDescriptor1Skeleton, gatt_descriptor1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE (GattDescriptor1Skeleton) + G_IMPLEMENT_INTERFACE (TYPE_GATT_DESCRIPTOR1, gatt_descriptor1_skeleton_iface_init)); + +#else +G_DEFINE_TYPE_WITH_CODE (GattDescriptor1Skeleton, gatt_descriptor1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_GATT_DESCRIPTOR1, gatt_descriptor1_skeleton_iface_init)); + +#endif +static void +gatt_descriptor1_skeleton_finalize (GObject *object) +{ + GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (object); + guint n; + for (n = 0; n < 3; n++) + g_value_unset (&skeleton->priv->properties[n]); + g_free (skeleton->priv->properties); + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy (skeleton->priv->changed_properties_idle_source); + g_main_context_unref (skeleton->priv->context); + g_mutex_clear (&skeleton->priv->lock); + G_OBJECT_CLASS (gatt_descriptor1_skeleton_parent_class)->finalize (object); +} + +static void +gatt_descriptor1_skeleton_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec G_GNUC_UNUSED) +{ + GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 3); + g_mutex_lock (&skeleton->priv->lock); + g_value_copy (&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock (&skeleton->priv->lock); +} + +static gboolean +_gatt_descriptor1_emit_changed (gpointer user_data) +{ + GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (user_data); + GList *l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock (&skeleton->priv->lock); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty *cp = l->data; + GVariant *variant; + const GValue *cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal (cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature)); + g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref (variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *ll; + GVariant *signal_variant; + signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.bluez.GattDescriptor1", + &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton)); + for (ll = connections; ll != NULL; ll = ll->next) + { + GDBusConnection *connection = ll->data; + + g_dbus_connection_emit_signal (connection, + NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + signal_variant, + NULL); + } + g_variant_unref (signal_variant); + g_list_free_full (connections, g_object_unref); + } + else + { + g_variant_builder_clear (&builder); + g_variant_builder_clear (&invalidated_builder); + } + g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock (&skeleton->priv->lock); + return FALSE; +} + +static void +_gatt_descriptor1_schedule_emit_changed (GattDescriptor1Skeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value) +{ + ChangedProperty *cp; + GList *l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty *i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0 (ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp); + g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value)); + g_value_copy (orig_value, &cp->orig_value); + } +} + +static void +gatt_descriptor1_skeleton_notify (GObject *object, + GParamSpec *pspec G_GNUC_UNUSED) +{ + GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (object); + g_mutex_lock (&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && + skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new (); + g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback (skeleton->priv->changed_properties_idle_source, _gatt_descriptor1_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref); + g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _gatt_descriptor1_emit_changed"); + g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref (skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock (&skeleton->priv->lock); +} + +static void +gatt_descriptor1_skeleton_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (object); + g_assert (prop_id != 0 && prop_id - 1 < 3); + g_mutex_lock (&skeleton->priv->lock); + g_object_freeze_notify (object); + if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL) + _gatt_descriptor1_schedule_emit_changed (skeleton, _gatt_descriptor1_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy (value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec (object, pspec); + } + g_mutex_unlock (&skeleton->priv->lock); + g_object_thaw_notify (object); +} + +static void +gatt_descriptor1_skeleton_init (GattDescriptor1Skeleton *skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = gatt_descriptor1_skeleton_get_instance_private (skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_GATT_DESCRIPTOR1_SKELETON, GattDescriptor1SkeletonPrivate); +#endif + + g_mutex_init (&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default (); + skeleton->priv->properties = g_new0 (GValue, 3); + g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING); + g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING); +} + +static const gchar * +gatt_descriptor1_skeleton_get_uuid (GattDescriptor1 *object) +{ + GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[0])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const gchar * +gatt_descriptor1_skeleton_get_characteristic (GattDescriptor1 *object) +{ + GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (object); + const gchar *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_string (&(skeleton->priv->properties[1])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static const GBytes * +gatt_descriptor1_skeleton_get_value (GattDescriptor1 *object) +{ + GattDescriptor1Skeleton *skeleton = GATT_DESCRIPTOR1_SKELETON (object); + const GBytes *value; + g_mutex_lock (&skeleton->priv->lock); + value = g_value_get_boxed (&(skeleton->priv->properties[2])); + g_mutex_unlock (&skeleton->priv->lock); + return value; +} + +static void +gatt_descriptor1_skeleton_class_init (GattDescriptor1SkeletonClass *klass) +{ + GObjectClass *gobject_class; + GDBusInterfaceSkeletonClass *skeleton_class; + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = gatt_descriptor1_skeleton_finalize; + gobject_class->get_property = gatt_descriptor1_skeleton_get_property; + gobject_class->set_property = gatt_descriptor1_skeleton_set_property; + gobject_class->notify = gatt_descriptor1_skeleton_notify; + + + gatt_descriptor1_override_properties (gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass); + skeleton_class->get_info = gatt_descriptor1_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = gatt_descriptor1_skeleton_dbus_interface_get_properties; + skeleton_class->flush = gatt_descriptor1_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = gatt_descriptor1_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private (klass, sizeof (GattDescriptor1SkeletonPrivate)); +#endif +} + +static void +gatt_descriptor1_skeleton_iface_init (GattDescriptor1Iface *iface) +{ + iface->get_uuid = gatt_descriptor1_skeleton_get_uuid; + iface->get_characteristic = gatt_descriptor1_skeleton_get_characteristic; + iface->get_value = gatt_descriptor1_skeleton_get_value; +} + +/** + * gatt_descriptor1_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link>. + * + * Returns: (transfer full) (type GattDescriptor1Skeleton): The skeleton object. + */ +GattDescriptor1 * +gatt_descriptor1_skeleton_new (void) +{ + return GATT_DESCRIPTOR1 (g_object_new (TYPE_GATT_DESCRIPTOR1_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for Object, ObjectProxy and ObjectSkeleton + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:Object + * @title: Object + * @short_description: Specialized GDBusObject types + * + * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces. + */ + +/** + * Object: + * + * The #Object type is a specialized container of interfaces. + */ + +/** + * ObjectIface: + * @parent_iface: The parent interface. + * + * Virtual table for the #Object interface. + */ + +typedef ObjectIface ObjectInterface; +G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT)); + +static void +object_default_init (ObjectIface *iface) +{ + /** + * Object:adapter1: + * + * The #Adapter1 instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link>, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property (iface, g_param_spec_object ("adapter1", "adapter1", "adapter1", TYPE_ADAPTER1, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); + + /** + * Object:device1: + * + * The #Device1 instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link>, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property (iface, g_param_spec_object ("device1", "device1", "device1", TYPE_DEVICE1, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); + + /** + * Object:gatt-service1: + * + * The #GattService1 instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link>, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property (iface, g_param_spec_object ("gatt-service1", "gatt-service1", "gatt-service1", TYPE_GATT_SERVICE1, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); + + /** + * Object:gatt-characteristic1: + * + * The #GattCharacteristic1 instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link>, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property (iface, g_param_spec_object ("gatt-characteristic1", "gatt-characteristic1", "gatt-characteristic1", TYPE_GATT_CHARACTERISTIC1, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); + + /** + * Object:gatt-descriptor1: + * + * The #GattDescriptor1 instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link>, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property (iface, g_param_spec_object ("gatt-descriptor1", "gatt-descriptor1", "gatt-descriptor1", TYPE_GATT_DESCRIPTOR1, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS)); + +} + +/** + * object_get_adapter1: + * @object: A #Object. + * + * Gets the #Adapter1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link> on @object, if any. + * + * Returns: (transfer full): A #Adapter1 that must be freed with g_object_unref() or %NULL if @object does not implement the interface. + */ +Adapter1 *object_get_adapter1 (Object *object) +{ + GDBusInterface *ret; + ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.Adapter1"); + if (ret == NULL) + return NULL; + return ADAPTER1 (ret); +} + +/** + * object_get_device1: + * @object: A #Object. + * + * Gets the #Device1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link> on @object, if any. + * + * Returns: (transfer full): A #Device1 that must be freed with g_object_unref() or %NULL if @object does not implement the interface. + */ +Device1 *object_get_device1 (Object *object) +{ + GDBusInterface *ret; + ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.Device1"); + if (ret == NULL) + return NULL; + return DEVICE1 (ret); +} + +/** + * object_get_gatt_service1: + * @object: A #Object. + * + * Gets the #GattService1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link> on @object, if any. + * + * Returns: (transfer full): A #GattService1 that must be freed with g_object_unref() or %NULL if @object does not implement the interface. + */ +GattService1 *object_get_gatt_service1 (Object *object) +{ + GDBusInterface *ret; + ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattService1"); + if (ret == NULL) + return NULL; + return GATT_SERVICE1 (ret); +} + +/** + * object_get_gatt_characteristic1: + * @object: A #Object. + * + * Gets the #GattCharacteristic1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link> on @object, if any. + * + * Returns: (transfer full): A #GattCharacteristic1 that must be freed with g_object_unref() or %NULL if @object does not implement the interface. + */ +GattCharacteristic1 *object_get_gatt_characteristic1 (Object *object) +{ + GDBusInterface *ret; + ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattCharacteristic1"); + if (ret == NULL) + return NULL; + return GATT_CHARACTERISTIC1 (ret); +} + +/** + * object_get_gatt_descriptor1: + * @object: A #Object. + * + * Gets the #GattDescriptor1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link> on @object, if any. + * + * Returns: (transfer full): A #GattDescriptor1 that must be freed with g_object_unref() or %NULL if @object does not implement the interface. + */ +GattDescriptor1 *object_get_gatt_descriptor1 (Object *object) +{ + GDBusInterface *ret; + ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattDescriptor1"); + if (ret == NULL) + return NULL; + return GATT_DESCRIPTOR1 (ret); +} + + +/** + * object_peek_adapter1: (skip) + * @object: A #Object. + * + * Like object_get_adapter1() but doesn't increase the reference count on the returned object. + * + * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning> + * + * Returns: (transfer none): A #Adapter1 or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. + */ +Adapter1 *object_peek_adapter1 (Object *object) +{ + GDBusInterface *ret; + ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.Adapter1"); + if (ret == NULL) + return NULL; + g_object_unref (ret); + return ADAPTER1 (ret); +} + +/** + * object_peek_device1: (skip) + * @object: A #Object. + * + * Like object_get_device1() but doesn't increase the reference count on the returned object. + * + * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning> + * + * Returns: (transfer none): A #Device1 or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. + */ +Device1 *object_peek_device1 (Object *object) +{ + GDBusInterface *ret; + ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.Device1"); + if (ret == NULL) + return NULL; + g_object_unref (ret); + return DEVICE1 (ret); +} + +/** + * object_peek_gatt_service1: (skip) + * @object: A #Object. + * + * Like object_get_gatt_service1() but doesn't increase the reference count on the returned object. + * + * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning> + * + * Returns: (transfer none): A #GattService1 or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. + */ +GattService1 *object_peek_gatt_service1 (Object *object) +{ + GDBusInterface *ret; + ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattService1"); + if (ret == NULL) + return NULL; + g_object_unref (ret); + return GATT_SERVICE1 (ret); +} + +/** + * object_peek_gatt_characteristic1: (skip) + * @object: A #Object. + * + * Like object_get_gatt_characteristic1() but doesn't increase the reference count on the returned object. + * + * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning> + * + * Returns: (transfer none): A #GattCharacteristic1 or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. + */ +GattCharacteristic1 *object_peek_gatt_characteristic1 (Object *object) +{ + GDBusInterface *ret; + ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattCharacteristic1"); + if (ret == NULL) + return NULL; + g_object_unref (ret); + return GATT_CHARACTERISTIC1 (ret); +} + +/** + * object_peek_gatt_descriptor1: (skip) + * @object: A #Object. + * + * Like object_get_gatt_descriptor1() but doesn't increase the reference count on the returned object. + * + * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning> + * + * Returns: (transfer none): A #GattDescriptor1 or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object. + */ +GattDescriptor1 *object_peek_gatt_descriptor1 (Object *object) +{ + GDBusInterface *ret; + ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattDescriptor1"); + if (ret == NULL) + return NULL; + g_object_unref (ret); + return GATT_DESCRIPTOR1 (ret); +} + + +static void +object_notify (GDBusObject *object, GDBusInterface *interface) +{ + _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface); + /* info can be NULL if the other end is using a D-Bus interface we don't know + * anything about, for example old generated code in this process talking to + * newer generated code in the other process. */ + if (info != NULL) + g_object_notify (G_OBJECT (object), info->hyphen_name); +} + +/** + * ObjectProxy: + * + * The #ObjectProxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * ObjectProxyClass: + * @parent_class: The parent class. + * + * Class structure for #ObjectProxy. + */ + +static void +object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) +{ +} + +static void +object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface) +{ + iface->interface_added = object_notify; + iface->interface_removed = object_notify; +} + + +G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY, + G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init) + G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init)); + +static void +object_proxy_init (ObjectProxy *object G_GNUC_UNUSED) +{ +} + +static void +object_proxy_set_property (GObject *gobject, + guint prop_id, + const GValue *value G_GNUC_UNUSED, + GParamSpec *pspec) +{ + G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); +} + +static void +object_proxy_get_property (GObject *gobject, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + ObjectProxy *object = OBJECT_PROXY (gobject); + GDBusInterface *interface; + + switch (prop_id) + { + case 1: + interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.Adapter1"); + g_value_take_object (value, interface); + break; + + case 2: + interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.Device1"); + g_value_take_object (value, interface); + break; + + case 3: + interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattService1"); + g_value_take_object (value, interface); + break; + + case 4: + interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattCharacteristic1"); + g_value_take_object (value, interface); + break; + + case 5: + interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattDescriptor1"); + g_value_take_object (value, interface); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); + break; + } +} + +static void +object_proxy_class_init (ObjectProxyClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->set_property = object_proxy_set_property; + gobject_class->get_property = object_proxy_get_property; + + g_object_class_override_property (gobject_class, 1, "adapter1"); + g_object_class_override_property (gobject_class, 2, "device1"); + g_object_class_override_property (gobject_class, 3, "gatt-service1"); + g_object_class_override_property (gobject_class, 4, "gatt-characteristic1"); + g_object_class_override_property (gobject_class, 5, "gatt-descriptor1"); +} + +/** + * object_proxy_new: + * @connection: A #GDBusConnection. + * @object_path: An object path. + * + * Creates a new proxy object. + * + * Returns: (transfer full): The proxy object. + */ +ObjectProxy * +object_proxy_new (GDBusConnection *connection, + const gchar *object_path) +{ + g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL); + g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); + return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL)); +} + +/** + * ObjectSkeleton: + * + * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * ObjectSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #ObjectSkeleton. + */ + +static void +object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED) +{ +} + + +static void +object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface) +{ + iface->interface_added = object_notify; + iface->interface_removed = object_notify; +} + +G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON, + G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init) + G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init)); + +static void +object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED) +{ +} + +static void +object_skeleton_set_property (GObject *gobject, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + ObjectSkeleton *object = OBJECT_SKELETON (gobject); + GDBusInterfaceSkeleton *interface; + + switch (prop_id) + { + case 1: + interface = g_value_get_object (value); + if (interface != NULL) + { + g_warn_if_fail (IS_ADAPTER1 (interface)); + g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.bluez.Adapter1"); + } + break; + + case 2: + interface = g_value_get_object (value); + if (interface != NULL) + { + g_warn_if_fail (IS_DEVICE1 (interface)); + g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.bluez.Device1"); + } + break; + + case 3: + interface = g_value_get_object (value); + if (interface != NULL) + { + g_warn_if_fail (IS_GATT_SERVICE1 (interface)); + g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.bluez.GattService1"); + } + break; + + case 4: + interface = g_value_get_object (value); + if (interface != NULL) + { + g_warn_if_fail (IS_GATT_CHARACTERISTIC1 (interface)); + g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.bluez.GattCharacteristic1"); + } + break; + + case 5: + interface = g_value_get_object (value); + if (interface != NULL) + { + g_warn_if_fail (IS_GATT_DESCRIPTOR1 (interface)); + g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.bluez.GattDescriptor1"); + } + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); + break; + } +} + +static void +object_skeleton_get_property (GObject *gobject, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + ObjectSkeleton *object = OBJECT_SKELETON (gobject); + GDBusInterface *interface; + + switch (prop_id) + { + case 1: + interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.Adapter1"); + g_value_take_object (value, interface); + break; + + case 2: + interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.Device1"); + g_value_take_object (value, interface); + break; + + case 3: + interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattService1"); + g_value_take_object (value, interface); + break; + + case 4: + interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattCharacteristic1"); + g_value_take_object (value, interface); + break; + + case 5: + interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.bluez.GattDescriptor1"); + g_value_take_object (value, interface); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); + break; + } +} + +static void +object_skeleton_class_init (ObjectSkeletonClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->set_property = object_skeleton_set_property; + gobject_class->get_property = object_skeleton_get_property; + + g_object_class_override_property (gobject_class, 1, "adapter1"); + g_object_class_override_property (gobject_class, 2, "device1"); + g_object_class_override_property (gobject_class, 3, "gatt-service1"); + g_object_class_override_property (gobject_class, 4, "gatt-characteristic1"); + g_object_class_override_property (gobject_class, 5, "gatt-descriptor1"); +} + +/** + * object_skeleton_new: + * @object_path: An object path. + * + * Creates a new skeleton object. + * + * Returns: (transfer full): The skeleton object. + */ +ObjectSkeleton * +object_skeleton_new (const gchar *object_path) +{ + g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); + return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL)); +} + +/** + * object_skeleton_set_adapter1: + * @object: A #ObjectSkeleton. + * @interface_: (allow-none): A #Adapter1 or %NULL to clear the interface. + * + * Sets the #Adapter1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Adapter1.top_of_page">org.bluez.Adapter1</link> on @object. + */ +void object_skeleton_set_adapter1 (ObjectSkeleton *object, Adapter1 *interface_) +{ + g_object_set (G_OBJECT (object), "adapter1", interface_, NULL); +} + +/** + * object_skeleton_set_device1: + * @object: A #ObjectSkeleton. + * @interface_: (allow-none): A #Device1 or %NULL to clear the interface. + * + * Sets the #Device1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-Device1.top_of_page">org.bluez.Device1</link> on @object. + */ +void object_skeleton_set_device1 (ObjectSkeleton *object, Device1 *interface_) +{ + g_object_set (G_OBJECT (object), "device1", interface_, NULL); +} + +/** + * object_skeleton_set_gatt_service1: + * @object: A #ObjectSkeleton. + * @interface_: (allow-none): A #GattService1 or %NULL to clear the interface. + * + * Sets the #GattService1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattService1.top_of_page">org.bluez.GattService1</link> on @object. + */ +void object_skeleton_set_gatt_service1 (ObjectSkeleton *object, GattService1 *interface_) +{ + g_object_set (G_OBJECT (object), "gatt-service1", interface_, NULL); +} + +/** + * object_skeleton_set_gatt_characteristic1: + * @object: A #ObjectSkeleton. + * @interface_: (allow-none): A #GattCharacteristic1 or %NULL to clear the interface. + * + * Sets the #GattCharacteristic1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattCharacteristic1.top_of_page">org.bluez.GattCharacteristic1</link> on @object. + */ +void object_skeleton_set_gatt_characteristic1 (ObjectSkeleton *object, GattCharacteristic1 *interface_) +{ + g_object_set (G_OBJECT (object), "gatt-characteristic1", interface_, NULL); +} + +/** + * object_skeleton_set_gatt_descriptor1: + * @object: A #ObjectSkeleton. + * @interface_: (allow-none): A #GattDescriptor1 or %NULL to clear the interface. + * + * Sets the #GattDescriptor1 instance for the D-Bus interface <link linkend="gdbus-interface-org-bluez-GattDescriptor1.top_of_page">org.bluez.GattDescriptor1</link> on @object. + */ +void object_skeleton_set_gatt_descriptor1 (ObjectSkeleton *object, GattDescriptor1 *interface_) +{ + g_object_set (G_OBJECT (object), "gatt-descriptor1", interface_, NULL); +} + + +/* ------------------------------------------------------------------------ + * Code for ObjectManager client + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:ObjectManagerClient + * @title: ObjectManagerClient + * @short_description: Generated GDBusObjectManagerClient type + * + * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. + */ + +/** + * ObjectManagerClient: + * + * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API. + */ + +/** + * ObjectManagerClientClass: + * @parent_class: The parent class. + * + * Class structure for #ObjectManagerClient. + */ + +G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT); + +static void +object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED) +{ +} + +static void +object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED) +{ +} + +/** + * object_manager_client_get_proxy_type: + * @manager: A #GDBusObjectManagerClient. + * @object_path: The object path of the remote object (unused). + * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType. + * @user_data: User data (unused). + * + * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types. + * + * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy. + */ +GType +object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, gpointer user_data G_GNUC_UNUSED) +{ + static gsize once_init_value = 0; + static GHashTable *lookup_hash; + GType ret; + + if (interface_name == NULL) + return TYPE_OBJECT_PROXY; + if (g_once_init_enter (&once_init_value)) + { + lookup_hash = g_hash_table_new (g_str_hash, g_str_equal); + g_hash_table_insert (lookup_hash, (gpointer) "org.bluez.Adapter1", GSIZE_TO_POINTER (TYPE_ADAPTER1_PROXY)); + g_hash_table_insert (lookup_hash, (gpointer) "org.bluez.Device1", GSIZE_TO_POINTER (TYPE_DEVICE1_PROXY)); + g_hash_table_insert (lookup_hash, (gpointer) "org.bluez.GattService1", GSIZE_TO_POINTER (TYPE_GATT_SERVICE1_PROXY)); + g_hash_table_insert (lookup_hash, (gpointer) "org.bluez.GattCharacteristic1", GSIZE_TO_POINTER (TYPE_GATT_CHARACTERISTIC1_PROXY)); + g_hash_table_insert (lookup_hash, (gpointer) "org.bluez.GattDescriptor1", GSIZE_TO_POINTER (TYPE_GATT_DESCRIPTOR1_PROXY)); + g_once_init_leave (&once_init_value, 1); + } + ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name)); + if (ret == (GType) 0) + ret = G_TYPE_DBUS_PROXY; + return ret; +} + +/** + * object_manager_client_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call object_manager_client_new_finish() to get the result of the operation. + * + * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor. + */ +void +object_manager_client_new ( + GDBusConnection *connection, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL); +} + +/** + * object_manager_client_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with object_manager_client_new(). + * + * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. + */ +GDBusObjectManager * +object_manager_client_new_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return G_DBUS_OBJECT_MANAGER (ret); + else + return NULL; +} + +/** + * object_manager_client_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. + * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See object_manager_client_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. + */ +GDBusObjectManager * +object_manager_client_new_sync ( + GDBusConnection *connection, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL); + if (ret != NULL) + return G_DBUS_OBJECT_MANAGER (ret); + else + return NULL; +} + + +/** + * object_manager_client_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from. + * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation. + * + * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void +object_manager_client_new_for_bus ( + GBusType bus_type, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async (TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL); +} + +/** + * object_manager_client_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with object_manager_client_new_for_bus(). + * + * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. + */ +GDBusObjectManager * +object_manager_client_new_for_bus_finish ( + GAsyncResult *res, + GError **error) +{ + GObject *ret; + GObject *source_object; + source_object = g_async_result_get_source_object (res); + ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error); + g_object_unref (source_object); + if (ret != NULL) + return G_DBUS_OBJECT_MANAGER (ret); + else + return NULL; +} + +/** + * object_manager_client_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (allow-none): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See object_manager_client_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set. + */ +GDBusObjectManager * +object_manager_client_new_for_bus_sync ( + GBusType bus_type, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GCancellable *cancellable, + GError **error) +{ + GInitable *ret; + ret = g_initable_new (TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", object_manager_client_get_proxy_type, NULL); + if (ret != NULL) + return G_DBUS_OBJECT_MANAGER (ret); + else + return NULL; +} + + diff --git a/src/org.bluez.xml b/src/org.bluez.xml new file mode 100644 index 00000000..99c18c02 --- /dev/null +++ b/src/org.bluez.xml @@ -0,0 +1,104 @@ +<?xml version="1.0"?> +<!-- +Author: Petre Eftime <[email protected]> +Copyright (c) 2015 Intel Corporation. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<node> + <interface name="org.bluez.Adapter1"> + <method name="StartDiscovery"/> + <method name="StopDiscovery"/> + <method name="RemoveDevice"> + <arg name="device" type="o" direction="in"/> + </method> + <property name="Address" type="s" access="read"/> + <property name="Name" type="s" access="read"/> + <property name="Alias" type="s" access="readwrite"/> + <property name="Class" type="u" access="read"/> + <property name="Powered" type="b" access="readwrite"/> + <property name="Discoverable" type="b" access="readwrite"/> + <property name="DiscoverableTimeout" type="u" access="readwrite"/> + <property name="Pairable" type="b" access="readwrite"/> + <property name="PairableTimeout" type="u" access="readwrite"/> + <property name="Discovering" type="b" access="read"/> + <property name="UUIDs" type="as" access="read"/> + <property name="Modalias" type="s" access="read"/> + </interface> + <interface name="org.bluez.Device1"> + <method name="Disconnect"/> + <method name="Connect"/> + <method name="ConnectProfile"> + <arg name="UUID" type="s" direction="in"/> + </method> + <method name="DisconnectProfile"> + <arg name="UUID" type="s" direction="in"/> + </method> + <method name="Pair"/> + <method name="CancelPairing"/> + <property name="Address" type="s" access="read"/> + <property name="Name" type="s" access="read"/> + <property name="Alias" type="s" access="readwrite"/> + <property name="Class" type="u" access="read"/> + <property name="Appearance" type="q" access="read"/> + <property name="Icon" type="s" access="read"/> + <property name="Paired" type="b" access="read"/> + <property name="Trusted" type="b" access="readwrite"/> + <property name="Blocked" type="b" access="readwrite"/> + <property name="LegacyPairing" type="b" access="read"/> + <property name="RSSI" type="n" access="read"/> + <property name="Connected" type="b" access="read"/> + <property name="UUIDs" type="as" access="read"/> + <property name="Modalias" type="s" access="read"/> + <property name="Adapter" type="o" access="read"/> + </interface> + <interface name="org.bluez.GattService1"> + <property name="UUID" type="s" access="read"/> + <property name="Device" type="o" access="read"/> + <property name="Primary" type="b" access="read"/> + <property name="Characteristics" type="ao" access="read"/> + </interface> + <interface name="org.bluez.GattCharacteristic1"> + <method name="ReadValue"> + <arg name="value" type="ay" direction="out"/> + </method> + <method name="WriteValue"> + <arg name="value" type="ay" direction="in"/> + </method> + <method name="StartNotify"/> + <method name="StopNotify"/> + <property name="UUID" type="s" access="read"/> + <property name="Service" type="o" access="read"/> + <property name="Value" type="ay" access="read"/> + <property name="Notifying" type="b" access="read"/> + <property name="Flags" type="as" access="read"/> + <property name="Descriptors" type="ao" access="read"/> + </interface> + <interface name="org.bluez.GattDescriptor1"> + <method name="ReadValue"> + <arg name="value" type="ay" direction="out"/> + </method> + <method name="WriteValue"> + <arg name="value" type="ay" direction="in"/> + </method> + <property name="UUID" type="s" access="read"/> + <property name="Characteristic" type="o" access="read"/> + <property name="Value" type="ay" access="read"/> + </interface> +</node> diff --git a/src/tinyb.pc.cmake b/src/tinyb.pc.cmake new file mode 100644 index 00000000..1c9fbaf8 --- /dev/null +++ b/src/tinyb.pc.cmake @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib@LIB_SUFFIX@ +includedir=${prefix}/include + +Name: tinyb +Description: Tiny BLE library +Version: @tinyb_VERSION_STRING@ + +Libs: -L${libdir} -ltinyb +Cflags: -I${includedir} diff --git a/src/tinyb_utils.cpp b/src/tinyb_utils.cpp new file mode 100644 index 00000000..a5853abc --- /dev/null +++ b/src/tinyb_utils.cpp @@ -0,0 +1,52 @@ +/* + * Author: Andrei Vasiliu <[email protected]> + * Copyright (c) 2015 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "tinyb_utils.hpp" + +std::vector<unsigned char> tinyb::from_gbytes_to_vector(const GBytes *bytes) +{ + gsize result_size; + const unsigned char *aux_array = (const unsigned char *)g_bytes_get_data(const_cast<GBytes *>(bytes), &result_size); + + std::vector<unsigned char> result(result_size); + std::copy(aux_array, aux_array + result_size, result.begin()); + + return result; +} + +/* it allocates memory - the result that is being returned is from heap */ +GBytes *tinyb::from_vector_to_gbytes(const std::vector<unsigned char>& vector) +{ + unsigned int vector_size = vector.size(); + const unsigned char *vector_content = vector.data(); + + GBytes *result = g_bytes_new(vector_content, vector_size); + if (!result) + { + g_printerr("Error: cannot allocate\n"); + throw std::exception(); + } + + return result; +} |