platform-api-3.0.1+16.04.20160203/0000755000015600001650000000000012654350173016452 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/doc/0000755000015600001650000000000012654350173017217 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/doc/Doxyfile0000644000015600001650000022520012654347715020736 0ustar pbuserpbgroup00000000000000# Doxyfile 1.8.1.2 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # # All text after a hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" "). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or sequence of words) that should # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. PROJECT_NAME = "Ubuntu Platform API" # 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 an logo or 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) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = YES # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # 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. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this # tag. The format is ext=language, where ext is a file extension, and language # is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, # C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make # doxygen treat .inc files as Fortran files (default is PHP), and .f files as C # (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions # you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) 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. MARKDOWN_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); v.s. # func(std::string) {}). This also makes the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When 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). INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and # unions with only public data 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 (the default), # structs, classes, and unions are shown on a separate page (for HTML and Man # pages) or section (for LaTeX and RTF). INLINE_SIMPLE_STRUCTS = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penalty. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will roughly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. SYMBOL_CACHE_SIZE = 0 # Similar to the SYMBOL_CACHE_SIZE 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 appear 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. 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 and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = 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 namespaces are hidden. EXTRACT_ANON_NSPACES = YES # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # 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. 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. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or macro consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and macros in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. 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. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # 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. 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 # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The 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 (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = ../include/ mainpage.md # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should 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 = ../include/ubuntu/ui # 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. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = ubuntu::platform::* # 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 = ../src/android/tests # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty or if # non 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 be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO # 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 option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C, C++ and Fortran comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. Note that when using a custom header you are responsible # for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify # that header. Note that the header is subject to change so you typically # have to redo this when upgrading to a newer version of doxygen or when # changing the value of configuration settings such as GENERATE_TREEVIEW! HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # style sheet in the HTML output directory as well, or it will be erased! HTML_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. 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. # The allowed range is 0 to 359. 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. 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. 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. HTML_TIMESTAMP = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. 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. 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, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_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. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. 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. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) # at top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. Since the tabs have the same information as the # navigation tree you can set this option to NO if you already set # GENERATE_TREEVIEW 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. # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) 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. 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. TREEVIEW_WIDTH = 250 # When 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. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # 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 before the changes have effect. 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 prerendered 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. USE_MATHJAX = NO # 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. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client # using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server # based approach is that it scales better to large projects and allows # full text search. The disadvantages are that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = 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. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # 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. Notice: only use this tag if you know what you are doing! LATEX_FOOTER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # http://en.wikipedia.org/wiki/BibTeX for more info. 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 very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load style sheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = 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. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # pointed to by INCLUDE_PATH will be searched when a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # 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. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) 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, because these will confuse the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. 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. Note that each tag file must have a unique name (where the name does # NOT include the path). If a tag file is not located in the directory in which # doxygen is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. 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 = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = NO # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) 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. DOT_NUM_THREADS = 0 # By default doxygen will use the Helvetica font for all dot files that # doxygen generates. When you want a differently looking font 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. DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the Helvetica font. # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to # set the path where dot can find it. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If 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 # managable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are svg, png, jpg, or gif. # If left blank png will be used. 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). 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. 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. INTERACTIVE_SVG = NO # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The 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 DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES platform-api-3.0.1+16.04.20160203/doc/mainpage.md0000644000015600001650000000214312654347715021332 0ustar pbuserpbgroup00000000000000Ubuntu Platform API {#mainpage} =================== The Ubuntu platform API Implements access to the Ubuntu platform and is the primary carrier across form-factor boundaries. It serves as a low-level access layer to the underlying system and its capabilities. Intended Audience ----------------- The intended audience of this API and its documentation are integrators and developers who either cannot or do not want to rely on the more convenient QML or HTML5/JS SDKs. Source Tree Layout ------------------ The overall source tree is split up into roughly two parts: * include/ * ubuntu/ * application/ * sensors/ * android/ where include contains all of the public types, functions and interfaces offered by the Ubuntu platform API. The android subfolder contains the android-specific implementation of the Ubuntu platform API, together with a default implementation of the C API on top of the generic C++ API. For developers, only the include/ folder and its subdirectories are of interest. Within the include/ folder, only the ubuntu/application/ subfolder is meant for public consumption. platform-api-3.0.1+16.04.20160203/doc/CMakeLists.txt0000644000015600001650000000217612654347715021775 0ustar pbuserpbgroup00000000000000# Copyright © 2013 Canonical Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Authored by: Thomas Voss find_package(Doxygen) if(DOXYGEN_FOUND) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) add_custom_target(doc ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating API documentation with Doxygen" VERBATIM) install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc/ubuntu-platform-api) endif(DOXYGEN_FOUND)platform-api-3.0.1+16.04.20160203/doc/Doxyfile.in0000644000015600001650000023452512654347715021355 0ustar pbuserpbgroup00000000000000# Doxyfile 1.8.3.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # # All text after a hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" "). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or sequence of words) that should # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. PROJECT_NAME = "Ubuntu Platform API" # 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 = @UBUNTU_PLATFORM_API_VERSION_MAJOR@.@UBUNTU_PLATFORM_API_VERSION_MINOR@.@UBUNTU_PLATFORM_API_VERSION_PATCH@ # 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 = "A library helping with tight integration into the Ubuntu platform" # With the PROJECT_LOGO tag one can specify an logo or 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) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. Note that you specify absolute paths here, but also # relative paths, which will be relative from the directory where doxygen is # started. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # 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. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, # and language is one of the parsers supported by doxygen: IDL, Java, # Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, # C++. For instance to make doxygen treat .inc files as Fortran files (default # is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note # that for custom extensions you also need to set FILE_PATTERNS otherwise the # files are not read by doxygen. EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) 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. 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 by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. 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); v.s. # func(std::string) {}). This also makes the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate # getter and setter methods for a property. Setting this option to YES (the # default) will make doxygen replace the get and set methods by a property in # the documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When 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). INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and # unions with only public data 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 (the default), # structs, classes, and unions are shown on a separate page (for HTML and Man # pages) or section (for LaTeX and RTF). INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penalty. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will roughly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. SYMBOL_CACHE_SIZE = 0 # Similar to the SYMBOL_CACHE_SIZE 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 appear 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. 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 and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal # scope will be included in the documentation. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. 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. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = 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 namespaces are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # 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. 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. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if section-label ... \endif # and \cond section-label ... \endcond blocks. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or macro consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and macros in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. 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. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # 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. Do not use # file names with spaces, bibtex cannot handle them. 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 # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The 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 (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @CMAKE_CURRENT_SOURCE_DIR@ @CMAKE_CURRENT_SOURCE_DIR@/../include # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should 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. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/../src # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = YES # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty or if # non 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 be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO # 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 option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = # If the USE_MD_FILE_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 reuse # the introduction page also for the doxygen output. USE_MDFILE_AS_MAINPAGE = @CMAKE_CURRENT_SOURCE_DIR@/mainpage.md #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C, C++ and Fortran comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. Note that when using a custom header you are responsible # for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify # that header. Note that the header is subject to change so you typically # have to redo this when upgrading to a newer version of doxygen or when # changing the value of configuration settings such as GENERATE_TREEVIEW! HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If left blank doxygen will # generate a default style sheet. Note that it is recommended to use # HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this # tag will in the future become obsolete. HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify an additional # user-defined cascading style sheet that is 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 therefor more # robust against future updates. Doxygen will copy the style sheet file to # the output directory. 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. 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. # The allowed range is 0 to 359. 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. 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. 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. HTML_TIMESTAMP = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. HTML_DYNAMIC_SECTIONS = YES # 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. 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, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_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. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. 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. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) # at top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. Since the tabs have the same information as the # navigation tree you can set this option to NO if you already set # GENERATE_TREEVIEW to YES. DISABLE_INDEX = YES # 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. # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = YES # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) 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. ENUM_VALUES_PER_LINE = 1 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # When 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. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # 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 before the changes have effect. 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 prerendered 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. USE_MATHJAX = NO # When MathJax is enabled you can set the default output format to be used for # thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and # SVG. The default value is HTML-CSS, which is slower, but has the best # compatibility. 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. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = 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 flavours of web server based search 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 manual for details. SERVER_BASED_SEARCH = NO # When EXTERNAL_SEARCH 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 the manual for configuration details. EXTERNAL_SEARCH = NO # The SEARCHENGINE_URL should point to a search engine hosted by a web server # which will returned the search results when EXTERNAL_SEARCH is enabled. # Doxygen ships with an example search engine (doxysearch) which is based on # the open source search engine library Xapian. See the manual for configuration # details. 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. 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. 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 = id1=loc1 id2=loc2 ... EXTRA_SEARCH_MAPPINGS = #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # 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. Notice: only use this tag if you know what you are doing! LATEX_FOOTER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # http://en.wikipedia.org/wiki/BibTeX for more info. 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 very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load style sheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = YES # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = 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. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # pointed to by INCLUDE_PATH will be searched when a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # 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. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) 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, because these will confuse the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. 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. Note that each tag file must have a unique name (where the name does # NOT include the path). If a tag file is not located in the directory in which # doxygen is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. 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 = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = NO # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) 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. DOT_NUM_THREADS = 1 # By default doxygen will use the Helvetica font for all dot files that # doxygen generates. When you want a differently looking font 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. DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the Helvetica font. # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to # set the path where dot can find it. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = YES # 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 # managable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = YES # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are svg, png, jpg, or gif. # If left blank png will be used. 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). 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. 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. INTERACTIVE_SVG = YES # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The 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 DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = YES # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES platform-api-3.0.1+16.04.20160203/tests/0000755000015600001650000000000012654350173017614 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/tests/test_ua_sensors_real.cpp0000644000015600001650000001126312654347715024556 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Martin Pitt */ #include #include #include #include #include #include #include "gtest/gtest.h" #include #include #include #include #include #include #include using namespace std; typedef chrono::time_point time_point_system_ns; /******************************************* * * Tests with default backend * *******************************************/ class DefaultBackendTest : public testing::Test { virtual void SetUp() { } }; TESTP_F(DefaultBackendTest, CreateProximity, { // this can succeed or fail depending on whether the hardware we run this // on actually exists; but it should never crash UASensorsProximity *s = ua_sensors_proximity_new(); if (s != NULL) { cerr << "proximity sensor present on this hardware\n"; // calling its functions should not crash; we can't assert much about // their actual values, though ua_sensors_proximity_enable(s); float min; ua_sensors_proximity_get_min_value(s, &min); float max; ua_sensors_proximity_get_max_value(s, &max); EXPECT_LE(min, max); float res; ua_sensors_proximity_get_resolution(s, &res); ua_sensors_proximity_disable(s); } else { cerr << "no proximity sensor on this hardware\n"; } }) TESTP_F(DefaultBackendTest, CreateAccelerometer, { // this can succeed or fail depending on whether the hardware we run this // on actually exists; but it should never crash UASensorsAccelerometer *s = ua_sensors_accelerometer_new(); if (s != NULL) { cerr << "accelerometer sensor present on this hardware\n"; // calling its functions should not crash; we can't assert much about // their actual values, though ua_sensors_accelerometer_enable(s); float min; ua_sensors_accelerometer_get_min_value(s, &min); float max; ua_sensors_accelerometer_get_max_value(s, &max); EXPECT_LE(min, max); float res; ua_sensors_accelerometer_get_resolution(s, &res); ua_sensors_accelerometer_disable(s); } else { cerr << "no accelerometer sensor on this hardware\n"; } }) TESTP_F(DefaultBackendTest, CreateLight, { // this can succeed or fail depending on whether the hardware we run this // on actually exists; but it should never crash UASensorsLight *s = ua_sensors_light_new(); if (s != NULL) { cerr << "light sensor present on this hardware\n"; // calling its functions should not crash; we can't assert much about // their actual values, though ua_sensors_light_enable(s); float min; ua_sensors_light_get_min_value(s, &min); float max; ua_sensors_light_get_max_value(s, &max); EXPECT_LE(min, max); float res; ua_sensors_light_get_resolution(s, &res); ua_sensors_light_disable(s); } else { cerr << "no light sensor on this hardware\n"; } }) TESTP_F(DefaultBackendTest, CreateHaptic, { // this can succeed or fail depending on whether the hardware we run this // on actually exists; but it should never crash UASensorsHaptic *s = ua_sensors_haptic_new(); if (s != NULL) { cerr << "haptic sensor present on this hardware\n"; // calling its functions should not crash; we can't assert much about // their actual values, though ua_sensors_haptic_enable(s); UStatus res = ua_sensors_haptic_vibrate_once(s, 10); EXPECT_EQ(U_STATUS_SUCCESS, res); ua_sensors_haptic_disable(s); // caller must delete the object ua_sensors_haptic_destroy(s); } else { cerr << "no haptic sensor on this hardware\n"; } }) platform-api-3.0.1+16.04.20160203/tests/test_ua_sensors_mock.cpp0000644000015600001650000002040212654347715024557 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Martin Pitt */ #include #include #include #include #include #include #include "gtest/gtest.h" #include #include #include #include #include #include using namespace std; typedef chrono::time_point time_point_system_ns; /******************************************* * * Tests with simulated sensor backend * *******************************************/ struct event { uint64_t timestamp; float x, y, z; UASProximityDistance distance; void* context; }; queue events; class SimBackendTest : public testing::Test { protected: virtual void SetUp() { snprintf(data_file, sizeof(data_file), "%s", "/tmp/sensor_test.XXXXXX"); data_fd = mkstemp(data_file); if (data_fd < 0) { perror("mkstemp"); abort(); } setenv("UBUNTU_PLATFORM_API_SENSOR_TEST", data_file, 1); setenv("UBUNTU_PLATFORM_API_BACKEND", "test", 1); // ensure the queue is clear while (events.size() > 0) events.pop(); } virtual void TearDown() { unlink(data_file); } void set_data(const char* data) { write(data_fd, data, strlen(data)); fsync(data_fd); } char data_file[100]; int data_fd; }; // without any data, there are no sensors defined TESTP_F(SimBackendTest, NoData, { EXPECT_EQ(NULL, ua_sensors_accelerometer_new()); EXPECT_EQ(NULL, ua_sensors_proximity_new()); EXPECT_EQ(NULL, ua_sensors_light_new()); }) TESTP_F(SimBackendTest, CreateProximity, { set_data("create proximity"); EXPECT_EQ(NULL, ua_sensors_accelerometer_new()); EXPECT_EQ(NULL, ua_sensors_light_new()); UASensorsProximity *s = ua_sensors_proximity_new(); EXPECT_TRUE(s != NULL); }) TESTP_F(SimBackendTest, CreateAccelerometer, { set_data("create accel 0.5 1000 0.1"); EXPECT_EQ(NULL, ua_sensors_proximity_new()); EXPECT_EQ(NULL, ua_sensors_light_new()); UASensorsAccelerometer *s = ua_sensors_accelerometer_new(); EXPECT_TRUE(s != NULL); float min = 0.f; ua_sensors_accelerometer_get_min_value(s, &min); float max = 0.f; ua_sensors_accelerometer_get_max_value(s, &max); float res = 0.f; ua_sensors_accelerometer_get_resolution(s, &res); EXPECT_FLOAT_EQ(0.5, min); EXPECT_FLOAT_EQ(1000.0, max); EXPECT_FLOAT_EQ(0.1, res); }) TESTP_F(SimBackendTest, CreateLight, { set_data("create light 0 10 0.5"); EXPECT_EQ(NULL, ua_sensors_proximity_new()); EXPECT_EQ(NULL, ua_sensors_accelerometer_new()); UASensorsLight *s = ua_sensors_light_new(); EXPECT_TRUE(s != NULL); float min = 0.f; ua_sensors_light_get_min_value(s, &min); float max = 0.f; ua_sensors_light_get_max_value(s, &max); float res = 0.f; ua_sensors_light_get_resolution(s, &res); EXPECT_FLOAT_EQ(0.0, min); EXPECT_FLOAT_EQ(10.0, max); EXPECT_FLOAT_EQ(0.5, res); }) TESTP_F(SimBackendTest, ProximityEvents, { set_data("create proximity\n" " # some comment\n" " \n" "50 proximity near\n" "100 proximity far\n" "80 proximity unknown\n" ); UASensorsProximity *s = ua_sensors_proximity_new(); EXPECT_TRUE(s != NULL); ua_sensors_proximity_enable(s); auto start_time = chrono::system_clock::now(); ua_sensors_proximity_set_reading_cb(s, [](UASProximityEvent* ev, void* ctx) { events.push({uas_proximity_event_get_timestamp(ev), .0, .0, .0, uas_proximity_event_get_distance(ev), ctx}); }, NULL); usleep(350000); EXPECT_EQ(3, events.size()); auto e = events.front(); events.pop(); EXPECT_EQ(e.distance, U_PROXIMITY_NEAR); EXPECT_EQ(NULL, e.context); auto event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); auto delay = chrono::duration_cast(event_time - start_time).count(); EXPECT_GE(delay, 30); EXPECT_LE(delay, 70); e = events.front(); events.pop(); EXPECT_EQ(e.distance, U_PROXIMITY_FAR); event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); delay = chrono::duration_cast(event_time - start_time).count(); EXPECT_GE(delay, 130); EXPECT_LE(delay, 170); e = events.front(); events.pop(); EXPECT_EQ(e.distance, (UASProximityDistance) 0); event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); delay = chrono::duration_cast(event_time - start_time).count(); EXPECT_GE(delay, 210); EXPECT_LE(delay, 250); }) TESTP_F(SimBackendTest, LightEvents, { set_data(" create light 0 10 1\n" "1 light 5\n" "100 light 8\n" ); UASensorsLight *s = ua_sensors_light_new(); EXPECT_TRUE(s != NULL); ua_sensors_light_enable(s); auto start_time = chrono::system_clock::now(); ua_sensors_light_set_reading_cb(s, [](UASLightEvent* ev, void* ctx) { float light = -1.f; uas_light_event_get_light(ev, &light); events.push({uas_light_event_get_timestamp(ev), light, .0, .0, (UASProximityDistance) 0, ctx}); }, NULL); usleep(130000); EXPECT_EQ(2, events.size()); auto e = events.front(); events.pop(); EXPECT_FLOAT_EQ(e.x, 5); EXPECT_EQ(NULL, e.context); auto event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); auto delay = chrono::duration_cast(event_time - start_time).count(); EXPECT_LE(delay, 10); e = events.front(); events.pop(); EXPECT_FLOAT_EQ(e.x, 8); event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); delay = chrono::duration_cast(event_time - start_time).count(); EXPECT_GE(delay, 91); EXPECT_LE(delay, 111); }) TESTP_F(SimBackendTest, AccelEvents, { // cover the case of > 1 s, to ensure that we correctly do mod arithmetic set_data("create accel -1000 1000 0.1\n" "1100 accel 5.5 -8.5 9.9\n" ); UASensorsAccelerometer *s = ua_sensors_accelerometer_new(); EXPECT_TRUE(s != NULL); ua_sensors_accelerometer_enable(s); auto start_time = chrono::system_clock::now(); ua_sensors_accelerometer_set_reading_cb(s, [](UASAccelerometerEvent* ev, void* ctx) { float x; uas_accelerometer_event_get_acceleration_x(ev, &x); float y; uas_accelerometer_event_get_acceleration_y(ev, &y); float z; uas_accelerometer_event_get_acceleration_z(ev, &z); events.push({uas_accelerometer_event_get_timestamp(ev), x, y, z, (UASProximityDistance) 0, ctx}); }, NULL); usleep(1200000); EXPECT_EQ(1, events.size()); auto e = events.front(); events.pop(); EXPECT_FLOAT_EQ(e.x, 5.5); EXPECT_FLOAT_EQ(e.y, -8.5); EXPECT_FLOAT_EQ(e.z, 9.9); EXPECT_EQ(NULL, e.context); auto event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); auto delay = chrono::duration_cast(event_time - start_time).count(); EXPECT_GE(delay, 1050); EXPECT_LE(delay, 1150); }) platform-api-3.0.1+16.04.20160203/tests/CMakeLists.txt0000644000015600001650000000216712654347715022372 0ustar pbuserpbgroup00000000000000find_package(PkgConfig REQUIRED) pkg_check_modules(PROCESS_CPP process-cpp REQUIRED) include_directories(${GTEST_ROOT}/src) include_directories(${PROCESS_CPP_INCLUDE_DIRS}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11") add_executable( test_ua_sensors_real test_ua_sensors_real.cpp ) add_executable( test_ua_sensors_mock test_ua_sensors_mock.cpp ) target_link_libraries( test_ua_sensors_mock ubuntu_application_api gtest gtest_main ${PROCESS_CPP_LIBRARIES} ) target_link_libraries( test_ua_sensors_real ubuntu_application_api gtest gtest_main ${PROCESS_CPP_LIBRARIES} ) add_test( test_ua_sensors_mock env LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/src/ubuntu:${CMAKE_BINARY_DIR}/src/ubuntu/application/testbackend ${CMAKE_CURRENT_BINARY_DIR}/test_ua_sensors_mock ) if(DEFINED ENV{UBUNTU_PLATFORM_API_BACKEND}) add_test( test_ua_sensors_real env LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/src/ubuntu:${CMAKE_BINARY_DIR}/src/ubuntu/application/touch:${CMAKE_BINARY_DIR}/src/ubuntu/desktop ${CMAKE_CURRENT_BINARY_DIR}/test_ua_sensors_real ) endif() platform-api-3.0.1+16.04.20160203/include/0000755000015600001650000000000012654350173020075 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/include/ubuntu/0000755000015600001650000000000012654350173021417 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/include/ubuntu/application/0000755000015600001650000000000012654350173023722 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/include/ubuntu/application/url_dispatcher/0000755000015600001650000000000012654350173026732 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/include/ubuntu/application/url_dispatcher/service.h0000644000015600001650000000303012654347715030547 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * */ #ifndef UBUNTU_APPLICATION_URL_DISPATCHER_SERVICE_H_ #define UBUNTU_APPLICATION_URL_DISPATCHER_SERVICE_H_ #include "ubuntu/application/url_dispatcher/session.h" #include #ifdef __cplusplus extern "C" { #endif /** * \defgroup url_dispatcher Functions and types to provide launching files/applications. * * Applications in Ubuntu can not launch other applications directly. * They have to use the url_dispatcher service to open other applications * or to open applications that handle a given url. */ /** * \brief Creates a new session with the url dispatcher service. * \returns A new session or NULL if the app lacks permissions to access the url dispatcher. */ UBUNTU_DLL_PUBLIC UAUrlDispatcherSession* ua_url_dispatcher_session(); #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_URL_DISPATCHER_SERVICE_H_ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/url_dispatcher/CMakeLists.txt0000644000015600001650000000030512654347715031500 0ustar pbuserpbgroup00000000000000set( UBUNTU_APPLICATION_URL_DISPATCHER_HEADERS service.h session.h ) install( FILES ${UBUNTU_APPLICATION_URL_DISPATCHER_HEADERS} DESTINATION include/ubuntu/application/url_dispatcher ) platform-api-3.0.1+16.04.20160203/include/ubuntu/application/url_dispatcher/session.h0000644000015600001650000000425312654347715030602 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * */ #ifndef UBUNTU_APPLICATION_URL_DISPATCHER_SESSION_H_ #define UBUNTU_APPLICATION_URL_DISPATCHER_SESSION_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type encapsulating a session with the url dispatcher service. * \ingroup url_dispatcher */ typedef struct UbuntuApplicationUrlDispatcherSession UAUrlDispatcherSession; /** * \brief Callback type that is invoked for open results. * \ingroup url_dispatcher * \param[out] status U_STATUS_SUCCESS if the dispatching was successful. * \param[out] url The url passed to the ua_url_dispatcher_session_dispatch call. * \param[out] context The url context passed to the ua_url_dispatcher_session_dispatch call. */ typedef void (*UAUrlDispatcherSessionDispatchHandler)( UStatus status, const char *url, void *context); /** * \brief Tells the url dispatcher to open the given url. * \ingroup url_dispatcher * \param[in] session The session instance. * \param[in] url The url to open. * \param[in] handler The url dispatcher open handler. * \param[in] context Your context, will be returned to you as is in the handler callback. */ UBUNTU_DLL_PUBLIC void ua_url_dispatcher_session_open( UAUrlDispatcherSession *session, const char *url, UAUrlDispatcherSessionDispatchHandler handler, void *context); #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_URL_DISPATCHER_SESSION_H_ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/location/0000755000015600001650000000000012654350173025532 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/include/ubuntu/application/location/velocity_update.h0000644000015600001650000000507512654347715031122 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_LOCATION_VELOCITY_UPDATE_H_ #define UBUNTU_APPLICATION_LOCATION_VELOCITY_UPDATE_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type encapsulating a velocity update. * \ingroup location_service */ typedef struct UbuntuApplicationLocationVelocityUpdate UALocationVelocityUpdate; /** * \brief Increments the reference count of the velocity update instance. * \ingroup location_service * \param[in] update The velocity update instance to increment the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_velocity_update_ref( UALocationVelocityUpdate *update); /** * \brief Decrements the reference count of the velocity update instance. * \ingroup location_service * \param[in] update The velocity update instance to decrement the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_velocity_update_unref( UALocationVelocityUpdate *update); /** * \brief Queries the timestamp of the velocity update. * \ingroup location_service * \returns The timestamp of the position update in [µs]. * \param[in] update The velocity update instance to be queried. */ UBUNTU_DLL_PUBLIC uint64_t ua_location_velocity_update_get_timestamp( UALocationVelocityUpdate *update); /** * \brief Queries the velocity contained in the position update. * \ingroup location_service * \returns The velocity in the position update in [m/s]. * \param[in] update The velocity update instance to be queried. */ UBUNTU_DLL_PUBLIC double ua_location_velocity_update_get_velocity_in_meters_per_second( UALocationVelocityUpdate *update); #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_LOCATION_VELOCITY_UPDATE_H_ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/location/controller.h0000644000015600001650000001144712654347715030105 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_LOCATION_SERVICE_CONTROLLER_H_ #define UBUNTU_APPLICATION_LOCATION_SERVICE_CONTROLLER_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Location service status. * \ingroup location_service */ typedef enum { UA_LOCATION_SERVICE_ENABLED = 1 << 0, /**< The service is enabled. */ UA_LOCATION_SERVICE_DISABLED = 1 << 1, /**< The service is disabled. */ UA_LOCATION_SERVICE_GPS_ENABLED = 1 << 2, /**< GPS providers are enabled. */ UA_LOCATION_SERVICE_GPS_DISABLED = 1 << 3, /**< GPS providers are disabled. */ } UbuntuApplicationLocationServiceStatus; typedef UbuntuApplicationLocationServiceStatus UALocationServiceStatus; typedef unsigned int UALocationServiceStatusFlags; /** * \brief Callback type that is invoked when the location service status changes. * \ingroup location_service */ typedef void (*UALocationServiceStatusChangedHandler)( UALocationServiceStatusFlags flags, void *context); /** * \brief Opaque type encapsulating a controller the location service. * \ingroup location_service */ typedef struct UbuntuApplicationLocationServiceController UALocationServiceController; /** * \brief Increments the reference count of the controller instance. * \ingroup location_service * \param[in] controller The controller instance to increment the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_service_controller_ref( UALocationServiceController *controller); /** * \brief Decrements the reference count of the controller instance. * \ingroup location_service * \param[in] controller The controller instance to decrement the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_service_controller_unref( UALocationServiceController *controller); /** * \brief Sets the status changed handler of the controller instance. * \ingroup location_service * \param[in] controller The controller instance. * \param[in] handler The status changed handler to invoke. * \param[in] context The context pointer to pass in the status changed handler */ UBUNTU_DLL_PUBLIC void ua_location_service_controller_set_status_changed_handler( UALocationServiceController *controller, UALocationServiceStatusChangedHandler handler, void *context); /** * \brief Query the status of the location service. * \ingroup location_service * \param[in] controller The controller instance. * \param[out] flags Flags indicating the service status. */ UBUNTU_DLL_PUBLIC UStatus ua_location_service_controller_query_status( UALocationServiceController *controller, UALocationServiceStatusFlags *out_flags); /** * \brief Enables the location service. * \ingroup location_service * \param[in] controller The controller instance. */ UBUNTU_DLL_PUBLIC UStatus ua_location_service_controller_enable_service( UALocationServiceController *controller); /** * \brief Disables the location service completely. * \ingroup location_service * \param[in] controller The controller instance. */ UBUNTU_DLL_PUBLIC UStatus ua_location_service_controller_disable_service( UALocationServiceController *controller); /** * \brief Enables all gps providers known to the location service. * \ingroup location_service * \param[in] controller The controller instance. */ UBUNTU_DLL_PUBLIC UStatus ua_location_service_controller_enable_gps( UALocationServiceController *controller); /** * \brief Disables all gps providers known to the location service. * \ingroup location_service * \param[in] controller The controller instance. */ UBUNTU_DLL_PUBLIC UStatus ua_location_service_controller_disable_gps( UALocationServiceController *controller); #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_LOCATION_SERVICE_CONTROLLER_H_ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/location/heading_update.h0000644000015600001650000000501012654347715030650 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_LOCATION_HEADING_UPDATE_H_ #define UBUNTU_APPLICATION_LOCATION_HEADING_UPDATE_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type encapsulating a heading update. * \ingroup location_service */ typedef struct UbuntuApplicationLocationHeadingUpdate UALocationHeadingUpdate; /** * \brief Increments the reference count of the heading update instance. * \ingroup location_service * \param[in] update The heading update instance to increment the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_heading_update_ref( UALocationHeadingUpdate *update); /** * \brief Decrements the reference count of the heading update instance. * \ingroup location_service * \param[in] update The heading update instance to decrement the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_heading_update_unref( UALocationHeadingUpdate *update); /** * \brief Queries the timestamp of the heading update. * \ingroup location_service * \returns The timestamp of the heading update in [µs]. * \param[in] update The heading update instance to be queried. */ UBUNTU_DLL_PUBLIC uint64_t ua_location_heading_update_get_timestamp( UALocationHeadingUpdate *update); /** * \brief Queries the new heading from the update. * \ingroup location_service * \returns The new heading from the update in [°]. * \param[in] update The heading update instance to be queried. */ UBUNTU_DLL_PUBLIC double ua_location_heading_update_get_heading_in_degree( UALocationHeadingUpdate *update); #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_LOCATION_HEADING_UPDATE_H_ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/location/position_update.h0000644000015600001650000001240012654347715031116 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_LOCATION_POSITION_UPDATE_H_ #define UBUNTU_APPLICATION_LOCATION_POSITION_UPDATE_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type encapsulating a location update. * \ingroup location_service */ typedef struct UbuntuApplicationLocationPositionUpdate UALocationPositionUpdate; /** * \brief Increments the reference count of the position update instance. * \ingroup location_service * \param[in] update The position update instance to increment the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_position_update_ref( UALocationPositionUpdate *update); /** * \brief Decrements the reference count of the position update instance. * \ingroup location_service * \param[in] update The position update instance to decrement the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_position_update_unref( UALocationPositionUpdate *update); /** * \brief Queries the timestamp of the position update. * \ingroup location_service * \returns The timestamp of the position update in [µs]. * \param[in] update The position update instance to be queried. */ UBUNTU_DLL_PUBLIC uint64_t ua_location_position_update_get_timestamp( UALocationPositionUpdate *update); /** * \brief Queries the latitude contained in the position update. * \ingroup location_service * \returns The latitude of the position update in [°]. * \param[in] update The position update instance to be queried. */ UBUNTU_DLL_PUBLIC double ua_location_position_update_get_latitude_in_degree( UALocationPositionUpdate *update); /** * \brief Queries the longitude contained in the position update. * \ingroup location_service * \returns The longitude of the position update in [°]. * \param[in] update The position update instance to be queried. */ UBUNTU_DLL_PUBLIC double ua_location_position_update_get_longitude_in_degree( UALocationPositionUpdate *update); /** * \brief Checks if the position update contains an altitude. * \ingroup location_service * \returns TRUE if the update contains an altitude, else FALSE. * \param[in] update The position update instance to be queried. */ UBUNTU_DLL_PUBLIC bool ua_location_position_update_has_altitude( UALocationPositionUpdate *update); /** * \brief Queries the altitude contained in the position update. * \ingroup location_service * \returns The altitude of the position update in [m]. * \param[in] update The position update instance to be queried. */ UBUNTU_DLL_PUBLIC double ua_location_position_update_get_altitude_in_meter( UALocationPositionUpdate *update); /** * \brief Checks if the position update contains a horizontal accuracy estimate. * \ingroup location_service * \returns TRUE if the update contains a horizontal accuracy estimate, else FALSE. * \param[in] update The position update instance to be queried. */ UBUNTU_DLL_PUBLIC bool ua_location_position_update_has_horizontal_accuracy( UALocationPositionUpdate *update); /** * \brief Queries the horizontal accuracy contained in the position update. * \ingroup location_service * \returns The horizontal accuracy of the position update in [m]. * \param[in] update The position update instance to be queried. */ UBUNTU_DLL_PUBLIC double ua_location_position_update_get_horizontal_accuracy_in_meter( UALocationPositionUpdate *update); /** * \brief Checks if the position update contains a vertical accuracy estimate. * \ingroup location_service * \returns TRUE if the update contains a vertical accuracy estimate, else FALSE. * \param[in] update The position update instance to be queried. */ UBUNTU_DLL_PUBLIC bool ua_location_position_update_has_vertical_accuracy( UALocationPositionUpdate *update); /** * \brief Queries the vertical accuracy contained in the position update. * \ingroup location_service * \returns The vertical accuracy of the position update in [m]. * \param[in] update The position update instance to be queried. */ UBUNTU_DLL_PUBLIC double ua_location_position_update_get_vertical_accuracy_in_meter( UALocationPositionUpdate *update); #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_LOCATION_POSITION_UPDATE_H_ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/location/service.h0000644000015600001650000001424512654347715027361 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_LOCATION_SERVICE_H_ #define UBUNTU_APPLICATION_LOCATION_SERVICE_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \defgroup location_service Functions and types to provide location services to applications. * * Applications in Ubuntu do not access positioning hardware * directly but instead rely on a system-wide location service to * be provided with position, heading and velocity updates. An * application that wants to receive position, heading or * velocity updates needs to start a session with the location * service and specify its requirements with the help * UALocationServiceRequirementsFlags. After the session has been * created, position, heading and velocity updates need to be * started by the application for its session. The actual updates * are delivered via callbacks. Please note that the location * service caches updates as good as possible. That is, if an * application is only interested in a single position fix, and a * reasonable fix is already known to the service, the * information is immediately delivered to the application when * the respecitve updates are started. * */ /** * \brief Application-specific requirements. * \ingroup location_service */ typedef enum { UA_LOCATION_SERVICE_REQUIRE_ALTITUDE = 1 << 0, /**< The application requires altitude updates. */ UA_LOCATION_SERVICE_REQUIRE_HEADING = 1 << 1, /**< The application requires heading updates. */ UA_LOCATION_SERVICE_REQUIRE_VELOCITY = 1 << 2 /**< The application requires velocity updates. */ } UbuntuApplicationLocationServiceRequirement; typedef UbuntuApplicationLocationServiceRequirement UALocationServiceRequirement; /** * \brief Bitfield type for summarizing an application's requirements. * \ingroup location_service */ typedef unsigned int UALocationServiceRequirementsFlags; /** * \brief Possible error codes reported when trying to create a session. * \ingroup location_service */ typedef enum { UA_LOCATION_SERVICE_ERROR_NONE = 0, /**< All good, session created. */ UA_LOCATION_SERVICE_ERROR_NO_CONNECTION = 1, /**< Could not connect to backend service. */ UA_LOCATION_SERVICE_ERROR_NO_ACCESS = 2, /**< Could not connect due to lack of permissions. */ UA_LOCATION_SERVICE_ERROR_GENERIC_ERROR = 3 /**< Could not connect, unspecified error. */ } UbuntuApplicationLocationServiceError; typedef UbuntuApplicationLocationServiceError UALocationServiceError; /** * \brief Creates a new session with the location service for low positional accuracy requirements. * \ingroup location_service * \returns A new session or NULL if the requirements cannot be * satisfied or if the app lacks permissions to access the * location service. * \param[in] Bitfield describing the application's requirements. */ UBUNTU_DLL_PUBLIC UALocationServiceSession* ua_location_service_create_session_for_low_accuracy( UALocationServiceRequirementsFlags flags); /** * \brief Tries to reate a new session with the location service for low positional accuracy requirements. * \ingroup location_service * \returns A new session or NULL if the requirements cannot be * satisfied or if the app lacks permissions to access the * location service. * \param[in] flags Bitfield describing the application's requirements. * \param[out] status Receives an error description if an issue arises. */ UBUNTU_DLL_PUBLIC UALocationServiceSession* ua_location_service_try_create_session_for_low_accuracy( UALocationServiceRequirementsFlags flags, UALocationServiceError* status); /** * \brief Creates a new session with the location service for high positional accuracy requirements. * \ingroup location_service * \returns A new session or NULL if the requirements cannot be * satisfied or if the app lacks permissions to access the * location service. * \param[in] Bitfield describing the application's requirements. */ UBUNTU_DLL_PUBLIC UALocationServiceSession* ua_location_service_create_session_for_high_accuracy( UALocationServiceRequirementsFlags flags); /** * \brief Tries to reate a new session with the location service for high positional accuracy requirements. * \ingroup location_service * \returns A new session or NULL if the requirements cannot be * satisfied or if the app lacks permissions to access the * location service. * \param[in] flags Bitfield describing the application's requirements. * \param[out] status Receives an error description if an issue arises. */ UBUNTU_DLL_PUBLIC UALocationServiceSession* ua_location_service_try_create_session_for_high_accuracy( UALocationServiceRequirementsFlags flags, UALocationServiceError* status); /** * \brief Creates a new controller for the location service. * \ingroup location_service * \returns A controller or NULL if the calling process does not * have sufficient privileges. */ UBUNTU_DLL_PUBLIC UALocationServiceController* ua_location_service_create_controller(); #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_LOCATION_SERVICE_H_ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/location/CMakeLists.txt0000644000015600001650000000037512654347715030307 0ustar pbuserpbgroup00000000000000set( UBUNTU_APPLICATION_LOCATION_HEADERS controller.h heading_update.h position_update.h service.h session.h velocity_update.h ) install( FILES ${UBUNTU_APPLICATION_LOCATION_HEADERS} DESTINATION include/ubuntu/application/location ) platform-api-3.0.1+16.04.20160203/include/ubuntu/application/location/session.h0000644000015600001650000001444212654347715027403 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_LOCATION_SESSION_H_ #define UBUNTU_APPLICATION_LOCATION_SESSION_H_ #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type encapsulating a session with the location service. * \ingroup location_service */ typedef struct UbuntuApplicationLocationServiceSession UALocationServiceSession; /** * \brief Callback type that is invoked for position updates. * \ingroup location_service */ typedef void (*UALocationServiceSessionPositionUpdatesHandler)( UALocationPositionUpdate *position, void *context); /** * \brief Callback type that is invoked for heading updates. * \ingroup location_service */ typedef void (*UALocationServiceSessionHeadingUpdatesHandler)( UALocationHeadingUpdate *heading, void *context); /** * \brief Callback type that is invoked for velocity updates. * \ingroup location_service */ typedef void (*UALocationServiceSessionVelocityUpdatesHandler)( UALocationVelocityUpdate *heading, void *context); /** * \brief Increments the reference count of the session instance. * \ingroup location_service * \param[in] session The session instance to increment the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_service_session_ref( UALocationServiceSession *session); /** * \brief Decrements the reference count of the session instance. * \ingroup location_service * \param[in] session The session instance to decrement the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_service_session_unref( UALocationServiceSession *session); /** * \brief Installs an app-specific position update handler for the session. * \ingroup location_service * \param[in] session The session instance to install the handler for. * \param[in] handler The position update handler. */ UBUNTU_DLL_PUBLIC void ua_location_service_session_set_position_updates_handler( UALocationServiceSession *session, UALocationServiceSessionPositionUpdatesHandler handler, void *context); /** * \brief Installs an app-specific heading update handler for the session. * \ingroup location_service * \param[in] session The session instance to install the handler for. * \param[in] handler The heading update handler. */ UBUNTU_DLL_PUBLIC void ua_location_service_session_set_heading_updates_handler( UALocationServiceSession *session, UALocationServiceSessionHeadingUpdatesHandler handler, void *context); /** * \brief Installs an app-specific velocity update handler for the session. * \ingroup location_service * \param[in] session The session instance to install the handler for. * \param[in] handler The velocity update handler. */ UBUNTU_DLL_PUBLIC void ua_location_service_session_set_velocity_updates_handler( UALocationServiceSession *session, UALocationServiceSessionVelocityUpdatesHandler handler, void *context); /** * \brief Starts position updates for the supplied session. * \ingroup location_service * \returns U_STATUS_SUCCESS if the updates were successfully started on the service side, else U_STATUS_ERROR. * \param[in] session The session instance to start position updates for. */ UBUNTU_DLL_PUBLIC UStatus ua_location_service_session_start_position_updates( UALocationServiceSession *session); /** * \brief Stops position updates for the supplied session. * \ingroup location_service * \param[in] session The session instance to stop position updates for. */ UBUNTU_DLL_PUBLIC void ua_location_service_session_stop_position_updates( UALocationServiceSession *session); /** * \brief Starts heading updates for the supplied session. * \ingroup location_service * \returns U_STATUS_SUCCESS if the updates were successfully started on the service side, else U_STATUS_ERROR. * \param[in] session The session instance to start heading updates for. */ UBUNTU_DLL_PUBLIC UStatus ua_location_service_session_start_heading_updates( UALocationServiceSession *session); /** * \brief Stops heading updates for the supplied session. * \ingroup location_service * \param[in] session The session instance to stop heading updates for. */ UBUNTU_DLL_PUBLIC void ua_location_service_session_stop_heading_updates( UALocationServiceSession *session); /** * \brief Starts velocity updates for the supplied session. * \ingroup location_service * \returns U_STATUS_SUCCESS if the updates were successfully started on the service side, else U_STATUS_ERROR. * \param[in] session The session instance to start velocity updates for. */ UBUNTU_DLL_PUBLIC UStatus ua_location_service_session_start_velocity_updates( UALocationServiceSession *session); /** * \brief Stops velocity updates for the supplied session. * \ingroup location_service * \param[in] session The session instance to stop velocity updates for. */ UBUNTU_DLL_PUBLIC void ua_location_service_session_stop_velocity_updates( UALocationServiceSession *session); #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_LOCATION_SESSION_H_ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/init.h0000644000015600001650000000334012654347715025046 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_INIT_H_ #define UBUNTU_APPLICATION_INIT_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Queries the Module Version that is currently loaded. * \ingroup application_support * \param[out] major Major version. * \param[out] minor Minor version. * \param[out] patch Patch version. */ UBUNTU_DLL_PUBLIC void u_application_module_version( uint32_t *major, uint32_t *minor, uint32_t *patch); /** * \brief Initializes the Ubuntu Application API backend with args. * \ingroup application_support * \param[in] args Opaque initialization arguments. */ UBUNTU_DLL_PUBLIC void u_application_init( void *args); /** * \brief Signal termination to the Application backend instance. * \ingroup application_support */ UBUNTU_DLL_PUBLIC void u_application_finish(); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_INIT_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/id.h0000644000015600001650000000415612654347715024505 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_ID_H_ #define UBUNTU_APPLICATION_ID_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief An opaque type describing an application ID. * \ingroup application_support */ typedef void UApplicationId; /** * \brief Creates a new application ID from an existing string. * \ingroup application_support * \param[in] string The string containing the application ID. * \param[in] size The size of the string. */ UBUNTU_DLL_PUBLIC UApplicationId* u_application_id_new_from_stringn( const char *string, size_t size); /** * \brief Destroy the supplied application ID instance. * \ingroup application_support * \param[in] id The instance to be destroyed. */ UBUNTU_DLL_PUBLIC void u_application_id_destroy(UApplicationId *id); /** * \brief Compares two application ID instances. * \ingroup application_support * \returns -1 iff lhs < rhs, 0 iff lhs == rhs, 1 iff lhs > rhs. * \param[in] lhs The left-hand-side id to be compared. * \param[in] rhs The right-hand-side id to be compared. */ UBUNTU_DLL_PUBLIC int u_application_id_compare( UApplicationId *lhs, UApplicationId *rhs); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_ID_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/archive.h0000644000015600001650000001344512654347715025533 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_ARCHIVE_H_ #define UBUNTU_APPLICATION_ARCHIVE_H_ #include #include #include #include #ifdef __cplusplus extern "C" { #endif typedef struct UbuntuApplicationArchive_ UApplicationArchive; /** * \brief Creates a new archive, ownership is transferred to caller. * \ingroup application_support * \sa u_application_archive_destroy * \returns A new archive instance or NULL if not enough memory is available. */ UBUNTU_DLL_PUBLIC UApplicationArchive* u_application_archive_new(); /** * \brief Destroys the given archive instance and releases all resources held by the instance. * \ingroup application_support * \param[in] archive The instance to be destroyed. * \post All resources held by the instance are released. The result of any operation invoked on the destroyed instance are undefined. */ UBUNTU_DLL_PUBLIC void u_application_archive_destroy( UApplicationArchive *archive); /** * \brief Writes a signed 64-bit integer to the supplied archive * \ingroup application_support * \returns U_STATUS_SUCCESS if successful, and U_STATUS_ERROR in case of failures. * \param[in] archive The archive to write to. * \param[in] s The signed 64-bit integer to write to the archive. */ UBUNTU_DLL_PUBLIC UStatus u_application_archive_write( UApplicationArchive *archive, int64_t s); /** * \brief Writes a string of characters to the supplied archive * \ingroup application_support * \returns U_STATUS_SUCCESS if successful, and U_STATUS_ERROR in case of failures. * \param[in] archive The archive to write to. * \param[in] s The string to write. * \param[in] size The number of characters to write to the archive. */ UBUNTU_DLL_PUBLIC UStatus u_application_archive_write_stringn( UApplicationArchive *archive, const char *s, size_t size); /** * \brief Writes a string of wide characters to the supplied archive * \ingroup application_support * \returns U_STATUS_SUCCESS if successful, and U_STATUS_ERROR in case of failures. * \param[in] archive The archive to write to. * \param[in] s The string to write. * \param[in] size The number of characters to write to the archive. */ UBUNTU_DLL_PUBLIC UStatus u_application_archive_write_wstringn( UApplicationArchive *archive, const wchar_t *s, size_t size); /** * \brief Writes a blob of binary data to the supplied archive * \ingroup application_support * \returns U_STATUS_SUCCESS if successful, and U_STATUS_ERROR in case of failures. * \param[in] archive The archive to write to. * \param[in] data The binary blob to write. * \param[in] size The size of the blob. */ UBUNTU_DLL_PUBLIC UStatus u_application_archive_write_bytes( UApplicationArchive *archive, const intptr_t *data, size_t size); UBUNTU_DLL_PUBLIC UStatus u_application_archive_write_begin_blockn( UApplicationArchive* archive, const char *name, size_t size); UBUNTU_DLL_PUBLIC UStatus u_application_archive_write_end_blockn( UApplicationArchive* archive, const char *name, size_t size); /** * \brief Reads a signed 64-bit integer from the supplied archive * \ingroup application_support * \returns U_STATUS_SUCCESS if successful, and U_STATUS_ERROR in case of failures. * \param[in] archive The archive to read from. * \param[out] s Pointer to memory that receives the signed 64-bit integer. */ UBUNTU_DLL_PUBLIC UStatus u_application_archive_read( const UApplicationArchive *archive, int64_t *s); /** * \brief Reads a string of characters from the supplied archive * \ingroup application_support * \returns U_STATUS_SUCCESS if successful, and U_STATUS_ERROR in case of failures. * \param[in] archive The archive to read from. * \param[out] s Pointer to memory that receives the string. * \param[out] size Pointer to memory that receives the size of the string. */ UBUNTU_DLL_PUBLIC UStatus u_application_archive_read_stringn( const UApplicationArchive *archive, const char **s, size_t *size); /** * \brief Reads a string of wide characters from the supplied archive * \ingroup application_support * \returns U_STATUS_SUCCESS if successful, and U_STATUS_ERROR in case of failures. * \param[in] archive The archive to read from. * \param[out] s Pointer to memory that receives the wide string. * \param[out] size Pointer to memory that receives the size of the string. */ UBUNTU_DLL_PUBLIC UStatus u_application_archive_read_wstringn( UApplicationArchive *archive, const wchar_t *s, size_t size); /** * \brief Reads a blob of binary data from the supplied archive * \ingroup application_support * \returns U_STATUS_SUCCESS if successful, and U_STATUS_ERROR in case of failures. * \param[in] archive The archive to read from. * \param[out] data Pointer to memory that receives the binary data. * \param[out] size Pointer to memory that receives the size of the blob. */ UBUNTU_DLL_PUBLIC UStatus u_application_archive_read_bytes( UApplicationArchive *archive, const intptr_t *data, size_t size); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_ARCHIVE_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/description.h0000644000015600001650000000675512654347715026443 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_DESCRIPTION_H_ #define UBUNTU_APPLICATION_DESCRIPTION_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Encapsulates properties of an application instance. * \ingroup application_support */ typedef void UApplicationDescription; /** * \brief Creates a new instance of application description. * \ingroup application_support * \returns A new application description instance or NULL if not enough memory is available. */ UBUNTU_DLL_PUBLIC UApplicationDescription* u_application_description_new(); /** * \brief Destroys an instance of application description and releases all resources. * \ingroup application_support * \param[in] desc The instance to be destroyed. */ UBUNTU_DLL_PUBLIC void u_application_description_destroy( UApplicationDescription *desc); /** * \brief Sets the application id contained in the description instance. * \ingroup application_support * \param[in] desc The application description instance, must not be NULL. * \param[in] id The new application id, must not be NULL. */ UBUNTU_DLL_PUBLIC void u_application_description_set_application_id( UApplicationDescription *desc, UApplicationId *id); /** * \brief Queries the application id contained in the description instance. * \ingroup application_support * \returns The app id contained in the instance. * \param[in] desc The application description instance, must not be NULL. */ UBUNTU_DLL_PUBLIC UApplicationId* u_application_description_get_application_id( UApplicationDescription *desc); /** * \brief Sets the application lifecycle delegate * \ingroup application_support * \param[in] desc The application description instance, must not be NULL. * \param[in] lifecycle_delegate The new lifecycle delegate, must not be NULL. */ UBUNTU_DLL_PUBLIC void u_application_description_set_application_lifecycle_delegate( UApplicationDescription *desc, UApplicationLifecycleDelegate *lifecycle_delegate); /** * \brief Queries the application lifecycle delegate * \ingroup application_support * \returns The application lifecycle delegate contained in the description instance. * \param[in] desc The application description instance, must not be NULL. */ UBUNTU_DLL_PUBLIC UApplicationLifecycleDelegate* u_application_description_get_application_lifecycle_delegate( UApplicationDescription *desc); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_DESCRIPTION_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/instance.h0000644000015600001650000000725512654347715025720 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_INSTANCE_H_ #define UBUNTU_APPLICATION_INSTANCE_H_ #include #include #include #include #ifdef __cplusplus extern "C" { #endif /** \defgroup application_support Functions and types to support application development. */ /** * \brief Opaque type describing an application instance. * \ingroup application_support * An application instance encapsulates the event loop of an app. */ typedef void UApplicationInstance; /** * \brief Creates a new application instance with a reference count of 1. * \ingroup application_support * \returns A new application instance or NULL in case of low-memory. * \param[in] desc A description object, must not be NULL. * \param[in] options An options object, must not be NULL. */ UBUNTU_DLL_PUBLIC UApplicationInstance* u_application_instance_new_from_description_with_options( UApplicationDescription *desc, UApplicationOptions *options); /** * \brief Return the MirConnection associated with an application instance. * Use of MirConnection with the mir client API is now the preferred * way to create and use application surfaces. The ua_ui_ namespace * is now deprecated. * \ingroup application_support * \param[in] instance The instance from which to retreive the MirConnection */ UBUNTU_DLL_PUBLIC MirConnection* u_application_instance_get_mir_connection( UApplicationInstance *instance); /** * \brief Increments the reference count of an application instance. * \ingroup application_support * \param[in] instance The instance to increment the reference count for. */ UBUNTU_DLL_PUBLIC void u_application_instance_ref( UApplicationInstance *instance); /** * \brief Decrements the reference count of an application instance and releases all resources held by the object if the reference count reaches 0. * \ingroup application_support * \param[in] instance The instance to decrement the reference count for. */ UBUNTU_DLL_PUBLIC void u_application_instance_unref( UApplicationInstance *instance); /** * \brief Destroys the application instance and releases all its resources. * \ingroup application_support * \param[in] instance The instance to be destroyed. */ UBUNTU_DLL_PUBLIC void u_application_instance_destroy( UApplicationInstance *instance); /** * \brief Executes the event loop of the application instance * \ingroup application_support * \param[in] instance The instance to be executed. */ UBUNTU_DLL_PUBLIC void u_application_instance_run( UApplicationInstance *instance); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_INSTANCE_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/CMakeLists.txt0000644000015600001650000000050512654347715026472 0ustar pbuserpbgroup00000000000000set( UBUNTU_APPLICATION_HEADERS archive.h description.h id.h instance.h lifecycle_delegate.h operation_mode.h options.h init.h ) install( FILES ${UBUNTU_APPLICATION_HEADERS} DESTINATION include/ubuntu/application ) add_subdirectory(location) add_subdirectory(sensors) add_subdirectory(url_dispatcher) platform-api-3.0.1+16.04.20160203/include/ubuntu/application/operation_mode.h0000644000015600001650000000214412654347715027110 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_OPERATION_MODE_H_ #define UBUNTU_APPLICATION_OPERATION_MODE_H_ /** * \brief Describes the different operational modes that an * application can run in. */ typedef enum { U_APPLICATION_FOREGROUND_APP, U_APPLICATION_BACKGROUND_SERVICE } UApplicationOperationMode; #endif /* UBUNTU_APPLICATION_OPERATION_MODE_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/sensors/0000755000015600001650000000000012654350173025416 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/include/ubuntu/application/sensors/orientation.h0000644000015600001650000001142712654347715030137 0ustar pbuserpbgroup00000000000000/* * Copyright © 2014 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_ORIENTATION_H_ #define UBUNTU_APPLICATION_SENSORS_ORIENTATION_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type that models the orientation. * \ingroup sensor_access */ typedef void UASensorsOrientation; /** * \brief Callback type used by applications to subscribe to orientation events. * \ingroup sensor_access */ typedef void (*on_orientation_event_cb)(UASOrientationEvent* event, void* context); /** * \brief Create a new object for accessing the orientation sensor. * \ingroup sensor_access * \returns A new instance or NULL in case of errors. */ UBUNTU_DLL_PUBLIC UASensorsOrientation* ua_sensors_orientation_new(); /** * \brief Enables the supplied orientation sensor. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be enabled. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_orientation_enable( UASensorsOrientation* sensor); /** * \brief Disables the supplied orientation sensor. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be disabled. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_orientation_disable( UASensorsOrientation* sensor); /** * \brief Queries the minimum delay between two readings for the supplied sensor. * \ingroup sensor_access * \returns The minimum delay between two readings in [ms]. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC uint32_t ua_sensors_orientation_get_min_delay( UASensorsOrientation* sensor); /** * \brief Queries the minimum value that can be reported by the sensor. * \ingroup sensor_access * \returns The minimum value that can be reported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_orientation_get_min_value( UASensorsOrientation* sensor, float* value); /** * \brief Queries the maximum value that can be reported by the sensor. * \ingroup sensor_access * \returns The maximum value that can be reported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_orientation_get_max_value( UASensorsOrientation* sensor, float* value); /** * \brief Queries the numeric resolution supported by the sensor * \ingroup sensor_access * \returns The numeric resolution supported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_orientation_get_resolution( UASensorsOrientation* sensor, float* value); /** * \brief Set the callback to be invoked whenever a new sensor reading is available. * \ingroup sensor_access * \param[in] sensor The sensor instance to associate the callback with. * \param[in] cb The callback to be invoked. * \param[in] ctx The context supplied to the callback invocation. */ UBUNTU_DLL_PUBLIC void ua_sensors_orientation_set_reading_cb( UASensorsOrientation* sensor, on_orientation_event_cb cb, void *ctx); /** * \brief Set the sensor event delivery rate in nanoseconds.. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be modified. * \param[in] rate The new event delivery rate. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_orientation_set_event_rate( UASensorsOrientation* sensor, uint32_t rate); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_SENSORS_ORIENTATION_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/sensors/accelerometer.h0000644000015600001650000001150012654347715030406 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_ACCELEROMETER_H_ #define UBUNTU_APPLICATION_SENSORS_ACCELEROMETER_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type that models the accelerometer. * \ingroup sensor_access */ typedef void UASensorsAccelerometer; /** * \brief Callback type used by applications to subscribe to accelerometer events. * \ingroup sensor_access */ typedef void (*on_accelerometer_event_cb)(UASAccelerometerEvent* event, void* context); /** * \brief Create a new object for accessing the accelerometer. * \ingroup sensor_access * \returns A new instance or NULL in case of errors. */ UBUNTU_DLL_PUBLIC UASensorsAccelerometer* ua_sensors_accelerometer_new(); /** * \brief Enables the supplied accelerometer. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be enabled. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_enable( UASensorsAccelerometer* sensor); /** * \brief Disables the supplied accelerometer. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be disabled. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_disable( UASensorsAccelerometer* sensor); /** * \brief Queries the minimum delay between two readings for the supplied sensor. * \ingroup sensor_access * \returns The minimum delay between two readings in [ms]. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC uint32_t ua_sensors_accelerometer_get_min_delay( UASensorsAccelerometer* sensor); /** * \brief Queries the minimum value that can be reported by the sensor. * \ingroup sensor_access * \returns The minimum value that can be reported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_get_min_value( UASensorsAccelerometer* sensor, float* value); /** * \brief Queries the maximum value that can be reported by the sensor. * \ingroup sensor_access * \returns The maximum value that can be reported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_get_max_value( UASensorsAccelerometer* sensor, float* value); /** * \brief Queries the numeric resolution supported by the sensor * \ingroup sensor_access * \returns The numeric resolution supported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_get_resolution( UASensorsAccelerometer* sensor, float* value); /** * \brief Set the callback to be invoked whenever a new sensor reading is available. * \ingroup sensor_access * \param[in] sensor The sensor instance to associate the callback with. * \param[in] cb The callback to be invoked. * \param[in] ctx The context supplied to the callback invocation. */ UBUNTU_DLL_PUBLIC void ua_sensors_accelerometer_set_reading_cb( UASensorsAccelerometer* sensor, on_accelerometer_event_cb cb, void *ctx); /** * \brief Set the sensor event delivery rate in nanoseconds.. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be modified. * \param[in] rate The new event delivery rate. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_set_event_rate( UASensorsAccelerometer* sensor, uint32_t rate); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_SENSORS_ACCELEROMETER_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/sensors/haptic.h0000644000015600001650000000750412654347715027055 0ustar pbuserpbgroup00000000000000/* * Copyright © 2014 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_HAPTIC_H_ #define UBUNTU_APPLICATION_SENSORS_HAPTIC_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type that models the haptics device. * \ingroup sensor_access */ typedef void UASensorsHaptic; /** * \brief Create a new object for accessing the haptics device. Ownership is transfered to caller. * \ingroup sensor_access * \sa ua_sensors_haptic_destroy * \returns A new instance or NULL in case of errors. */ UBUNTU_DLL_PUBLIC UASensorsHaptic* ua_sensors_haptic_new(); /** * \brief Destroys the given sensor instance and releases all resources held by the instance. * \ingroup sensor_access * \param[in] sensor The instance to be destroyed. * \post All resources held by the instance are released. The result of any operation invoked on the destroyed instance are undefined. */ UBUNTU_DLL_PUBLIC void ua_sensors_haptic_destroy(UASensorsHaptic* sensor); /** * \brief Enables the supplied haptics device. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be enabled. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_haptic_enable( UASensorsHaptic* sensor); /** * \brief Disables the supplied haptics device. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be disabled. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_haptic_disable( UASensorsHaptic* sensor); /** * \brief Run the vibrator for a fixed duration. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if pushed correctly, U_STATUS_ERROR if the pattern limit is invalid or the actuator cannot be activated. * \param[in] sensor Haptic device to activate. * \param[in] duration How long should the vibrator stay on. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_haptic_vibrate_once( UASensorsHaptic* sensor, uint32_t duration); #define MAX_PATTERN_SIZE 6 /** * \brief Run the vibrator with a pattern and repeat a precise number of times. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if pushed correctly, U_STATUS_ERROR if the pattern limit is invalid or the actuator cannot be activated. * \param[in] sensor Haptic device to activate. * \param[in] pattern An array of uint32_t durations for which to keep the vibrator on or off. The first value indicates how long to keep the vibrator on for, the second value how long to keep it off for, and so on until the end of the array. * \param[in] repeat How many times to repeat the whole pattern for. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_haptic_vibrate_with_pattern( UASensorsHaptic* sensor, uint32_t pattern[MAX_PATTERN_SIZE], uint32_t repeat); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_SENSORS_HAPTIC_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/sensors/proximity.h0000644000015600001650000001134312654347715027645 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_PROXIMITY_H_ #define UBUNTU_APPLICATION_SENSORS_PROXIMITY_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type that models the proximity sensor. * \ingroup sensor_access */ typedef void UASensorsProximity; /** * \brief Callback type used by applications to subscribe to proximity sensor events. * \ingroup sensor_access */ typedef void (*on_proximity_event_cb)(UASProximityEvent* event, void* context); /** * \brief Create a new object for accessing the proximity sensor. * \ingroup sensor_access * \returns A new instance or NULL in case of errors. */ UBUNTU_DLL_PUBLIC UASensorsProximity* ua_sensors_proximity_new(); /** * \brief Enables the supplied proximity sensor. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be enabled. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_proximity_enable( UASensorsProximity* sensor); /** * \brief Disables the supplied proximity sensor. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be disabled. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_proximity_disable( UASensorsProximity* sensor); /** * \brief Queries the minimum delay between two readings for the supplied sensor. * \ingroup sensor_access * \returns The minimum delay between two readings in [ms]. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC uint32_t ua_sensors_proximity_get_min_delay( UASensorsProximity* sensor); /** * \brief Queries the minimum value that can be reported by the sensor. * \ingroup sensor_access * \returns The minimum value that can be reported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_proximity_get_min_value( UASensorsProximity* sensor, float* value); /** * \brief Queries the maximum value that can be reported by the sensor. * \ingroup sensor_access * \returns The maximum value that can be reported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_proximity_get_max_value( UASensorsProximity* sensor, float* value); /** * \brief Queries the numeric resolution supported by the sensor * \ingroup sensor_access * \returns The numeric resolution supported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_proximity_get_resolution( UASensorsProximity* sensor, float* value); /** * \brief Set the callback to be invoked whenever a new sensor reading is available. * \ingroup sensor_access * \param[in] sensor The sensor instance to associate the callback with. * \param[in] cb The callback to be invoked. * \param[in] ctx The context supplied to the callback invocation. */ UBUNTU_DLL_PUBLIC void ua_sensors_proximity_set_reading_cb( UASensorsProximity* sensor, on_proximity_event_cb cb, void *ctx); /** * \brief Set the sensor event delivery rate in nanoseconds.. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be modified. * \param[in] rate The new event delivery rate. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_proximity_set_event_rate( UASensorsProximity* sensor, uint32_t rate); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_SENSORS_PROXIMITY_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/sensors/light.h0000644000015600001650000001121312654347715026704 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_LIGHT_H_ #define UBUNTU_APPLICATION_SENSORS_LIGHT_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type that models the ambient light sensor. * \ingroup sensor_access */ typedef void UASensorsLight; /** * \brief Callback type used by applications to subscribe to ambient light sensor events. * \ingroup sensor_access */ typedef void (*on_light_event_cb)(UASLightEvent* event, void* context); /** * \brief Create a new object for accessing the ambient light sensor. * \ingroup sensor_access * \returns A new instance or NULL in case of errors. */ UBUNTU_DLL_PUBLIC UASensorsLight* ua_sensors_light_new(); /** * \brief Enables the supplied ambient light sensor. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be enabled. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_light_enable( UASensorsLight* sensor); /** * \brief Disables the supplied ambient light sensor. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be disabled. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_light_disable( UASensorsLight* sensor); /** * \brief Queries the minimum delay between two readings for the supplied sensor. * \ingroup sensor_access * \returns The minimum delay between two readings in [ms]. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC uint32_t ua_sensors_light_get_min_delay( UASensorsLight* sensor); /** * \brief Queries the minimum value that can be reported by the sensor. * \ingroup sensor_access * \returns The minimum value that can be reported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_light_get_min_value( UASensorsLight* sensor, float* value); /** * \brief Queries the maximum value that can be reported by the sensor. * \ingroup sensor_access * \returns The maximum value that can be reported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_light_get_max_value( UASensorsLight* sensor, float* value); /** * \brief Queries the numeric resolution supported by the sensor * \ingroup sensor_access * \returns The numeric resolution supported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_light_get_resolution( UASensorsLight* sensor, float* value); /** * \brief Set the callback to be invoked whenever a new sensor reading is available. * \ingroup sensor_access * \param[in] sensor The sensor instance to associate the callback with. * \param[in] cb The callback to be invoked. * \param[in] ctx The context supplied to the callback invocation. */ UBUNTU_DLL_PUBLIC void ua_sensors_light_set_reading_cb( UASensorsLight* sensor, on_light_event_cb cb, void *ctx); /** * \brief Set the sensor event delivery rate in nanoseconds.. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be modified. * \param[in] rate The new event delivery rate. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_light_set_event_rate( UASensorsLight* sensor, uint32_t rate); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_SENSORS_LIGHT_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/sensors/CMakeLists.txt0000644000015600001650000000036512654347715030172 0ustar pbuserpbgroup00000000000000set( UBUNTU_APPLICATION_SENSORS_HEADERS accelerometer.h light.h proximity.h haptic.h orientation.h ) install( FILES ${UBUNTU_APPLICATION_SENSORS_HEADERS} DESTINATION include/ubuntu/application/sensors ) add_subdirectory(event) platform-api-3.0.1+16.04.20160203/include/ubuntu/application/sensors/event/0000755000015600001650000000000012654350173026537 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/include/ubuntu/application/sensors/event/orientation.h0000644000015600001650000000522012654347715031252 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_ORIENTATION_EVENT_H_ #define UBUNTU_APPLICATION_SENSORS_ORIENTATION_EVENT_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type describing an orientation reading. * \ingroup sensor_access */ typedef void UASOrientationEvent; /** * \brief Query the timestamp of the sensor reading. * \ingroup sensor_access * \returns The timestamp of the sensor reading in [µs], timebase: monotonic clock. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC uint64_t uas_orientation_event_get_timestamp( UASOrientationEvent* event); /** * \brief Query the azimuth (rotation around Z-axis). * \ingroup sensor_access * \returns U_STATUS_SUCCESS if the updates were successfully started on the service side, else U_STATUS_ERROR. * \param[out] value The reading to be queried. */ UBUNTU_DLL_PUBLIC UStatus uas_orientation_event_get_azimuth( UASOrientationEvent* event, float* value); /** * \brief Query the pitch (rotation around X-axis). * \ingroup sensor_access * \returns U_STATUS_SUCCESS if the updates were successfully started on the service side, else U_STATUS_ERROR. * \param[out] value The reading to be queried. */ UBUNTU_DLL_PUBLIC UStatus uas_orientation_event_get_pitch( UASOrientationEvent* event, float* value); /** * \brief Query the roll (rotation around Y-axis). * \ingroup sensor_access * \returns U_STATUS_SUCCESS if the updates were successfully started on the service side, else U_STATUS_ERROR. * \param[out] value The reading to be queried. */ UBUNTU_DLL_PUBLIC UStatus uas_orientation_event_get_roll( UASOrientationEvent* event, float* value); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_SENSORS_ORIENTATION_EVENT_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/sensors/event/accelerometer.h0000644000015600001650000000501412654347715031532 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_ACCELEROMETER_EVENT_H_ #define UBUNTU_APPLICATION_SENSORS_ACCELEROMETER_EVENT_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type describing an accelerometer reading. * \ingroup sensor_access */ typedef void UASAccelerometerEvent; /** * \brief Query the timestamp of the sensor reading. * \ingroup sensor_access * \returns The timestamp of the sensor reading in [µs], timebase: monotonic clock. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC uint64_t uas_accelerometer_event_get_timestamp( UASAccelerometerEvent* event); /** * \brief Query the acceleration in x-axis direction. * \ingroup sensor_access * \returns The acceleration in x-axis direction. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC UStatus uas_accelerometer_event_get_acceleration_x( UASAccelerometerEvent* event, float* value); /** * \brief Query the acceleration in y-axis direction. * \ingroup sensor_access * \returns The acceleration in y-axis direction. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC UStatus uas_accelerometer_event_get_acceleration_y( UASAccelerometerEvent* event, float* value); /** * \brief Query the acceleration in z-axis direction. * \ingroup sensor_access * \returns The acceleration in z-axis direction. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC UStatus uas_accelerometer_event_get_acceleration_z( UASAccelerometerEvent* event, float* value); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_SENSORS_ACCELEROMETER_EVENT_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/sensors/event/proximity.h0000644000015600001650000000446312654347715030773 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_PROXIMITY_EVENT_H_ #define UBUNTU_APPLICATION_SENSORS_PROXIMITY_EVENT_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Useful constants when inspecting readings from the proximity sensor. * \ingroup sensor_access */ typedef enum { U_PROXIMITY_NEAR = 1, /**< The reading indicates that something is near the sensor/device. */ U_PROXIMITY_FAR = 2 /**< The reading indicates that something is far away from the sensor/device. */ } UbuntuApplicationSensorsProximityDistance; typedef UbuntuApplicationSensorsProximityDistance UASProximityDistance; /** * \brief Opaque type describing an accelerometer reading. * \ingroup sensor_access */ typedef void UASProximityEvent; /** * \brief Query the timestamp of the sensor reading. * \ingroup sensor_access * \returns The timestamp of the sensor reading in [µs], timebase: monotonic clock. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC uint64_t uas_proximity_event_get_timestamp( UASProximityEvent* event); /** * \brief Query the discrete distance as reported by the proximity sensor. * \ingroup sensor_access * \returns The discrete distance as reported by the proximity sensor. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC UASProximityDistance uas_proximity_event_get_distance( UASProximityEvent* event); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_SENSORS_PROXIMITY_EVENT_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/sensors/event/light.h0000644000015600001650000000341512654347715030032 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_LIGHT_EVENT_H_ #define UBUNTU_APPLICATION_SENSORS_LIGHT_EVENT_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type describing an ambient light sensor reading. * \ingroup sensor_access */ typedef void UASLightEvent; /** * \brief Query the timestamp of the sensor reading. * \ingroup sensor_access * \returns The timestamp of the sensor reading in [µs], timebase: monotonic clock. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC uint64_t uas_light_event_get_timestamp( UASLightEvent* event); /** * \brief Query the value measured by the ambient light sensor. * \ingroup sensor_access * \returns The ambient light level. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC UStatus uas_light_event_get_light( UASLightEvent* event, float* value); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_SENSORS_LIGHT_EVENT_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/sensors/event/CMakeLists.txt0000644000015600001650000000034312654347715031307 0ustar pbuserpbgroup00000000000000set( UBUNTU_APPLICATION_SENSORS_EVENT_HEADERS accelerometer.h light.h proximity.h orientation.h ) install( FILES ${UBUNTU_APPLICATION_SENSORS_EVENT_HEADERS} DESTINATION include/ubuntu/application/sensors/event ) platform-api-3.0.1+16.04.20160203/include/ubuntu/application/options.h0000644000015600001650000000431612654347715025602 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_OPTIONS_H_ #define UBUNTU_APPLICATION_OPTIONS_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Encapsulates options as passed to the application. * \ingroup application_support */ typedef void UApplicationOptions; /** * \brief Parses options from the command line. * \ingroup application_support * \returns An options instance if parsing was successful, or 0 otheriwse. * \param[in] argc Number of arguments. * \param[in] argv Arguments. */ UBUNTU_DLL_PUBLIC UApplicationOptions* u_application_options_new_from_cmd_line( int argc, char** argv); /** * \brief Destroys the options object and releases all resources. * \ingroup application_support * \param[in] options The object to be destroyed. */ UBUNTU_DLL_PUBLIC void u_application_options_destroy( UApplicationOptions *options); /** * \brief Queries the operation mode from the supplied options object. * \ingroup application_support * \returns The operation mode as stored in the options object. * \param[in] options The options object to be queried. */ UBUNTU_DLL_PUBLIC UApplicationOperationMode u_application_options_get_operation_mode( UApplicationOptions *options); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_OPTIONS_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/application/lifecycle_delegate.h0000644000015600001650000001361412654347715027701 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_LIFECYCLE_DELEGATE_H_ #define UBUNTU_APPLICATION_LIFECYCLE_DELEGATE_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Prototype for the callback that is invoked whenever the app has been resumed. * \ingroup application_support * \param[in] options Application instance options * \param[in] context The callback context as specified by the application */ typedef void (*u_on_application_resumed)(const UApplicationOptions *options, void *context); /** * \brief Prototype for the callback that is invoked whenever the app is about to be stopped. * Applications can serialize their state to the supplied archive. * \ingroup application_support */ typedef void (*u_on_application_about_to_stop)(UApplicationArchive *archive, void *context); /** * \brief Opaque type encapsulating all app-specific callback functions. * \ingroup application_support */ typedef void UApplicationLifecycleDelegate; /** * \brief Creates a new instance of the lifecycle delegate with an initial refernce count of 1. * \ingroup application_support * \returns A new instance of the lifecycle delegate or NULL if no memory is available. */ UBUNTU_DLL_PUBLIC UApplicationLifecycleDelegate* u_application_lifecycle_delegate_new(); /** * \brief Destroys an instance of the lifecycle delegate and releases all of its resources. * \ingroup application_support * \param[in] delegate The instance to be destroyed. */ UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_destroy( UApplicationLifecycleDelegate *delegate); /** * \brief Increments the reference count of the supplied lifecycle delegate. * \ingroup application_support * \param[in] delegate The lifecycle delegate to increment the reference count for. */ UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_ref( UApplicationLifecycleDelegate *delegate); /** * \brief Decrements the reference count of the supplied lifecycle delegate and destroys it if the count reaches 0. * \ingroup application_support * \param[in] delegate The lifecycle delegate to decrement the reference count for. */ UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_unref( UApplicationLifecycleDelegate *delegate); /** * \brief Sets the resumed cb for the supplied delegate. * \ingroup application_support * \param[in] delegate The lifecycle delegate to adjust the cb for. * \param[in] cb The new callback to be invoked whenever the app resumes. */ UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_set_application_resumed_cb( UApplicationLifecycleDelegate *delegate, u_on_application_resumed cb); /** * \brief Queries the resumed cb from the supplied delegate. * \ingroup application_support * \returns The callback to be invoked whenever the app resumes. * \param[in] delegate The lifecycle delegate to query the callback from. */ UBUNTU_DLL_PUBLIC u_on_application_resumed u_application_lifecycle_delegate_get_application_resumed_cb( UApplicationLifecycleDelegate *delegate); /** * \brief Sets the about-to-stop cb for the supplied delegate. * \ingroup application_support * \param[in] delegate The lifecycle delegate to adjust the cb for. * \param[in] cb The new callback to be invoked whenever the app is about to be stopped.. */ UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_set_application_about_to_stop_cb( UApplicationLifecycleDelegate *delegate, u_on_application_about_to_stop cb); /** * \brief Queries the about-to-be-stopped cb from the supplied delegate. * \ingroup application_support * \returns The callback to be invoked whenever the app is about to be stopped. * \param[in] delegate The lifecycle delegate to query the callback from. */ UBUNTU_DLL_PUBLIC u_on_application_about_to_stop u_application_lifecycle_delegate_get_application_about_to_stop_cb( UApplicationLifecycleDelegate *delegate); /** * \brief Sets the cb context for the supplied delegate. * \ingroup application_support * \param[in] delegate The lifecycle delegate to adjust the context for. * \param[in] context The new cb context. */ UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_set_context( UApplicationLifecycleDelegate *delegate, void *context); /** * \brief Queries the cb context from the supplied delegate. * \ingroup application_support * \returns The context that is passed to callbacks of this delegate. * \param[in] delegate The lifecycle delegate to query the context from. * \param[in] context Unused. */ UBUNTU_DLL_PUBLIC void* u_application_lifecycle_delegate_get_context( UApplicationLifecycleDelegate *delegate, void *context); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_LIFECYCLE_DELEGATE_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/visibility.h0000644000015600001650000000177012654347715023774 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_VISIBILITY_H_ #define UBUNTU_VISIBILITY_H_ #if __GNUC__ >= 4 #define UBUNTU_DLL_PUBLIC __attribute__ ((visibility ("default"))) #define UBUNTU_DLL_LOCAL __attribute__ ((visibility ("hidden"))) #else #define UBUNTU_DLL_PUBLIC #define UBUNTU_DLL_LOCAL #endif #endif /* UBUNTU_VISIBILITY_H_ */ platform-api-3.0.1+16.04.20160203/include/ubuntu/status.h0000644000015600001650000000210112654347715023115 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß * Ricardo Mendoza . * * Authored by: Thomas Voß * Ricardo Mendoza . * * Authored by: Thomas Voß */ #ifndef UBUNTU_HARDWARE_BOOSTER_H_ #define UBUNTU_HARDWARE_BOOSTER_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif typedef enum { /** @brief Boost device performance to account for user interacting with device. */ U_HARDWARE_BOOSTER_SCENARIO_USER_INTERACTION } UbuntuHardwareBoosterScenario; /** @brief Enumerates all known performance boosting scenarios. */ typedef UbuntuHardwareBoosterScenario UHardwareBoosterScenario; /** @cond */ typedef struct UbuntuHardwareBooster; /** @endcond */ /** @brief UbuntuHardwareBooster is an opaque type providing access to the performance booster capabilities of the HW and drivers. */ typedef UbuntuHardwareBooster UHardwareBooster; /** @brief u_hardware_booster_new creates a new UHardwareBooster* instance with an initial referrence count of 1. */ UBUNTU_DLL_PUBLIC UHardwareBooster* u_hardware_booster_new(); /** @brief u_hardware_booster_ref increases the reference count of booster by 1. */ UBUNTU_DLL_PUBLIC void u_hardware_booster_ref(UHardwareBooster*); /** @brief u_hardware_booster_unref decreases the reference count of booster by 1. */ UBUNTU_DLL_PUBLIC void u_hardware_booster_unref(UHardwareBooster*); /** u_hardware_booster_enable_scenario informs booster to ramp up system performance to support scenario. */ UBUNTU_DLL_PUBLIC void u_hardware_booster_enable_scenario(UHardwareBooster*, UHardwareBoosterScenario); /** u_hardware_booster_enable_scenario informs booster that scenario is no longer active. */ UBUNTU_DLL_PUBLIC void u_hardware_booster_disable_scenario(UHardwareBooster*, UHardwareBoosterScenario); #ifdef __cplusplus } #endif #endif // UBUNTU_HARDWARE_BOOSTER_H_ platform-api-3.0.1+16.04.20160203/include/ubuntu/hardware/gps.h0000644000015600001650000004253412654347715024176 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Daniel d'Andrada * Authored by: Thomas Voß */ #ifndef UBUNTU_HARDWARE_GPS_H_ #define UBUNTU_HARDWARE_GPS_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** \defgroup gps_access Functions and types for accessing GPS H/W. */ /** * Maximum number of SVs for u_hardware_gps_sv_status_callback(). * \ingroup gps_access */ #define U_HARDWARE_GPS_MAX_SVS 32 /** * The status of the GPS hardware. * \ingroup gps_access */ enum { /** GPS status unknown. */ U_HARDWARE_GPS_STATUS_NONE = 0, /** GPS has begun navigating. */ U_HARDWARE_GPS_STATUS_SESSION_BEGIN = 1, /** GPS has stopped navigating. */ U_HARDWARE_GPS_STATUS_SESSION_END = 2, /** GPS has powered on but is not navigating. */ U_HARDWARE_GPS_STATUS_ENGINE_ON = 3, /** GPS is powered off. */ U_HARDWARE_GPS_STATUS_ENGINE_OFF = 4 }; /** * Flags for the gps_set_capabilities callback. * \ingroup gps_access * GPS HAL schedules fixes for U_HARDWARE_GPS_POSITION_RECURRENCE_PERIODIC mode. * If this is not set, then the framework will use 1000ms for min_interval * and will start and call start() and stop() to schedule the GPS. */ #define U_HARDWARE_GPS_CAPABILITY_SCHEDULING 0x0000001 /** GPS supports MS-Based AGPS mode */ #define U_HARDWARE_GPS_CAPABILITY_MSB 0x0000002 /** GPS supports MS-Assisted AGPS mode */ #define U_HARDWARE_GPS_CAPABILITY_MSA 0x0000004 /** GPS supports single-shot fixes */ #define U_HARDWARE_GPS_CAPABILITY_SINGLE_SHOT 0x0000008 /** GPS supports on demand time injection */ #define U_HARDWARE_GPS_CAPABILITY_ON_DEMAND_TIME 0x0000010 /** * UHardwareGpsNiNotifyFlags constants * \ingroup gps_access */ typedef uint32_t UHardwareGpsNiNotifyFlags; /** NI requires notification */ #define U_HARDWARE_GPS_NI_NEED_NOTIFY 0x0001 /** NI requires verification */ #define U_HARDWARE_GPS_NI_NEED_VERIFY 0x0002 /** NI requires privacy override, no notification/minimal trace */ #define U_HARDWARE_GPS_NI_PRIVACY_OVERRIDE 0x0004 /** * GPS NI responses, used to define the response in * NI structures * \ingroup gps_access */ typedef int UHardwareGpsUserResponseType; enum { U_HARDWARE_GPS_NI_RESPONSE_ACCEPT = 1, U_HARDWARE_GPS_NI_RESPONSE_DENY = 2, U_HARDWARE_GPS_NI_RESPONSE_NORESP = 3 }; enum { U_HARDWARE_GPS_NI_TYPE_VOICE = 1, U_HARDWARE_GPS_NI_TYPE_UMTS_SUPL = 2, U_HARDWARE_GPS_NI_TYPE_UMTS_CTRL_PLANE = 3 }; /** * String length constants * \ingroup gps_access */ #define U_HARDWARE_GPS_NI_SHORT_STRING_MAXLEN 256 #define U_HARDWARE_GPS_NI_LONG_STRING_MAXLEN 2048 /** * NI data encoding scheme * \ingroup gps_access */ typedef int UHardwareGpsNiEncodingType; /** * Known encoding types for Ni responses * \ingroup gps_access */ enum { U_HARDWARE_GPS_ENC_NONE = 0, U_HARDWARE_GPS_ENC_SUPL_GSM_DEFAULT = 1, U_HARDWARE_GPS_ENC_SUPL_UTF8 = 2, U_HARDWARE_GPS_ENC_SUPL_UCS2 = 3, U_HARDWARE_GPS_ENC_UNKNOWN = -1 }; /** * Known AGPS types * \ingroup gps_access */ enum { U_HARDWARE_GPS_AGPS_TYPE_SUPL = 1, U_HARDWARE_GPS_AGPS_TYPE_C2K = 2 }; /** * Known positioning modes * \ingroup gps_access */ enum { /** Mode for running GPS standalone (no assistance). */ U_HARDWARE_GPS_POSITION_MODE_STANDALONE = 0, /** AGPS MS-Based mode. */ U_HARDWARE_GPS_POSITION_MODE_MS_BASED = 1, /** AGPS MS-Assisted mode. */ U_HARDWARE_GPS_POSITION_MODE_MS_ASSISTED = 2 }; /** * Known positioning modes * \ingroup gps_access */ enum { /** Receive GPS fixes on a recurring basis at a specified period. */ U_HARDWARE_GPS_POSITION_RECURRENCE_PERIODIC = 0, /** Request a single shot GPS fix. */ U_HARDWARE_GPS_POSITION_RECURRENCE_SINGLE = 1 }; enum { /** GPS requests data connection for AGPS. */ U_HARDWARE_GPS_REQUEST_AGPS_DATA_CONN = 1, /** GPS releases the AGPS data connection. */ U_HARDWARE_GPS_RELEASE_AGPS_DATA_CONN = 2, /** AGPS data connection initiated */ U_HARDWARE_GPS_AGPS_DATA_CONNECTED = 3, /** AGPS data connection completed */ U_HARDWARE_GPS_AGPS_DATA_CONN_DONE = 4, /** AGPS data connection failed */ U_HARDWARE_GPS_AGPS_DATA_CONN_FAILED = 5 }; /** Flags used to specify which aiding data to delete when calling delete_aiding_data(). */ typedef uint16_t UHardwareGpsAidingData; #define U_HARDWARE_GPS_DELETE_EPHEMERIS 0x0001 #define U_HARDWARE_GPS_DELETE_ALMANAC 0x0002 #define U_HARDWARE_GPS_DELETE_POSITION 0x0004 #define U_HARDWARE_GPS_DELETE_TIME 0x0008 #define U_HARDWARE_GPS_DELETE_IONO 0x0010 #define U_HARDWARE_GPS_DELETE_UTC 0x0020 #define U_HARDWARE_GPS_DELETE_HEALTH 0x0040 #define U_HARDWARE_GPS_DELETE_SVDIR 0x0080 #define U_HARDWARE_GPS_DELETE_SVSTEER 0x0100 #define U_HARDWARE_GPS_DELETE_SADATA 0x0200 #define U_HARDWARE_GPS_DELETE_RTI 0x0400 #define U_HARDWARE_GPS_DELETE_CELLDB_INFO 0x8000 #define U_HARDWARE_GPS_DELETE_ALL 0xFFFF /** AGPS type */ typedef uint16_t UHardwareGpsAGpsType; #define U_HARDWARE_GPS_AGPS_TYPE_SUPL 1 #define U_HARDWARE_GPS_AGPS_TYPE_C2K 2 /** Known types for AGps reference locations. */ /** A GSM cell ID. */ #define U_HARDWARE_GPS_AGPS_REF_LOCATION_TYPE_GSM_CELLID 1 /** A UMTS cell ID. */ #define U_HARDWARE_GPS_AGPS_REF_LOCATION_TYPE_UMTS_CELLID 2 /** The BSSID of a visible access point. */ #define U_HARDWARE_GPS_AGPS_REG_LOCATION_TYPE_MAC 3 /** UHardwareGpsLocation has valid latitude and longitude. */ #define U_HARDWARE_GPS_LOCATION_HAS_LAT_LONG 0x0001 /** UHardwareGpsLocation has valid altitude. */ #define U_HARDWARE_GPS_LOCATION_HAS_ALTITUDE 0x0002 /** UHardwareGpsLocation has valid speed. */ #define U_HARDWARE_GPS_LOCATION_HAS_SPEED 0x0004 /** UHardwareGpsLocation has valid bearing. */ #define U_HARDWARE_GPS_LOCATION_HAS_BEARING 0x0008 /** UHardwareGpsLocation has valid accuracy. */ #define U_HARDWARE_GPS_LOCATION_HAS_ACCURACY 0x0010 typedef struct UHardwareGps_* UHardwareGps; /** * Models a location as reported by the GPS HAL. * \ingroup gps_access */ typedef struct { /** set to sizeof(UHardwareGpsLocation) */ size_t size; /** Contains U_HARDWARE_GPS_LOCATION_* flags bits. */ uint16_t flags; /** Represents latitude in degrees. */ double latitude; /** Represents longitude in degrees. */ double longitude; /** Represents altitude in meters above the WGS 84 reference ellipsoid. */ double altitude; /** Represents speed in meters per second. */ float speed; /** Represents heading in degrees. */ float bearing; /** Represents expected accuracy in meters. */ float accuracy; /** Timestamp for the location fix, in milliseconds since January 1, 1970 */ int64_t timestamp; } UHardwareGpsLocation; /** * Represents space vehicle (satellite) information. * \ingroup gps_access */ typedef struct { /** set to sizeof(UHardwareGpsSvInfo) */ size_t size; /** Pseudo-random number for the SV. */ int prn; /** Signal to noise ratio. */ float snr; /** Elevation of SV in degrees. */ float elevation; /** Azimuth of SV in degrees. */ float azimuth; } UHardwareGpsSvInfo; /** * Represents SV (Space Vehicle) status. * \ingroup gps_access */ typedef struct { /** set to sizeof(GpsSvStatus) */ size_t size; /** Number of SVs currently visible. */ int num_svs; /** Contains an array of SV information. */ UHardwareGpsSvInfo sv_list[U_HARDWARE_GPS_MAX_SVS]; /** Represents a bit mask indicating which SVs * have ephemeris data. */ uint32_t ephemeris_mask; /** Represents a bit mask indicating which SVs * have almanac data. */ uint32_t almanac_mask; /** * Represents a bit mask indicating which SVs * were used for computing the most recent position fix. */ uint32_t used_in_fix_mask; } UHardwareGpsSvStatus; /** * Represents the status of AGPS. * \ingroup gps_access */ typedef struct { /** set to sizeof(UHardwareGpsAGpsStatus) */ size_t size; uint16_t type; uint16_t status; uint32_t ipaddr; } UHardwareGpsAGpsStatus; /** \brief Describes a cell ID as understood by the GPS chipset. */ typedef struct { /** One of: * U_HARDWARE_GPS_AGPS_REF_LOCATION_TYPE_GSM_CELLID * U_HARDWARE_GPS_AGPS_REF_LOCATION_TYPE_UMTS_CELLID */ uint16_t type; /** Mobile country code. */ uint16_t mcc; /** Mobile network code. */ uint16_t mnc; /** Location area code. */ uint16_t lac; /** The actual cell id. */ uint32_t cid; } UHardwareGpsAGpsRefLocationCellID; /** \brief Describes a wifi ID as understood by the GPS chipset. */ typedef struct { /** The MAC address/BSSID of an AP. */ uint8_t mac[6]; } UHardwareGpsAGpsRefLocationMac; /** @brief Describes a reference location, either a radio cell or a wifi. */ typedef struct { /** One of: * U_HARDWARE_GPS_AGPS_REF_LOCATION_TYPE_GSM_CELLID * U_HARDWARE_GPS_AGPS_REF_LOCATION_TYPE_UMTS_CELLID * U_HARDWARE_GPS_AGPS_REG_LOCATION_TYPE_MAC */ uint16_t type; union { UHardwareGpsAGpsRefLocationCellID cellID; UHardwareGpsAGpsRefLocationMac mac; } u; } UHardwareGpsAGpsRefLocation; /** * Represents an NI request * \ingroup gps_access */ typedef struct { /** set to sizeof(UHardwareGpsNiNotification) */ size_t size; /** * An ID generated by HAL to associate NI notifications and UI * responses */ int notification_id; /** * An NI type used to distinguish different categories of NI * events, such as U_HARDWARE_GPS_NI_TYPE_VOICE, U_HARDWARE_GPS_NI_TYPE_UMTS_SUPL, ... */ uint32_t ni_type; /** * Notification/verification options, combinations of UHardwareGpsNiNotifyFlags constants */ UHardwareGpsNiNotifyFlags notify_flags; /** * Timeout period to wait for user response. * Set to 0 for no time out limit. */ int timeout; /** * Default response when time out. */ UHardwareGpsUserResponseType default_response; /** * Requestor ID */ char requestor_id[U_HARDWARE_GPS_NI_SHORT_STRING_MAXLEN]; /** * Notification message. It can also be used to store client_id in some cases */ char text[U_HARDWARE_GPS_NI_LONG_STRING_MAXLEN]; /** * Client name decoding scheme */ UHardwareGpsNiEncodingType requestor_id_encoding; /** * Client name decoding scheme */ UHardwareGpsNiEncodingType text_encoding; /** * A pointer to extra data. Format: * key_1 = value_1 * key_2 = value_2 */ char extras[U_HARDWARE_GPS_NI_LONG_STRING_MAXLEN]; } UHardwareGpsNiNotification; typedef void (*UHardwareGpsLocationCallback)(UHardwareGpsLocation *location, void *context); typedef void (*UHardwareGpsStatusCallback)(uint16_t status, void *context); typedef void (*UHardwareGpsSvStatusCallback)(UHardwareGpsSvStatus *sv_info, void *context); typedef void (*UHardwareGpsNmeaCallback)(int64_t timestamp, const char *nmea, int length, void *context); typedef void (*UHardwareGpsSetCapabilities)(uint32_t capabilities, void *context); typedef void (*UHardwareGpsRequestUtcTime)(void *context); /** Callback to request the client to download XTRA data. The client should download XTRA data and inject it by calling inject_xtra_data(). */ typedef void (*UHardwareGpsXtraDownloadRequest)(void *context); /** Callback with AGPS status information. */ typedef void (*UHardwareGpsAGpsStatusCallback)(UHardwareGpsAGpsStatus *status, void *context); /** Callback with NI notification. */ typedef void (*UHardwareGpsNiNotifyCallback)(UHardwareGpsNiNotification *notification, void *context); /** Callback invoked by the driver to set the set id. */ typedef void (*UHardwareGpsAGpsRilRequestSetId)(uint32_t flags, void *context); /** Callback invoked by the driver to request a reference location (typically cell ID). */ typedef void (*UHardwareGpsAGpsRilRequestRefLoc)(uint32_t flags, void *context); typedef struct { UHardwareGpsLocationCallback location_cb; UHardwareGpsStatusCallback status_cb; UHardwareGpsSvStatusCallback sv_status_cb; UHardwareGpsNmeaCallback nmea_cb; UHardwareGpsSetCapabilities set_capabilities_cb; UHardwareGpsRequestUtcTime request_utc_time_cb; UHardwareGpsXtraDownloadRequest xtra_download_request_cb; UHardwareGpsAGpsStatusCallback agps_status_cb; UHardwareGpsNiNotifyCallback gps_ni_notify_cb; UHardwareGpsAGpsRilRequestSetId request_setid_cb; UHardwareGpsAGpsRilRequestRefLoc request_refloc_cb; void* context; } UHardwareGpsParams; /* You must create only one instance per process/application. */ UBUNTU_DLL_PUBLIC UHardwareGps u_hardware_gps_new(UHardwareGpsParams *params); UBUNTU_DLL_PUBLIC void u_hardware_gps_delete(UHardwareGps handle); UBUNTU_DLL_PUBLIC bool u_hardware_gps_start(UHardwareGps self); UBUNTU_DLL_PUBLIC bool u_hardware_gps_stop(UHardwareGps self); /** \brief Injects a new reference time into the GPS chipset. * \param time NTP time, in milliseconds since Jan 1st 1970. * \param time_reference time from the internal clock at the moment that NTP time was taken. * \param uncertainty possible deviation in the time supplied (uncertainty) in milliseconds. */ UBUNTU_DLL_PUBLIC void u_hardware_gps_inject_time( UHardwareGps self, int64_t time, int64_t time_reference, int uncertainty); /** * \brief Injects a new reference location into the GPS chipset. * \param self The instance to apply the change to. * \param location New location to me injected. The structure must have the following details, any others are ignored: * - location: New coordinate, in [°]. * - longitude: New coordinate, [°]. * - accuracy: Accuracy estimate of the location, in [m]. */ UBUNTU_DLL_PUBLIC void u_hardware_gps_inject_location( UHardwareGps self, UHardwareGpsLocation location); /** * \brief Informs the GPS chipset about wifi ap's or radio cells to be used in AGPS calls. * \param self The instance to inform. * \param location The reference location, that is a wifi ap or a radio cell. * \param size_of_struct The size of the reference location struct. */ UBUNTU_DLL_PUBLIC void u_hardware_gps_agps_set_reference_location( UHardwareGps self, UHardwareGpsAGpsRefLocation *location, size_t size_of_struct); /** * \brief Notifies the chipset that a data connection is availble. * \param self The instance to be notified. * \param apn Name of the apn to be used for SUPL. */ UBUNTU_DLL_PUBLIC void u_hardware_gps_agps_notify_connection_is_open( UHardwareGps self, const char *apn); /** * \brief Notifies the chipset that an AGPS data connection has been closed. * \param self The instance to be notified. */ UBUNTU_DLL_PUBLIC void u_hardware_gps_agps_notify_connection_is_closed( UHardwareGps self); /** * \brief Notifies the chipset that an AGPS data connection is not available. * \param self The instance to be notified. */ UBUNTU_DLL_PUBLIC void u_hardware_gps_agps_notify_connection_not_available( UHardwareGps self); /** * \brief Sets the hostname and port for the AGPS server. * \param self The instance to be altered. * \param type Type of the server, one of U_HARDWARE_GPS_AGPS_TYPE_SUPL or U_HARDWARE_GPS_AGPS_TYPE_C2K. * \param hostname The hostname of the AGPS server. * \param port The post of the AGPS server. */ UBUNTU_DLL_PUBLIC void u_hardware_gps_agps_set_server_for_type( UHardwareGps self, UHardwareGpsAGpsType type, const char* hostname, uint16_t port); /** * \brief Requests the chipset to delete the aiding data specified in flags. * \param self The instance to apply the change to. * \param flags Specifies the aiding data that should be deleted. */ UBUNTU_DLL_PUBLIC void u_hardware_gps_delete_aiding_data( UHardwareGps self, UHardwareGpsAidingData flags); /** * \brief Sets the positioning mode of the chipset. * \param mode One of the U_HARDWARE_GPS_POSITION_MODE_* values * \param recurrence One of the U_HARDWARE_GPS_POSITION_RECURRENCE_* values * \param min_interval represents the time between fixes in milliseconds. * \param preferred_accuracy The requested fix accuracy in meters. Can be zero. * \param preferred_time The requested time to first fix in milliseconds. Can be zero. */ UBUNTU_DLL_PUBLIC bool u_hardware_gps_set_position_mode( UHardwareGps self, uint32_t mode, uint32_t recurrence, uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time); UBUNTU_DLL_PUBLIC void u_hardware_gps_inject_xtra_data( UHardwareGps self, char* data, int length); #ifdef __cplusplus } #endif #endif // UBUNTU_HARDWARE_GPS_H_ platform-api-3.0.1+16.04.20160203/include/ubuntu/hardware/alarm.h0000644000015600001650000000631612654347715024477 0ustar pbuserpbgroup00000000000000/* * Copyright © 2014 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_HARDWARE_ALARM_H_ #define UBUNTU_HARDWARE_ALARM_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** The time reference that alarms are setup to. */ typedef enum { U_HARDWARE_ALARM_TIME_REFERENCE_BOOT, /**< Relative to the device's boot time, including sleep. */ U_HARDWARE_ALARM_TIME_REFERENCE_RTC /**< Wall clock time in UTC. */ } UbuntuHardwareAlarmTimeReference; typedef UbuntuHardwareAlarmTimeReference UHardwareAlarmTimeReference; /** Describes if an alarm is able to wakup the device from sleep. */ typedef enum { /** Alarm will wakeup the device from sleep. */ U_HARDWARE_ALARM_SLEEP_BEHAVIOR_WAKEUP_DEVICE, /** Alarm will not wakeup the device and will be delivered on the next wakeup of the device */ U_HARDWARE_ALARM_SLEEP_BEHAVIOR_KEEP_DEVICE_ASLEEP } UbuntuHardwareAlarmSleepBehavior; typedef UbuntuHardwareAlarmSleepBehavior UHardwareAlarmSleepBehavior; /** Bundles the time reference and sleep/wakeup behavior when waiting for an alarm to happen. */ typedef struct { UHardwareAlarmTimeReference reference; UHardwareAlarmSleepBehavior sleep_behavior; } UbuntuHardwareAlarmWaitResult; typedef UbuntuHardwareAlarmWaitResult UHardwareAlarmWaitResult; /** Opaque type modelling access to the kernel/hw-level alarm capabilities. */ typedef struct UbuntuHardwareAlarm* UHardwareAlarm; /** Creates an instance and/or increments its refcount. */ UBUNTU_DLL_PUBLIC UHardwareAlarm u_hardware_alarm_create(); /** Increments the instance's ref count. */ UBUNTU_DLL_PUBLIC void u_hardware_alarm_ref( UHardwareAlarm alarm); /** Decrements the instance's ref count. */ UBUNTU_DLL_PUBLIC void u_hardware_alarm_unref( UHardwareAlarm alarm); /** Query the time that elapsed since boot, including deep sleeps. */ UBUNTU_DLL_PUBLIC UStatus u_hardware_alarm_get_elapsed_real_time( UHardwareAlarm alarm, struct timespec *tz); /** Reports a timezone change to kernel and HW. */ UBUNTU_DLL_PUBLIC UStatus u_hardware_alarm_set_timezone( UHardwareAlarm alarm, const struct timezone *tz); /** Sets and arms a timer. */ UBUNTU_DLL_PUBLIC UStatus u_hardware_alarm_set_relative_to_with_behavior( UHardwareAlarm alarm, UHardwareAlarmTimeReference time_reference, UHardwareAlarmSleepBehavior behavior, const struct timespec *ts); /** Blocks until the next alarm occurs. */ UBUNTU_DLL_PUBLIC UStatus u_hardware_alarm_wait_for_next_alarm( UHardwareAlarm alarm, UHardwareAlarmWaitResult *result); #ifdef __cplusplus } #endif #endif platform-api-3.0.1+16.04.20160203/include/ubuntu/hardware/CMakeLists.txt0000644000015600001650000000022412654347724025762 0ustar pbuserpbgroup00000000000000set( UBUNTU_HARDWARE_HEADERS alarm.h booster.h gps.h ) install( FILES ${UBUNTU_HARDWARE_HEADERS} DESTINATION include/ubuntu/hardware ) platform-api-3.0.1+16.04.20160203/include/ubuntu/CMakeLists.txt0000644000015600001650000000026712654347715024174 0ustar pbuserpbgroup00000000000000set( UBUNTU_HEADERS status.h unit.h visibility.h ) install( FILES ${UBUNTU_HEADERS} DESTINATION include/ubuntu ) add_subdirectory(application) add_subdirectory(hardware)platform-api-3.0.1+16.04.20160203/include/CMakeLists.txt0000644000015600001650000000003112654347715022637 0ustar pbuserpbgroup00000000000000add_subdirectory(ubuntu) platform-api-3.0.1+16.04.20160203/src/0000755000015600001650000000000012654350173017241 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/src/bridge/0000755000015600001650000000000012654350173020475 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/src/bridge/bridge.h0000644000015600001650000000406412654347715022116 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss * Ricardo Mendoza */ #ifndef BASE_BRIDGE_H_ #define BASE_BRIDGE_H_ #include #include #include #include #include #include #define MAX_MODULE_NAME 32 #define HIDDEN_SYMBOL __attribute__ ((visibility ("hidden"))) namespace internal { template class HIDDEN_SYMBOL Bridge { public: static Bridge& instance() { static Bridge bridge; return bridge; } void* resolve_symbol(const char* symbol, const char* module = "") const { static const char* test_modules = secure_getenv("UBUNTU_PLATFORM_API_TEST_OVERRIDE"); if (test_modules && strstr(test_modules, module)) { printf("Platform API: INFO: Overriding symbol '%s' with test version\n", symbol); return Scope::dlsym_fn(lib_override_handle, symbol); } else { return Scope::dlsym_fn(lib_handle, symbol); } } protected: Bridge() : lib_handle(Scope::dlopen_fn(Scope::path(), RTLD_LAZY)) { if (Scope::override_path() && secure_getenv("UBUNTU_PLATFORM_API_TEST_OVERRIDE")) lib_override_handle = (Scope::dlopen_fn(Scope::override_path(), RTLD_LAZY)); } ~Bridge() { } void* lib_handle; void* lib_override_handle; }; } #endif // BRIDGE_H_ platform-api-3.0.1+16.04.20160203/src/bridge/hybris_bridge_defs.h0000644000015600001650000002001012654347724024464 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012-2015 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss * Ricardo Mendoza */ #ifndef HYBRIS_BRIDGE_DEFS_H_ #define HYBRIS_BRIDGE_DEFS_H_ // Must be included after the Bridge class is defined #ifdef __cplusplus extern "C" { #endif /**********************************************************/ /*********** Implementation starts here *******************/ /**********************************************************/ // this allows DLSYM to return NULL (happens if the backend is not available), // and returns NULL in that case; return_type must be a pointer! #define IMPLEMENT_CTOR0(return_type, symbol) \ return_type symbol() \ { \ static return_type (*f)() = NULL; \ DLSYM(&f, #symbol); \ return f ? f() : NULL;} #define IMPLEMENT_FUNCTION0(return_type, symbol) \ return_type symbol() \ { \ static return_type (*f)() = NULL; \ DLSYM(&f, #symbol); \ return f();} #define IMPLEMENT_OPTIONAL_FUNCTION0(return_type, symbol, return_value) \ return_type symbol() \ { \ static return_type (*f)() = NULL; \ DLSYM(&f, #symbol); \ return f ? f() : return_value;} #define IMPLEMENT_VOID_FUNCTION0(symbol) \ void symbol() \ { \ static void (*f)() = NULL; \ DLSYM(&f, #symbol); \ f();} #define IMPLEMENT_OPTIONAL_VOID_FUNCTION0(symbol) \ void symbol() \ { \ static void (*f)() = NULL; \ DLSYM(&f, #symbol); \ if (f) f();} #define IMPLEMENT_FUNCTION1(return_type, symbol, arg1) \ return_type symbol(arg1 _1) \ { \ static return_type (*f)(arg1) = NULL; \ DLSYM(&f, #symbol); \ return f(_1); } #define IMPLEMENT_OPTIONAL_FUNCTION1(return_type, symbol, return_value, arg1) \ return_type symbol(arg1 _1) \ { \ static return_type (*f)(arg1) = NULL; \ DLSYM(&f, #symbol); \ return f ? f(_1) : return_value; } #define IMPLEMENT_VOID_FUNCTION1(symbol, arg1) \ void symbol(arg1 _1) \ { \ static void (*f)(arg1) = NULL; \ DLSYM(&f, #symbol); \ f(_1); } #define IMPLEMENT_OPTIONAL_VOID_FUNCTION1(symbol, arg1) \ void symbol(arg1 _1) \ { \ static void (*f)(arg1) = NULL; \ DLSYM(&f, #symbol); \ if (f) f(_1); } #define IMPLEMENT_FUNCTION2(return_type, symbol, arg1, arg2) \ return_type symbol(arg1 _1, arg2 _2) \ { \ static return_type (*f)(arg1, arg2) = NULL; \ DLSYM(&f, #symbol); \ return f(_1, _2); } #define IMPLEMENT_VOID_FUNCTION2(symbol, arg1, arg2) \ void symbol(arg1 _1, arg2 _2) \ { \ static void (*f)(arg1, arg2) = NULL; \ DLSYM(&f, #symbol); \ f(_1, _2); } #define IMPLEMENT_OPTIONAL_VOID_FUNCTION2(symbol, arg1, arg2) \ void symbol(arg1 _1, arg2 _2) \ { \ static void (*f)(arg1, arg2) = NULL; \ DLSYM(&f, #symbol); \ if (f) f(_1, _2); } #define IMPLEMENT_FUNCTION3(return_type, symbol, arg1, arg2, arg3) \ return_type symbol(arg1 _1, arg2 _2, arg3 _3) \ { \ static return_type (*f)(arg1, arg2, arg3) = NULL; \ DLSYM(&f, #symbol); \ return f(_1, _2, _3); } #define IMPLEMENT_VOID_FUNCTION3(symbol, arg1, arg2, arg3) \ void symbol(arg1 _1, arg2 _2, arg3 _3) \ { \ static void (*f)(arg1, arg2, arg3) = NULL; \ DLSYM(&f, #symbol); \ f(_1, _2, _3); } #define IMPLEMENT_VOID_FUNCTION4(symbol, arg1, arg2, arg3, arg4) \ void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4) \ { \ static void (*f)(arg1, arg2, arg3, arg4) = NULL; \ DLSYM(&f, #symbol); \ f(_1, _2, _3, _4); } #define IMPLEMENT_FUNCTION4(return_type, symbol, arg1, arg2, arg3, arg4) \ return_type symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4) \ { \ static return_type (*f)(arg1, arg2, arg3, arg4) = NULL; \ DLSYM(&f, #symbol); \ return f(_1, _2, _3, _4); } #define IMPLEMENT_FUNCTION6(return_type, symbol, arg1, arg2, arg3, arg4, arg5, arg6) \ return_type symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6) \ { \ static return_type (*f)(arg1, arg2, arg3, arg4, arg5, arg6) = NULL; \ DLSYM(&f, #symbol); \ return f(_1, _2, _3, _4, _5, _6); } #define IMPLEMENT_VOID_FUNCTION7(symbol, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6, arg7 _7) \ { \ static void (*f)(arg1, arg2, arg3, arg4, arg5, arg6, arg7) = NULL; \ DLSYM(&f, #symbol); \ f(_1, _2, _3, _4, _5, _6, _7); } #define IMPLEMENT_VOID_FUNCTION8(symbol, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6, arg7 _7, arg8 _8) \ { \ static void (*f)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) = NULL; \ DLSYM(&f, #symbol); \ f(_1, _2, _3, _4, _5, _6, _7, _8); } #ifdef __cplusplus } #endif #endif // HYBRIS_BRIDGE_DEFS_H_ platform-api-3.0.1+16.04.20160203/src/bridge/bridge_defs.h0000644000015600001650000001451212654347715023116 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012-2015 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss * Ricardo Mendoza */ #ifndef BRIDGE_DEFS_H_ #define BRIDGE_DEFS_H_ // Must be included after the Bridge class is defined #ifdef __cplusplus extern "C" { #endif /**********************************************************/ /*********** Implementation starts here *******************/ /**********************************************************/ // this allows DLSYM to return NULL (happens if the backend is not available), // and returns NULL in that case; return_type must be a pointer! #define IMPLEMENT_CTOR0(module, return_type, symbol) \ return_type symbol() \ { \ static return_type (*f)() = NULL; \ DLSYM(&f, #symbol, #module); \ return f ? f() : NULL;} #define IMPLEMENT_FUNCTION0(module, return_type, symbol) \ return_type symbol() \ { \ static return_type (*f)() = NULL; \ DLSYM(&f, #symbol, #module); \ return f();} #define IMPLEMENT_VOID_FUNCTION0(module, symbol) \ void symbol() \ { \ static void (*f)() = NULL; \ DLSYM(&f, #symbol, #module); \ f();} #define IMPLEMENT_FUNCTION1(module, return_type, symbol, arg1) \ return_type symbol(arg1 _1) \ { \ static return_type (*f)(arg1) = NULL; \ DLSYM(&f, #symbol, #module); \ return f(_1); } #define IMPLEMENT_VOID_FUNCTION1(module, symbol, arg1) \ void symbol(arg1 _1) \ { \ static void (*f)(arg1) = NULL; \ DLSYM(&f, #symbol, #module); \ f(_1); } #define IMPLEMENT_FUNCTION2(module, return_type, symbol, arg1, arg2) \ return_type symbol(arg1 _1, arg2 _2) \ { \ static return_type (*f)(arg1, arg2) = NULL; \ DLSYM(&f, #symbol, #module); \ return f(_1, _2); } #define IMPLEMENT_VOID_FUNCTION2(module, symbol, arg1, arg2) \ void symbol(arg1 _1, arg2 _2) \ { \ static void (*f)(arg1, arg2) = NULL; \ DLSYM(&f, #symbol, #module); \ f(_1, _2); } #define IMPLEMENT_FUNCTION3(module, return_type, symbol, arg1, arg2, arg3) \ return_type symbol(arg1 _1, arg2 _2, arg3 _3) \ { \ static return_type (*f)(arg1, arg2, arg3) = NULL; \ DLSYM(&f, #symbol, #module); \ return f(_1, _2, _3); } #define IMPLEMENT_VOID_FUNCTION3(module, symbol, arg1, arg2, arg3) \ void symbol(arg1 _1, arg2 _2, arg3 _3) \ { \ static void (*f)(arg1, arg2, arg3) = NULL; \ DLSYM(&f, #symbol, #module); \ f(_1, _2, _3); } #define IMPLEMENT_VOID_FUNCTION4(module, symbol, arg1, arg2, arg3, arg4) \ void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4) \ { \ static void (*f)(arg1, arg2, arg3, arg4) = NULL; \ DLSYM(&f, #symbol, #module); \ f(_1, _2, _3, _4); } #define IMPLEMENT_FUNCTION4(module, return_type, symbol, arg1, arg2, arg3, arg4) \ return_type symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4) \ { \ static return_type (*f)(arg1, arg2, arg3, arg4) = NULL; \ DLSYM(&f, #symbol, #module); \ return f(_1, _2, _3, _4); } #define IMPLEMENT_FUNCTION6(module, return_type, symbol, arg1, arg2, arg3, arg4, arg5, arg6) \ return_type symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6) \ { \ static return_type (*f)(arg1, arg2, arg3, arg4, arg5, arg6) = NULL; \ DLSYM(&f, #symbol, #module); \ return f(_1, _2, _3, _4, _5, _6); } #define IMPLEMENT_VOID_FUNCTION7(module, symbol, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6, arg7 _7) \ { \ static void (*f)(arg1, arg2, arg3, arg4, arg5, arg6, arg7) = NULL; \ DLSYM(&f, #symbol, #module); \ f(_1, _2, _3, _4, _5, _6, _7); } #define IMPLEMENT_VOID_FUNCTION8(module, symbol, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6, arg7 _7, arg8 _8) \ { \ static void (*f)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) = NULL; \ DLSYM(&f, #symbol, #module); \ f(_1, _2, _3, _4, _5, _6, _7, _8); } #ifdef __cplusplus } #endif #endif // BRIDGE_DEFS_H_ platform-api-3.0.1+16.04.20160203/src/ubuntu/0000755000015600001650000000000012654350173020563 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/0000755000015600001650000000000012654350173023066 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/testbackend/0000755000015600001650000000000012654350173025355 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/testbackend/ubuntu_application_sensors.cpp0000644000015600001650000005447312654347715033567 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013-2015 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Martin Pitt * Ricardo Mendoza */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; // necessary for functions that return float // pcs attribute (calling convention) is only defined on ARM, avoid warning on // other platforms #ifdef __arm__ #define __SF_FN_ATTR __attribute__((pcs("aapcs"))) #else #define __SF_FN_ATTR #endif /*************************************** * * test sensor implementation * ***************************************/ enum ubuntu_sensor_type { first_defined_sensor_type = 0, ubuntu_sensor_type_accelerometer = first_defined_sensor_type, ubuntu_sensor_type_magnetic_field, ubuntu_sensor_type_gyroscope, ubuntu_sensor_type_light, ubuntu_sensor_type_proximity, ubuntu_sensor_type_orientation, ubuntu_sensor_type_linear_acceleration, ubuntu_sensor_type_rotation_vector, undefined_sensor_type }; // this is only internal API, so we make everything public struct TestSensor { TestSensor(ubuntu_sensor_type _type, float _min_value, float _max_value, float _resolution) : type(_type), enabled(false), resolution(_resolution), min_delay(0), min_value(_min_value), max_value(_max_value), on_event_cb(NULL), event_cb_context(NULL), x(_min_value), y(_min_value), z(_min_value), distance((UASProximityDistance) 0), // LP#1256969 timestamp(0) {} ubuntu_sensor_type type; bool enabled; float resolution; uint32_t min_delay; float min_value, max_value; void (*on_event_cb)(void*, void*); void* event_cb_context; /* current value; note that we do not track separate Event objects/pointers * at all, and just always deliver the current value */ float x, y, z; UASProximityDistance distance; uint64_t timestamp; }; /* Singleton which reads the sensor data file and maintains the TestSensor * instances */ class SensorController { public: // Ensure that controller is initialized, and return singleton static SensorController& instance() { static SensorController _inst; return _inst; } // Return TestSensor of given type, or NULL if it doesn't exist TestSensor* get(ubuntu_sensor_type type, bool no_block = false) { if (!no_block && dynamic) { unique_lock lk(create_mtx); create_cv.wait(lk, [this, type]{ try { sensors.at(type).get(); return true; } catch (const out_of_range&) { cerr << "TestSensor WARNING: Requested sensor " << name_from_type(type) << " not yet created, blocking thread until create event received" << endl; return false; } }); } try { return sensors.at(type).get(); } catch (const out_of_range&) { return NULL; } } private: SensorController(); ~SensorController(); bool fifo_take_command(); bool next_command(); bool process_create_command(); void process_event_command(); void setup_timer(unsigned delay_ms); static void on_timer(union sigval sval); static ubuntu_sensor_type type_from_name(const string& type) { if (type == "light") return ubuntu_sensor_type_light; if (type == "proximity") return ubuntu_sensor_type_proximity; if (type == "accel") return ubuntu_sensor_type_accelerometer; cerr << "TestSensor ERROR: unknown sensor type " << type << endl; abort(); } static const char* name_from_type(ubuntu_sensor_type type) { if (type == ubuntu_sensor_type_light) return "light"; if (type == ubuntu_sensor_type_proximity) return "proximity"; if (type == ubuntu_sensor_type_accelerometer) return "accelerometer"; return "ERROR_TYPE"; } map> sensors; ifstream data; bool dynamic; int fifo_fd; string fifo_path; bool block; condition_variable comm_cv; mutex mtx; thread worker; condition_variable create_cv; mutex create_mtx; bool exit; // current command/event string current_command; TestSensor* event_sensor; float event_x, event_y, event_z; UASProximityDistance event_distance; }; SensorController::SensorController() : dynamic(true), fifo_fd(-1), block(false), exit(false) { const char* path = getenv("UBUNTU_PLATFORM_API_SENSOR_TEST"); if (path != NULL) dynamic = false; // Either we are using a named pipe (dynamic) or a static file for event injection if (dynamic) { // create named pipe for event injection stringstream ss; ss << "/tmp/sensor-fifo-" << getpid(); fifo_path = ss.str(); int ret = mkfifo(fifo_path.c_str(), S_IFIFO | 0666); if (ret < 0) { cerr << "TestSensor ERROR: Failed to create named pipe at " << fifo_path << endl; abort(); } fifo_fd = open(fifo_path.c_str(), O_RDWR); if (fifo_fd < 0) { cerr << "TestSensor ERROR: Failed to open named pipe at " << fifo_path << endl; abort(); } cout << "TestSensor INFO: Setup for DYNAMIC event injection over named pipe " << fifo_path << endl; worker = move(thread([this] { while (fifo_take_command()) { if (current_command.find("create") == string::npos) process_event_command(); else process_create_command(); if (exit) break; } })); } else { data.open(path); if (!data.is_open()) { cerr << "TestSensor ERROR: Failed to open data file " << path << ": " << strerror(errno) << endl; abort(); } cout << "TestSensor INFO: Setup for STATIC event injection reading from " << path << endl; // process all "create" commands while (next_command()) { if (!process_create_command()) break; } // start event processing if (!data.eof()) process_event_command(); } } SensorController::~SensorController() { if (dynamic) { exit = true; if (worker.joinable()) worker.join(); unlink(fifo_path.c_str()); } } bool SensorController::fifo_take_command() { char buf; int size; string tmp = ""; // block until last event has fired unique_lock lk(mtx); comm_cv.wait(lk, [this] { if (block) { return false; } else { block = true; return true; }}); tmp.clear(); while (read(fifo_fd, &buf, sizeof(char))) { if (buf == '\n' || buf == '#') break; tmp.append(1, buf); } if (buf == '#') { // comment input (from piped file) // consume rest of line while (read(fifo_fd, &buf, sizeof(char))) { if (buf == '\n') break; } if (tmp.size() == 0) { block = false; return true; } } tmp.erase(0, tmp.find_first_not_of(" \t")); tmp.erase(tmp.find_last_not_of(" \t") + 1); if (tmp.size() == 0) return true; // if create command, dont block if (tmp.find("create") != string::npos) block = false; current_command = tmp; return true; } bool SensorController::next_command() { while (getline(data, current_command)) { // trim leading and trailing space current_command.erase(0, current_command.find_first_not_of(" \t")); current_command.erase(current_command.find_last_not_of(" \t") + 1); // ignore empty or comment lines if (current_command.size() == 0 || current_command[0] == '#') continue; return true; } return false; } bool SensorController::process_create_command() { stringstream ss(current_command, ios_base::in); string token; // we only process "create" commands here; if we have something else, stop ss >> token; if (token != "create") return false; ss >> token; ubuntu_sensor_type type = type_from_name(token); if (get(type, true) != NULL) { cerr << "TestSensor ERROR: duplicate creation of sensor type " << token << endl; return false; } float min = 0, max = 0, resolution = 0; if (type != ubuntu_sensor_type_proximity) { // read min, max, resolution ss >> min >> max >> resolution; if (max <= min) { cerr << "TestSensor ERROR: max_value must be >= min_value in " << current_command << endl; abort(); } if (resolution <= 0) { cerr << "TestSensor ERROR: resolution must be > 0 in " << current_command << endl; abort(); } } sensors[type] = make_shared(type, min, max, resolution); create_cv.notify_all(); return true; } void SensorController::process_event_command() { stringstream ss(current_command, ios_base::in); int delay; //cout << "TestSensor: processing event " << current_command << endl; // parse delay ss >> delay; if (delay <= 0) { cerr << "TestSensor ERROR: delay must be positive in command " << current_command << endl; abort(); } // parse sensor type string token; ss >> token; ubuntu_sensor_type type = type_from_name(token); event_sensor = get(type, true); if (event_sensor == NULL) { cerr << "TestSensor ERROR: sensor does not exist, you need to create it: " << token << endl; abort(); } switch (type) { case ubuntu_sensor_type_light: ss >> event_x; //cout << "got event: sensor type " << type << " (light), delay " // << delay << " ms, value " << event_x << endl; break; case ubuntu_sensor_type_accelerometer: ss >> event_x >> event_y >> event_z; //cout << "got event: sensor type " << type << " (accel), delay " // << delay << " ms, value " << event_x << "/" << event_y << "/" << event_z << endl; break; case ubuntu_sensor_type_proximity: ss >> token; if (token == "unknown") event_distance = (UASProximityDistance) 0; // LP#1256969 else if (token == "near") event_distance = U_PROXIMITY_NEAR; else if (token == "far") event_distance = U_PROXIMITY_FAR; else { cerr << "TestSensor ERROR: unknown proximity value " << token << endl; abort(); } //cout << "got event: sensor type " << type << " (proximity), delay " // << delay << " ms, value " << int(event_distance) << endl; break; default: cerr << "TestSensor ERROR: unhandled sensor type " << token << endl; abort(); } // wake up after given delay for committing the change and processing the // next event setup_timer(unsigned(delay)); } void SensorController::setup_timer(unsigned delay_ms) { static timer_t timerid; // we keep a pointer to that until on_timer struct sigevent sev; struct itimerspec its { {0, 0}, // interval {time_t(delay_ms / 1000), long((delay_ms % 1000) * 1000000L) % 1000000000L } }; sev.sigev_notify = SIGEV_THREAD; sev.sigev_notify_function = SensorController::on_timer; sev.sigev_notify_attributes = NULL; sev.sigev_value.sival_ptr = &timerid; if (timer_create(CLOCK_MONOTONIC, &sev, &timerid) < 0) { perror("TestSensor ERROR: Failed to create timer"); abort(); } if (timer_settime(timerid, 0, &its, NULL) < 0) { perror("TestSensor ERROR: Failed to set up timer"); abort(); }; } void SensorController::on_timer(union sigval sval) { timer_t* timerid = static_cast(sval.sival_ptr); //cout << "on_timer called\n"; timer_delete(*timerid); SensorController& sc = SensorController::instance(); // update sensor values, call callback if (sc.event_sensor && sc.event_sensor->enabled) { sc.event_sensor->x = sc.event_x; sc.event_sensor->y = sc.event_y; sc.event_sensor->z = sc.event_z; sc.event_sensor->distance = sc.event_distance; sc.event_sensor->timestamp = chrono::duration_cast( chrono::system_clock::now().time_since_epoch()).count(); if (sc.event_sensor->on_event_cb != NULL) { //cout << "TestSensor: calling sensor callback for type " << sc.event_sensor->type << endl; sc.event_sensor->on_event_cb(sc.event_sensor, sc.event_sensor->event_cb_context); } else { //cout << "TestSensor: sensor type " << sc.event_sensor->type << "has no callback\n"; } } else { //cout << "TestSensor: sensor type " << sc.event_sensor->type << "disabled, not processing event\n"; } // read/process next event if (sc.dynamic) { sc.block = false; sc.comm_cv.notify_one(); } else { if (sc.next_command()) sc.process_event_command(); else { //cout << "TestSensor: script ended, no further commands\n"; } } } /*************************************** * * Acceleration API * ***************************************/ UASensorsAccelerometer* ua_sensors_accelerometer_new() { return SensorController::instance().get(ubuntu_sensor_type_accelerometer); } UStatus ua_sensors_accelerometer_enable(UASensorsAccelerometer* s) { static_cast(s)->enabled = true; return (UStatus) 0; } UStatus ua_sensors_accelerometer_disable(UASensorsAccelerometer* s) { static_cast(s)->enabled = false; return (UStatus) 0; } uint32_t ua_sensors_accelerometer_get_min_delay(UASensorsAccelerometer* s) { return static_cast(s)->min_delay; } UStatus ua_sensors_accelerometer_get_min_value(UASensorsAccelerometer* s, float* value) { if (!value) return U_STATUS_ERROR; *value = static_cast(s)->min_value; return U_STATUS_SUCCESS; } UStatus ua_sensors_accelerometer_get_max_value(UASensorsAccelerometer* s, float* value) { if (!value) return U_STATUS_ERROR; *value = static_cast(s)->max_value; return U_STATUS_SUCCESS; } UStatus ua_sensors_accelerometer_get_resolution(UASensorsAccelerometer* s, float* value) { if (!value) return U_STATUS_ERROR; *value = static_cast(s)->resolution; return U_STATUS_SUCCESS; } UStatus ua_sensors_accelerometer_set_event_rate(UASensorsAccelerometer* s, uint32_t rate) { return U_STATUS_SUCCESS; } void ua_sensors_accelerometer_set_reading_cb(UASensorsAccelerometer* s, on_accelerometer_event_cb cb, void* ctx) { TestSensor* sensor = static_cast(s); sensor->on_event_cb = cb; sensor->event_cb_context = ctx; } uint64_t uas_accelerometer_event_get_timestamp(UASAccelerometerEvent* e) { return static_cast(e)->timestamp; } UStatus uas_accelerometer_event_get_acceleration_x(UASAccelerometerEvent* e, float* value) { if (!value) return U_STATUS_ERROR; *value = static_cast(e)->x; return U_STATUS_SUCCESS; } UStatus uas_accelerometer_event_get_acceleration_y(UASAccelerometerEvent* e, float* value) { if (!value) return U_STATUS_ERROR; *value = static_cast(e)->y; return U_STATUS_SUCCESS; } UStatus uas_accelerometer_event_get_acceleration_z(UASAccelerometerEvent* e, float* value) { if (!value) return U_STATUS_ERROR; *value = static_cast(e)->z; return U_STATUS_SUCCESS; } /*************************************** * * Proximity API * ***************************************/ UASensorsProximity* ua_sensors_proximity_new() { return SensorController::instance().get(ubuntu_sensor_type_proximity); } UStatus ua_sensors_proximity_enable(UASensorsProximity* s) { static_cast(s)->enabled = true; return (UStatus) 0; } UStatus ua_sensors_proximity_disable(UASensorsProximity* s) { static_cast(s)->enabled = false; return (UStatus) 0; } uint32_t ua_sensors_proximity_get_min_delay(UASensorsProximity* s) { return static_cast(s)->min_delay; } // the next three function make no sense in the API, just return zero UStatus ua_sensors_proximity_get_min_value(UASensorsProximity*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_proximity_get_max_value(UASensorsProximity*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_proximity_get_resolution(UASensorsProximity*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_proximity_set_event_rate(UASensorsProximity* s, uint32_t rate) { return U_STATUS_SUCCESS; } void ua_sensors_proximity_set_reading_cb(UASensorsProximity* s, on_proximity_event_cb cb, void* ctx) { TestSensor* sensor = static_cast(s); sensor->on_event_cb = cb; sensor->event_cb_context = ctx; } uint64_t uas_proximity_event_get_timestamp(UASProximityEvent* e) { return static_cast(e)->timestamp; } UASProximityDistance uas_proximity_event_get_distance(UASProximityEvent* e) { return static_cast(e)->distance; } /*************************************** * * Light API * ***************************************/ UASensorsLight* ua_sensors_light_new() { return SensorController::instance().get(ubuntu_sensor_type_light); } UStatus ua_sensors_light_enable(UASensorsLight* s) { static_cast(s)->enabled = true; return (UStatus) 0; } UStatus ua_sensors_light_disable(UASensorsLight* s) { static_cast(s)->enabled = false; return (UStatus) 0; } uint32_t ua_sensors_light_get_min_delay(UASensorsLight* s) { return static_cast(s)->min_delay; } UStatus ua_sensors_light_get_min_value(UASensorsLight* s, float* value) { if (!value) return U_STATUS_ERROR; *value = static_cast(s)->min_value; return U_STATUS_SUCCESS; } UStatus ua_sensors_light_get_max_value(UASensorsLight* s, float* value) { if (!value) return U_STATUS_ERROR; *value = static_cast(s)->max_value; return U_STATUS_SUCCESS; } UStatus ua_sensors_light_get_resolution(UASensorsLight* s, float* value) { if (!value) return U_STATUS_ERROR; *value = static_cast(s)->resolution; return U_STATUS_SUCCESS; } UStatus ua_sensors_light_set_event_rate(UASensorsLight* s, uint32_t rate) { return U_STATUS_SUCCESS; } void ua_sensors_light_set_reading_cb(UASensorsLight* s, on_light_event_cb cb, void* ctx) { TestSensor* sensor = static_cast(s); sensor->on_event_cb = cb; sensor->event_cb_context = ctx; } uint64_t uas_light_event_get_timestamp(UASLightEvent* e) { return static_cast(e)->timestamp; } UStatus uas_light_event_get_light(UASLightEvent* e, float* value) { if (!value) return U_STATUS_ERROR; *value = static_cast(e)->x; return U_STATUS_SUCCESS; } UASensorsOrientation* ua_sensors_orientation_new() { return NULL; } UStatus ua_sensors_orientation_enable(UASensorsOrientation*) { return (UStatus) 0; } UStatus ua_sensors_orientation_disable(UASensorsOrientation*) { return (UStatus) 0; } uint32_t ua_sensors_orientation_get_min_delay(UASensorsOrientation*) { return 0; } UStatus ua_sensors_orientation_get_min_value(UASensorsOrientation*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_orientation_get_max_value(UASensorsOrientation*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_orientation_get_resolution(UASensorsOrientation*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_orientation_set_event_rate(UASensorsOrientation* s, uint32_t rate) { return U_STATUS_SUCCESS; } void ua_sensors_orientation_set_reading_cb(UASensorsOrientation*, on_orientation_event_cb, void*) { } uint64_t uas_orientation_event_get_timestamp(UASOrientationEvent*) { return 0; } UStatus uas_orientation_event_get_azimuth(UASOrientationEvent*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus uas_orientation_event_get_pitch(UASOrientationEvent*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus uas_orientation_event_get_roll(UASOrientationEvent*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } platform-api-3.0.1+16.04.20160203/src/ubuntu/application/testbackend/module_version.h0000644000015600001650000000014012654347715030563 0ustar pbuserpbgroup00000000000000#define MODULE_VERSION_MAJOR 3 #define MODULE_VERSION_MINOR 0 #define MODULE_VERSION_PATCH 0 platform-api-3.0.1+16.04.20160203/src/ubuntu/application/testbackend/README.md0000644000015600001650000000465012654347715026651 0ustar pbuserpbgroup00000000000000Testing applications with simulated sensor data =============================================== Purpose ------- platform-api's interface to sensor data is in the shared library `libubuntu_platform_hardware_api.so`. That is only a stub which dynamically (dlopen) loads a backend library which provides the actual implementation. By default this is `/system/lib/libubuntu_application_api.so` which reads sensor data from the Android side. For testing purposes this can be replaced with this `libubuntu_application_api_test.so.1` which simulates sensors and their data based on a simple text input file. Using the test sensors ---------------------- Run your application under test with the environment variable UBUNTU_PLATFORM_API_BACKEND=libubuntu_application_api_test.so.1 and make sure that ld.so(8) can find it. If you don't have the library installed in a standard system library path, it is recommended to set `LD_LIBRARY_PATH` to the directory that contains the library (usually when using the library right out of the build tree). Alternatively you can specify the full path in `$UBUNTU_PLATFORM_API_BACKEND`. The env variable `$UBUNTU_PLATFORM_API_SENSOR_TEST` needs to point to a file that describes the desired sensor behaviour. Data format ----------- The test sensors use a simple line based file format. The first part instantiates desired sensors with their parameters: create [accel|light] # but no arguments for proximity sensor: create proximity After that, it defines events; specifies time after previous event in ms: proximity [unknown|near|far] light accel Empty lines and comment lines (starting with #) are allowed. Example file: create light 0 10 1 create accel 0 1000 0.1 create proximity 200 proximity near 500 light 5 # simulate crash on the ground 500 accel 0.2 0.1 10 100 accel 0.2 0.2 1000 20 accel 0 0 0 10 proximity far 0 light 10 Complete example ---------------- * Build platform-api: mkdir obj; (cd obj; cmake .. && make) * Put above example file into /tmp/test.sensors * Run the sensor test with it: LD_LIBRARY_PATH=obj/src/ubuntu/testbackend \ UBUNTU_PLATFORM_API_BACKEND=libubuntu_application_api_test.so.1 \ UBUNTU_PLATFORM_API_SENSOR_TEST=/tmp/test.sensors \ obj/src/ubuntu/hybris/tests/test_android_sensors_api platform-api-3.0.1+16.04.20160203/src/ubuntu/application/testbackend/CMakeLists.txt0000644000015600001650000000132412654347715030125 0ustar pbuserpbgroup00000000000000set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11") add_library( ubuntu_application_api_test MODULE ubuntu_application_sensors.cpp module.cpp test_stubs.cpp module_version.h ) target_link_libraries( ubuntu_application_api_test rt ) set_target_properties( ubuntu_application_api_test PROPERTIES VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH} SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR} ) install( TARGETS ubuntu_application_api_test # this is not a development library to compile against, users should always # specify the SONAME; so don't build a *.so LIBRARY DESTINATION "${LIB_INSTALL_DIR}" NAMELINK_SKIP ) platform-api-3.0.1+16.04.20160203/src/ubuntu/application/testbackend/module.cpp0000644000015600001650000000176212654347715027364 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2014 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #include #include "module_version.h" void u_application_module_version(uint32_t *major, uint32_t *minor, uint32_t *patch) { *major = (uint32_t) MODULE_VERSION_MAJOR; *minor = (uint32_t) MODULE_VERSION_MINOR; *patch = (uint32_t) MODULE_VERSION_PATCH; } platform-api-3.0.1+16.04.20160203/src/ubuntu/application/testbackend/test_stubs.cpp0000644000015600001650000001663412654347715030302 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2014 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #include #include #include #include #include #include #include #include #include #include #include #include // Application Module Config void u_application_init(void*) { } void u_application_finish() { } // Lifecycle helpers UApplicationLifecycleDelegate* u_application_lifecycle_delegate_new() { return NULL; } void u_application_lifecycle_delegate_set_context (UApplicationLifecycleDelegate*, void*) { } void u_application_lifecycle_delegate_ref (UApplicationLifecycleDelegate*) { } void u_application_lifecycle_delegate_unref (UApplicationLifecycleDelegate*) { } void u_application_lifecycle_delegate_set_application_resumed_cb (UApplicationLifecycleDelegate*, u_on_application_resumed) { } void u_application_lifecycle_delegate_set_application_about_to_stop_cb (UApplicationLifecycleDelegate*, u_on_application_about_to_stop) { } // Application Helpers // UApplicationId UApplicationId* u_application_id_new_from_stringn(const char*, size_t) { return NULL; } void u_application_id_destroy(UApplicationId*) { } int u_application_id_compare(UApplicationId*, UApplicationId*) { } // UApplicationDescription UApplicationDescription* u_application_description_new() { return NULL; } void u_application_description_destroy (UApplicationDescription*) { } void u_application_description_set_application_id (UApplicationDescription*, UApplicationId*) { } void u_application_description_set_application_lifecycle_delegate (UApplicationDescription*, UApplicationLifecycleDelegate*) { } // UApplicationOptions UApplicationOptions* u_application_options_new_from_cmd_line(int, char**) { return NULL; } void u_application_options_destroy(UApplicationOptions*) { } // UApplicationInstance UApplicationInstance* u_application_instance_new_from_description_with_options(UApplicationDescription*, UApplicationOptions*) { return NULL; } // Sensors UASensorsHaptic* ua_sensors_haptic_new() { return NULL; } // Sensors void ua_sensors_haptic_destroy(UASensorsHaptic*) { } UStatus ua_sensors_haptic_enable(UASensorsHaptic*) { return U_STATUS_ERROR; } UStatus ua_sensors_haptic_disable(UASensorsHaptic*) { return U_STATUS_ERROR; } UStatus ua_sensors_haptic_vibrate_once(UASensorsHaptic*, uint32_t) { return U_STATUS_ERROR; } UStatus ua_sensors_haptic_vibrate_with_pattern(UASensorsHaptic*, uint32_t*, uint32_t) { return U_STATUS_ERROR; } // Location void ua_location_service_controller_ref(UALocationServiceController*) { } void ua_location_service_controller_unref(UALocationServiceController*) { } void ua_location_service_controller_set_status_changed_handler(UALocationServiceController*, UALocationServiceStatusChangedHandler, void*) { } UStatus ua_location_service_controller_query_status(UALocationServiceController*, UALocationServiceStatusFlags*) { return U_STATUS_ERROR; } UStatus ua_location_service_controller_enable_service(UALocationServiceController*) { return U_STATUS_ERROR; } UStatus ua_location_service_controller_disable_service(UALocationServiceController*) { return U_STATUS_ERROR; } UStatus ua_location_service_controller_enable_gps(UALocationServiceController*) { return U_STATUS_ERROR; } UStatus ua_location_service_controller_disable_gps(UALocationServiceController*) { return U_STATUS_ERROR; } void ua_location_heading_update_ref(UALocationHeadingUpdate*) { } void ua_location_heading_update_unref(UALocationHeadingUpdate*) { } uint64_t ua_location_heading_update_get_timestamp(UALocationHeadingUpdate*) { return 0; } double ua_location_heading_update_get_heading_in_degree(UALocationHeadingUpdate*) { return 0; } void ua_location_position_update_ref(UALocationPositionUpdate*) { } void ua_location_position_update_unref(UALocationPositionUpdate*) { } uint64_t ua_location_position_update_get_timestamp(UALocationPositionUpdate*) { return 0; } double ua_location_position_update_get_latitude_in_degree(UALocationPositionUpdate*) { return 0; } double ua_location_position_update_get_longitude_in_degree(UALocationPositionUpdate*) { return 0; } bool ua_location_position_update_has_altitude(UALocationPositionUpdate*) { return 0; } double ua_location_position_update_get_altitude_in_meter(UALocationPositionUpdate*) { return 0; } UALocationServiceSession* ua_location_service_create_session_for_low_accuracy(UALocationServiceRequirementsFlags) { return NULL; } UALocationServiceSession* ua_location_service_create_session_for_high_accuracy(UALocationServiceRequirementsFlags) { return NULL; } UALocationServiceController* ua_location_service_create_controller() { return NULL; } void ua_location_service_session_ref(UALocationServiceSession*) { } void ua_location_service_session_unref(UALocationServiceSession*) { } void ua_location_service_session_set_position_updates_handler(UALocationServiceSession*, UALocationServiceSessionPositionUpdatesHandler, void*) { } void ua_location_service_session_set_heading_updates_handler(UALocationServiceSession*, UALocationServiceSessionHeadingUpdatesHandler, void*) { } void ua_location_service_session_set_velocity_updates_handler(UALocationServiceSession*, UALocationServiceSessionVelocityUpdatesHandler, void*) { } UStatus ua_location_service_session_start_position_updates(UALocationServiceSession*) { return U_STATUS_ERROR; } void ua_location_service_session_stop_position_updates(UALocationServiceSession*) { } UStatus ua_location_service_session_start_heading_updates(UALocationServiceSession*) { return U_STATUS_ERROR; } void ua_location_service_session_stop_heading_updates(UALocationServiceSession*) { } UStatus ua_location_service_session_start_velocity_updates(UALocationServiceSession*) { return U_STATUS_ERROR; } void ua_location_service_session_stop_velocity_updates(UALocationServiceSession*) { } void ua_location_velocity_update_ref(UALocationVelocityUpdate*) { } void ua_location_velocity_update_unref(UALocationVelocityUpdate*) { } uint64_t ua_location_velocity_update_get_timestamp(UALocationVelocityUpdate*) { return 0; } double ua_location_velocity_update_get_velocity_in_meters_per_second(UALocationVelocityUpdate*) { return 0; } // URL Dispatcher UAUrlDispatcherSession* ua_url_dispatcher_session() { return NULL; } void ua_url_dispatcher_session_open(UAUrlDispatcherSession*, const char*, UAUrlDispatcherSessionDispatchHandler, void*) { } platform-api-3.0.1+16.04.20160203/src/ubuntu/application/touch/0000755000015600001650000000000012654350173024210 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/touch/module_version.h0000644000015600001650000000014012654347715027416 0ustar pbuserpbgroup00000000000000#define MODULE_VERSION_MAJOR 3 #define MODULE_VERSION_MINOR 0 #define MODULE_VERSION_PATCH 0 platform-api-3.0.1+16.04.20160203/src/ubuntu/application/touch/CMakeLists.txt0000644000015600001650000000162212654347715026761 0ustar pbuserpbgroup00000000000000set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11") add_subdirectory(hybris) add_library( ubuntu_application_api_touch_mirclient MODULE module.cpp module_version.h ) target_link_libraries( ubuntu_application_api_touch_mirclient "-Wl,--whole-archive" ubuntu_application_api_mirclient ubuntu_application_api_hybris ${UBUNTU_APPLICATION_API_LINK_LIBRARIES} "-Wl,--no-whole-archive" #TODO: Alarms ) set_target_properties( ubuntu_application_api_touch_mirclient PROPERTIES VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH} SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR} ) install( TARGETS ubuntu_application_api_touch_mirclient # this is not a development library to compile against, users should always # specify the SONAME; so don't build a *.so LIBRARY DESTINATION "${LIB_INSTALL_DIR}" NAMELINK_SKIP ) platform-api-3.0.1+16.04.20160203/src/ubuntu/application/touch/hybris/0000755000015600001650000000000012654350173025510 5ustar pbuserpbgroup00000000000000././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/touch/hybris/ubuntu_application_sensors_hybris.cppplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/touch/hybris/ubuntu_application_sensors_hyb0000644000015600001650000001302112654347715033763 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss * Ricardo Mendoza */ #include #include #include #include #include "hybris_module.h" // Ubuntu Application Sensors // Acceleration Sensor IMPLEMENT_CTOR0(UASensorsAccelerometer*, ua_sensors_accelerometer_new); IMPLEMENT_FUNCTION1(UStatus, ua_sensors_accelerometer_enable, UASensorsAccelerometer*); IMPLEMENT_FUNCTION1(UStatus, ua_sensors_accelerometer_disable, UASensorsAccelerometer*); IMPLEMENT_FUNCTION1(uint32_t, ua_sensors_accelerometer_get_min_delay, UASensorsAccelerometer*); IMPLEMENT_FUNCTION2(UStatus, ua_sensors_accelerometer_get_min_value, UASensorsAccelerometer*, float*); IMPLEMENT_FUNCTION2(UStatus, ua_sensors_accelerometer_get_max_value, UASensorsAccelerometer*, float*); IMPLEMENT_FUNCTION2(UStatus, ua_sensors_accelerometer_get_resolution, UASensorsAccelerometer*, float*); IMPLEMENT_VOID_FUNCTION3(ua_sensors_accelerometer_set_reading_cb, UASensorsAccelerometer*, on_accelerometer_event_cb, void*); IMPLEMENT_FUNCTION2(UStatus, ua_sensors_accelerometer_set_event_rate, UASensorsAccelerometer*, uint32_t); // Acceleration Sensor Event IMPLEMENT_FUNCTION1(uint64_t, uas_accelerometer_event_get_timestamp, UASAccelerometerEvent*); IMPLEMENT_FUNCTION2(UStatus, uas_accelerometer_event_get_acceleration_x, UASAccelerometerEvent*, float*); IMPLEMENT_FUNCTION2(UStatus, uas_accelerometer_event_get_acceleration_y, UASAccelerometerEvent*, float*); IMPLEMENT_FUNCTION2(UStatus, uas_accelerometer_event_get_acceleration_z, UASAccelerometerEvent*, float*); // Proximity Sensor IMPLEMENT_CTOR0(UASensorsProximity*, ua_sensors_proximity_new); IMPLEMENT_FUNCTION1(UStatus, ua_sensors_proximity_enable, UASensorsProximity*); IMPLEMENT_FUNCTION1(UStatus, ua_sensors_proximity_disable, UASensorsProximity*); IMPLEMENT_FUNCTION1(uint32_t, ua_sensors_proximity_get_min_delay, UASensorsProximity*); IMPLEMENT_FUNCTION2(UStatus, ua_sensors_proximity_get_min_value, UASensorsProximity*, float*); IMPLEMENT_FUNCTION2(UStatus, ua_sensors_proximity_get_max_value, UASensorsProximity*, float*); IMPLEMENT_FUNCTION2(UStatus, ua_sensors_proximity_get_resolution, UASensorsProximity*, float*); IMPLEMENT_VOID_FUNCTION3(ua_sensors_proximity_set_reading_cb, UASensorsProximity*, on_proximity_event_cb, void*); IMPLEMENT_FUNCTION2(UStatus, ua_sensors_proximity_set_event_rate, UASensorsProximity*, uint32_t); // Proximity Sensor Event IMPLEMENT_FUNCTION1(uint64_t, uas_proximity_event_get_timestamp, UASProximityEvent*); IMPLEMENT_FUNCTION1(UASProximityDistance, uas_proximity_event_get_distance, UASProximityEvent*); // Ambient Light Sensor IMPLEMENT_CTOR0(UASensorsLight*, ua_sensors_light_new); IMPLEMENT_FUNCTION1(UStatus, ua_sensors_light_enable, UASensorsLight*); IMPLEMENT_FUNCTION1(UStatus, ua_sensors_light_disable, UASensorsLight*); IMPLEMENT_FUNCTION1(uint32_t, ua_sensors_light_get_min_delay, UASensorsLight*); IMPLEMENT_FUNCTION2(UStatus, ua_sensors_light_get_min_value, UASensorsLight*, float*); IMPLEMENT_FUNCTION2(UStatus, ua_sensors_light_get_max_value, UASensorsLight*, float*); IMPLEMENT_FUNCTION2(UStatus, ua_sensors_light_get_resolution, UASensorsLight*, float*); IMPLEMENT_VOID_FUNCTION3(ua_sensors_light_set_reading_cb, UASensorsLight*, on_light_event_cb, void*); IMPLEMENT_FUNCTION2(UStatus, ua_sensors_light_set_event_rate, UASensorsLight*, uint32_t); // Ambient Light Sensor Event IMPLEMENT_FUNCTION1(uint64_t, uas_light_event_get_timestamp, UASLightEvent*); IMPLEMENT_FUNCTION2(UStatus, uas_light_event_get_light, UASLightEvent*, float*); // Orientation Sensor IMPLEMENT_CTOR0(UASensorsOrientation*, ua_sensors_orientation_new); IMPLEMENT_FUNCTION1(UStatus, ua_sensors_orientation_enable, UASensorsOrientation*); IMPLEMENT_FUNCTION1(UStatus, ua_sensors_orientation_disable, UASensorsOrientation*); IMPLEMENT_FUNCTION1(uint32_t, ua_sensors_orientation_get_min_delay, UASensorsOrientation*); IMPLEMENT_FUNCTION2(UStatus, ua_sensors_orientation_get_min_value, UASensorsOrientation*, float*); IMPLEMENT_FUNCTION2(UStatus, ua_sensors_orientation_get_max_value, UASensorsOrientation*, float*); IMPLEMENT_FUNCTION2(UStatus, ua_sensors_orientation_get_resolution, UASensorsOrientation*, float*); IMPLEMENT_VOID_FUNCTION3(ua_sensors_orientation_set_reading_cb, UASensorsOrientation*, on_orientation_event_cb, void*); IMPLEMENT_FUNCTION2(UStatus, ua_sensors_orientation_set_event_rate, UASensorsOrientation*, uint32_t); // Orientation Sensor Event IMPLEMENT_FUNCTION1(uint64_t, uas_orientation_event_get_timestamp, UASOrientationEvent*); IMPLEMENT_FUNCTION2(UStatus, uas_orientation_event_get_azimuth, UASOrientationEvent*, float*); IMPLEMENT_FUNCTION2(UStatus, uas_orientation_event_get_pitch, UASOrientationEvent*, float*); IMPLEMENT_FUNCTION2(UStatus, uas_orientation_event_get_roll, UASOrientationEvent*, float*); platform-api-3.0.1+16.04.20160203/src/ubuntu/application/touch/hybris/hybris_module.h0000644000015600001650000000332712654347715030543 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss * Ricardo Mendoza */ #ifndef HYBRIS_MODULE_H_ #define HYBRIS_MODULE_H_ #include #ifdef __cplusplus extern "C" { #endif extern void *android_dlopen(const char *filename, int flag); extern void *android_dlsym(void *handle, const char *symbol); #ifdef __cplusplus } #endif namespace internal { struct HIDDEN_SYMBOL ToHybris { static const char* path() { static const char* cache = "/system/lib/libubuntu_application_api.so"; return cache; } static const char* override_path() { return NULL; } static void* dlopen_fn(const char* path, int flags) { return android_dlopen(path, flags); } static void* dlsym_fn(void* handle, const char* symbol) { return android_dlsym(handle, symbol); } }; } #define DLSYM(fptr, sym) if (*(fptr) == NULL) { *((void**)fptr) = (void *) internal::Bridge::instance().resolve_symbol(sym); } #include #endif // HYBRIS_MODULE_H_ platform-api-3.0.1+16.04.20160203/src/ubuntu/application/touch/hybris/CMakeLists.txt0000644000015600001650000000043512654347715030262 0ustar pbuserpbgroup00000000000000set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") add_library( ubuntu_application_api_hybris STATIC ubuntu_application_sensors_hybris.cpp ) include_directories( ${CMAKE_BINARY_DIR}/include ) target_link_libraries( ubuntu_application_api_hybris ${Hybris} ) platform-api-3.0.1+16.04.20160203/src/ubuntu/application/touch/module.cpp0000644000015600001650000000176212654347715026217 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2014 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #include #include "module_version.h" void u_application_module_version(uint32_t *major, uint32_t *minor, uint32_t *patch) { *major = (uint32_t) MODULE_VERSION_MAJOR; *minor = (uint32_t) MODULE_VERSION_MINOR; *patch = (uint32_t) MODULE_VERSION_PATCH; } platform-api-3.0.1+16.04.20160203/src/ubuntu/application/base_module.h0000644000015600001650000000777712654347715025550 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss * Ricardo Mendoza */ #ifndef BASE_MODULE_H_ #define BASE_MODULE_H_ #include #include #include /* * This is the base backend loader for the Platform API */ #define API_VERSION_MAJOR "3" #define API_VERSION_MINOR "0" #define API_VERSION_PATCH "0" #define SO_SUFFIX ".so." API_VERSION_MAJOR "." API_VERSION_MINOR "." API_VERSION_PATCH namespace internal { /* Programs can select a backend with $UBUNTU_PLATFORM_API_BACKEND, * which either needs to be a full path or just the file name (then it will be * looked up in the usual library search path, see dlopen(3)). */ struct HIDDEN_SYMBOL ToBackend { static const char* path() { static char* cache = NULL; static char path[64]; char module_name[32]; if (cache == NULL) { cache = secure_getenv("UBUNTU_PLATFORM_API_BACKEND"); if (cache == NULL) { FILE *conf; conf = fopen("/etc/ubuntu-platform-api/application.conf", "r"); if (conf != NULL) { if (fgets(module_name, 32, conf)) { cache = module_name; // Null terminate module blob cache[strlen(cache)-1] = '\0'; fclose(conf); } else fprintf(stderr, "Error reading module name from file.\n"); } } if (cache == NULL) { // No module available, use dummy. fprintf(stderr, "Unable to select module, using dummy.\n"); strcpy(path, override_path()); } else { strcpy(path, "libubuntu_application_api_"); if (strlen(cache) > MAX_MODULE_NAME) exit_module("Selected module is invalid"); strcat(path, cache); strcat(path, SO_SUFFIX); } fprintf(stderr, "Loading module: '%s'\n", path); } return path; } static const char* override_path() { // Hardcoded for the testbackend const char *testlib = "test"; static char path[64]; strcpy(path, "libubuntu_application_api_"); strcat(path, testlib); strcat(path, SO_SUFFIX); return path; } static void exit_module(const char* msg) { fprintf(stderr, "Ubuntu Platform API: %s -- Aborting\n", msg); abort(); } static void* dlopen_fn(const char* path, int flags) { void *handle = dlopen(path, flags); if (handle == NULL) { fprintf(stderr, "Unable to load selected module, using dummy.\n"); fprintf(stderr, "Loading module: '%s'\n", override_path()); handle = dlopen(override_path(), flags); if (handle == NULL) exit_module("Dummy module failed to load."); } return handle; } static void* dlsym_fn(void* handle, const char* symbol) { return dlsym(handle, symbol); } }; } #define DLSYM(fptr, sym, module) if (*(fptr) == NULL) { *((void**)fptr) = (void *) internal::Bridge::instance().resolve_symbol(sym, module); } #include #endif // BASE_MODULE_H_ platform-api-3.0.1+16.04.20160203/src/ubuntu/application/ubuntu_application_api.cpp0000644000015600001650000003550712654347715030352 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2014-2015 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss * Ricardo Mendoza */ // C APIs #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "base_module.h" #ifdef __cplusplus extern "C" { #endif // Application Module Config IMPLEMENT_VOID_FUNCTION3(init, u_application_module_version, uint32_t*, uint32_t*, uint32_t*); IMPLEMENT_VOID_FUNCTION1(init, u_application_init, void*); IMPLEMENT_VOID_FUNCTION0(init, u_application_finish); // Lifecycle helpers IMPLEMENT_FUNCTION0(lifecycle, UApplicationLifecycleDelegate*, u_application_lifecycle_delegate_new); IMPLEMENT_VOID_FUNCTION2(lifecycle, u_application_lifecycle_delegate_set_context, UApplicationLifecycleDelegate*, void*); IMPLEMENT_VOID_FUNCTION1(lifecycle, u_application_lifecycle_delegate_ref, UApplicationLifecycleDelegate*); IMPLEMENT_VOID_FUNCTION1(lifecycle, u_application_lifecycle_delegate_unref, UApplicationLifecycleDelegate*); IMPLEMENT_VOID_FUNCTION2(lifecycle, u_application_lifecycle_delegate_set_application_resumed_cb, UApplicationLifecycleDelegate*, u_on_application_resumed); IMPLEMENT_VOID_FUNCTION2(lifecycle, u_application_lifecycle_delegate_set_application_about_to_stop_cb, UApplicationLifecycleDelegate*, u_on_application_about_to_stop); // Application Instance Helpers // UApplicationId IMPLEMENT_FUNCTION2(instance, UApplicationId*, u_application_id_new_from_stringn, const char*, size_t); IMPLEMENT_VOID_FUNCTION1(instance, u_application_id_destroy, UApplicationId*); IMPLEMENT_FUNCTION2(instance, int, u_application_id_compare, UApplicationId*, UApplicationId*); // UApplicationDescription IMPLEMENT_FUNCTION0(instance, UApplicationDescription*, u_application_description_new); IMPLEMENT_VOID_FUNCTION1(instance, u_application_description_destroy, UApplicationDescription*); IMPLEMENT_VOID_FUNCTION2(instance, u_application_description_set_application_id, UApplicationDescription*, UApplicationId*); IMPLEMENT_VOID_FUNCTION2(instance, u_application_description_set_application_lifecycle_delegate, UApplicationDescription*, UApplicationLifecycleDelegate*); // UApplicationOptions IMPLEMENT_FUNCTION2(instance, UApplicationOptions*, u_application_options_new_from_cmd_line, int, char**); IMPLEMENT_VOID_FUNCTION1(instance, u_application_options_destroy, UApplicationOptions*); // UApplicationInstance IMPLEMENT_FUNCTION2(instance, UApplicationInstance*, u_application_instance_new_from_description_with_options, UApplicationDescription*, UApplicationOptions*); IMPLEMENT_FUNCTION1(connection, MirConnection*, u_application_instance_get_mir_connection, UApplicationInstance*); // Ubuntu Application Sensors // Acceleration Sensor IMPLEMENT_CTOR0(sensors, UASensorsAccelerometer*, ua_sensors_accelerometer_new); IMPLEMENT_FUNCTION1(sensors, UStatus, ua_sensors_accelerometer_enable, UASensorsAccelerometer*); IMPLEMENT_FUNCTION1(sensors, UStatus, ua_sensors_accelerometer_disable, UASensorsAccelerometer*); IMPLEMENT_FUNCTION1(sensors, uint32_t, ua_sensors_accelerometer_get_min_delay, UASensorsAccelerometer*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_accelerometer_get_min_value, UASensorsAccelerometer*, float*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_accelerometer_get_max_value, UASensorsAccelerometer*, float*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_accelerometer_get_resolution, UASensorsAccelerometer*, float*); IMPLEMENT_VOID_FUNCTION3(sensors, ua_sensors_accelerometer_set_reading_cb, UASensorsAccelerometer*, on_accelerometer_event_cb, void*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_accelerometer_set_event_rate, UASensorsAccelerometer*, uint32_t); // Acceleration Sensor Event IMPLEMENT_FUNCTION1(sensors, uint64_t, uas_accelerometer_event_get_timestamp, UASAccelerometerEvent*); IMPLEMENT_FUNCTION2(sensors, UStatus, uas_accelerometer_event_get_acceleration_x, UASAccelerometerEvent*, float*); IMPLEMENT_FUNCTION2(sensors, UStatus, uas_accelerometer_event_get_acceleration_y, UASAccelerometerEvent*, float*); IMPLEMENT_FUNCTION2(sensors, UStatus, uas_accelerometer_event_get_acceleration_z, UASAccelerometerEvent*, float*); // Proximity Sensor IMPLEMENT_CTOR0(sensors, UASensorsProximity*, ua_sensors_proximity_new); IMPLEMENT_FUNCTION1(sensors, UStatus, ua_sensors_proximity_enable, UASensorsProximity*); IMPLEMENT_FUNCTION1(sensors, UStatus, ua_sensors_proximity_disable, UASensorsProximity*); IMPLEMENT_FUNCTION1(sensors, uint32_t, ua_sensors_proximity_get_min_delay, UASensorsProximity*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_proximity_get_min_value, UASensorsProximity*, float*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_proximity_get_max_value, UASensorsProximity*, float*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_proximity_get_resolution, UASensorsProximity*, float*); IMPLEMENT_VOID_FUNCTION3(sensors, ua_sensors_proximity_set_reading_cb, UASensorsProximity*, on_proximity_event_cb, void*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_proximity_set_event_rate, UASensorsProximity*, uint32_t); // Proximity Sensor Event IMPLEMENT_FUNCTION1(sensors, uint64_t, uas_proximity_event_get_timestamp, UASProximityEvent*); IMPLEMENT_FUNCTION1(sensors, UASProximityDistance, uas_proximity_event_get_distance, UASProximityEvent*); // Ambient Light Sensor IMPLEMENT_CTOR0(sensors, UASensorsLight*, ua_sensors_light_new); IMPLEMENT_FUNCTION1(sensors, UStatus, ua_sensors_light_enable, UASensorsLight*); IMPLEMENT_FUNCTION1(sensors, UStatus, ua_sensors_light_disable, UASensorsLight*); IMPLEMENT_FUNCTION1(sensors, uint32_t, ua_sensors_light_get_min_delay, UASensorsLight*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_light_get_min_value, UASensorsLight*, float*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_light_get_max_value, UASensorsLight*, float*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_light_get_resolution, UASensorsLight*, float*); IMPLEMENT_VOID_FUNCTION3(sensors, ua_sensors_light_set_reading_cb, UASensorsLight*, on_light_event_cb, void*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_light_set_event_rate, UASensorsLight*, uint32_t); // Ambient Light Sensor Event IMPLEMENT_FUNCTION1(sensors, uint64_t, uas_light_event_get_timestamp, UASLightEvent*); IMPLEMENT_FUNCTION2(sensors, UStatus, uas_light_event_get_light, UASLightEvent*, float*); // Haptic Sensor IMPLEMENT_CTOR0(sensors, UASensorsHaptic*, ua_sensors_haptic_new); IMPLEMENT_VOID_FUNCTION1(sensors, ua_sensors_haptic_destroy, UASensorsHaptic*); IMPLEMENT_FUNCTION1(sensors, UStatus, ua_sensors_haptic_enable, UASensorsHaptic*); IMPLEMENT_FUNCTION1(sensors, UStatus, ua_sensors_haptic_disable, UASensorsHaptic*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_haptic_vibrate_once, UASensorsHaptic*, uint32_t); IMPLEMENT_FUNCTION3(sensors, UStatus, ua_sensors_haptic_vibrate_with_pattern, UASensorsHaptic*, uint32_t*, uint32_t); // Orientation Sensor IMPLEMENT_CTOR0(sensors, UASensorsOrientation*, ua_sensors_orientation_new); IMPLEMENT_FUNCTION1(sensors, UStatus, ua_sensors_orientation_enable, UASensorsOrientation*); IMPLEMENT_FUNCTION1(sensors, UStatus, ua_sensors_orientation_disable, UASensorsOrientation*); IMPLEMENT_FUNCTION1(sensors, uint32_t, ua_sensors_orientation_get_min_delay, UASensorsOrientation*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_orientation_get_min_value, UASensorsOrientation*, float*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_orientation_get_max_value, UASensorsOrientation*, float*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_orientation_get_resolution, UASensorsOrientation*, float*); IMPLEMENT_VOID_FUNCTION3(sensors, ua_sensors_orientation_set_reading_cb, UASensorsOrientation*, on_orientation_event_cb, void*); IMPLEMENT_FUNCTION2(sensors, UStatus, ua_sensors_orientation_set_event_rate, UASensorsOrientation*, uint32_t); // Orientation Sensor Event IMPLEMENT_FUNCTION1(sensors, uint64_t, uas_orientation_event_get_timestamp, UASOrientationEvent*); IMPLEMENT_FUNCTION2(sensors, UStatus, uas_orientation_event_get_azimuth, UASOrientationEvent*, float*); IMPLEMENT_FUNCTION2(sensors, UStatus, uas_orientation_event_get_pitch, UASOrientationEvent*, float*); IMPLEMENT_FUNCTION2(sensors, UStatus, uas_orientation_event_get_roll, UASOrientationEvent*, float*); // Location IMPLEMENT_VOID_FUNCTION1(location, ua_location_service_controller_ref, UALocationServiceController*); IMPLEMENT_VOID_FUNCTION1(location, ua_location_service_controller_unref, UALocationServiceController*); IMPLEMENT_VOID_FUNCTION3(location, ua_location_service_controller_set_status_changed_handler, UALocationServiceController*, UALocationServiceStatusChangedHandler, void*); IMPLEMENT_FUNCTION2(location, UStatus, ua_location_service_controller_query_status, UALocationServiceController*, UALocationServiceStatusFlags*); IMPLEMENT_FUNCTION1(location, UStatus, ua_location_service_controller_enable_service, UALocationServiceController*); IMPLEMENT_FUNCTION1(location, UStatus, ua_location_service_controller_disable_service, UALocationServiceController*); IMPLEMENT_FUNCTION1(location, UStatus, ua_location_service_controller_enable_gps, UALocationServiceController*); IMPLEMENT_FUNCTION1(location, UStatus, ua_location_service_controller_disable_gps, UALocationServiceController*); IMPLEMENT_VOID_FUNCTION1(location, ua_location_heading_update_ref, UALocationHeadingUpdate*); IMPLEMENT_VOID_FUNCTION1(location, ua_location_heading_update_unref, UALocationHeadingUpdate*); IMPLEMENT_FUNCTION1(location, uint64_t, ua_location_heading_update_get_timestamp, UALocationHeadingUpdate*); IMPLEMENT_FUNCTION1(location, double, ua_location_heading_update_get_heading_in_degree, UALocationHeadingUpdate*); IMPLEMENT_VOID_FUNCTION1(location, ua_location_position_update_ref, UALocationPositionUpdate*); IMPLEMENT_VOID_FUNCTION1(location, ua_location_position_update_unref, UALocationPositionUpdate*); IMPLEMENT_FUNCTION1(location, uint64_t, ua_location_position_update_get_timestamp, UALocationPositionUpdate*); IMPLEMENT_FUNCTION1(location, double, ua_location_position_update_get_latitude_in_degree, UALocationPositionUpdate*); IMPLEMENT_FUNCTION1(location, double, ua_location_position_update_get_longitude_in_degree, UALocationPositionUpdate*); IMPLEMENT_FUNCTION1(location, bool, ua_location_position_update_has_altitude, UALocationPositionUpdate*); IMPLEMENT_FUNCTION1(location, double, ua_location_position_update_get_altitude_in_meter, UALocationPositionUpdate*); IMPLEMENT_FUNCTION1(location, bool, ua_location_position_update_has_horizontal_accuracy, UALocationPositionUpdate*); IMPLEMENT_FUNCTION1(location, double, ua_location_position_update_get_horizontal_accuracy_in_meter, UALocationPositionUpdate*); IMPLEMENT_FUNCTION1(location, bool, ua_location_position_update_has_vertical_accuracy, UALocationPositionUpdate*); IMPLEMENT_FUNCTION1(location, double, ua_location_position_update_get_vertical_accuracy_in_meter, UALocationPositionUpdate*); IMPLEMENT_FUNCTION1(location, UALocationServiceSession*, ua_location_service_create_session_for_low_accuracy, UALocationServiceRequirementsFlags); IMPLEMENT_FUNCTION2(location, UALocationServiceSession*, ua_location_service_try_create_session_for_low_accuracy, UALocationServiceRequirementsFlags, UALocationServiceError*); IMPLEMENT_FUNCTION1(location, UALocationServiceSession*, ua_location_service_create_session_for_high_accuracy, UALocationServiceRequirementsFlags); IMPLEMENT_FUNCTION2(location, UALocationServiceSession*, ua_location_service_try_create_session_for_high_accuracy, UALocationServiceRequirementsFlags, UALocationServiceError*); IMPLEMENT_CTOR0(location, UALocationServiceController*, ua_location_service_create_controller); IMPLEMENT_VOID_FUNCTION1(location, ua_location_service_session_ref, UALocationServiceSession*); IMPLEMENT_VOID_FUNCTION1(location, ua_location_service_session_unref, UALocationServiceSession*); IMPLEMENT_VOID_FUNCTION3(location, ua_location_service_session_set_position_updates_handler, UALocationServiceSession*, UALocationServiceSessionPositionUpdatesHandler, void*); IMPLEMENT_VOID_FUNCTION3(location, ua_location_service_session_set_heading_updates_handler, UALocationServiceSession*, UALocationServiceSessionHeadingUpdatesHandler, void*); IMPLEMENT_VOID_FUNCTION3(location, ua_location_service_session_set_velocity_updates_handler, UALocationServiceSession*, UALocationServiceSessionVelocityUpdatesHandler, void*); IMPLEMENT_FUNCTION1(location, UStatus, ua_location_service_session_start_position_updates, UALocationServiceSession*); IMPLEMENT_VOID_FUNCTION1(location, ua_location_service_session_stop_position_updates, UALocationServiceSession*); IMPLEMENT_FUNCTION1(location, UStatus, ua_location_service_session_start_heading_updates, UALocationServiceSession*); IMPLEMENT_VOID_FUNCTION1(location, ua_location_service_session_stop_heading_updates, UALocationServiceSession*); IMPLEMENT_FUNCTION1(location, UStatus, ua_location_service_session_start_velocity_updates, UALocationServiceSession*); IMPLEMENT_VOID_FUNCTION1(location, ua_location_service_session_stop_velocity_updates, UALocationServiceSession*); IMPLEMENT_VOID_FUNCTION1(location, ua_location_velocity_update_ref, UALocationVelocityUpdate*); IMPLEMENT_VOID_FUNCTION1(location, ua_location_velocity_update_unref, UALocationVelocityUpdate*); IMPLEMENT_FUNCTION1(location, uint64_t, ua_location_velocity_update_get_timestamp, UALocationVelocityUpdate*); IMPLEMENT_FUNCTION1(location, double, ua_location_velocity_update_get_velocity_in_meters_per_second, UALocationVelocityUpdate*); // URL Dispatcher IMPLEMENT_CTOR0(url_dispatcher, UAUrlDispatcherSession*, ua_url_dispatcher_session); IMPLEMENT_VOID_FUNCTION4(url_dispatcher, ua_url_dispatcher_session_open, UAUrlDispatcherSession*, const char*, UAUrlDispatcherSessionDispatchHandler, void*); #ifdef __cplusplus } #endif platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/0000755000015600001650000000000012654350173024356 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/0000755000015600001650000000000012654350173026661 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/url_dispatcher/0000755000015600001650000000000012654350173031671 5ustar pbuserpbgroup00000000000000././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/url_dispatcher/session.cppplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/url_dispatcher/session.c0000644000015600001650000000301312654347715033525 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * */ #include "ubuntu/application/url_dispatcher/session.h" #include #include struct DispatchCallBackData { UAUrlDispatcherSessionDispatchHandler handler; void *user_context; }; static void dispatch_callback(const gchar *url, gboolean success, gpointer user_data) { DispatchCallBackData *data = (DispatchCallBackData*)user_data; if (data->handler) data->handler(success ? U_STATUS_SUCCESS : U_STATUS_ERROR, url, data->user_context); free(data); } void ua_url_dispatcher_session_open( UAUrlDispatcherSession *session, const char *url, UAUrlDispatcherSessionDispatchHandler handler, void *user_context) { DispatchCallBackData *data = (DispatchCallBackData*)malloc(sizeof(DispatchCallBackData)); data->handler = handler; data->user_context = user_context; url_dispatch_send(url, dispatch_callback, data); } ././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/url_dispatcher/session_p.hplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/url_dispatcher/session_p0000644000015600001650000000135312654347715033630 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * */ struct UbuntuApplicationUrlDispatcherSession { // We don't need anything for the moment }; ././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/url_dispatcher/CMakeLists.txtplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/url_dispatcher/CMakeList0000644000015600001650000000057312654347715033445 0ustar pbuserpbgroup00000000000000find_package(PkgConfig) pkg_check_modules(LIBURL_DISPATCHER REQUIRED url-dispatcher-1) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") include_directories(${LIBURL_DISPATCHER_INCLUDE_DIRS}) add_library( ubuntu_application_url_dispatcher service.cpp session.cpp ) target_link_libraries( ubuntu_application_url_dispatcher ${LIBURL_DISPATCHER_LDFLAGS} ) ././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/url_dispatcher/service.cppplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/url_dispatcher/service.c0000644000015600001650000000164312654347715033511 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * */ #include "ubuntu/application/url_dispatcher/service.h" #include "session_p.h" #include UAUrlDispatcherSession* ua_url_dispatcher_session() { UAUrlDispatcherSession *session = (UAUrlDispatcherSession*)malloc(sizeof(UAUrlDispatcherSession)); return session; } platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/0000755000015600001650000000000012654350173030471 5ustar pbuserpbgroup00000000000000././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/position_update_p.hplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/position_update0000644000015600001650000000236212654347715033635 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss */ #ifndef POSITION_UPDATE_PRIVATE_H_ #define POSITION_UPDATE_PRIVATE_H_ #include "ubuntu/application/location/position_update.h" #include "ref_counted.h" #include #include namespace cul = com::ubuntu::location; struct UbuntuApplicationLocationPositionUpdate : public detail::RefCounted { UbuntuApplicationLocationPositionUpdate(const cul::Update& update) : update(update) { } const cul::Update& update; }; #endif // POSITION_UPDATE_PRIVATE_H_ platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/session.cpp0000644000015600001650000001371712654347715032701 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss */ #include "ubuntu/application/location/session.h" #include "session_p.h" #include "heading_update_p.h" #include "position_update_p.h" #include "velocity_update_p.h" namespace location = com::ubuntu::location; void ua_location_service_session_ref( UALocationServiceSession *session) { if (not session) return; auto s = static_cast(session); s->ref(); } void ua_location_service_session_unref( UALocationServiceSession *session) { if (not session) return; auto s = static_cast(session); s->unref(); } void ua_location_service_session_set_position_updates_handler( UALocationServiceSession *session, UALocationServiceSessionPositionUpdatesHandler handler, void *context) { if (not session) return; auto s = static_cast(session); try { std::lock_guard lg(s->position_updates.guard); s->position_updates.handler = handler; s->position_updates.context = context; } catch(const std::exception& e) { fprintf(stderr, "Error setting up position updates handler: %s \n", e.what()); } catch(...) { fprintf(stderr, "Error setting up position updates handler.\n"); } } void ua_location_service_session_set_heading_updates_handler( UALocationServiceSession *session, UALocationServiceSessionHeadingUpdatesHandler handler, void *context) { if (not session) return; auto s = static_cast(session); try { std::lock_guard lg(s->heading_updates.guard); s->heading_updates.handler = handler; s->heading_updates.context = context; } catch(const std::exception& e) { fprintf(stderr, "Error setting up heading updates handler: %s \n", e.what()); } catch(...) { fprintf(stderr, "Error setting up heading updates handler. \n"); } } void ua_location_service_session_set_velocity_updates_handler( UALocationServiceSession *session, UALocationServiceSessionVelocityUpdatesHandler handler, void *context) { if (not session) return; auto s = static_cast(session); try { std::lock_guard lg(s->velocity_updates.guard); s->velocity_updates.handler = handler; s->velocity_updates.context = context; } catch(const std::exception& e) { fprintf(stderr, "Error setting up velocity updates handler: %s \n", e.what()); } catch(...) { fprintf(stderr, "Error setting up velocity updates handler."); } } UStatus ua_location_service_session_start_position_updates( UALocationServiceSession *session) { if (not session) return U_STATUS_ERROR; auto s = static_cast(session); try { s->session->updates().position_status.set( location::service::session::Interface::Updates::Status::enabled); } catch(...) { return U_STATUS_ERROR; } return U_STATUS_SUCCESS; } void ua_location_service_session_stop_position_updates( UALocationServiceSession *session) { if (not session) return; auto s = static_cast(session); try { s->session->updates().position_status.set( location::service::session::Interface::Updates::Status::disabled); } catch(...) { } } UStatus ua_location_service_session_start_heading_updates( UALocationServiceSession *session) { if (not session) return U_STATUS_ERROR; auto s = static_cast(session); try { s->session->updates().heading_status.set( location::service::session::Interface::Updates::Status::enabled); } catch(...) { return U_STATUS_ERROR; } return U_STATUS_SUCCESS; } void ua_location_service_session_stop_heading_updates( UALocationServiceSession *session) { if (not session) return; auto s = static_cast(session); try { s->session->updates().heading_status.set( location::service::session::Interface::Updates::Status::disabled); } catch(...) { } } UStatus ua_location_service_session_start_velocity_updates( UALocationServiceSession *session) { if (not session) return U_STATUS_ERROR; auto s = static_cast(session); try { s->session->updates().velocity_status.set( location::service::session::Interface::Updates::Status::enabled); } catch(...) { return U_STATUS_ERROR; } return U_STATUS_SUCCESS; } void ua_location_service_session_stop_velocity_updates( UALocationServiceSession *session) { if (not session) return; auto s = static_cast(session); try { s->session->updates().velocity_status.set( location::service::session::Interface::Updates::Status::disabled); } catch(...) { } } ././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/heading_update.cppplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/heading_update.0000644000015600001650000000270112654347715033443 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss */ #include "ubuntu/application/location/heading_update.h" #include "heading_update_p.h" #include #include namespace cul = com::ubuntu::location; void ua_location_heading_update_ref( UALocationHeadingUpdate *update) { update->ref(); } void ua_location_heading_update_unref( UALocationHeadingUpdate *update) { update->unref(); } uint64_t ua_location_heading_update_get_timestamp( UALocationHeadingUpdate *update) { return std::chrono::duration_cast( update->update.when.time_since_epoch()).count(); } double ua_location_heading_update_get_heading_in_degree( UALocationHeadingUpdate *update) { return update->update.value.value(); } ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/velocity_update.cppplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/velocity_update0000644000015600001650000000273012654347715033626 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss */ #include "ubuntu/application/location/velocity_update.h" #include "velocity_update_p.h" #include #include namespace cul = com::ubuntu::location; void ua_location_velocity_update_ref( UALocationVelocityUpdate *update) { update->ref(); } void ua_location_velocity_update_unref( UALocationVelocityUpdate *update) { update->unref(); } uint64_t ua_location_velocity_update_get_timestamp( UALocationVelocityUpdate *update) { return std::chrono::duration_cast( update->update.when.time_since_epoch()).count(); } double ua_location_velocity_update_get_velocity_in_meters_per_second( UALocationVelocityUpdate *update) { return update->update.value.value(); } platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/controller.cpp0000644000015600001650000001201112654347715033363 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss */ #include "ubuntu/application/location/controller.h" #include "controller_p.h" #include "instance.h" void ua_location_service_controller_ref( UALocationServiceController *controller) { controller->ref(); } void ua_location_service_controller_unref( UALocationServiceController *controller) { controller->unref(); } void ua_location_service_controller_set_status_changed_handler( UALocationServiceController *controller, UALocationServiceStatusChangedHandler handler, void *context) { (void) controller; try { Instance::instance().set_changed_handler_with_context(handler, context); } catch(const std::exception& e) { std::cerr << "ua_location_service_controller_set_status_changed_handler: error accessing instance: " << e.what() << std::endl; } catch(...) { std::cerr << "ua_location_service_controller_set_status_changed_handler: error accessing instance." << std::endl; } } UStatus ua_location_service_controller_query_status( UALocationServiceController *controller, UALocationServiceStatusFlags *out_flags) { (void) controller; *out_flags = 0; try { auto service = Instance::instance().get_service(); if (service->is_online().get()) *out_flags |= UA_LOCATION_SERVICE_ENABLED; else *out_flags |= UA_LOCATION_SERVICE_DISABLED; if (service->does_satellite_based_positioning().get()) *out_flags |= UA_LOCATION_SERVICE_GPS_ENABLED; else *out_flags |= UA_LOCATION_SERVICE_GPS_DISABLED; return U_STATUS_SUCCESS; } catch(const std::exception& e) { std::cerr << "ua_location_service_controller_query_status: error accessing instance: " << e.what() << std::endl; } catch(...) { std::cerr << "ua_location_service_controller_query_status: error accessing instance." << std::endl; } return U_STATUS_ERROR; } UStatus ua_location_service_controller_enable_service( UALocationServiceController *controller) { (void) controller; try { auto service = Instance::instance().get_service(); service->is_online().set(true); return U_STATUS_SUCCESS; } catch(const std::exception& e) { std::cerr << "ua_location_service_controller_enable_service: error accessing instance: " << e.what() << std::endl; } catch(...) { std::cerr << "ua_location_service_controller_enable_service: error accessing instance." << std::endl; } return U_STATUS_ERROR; } UStatus ua_location_service_controller_disable_service( UALocationServiceController *controller) { (void) controller; try { auto service = Instance::instance().get_service(); service->is_online().set(false); return U_STATUS_SUCCESS; } catch(const std::exception& e) { std::cerr << "ua_location_service_controller_disable_service: error accessing instance: " << e.what() << std::endl; } catch(...) { std::cerr << "ua_location_service_controller_disable_service: error accessing instance." << std::endl; } return U_STATUS_ERROR; } UStatus ua_location_service_controller_enable_gps( UALocationServiceController *controller) { (void) controller; try { auto service = Instance::instance().get_service(); service->does_satellite_based_positioning().set(true); return U_STATUS_SUCCESS; } catch(const std::exception& e) { std::cerr << "ua_location_service_controller_enable_gps: error accessing instance: " << e.what() << std::endl; } catch(...) { std::cerr << "ua_location_service_controller_enable_gps: error accessing instance." << std::endl; } return U_STATUS_ERROR; } UStatus ua_location_service_controller_disable_gps( UALocationServiceController *controller) { (void) controller; try { auto service = Instance::instance().get_service(); service->does_satellite_based_positioning().set(false); return U_STATUS_SUCCESS; } catch(const std::exception& e) { std::cerr << "ua_location_service_controller_disable_gps: error accessing instance: " << e.what() << std::endl; } catch(...) { std::cerr << "ua_location_service_controller_disable_gps: error accessing instance." << std::endl; } return U_STATUS_ERROR; } ././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/heading_update_p.hplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/heading_update_0000644000015600001650000000235112654347715033525 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss */ #ifndef HEADING_UPDATE_PRIVATE_H_ #define HEADING_UPDATE_PRIVATE_H_ #include "ubuntu/application/location/heading_update.h" #include "ref_counted.h" #include #include namespace cul = com::ubuntu::location; struct UbuntuApplicationLocationHeadingUpdate : public detail::RefCounted { UbuntuApplicationLocationHeadingUpdate(const cul::Update& update) : update(update) { } const cul::Update& update; }; #endif // HEADING_UPDATE_PRIVATE_H_ platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/session_p.h0000644000015600001650000001150512654347715032656 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss */ #ifndef SESSION_PRIVATE_H_ #define SESSION_PRIVATE_H_ #include "ubuntu/application/location/session.h" #include "ref_counted.h" #include "heading_update_p.h" #include "position_update_p.h" #include "velocity_update_p.h" #include #include namespace cul = com::ubuntu::location; namespace culss = com::ubuntu::location::service::session; struct UbuntuApplicationLocationServiceSession : public detail::RefCounted { UbuntuApplicationLocationServiceSession(const culss::Interface::Ptr& session) : session(session), connections { session->updates().position.changed().connect( [this](const cul::Update& new_position) { try { std::lock_guard lg(position_updates.guard); UbuntuApplicationLocationPositionUpdate pu{new_position}; if (position_updates.handler) position_updates.handler( std::addressof(pu), position_updates.context); } catch(...) { // We silently ignore the issue and keep going. } }), session->updates().heading.changed().connect( [this](const cul::Update& new_heading) { try { std::lock_guard lg(heading_updates.guard); UbuntuApplicationLocationHeadingUpdate hu{new_heading}; if (heading_updates.handler) heading_updates.handler( std::addressof(hu), heading_updates.context); } catch(...) { // We silently ignore the issue and keep going. } }), session->updates().velocity.changed().connect( [this](const cul::Update& new_velocity) { try { std::lock_guard lg(velocity_updates.guard); UbuntuApplicationLocationVelocityUpdate vu{new_velocity}; if (velocity_updates.handler) velocity_updates.handler( std::addressof(vu), velocity_updates.context); } catch(...) { // We silently ignore the issue and keep going. } }), } { } ~UbuntuApplicationLocationServiceSession() { std::lock_guard lgp(position_updates.guard); std::lock_guard lgh(heading_updates.guard); std::lock_guard lgv(velocity_updates.guard); position_updates.handler = nullptr; heading_updates.handler = nullptr; velocity_updates.handler = nullptr; } culss::Interface::Ptr session; struct { std::mutex guard; UALocationServiceSessionPositionUpdatesHandler handler{nullptr}; void* context{nullptr}; } position_updates{}; struct { std::mutex guard; UALocationServiceSessionHeadingUpdatesHandler handler{nullptr}; void* context{nullptr}; } heading_updates{}; struct { std::mutex guard; UALocationServiceSessionVelocityUpdatesHandler handler{nullptr}; void* context{nullptr}; } velocity_updates{}; struct { core::ScopedConnection position_updates; core::ScopedConnection heading_updates; core::ScopedConnection velocity_updates; } connections; }; #endif // SESSION_PRIVATE_H_ platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/instance.h0000644000015600001650000001063412654347715032462 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef INSTANCE_H_ #define INSTANCE_H_ #include "ubuntu/visibility.h" #include "ubuntu/application/location/controller.h" #include #include #include #include class UBUNTU_DLL_LOCAL Instance { public: static Instance& instance() { static Instance inst; return inst; } const com::ubuntu::location::service::Interface::Ptr& get_service() const { return service; } void set_changed_handler_with_context( UALocationServiceStatusChangedHandler handler, void* context) { changed_handler = handler; changed_handler_context = context; } private: Instance() : bus(std::make_shared(core::dbus::WellKnownBus::system)), executor(core::dbus::asio::make_executor(bus)), service(core::dbus::resolve_service_on_bus< com::ubuntu::location::service::Interface, com::ubuntu::location::service::Stub >(bus)), connections { service->does_satellite_based_positioning().changed().connect([this](bool value) { // Update our cached value. if (value) { cached_state_flags |= UA_LOCATION_SERVICE_GPS_ENABLED; cached_state_flags &= ~UA_LOCATION_SERVICE_GPS_DISABLED; } else { cached_state_flags |= UA_LOCATION_SERVICE_GPS_DISABLED; cached_state_flags &= ~UA_LOCATION_SERVICE_GPS_ENABLED; } // And notify change handler if one is set. if (changed_handler) changed_handler(cached_state_flags, changed_handler_context); }), service->is_online().changed().connect([this](bool value) { // Update our cached value. if (value) { cached_state_flags |= UA_LOCATION_SERVICE_ENABLED; cached_state_flags &= ~UA_LOCATION_SERVICE_DISABLED; } else { cached_state_flags |= UA_LOCATION_SERVICE_DISABLED; cached_state_flags &= ~UA_LOCATION_SERVICE_ENABLED; } // And notify change handler if one is set. if (changed_handler) changed_handler(cached_state_flags, changed_handler_context); }) }, cached_state_flags{0}, changed_handler{nullptr}, changed_handler_context{nullptr} { bus->install_executor(executor); worker = std::move(std::thread([&]() { bus->run(); })); } ~Instance() noexcept { try { bus->stop(); if (worker.joinable()) worker.join(); } catch(...) { // We silently ignore errors to fulfill our noexcept guarantee. } } core::dbus::Bus::Ptr bus; core::dbus::Executor::Ptr executor; std::thread worker; com::ubuntu::location::service::Interface::Ptr service; // All event connections go here. struct { core::ScopedConnection on_does_satellite_based_positioning_changed; core::ScopedConnection on_is_online_changed; } connections; // All change-handler specifics go here. UALocationServiceStatusFlags cached_state_flags; UALocationServiceStatusChangedHandler changed_handler; void* changed_handler_context; }; #endif // INSTANCE_H_ ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/velocity_update_p.hplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/velocity_update0000644000015600001650000000236212654347715033627 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss */ #ifndef VELOCITY_UPDATE_PRIVATE_H_ #define VELOCITY_UPDATE_PRIVATE_H_ #include "ubuntu/application/location/velocity_update.h" #include "ref_counted.h" #include #include namespace cul = com::ubuntu::location; struct UbuntuApplicationLocationVelocityUpdate : public detail::RefCounted { UbuntuApplicationLocationVelocityUpdate(const cul::Update& update) : update(update) { } const cul::Update& update; }; #endif // VELOCITY_UPDATE_PRIVATE_H_ platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/CMakeLists.txt0000644000015600001650000000113412654347715033240 0ustar pbuserpbgroup00000000000000find_package(PkgConfig) find_package(Threads) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") pkg_check_modules(DBUS_CPP REQUIRED dbus-cpp) pkg_check_modules(LOCATION_SERVICE REQUIRED ubuntu-location-service) include_directories( ${DBUS_CPP_INCLUDE_DIRS} ${LOCATION_SERVICE_INCLUDE_DIRS} ) add_library( ubuntu_application_location controller.cpp service.cpp session.cpp heading_update.cpp position_update.cpp velocity_update.cpp ) target_link_libraries( ubuntu_application_location ${LOCATION_SERVICE_LDFLAGS} ${DBUS_CPP_LDFLAGS} ${CMAKE_THREAD_LIBS_INIT} ) ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/position_update.cppplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/position_update0000644000015600001650000000512312654347715033633 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss */ #include "ubuntu/application/location/position_update.h" #include "position_update_p.h" #include #include namespace cul = com::ubuntu::location; void ua_location_position_update_ref( UALocationPositionUpdate *update) { update->ref(); } void ua_location_position_update_unref( UALocationPositionUpdate *update) { update->unref(); } uint64_t ua_location_position_update_get_timestamp( UALocationPositionUpdate *update) { return std::chrono::duration_cast( update->update.when.time_since_epoch()).count(); } double ua_location_position_update_get_latitude_in_degree( UALocationPositionUpdate *update) { return update->update.value.latitude.value.value(); } double ua_location_position_update_get_longitude_in_degree( UALocationPositionUpdate *update) { return update->update.value.longitude.value.value(); } bool ua_location_position_update_has_altitude( UALocationPositionUpdate *update) { return update->update.value.altitude ? true : false; } double ua_location_position_update_get_altitude_in_meter( UALocationPositionUpdate *update) { return update->update.value.altitude->value.value(); } bool ua_location_position_update_has_horizontal_accuracy( UALocationPositionUpdate *update) { return update->update.value.accuracy.horizontal ? true : false; } double ua_location_position_update_get_horizontal_accuracy_in_meter( UALocationPositionUpdate *update) { return update->update.value.accuracy.horizontal->value(); } bool ua_location_position_update_has_vertical_accuracy( UALocationPositionUpdate *update) { return update->update.value.accuracy.vertical ? true : false; } double ua_location_position_update_get_vertical_accuracy_in_meter( UALocationPositionUpdate *update) { return update->update.value.accuracy.vertical->value(); } platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/controller_p.h0000644000015600001650000000170512654347715033357 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss */ #ifndef CONTROLLER_PRIVATE_H_ #define CONTROLLER_PRIVATE_H_ #include "ubuntu/application/location/controller.h" #include "ref_counted.h" struct UbuntuApplicationLocationServiceController : public detail::RefCounted { }; #endif // CONTROLLER_PRIVATE_H_ platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/service.cpp0000644000015600001650000001166012654347715032651 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss */ #include "ubuntu/application/location/service.h" #include "controller_p.h" #include "instance.h" #include "session_p.h" #include #include #include namespace dbus = core::dbus; namespace cul = com::ubuntu::location; namespace culs = com::ubuntu::location::service; UALocationServiceSession* ua_location_service_create_session_for_low_accuracy( UALocationServiceRequirementsFlags /*flags*/) { // Creating the instance might fail for a number of reason and // we cannot allow exceptions to propagate to prevent applications // from aborting. For that, we catch all exceptions, provide some error // information to std::cerr and return a nullptr in case of errors. try { return new UbuntuApplicationLocationServiceSession { // Creating the instance might fail for a number of reasons. Instance::instance().get_service()->create_session_for_criteria(cul::Criteria{}) }; } catch(const std::exception& e) { std::cerr << "ua_location_service_create_session_for_low_accuracy: Error creating instance: " << e.what() << std::endl; } catch(...) { std::cerr << "ua_location_service_create_session_for_low_accuracy: Error creating instance." << std::endl; } return nullptr; } UALocationServiceSession* ua_location_service_try_create_session_for_low_accuracy( UALocationServiceRequirementsFlags flags, UALocationServiceError* status) { if (status) *status = UA_LOCATION_SERVICE_ERROR_NONE; // Creating the instance might fail for a number of reason and // we cannot allow exceptions to propagate to prevent applications // from aborting. For that, we catch all exceptions, provide some error // information to std::cerr and return a nullptr in case of errors. try { return new UbuntuApplicationLocationServiceSession { // Creating the instance might fail for a number of reasons. Instance::instance().get_service()->create_session_for_criteria(cul::Criteria{}) }; } catch(...) { if (status) *status = UA_LOCATION_SERVICE_ERROR_NO_ACCESS; } return nullptr; } UALocationServiceSession* ua_location_service_create_session_for_high_accuracy( UALocationServiceRequirementsFlags /*flags*/) { // Creating the instance might fail for a number of reason and // we cannot allow exceptions to propagate to prevent applications // from aborting. For that, we catch all exceptions, provide some error // information to std::cerr and return a nullptr in case of errors. try { return new UbuntuApplicationLocationServiceSession { // Creating the instance might fail for a number of reasons. Instance::instance().get_service()->create_session_for_criteria(cul::Criteria{}) }; } catch(const std::exception& e) { std::cerr << "ua_location_service_create_session_for_high_accuracy: Error creating instance: " << e.what() << std::endl; } catch(...) { std::cerr << "ua_location_service_create_session_for_high_accuracy: Error creating instance." << std::endl; } return nullptr; } UALocationServiceSession* ua_location_service_try_create_session_for_high_accuracy( UALocationServiceRequirementsFlags, UALocationServiceError* status) { if (status) *status = UA_LOCATION_SERVICE_ERROR_NONE; // Creating the instance might fail for a number of reason and // we cannot allow exceptions to propagate to prevent applications // from aborting. For that, we catch all exceptions, provide some error // information to std::cerr and return a nullptr in case of errors. try { return new UbuntuApplicationLocationServiceSession { // Creating the instance might fail for a number of reasons. Instance::instance().get_service()->create_session_for_criteria(cul::Criteria{}) }; } catch(...) { if (status) *status = UA_LOCATION_SERVICE_ERROR_NO_ACCESS; } return nullptr; } UALocationServiceController* ua_location_service_create_controller() { return new UbuntuApplicationLocationServiceController{}; } platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/location/ref_counted.h0000644000015600001650000000234512654347715033153 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss */ #ifndef REF_COUNTED_H_ #define REF_COUNTED_H_ #include namespace detail { class RefCounted { public: RefCounted(const RefCounted&) = delete; virtual ~RefCounted() = default; RefCounted& operator=(const RefCounted&) = delete; bool operator==(const RefCounted&) const = delete; void ref() { counter.fetch_add(1); } void unref() { if (1 == counter.fetch_sub(1)) { delete this; } } protected: RefCounted() : counter(1) { } private: std::atomic counter; }; } #endif // REF_COUNTED_H_ platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/CMakeLists.txt0000644000015600001650000000012612654347715031430 0ustar pbuserpbgroup00000000000000add_subdirectory(sensors) add_subdirectory(location) add_subdirectory(url_dispatcher) platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/sensors/0000755000015600001650000000000012654350173030355 5ustar pbuserpbgroup00000000000000././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/sensors/usensord_service.hplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/sensors/usensord_service0000644000015600001650000000406112654347715033673 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Author: Ricardo Mendoza */ #include #include #include namespace ubuntu { namespace application { namespace sensors { struct USensorD { static const std::string& name() { static std::string s = "com.canonical.usensord"; return s; } struct Haptic { static const std::string& name() { static std::string s = "com.canonical.usensord.haptic"; return s; } struct Vibrate { static const std::string& name() { static std::string s = "Vibrate"; return s; } static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; } typedef Haptic Interface; typedef void ResultType; typedef std::uint32_t ArgumentType; }; struct VibratePattern { static const std::string& name() { static std::string s = "VibratePattern"; return s; } static const std::chrono::milliseconds default_timeout() { return std::chrono::seconds{1}; } typedef Haptic Interface; typedef void ResultType; typedef std::tuple, std::uint32_t> ArgumentType; }; }; }; } } } platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/sensors/sensors_p.h0000644000015600001650000000301212654347715032545 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2014 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Author: Ricardo Mendoza */ #include #include #include #include #include #include #include #include #include #include #include namespace dbus = core::dbus; struct UbuntuApplicationSensorsHaptic { UbuntuApplicationSensorsHaptic(std::shared_ptr session) : enabled(false), session(session) { } ~UbuntuApplicationSensorsHaptic() { bus->stop(); if (bus_thread.joinable()) bus_thread.join(); } bool enabled; std::shared_ptr session; std::thread bus_thread; std::shared_ptr bus; }; platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/sensors/CMakeLists.txt0000644000015600001650000000056512654347715033133 0ustar pbuserpbgroup00000000000000find_package(PkgConfig) find_package(Threads) pkg_check_modules(DBUS_CPP REQUIRED dbus-cpp) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC -pthread") include_directories( ${DBUS_CPP_INCLUDE_DIRS} ) add_library( ubuntu_application_sensors_haptic service.cpp ) target_link_libraries( ubuntu_application_sensors_haptic ${DBUS_CPP_LIBRARIES} ) platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/application/sensors/service.cpp0000644000015600001650000000624712654347715032542 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Author: Ricardo Mendoza */ #include "ubuntu/application/sensors/haptic.h" #include "usensord_service.h" #include "sensors_p.h" #include namespace dbus = core::dbus; namespace uas = ubuntu::application::sensors; UASensorsHaptic* ua_sensors_haptic_new() { auto bus = std::shared_ptr(new dbus::Bus(core::dbus::WellKnownBus::session)); bus->install_executor(dbus::asio::make_executor(bus)); auto stub_service = dbus::Service::use_service(bus, dbus::traits::Service::interface_name()); auto stub = stub_service->object_for_path(dbus::types::ObjectPath("/com/canonical/usensord/haptic")); auto s = new UbuntuApplicationSensorsHaptic(stub); s->bus_thread = std::thread{[bus](){ bus->run(); }}; s->bus = bus; return s; } void ua_sensors_haptic_destroy(UASensorsHaptic* sensor) { auto s = static_cast(sensor); delete s; } UStatus ua_sensors_haptic_enable(UASensorsHaptic* sensor) { auto s = static_cast(sensor); s->enabled = true; return U_STATUS_SUCCESS; } UStatus ua_sensors_haptic_disable(UASensorsHaptic* sensor) { auto s = static_cast(sensor); s->enabled = false; return U_STATUS_SUCCESS; } UStatus ua_sensors_haptic_vibrate_once( UASensorsHaptic* sensor, uint32_t duration) { if (sensor == nullptr) return U_STATUS_ERROR; auto s = static_cast(sensor); if (s->enabled == false) return U_STATUS_ERROR; try { s->session->invoke_method_synchronously(duration); } catch (const std::runtime_error& e) { std::cout << e.what() << std::endl; return U_STATUS_ERROR; } return U_STATUS_SUCCESS; } UStatus ua_sensors_haptic_vibrate_with_pattern( UASensorsHaptic* sensor, uint32_t pattern[MAX_PATTERN_SIZE], uint32_t repeat) { if (sensor == nullptr) return U_STATUS_ERROR; auto s = static_cast(sensor); if (s->enabled == false) return U_STATUS_ERROR; std::vector p_arg (pattern, pattern + MAX_PATTERN_SIZE); try { s->session->invoke_method_synchronously(p_arg, repeat); } catch (const std::runtime_error& e) { std::cout << e.what() << std::endl; return U_STATUS_ERROR; } return U_STATUS_SUCCESS; } platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/0000755000015600001650000000000012654350173026344 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/application_id_mir.cpp0000644000015600001650000000305512654347715032711 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Robert Carr */ #include "application_id_mir_priv.h" namespace uam = ubuntu::application::mir; uam::Id::Id(const char *name, size_t size) : name(name, size) { } UApplicationId* uam::Id::as_u_application_id() { return static_cast(this); } uam::Id* uam::Id::from_u_application_id(UApplicationId *id) { return static_cast(id); } UApplicationId* u_application_id_new_from_stringn(const char *string, size_t size) { auto id = new uam::Id(string, size); return id->as_u_application_id(); } void u_application_id_destroy(UApplicationId *u_id) { auto id = uam::Id::from_u_application_id(u_id); delete id; } int u_application_id_compare(UApplicationId* u_lhs, UApplicationId* u_rhs) { auto lhs = uam::Id::from_u_application_id(u_lhs); auto rhs = uam::Id::from_u_application_id(u_rhs); return lhs->name.compare(rhs->name); } ././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/application_options_mir.cppplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/application_options_mir.cp0000644000015600001650000001043712654347715033632 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Robert Carr */ #include "application_options_mir_priv.h" #include #include #include #include #include #include #include #include #include namespace uam = ubuntu::application::mir; UApplicationOptions* uam::Options::as_u_application_options() { return static_cast(this); } uam::Options* uam::Options::from_u_application_options(UApplicationOptions* options) { return static_cast(options); } namespace { void print_help_and_exit() { printf("Usage: executable " "[--desktop_file_hint=absolute_path_to_desktop_file]\n"); exit(EXIT_SUCCESS); } } extern "C" { UApplicationOptions* u_application_options_new_from_cmd_line(int argc, char** argv) { static const int uninteresting_flag_value = 0; static struct option long_options[] = { {"desktop_file_hint", required_argument, NULL, uninteresting_flag_value}, {"help", no_argument, NULL, uninteresting_flag_value}, {0, 0, 0, 0} }; static const int desktop_file_hint_index = 2; static const int help_index = 3; auto app_options = new uam::Options; // Construct legacy desktop file path std::string desktop_file_name; if (getenv("APP_ID")) { desktop_file_name = getenv("APP_ID"); desktop_file_name.append(".desktop"); } // Click desktop path std::string local_path; if (getenv("APP_DESKTOP_FILE_PATH")) local_path = getenv("APP_DESKTOP_FILE_PATH");; std::ifstream infile; std::string search_paths[2] = {"/usr/share/applications/", local_path}; search_paths[0].append(desktop_file_name); std::string line; for (std::string path : search_paths) { if (path.empty()) continue; infile.open(path); if (!infile) continue; std::getline(infile, line); while (std::getline(infile, line)) { if (infile.eof()) break; // Check for non key-value line if (line.find("=") == std::string::npos) continue; std::string lhs = line.substr(0,line.find("=")); std::string rhs = line.substr(line.find("=")); } } while(true) { int option_index = 0; int c = getopt_long(argc, argv, "", long_options, &option_index); if (c == -1) break; switch (c) { case 0: // If this option set a flag, do nothing else now. if (long_options[option_index].flag != 0) break; if (option_index == help_index) print_help_and_exit(); if (optarg) { switch(option_index) { case desktop_file_hint_index: app_options->desktop_file = std::string(optarg); break; } } break; case '?': break; } } return app_options->as_u_application_options(); } void u_application_options_destroy(UApplicationOptions* u_options) { auto options = uam::Options::from_u_application_options(u_options); delete options; } UApplicationOperationMode u_application_options_get_operation_mode(UApplicationOptions *u_options) { auto options = uam::Options::from_u_application_options(u_options); return options->operation_mode; } } platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/lifecycle_delegate_mir.cpp0000644000015600001650000000723412654347715033526 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Robert Carr */ #include "lifecycle_delegate_mir_priv.h" namespace uam = ubuntu::application::mir; uam::LifecycleDelegate::LifecycleDelegate() : resumed_cb(nullptr), stop_cb(nullptr), ctx(nullptr) { } UApplicationLifecycleDelegate* uam::LifecycleDelegate::as_u_lifecycle_delegate() { return static_cast(this); } uam::LifecycleDelegate* uam::LifecycleDelegate::from_u_lifecycle_delegate(UApplicationLifecycleDelegate *u_delegate) { return static_cast(u_delegate); } void uam::LifecycleDelegate::ref() { ref_count++; } void uam::LifecycleDelegate::unref() { ref_count--; if (ref_count == 0) delete this; } extern "C" { UApplicationLifecycleDelegate* u_application_lifecycle_delegate_new() { return (new uam::LifecycleDelegate)->as_u_lifecycle_delegate(); } void u_application_lifecycle_delegate_destroy(UApplicationLifecycleDelegate *u_delegate) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); // TODO: What are the intended semantics of this? delegate->unref(); } void u_application_lifecycle_delegate_ref(UApplicationLifecycleDelegate *u_delegate) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); delegate->ref(); } void u_application_lifecycle_delegate_unref(UApplicationLifecycleDelegate *u_delegate) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); delegate->unref(); } void u_application_lifecycle_delegate_set_application_resumed_cb(UApplicationLifecycleDelegate *u_delegate, u_on_application_resumed cb) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); delegate->resumed_cb = cb; } u_on_application_resumed u_application_lifecycle_delegate_get_application_resumed_cb(UApplicationLifecycleDelegate *u_delegate) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); return delegate->resumed_cb; } void u_application_lifecycle_delegate_set_application_about_to_stop_cb(UApplicationLifecycleDelegate *u_delegate, u_on_application_about_to_stop cb) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); delegate->stop_cb = cb; } u_on_application_about_to_stop u_application_lifecycle_delegate_get_application_about_to_stop_cb(UApplicationLifecycleDelegate *u_delegate) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); return delegate->stop_cb; } void u_application_lifecycle_delegate_set_context(UApplicationLifecycleDelegate *u_delegate, void *context) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); delegate->ctx = context; } void* u_application_lifecycle_delegate_get_context(UApplicationLifecycleDelegate *u_delegate, void *context) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); return delegate->ctx; } } ././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/application_description_mir.cppplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/application_description_mi0000644000015600001650000000615712654347715033703 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Robert Carr */ #include "application_description_mir_priv.h" namespace uam = ubuntu::application::mir; uam::Description::Description() : application_id(nullptr), lifecycle_delegate(nullptr) { } UApplicationDescription* uam::Description::as_u_application_description() { return static_cast(this); } uam::Description* uam::Description::from_u_application_description(UApplicationDescription* description) { return static_cast(description); } UApplicationDescription* u_application_description_new() { auto description = new uam::Description(); return description->as_u_application_description(); } void u_application_description_destroy(UApplicationDescription *u_description) { auto description = uam::Description::from_u_application_description(u_description); delete description; } void u_application_description_set_application_id(UApplicationDescription *u_description, UApplicationId *id) { auto description = uam::Description::from_u_application_description(u_description); description->application_id = std::unique_ptr>(id, [](UApplicationId *p) { u_application_id_destroy(p); }); } UApplicationId* u_application_description_get_application_id(UApplicationDescription *u_description) { auto description = uam::Description::from_u_application_description(u_description); return description->application_id.get(); } void u_application_description_set_application_lifecycle_delegate(UApplicationDescription *u_description, UApplicationLifecycleDelegate *lifecycle_delegate) { auto description = uam::Description::from_u_application_description(u_description); // TODO: We don't take a ref as it is created with a floating ref but this should be made more explicit... description->lifecycle_delegate = std::unique_ptr>(lifecycle_delegate, [](UApplicationLifecycleDelegate *p) { u_application_lifecycle_delegate_unref(p); }); } UApplicationLifecycleDelegate* u_application_description_get_application_lifecycle_delegate(UApplicationDescription *u_description) { auto description = uam::Description::from_u_application_description(u_description); return description->lifecycle_delegate.get(); } ././@LongLink0000000000000000000000000000016000000000000011212 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/application_instance_mirclient_priv.hplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/application_instance_mircl0000644000015600001650000000324012654347715033653 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_APPLICATION_INSTANCE_MIRCLIENT_PRIV_H_ #define UBUNTU_APPLICATION_INSTANCE_MIRCLIENT_PRIV_H_ #include #include #include #include namespace ubuntu { namespace application { namespace mir { namespace client { class Instance { public: Instance(); ~Instance() = default; UApplicationInstance* as_u_application_instance(); static Instance* from_u_application_instance(UApplicationInstance* u_instance); void ref(); void unref(); MirConnection* connection() const; bool connect(std::string const& application_name); protected: Instance(Instance const&) = delete; Instance& operator=(Instance const&) = delete; private: typedef std::unique_ptr> ConnectionPtr; ConnectionPtr con; int ref_count; }; } } } } // namespace ubuntu #endif // UBUNTU_APPLICATION_INSTANCE_MIRCLIENT_PRIV_H_ ././@LongLink0000000000000000000000000000015700000000000011220 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/ubuntu_application_api_mirclient.cppplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/ubuntu_application_api_mir0000644000015600001650000000672012654347715033711 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Robert Carr */ #include "application_instance_mirclient_priv.h" #include "lifecycle_delegate_mir_priv.h" #include "application_id_mir_priv.h" #include #include #include #include #include #include #include #include namespace uam = ubuntu::application::mir; namespace uamc = uam::client; namespace { static void dispatch_callback(MirConnection* conn, MirLifecycleState state, void* context) { auto delegate = static_cast(context); void* c_ctx = u_application_lifecycle_delegate_get_context(delegate->as_u_lifecycle_delegate(), nullptr); switch (state) { case mir_lifecycle_state_will_suspend: { if (delegate->stop_cb) delegate->stop_cb(nullptr, c_ctx); break; } case mir_lifecycle_state_resumed: { if (delegate->resumed_cb) delegate->resumed_cb(nullptr, c_ctx); break; } default: break; } } }; extern "C" { void u_application_init(void *args) { (void) args; } void u_application_finish() { } UApplicationInstance* u_application_instance_new_from_description_with_options(UApplicationDescription* description, UApplicationOptions* options) { auto instance = new uamc::Instance(); auto id = uam::Id::from_u_application_id(u_application_description_get_application_id(description)); auto connect_succeeded = instance->connect(id->name); if (!connect_succeeded) return nullptr; auto delegate = u_application_description_get_application_lifecycle_delegate(description); mir_connection_set_lifecycle_event_callback(instance->connection(), &dispatch_callback, delegate); return instance->as_u_application_instance(); } void u_application_instance_ref(UApplicationInstance *u_instance) { auto instance = uamc::Instance::from_u_application_instance(u_instance); instance->ref(); } void u_application_instance_unref(UApplicationInstance *u_instance) { auto instance = uamc::Instance::from_u_application_instance(u_instance); instance->unref(); } void u_application_instance_destroy(UApplicationInstance *u_instance) { // TODO: What are the proper semantics here. u_application_instance_unref(u_instance); } void u_application_instance_run(UApplicationInstance *instance) { // TODO: What is this supposed to do? Seems to be no-op on hybris. (void) instance; } MirConnection* u_application_instance_get_mir_connection(UApplicationInstance *u_instance) { auto instance = uamc::Instance::from_u_application_instance(u_instance); return instance->connection(); } } ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/application_options_mir_priv.hplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/application_options_mir_pr0000644000015600001650000000262412654347715033731 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_APPLICATION_OPTIONS_MIR_PRIV_H_ #define UBUNTU_APPLICATION_OPTIONS_MIR_PRIV_H_ #include #include namespace ubuntu { namespace application { namespace mir { class Options { public: Options() = default; ~Options() = default; UApplicationOptions* as_u_application_options(); static Options* from_u_application_options(UApplicationOptions* u_options); UApplicationOperationMode operation_mode = U_APPLICATION_FOREGROUND_APP; std::string desktop_file; protected: Options(Options const&) = delete; Options& operator=(Options const&) = delete; }; } } } // namespace ubuntu #endif // UBUNTU_APPLICATION_OPTIONS_MIR_PRIV_H_ ././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/application_instance_mirclient.cppplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/application_instance_mircl0000644000015600001650000000350412654347715033656 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Robert Carr */ #include "application_instance_mirclient_priv.h" namespace uamc = ubuntu::application::mir::client; uamc::Instance::Instance() : con(nullptr), ref_count(1) { } UApplicationInstance* uamc::Instance::as_u_application_instance() { return static_cast(this); } uamc::Instance* uamc::Instance::from_u_application_instance(UApplicationInstance* u_instance) { return static_cast(u_instance); } void uamc::Instance::ref() { ref_count++; } void uamc::Instance::unref() { ref_count--; if (ref_count == 0) delete this; } MirConnection* uamc::Instance::connection() const { return con.get(); } bool uamc::Instance::connect(std::string const& application_name) { auto mir_connection = mir_connect_sync(NULL, application_name.c_str()); // mir_connect_sync() always returns a connection object, even in case // of a failed connection. We need to release this object in all cases. con = ConnectionPtr(mir_connection, [](MirConnection *c) { mir_connection_release(c); }); return mir_connection_is_valid(mir_connection); } platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/application_id_mir_priv.h0000644000015600001650000000237412654347715033421 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_APPLICATION_ID_MIR_PRIV_H_ #define UBUNTU_APPLICATION_ID_MIR_PRIV_H_ #include #include namespace ubuntu { namespace application { namespace mir { class Id { public: Id(const char *name, size_t size); ~Id() = default; UApplicationId* as_u_application_id(); static Id* from_u_application_id(UApplicationId* id); std::string const name; protected: Id(const Id&) = delete; Id& operator=(const Id&) = delete; }; } } } // namespace ubuntu #endif // UBUNTU_APPLICATION_ID_MIR_PRIV_H_ platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/CMakeLists.txt0000644000015600001650000000106412654347715031115 0ustar pbuserpbgroup00000000000000set(SOURCES ubuntu_application_api_mirclient.cpp application_instance_mirclient.cpp application_id_mir.cpp application_options_mir.cpp application_description_mir.cpp lifecycle_delegate_mir.cpp ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") include_directories( ${CMAKE_BINARY_DIR}/include ${MIRCLIENT_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} ) add_library( ubuntu_application_api_mirclient STATIC ${SOURCES} ) target_link_libraries( ubuntu_application_api_mirclient ${MIRCLIENT_LDFLAGS} ${MIRCLIENT_LIBRARIES} ) ././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/lifecycle_delegate_mir_priv.hplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/lifecycle_delegate_mir_pri0000644000015600001650000000311512654347715033611 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_APPLICATION_LIECYCLE_DELEGATE_MIR_PRIV_H_ #define UBUNTU_APPLICATION_LIECYCLE_DELEGATE_MIR_PRIV_H_ #include "mir_toolkit/common.h" #include namespace ubuntu { namespace application { namespace mir { class LifecycleDelegate { public: LifecycleDelegate(); ~LifecycleDelegate() = default; UApplicationLifecycleDelegate* as_u_lifecycle_delegate(); static LifecycleDelegate* from_u_lifecycle_delegate(UApplicationLifecycleDelegate *u_delegate); void ref(); void unref(); u_on_application_resumed resumed_cb; u_on_application_about_to_stop stop_cb; void *ctx; protected: LifecycleDelegate(LifecycleDelegate const&) = delete; LifecycleDelegate& operator=(LifecycleDelegate const&) = delete; private: unsigned int ref_count; }; } } } #endif // UBUNTU_APPLICATION_LIECYCLE_DELEGATE_MIR_PRIV_H_ ././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/application_description_mir_priv.hplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/mirclient/application_description_mi0000644000015600001650000000316412654347715033676 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_APPLICATION_DESCRIPTION_MIR_PRIV_H_ #define UBUNTU_APPLICATION_DESCRIPTION_MIR_PRIV_H_ #include #include #include namespace ubuntu { namespace application { namespace mir { class Description { public: Description(); ~Description() = default; UApplicationDescription* as_u_application_description(); static Description* from_u_application_description(UApplicationDescription* u_description); // TODO Do we really own these? std::unique_ptr> application_id; std::unique_ptr> lifecycle_delegate; protected: Description(Description const&) = delete; Description& operator=(Description const&) = delete; }; } } } // namespace ubuntu #endif // UBUNTU_APPLICATION_DESCRIPTION_MIR_PRIV_H_ platform-api-3.0.1+16.04.20160203/src/ubuntu/application/common/CMakeLists.txt0000644000015600001650000000016012654347715027123 0ustar pbuserpbgroup00000000000000include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) add_subdirectory(application) add_subdirectory(mirclient) platform-api-3.0.1+16.04.20160203/src/ubuntu/application/CMakeLists.txt0000644000015600001650000000153212654347715025637 0ustar pbuserpbgroup00000000000000set( UBUNTU_APPLICATION_API_LINK_LIBRARIES ubuntu_application_sensors_haptic ubuntu_application_location ubuntu_application_url_dispatcher ) include_directories( ${CMAKE_BINARY_DIR}/include ) include_directories(../../bridge) add_subdirectory(common) add_subdirectory(desktop) add_subdirectory(touch) add_subdirectory(testbackend) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") add_library( ubuntu_application_api SHARED ubuntu_application_api.cpp ) target_link_libraries( ubuntu_application_api dl ) set_target_properties( ubuntu_application_api PROPERTIES VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH} SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR} ) install( TARGETS ubuntu_application_api ${INSTALL_TARGETS_DEFAULT_ARGS} ) platform-api-3.0.1+16.04.20160203/src/ubuntu/application/desktop/0000755000015600001650000000000012654350173024537 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/desktop/module_version.h0000644000015600001650000000014012654347715027745 0ustar pbuserpbgroup00000000000000#define MODULE_VERSION_MAJOR 3 #define MODULE_VERSION_MINOR 0 #define MODULE_VERSION_PATCH 0 ././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/application/desktop/ubuntu_application_sensors_desktop.cppplatform-api-3.0.1+16.04.20160203/src/ubuntu/application/desktop/ubuntu_application_sensors_desktop.0000644000015600001650000001613712654347715033772 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2014 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #include #include #include #include #include // Ubuntu Application Sensors. Null desktop implementation // Acceleration Sensor UASensorsAccelerometer* ua_sensors_accelerometer_new() { return NULL; } UStatus ua_sensors_accelerometer_enable(UASensorsAccelerometer*) { return (UStatus) 0; } UStatus ua_sensors_accelerometer_disable(UASensorsAccelerometer*) { return (UStatus) 0; } uint32_t ua_sensors_accelerometer_get_min_delay(UASensorsAccelerometer*) { return 0; } UStatus ua_sensors_accelerometer_get_min_value(UASensorsAccelerometer*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_accelerometer_get_max_value(UASensorsAccelerometer*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_accelerometer_get_resolution(UASensorsAccelerometer*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_accelerometer_set_event_rate(UASensorsAccelerometer* s, uint32_t rate) { return U_STATUS_SUCCESS; } void ua_sensors_accelerometer_set_reading_cb(UASensorsAccelerometer*, on_accelerometer_event_cb, void*) { } // Acceleration Sensor Event uint64_t uas_accelerometer_event_get_timestamp(UASAccelerometerEvent*) { return 0; } UStatus uas_accelerometer_event_get_acceleration_x(UASAccelerometerEvent*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus uas_accelerometer_event_get_acceleration_y(UASAccelerometerEvent*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus uas_accelerometer_event_get_acceleration_z(UASAccelerometerEvent*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } // Proximity Sensor UASensorsProximity* ua_sensors_proximity_new() { return NULL; } UStatus ua_sensors_proximity_enable(UASensorsProximity*) { return (UStatus) 0; } UStatus ua_sensors_proximity_disable(UASensorsProximity*) { return (UStatus) 0; } uint32_t ua_sensors_proximity_get_min_delay(UASensorsProximity*) { return 0; } UStatus ua_sensors_proximity_get_min_value(UASensorsProximity*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_proximity_get_max_value(UASensorsProximity*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_proximity_get_resolution(UASensorsProximity*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_proximity_set_event_rate(UASensorsProximity* s, uint32_t rate) { return U_STATUS_SUCCESS; } void ua_sensors_proximity_set_reading_cb(UASensorsProximity*, on_proximity_event_cb, void*) { } // Proximity Sensor Event uint64_t uas_proximity_event_get_timestamp(UASProximityEvent*) { return 0; } UASProximityDistance uas_proximity_event_get_distance(UASProximityEvent*) { return (UASProximityDistance) 0; } // Ambient Light Sensor UASensorsLight* ua_sensors_light_new() { return NULL; } UStatus ua_sensors_light_enable(UASensorsLight*) { return (UStatus) 0; } UStatus ua_sensors_light_disable(UASensorsLight*) { return (UStatus) 0; } uint32_t ua_sensors_light_get_min_delay(UASensorsLight*) { return 0; } UStatus ua_sensors_light_get_min_value(UASensorsLight*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_light_get_max_value(UASensorsLight*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_light_get_resolution(UASensorsLight*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_light_set_event_rate(UASensorsLight* s, uint32_t rate) { return U_STATUS_SUCCESS; } void ua_sensors_light_set_reading_cb(UASensorsLight*, on_light_event_cb, void*) { } // Ambient Light Sensor Event uint64_t uas_light_event_get_timestamp(UASLightEvent*) { return 0; } UStatus uas_light_event_get_light(UASLightEvent*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } // Orientation Sensor UASensorsOrientation* ua_sensors_orientation_new() { return NULL; } UStatus ua_sensors_orientation_enable(UASensorsOrientation*) { return (UStatus) 0; } UStatus ua_sensors_orientation_disable(UASensorsOrientation*) { return (UStatus) 0; } uint32_t ua_sensors_orientation_get_min_delay(UASensorsOrientation*) { return 0; } UStatus ua_sensors_orientation_get_min_value(UASensorsOrientation*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_orientation_get_max_value(UASensorsOrientation*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_orientation_get_resolution(UASensorsOrientation*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus ua_sensors_orientation_set_event_rate(UASensorsOrientation* s, uint32_t rate) { return U_STATUS_SUCCESS; } void ua_sensors_orientation_set_reading_cb(UASensorsOrientation*, on_orientation_event_cb, void*) { } // Orientation Sensor Event uint64_t uas_orientation_event_get_timestamp(UASOrientationEvent*) { return 0; } UStatus uas_orientation_event_get_azimuth(UASOrientationEvent*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus uas_orientation_event_get_pitch(UASOrientationEvent*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } UStatus uas_orientation_event_get_roll(UASOrientationEvent*, float* value) { if (!value) return U_STATUS_ERROR; *value = 0.f; return U_STATUS_SUCCESS; } platform-api-3.0.1+16.04.20160203/src/ubuntu/application/desktop/CMakeLists.txt0000644000015600001650000000161112654347715027306 0ustar pbuserpbgroup00000000000000set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11") add_library( ubuntu_application_api_desktop_mirclient MODULE module.cpp module_version.h ubuntu_application_sensors_desktop.cpp ) target_link_libraries( ubuntu_application_api_desktop_mirclient "-Wl,--whole-archive" ubuntu_application_api_mirclient ${UBUNTU_APPLICATION_API_LINK_LIBRARIES} "-Wl,--no-whole-archive" #TODO: Alarms ) set_target_properties( ubuntu_application_api_desktop_mirclient PROPERTIES VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH} SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR} ) install( TARGETS ubuntu_application_api_desktop_mirclient # this is not a development library to compile against, users should always # specify the SONAME; so don't build a *.so LIBRARY DESTINATION "${LIB_INSTALL_DIR}" NAMELINK_SKIP ) platform-api-3.0.1+16.04.20160203/src/ubuntu/application/desktop/module.cpp0000644000015600001650000000176212654347715026546 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2014 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #include #include "module_version.h" void u_application_module_version(uint32_t *major, uint32_t *minor, uint32_t *patch) { *major = (uint32_t) MODULE_VERSION_MAJOR; *minor = (uint32_t) MODULE_VERSION_MINOR; *patch = (uint32_t) MODULE_VERSION_PATCH; } platform-api-3.0.1+16.04.20160203/src/ubuntu/hardware/0000755000015600001650000000000012654350173022360 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/hardware/alarms/0000755000015600001650000000000012654350173023637 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/hardware/alarms/alarm.cpp0000644000015600001650000001674712654347715025466 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #include #include #include #include #include #include #include #include #include #include #include #include namespace { struct HardwareAlarm { HardwareAlarm() = default; virtual ~HardwareAlarm() = default; // Blocks the calling thread until an alarm fires or // an error occurs. Returns an int with bool semantics. virtual int wait_for() = 0; // Arms the alarm with the given properties. // Returns true if the alarm has been armed successfully, false otherwise. virtual bool set( UHardwareAlarmTimeReference time_reference, UHardwareAlarmSleepBehavior behavior, const struct timespec *ts) = 0; // Queries the time since last boot including deep sleep periods. virtual bool get_elapsed_realtime(struct timespec* ts) = 0; }; // An implementation of HardwareAlarm based on Android's /dev/alarm. struct DevAlarmHardwareAlarm : public HardwareAlarm { int fd; // file descriptor referring to /dev/alarm DevAlarmHardwareAlarm() : fd(open("/dev/alarm", O_RDWR)) { if (fd == -1) { auto error = errno; std::string what { "Could not open /dev/alarm: " }; throw std::runtime_error { (what + strerror(error)).c_str() }; } } ~DevAlarmHardwareAlarm() { // No need to check if fd is valid here. // Ctor would have thrown if fd was invalid. ::close(fd); } int wait_for() { int result{-1}; do { result = ::ioctl(fd, ANDROID_ALARM_WAIT); } while (result < 0 && errno == EINTR); if (result < 0) fprintf(stderr, "Waiting for hw alarm failed with: %s\n", strerror(errno)); return result; } bool set(UHardwareAlarmTimeReference time_reference, UHardwareAlarmSleepBehavior behavior, const struct timespec *ts) { if (not ts) return false; int type = 0; if (time_reference == U_HARDWARE_ALARM_TIME_REFERENCE_BOOT) switch(behavior) { case U_HARDWARE_ALARM_SLEEP_BEHAVIOR_WAKEUP_DEVICE: type = ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP; break; case U_HARDWARE_ALARM_SLEEP_BEHAVIOR_KEEP_DEVICE_ASLEEP: type = ANDROID_ALARM_ELAPSED_REALTIME; break; } else if (time_reference == U_HARDWARE_ALARM_TIME_REFERENCE_RTC) switch(behavior) { case U_HARDWARE_ALARM_SLEEP_BEHAVIOR_WAKEUP_DEVICE: type = ANDROID_ALARM_RTC_WAKEUP; break; case U_HARDWARE_ALARM_SLEEP_BEHAVIOR_KEEP_DEVICE_ASLEEP: type = ANDROID_ALARM_RTC; break; } int result = ::ioctl(fd, ANDROID_ALARM_SET(type), ts); if (result < 0) fprintf(stderr, "Unable to set alarm: %s\n", strerror(errno)); return not (result < 0); } bool get_elapsed_realtime(struct timespec* ts) { if (not ts) return false; int result = ::ioctl( fd, ANDROID_ALARM_GET_TIME(ANDROID_ALARM_ELAPSED_REALTIME), ts); return result == 0; } }; } class UbuntuHardwareAlarm { public: static UbuntuHardwareAlarm& instance() { static UbuntuHardwareAlarm ha; return ha; } int wait_for() { return impl->wait_for(); } bool set(UHardwareAlarmTimeReference time_reference, UHardwareAlarmSleepBehavior behavior, const struct timespec *ts) { return impl->set(time_reference, behavior, ts); } bool get_elapsed_realtime(struct timespec* ts) { return impl->get_elapsed_realtime(ts); } bool is_valid() const { return impl != nullptr; } private: UbuntuHardwareAlarm() { try { impl = new DevAlarmHardwareAlarm(); } catch(const std::runtime_error& e) { fprintf( stderr, "%s: Error creating /dev/alarm-based implementation with: %s\n", __PRETTY_FUNCTION__, e.what()); // TODO: Should we fallback to a timer-fd implementation here? I'm not // convinced that we should do so as a timer-fd wouldn't wakeup the device // from any sort of sleep mode. } } ~UbuntuHardwareAlarm() { delete impl; } HardwareAlarm* impl { nullptr }; }; UHardwareAlarm u_hardware_alarm_create() { auto result = &UbuntuHardwareAlarm::instance(); if (result) if (result->is_valid()) return result; return NULL; } void u_hardware_alarm_ref( UHardwareAlarm alarm) { // Considering a singleton pattern here, just voiding the argument. (void) alarm; } void u_hardware_alarm_unref( UHardwareAlarm alarm) { // Considering a singleton pattern here, just voiding the argument. (void) alarm; } UStatus u_hardware_alarm_get_elapsed_real_time( UHardwareAlarm alarm, struct timespec* ts) { return alarm->get_elapsed_realtime(ts) ? U_STATUS_SUCCESS : U_STATUS_ERROR; } UStatus u_hardware_alarm_set_timezone( UHardwareAlarm alarm, const struct timezone *tz) { int result = settimeofday(NULL, tz); if (result < 0) return U_STATUS_ERROR; return U_STATUS_SUCCESS; } UStatus u_hardware_alarm_set_relative_to_with_behavior( UHardwareAlarm alarm, UHardwareAlarmTimeReference time_reference, UHardwareAlarmSleepBehavior behavior, const struct timespec *ts) { return alarm->set(time_reference, behavior, ts) ? U_STATUS_SUCCESS : U_STATUS_ERROR; } UStatus u_hardware_alarm_wait_for_next_alarm( UHardwareAlarm alarm, UHardwareAlarmWaitResult *result) { int rc = alarm->wait_for(); if (rc < 0) return U_STATUS_ERROR; if ((rc & ANDROID_ALARM_RTC_MASK) || (rc & ANDROID_ALARM_RTC_WAKEUP_MASK)) result->reference = U_HARDWARE_ALARM_TIME_REFERENCE_BOOT; else if ((rc & ANDROID_ALARM_ELAPSED_REALTIME_MASK) || (rc & ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP_MASK)) result->reference = U_HARDWARE_ALARM_TIME_REFERENCE_RTC; if ((rc & ANDROID_ALARM_RTC_WAKEUP_MASK) || (rc & ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP_MASK)) result->sleep_behavior = U_HARDWARE_ALARM_SLEEP_BEHAVIOR_WAKEUP_DEVICE; else result->sleep_behavior = U_HARDWARE_ALARM_SLEEP_BEHAVIOR_KEEP_DEVICE_ASLEEP; return U_STATUS_SUCCESS; } platform-api-3.0.1+16.04.20160203/src/ubuntu/hardware/alarms/CMakeLists.txt0000644000015600001650000000023312654347715026405 0ustar pbuserpbgroup00000000000000set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") include_directories(/usr/include/android) add_library( ubuntu_hardware_alarm alarm.cpp )platform-api-3.0.1+16.04.20160203/src/ubuntu/hardware/tests/0000755000015600001650000000000012654350173023522 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/src/ubuntu/hardware/tests/test_alarms_api.cpp0000644000015600001650000000320612654347715027406 0ustar pbuserpbgroup00000000000000/* * Copyright © 2014 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #include #include #include int main(int argc, char** argv) { UHardwareAlarm alarm = u_hardware_alarm_create(); if (!alarm) { printf("Error creating handle to hardware alarms.\n"); return 1; } // Alarm in two seconds. timespec ts { 2, 0 }; UStatus rc = u_hardware_alarm_set_relative_to_with_behavior( alarm, U_HARDWARE_ALARM_TIME_REFERENCE_RTC, U_HARDWARE_ALARM_SLEEP_BEHAVIOR_WAKEUP_DEVICE, &ts); if (rc != U_STATUS_SUCCESS) { printf("Problem setting hardware alarm.\n"); return 1; } UHardwareAlarmWaitResult wait_result; rc = u_hardware_alarm_wait_for_next_alarm(alarm, &wait_result); if (rc != U_STATUS_SUCCESS) { printf("Problem waiting for hardware alarm to go off.\n"); return 1; } printf("Successfully created and waited for a hw alarm.\n"); return 0; } platform-api-3.0.1+16.04.20160203/src/ubuntu/hardware/tests/test_booster_api.cpp0000644000015600001650000000313612654347724027606 0ustar pbuserpbgroup00000000000000/* * Copyright © 2016 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #include #include #include #include #include namespace { void wait_for_sigint() { sigset_t signals; sigemptyset(&signals); sigaddset(&signals, SIGINT); int sig = 0; do { if (0 != sigwait(&signals, &sig)) break; } while(sig != SIGINT); } } int main() { auto booster = u_hardware_booster_new(); if (not booster) { std::cerr << "Failed to acquire performance booster instance, aborting." << std::endl; return 1; } std::cout << "Enabling boosting, hit CTRL-C to disable ... "; { u_hardware_booster_enable_scenario(booster, U_HARDWARE_BOOSTER_SCENARIO_USER_INTERACTION); wait_for_sigint(); u_hardware_booster_disable_scenario(booster, U_HARDWARE_BOOSTER_SCENARIO_USER_INTERACTION); } std::cout << "exiting"; return 0; } platform-api-3.0.1+16.04.20160203/src/ubuntu/hardware/tests/test_gps_api.cpp0000644000015600001650000001703712654347715026727 0ustar pbuserpbgroup00000000000000/* * Copyright © 2014 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Daniel d'Andrada */ #include #include #include #include #include #include #include namespace ubuntu { class GPSTest { public: GPSTest(); ~GPSTest(); bool init_and_start(const char* server, uint16_t port); bool stop(); void inject_time(); void inject_reference_location(float lat, float lon, float accuracy); UHardwareGps u_hardware_gps; }; void gps_location_cb(UHardwareGpsLocation* location, void* context) { printf("gps_location_cb() called.\n"); } void gps_status_cb(uint16_t status, void* context) { switch(status) { case U_HARDWARE_GPS_STATUS_NONE: printf("status: None\n"); break; case U_HARDWARE_GPS_STATUS_SESSION_BEGIN: printf("status: Session Begin\n"); break; case U_HARDWARE_GPS_STATUS_SESSION_END: printf("status: Session End\n"); break; case U_HARDWARE_GPS_STATUS_ENGINE_ON: printf("status: Engine On\n"); break; case U_HARDWARE_GPS_STATUS_ENGINE_OFF: printf("status: Engine Off\n"); default: break; }; } void gps_sb_status_cb(UHardwareGpsSvStatus* sv_info, void* context) { printf("gps_sb_status_cb() called, listing %d space vehicles\n", sv_info->num_svs); } void gps_nmea_cb(int64_t timestamp, const char* nmea, int length, void* context) { char str[length+1]; memcpy(str, nmea, length); str[length] = 0; printf("gps_nmea_cb() - %s\n", str); } void gps_set_cabapilities_cb(uint32_t capabilities, void* context) { printf("gps_set_cabapilities_cb() -"); if (capabilities & U_HARDWARE_GPS_CAPABILITY_SCHEDULING) printf(" scheduling"); if (capabilities & U_HARDWARE_GPS_CAPABILITY_MSB) printf(" MSB"); if (capabilities & U_HARDWARE_GPS_CAPABILITY_MSA) printf(" MSA"); if (capabilities & U_HARDWARE_GPS_CAPABILITY_SINGLE_SHOT) printf(" 'single shot'"); if (capabilities & U_HARDWARE_GPS_CAPABILITY_ON_DEMAND_TIME) printf(" 'on demand time'"); printf("\n"); } void gps_request_utc_time_cb(void* context) { printf("gps_request_utc_time_cb() called.\n"); ((GPSTest*)context)->inject_time(); } void gps_xtra_download_request_cb(void* context) { printf("gps_xtra_download_request_cb() called.\n"); } void agps_status_cb(UHardwareGpsAGpsStatus* status, void* context) { printf("agps status -"); if (status->type == U_HARDWARE_GPS_AGPS_TYPE_SUPL) printf(" SUPL"); else printf(" C2K"); switch (status->status) { case U_HARDWARE_GPS_REQUEST_AGPS_DATA_CONN: printf(", request AGPS data connection"); break; case U_HARDWARE_GPS_RELEASE_AGPS_DATA_CONN: printf(", release AGPS data connection"); break; case U_HARDWARE_GPS_AGPS_DATA_CONNECTED: printf(", request AGPS data connected"); break; case U_HARDWARE_GPS_AGPS_DATA_CONN_DONE: printf(", AGPS data connection done"); break; default: case U_HARDWARE_GPS_AGPS_DATA_CONN_FAILED: printf(", AGPS data connection failed"); break; } printf(" ipaddr=%u\n", status->ipaddr); } void gps_notify_cb(UHardwareGpsNiNotification *notification, void* context) { printf("gps_notify_cb() called.\n"); } void agps_ril_request_set_id_cb(uint32_t flags, void* context) { printf("agps_ril_request_set_id_cb() called.\n"); } void agps_ril_request_refloc_cb(uint32_t flags, void* context) { printf("agps_ril_request_refloc_cb() called.\n"); } GPSTest::GPSTest() : u_hardware_gps(NULL) { } GPSTest::~GPSTest() { if (u_hardware_gps) u_hardware_gps_delete(u_hardware_gps); } void GPSTest::inject_time() { // A real implementation would inject time from some NTP server. time_t t = time(0); int64_t time_millis = (int64_t)t * (int64_t)1000; u_hardware_gps_inject_time(u_hardware_gps, time_millis /*NTP time would go here*/, time_millis /*internal time when that NTP time was taken*/, 10 /* possible deviation, in milliseconds*/); } void GPSTest::inject_reference_location(float lat, float lon, float accuracy) { UHardwareGpsLocation location; location.latitude = lat; location.longitude = lon; location.accuracy = accuracy; u_hardware_gps_inject_location(u_hardware_gps, location); } bool GPSTest::init_and_start(const char* supl_server, uint16_t port) { UHardwareGpsParams gps_params; gps_params.location_cb = gps_location_cb; gps_params.status_cb = gps_status_cb; gps_params.sv_status_cb = gps_sb_status_cb; gps_params.nmea_cb = gps_nmea_cb; gps_params.set_capabilities_cb = gps_set_cabapilities_cb; gps_params.request_utc_time_cb = gps_request_utc_time_cb; gps_params.xtra_download_request_cb = gps_xtra_download_request_cb; gps_params.agps_status_cb = agps_status_cb; gps_params.gps_ni_notify_cb = gps_notify_cb; gps_params.request_setid_cb = agps_ril_request_set_id_cb; gps_params.request_refloc_cb = agps_ril_request_refloc_cb; gps_params.context = this; UHardwareGps u_hardware_gps = u_hardware_gps_new(&gps_params); if (!u_hardware_gps) { printf("GPS creation failed!\n"); return false; } bool ok = u_hardware_gps_start(u_hardware_gps); if (!ok) { printf("GPS start up failed!\n"); return false; } u_hardware_gps_delete_aiding_data(u_hardware_gps, U_HARDWARE_GPS_DELETE_ALL); u_hardware_gps_agps_set_server_for_type( u_hardware_gps, U_HARDWARE_GPS_AGPS_TYPE_SUPL, supl_server, port); return true; } bool GPSTest::stop() { bool ok = u_hardware_gps_stop(u_hardware_gps); if (!ok) printf("failed when stopping GPS!\n"); return ok; } } void wait_for_sigint() { sigset_t signals; sigemptyset(&signals); sigaddset(&signals, SIGINT); int sig; int result = sigwait(&signals, &sig); if (result != 0) printf("sigwait failed!\n"); } int main(int argc, char** argv) { if (argc != 6) { printf("Usage: test_gps supl_server supl_server_port lat lon accuracy\n"); return 1; } const char* supl_server = argv[1]; uint16_t port = atoi(argv[2]); double lat = atof(argv[3]); double lon = atof(argv[4]); float accuracy = atof(argv[5]); int return_value = 0; ubuntu::GPSTest test; if (!test.init_and_start(supl_server, port)) return 1; printf("GPS initialized and started. Injecting reference location: %f %f %f.\n", lat, lon, accuracy); test.inject_reference_location(lat, lon, accuracy); printf("Now waiting for callbacks or SIGINT (to quit).\n"); wait_for_sigint(); printf("Exiting...\n"); if (!test.stop()) return 1; printf("GPS stopped.\n"); return 0; } platform-api-3.0.1+16.04.20160203/src/ubuntu/hardware/tests/CMakeLists.txt0000644000015600001650000000114312654347724026271 0ustar pbuserpbgroup00000000000000set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") include_directories( ${CMAKE_BINARY_DIR}/include ) add_executable(test_android_gps_api test_gps_api.cpp) target_link_libraries(test_android_gps_api ubuntu_platform_hardware_api) add_executable(test_hardware_alarms_api test_alarms_api.cpp) target_link_libraries(test_hardware_alarms_api ubuntu_platform_hardware_api) add_executable(test_booster_api test_booster_api.cpp) target_link_libraries(test_booster_api ubuntu_platform_hardware_api) install(TARGETS test_android_gps_api test_hardware_alarms_api test_booster_api DESTINATION bin ) platform-api-3.0.1+16.04.20160203/src/ubuntu/hardware/ubuntu_platform_hardware_api.cpp0000644000015600001650000000537212654347724031037 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss * Ricardo Mendoza */ // C APIs #include #include #include #include "android_hw_module.h" // Hardware - GPS IMPLEMENT_FUNCTION1( UHardwareGps, u_hardware_gps_new, UHardwareGpsParams*); IMPLEMENT_VOID_FUNCTION1( u_hardware_gps_delete, UHardwareGps); IMPLEMENT_FUNCTION1( bool, u_hardware_gps_start, UHardwareGps); IMPLEMENT_FUNCTION1( bool, u_hardware_gps_stop, UHardwareGps); IMPLEMENT_VOID_FUNCTION4( u_hardware_gps_inject_time, UHardwareGps, int64_t, int64_t, int); IMPLEMENT_VOID_FUNCTION2( u_hardware_gps_inject_location, UHardwareGps, UHardwareGpsLocation); IMPLEMENT_VOID_FUNCTION2( u_hardware_gps_delete_aiding_data, UHardwareGps, UHardwareGpsAidingData); IMPLEMENT_VOID_FUNCTION3( u_hardware_gps_agps_set_reference_location, UHardwareGps, UHardwareGpsAGpsRefLocation*, size_t); IMPLEMENT_VOID_FUNCTION2( u_hardware_gps_agps_notify_connection_is_open, UHardwareGps, const char *); IMPLEMENT_VOID_FUNCTION1( u_hardware_gps_agps_notify_connection_is_closed, UHardwareGps); IMPLEMENT_VOID_FUNCTION1( u_hardware_gps_agps_notify_connection_not_available, UHardwareGps); IMPLEMENT_VOID_FUNCTION4( u_hardware_gps_agps_set_server_for_type, UHardwareGps, UHardwareGpsAGpsType, const char*, uint16_t); IMPLEMENT_FUNCTION6( bool, u_hardware_gps_set_position_mode, UHardwareGps, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t); IMPLEMENT_VOID_FUNCTION3( u_hardware_gps_inject_xtra_data, UHardwareGps, char*, int); IMPLEMENT_OPTIONAL_FUNCTION0( UHardwareBooster*, u_hardware_booster_new, NULL); IMPLEMENT_OPTIONAL_VOID_FUNCTION1( u_hardware_booster_ref, UHardwareBooster*); IMPLEMENT_OPTIONAL_VOID_FUNCTION1( u_hardware_booster_unref, UHardwareBooster*); IMPLEMENT_OPTIONAL_VOID_FUNCTION2( u_hardware_booster_enable_scenario, UHardwareBooster*, UHardwareBoosterScenario); IMPLEMENT_OPTIONAL_VOID_FUNCTION2( u_hardware_booster_disable_scenario, UHardwareBooster*, UHardwareBoosterScenario); platform-api-3.0.1+16.04.20160203/src/ubuntu/hardware/CMakeLists.txt0000644000015600001650000000153112654347715025130 0ustar pbuserpbgroup00000000000000set( UBUNTU_HARDWARE_API_LINK_LIBRARIES ubuntu_hardware_alarm ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") include_directories( ${CMAKE_BINARY_DIR}/include ) include_directories(../../bridge) add_subdirectory(alarms/) add_library( ubuntu_platform_hardware_api SHARED ubuntu_platform_hardware_api.cpp ) target_link_libraries( ubuntu_platform_hardware_api "-Wl,--whole-archive" ${UBUNTU_HARDWARE_API_LINK_LIBRARIES} "-Wl,--no-whole-archive" dl ${Hybris} ) set_target_properties( ubuntu_platform_hardware_api PROPERTIES VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH} SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR} ) install( TARGETS ubuntu_platform_hardware_api ${INSTALL_TARGETS_DEFAULT_ARGS} ) add_subdirectory(tests/) platform-api-3.0.1+16.04.20160203/src/ubuntu/hardware/android_hw_module.h0000644000015600001650000000336712654347724026235 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss * Ricardo Mendoza */ #ifndef ANDROID_HW_MODULE_H_ #define ANDROID_HW_MODULE_H_ #include #ifdef __cplusplus extern "C" { #endif extern void *android_dlopen(const char *filename, int flag); extern void *android_dlsym(void *handle, const char *symbol); #ifdef __cplusplus } #endif namespace internal { struct HIDDEN_SYMBOL ToHybris { static const char* path() { static const char* cache = "/system/lib/libubuntu_application_api.so"; return cache; } static const char* override_path() { return NULL; } static void* dlopen_fn(const char* path, int flags) { return android_dlopen(path, flags); } static void* dlsym_fn(void* handle, const char* symbol) { return android_dlsym(handle, symbol); } }; } #define DLSYM(fptr, sym) if (*(fptr) == NULL) \ {\ *((void**)fptr) = (void *) internal::Bridge::instance().resolve_symbol(sym);\ } #include #endif // ANDROID_HW_MODULE_H_ platform-api-3.0.1+16.04.20160203/src/ubuntu/CMakeLists.txt0000644000015600001650000000007112654347715023331 0ustar pbuserpbgroup00000000000000add_subdirectory(application) add_subdirectory(hardware) platform-api-3.0.1+16.04.20160203/src/CMakeLists.txt0000644000015600001650000000011712654347715022010 0ustar pbuserpbgroup00000000000000include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) add_subdirectory(ubuntu) platform-api-3.0.1+16.04.20160203/COPYING0000644000015600001650000010451312654347715017521 0ustar pbuserpbgroup00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, 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 them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . platform-api-3.0.1+16.04.20160203/android/0000755000015600001650000000000012654350173020072 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/android/include/0000755000015600001650000000000012654350173021515 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/android/include/private/0000755000015600001650000000000012654350173023167 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/android/include/private/application/0000755000015600001650000000000012654350173025472 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/android/include/private/application/session_delegates.h0000644000015600001650000000261212654347715031354 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_UI_SESSION_DELEGATES_H_ #define UBUNTU_APPLICATION_UI_SESSION_DELEGATES_H_ #include #include namespace ubuntu { namespace application { class LifecycleDelegate : public platform::ReferenceCountedBase { public: typedef platform::shared_ptr Ptr; virtual void on_application_resumed() = 0; virtual void on_application_about_to_stop() = 0; protected: LifecycleDelegate() {} virtual ~LifecycleDelegate() {} LifecycleDelegate(const LifecycleDelegate&) = delete; LifecycleDelegate& operator=(const LifecycleDelegate&) = delete; }; } } #endif // UBUNTU_APPLICATION_UI_SESSION_DELEGATES_H_ platform-api-3.0.1+16.04.20160203/android/include/private/application/application.h0000644000015600001650000000517712654347715030170 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_APPLICATION_H_ #define UBUNTU_APPLICATION_APPLICATION_H_ #include namespace ubuntu { namespace application { class Instance : public ubuntu::platform::ReferenceCountedBase { public: Instance(UApplicationDescription *description, UApplicationOptions *options) : description(description), options(options) {} typedef ubuntu::platform::shared_ptr Ptr; void run() { return; } void ref() { refcount++; } void unref() { if (refcount) refcount--; } unsigned int get_refcount() { return this->refcount; } UApplicationDescription* get_description() { return this->description; } private: UApplicationDescription *description; UApplicationOptions *options; unsigned int refcount; protected: virtual ~Instance() {} Instance(const Instance&) = delete; Instance& operator=(const Instance&) = delete; }; class Description : public ubuntu::platform::ReferenceCountedBase { public: Description() : refcount(1) {} typedef ubuntu::platform::shared_ptr Ptr; void set_lifecycle_delegate(UApplicationLifecycleDelegate *delegate) { this->lifecycle_delegate = delegate; } void set_application_id(UApplicationId *id) { this->application_id = id; } UApplicationId* get_application_id() { return this->application_id; } UApplicationLifecycleDelegate* get_lifecycle_delegate() { return this->lifecycle_delegate; } unsigned int refcount; private: UApplicationId *application_id; UApplicationLifecycleDelegate *lifecycle_delegate; protected: virtual ~Description() {} Description(const Description&) = delete; Description& operator=(const Description&) = delete; }; } } #endif /* UBUNTU_APPLICATION_UI_WINDOW_INTERNAL_H_ */ platform-api-3.0.1+16.04.20160203/android/include/private/application/sensors/0000755000015600001650000000000012654350173027166 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/android/include/private/application/sensors/sensor_service.h0000644000015600001650000000272512654347715032406 0ustar pbuserpbgroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_SERVICE_H_ #define UBUNTU_APPLICATION_SENSORS_SENSOR_SERVICE_H_ #include "private/platform/shared_ptr.h" #include "private/application/sensors/sensor.h" namespace ubuntu { namespace application { namespace sensors { /** Local stub that allows for instantiating sensor instances given a type. */ class SensorService : public ubuntu::platform::ReferenceCountedBase { public: /** Returns a sensor instance for the provided type or NULL. */ static Sensor::Ptr sensor_for_type(SensorType type); protected: SensorService() {} virtual ~SensorService() {} SensorService(const SensorService&) = delete; SensorService& operator=(const SensorService&) = delete; }; } } } #endif // UBUNTU_APPLICATION_SENSORS_SENSOR_SERVICE_H_ platform-api-3.0.1+16.04.20160203/android/include/private/application/sensors/sensor_reading.h0000644000015600001650000000452112654347715032353 0ustar pbuserpbgroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_READING_H_ #define UBUNTU_APPLICATION_SENSORS_SENSOR_READING_H_ #include #include #include namespace ubuntu { namespace application { namespace sensors { /** A vector of static size. */ template struct Vector { NumericType v[size]; /** Accesses the element at index index. */ NumericType& operator[](size_t index) { return v[index]; } /** Accesses the element at index index. */ const NumericType& operator[](size_t index) const { return v[index]; } }; /** A timestamped reading from a sensor. */ struct SensorReading : public ubuntu::platform::ReferenceCountedBase { typedef ubuntu::platform::shared_ptr Ptr; SensorReading() : timestamp(-1) { } int64_t timestamp; ///< The timestamp of the reading in [ns], CLOCK_MONOTONIC. /** A union of different possible sensor readings. */ union { Vector<3> vector; ///< Arbitrary vector, orientation and linear acceleration readings are reported here. Vector<3> acceleration; ///< Acceleration vector containing acceleration readings for the three axis. Vector<3> magnetic; ///< Readings from magnetometer, in three dimensions. float temperature; ///< Ambient temperature. float distance; ///< Discrete distance, everything > 5 is considered far, everything < 5 is considered near. float light; ///< Ambient light conditions. float pressure; ///< Ambient pressure. }; }; } } } #endif // UBUNTU_APPLICATION_SENSORS_SENSOR_READING_H_ platform-api-3.0.1+16.04.20160203/android/include/private/application/sensors/events.h0000644000015600001650000000622112654347715030654 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_EVENTS_H_ #define UBUNTU_APPLICATION_SENSORS_EVENTS_H #include #include namespace ubuntu { namespace application { namespace sensors { class OrientationEvent { public: OrientationEvent(uint64_t timestamp, float azimuth, float pitch, float roll) : timestamp(timestamp), azimuth(azimuth), pitch(pitch), roll(roll) {} uint64_t get_timestamp() { return this->timestamp; } float get_azimuth() { return this->azimuth; } float get_pitch() { return this->pitch; } float get_roll() { return this->roll; } private: uint64_t timestamp; float azimuth; float pitch; float roll; protected: OrientationEvent(const OrientationEvent&) = delete; OrientationEvent& operator=(const OrientationEvent&) = delete; }; class AccelerometerEvent { public: AccelerometerEvent(uint64_t timestamp, float x, float y, float z) : timestamp(timestamp), x(x), y(y), z(z) {} uint64_t get_timestamp() { return this->timestamp; } float get_x() { return this->x; } float get_y() { return this->y; } float get_z() { return this->z; } private: uint64_t timestamp; float x; float y; float z; protected: AccelerometerEvent(const AccelerometerEvent&) = delete; AccelerometerEvent& operator=(const AccelerometerEvent&) = delete; }; class ProximityEvent { public: ProximityEvent(uint64_t timestamp, float distance) : timestamp(timestamp), distance(distance) {} uint64_t get_timestamp() { return this->timestamp; } float get_distance() { return this->distance; } private: uint64_t timestamp; float distance; protected: ProximityEvent(const ProximityEvent&) = delete; ProximityEvent& operator=(const ProximityEvent&) = delete; }; class LightEvent { public: LightEvent(uint64_t timestamp, float light) : timestamp(timestamp), light(light) {} uint64_t get_timestamp() { return this->timestamp; } float get_light() { return this->light; } private: uint64_t timestamp; float light; protected: LightEvent(const LightEvent&) = delete; LightEvent& operator=(const LightEvent&) = delete; }; } } } #endif /* UBUNTU_APPLICATION_SENSORS_EVENTS_H_ */ platform-api-3.0.1+16.04.20160203/android/include/private/application/sensors/sensor_listener.h0000644000015600001650000000313712654347715032571 0ustar pbuserpbgroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_LISTENER_H_ #define UBUNTU_APPLICATION_SENSORS_SENSOR_LISTENER_H_ #include "private/platform/shared_ptr.h" #include "private/application/sensors/sensor_reading.h" namespace ubuntu { namespace application { namespace sensors { /** Extension point to allow for observing a sensor's readings. */ class SensorListener : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; /** Invoked whenever a new reading is available from the sensor. * \param [in] reading The new reading. */ virtual void on_new_reading(const SensorReading::Ptr& reading) = 0; protected: SensorListener() {} virtual ~SensorListener() {} SensorListener(const SensorListener&) = delete; SensorListener& operator=(const SensorListener&) = delete; }; } } } #endif // UBUNTU_APPLICATION_SENSORS_SENSOR_LISTENER_H_ platform-api-3.0.1+16.04.20160203/android/include/private/application/sensors/sensor.h0000644000015600001650000000551712654347715030670 0ustar pbuserpbgroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_H_ #define UBUNTU_APPLICATION_SENSORS_SENSOR_H_ #include "private/platform/shared_ptr.h" #include "private/application/sensors/sensor_listener.h" #include "private/application/sensors/sensor_type.h" #include namespace ubuntu { namespace application { namespace sensors { /** A data acquisition device that samples a device's environment. */ class Sensor : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; /** Accesses the name of the sensor. Returned pointer is owned by the implementation. */ virtual const char* name() = 0; /** Accesses the vendor of the sensor. Returned pointer is owned by the implementation. */ virtual const char* vendor() = 0; /** Accesses the numeric id of the sensor. Should be as stable as possible. */ virtual int32_t id() = 0; /** Registers the provided listener with the sensor and integrates it with the reporting of sensor readings. */ virtual void register_listener(const SensorListener::Ptr& listener) = 0; /** Enables the sensor and starts the data acquisition. */ virtual int enable() = 0; /** Disables the sensor and stops the data acquisition. */ virtual int disable() = 0; virtual SensorType type() = 0; /** Returns the minimum numeric value of a sensor reading. */ virtual float min_value() = 0; /** Returns the maximum numeric value of a sensor reading. */ virtual float max_value() = 0; /** Returns the numerical resolution of a sensor reading. */ virtual float resolution() = 0; /** Returns an estimate of the sensor's power consumption, normalized to [0,1]. */ virtual float power_consumption() = 0; /** Set event delivery rate for the given sensor, in nanoseconds */ virtual int set_event_rate(uint32_t nsecs) = 0; /** Returns the minimum delay between two consecutive sensor readings. */ virtual int32_t min_delay() = 0; protected: Sensor() {} virtual ~Sensor() {} Sensor(const Sensor&) = delete; Sensor& operator=(const Sensor&) = delete; }; } } } #endif // UBUNTU_APPLICATION_SENSORS_SENSOR_H_ platform-api-3.0.1+16.04.20160203/android/include/private/application/sensors/sensor_type.h0000644000015600001650000000334712654347715031730 0ustar pbuserpbgroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_TYPE_H_ #define UBUNTU_APPLICATION_SENSORS_SENSOR_TYPE_H_ namespace ubuntu { namespace application { namespace sensors { /** Models a special type of a sensor */ enum SensorType { first_defined_sensor_type = 0, sensor_type_accelerometer = first_defined_sensor_type, ///< An accelerometer sensor_type_magnetic_field, ///< A magnetic field sensor, i.e., a compass sensor_type_gyroscope, ///< A gyroscope sensor_type_light, ///< An ambient light sensor sensor_type_proximity, ///< A proximity sensor, used to blank the screen when making a call sensor_type_orientation, ///< Virtual sensor, reports sensor fusion results regarding a device's orientation sensor_type_linear_acceleration, ///< Virtual sensor, reports sensor fusion results regarding a device's linear acceleration sensor_type_rotation_vector, ///< Virtual sensor, reports sensor fusion results regarding a device's rotation vector undefined_sensor_type }; } } } #endif // UBUNTU_APPLICATION_SENSORS_SENSOR_TYPE_H_ platform-api-3.0.1+16.04.20160203/android/include/private/application/session.h0000644000015600001650000000440712654347715027343 0ustar pbuserpbgroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_SESSION_H_ #define UBUNTU_APPLICATION_SESSION_H_ #include #include namespace ubuntu { namespace application { /** * Represents a session with the service providers abstracted by Ubuntu platform API. */ class Session : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; protected: Session() {} virtual ~Session() {} Session(const Session&) = delete; Session& operator=(const Session&) = delete; }; /** * Represents a session lifecycle delegate. */ class LifecycleDelegate : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; virtual void on_application_resumed() = 0; virtual void on_application_about_to_stop() = 0; protected: LifecycleDelegate() {} virtual ~LifecycleDelegate() {} LifecycleDelegate(const LifecycleDelegate&) = delete; LifecycleDelegate& operator=(const LifecycleDelegate&) = delete; }; class Id : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; Id(const char *string, size_t size) { this->size = size; this->string = (char*) malloc(sizeof (char) * (size+1)); memcpy(this->string, string, (size+1)); } ~Id() { free(this->string); } char *string; size_t size; protected: Id() {} Id(const Id&) = delete; Id& operator=(const Id&) = delete; }; } } #endif // UBUNTU_APPLICATION_SESSION_H_ platform-api-3.0.1+16.04.20160203/android/include/private/platform/0000755000015600001650000000000012654350173025013 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/android/include/private/platform/empty_base.h0000644000015600001650000000203312654347715027322 0ustar pbuserpbgroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_PLATFORM_EMPTY_BASE_H_ #define UBUNTU_PLATFORM_EMPTY_BASE_H_ namespace ubuntu { namespace platform { class EmptyBase { public: virtual ~EmptyBase() {} protected: EmptyBase() {} EmptyBase(const EmptyBase&) = delete; EmptyBase& operator=(const EmptyBase&) = delete; }; } } #endif // UBUNTU_PLATFORM_EMPTY_BASE_H_ platform-api-3.0.1+16.04.20160203/android/include/private/platform/shared_ptr.h0000644000015600001650000000251312654347715027330 0ustar pbuserpbgroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_PLATFORM_SHARED_PTR_H_ #define UBUNTU_PLATFORM_SHARED_PTR_H_ #ifdef ANDROID #include #include #else #include #endif #include "empty_base.h" namespace ubuntu { namespace platform { #ifdef ANDROID typedef android::RefBase ReferenceCountedBase; template struct shared_ptr : public android::sp { shared_ptr() : android::sp() { } template shared_ptr(Y* p) : android::sp(p) { } }; #else typedef ubuntu::platform::EmptyBase ReferenceCountedBase; using std::shared_ptr; #endif } } #endif // UBUNTU_PLATFORM_SHARED_PTR_H_ platform-api-3.0.1+16.04.20160203/android/default/0000755000015600001650000000000012654350173021516 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/android/default/default_ubuntu_application_sensor.cpp0000644000015600001650000005110212654347715031233 0ustar pbuserpbgroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß * Ricardo Mendoza */ #include #include #include #include #include #include #include #include #include #include #include namespace { enum sensor_value_t { MIN_DELAY, MIN_VALUE, MAX_VALUE, RESOLUTION }; template struct SensorListener : public ubuntu::application::sensors::SensorListener { SensorListener() : on_accelerometer_event(NULL), on_proximity_event(NULL), on_light_event(NULL), on_orientation_event(NULL), context(nullptr) { } void on_new_reading(const ubuntu::application::sensors::SensorReading::Ptr& reading) { switch(sensor_type) { case ubuntu::application::sensors::sensor_type_orientation: { if (!on_orientation_event) return; ubuntu::application::sensors::OrientationEvent ev( reading->timestamp, reading->vector[0], reading->vector[1], reading->vector[2] ); on_orientation_event( &ev, this->context ); break; } case ubuntu::application::sensors::sensor_type_accelerometer: { if (!on_accelerometer_event) return; ubuntu::application::sensors::AccelerometerEvent ev( reading->timestamp, reading->acceleration[0], reading->acceleration[1], reading->acceleration[2] ); on_accelerometer_event( &ev, this->context ); break; } case ubuntu::application::sensors::sensor_type_proximity: { if (!on_proximity_event) return; ubuntu::application::sensors::ProximityEvent ev( static_cast(reading->timestamp), reading->distance ); on_proximity_event( &ev, this->context ); break; } case ubuntu::application::sensors::sensor_type_light: { if (!on_light_event) return; ubuntu::application::sensors::LightEvent ev( reading->timestamp, reading->light ); on_light_event( &ev, this->context ); break; } } } on_accelerometer_event_cb on_accelerometer_event; on_proximity_event_cb on_proximity_event; on_light_event_cb on_light_event; on_orientation_event_cb on_orientation_event; void *context; }; ubuntu::application::sensors::Sensor::Ptr orientation; ubuntu::application::sensors::Sensor::Ptr accelerometer; ubuntu::application::sensors::Sensor::Ptr proximity; ubuntu::application::sensors::Sensor::Ptr light; ubuntu::application::sensors::SensorListener::Ptr orientation_listener; ubuntu::application::sensors::SensorListener::Ptr accelerometer_listener; ubuntu::application::sensors::SensorListener::Ptr proximity_listener; ubuntu::application::sensors::SensorListener::Ptr light_listener; } static int32_t toHz(int32_t microseconds) { return 1 / (microseconds / 1e6); } /* * Proximity Sensor */ UASensorsProximity* ua_sensors_proximity_new() { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); proximity = ubuntu::application::sensors::SensorService::sensor_for_type( ubuntu::application::sensors::sensor_type_proximity); return proximity.get(); } UStatus ua_sensors_proximity_enable( UASensorsProximity* sensor) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); if (sensor == NULL) return U_STATUS_ERROR; auto s = static_cast(sensor); int ret = s->enable(); if (ret < 0) return U_STATUS_ERROR; return U_STATUS_SUCCESS; } UStatus ua_sensors_proximity_disable( UASensorsProximity* sensor) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); if (sensor == NULL) return U_STATUS_ERROR; auto s = static_cast(sensor); s->disable(); return U_STATUS_SUCCESS; } uint32_t ua_sensors_proximity_get_min_delay( UASensorsProximity* sensor) { if (sensor == NULL) return -1; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); return toHz(s->min_delay()); } UStatus ua_sensors_proximity_get_min_value( UASensorsProximity* sensor, float* value) { if (sensor == NULL || value == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); *value = s->min_value(); return U_STATUS_SUCCESS; } UStatus ua_sensors_proximity_get_max_value( UASensorsProximity* sensor, float* value) { if (sensor == NULL || value == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); *value = s->max_value(); return U_STATUS_SUCCESS; } UStatus ua_sensors_proximity_get_resolution( UASensorsProximity* sensor, float* value) { if (sensor == NULL || value == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); *value = s->resolution(); return U_STATUS_SUCCESS; } void ua_sensors_proximity_set_reading_cb( UASensorsProximity* sensor, on_proximity_event_cb cb, void *ctx) { if (sensor == NULL) return; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); SensorListener* sl = new SensorListener(); sl->on_proximity_event = cb; sl->context = ctx; proximity_listener = sl; s->register_listener(proximity_listener); } UStatus ua_sensors_proximity_set_event_rate( UASensorsProximity* sensor, uint32_t rate) { if (sensor == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); if (!s->set_event_rate(rate)) return U_STATUS_ERROR; return U_STATUS_SUCCESS; } uint64_t uas_proximity_event_get_timestamp( UASProximityEvent* event) { auto ev = static_cast(event); return ev->get_timestamp(); } UASProximityDistance uas_proximity_event_get_distance( UASProximityEvent* event) { auto ev = static_cast(event); if (ev->get_distance() == proximity->max_value()) return U_PROXIMITY_FAR; return U_PROXIMITY_NEAR; } /* * Ambient Light Sensor */ UASensorsLight* ua_sensors_light_new() { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); light = ubuntu::application::sensors::SensorService::sensor_for_type( ubuntu::application::sensors::sensor_type_light); return light.get(); } UStatus ua_sensors_light_enable( UASensorsLight* sensor) { if (sensor == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); s->enable(); return U_STATUS_SUCCESS; } UStatus ua_sensors_light_disable( UASensorsLight* sensor) { if (sensor == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); s->disable(); return U_STATUS_SUCCESS; } uint32_t ua_sensors_light_get_min_delay( UASensorsLight* sensor) { if (sensor == NULL) return -1; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); return toHz(s->min_delay()); } UStatus ua_sensors_light_get_min_value( UASensorsLight* sensor, float* value) { if (sensor == NULL || value == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); *value = s->min_value(); return U_STATUS_SUCCESS; } UStatus ua_sensors_light_get_max_value( UASensorsLight* sensor, float* value) { if (sensor == NULL || value == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); *value = s->max_value(); return U_STATUS_SUCCESS; } UStatus ua_sensors_light_get_resolution( UASensorsLight* sensor, float* value) { if (sensor == NULL || value == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); *value = s->resolution(); return U_STATUS_SUCCESS; } void ua_sensors_light_set_reading_cb( UASensorsLight* sensor, on_light_event_cb cb, void *ctx) { if (sensor == NULL) return; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); SensorListener* sl = new SensorListener(); sl->on_light_event = cb; sl->context = ctx; light_listener = sl; s->register_listener(light_listener); } UStatus ua_sensors_light_set_event_rate( UASensorsLight* sensor, uint32_t rate) { if (sensor == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); if (!s->set_event_rate(rate)) return U_STATUS_ERROR; return U_STATUS_SUCCESS; } uint64_t uas_light_event_get_timestamp( UASLightEvent* event) { auto ev = static_cast(event); return ev->get_timestamp(); } UStatus uas_light_event_get_light( UASLightEvent* event, float* value) { if (event == NULL || value == NULL) return U_STATUS_ERROR; auto ev = static_cast(event); *value = ev->get_light(); return U_STATUS_SUCCESS; } /* * Acceleration Sensor */ UASensorsAccelerometer* ua_sensors_accelerometer_new() { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); accelerometer = ubuntu::application::sensors::SensorService::sensor_for_type( ubuntu::application::sensors::sensor_type_accelerometer); return accelerometer.get(); } UStatus ua_sensors_accelerometer_enable( UASensorsAccelerometer* sensor) { if (sensor == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); s->enable(); return U_STATUS_SUCCESS; } UStatus ua_sensors_accelerometer_disable( UASensorsAccelerometer* sensor) { if (sensor == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); s->disable(); return U_STATUS_SUCCESS; } uint32_t ua_sensors_accelerometer_get_min_delay( UASensorsAccelerometer* sensor) { if (sensor == NULL) return -1; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); return toHz(s->min_delay()); } UStatus ua_sensors_accelerometer_get_min_value( UASensorsAccelerometer* sensor, float* value) { if (sensor == NULL || value == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); *value = s->min_value(); return U_STATUS_SUCCESS; } UStatus ua_sensors_accelerometer_get_max_value( UASensorsAccelerometer* sensor, float* value) { if (sensor == NULL || value == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); *value = s->max_value(); return U_STATUS_SUCCESS; } UStatus ua_sensors_accelerometer_get_resolution( UASensorsAccelerometer* sensor, float* value) { if (sensor == NULL || value == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); *value = s->resolution(); return U_STATUS_SUCCESS; } void ua_sensors_accelerometer_set_reading_cb( UASensorsAccelerometer* sensor, on_accelerometer_event_cb cb, void *ctx) { if (sensor == NULL) return; auto s = static_cast(sensor); SensorListener* sl = new SensorListener(); sl->on_accelerometer_event = cb; sl->context = ctx; accelerometer_listener = sl; s->register_listener(accelerometer_listener); } UStatus ua_sensors_accelerometer_set_event_rate( UASensorsAccelerometer* sensor, uint32_t rate) { if (sensor == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); if (!s->set_event_rate(rate)) return U_STATUS_ERROR; return U_STATUS_SUCCESS; } uint64_t uas_accelerometer_event_get_timestamp( UASAccelerometerEvent* event) { auto ev = static_cast(event); return ev->get_timestamp(); } UStatus uas_accelerometer_event_get_acceleration_x( UASAccelerometerEvent* event, float* value) { if (event == NULL || value == NULL) return U_STATUS_ERROR; auto ev = static_cast(event); *value = ev->get_x(); return U_STATUS_SUCCESS; } UStatus uas_accelerometer_event_get_acceleration_y( UASAccelerometerEvent* event, float* value) { if (event == NULL || value == NULL) return U_STATUS_ERROR; auto ev = static_cast(event); *value = ev->get_y(); return U_STATUS_SUCCESS; } UStatus uas_accelerometer_event_get_acceleration_z( UASAccelerometerEvent* event, float* value) { if (event == NULL || value == NULL) return U_STATUS_ERROR; auto ev = static_cast(event); *value = ev->get_z(); return U_STATUS_SUCCESS; } /* * Orientation Sensor */ UASensorsOrientation* ua_sensors_orientation_new() { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); orientation = ubuntu::application::sensors::SensorService::sensor_for_type( ubuntu::application::sensors::sensor_type_orientation); return orientation.get(); } UStatus ua_sensors_orientation_enable( UASensorsOrientation* sensor) { if (sensor == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); s->enable(); return U_STATUS_SUCCESS; } UStatus ua_sensors_orientation_disable( UASensorsOrientation* sensor) { if (sensor == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); s->disable(); return U_STATUS_SUCCESS; } uint32_t ua_sensors_orientation_get_min_delay( UASensorsOrientation* sensor) { if (sensor == NULL) return -1; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); return toHz(s->min_delay()); } UStatus ua_sensors_orientation_get_min_value( UASensorsOrientation* sensor, float* value) { if (sensor == NULL || value == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); *value = s->min_value(); return U_STATUS_SUCCESS; } UStatus ua_sensors_orientation_get_max_value( UASensorsOrientation* sensor, float* value) { if (sensor == NULL || value == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); *value = s->max_value(); return U_STATUS_SUCCESS; } UStatus ua_sensors_orientation_get_resolution( UASensorsOrientation* sensor, float* value) { if (sensor == NULL || value == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); *value = s->resolution(); return U_STATUS_SUCCESS; } void ua_sensors_orientation_set_reading_cb( UASensorsOrientation* sensor, on_orientation_event_cb cb, void *ctx) { if (sensor == NULL) return; auto s = static_cast(sensor); SensorListener* sl = new SensorListener(); sl->on_orientation_event = cb; sl->context = ctx; orientation_listener = sl; s->register_listener(orientation_listener); } UStatus ua_sensors_orientation_set_event_rate( UASensorsOrientation* sensor, uint32_t rate) { if (sensor == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); if (!s->set_event_rate(rate)) return U_STATUS_ERROR; return U_STATUS_SUCCESS; } uint64_t uas_orientation_event_get_timestamp( UASOrientationEvent* event) { auto ev = static_cast(event); return ev->get_timestamp(); } UStatus uas_orientation_event_get_azimuth( UASOrientationEvent* event, float* value) { if (event == NULL || value == NULL) return U_STATUS_ERROR; auto ev = static_cast(event); *value = ev->get_azimuth(); return U_STATUS_SUCCESS; } UStatus uas_orientation_event_get_pitch( UASOrientationEvent* event, float* value) { if (event == NULL || value == NULL) return U_STATUS_ERROR; auto ev = static_cast(event); *value = ev->get_pitch(); return U_STATUS_SUCCESS; } UStatus uas_orientation_event_get_roll( UASOrientationEvent* event, float* value) { if (event == NULL || value == NULL) return U_STATUS_ERROR; auto ev = static_cast(event); *value = ev->get_roll(); return U_STATUS_SUCCESS; } platform-api-3.0.1+16.04.20160203/android/hybris/0000755000015600001650000000000012654350173021372 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/android/hybris/test_sensors.cpp0000644000015600001650000001027512654347715024646 0ustar pbuserpbgroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include #include #include #include #include #include namespace uas = ubuntu::application::sensors; struct SensorListener : public uas::SensorListener { SensorListener(uas::SensorType sensor_type) : sensor_type(sensor_type) { } void on_new_reading(const uas::SensorReading::Ptr& reading) { on_new_reading(sensor_type, reading); } void on_new_reading( uas::SensorType sensor_type, const uas::SensorReading::Ptr& reading) { switch (sensor_type) { case uas::sensor_type_accelerometer: printf("New reading for accelerometer: [%f, %f, %f] \n", reading->acceleration[0], reading->acceleration[1], reading->acceleration[2]); break; case uas::sensor_type_magnetic_field: printf("New reading for magnetic field: [%f, %f, %f] \n", reading->magnetic[0], reading->magnetic[1], reading->magnetic[2]); break; case uas::sensor_type_gyroscope: printf("New reading for gyro: [%f, %f, %f] \n", reading->vector[0], reading->vector[1], reading->vector[2]); break; case uas::sensor_type_light: printf("New reading for light sensor: [%f] \n", reading->light); break; case uas::sensor_type_proximity: printf("New reading for proximity sensor: [%f] \n", reading->distance); break; case uas::sensor_type_orientation: printf("New reading for orientation sensor: [%f, %f, %f] \n", reading->vector[0], reading->vector[1], reading->vector[2]); break; case uas::sensor_type_linear_acceleration: printf("New reading for linear acceleration: [%f, %f, %f] \n", reading->vector[0], reading->vector[1], reading->vector[2]); break; case uas::sensor_type_rotation_vector: printf("New reading for rotation vector: [%f, %f, %f] \n", reading->vector[0], reading->vector[1], reading->vector[2]); break; } } uas::SensorType sensor_type; }; int main(int argc, char** argv) { ubuntu::application::sensors::Sensor::Ptr sensors[ubuntu::application::sensors::undefined_sensor_type]; for(int i = ubuntu::application::sensors::first_defined_sensor_type; i < ubuntu::application::sensors::undefined_sensor_type; i++) { sensors[i] = uas::SensorService::sensor_for_type( static_cast(i)); if (sensors[i] == NULL) continue; printf("Sensor: %s by %s (power consumption: %f)\n", sensors[i]->name(), sensors[i]->vendor(), sensors[i]->power_consumption()); sensors[i]->register_listener( uas::SensorListener::Ptr( new SensorListener( static_cast(i)))); sensors[i]->enable(); } while (true) { sleep(1); } } platform-api-3.0.1+16.04.20160203/android/hybris/event_loop.h0000644000015600001650000000317412654347730023727 0ustar pbuserpbgroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef EVENT_LOOP_H_ #define EVENT_LOOP_H_ #include #include #include #if ANDROID_VERSION_MAJOR==5 #include "android/looper.h" #endif namespace ubuntu { namespace application { struct EventLoop : public android::Thread { EventLoop(const android::sp& looper) : looper(looper) { } bool threadLoop() { static const int five_seconds_in_milliseconds = 5*1000; bool result = true; while(true) { switch(looper->pollOnce(five_seconds_in_milliseconds)) { case ALOOPER_POLL_CALLBACK: case ALOOPER_POLL_TIMEOUT: result = true; break; case ALOOPER_POLL_ERROR: result = false; break; } } return result; } android::sp looper; }; } } #endif // EVENT_LOOP_H_ platform-api-3.0.1+16.04.20160203/android/hybris/session_service.h0000644000015600001650000000162512654347715024762 0ustar pbuserpbgroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef HYBRIS_SESSION_SERVICE_H_ #define HYBRIS_SESSION_SERVICE_H_ #include namespace android { class ISessionService : public IInterface } #endif // HYBRIS_SESSION_SERVICE_H_ platform-api-3.0.1+16.04.20160203/android/hybris/test_gps_api.cpp0000644000015600001650000001432412654347715024573 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Daniel d'Andrada */ #include #include #include #include #include #include class GPSTest { public: GPSTest(); ~GPSTest(); bool init_and_start(); bool stop(); void inject_time(); UbuntuGps ubuntu_gps; }; void gps_location_cb(UbuntuGpsLocation* location, void* context) { printf("gps_location_cb() called.\n"); } void gps_status_cb(uint16_t status, void* context) { switch(status) { case UBUNTU_GPS_STATUS_NONE: printf("status: None\n"); break; case UBUNTU_GPS_STATUS_SESSION_BEGIN: printf("status: Session Begin\n"); break; case UBUNTU_GPS_STATUS_SESSION_END: printf("status: Session End\n"); break; case UBUNTU_GPS_STATUS_ENGINE_ON: printf("status: Engine On\n"); break; case UBUNTU_GPS_STATUS_ENGINE_OFF: printf("status: Engine Off\n"); default: break; }; } void gps_sb_status_cb(UbuntuGpsSvStatus* sv_info, void* context) { printf("gps_sb_status_cb() called, listing %d space vehicles\n", sv_info->num_svs); } void gps_nmea_cb(int64_t timestamp, const char* nmea, int length, void* context) { char str[length+1]; memcpy(str, nmea, length); str[length] = 0; printf("gps_nmea_cb() - %s\n", str); } void gps_set_cabapilities_cb(uint32_t capabilities, void* context) { printf("gps_set_cabapilities_cb() -"); if (capabilities & UBUNTU_GPS_CAPABILITY_SCHEDULING) printf(" scheduling"); if (capabilities & UBUNTU_GPS_CAPABILITY_MSB) printf(" MSB"); if (capabilities & UBUNTU_GPS_CAPABILITY_MSA) printf(" MSA"); if (capabilities & UBUNTU_GPS_CAPABILITY_SINGLE_SHOT) printf(" 'single shot'"); if (capabilities & UBUNTU_GPS_CAPABILITY_ON_DEMAND_TIME) printf(" 'on demand time'"); printf("\n"); } void gps_request_utc_time_cb(void* context) { printf("gps_request_utc_time_cb() called.\n"); ((GPSTest*)context)->inject_time(); } void gps_xtra_download_request_cb(void* context) { printf("gps_xtra_download_request_cb() called.\n"); } void agps_status_cb(UbuntuAgpsStatus* status, void* context) { printf("agps status -"); if (status->type == UBUNTU_AGPS_TYPE_SUPL) printf(" SUPL"); else printf(" C2K"); switch (status->status) { case UBUNTU_GPS_REQUEST_AGPS_DATA_CONN: printf(", request AGPS data connection"); break; case UBUNTU_GPS_RELEASE_AGPS_DATA_CONN: printf(", release AGPS data connection"); break; case UBUNTU_GPS_AGPS_DATA_CONNECTED: printf(", request AGPS data connected"); break; case UBUNTU_GPS_AGPS_DATA_CONN_DONE: printf(", AGPS data connection done"); break; default: case UBUNTU_GPS_AGPS_DATA_CONN_FAILED: printf(", AGPS data connection failed"); break; } printf(" ipaddr=%u\n", status->ipaddr); } void gps_notify_cb(UbuntuGpsNiNotification *notification, void* context) { printf("gps_notify_cb() called.\n"); } void agps_ril_request_set_id_cb(uint32_t flags, void* context) { printf("agps_ril_request_set_id_cb() called.\n"); } void agps_ril_request_refloc_cb(uint32_t flags, void* context) { printf("agps_ril_request_refloc_cb() called.\n"); } GPSTest::GPSTest() : ubuntu_gps(NULL) { } GPSTest::~GPSTest() { if (ubuntu_gps) ubuntu_gps_delete(ubuntu_gps); } void GPSTest::inject_time() { // A real implementation would inject time from some NTP server. time_t t = time(0); int64_t time_millis = (int64_t)t * (int64_t)1000; ubuntu_gps_inject_time(ubuntu_gps, time_millis /*NTP time would go here*/, time_millis /*internal time when that NTP time was taken*/, 10 /* possible deviation, in milliseconds*/); } bool GPSTest::init_and_start() { UbuntuGpsParams gps_params; gps_params.location_cb = gps_location_cb; gps_params.status_cb = gps_status_cb; gps_params.sv_status_cb = gps_sb_status_cb; gps_params.nmea_cb = gps_nmea_cb; gps_params.set_capabilities_cb = gps_set_cabapilities_cb; gps_params.request_utc_time_cb = gps_request_utc_time_cb; gps_params.xtra_download_request_cb = gps_xtra_download_request_cb; gps_params.agps_status_cb = agps_status_cb; gps_params.gps_ni_notify_cb = gps_notify_cb; gps_params.request_setid_cb = agps_ril_request_set_id_cb; gps_params.request_refloc_cb = agps_ril_request_refloc_cb; gps_params.context = this; UbuntuGps ubuntu_gps = ubuntu_gps_new(&gps_params); if (!ubuntu_gps) { printf("GPS creation failed!\n"); return false; } bool ok = ubuntu_gps_start(ubuntu_gps); if (!ok) { printf("GPS start up failed!\n"); return false; } return true; } bool GPSTest::stop() { bool ok = ubuntu_gps_stop(ubuntu_gps); if (!ok) printf("failed when stopping GPS!\n"); return ok; } void wait_for_sigint() { sigset_t signals; sigemptyset(&signals); sigaddset(&signals, SIGINT); int sig; int result = sigwait(&signals, &sig); if (result != 0) printf("sigwait failed!\n"); } int main(int argc, char** argv) { int return_value = 0; GPSTest test; if (!test.init_and_start()) return 1; printf("GPS initialized and started. Now waiting for callbacks or SIGINT (to quit).\n"); wait_for_sigint(); printf("Exiting...\n"); if (!test.stop()) return 1; printf("GPS stopped.\n"); return 0; } platform-api-3.0.1+16.04.20160203/android/hybris/ubuntu_hardware_booster_for_hybris.cpp0000644000015600001650000000760412654347724031277 0ustar pbuserpbgroup00000000000000/* * Copyright © 2016 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #include #include #include #include struct UbuntuHardwareBooster : public android::RefBase { typedef void (*BoosterEnableScenario)(int); typedef void (*BoosterDisableScenario)(int); static int translate_ubuntu_scenario(UHardwareBoosterScenario scenario) { switch (scenario) { case U_HARDWARE_BOOSTER_SCENARIO_USER_INTERACTION: return 5; } return 0; } static BoosterEnableScenario load_booster_enable_scenario(void* dl_handle) { if (!dl_handle) return NULL; return reinterpret_cast(::dlsym(dl_handle, booster_enable_scenario_from_property())); } static BoosterDisableScenario load_booster_disable_scenario(void* dl_handle) { if (!dl_handle) return NULL; return reinterpret_cast(::dlsym(dl_handle, booster_disable_scenario_from_property())); } static const char* dl_path_from_property() { static char value[PROP_VALUE_MAX]; static int rc = property_get("ubuntu.booster.dl", value, NULL); return rc == 0 ? NULL : &value[0]; } static const char* booster_enable_scenario_from_property() { static char value[PROP_VALUE_MAX]; static int rc = property_get("ubuntu.booster.enable", value, NULL); return rc == 0 ? NULL : &value[0]; } static const char* booster_disable_scenario_from_property() { static char value[PROP_VALUE_MAX]; static int rc = property_get("ubuntu.booster.disable", value, NULL); return rc == 0 ? NULL : &value[0]; } UbuntuHardwareBooster() : dl_handle(dlopen(dl_path_from_property(), RTLD_NOW)), booster_enable_scenario(load_booster_enable_scenario(dl_handle)), booster_disable_scenario(load_booster_disable_scenario(dl_handle)) { } ~UbuntuHardwareBooster() { if (dl_handle) dlclose(dl_handle); } void enable_scenario(UHardwareBoosterScenario scenario) { if (booster_enable_scenario) booster_enable_scenario(translate_ubuntu_scenario(scenario)); } void disable_scenario(UHardwareBoosterScenario scenario) { if (booster_disable_scenario) booster_disable_scenario(translate_ubuntu_scenario(scenario)); } void* dl_handle; BoosterEnableScenario booster_enable_scenario; BoosterDisableScenario booster_disable_scenario; }; UHardwareBooster* u_hardware_booster_new() { return new UbuntuHardwareBooster(); } void u_hardware_booster_ref(UHardwareBooster* booster) { if (booster) booster->incStrong(NULL); } void u_hardware_booster_unref(UHardwareBooster* booster) { if (booster) booster->decStrong(NULL); } void u_hardware_booster_enable_scenario(UHardwareBooster* booster, UHardwareBoosterScenario scenario) { if (booster) booster->enable_scenario(scenario); } void u_hardware_booster_disable_scenario(UHardwareBooster* booster, UHardwareBoosterScenario scenario) { if (booster) booster->disable_scenario(scenario); } platform-api-3.0.1+16.04.20160203/android/hybris/test_sensors_c_api.cpp0000644000015600001650000000753012654347715026001 0ustar pbuserpbgroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza */ #include #include #include #define __STDC_FORMAT_MACROS #include #include #include #include #include void on_new_accelerometer_event(UASAccelerometerEvent* event, void* context) { float x; uas_accelerometer_event_get_acceleration_x(event, &x); float y; uas_accelerometer_event_get_acceleration_y(event, &y); float z; uas_accelerometer_event_get_acceleration_z(event, &z); printf("%s \n", __PRETTY_FUNCTION__); printf("\ttime: %" PRIu64 "\n", uas_accelerometer_event_get_timestamp(event)); printf("\tx: %f\n", x); printf("\ty: %f\n", y); printf("\tz: %f\n", z); } void on_new_proximity_event(UASProximityEvent* event, void* context) { printf("%s \n", __PRETTY_FUNCTION__); printf("\ttime: %" PRIu64 "\n", uas_proximity_event_get_timestamp(event)); switch (uas_proximity_event_get_distance(event)) { case U_PROXIMITY_NEAR: { printf("\tdistance: NEAR\n"); break; } case U_PROXIMITY_FAR: { printf("\tdistance: FAR\n"); break; } } } void on_new_light_event(UASLightEvent* event, void* context) { float light = -1.f; uas_light_event_get_light(event, &light); printf("%s \n", __PRETTY_FUNCTION__); printf("\ttime: %" PRIu64 "\n", uas_light_event_get_timestamp(event)); printf("\tlight: %f\n", light); } void on_new_orientation_event(UASOrientationEvent* event, void* context) { float x; uas_orientation_event_get_azimuth(event, &x); float y; uas_orientation_event_get_pitch(event, &y); float z; uas_orientation_event_get_roll(event, &z); printf("%s \n", __PRETTY_FUNCTION__); printf("\ttime: %" PRIu64 "\n", uas_orientation_event_get_timestamp(event)); printf("\tx: %f\n", x); printf("\ty: %f\n", y); printf("\tz: %f\n", z); } int main(int argc, char** argv) { UASensorsAccelerometer* accelerometer = ua_sensors_accelerometer_new(); UASensorsProximity* proximity = ua_sensors_proximity_new(); UASensorsLight* ambientlight = ua_sensors_light_new(); UASensorsOrientation* orientation = ua_sensors_orientation_new(); ua_sensors_accelerometer_set_reading_cb(accelerometer, on_new_accelerometer_event, NULL); ua_sensors_proximity_set_reading_cb(proximity, on_new_proximity_event, NULL); ua_sensors_light_set_reading_cb(ambientlight, on_new_light_event, NULL); ua_sensors_orientation_set_reading_cb(orientation, on_new_orientation_event, NULL); ua_sensors_accelerometer_enable(accelerometer); ua_sensors_proximity_enable(proximity); ua_sensors_light_enable(ambientlight); ua_sensors_orientation_enable(orientation); while(true) { } } platform-api-3.0.1+16.04.20160203/android/hybris/Android.mk0000644000015600001650000000476412654347730023323 0ustar pbuserpbgroup00000000000000LOCAL_PATH := $(call my-dir) ANDROID_VERSION_MAJOR := $(word 1, $(subst ., , $(PLATFORM_VERSION))) ANDROID_VERSION_MINOR := $(word 2, $(subst ., , $(PLATFORM_VERSION))) ANDROID_VERSION_PATCH := $(word 3, $(subst ., , $(PLATFORM_VERSION))) HAS_LIBINPUTSERVICE := $(shell test $(ANDROID_VERSION_MAJOR) -eq 4 -a $(ANDROID_VERSION_MINOR) -gt 2 && echo true) include $(CLEAR_VARS) LOCAL_CFLAGS += \ -DANDROID_VERSION_MAJOR=$(ANDROID_VERSION_MAJOR) \ -DANDROID_VERSION_MINOR=$(ANDROID_VERSION_MINOR) \ -DANDROID_VERSION_PATCH=$(ANDROID_VERSION_PATCH) UPAPI_PATH := $(LOCAL_PATH)/../../ LOCAL_CFLAGS += -std=gnu++0x ifeq ($(BOARD_HAS_GNSS_STATUS_CALLBACK),true) LOCAL_CFLAGS += -DBOARD_HAS_GNSS_STATUS_CALLBACK endif LOCAL_C_INCLUDES := \ $(UPAPI_PATH)/include \ $(UPAPI_PATH)/android/include LOCAL_SRC_FILES := \ ubuntu_application_gps_for_hybris.cpp \ ubuntu_application_sensors_for_hybris.cpp \ ubuntu_hardware_booster_for_hybris.cpp \ ../default/default_ubuntu_application_sensor.cpp LOCAL_MODULE := libubuntu_application_api LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ libandroidfw \ libbinder \ libcutils \ libinput \ liblog \ libutils \ libgui \ libEGL \ libGLESv2 \ libhardware \ libhardware_legacy \ libdl include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_CFLAGS += -std=gnu++0x LOCAL_C_INCLUDES := \ $(UPAPI_PATH)/include \ $(UPAPI_PATH)/android/include LOCAL_SRC_FILES:= \ test_sensors_c_api.cpp \ LOCAL_MODULE:= direct_ubuntu_application_sensors_c_api_for_hybris_test LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ libandroidfw \ libutils \ libEGL \ libGLESv2 \ libubuntu_application_api include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_CFLAGS += -std=gnu++0x LOCAL_C_INCLUDES := \ $(UPAPI_PATH)/include \ $(UPAPI_PATH)/android/include LOCAL_SRC_FILES:= \ test_sensors.cpp \ LOCAL_MODULE:= direct_ubuntu_application_sensors_for_hybris_test LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ libandroidfw \ libutils \ libEGL \ libGLESv2 \ libubuntu_application_api include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_CFLAGS += -std=gnu++0x LOCAL_C_INCLUDES := \ $(UPAPI_PATH)/include \ $(UPAPI_PATH)/android/include LOCAL_SRC_FILES:= \ test_gps_api.cpp \ LOCAL_MODULE:= direct_ubuntu_application_gps_c_api_for_hybris_test LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ libui \ libutils \ libEGL \ libGLESv2 \ libhardware \ libhardware_legacy \ libubuntu_application_api #include $(BUILD_EXECUTABLE) platform-api-3.0.1+16.04.20160203/android/hybris/input_consumer_thread.h0000644000015600001650000000502712654347715026160 0ustar pbuserpbgroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #ifndef INPUT_CONSUMER_THREAD_H_ #define INPUT_CONSUMER_THREAD_H_ #if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=2 #include #else #include #endif #include namespace android { struct InputConsumerThread : public android::Thread { InputConsumerThread(android::InputConsumer& input_consumer) : input_consumer(input_consumer), looper(android::Looper::prepare(ALOOPER_PREPARE_ALLOW_NON_CALLBACKS)) { looper->addFd(input_consumer.getChannel()->getFd(), input_consumer.getChannel()->getFd(), ALOOPER_EVENT_INPUT, NULL, NULL); } bool threadLoop() { while (true) { switch(looper->pollOnce(5 * 1000)) { case ALOOPER_POLL_TIMEOUT: case ALOOPER_POLL_ERROR: continue; break; } // printf("%s \n", __PRETTY_FUNCTION__); InputEvent* event = NULL; uint32_t consumeSeq; bool result = true; switch(input_consumer.consume(&event_factory, true, -1, &consumeSeq, &event)) { case OK: //TODO:Dispatch to input listener result = true; //printf("Yeah, we have an event client-side.\n"); input_consumer.sendFinishedSignal(consumeSeq, result); break; case INVALID_OPERATION: result = true; break; case NO_MEMORY: result = true; break; } } return true; } android::InputConsumer input_consumer; android::sp looper; android::PreallocatedInputEventFactory event_factory; }; } #endif // INPUT_CONSUMER_THREAD_H_ platform-api-3.0.1+16.04.20160203/android/hybris/ubuntu_application_gps_for_hybris.cpp0000644000015600001650000003453212654347730031116 0ustar pbuserpbgroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Daniel d'Andrada */ #include #include // android stuff #include #include #define WAKE_LOCK_NAME "U_HARDWARE_GPS" struct UHardwareGps_ { UHardwareGps_(UHardwareGpsParams* params); ~UHardwareGps_(); bool init(); bool start(); bool stop(); void inject_time(int64_t time, int64_t timeReference, int uncertainty); void inject_location(double latitude, double longitude, float accuracy); void delete_aiding_data(UHardwareGpsAidingData flags); void set_server_for_type(UHardwareGpsAGpsType type, const char* hostname, uint16_t port); void set_reference_location(UHardwareGpsAGpsRefLocation* location, size_t size_of_struct); void notify_connection_is_open(const char* apn); void notify_connection_is_closed(); void notify_connection_not_available(); bool set_position_mode(uint32_t mode, uint32_t recurrence, uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time); void inject_xtra_data(char* data, int length); const GpsInterface* gps_interface; const GpsXtraInterface* gps_xtra_interface; const AGpsInterface* agps_interface; const GpsNiInterface* gps_ni_interface; const GpsDebugInterface* gps_debug_interface; const AGpsRilInterface* agps_ril_interface; UHardwareGpsLocationCallback location_cb; UHardwareGpsStatusCallback status_cb; UHardwareGpsSvStatusCallback sv_status_cb; UHardwareGpsNmeaCallback nmea_cb; UHardwareGpsSetCapabilities set_capabilities_cb; UHardwareGpsRequestUtcTime request_utc_time_cb; UHardwareGpsXtraDownloadRequest xtra_download_request_cb; UHardwareGpsAGpsStatusCallback agps_status_cb; UHardwareGpsNiNotifyCallback gps_ni_notify_cb; UHardwareGpsAGpsRilRequestSetId request_setid_cb; UHardwareGpsAGpsRilRequestRefLoc request_refloc_cb; void* context; }; namespace { UHardwareGps hybris_gps_instance = NULL; } static void location_callback(GpsLocation* location) { if (!hybris_gps_instance) return; hybris_gps_instance->location_cb( reinterpret_cast(location), hybris_gps_instance->context); } static void status_callback(GpsStatus* status) { if (!hybris_gps_instance) return; hybris_gps_instance->status_cb(status->status, hybris_gps_instance->context); } static void sv_status_callback(GpsSvStatus* sv_status) { if (!hybris_gps_instance) return; hybris_gps_instance->sv_status_cb( reinterpret_cast(sv_status), hybris_gps_instance->context); } static void nmea_callback(GpsUtcTime timestamp, const char* nmea, int length) { if (!hybris_gps_instance) return; hybris_gps_instance->nmea_cb(timestamp, nmea, length, hybris_gps_instance->context); } static void set_capabilities_callback(uint32_t capabilities) { if (!hybris_gps_instance) return; hybris_gps_instance->set_capabilities_cb(capabilities, hybris_gps_instance->context); } static void acquire_wakelock_callback() { acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_NAME); } static void release_wakelock_callback() { release_wake_lock(WAKE_LOCK_NAME); } static void request_utc_time_callback() { if (!hybris_gps_instance) return; hybris_gps_instance->request_utc_time_cb(hybris_gps_instance->context); } typedef struct { void (*func)(void *); void *arg; } FuncAndArg; static void * thread_start_wrapper(void* arg) { FuncAndArg *func_and_arg = reinterpret_cast(arg); func_and_arg->func(func_and_arg->arg); delete func_and_arg; return NULL; } static pthread_t create_thread_callback(const char* name, void (*start)(void *), void* arg) { pthread_t thread; FuncAndArg *func_and_arg = new FuncAndArg; func_and_arg->func = start; func_and_arg->arg = arg; pthread_create(&thread, NULL, thread_start_wrapper, func_and_arg); return thread; } GpsCallbacks gps_callbacks = { sizeof(GpsCallbacks), location_callback, status_callback, sv_status_callback, #ifdef BOARD_HAS_GNSS_STATUS_CALLBACK NULL, #endif nmea_callback, set_capabilities_callback, acquire_wakelock_callback, release_wakelock_callback, create_thread_callback, request_utc_time_callback, }; static void xtra_download_request_callback() { if (hybris_gps_instance) hybris_gps_instance->xtra_download_request_cb(hybris_gps_instance->context); } GpsXtraCallbacks gps_xtra_callbacks = { xtra_download_request_callback, create_thread_callback, }; static void agps_status_cb(AGpsStatus* agps_status) { if (!hybris_gps_instance) return; /* uint32_t ipaddr; // ipaddr field was not included in original AGpsStatus if (agps_status->size >= sizeof(AGpsStatus)) ipaddr = agps_status->ipaddr; else ipaddr = 0xFFFFFFFF; */ hybris_gps_instance->agps_status_cb( reinterpret_cast(agps_status), hybris_gps_instance->context); } AGpsCallbacks agps_callbacks = { agps_status_cb, create_thread_callback, }; static void gps_ni_notify_cb(GpsNiNotification *notification) { if (hybris_gps_instance) hybris_gps_instance->gps_ni_notify_cb( reinterpret_cast(notification), hybris_gps_instance->context); } GpsNiCallbacks gps_ni_callbacks = { gps_ni_notify_cb, create_thread_callback, }; static void agps_request_set_id(uint32_t flags) { if (hybris_gps_instance) hybris_gps_instance->request_setid_cb(flags, hybris_gps_instance->context); } static void agps_request_ref_location(uint32_t flags) { if (hybris_gps_instance) hybris_gps_instance->request_refloc_cb(flags, hybris_gps_instance->context); } AGpsRilCallbacks agps_ril_callbacks = { agps_request_set_id, agps_request_ref_location, create_thread_callback, }; UHardwareGps_::UHardwareGps_(UHardwareGpsParams* params) : gps_interface(NULL), gps_xtra_interface(NULL), agps_interface(NULL), gps_ni_interface(NULL), gps_debug_interface(NULL), agps_ril_interface(NULL), location_cb(params->location_cb), status_cb(params->status_cb), sv_status_cb(params->sv_status_cb), nmea_cb(params->nmea_cb), set_capabilities_cb(params->set_capabilities_cb), request_utc_time_cb(params->request_utc_time_cb), xtra_download_request_cb(params->xtra_download_request_cb), agps_status_cb(params->agps_status_cb), gps_ni_notify_cb(params->gps_ni_notify_cb), request_setid_cb(params->request_setid_cb), request_refloc_cb(params->request_refloc_cb), context(params->context) { int err; hw_module_t* module; err = hw_get_module(GPS_HARDWARE_MODULE_ID, (hw_module_t const**)&module); if (err == 0) { hw_device_t* device; err = module->methods->open(module, GPS_HARDWARE_MODULE_ID, &device); if (err == 0) { gps_device_t* gps_device = (gps_device_t *)device; gps_interface = gps_device->get_gps_interface(gps_device); } } if (gps_interface) { gps_xtra_interface = (const GpsXtraInterface*)gps_interface->get_extension(GPS_XTRA_INTERFACE); agps_interface = (const AGpsInterface*)gps_interface->get_extension(AGPS_INTERFACE); gps_ni_interface = (const GpsNiInterface*)gps_interface->get_extension(GPS_NI_INTERFACE); gps_debug_interface = (const GpsDebugInterface*)gps_interface->get_extension(GPS_DEBUG_INTERFACE); agps_ril_interface = (const AGpsRilInterface*)gps_interface->get_extension(AGPS_RIL_INTERFACE); } } UHardwareGps_::~UHardwareGps_() { if (gps_interface) gps_interface->cleanup(); } bool UHardwareGps_::init() { // fail if the main interface fails to initialize if (!gps_interface || gps_interface->init(&gps_callbacks) != 0) return false; // if XTRA initialization fails we will disable it by gps_Xtra_interface to null, // but continue to allow the rest of the GPS interface to work. if (gps_xtra_interface && gps_xtra_interface->init(&gps_xtra_callbacks) != 0) gps_xtra_interface = NULL; if (agps_interface) agps_interface->init(&agps_callbacks); if (gps_ni_interface) gps_ni_interface->init(&gps_ni_callbacks); if (agps_ril_interface) agps_ril_interface->init(&agps_ril_callbacks); return true; } bool UHardwareGps_::start() { if (gps_interface) return (gps_interface->start() == 0); else return false; } bool UHardwareGps_::stop() { if (gps_interface) return (gps_interface->stop() == 0); else return false; } void UHardwareGps_::inject_time(int64_t time, int64_t time_reference, int uncertainty) { if (gps_interface) gps_interface->inject_time(time, time_reference, uncertainty); } void UHardwareGps_::inject_location(double latitude, double longitude, float accuracy) { if (gps_interface && gps_interface->inject_location) gps_interface->inject_location(latitude, longitude, accuracy); } void UHardwareGps_::delete_aiding_data(uint16_t flags) { if (gps_interface) gps_interface->delete_aiding_data(flags); } void UHardwareGps_::set_server_for_type(UHardwareGpsAGpsType type, const char* hostname, uint16_t port) { if (agps_interface && agps_interface->set_server) agps_interface->set_server(type, hostname, port); } void UHardwareGps_::set_reference_location(UHardwareGpsAGpsRefLocation* location, size_t size_of_struct) { AGpsRefLocation ref_loc; ref_loc.type = location->type; ref_loc.u.cellID.type = location->u.cellID.type; ref_loc.u.cellID.mcc = location->u.cellID.mcc; ref_loc.u.cellID.mnc = location->u.cellID.mnc; ref_loc.u.cellID.lac = location->u.cellID.lac; ref_loc.u.cellID.cid = location->u.cellID.cid; if (agps_ril_interface && agps_ril_interface->set_ref_location) agps_ril_interface->set_ref_location(&ref_loc, sizeof(ref_loc)); } void UHardwareGps_::notify_connection_is_open(const char* apn) { if (agps_interface && agps_interface->data_conn_open) agps_interface->data_conn_open(apn); } void UHardwareGps_::notify_connection_is_closed() { if (agps_interface && agps_interface->data_conn_closed) agps_interface->data_conn_closed(); } void UHardwareGps_::notify_connection_not_available() { if (agps_interface && agps_interface->data_conn_failed) agps_interface->data_conn_failed(); } bool UHardwareGps_::set_position_mode(uint32_t mode, uint32_t recurrence, uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time) { if (gps_interface) return (gps_interface->set_position_mode(mode, recurrence, min_interval, preferred_accuracy, preferred_time) == 0); else return false; } void UHardwareGps_::inject_xtra_data(char* data, int length) { if (gps_xtra_interface) gps_xtra_interface->inject_xtra_data(data, length); } ///////////////////////////////////////////////////////////////////// // Implementation of the C API UHardwareGps u_hardware_gps_new(UHardwareGpsParams* params) { if (hybris_gps_instance != NULL) return NULL; UHardwareGps u_hardware_gps = new UHardwareGps_(params); hybris_gps_instance = u_hardware_gps; if (!u_hardware_gps->init()) { delete u_hardware_gps; u_hardware_gps = NULL; } return u_hardware_gps; } void u_hardware_gps_delete(UHardwareGps handle) { delete handle; if (handle == hybris_gps_instance) hybris_gps_instance = NULL; } bool u_hardware_gps_start(UHardwareGps self) { return self->start(); } bool u_hardware_gps_stop(UHardwareGps self) { return self->stop(); } void u_hardware_gps_inject_time(UHardwareGps self, int64_t time, int64_t time_reference, int uncertainty) { self->inject_time(time, time_reference, uncertainty); } void u_hardware_gps_inject_location(UHardwareGps self, UHardwareGpsLocation location) { self->inject_location(location.latitude, location.longitude, location.accuracy); } void u_hardware_gps_delete_aiding_data(UHardwareGps self, UHardwareGpsAidingData flags) { self->delete_aiding_data(flags); } void u_hardware_gps_agps_set_server_for_type( UHardwareGps self, UHardwareGpsAGpsType type, const char* hostname, uint16_t port) { self->set_server_for_type(type, hostname, port); } void u_hardware_gps_agps_set_reference_location( UHardwareGps self, UHardwareGpsAGpsRefLocation *location, size_t size_of_struct) { self->set_reference_location(location, size_of_struct); } void u_hardware_gps_agps_notify_connection_is_open( UHardwareGps self, const char *apn) { self->notify_connection_is_open(apn); } void u_hardware_gps_agps_notify_connection_is_closed(UHardwareGps self) { self->notify_connection_is_closed(); } void u_hardware_gps_agps_notify_connection_not_available(UHardwareGps self) { self->notify_connection_not_available(); } bool u_hardware_gps_set_position_mode(UHardwareGps self, uint32_t mode, uint32_t recurrence, uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time) { return self->set_position_mode(mode, recurrence, min_interval, preferred_accuracy, preferred_time); } void u_hardware_gps_inject_xtra_data(UHardwareGps self, char* data, int length) { self->inject_xtra_data(data, length); } platform-api-3.0.1+16.04.20160203/android/hybris/ubuntu_application_sensors_for_hybris.cpp0000644000015600001650000002226412654347715032023 0ustar pbuserpbgroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voß */ #include "event_loop.h" #include #include #include #include #include #include #include #include #include #include namespace ubuntu { namespace application { namespace sensors { namespace hybris { typedef android::KeyedVector< ubuntu::application::sensors::SensorType, uint32_t> ForwardSensorTypeLut; typedef android::KeyedVector< uint32_t, ubuntu::application::sensors::SensorType> BackwardSensorTypeLut; static ForwardSensorTypeLut init_forward_sensor_type_lut() { static ForwardSensorTypeLut lut; lut.add(sensor_type_accelerometer, ASENSOR_TYPE_ACCELEROMETER); lut.add(sensor_type_magnetic_field, ASENSOR_TYPE_MAGNETIC_FIELD); lut.add(sensor_type_gyroscope, ASENSOR_TYPE_GYROSCOPE); lut.add(sensor_type_light, ASENSOR_TYPE_LIGHT); lut.add(sensor_type_proximity, ASENSOR_TYPE_PROXIMITY); lut.add(sensor_type_orientation, SENSOR_TYPE_ORIENTATION); lut.add(sensor_type_linear_acceleration, SENSOR_TYPE_LINEAR_ACCELERATION); lut.add(sensor_type_rotation_vector, SENSOR_TYPE_ROTATION_VECTOR); return lut; } static BackwardSensorTypeLut init_backward_sensor_type_lut() { static BackwardSensorTypeLut lut; lut.add(ASENSOR_TYPE_ACCELEROMETER, sensor_type_accelerometer); lut.add(ASENSOR_TYPE_MAGNETIC_FIELD, sensor_type_magnetic_field); lut.add(ASENSOR_TYPE_GYROSCOPE, sensor_type_gyroscope); lut.add(ASENSOR_TYPE_LIGHT, sensor_type_light); lut.add(ASENSOR_TYPE_PROXIMITY, sensor_type_proximity); lut.add(SENSOR_TYPE_ORIENTATION, sensor_type_orientation); lut.add(SENSOR_TYPE_LINEAR_ACCELERATION, sensor_type_linear_acceleration); lut.add(SENSOR_TYPE_ROTATION_VECTOR, sensor_type_rotation_vector); return lut; } static const ForwardSensorTypeLut forward_sensor_type_lut = init_forward_sensor_type_lut(); static const BackwardSensorTypeLut backward_sensor_type_lut = init_backward_sensor_type_lut(); struct Sensor : public ubuntu::application::sensors::Sensor { typedef ubuntu::platform::shared_ptr Ptr; Sensor( const android::Sensor* sensor, const android::sp& queue) : sensor(sensor), sensor_event_queue(queue) { }; int32_t id() { return sensor->getHandle(); } const char* name() { return sensor->getName().string(); } const char* vendor() { return sensor->getVendor().string(); } void register_listener(const SensorListener::Ptr& listener) { listeners.push_back(listener); } // Deprecated! const SensorListener::Ptr& registered_listener() { return *(listeners.begin()); } const android::List& registered_listeners() const { return listeners; } int enable() { return sensor_event_queue->enableSensor(sensor); } int disable() { return sensor_event_queue->disableSensor(sensor); } SensorType type() { return backward_sensor_type_lut.valueFor(sensor->getType()); } float min_value() { return sensor->getMinValue(); } float max_value() { return sensor->getMaxValue(); } float resolution() { return sensor->getResolution(); } int32_t min_delay() { return sensor->getMinDelay(); } float power_consumption() { return sensor->getPowerUsage(); } int set_event_rate(uint32_t nsecs) { return sensor_event_queue->setEventRate(sensor, nsecs); } const android::Sensor* sensor; ubuntu::application::sensors::SensorListener::Ptr listener; android::List listeners; android::sp sensor_event_queue; }; void print_vector(const ASensorVector& vec) { printf("Status: %d \n", vec.status); printf("\t\t %f, %f, %f \n", vec.v[0], vec.v[1], vec.v[2]); printf("\t\t %f, %f, %f \n", vec.x, vec.y, vec.z); printf("\t\t %f, %f, %f \n", vec.azimuth, vec.pitch, vec.roll); } struct SensorService : public ubuntu::application::sensors::SensorService { static int looper_callback(int receiveFd, int events, void* ctxt) { static const int success_and_continue = 1; static const int error_and_abort = 0; SensorService* thiz = static_cast(ctxt); if (!thiz) return error_and_abort; if (thiz->sensor_event_queue->getFd() != receiveFd) return success_and_continue; static ASensorEvent event; if (1 != thiz->sensor_event_queue->read(&event, 1)) return error_and_abort; ssize_t i = thiz->sensor_registry.indexOfKey(event.sensor); if (i < 0) return success_and_continue; Sensor::Ptr sensor = thiz->sensor_registry.valueAt(i); static ubuntu::application::sensors::SensorReading::Ptr reading( new ubuntu::application::sensors::SensorReading()); reading->timestamp = event.timestamp; switch (event.type) { case ASENSOR_TYPE_ACCELEROMETER: memcpy( reading->acceleration.v, event.acceleration.v, sizeof(reading->acceleration.v)); break; case ASENSOR_TYPE_MAGNETIC_FIELD: memcpy( reading->magnetic.v, event.magnetic.v, sizeof(reading->magnetic.v)); break; case ASENSOR_TYPE_GYROSCOPE: memcpy( reading->acceleration.v, event.acceleration.v, sizeof(reading->acceleration.v)); break; case ASENSOR_TYPE_LIGHT: reading->light = event.light; break; case ASENSOR_TYPE_PROXIMITY: reading->distance = event.distance; break; case SENSOR_TYPE_ORIENTATION: reading->vector.v[0] = event.vector.azimuth; reading->vector.v[1] = event.vector.pitch; reading->vector.v[2] = event.vector.roll; break; case SENSOR_TYPE_LINEAR_ACCELERATION: memcpy( reading->acceleration.v, event.acceleration.v, sizeof(reading->acceleration.v)); break; case SENSOR_TYPE_ROTATION_VECTOR: reading->vector.v[0] = event.data[0]; reading->vector.v[1] = event.data[1]; reading->vector.v[2] = event.data[2]; break; } // Call all of the registered listeners android::List::const_iterator it = sensor->registered_listeners().begin(); while (it != sensor->registered_listeners().end()) { (*it)->on_new_reading(reading); ++it; } return success_and_continue; } SensorService() : sensor_event_queue(android::SensorManager::getInstance().createEventQueue()), looper(new android::Looper(false)), event_loop(new ubuntu::application::EventLoop(looper)) { looper->addFd( sensor_event_queue->getFd(), 0, ALOOPER_EVENT_INPUT, looper_callback, this); event_loop->run(); } android::sp sensor_event_queue; android::sp looper; android::sp event_loop; android::KeyedVector sensor_registry; }; ubuntu::platform::shared_ptr instance; } ubuntu::application::sensors::Sensor::Ptr ubuntu::application::sensors::SensorService::sensor_for_type( ubuntu::application::sensors::SensorType type) { const android::Sensor* sensor = android::SensorManager::getInstance().getDefaultSensor( hybris::forward_sensor_type_lut.valueFor(type)); if (sensor == NULL) return Sensor::Ptr(); if (hybris::instance == NULL) hybris::instance = new hybris::SensorService(); hybris::Sensor::Ptr p( new hybris::Sensor( sensor, hybris::instance->sensor_event_queue)); if (sensor) hybris::instance->sensor_registry.add(p->id(), p); return Sensor::Ptr(p.get()); } } } } platform-api-3.0.1+16.04.20160203/TODO.txt0000644000015600001650000000046312654347715017773 0ustar pbuserpbgroup00000000000000TODO: ----- * Make sure the libraries are all self-contained at their own path, to avoid conflicts * Review headers to know which ones should not be exported by the package * Make sure the package is lintian free * Get the -headers package to be arch all, not used for now due restriction at Launchpad PPA platform-api-3.0.1+16.04.20160203/data/0000755000015600001650000000000012654350173017363 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/data/ubuntu-platform-api.pc.in0000644000015600001650000000064312654347715024242 0ustar pbuserpbgroup00000000000000prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} libdir=${prefix}/@LIB_INSTALL_DIR@ includedir=${exec_prefix}/include Name: @CMAKE_PROJECT_NAME@ Description: Ubuntu's platform abstraction layer. Version: @UBUNTU_PLATFORM_API_VERSION_MAJOR@.@UBUNTU_PLATFORM_API_VERSION_MINOR@.@UBUNTU_PLATFORM_API_VERSION_PATCH@ Libs: -L${libdir} -lubuntu_application_api Cflags: -I${includedir}/ubuntu Requires.private: mirclient platform-api-3.0.1+16.04.20160203/data/ubuntu-platform-hardware-api.pc.in0000644000015600001650000000063612654347715026037 0ustar pbuserpbgroup00000000000000prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} libdir=${prefix}/@LIB_INSTALL_DIR@ includedir=${exec_prefix}/include Name: ubuntu_platform_hardware_api Description: Ubuntu's platform hardware abstraction layer. Version: @UBUNTU_PLATFORM_API_VERSION_MAJOR@.@UBUNTU_PLATFORM_API_VERSION_MINOR@.@UBUNTU_PLATFORM_API_VERSION_PATCH@ Libs: -L${libdir} -lubuntu_platform_hardware_api Cflags: -I${includedir}/ubuntu platform-api-3.0.1+16.04.20160203/data/CMakeLists.txt0000644000015600001650000000054612654347715022140 0ustar pbuserpbgroup00000000000000configure_file( ubuntu-platform-api.pc.in ubuntu-platform-api.pc @ONLY ) configure_file( ubuntu-platform-hardware-api.pc.in ubuntu-platform-hardware-api.pc @ONLY ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/ubuntu-platform-api.pc ${CMAKE_CURRENT_BINARY_DIR}/ubuntu-platform-hardware-api.pc DESTINATION lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig ) platform-api-3.0.1+16.04.20160203/COPYING.LGPL0000644000015600001650000001674312654347715020265 0ustar pbuserpbgroup00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. 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 that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. platform-api-3.0.1+16.04.20160203/CMakeLists.txt0000644000015600001650000000506112654347715021224 0ustar pbuserpbgroup00000000000000cmake_minimum_required(VERSION 2.6) project(ubuntu-platform-api) set(UBUNTU_PLATFORM_API_VERSION_MAJOR 3) set(UBUNTU_PLATFORM_API_VERSION_MINOR 0) set(UBUNTU_PLATFORM_API_VERSION_PATCH 0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") if (CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE]) set(CMAKE_GCOV gcov) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs" ) SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" ) SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" ) endif (CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE]) set(BIN_INSTALL_DIR bin) set(LIB_INSTALL_DIR lib/${CMAKE_LIBRARY_ARCHITECTURE}) set(INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${BIN_INSTALL_DIR}" LIBRARY DESTINATION "${LIB_INSTALL_DIR}" ARCHIVE DESTINATION "${LIB_INSTALL_DIR}") #### Detect if we have got gles2, and fall back to plain gl if not #### set(UBUNTU_PLATFORM_API_HAVE_GLES2 0) find_path( GLES2_INCLUDE_PATH GLES2/gl2.h ) if (GLES2_INCLUDE_PATH) message(STATUS "GLES2 found in ${GLES2_INCLUDE_PATH}") set(UBUNTU_PLATFORM_API_HAVE_GLES2 1) else (GLES2_INCLUDE_PATH) message(STATUS "GLES2 not found, falling back to plain GL") endif (GLES2_INCLUDE_PATH) #### Detect if we have got gles2, and fall back to plain gl if not #### #### Detect if we have EGL/egl.h, and bail out if not #### find_path( EGL_INCLUDE_PATH EGL/egl.h ) if (NOT EGL_INCLUDE_PATH) message(ERROR EGL not found) else (NOT EGL_INCLUDE_PATH) message(STATUS "EGL found in ${EGL_INCLUDE_PATH}") endif (NOT EGL_INCLUDE_PATH) #### Detect if we have EGL/egl.h, and bail out if not #### option( ENABLE_HYBRIS_IMPLEMENTATION "Enable hybris based platform API implementation" ON ) find_package(PkgConfig) pkg_check_modules(MIRCLIENT REQUIRED mirclient) # Try to find hybris, and disable hybris from build if not found find_library(Hybris NAMES hybris-common ) if(NOT Hybris) message(STATUS "Notice: libhybris-common.so not found, disabling hybris support") set(ENABLE_HYBRIS_IMPLEMENTATION OFF) endif() include_directories(include) include_directories(android/include) include_directories( ${MIRCLIENT_INCLUDE_DIRS} ) add_subdirectory(data/) add_subdirectory(doc/) add_subdirectory(include/) add_subdirectory(src/) add_subdirectory(examples/) #### Enable tests include(CTest) set(GTEST_ROOT /usr/src/gtest) add_subdirectory(tests/) add_subdirectory(${GTEST_ROOT} ${CMAKE_CURRENT_BINARY_DIR}/gtest) platform-api-3.0.1+16.04.20160203/examples/0000755000015600001650000000000012654350173020270 5ustar pbuserpbgroup00000000000000platform-api-3.0.1+16.04.20160203/examples/test_sensors_api.cpp0000644000015600001650000000755512654347715024404 0ustar pbuserpbgroup00000000000000/* * Copyright © 2014 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #include #include #include #define __STDC_FORMAT_MACROS #include #include #include #include #include void on_new_accelerometer_event(UASAccelerometerEvent* event, void* context) { float x; uas_accelerometer_event_get_acceleration_x(event, &x); float y; uas_accelerometer_event_get_acceleration_y(event, &y); float z; uas_accelerometer_event_get_acceleration_z(event, &z); printf("%s \n", __PRETTY_FUNCTION__); printf("\ttime: %" PRIu64 "\n", uas_accelerometer_event_get_timestamp(event)); printf("\tx: %f\n", x); printf("\ty: %f\n", y); printf("\tz: %f\n", z); } void on_new_proximity_event(UASProximityEvent* event, void* context) { printf("%s \n", __PRETTY_FUNCTION__); printf("\ttime: %" PRIu64 "\n", uas_proximity_event_get_timestamp(event)); switch (uas_proximity_event_get_distance(event)) { case U_PROXIMITY_NEAR: { printf("\tdistance: NEAR\n"); break; } case U_PROXIMITY_FAR: { printf("\tdistance: FAR\n"); break; } } } void on_new_light_event(UASLightEvent* event, void* context) { float light = -1.f; uas_light_event_get_light(event, &light); printf("%s \n", __PRETTY_FUNCTION__); printf("\ttime: %" PRIu64 "\n", uas_light_event_get_timestamp(event)); printf("\tlight: %f\n", light); } void on_new_orientation_event(UASOrientationEvent* event, void* context) { float x; uas_orientation_event_get_azimuth(event, &x); float y; uas_orientation_event_get_pitch(event, &y); float z; uas_orientation_event_get_roll(event, &z); printf("%s \n", __PRETTY_FUNCTION__); printf("\ttime: %" PRIu64 "\n", uas_orientation_event_get_timestamp(event)); printf("\tx: %f\n", x); printf("\ty: %f\n", y); printf("\tz: %f\n", z); } int main(int argc, char** argv) { UASensorsAccelerometer* accelerometer = ua_sensors_accelerometer_new(); UASensorsProximity* proximity = ua_sensors_proximity_new(); UASensorsLight* ambientlight = ua_sensors_light_new(); UASensorsOrientation* orientation = ua_sensors_orientation_new(); ua_sensors_accelerometer_set_reading_cb(accelerometer, on_new_accelerometer_event, NULL); ua_sensors_proximity_set_reading_cb(proximity, on_new_proximity_event, NULL); ua_sensors_light_set_reading_cb(ambientlight, on_new_light_event, NULL); ua_sensors_orientation_set_reading_cb(orientation, on_new_orientation_event, NULL); ua_sensors_accelerometer_enable(accelerometer); ua_sensors_proximity_enable(proximity); ua_sensors_light_enable(ambientlight); ua_sensors_orientation_enable(orientation); while(true) { } } platform-api-3.0.1+16.04.20160203/examples/test_haptic_device.cpp0000644000015600001650000000247112654347715024636 0ustar pbuserpbgroup00000000000000/* * Copyright © 2014 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Ricardo Mendoza */ #include #include #include #include int main(int argc, char *argv[]) { UASensorsHaptic *sensor = ua_sensors_haptic_new(); if (!sensor) { printf("Haptic device unavailable\n"); return 1; } printf("Vibrating once for 1500ms\n"); ua_sensors_haptic_vibrate_once(sensor, 1500); sleep(3); printf("Vibrating with pattern 6*1500, repeat twice.\n"); uint32_t pattern[MAX_PATTERN_SIZE] = {1500, 1500, 1500, 1500, 1500, 1500}; ua_sensors_haptic_vibrate_with_pattern(sensor, pattern, 2); return 0; } platform-api-3.0.1+16.04.20160203/examples/CMakeLists.txt0000644000015600001650000000131212654347715023035 0ustar pbuserpbgroup00000000000000include_directories( ${CMAKE_BINARY_DIR}/include ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC -Wl,--no-as-needed -pthread") add_executable(test_android_sensors_api test_sensors_api.cpp) target_link_libraries(test_android_sensors_api ubuntu_application_api) add_executable(test_ubuntu_app_api_location_service test_location_api.cpp) target_link_libraries(test_ubuntu_app_api_location_service ubuntu_application_api) add_executable(test_ubuntu_haptic_device test_haptic_device.cpp) target_link_libraries(test_ubuntu_haptic_device ubuntu_application_api) install(TARGETS test_android_sensors_api test_ubuntu_app_api_location_service test_ubuntu_haptic_device DESTINATION bin ) platform-api-3.0.1+16.04.20160203/examples/test_location_api.cpp0000644000015600001650000000641112654347715024506 0ustar pbuserpbgroup00000000000000/* * Copyright © 2014 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program 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 program. If not, see . * * Authored by: Thomas Voss */ #include #include #include #include #include #include #include #define __STDC_FORMAT_MACROS #include namespace { void on_position_updated(UALocationPositionUpdate* update, void*) { printf("%s@%" PRIu64 ": (%f, %f, %f) \n", __PRETTY_FUNCTION__, ua_location_position_update_get_timestamp(update), ua_location_position_update_get_latitude_in_degree(update), ua_location_position_update_get_longitude_in_degree(update), ua_location_position_update_has_altitude(update) ? ua_location_position_update_get_altitude_in_meter(update) : 0); } void on_heading_updated(UALocationHeadingUpdate* update, void*) { printf("%s@%" PRIu64 ": %f \n", __PRETTY_FUNCTION__, ua_location_heading_update_get_timestamp(update), ua_location_heading_update_get_heading_in_degree(update)); } void on_velocity_updated(UALocationVelocityUpdate* update, void*) { printf("%s@%" PRIu64 ": %f \n", __PRETTY_FUNCTION__, ua_location_velocity_update_get_timestamp(update), ua_location_velocity_update_get_velocity_in_meters_per_second(update)); } void wait_for_sigint() { sigset_t signals; sigemptyset(&signals); sigaddset(&signals, SIGINT); int sig; int result = sigwait(&signals, &sig); if (result != 0) printf("sigwait failed!\n"); } } int main(int argc, char** argv) { UALocationServiceSession* session = ua_location_service_create_session_for_high_accuracy(0); ua_location_service_session_set_position_updates_handler( session, on_position_updated, NULL); ua_location_service_session_set_heading_updates_handler( session, on_heading_updated, NULL); ua_location_service_session_set_velocity_updates_handler( session, on_velocity_updated, NULL); ua_location_service_session_start_position_updates(session); ua_location_service_session_start_heading_updates(session); ua_location_service_session_start_velocity_updates(session); wait_for_sigint(); ua_location_service_session_stop_position_updates(session); ua_location_service_session_stop_heading_updates(session); ua_location_service_session_stop_velocity_updates(session); ua_location_service_session_unref(session); return 0; }