# HG changeset patch # User David Caabeiro # Date 1277463005 -7200 # Node ID c316ab048e9d49da41be2381215488a8f7ff8c0d First public commit diff -r 000000000000 -r c316ab048e9d Doxyfile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Doxyfile Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,1417 @@ +# Doxyfile 1.5.6 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = OpenMAR + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# 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, 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, Slovak, Slovene, Spanish, Swedish, +# and Ukrainian. + +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 is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = 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 = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = 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 to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = 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 namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# 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 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_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , 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 = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , 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, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = 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 and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +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 = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the 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_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. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_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 + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to FRAME, 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 (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. Other possible values +# for this tag are: HIERARCHIES, which will generate the Groups, Directories, +# and Class Hiererachy pages using a tree view instead of an ordered list; +# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which +# disables this behavior completely. For backwards compatibility with previous +# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE +# respectively. + +GENERATE_TREEVIEW = NONE + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +#--------------------------------------------------------------------------- +# 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. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = 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 +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = 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 = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# By default doxygen will write a font called FreeSans.ttf to the output +# directory and reference it in all dot files that doxygen generates. This +# font does not include all possible unicode characters however, so when you need +# these (or just want a differently looking font) you can specify the font name +# using DOT_FONTNAME. You need need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = FreeSans + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = 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 set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is enabled by default, which results in a transparent +# background. 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 = NO + +# 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 + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff -r 000000000000 -r c316ab048e9d SymbianSigned.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SymbianSigned.txt Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,27 @@ +#Assigned UIDs + +0x2002E1AB Main application +0x2002E1AC KOverlayInterfaceUidValue +0x2002E1AD KProviderInterfaceUidValue +0x2002E1AE KObjectInterfaceUidValue + +# Landmarks +0x2002E1AF KDllUidValue / KOverlayImplementationUidValue +0x2002E1B0 KProviderImplementationUidValue +0x2002E1B1 KObjectImplementationUidValue + +# Geonames +0x2002E1B2 KDllUidValue / KProviderImplementationUidValue +0x2002E1B3 KObjectImplementationUidValue + +0x2002E1B4 +0x2002E1B5 +0x2002E1B6 +0x2002E1B7 +0x2002E1B8 +0x2002E1B9 +0x2002E1BA +0x2002E1BB +0x2002E1BC +0x2002E1BD +0x2002E1BE \ No newline at end of file diff -r 000000000000 -r c316ab048e9d browser/data/Application.rls --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/data/Application.rls Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,29 @@ +/* + * Name : Application.rls + * Description : Localisation strings + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +// LOCALISATION STRINGS + +// Caption string for app. +#define qtn_caption_string "OpenMAR" + +#define qtn_about "About" +#define qtn_exit "Exit" + +#define qtn_loc_resource_file "\\resource\\apps\\OpenMAR_0x2002E1AB" + +#define qtn_about_dialog_title "About" +#define qtn_about_dialog_text "OpenMAR Version 1.0.0\n\nSupport: support@OpenMAR.org\n\n(c) 2010 David Caabeiro" + +#define qtn_screenshot_text_ok "Screenshot saved in %S" +#define qtn_screenshot_text_error "Screenshot error %d" diff -r 000000000000 -r c316ab048e9d browser/data/Application.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/data/Application.rss Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,218 @@ +/* + * Name : Application.rss + * Description : Application resource file + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +NAME ARXX // 4 letter ID + +// INCLUDES +#include +#include +#include +#include + +#include "Application.hrh" +#include "Application.rls" + +RESOURCE RSS_SIGNATURE +{ +} + +RESOURCE TBUF r_default_document_name +{ +} + +RESOURCE EIK_APP_INFO +{ +// cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; +} + +RESOURCE AVKON_VIEW r_splash_view +{ +} + +RESOURCE AVKON_VIEW r_ar_view +{ +// cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; +// menubar = r_ar_menubar; +// toolbar = r_ar_toolbar; +} + +RESOURCE MENU_BAR r_ar_menubar +{ + titles = + { + MENU_TITLE { menu_pane = r_ar_menu; } + }; +} + +RESOURCE MENU_PANE r_ar_menu +{ + items = + { + MENU_ITEM + { + command = EAbout; + txt = qtn_about; + }, + MENU_ITEM + { + command = EAknSoftkeyExit; + txt = qtn_exit; + } + }; +} + +/* +RESOURCE AVKON_TOOLBAR r_ar_toolbar +{ +// flags = KAknToolbarFixed | KAknToolbarDsaMode; + flags = KAknToolbarFixed; + items = + { + TBAR_CTRL + { + type = EAknCtButton; + id = EHelp; + control = AVKON_BUTTON + { + flags = KAknButtonNoFrame; + states = + { + AVKON_BUTTON_STATE + { + txt = "Option1"; + helptxt = ""; + } + }; + }; + } + , + TBAR_CTRL + { + type = EAknCtButton; + id = EHelp; + control = AVKON_BUTTON + { + flags = KAknButtonNoFrame; + states = + { + AVKON_BUTTON_STATE + { + txt = "Option2"; + helptxt = ""; + } + }; + }; + } + , + TBAR_CTRL + { + type = EAknCtButton; + id = EHelp; + control = AVKON_BUTTON + { + flags = KAknButtonNoFrame; + states = + { + AVKON_BUTTON_STATE + { + txt = "Option3"; + helptxt = ""; + } + }; + }; + } + , + TBAR_CTRL + { + type = EAknCtToolbarExtension; + id = ECmdDataSource; + + control = AVKON_TOOLBAR_EXTENSION + { + flags = KAknButtonNoFrame | KAknTbExtensionDsaMode | KAknTbExtensionTransparent; + }; + } + }; +} +*/ + + + +RESOURCE DIALOG r_about_query_dialog +{ + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + itemflags = EEikDlgItemNonFocusing; + control = AVKON_HEADING + { + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + }; + } + }; +} + +RESOURCE DIALOG r_wait_dialog +{ + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EDialogWait; + control = AVKON_NOTE + { + layout = EWaitLayout; + singular_label = qtn_wait_text; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; +} + + +RESOURCE TBUF r_caption_string { buf = qtn_caption_string; } +RESOURCE TBUF r_about_dialog_title { buf = qtn_about_dialog_title; } +RESOURCE TBUF r_about_dialog_text { buf = qtn_about_dialog_text; } + +RESOURCE TBUF r_screenshot_text_ok { buf = qtn_screenshot_text_ok; } +RESOURCE TBUF r_screenshot_text_error { buf = qtn_screenshot_text_error; } + + +RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info +{ + short_caption = qtn_caption_string; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = qtn_caption_string; + + number_of_icons = 1; + icon_file = "\\resource\\apps\\OpenMAR_0x2002E1AB.mif"; + }; +} diff -r 000000000000 -r c316ab048e9d browser/data/Application_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/data/Application_reg.rss Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,32 @@ +/* + * Name : Application_reg.rss + * Description : Application registration file + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Application.hrh" +#include "Application.rls" + +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 _UID3 + +RESOURCE APP_REGISTRATION_INFO +{ + app_file = "OpenMAR_0x2002E1AB"; + localisable_resource_file = qtn_loc_resource_file; + localisable_resource_id = R_LOCALISABLE_APP_INFO; + + embeddability = KAppNotEmbeddable; + newfile = KAppDoesNotSupportNewFile; +} diff -r 000000000000 -r c316ab048e9d browser/engine/inc/Camera.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/engine/inc/Camera.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,77 @@ +/* + * Name : Camera.h + * Description : Camera helper class + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef CAMERA_H_ +#define CAMERA_H_ + +#include + +class CFbsBitmap; + +/** + * @brief Wrapper class over CCamera + * + * Implemented to use the minimum frame size + */ +class CDigitalCamera : public CBase, + public MCameraObserver, + public MCameraObserver2 +{ +public: + class MObserver + { + public: + virtual void CameraReady(TInt aError) = 0; + virtual void CameraFrame(CFbsBitmap& aFrame) = 0; + virtual void FocusReady(TInt aError) = 0; + }; + +public: + static CDigitalCamera* NewL(MObserver& aObserver); + ~CDigitalCamera(); + +protected: + CDigitalCamera(MObserver& aObserver); + void ConstructL(); + +public: + void Start(); + void Stop(); + + void StartFocus(); + + const TSize& ViewportSize() const { return iViewportSize; } + +protected: + // From MCameraObserver + void ReserveComplete(TInt aError); + void PowerOnComplete(TInt aError); + void ViewFinderFrameReady(CFbsBitmap& aFrame); + void ImageReady(CFbsBitmap* aBitmap, HBufC8* aData, TInt aError); + void FrameBufferReady(MFrameBuffer* aFrameBuffer, TInt aError); + + // From MCameraObserver2 + void HandleEvent(const TECAMEvent& aEvent); + void ViewFinderReady(MCameraBuffer& aCameraBuffer, TInt aError); + void ImageBufferReady(MCameraBuffer& aCameraBuffer, TInt aError); + void VideoBufferReady(MCameraBuffer& aCameraBuffer, TInt aError); + +private: + MObserver& iObserver; + CCamera* iCamera; + CCamera::CCameraAdvancedSettings* iCameraSetting; + TSize iViewportSize; +}; + +#endif diff -r 000000000000 -r c316ab048e9d browser/engine/inc/ConnectionManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/engine/inc/ConnectionManager.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,65 @@ +/* + * Name : ConnectionManager.h + * Description : Manages application connection + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef CONNECTIONMANAGER_H_ +#define CONNECTIONMANAGER_H_ + +#include +#include +#include + +class CSettingManager; + +/** + * @brief Notifies the status of the started connection + */ +class MConnectionManager +{ +public: + virtual void ConnectionStartedL(TInt aError) = 0; +}; + +/** + * @brief Initializes a working connection + * + */ +class CConnectionManager : public CActive, public MConnectionMonitorObserver +{ +public: + static CConnectionManager* NewL(MConnectionManager& aObserver, CSettingManager& aSetting); + ~CConnectionManager(); + +protected: + CConnectionManager(MConnectionManager& aObserver, CSettingManager& aSetting); + void ConstructL(); + + // From CActive + void RunL(); + void DoCancel(); + + // From MConnectionMonitorObserver + void EventL(const CConnMonEventBase& aEvent); + +private: + MConnectionManager& iObserver; + CSettingManager& iSetting; + + RSocketServ iSocketServ; + RConnection iConnection; + RConnectionMonitor iMonitor; + + TUint32 iIapId; +}; + +#endif diff -r 000000000000 -r c316ab048e9d browser/engine/inc/ResetAndDestroy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/engine/inc/ResetAndDestroy.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,27 @@ +/* + * Helper classes + */ + +//#include + +/* + * Function passed in as a parameter to TCleanupItem constructor to reset and + * destroy the received aPtr. + * @param aPtr A pointer to the object that is to be cleaned up + */ +inline void ResetAndDestroy(TAny* aPtr) +{ + reinterpret_cast(aPtr)->ResetAndDestroy(); +} + +/* + * Function that creates a cleanup item for aArray and specifies the cleanup + * function as ResetAndDestroy. When the item is removed from the cleanup stack + * the function ResetAndDestroy will be called on aArray. + * @param aArray The array to be destroyed. + */ +inline void CleanupResetAndDestroyPushL(RImplInfoPtrArray& aArray) +{ + TCleanupItem item(ResetAndDestroy, &aArray); + CleanupStack::PushL(item); +} diff -r 000000000000 -r c316ab048e9d browser/engine/inc/Screenshot.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/engine/inc/Screenshot.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,64 @@ +/* + * Name : Screenshot.h + * Description : Performs screenshot and bitmap conversion + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef SCREENSHOT_H_ +#define SCREENSHOT_H_ + +#include +#include + +class TSize; + +class CFbsBitmap; +class CFbsBitmapDevice; +class CFbsBitGc; + +class CImageEncoder; + +class CScreenshot : public CActive +{ +public: + class MObserver + { + public: + virtual void ScreenshotReadyL(TInt aError, const TDesC& aFilename) = 0; + }; + +public: + static CScreenshot* NewL(MObserver& aObserver, const TSize& aSize, const TDisplayMode& aDisplayMode); + ~CScreenshot(); + +protected: + CScreenshot(MObserver& aObserver); + void ConstructL(const TSize& aSize, const TDisplayMode& aDisplayMode); + +public: + void RequestL(const CFbsBitmap& aSourceBitmap, const TSize& aSize); + +protected: + void RunL(); + void DoCancel(); + +private: + MObserver& iObserver; + + CFbsBitmap* iBitmap; + CFbsBitmapDevice* iBitmapDevice; + CFbsBitGc* iBitmapContext; + + TFileName iFilename; + CImageEncoder* iEncoder; +}; + +#endif diff -r 000000000000 -r c316ab048e9d browser/engine/inc/SettingManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/engine/inc/SettingManager.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,37 @@ +/* + * Name : SettingManager.h + * Description : Manages application settings + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef SETTINGMANAGER_H_ +#define SETTINGMANAGER_H_ + +#include + +/** + * @brief Manages application global settings + * + */ +class CSettingManager : public CBase +{ +public: + static CSettingManager* NewL(); + ~CSettingManager(); + +protected: + CSettingManager(); + void ConstructL(); + +private: +}; + +#endif diff -r 000000000000 -r c316ab048e9d browser/engine/src/Camera.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/engine/src/Camera.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,161 @@ +/* + * Name : Camera.cpp + * Description : Camera helper class + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Camera.h" + +#include +#include + +#include "Logger.h" + +CDigitalCamera* CDigitalCamera::NewL(MObserver& aObserver) +{ + CDigitalCamera* self = new(ELeave) CDigitalCamera(aObserver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +CDigitalCamera::~CDigitalCamera() +{ + delete iCameraSetting; + delete iCamera; +} + +CDigitalCamera::CDigitalCamera(MObserver& aObserver) + : iObserver(aObserver), iViewportSize(KMaxTInt, KMaxTInt) +{} + +void CDigitalCamera::ConstructL() +{ + TInt cameraCount = CCamera::CamerasAvailable(); + + LOGARG("Camera count is %d", cameraCount); + + // Use main camera (index 0) + iCamera = CCamera::New2L(*this, 0, 0); + iCameraSetting = CCamera::CCameraAdvancedSettings::NewL(*iCamera); + + TCameraInfo cameraInfo; + iCamera->CameraInfo(cameraInfo); + + LOGTXT("Camera capture sizes supported:"); + + for (TInt i = 0; i < cameraInfo.iNumImageSizesSupported; ++i) + { + TSize size; + iCamera->EnumerateCaptureSizes(size, i, CCamera::EFormatExif); + + if (iViewportSize.iWidth > size.iWidth && iViewportSize.iHeight > size.iHeight) + iViewportSize = size; + + LOGARG("Index %d Size %d x %d", i, size.iWidth, size.iHeight); + } + + LOGARG("Using smallest viewport: %d x %d", iViewportSize.iWidth, iViewportSize.iHeight); +} + +void CDigitalCamera::Start() +{ + iCamera->Reserve(); +} + +void CDigitalCamera::Stop() +{ + iCamera->Release(); +} + +void CDigitalCamera::StartFocus() +{ + iCameraSetting->SetAutoFocusType(CCamera::CCameraAdvancedSettings::EAutoFocusTypeSingle); +} + +void CDigitalCamera::ReserveComplete(TInt aError) +{ + if (aError) + { + LOGARG("Camera reserve complete error %d", aError); + iObserver.CameraReady(aError); + } + else + iCamera->PowerOn(); +} + +void CDigitalCamera::PowerOnComplete(TInt aError) +{ + TCameraInfo cameraInfo; + iCamera->CameraInfo(cameraInfo); + + if ((aError == KErrNone) && + (cameraInfo.iOptionsSupported & TCameraInfo::EViewFinderBitmapsSupported) && + (cameraInfo.iOrientation == TCameraInfo::EOrientationOutwards)) + { + TSize requestSize(iViewportSize); + + LOGARG("Requesting viewfinder size %d x %d", requestSize.iWidth, requestSize.iHeight); + TRAPD(error, iCamera->StartViewFinderL(CCamera::EFormatFbsBitmapColor16MU, requestSize)); + LOGARG("Obtaining viewfinder size %d x %d", requestSize.iWidth, requestSize.iHeight); + + iObserver.CameraReady(error); + } + else + { + // Either power complete error or viewfinder bitmap unsupported + iObserver.CameraReady(KErrNotSupported); + } +} + +void CDigitalCamera::ViewFinderFrameReady(CFbsBitmap& aFrame) +{ + iObserver.CameraFrame(aFrame); +} + +void CDigitalCamera::ImageReady(CFbsBitmap* /*aBitmap*/, HBufC8* /*aData*/, TInt /*aError*/) +{} + +void CDigitalCamera::FrameBufferReady(MFrameBuffer* /*aFrameBuffer*/, TInt /*aError*/) +{} + +void CDigitalCamera::HandleEvent(const TECAMEvent& aEvent) +{ + if (aEvent.iEventType == KUidECamEventReserveComplete) + ReserveComplete(aEvent.iErrorCode); + else if (aEvent.iEventType == KUidECamEventPowerOnComplete) + PowerOnComplete(aEvent.iErrorCode); + else if (aEvent.iEventType == KUidECamEventCameraSettingFocusRange || + aEvent.iEventType == KUidECamEventCameraSettingFocusRange2) + ; + else if (aEvent.iEventType == KUidECamEventCameraSettingAutoFocusType || + aEvent.iEventType == KUidECamEventCameraSettingAutoFocusType2) + ; + else if (aEvent.iEventType == KUidECamEventCameraSettingsOptimalFocus) + iObserver.FocusReady(aEvent.iErrorCode); + + LOGARG("Camera event %x (error %d)", aEvent.iEventType, aEvent.iErrorCode); +} + +void CDigitalCamera::ViewFinderReady(MCameraBuffer& aCameraBuffer, TInt /*aError*/) +{ + CFbsBitmap& bitmap = aCameraBuffer.BitmapL(0); + ViewFinderFrameReady(bitmap); + aCameraBuffer.Release(); +} + +void CDigitalCamera::ImageBufferReady(MCameraBuffer& /*aCameraBuffer*/, TInt /*aError*/) +{} + +void CDigitalCamera::VideoBufferReady(MCameraBuffer& /*aCameraBuffer*/, TInt /*aError*/) +{} diff -r 000000000000 -r c316ab048e9d browser/engine/src/ConnectionManager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/engine/src/ConnectionManager.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,129 @@ +/* + * Name : ConnectionManager.cpp + * Description : Manages application connection + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "ConnectionManager.h" + +#include "SettingManager.h" + +#include +#include + +#include "Logger.h" + +CConnectionManager* CConnectionManager::NewL(MConnectionManager& aObserver, CSettingManager& aSetting) +{ + CConnectionManager* self = new(ELeave) CConnectionManager(aObserver, aSetting); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +CConnectionManager::~CConnectionManager() +{ + Cancel(); + + iMonitor.Close(); + iConnection.Close(); + iSocketServ.Close(); +} + +CConnectionManager::CConnectionManager(MConnectionManager& aObserver, CSettingManager& aSetting) + : CActive(CActive::EPriorityStandard), iObserver(aObserver), iSetting(aSetting) +{ + CActiveScheduler::Add(this); +} + +void CConnectionManager::ConstructL() +{ + LOGTXT("Initializing connection.."); + + User::LeaveIfError(iSocketServ.Connect()); + User::LeaveIfError(iConnection.Open(iSocketServ)); + + iMonitor.ConnectL(); + iMonitor.NotifyEventL(*this); + +// _LIT8(KDefault, "/application/destination"); + TUint destinationId = 0; +// iSettings.Get(KDefault, destinationId, EHex); + + if (destinationId == 0) + { + // "Always ask" + TCommDbConnPref pref; + pref.SetDialogPreference(ECommDbDialogPrefPrompt); + + iConnection.Start(pref, iStatus); + } + else + { + TConnSnapPref pref; + pref.SetSnap(destinationId); + + iConnection.Start(pref, iStatus); + } + + SetActive(); +} + +void CConnectionManager::RunL() +{ + _LIT(KIapId, "IAP\\Id"); + iConnection.GetIntSetting(KIapId, iIapId); + + LOGARG("Connected with iap %u", iIapId); + + iObserver.ConnectionStartedL(iStatus.Int()); +} + +void CConnectionManager::DoCancel() +{ + // Unfortunately no RConnection::StartCancel() available.. +} + +void CConnectionManager::EventL(const CConnMonEventBase& aEvent) +{ + switch (aEvent.EventType()) + { +/* + case EConnMonConnectionStatusChange: + { + const CConnMonNetworkStatusChange& event = static_cast(aEvent); + break; + } +*/ + case EConnMonDeleteConnection: + { + TUint count = 0; + iConnection.EnumerateConnections(count); + + if (count == 0) + LOGTXT("Connection dropped"); + +/* + if (info().iIapId == iIapId) + { + connFound = ETrue; + break; + } +*/ + break; + } + + default: + break; + } +} diff -r 000000000000 -r c316ab048e9d browser/engine/src/Screenshot.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/engine/src/Screenshot.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,103 @@ +/* + * Name : Screenshot.cpp + * Description : Performs screenshot and bitmap conversion + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Screenshot.h" + +#include +#include +#include +#include +#include + +#include "Logger.h" + +CScreenshot* CScreenshot::NewL(MObserver& aObserver, const TSize& aSize, const TDisplayMode& aDisplayMode) +{ + CScreenshot* self = new(ELeave) CScreenshot(aObserver); + CleanupStack::PushL(self); + self->ConstructL(aSize, aDisplayMode); + CleanupStack::Pop(); + + return self; +} + +CScreenshot::~CScreenshot() +{ + Cancel(); + + delete iEncoder; + + delete iBitmapContext; + delete iBitmapDevice; + delete iBitmap; +} + +CScreenshot::CScreenshot(MObserver& aObserver) + :CActive(EPriorityStandard), iObserver(aObserver) +{ + CActiveScheduler::Add(this); +} + +void CScreenshot::ConstructL(const TSize& aSize, const TDisplayMode& aDisplayMode) +{ + // Create bitmap where screen bitmap will be blitted + iBitmap = new(ELeave) CFbsBitmap; + iBitmap->Create(aSize, aDisplayMode); + + iBitmapDevice = CFbsBitmapDevice::NewL(iBitmap); + User::LeaveIfError(iBitmapDevice->CreateContext(iBitmapContext)); + + LOGARG("Bitmap capture size is %d x %d", aSize.iWidth, aSize.iHeight); +} + +void CScreenshot::RequestL(const CFbsBitmap& aSourceBitmap, const TSize& aSize) +{ + // Blit screen bitmap into internal bitmap + iBitmapContext->BitBlt(TPoint(0, 0), &aSourceBitmap, TRect(TPoint(0, 0), aSize)); + + // Generate file name + TTime time; + time.HomeTime(); + + TDateTime dateTime = time.DateTime(); + +#if defined(__WINS__) + iFilename.Copy(PathInfo::PhoneMemoryRootPath()); +#else + iFilename.Copy(PathInfo::MemoryCardRootPath()); +#endif + iFilename.Append(PathInfo::ImagesPath()); + + _LIT(KFormat, "%04d%02d%02d%02d%02d%02d.png"); + iFilename.AppendFormat(KFormat, dateTime.Year(), dateTime.Month() + 1, dateTime.Day() + 1, dateTime.Hour(), dateTime.Minute(), dateTime.Second()); + + // Convert to PNG + delete iEncoder; + iEncoder = 0; + + iEncoder = CImageEncoder::FileNewL(CCoeEnv::Static()->FsSession(), iFilename, CImageEncoder::EOptionAlwaysThread, KImageTypePNGUid); + iEncoder->Convert(&iStatus, *iBitmap); + SetActive(); +} + +void CScreenshot::RunL() +{ + iObserver.ScreenshotReadyL(iStatus.Int(), iFilename); +} + +void CScreenshot::DoCancel() +{ + if (iEncoder) + iEncoder->Cancel(); +} diff -r 000000000000 -r c316ab048e9d browser/engine/src/SettingManager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/engine/src/SettingManager.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,37 @@ +/* + * Name : SettingManager.cpp + * Description : Manages application settings + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "SettingManager.h" + +CSettingManager* CSettingManager::NewL() +{ + CSettingManager* self = new(ELeave) CSettingManager; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +CSettingManager::~CSettingManager() +{ +} + +CSettingManager::CSettingManager() +{ +} + +void CSettingManager::ConstructL() +{ +} diff -r 000000000000 -r c316ab048e9d browser/gfx/Application.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/gfx/Application.svg Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r c316ab048e9d browser/gfx/ScreenshotButtonNormal.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/gfx/ScreenshotButtonNormal.svg Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r c316ab048e9d browser/group/Application.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/group/Application.mmp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,123 @@ +/* + * Name : Application.mmp + * Description : Project definition + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +TARGET OpenMAR_0x2002E1AB.exe +TARGETTYPE exe +UID 0x100039CE 0x2002E1AB + +EPOCSTACKSIZE 0x4000 +EPOCHEAPSIZE 0x100000 0x1000000 + +MACRO __DEBUG__ + +SOURCEPATH ..\ui\src +SOURCE Application.cpp +SOURCE AppUi.cpp +SOURCE Document.cpp + +SOURCE SplashView.cpp +SOURCE SplashContainer.cpp + +SOURCE ARView.cpp +SOURCE ARContainer.cpp + +SOURCEPATH ..\engine\src +SOURCE Camera.cpp +SOURCE ConnectionManager.cpp +SOURCE Screenshot.cpp +SOURCE SettingManager.cpp + +SOURCEPATH ..\..\common\src +SOURCE HttpClient.cpp +SOURCE IconLoader.cpp +SOURCE Logger.cpp + + +SOURCEPATH ..\data + +START RESOURCE Application.rss +HEADER +TARGET OpenMAR_0x2002E1AB +TARGETPATH resource\apps +END //RESOURCE + +START RESOURCE Application_reg.rss +TARGET OpenMAR_0x2002E1AB_reg +TARGETPATH \private\10003a3f\apps +END //RESOURCE + +USERINCLUDE ..\..\common\inc +USERINCLUDE ..\ui\inc +USERINCLUDE ..\engine\inc + +USERINCLUDE ..\..\interface +USERINCLUDE ..\..\interface\overlay +USERINCLUDE ..\..\interface\provider + +SYSTEMINCLUDE \epoc32\include + +LIBRARY euser.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY eikcoctl.lib +LIBRARY eikctl.lib +LIBRARY avkon.lib +LIBRARY commonengine.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY aknnotify.lib + +LIBRARY ws32.lib +LIBRARY gdi.lib +LIBRARY bitgdi.lib +LIBRARY fbscli.lib +LIBRARY egul.lib +LIBRARY ImageConversion.lib +LIBRARY AknIcon.lib + +LIBRARY hal.lib +LIBRARY charconv.lib + +LIBRARY ConnMon.lib +LIBRARY CommDb.lib +LIBRARY etel3rdparty.lib + +LIBRARY esock.lib +LIBRARY http.lib +LIBRARY inetprotutil.lib +LIBRARY bafl.lib +LIBRARY PlatformEnv.lib + +LIBRARY SenXml.lib +LIBRARY XmlFramework.lib + +LIBRARY ecam.lib +LIBRARY ecamadvsettings.lib + +LIBRARY ecom.lib + +LIBRARY eposlandmarks.lib + + +LANG SC + +VENDORID 0x700001D2 +SECUREID 0x2002E1AB +CAPABILITY LocalServices Location NetworkServices ReadUserData ReadDeviceData SwEvent UserEnvironment WriteDeviceData WriteUserData + +#ifdef ENABLE_ABIV2_MODE +DEBUGGABLE +#endif +USERINCLUDE ..\..\interface\object diff -r 000000000000 -r c316ab048e9d browser/group/Button.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/group/Button.mk Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,62 @@ +#/* +# * Name : Button.mk +# * Description : Application buttons makefile +# * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser +# * Website : http://OpenMAR.org +# * +# * Copyright (c) 2010 David Caabeiro +# * +# * All rights reserved. This program and the accompanying materials are made available +# * under the terms of the Eclipse Public License v1.0 which accompanies this +# * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html +# * +# */ + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z +else +ZDIR=$(EPOCROOT)epoc32\data\z +endif + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\Button_0x2002E1AB.mif + +HEADERDIR=$(EPOCROOT)epoc32\include +HEADERFILENAME=$(HEADERDIR)\Button_0x2002E1AB.mbg + +ICONDIR=..\gfx + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# NOTE: if you have JUSTINTIME enabled for your S60 3rd FP1 or newer SDK +# and this command crashes, consider adding "/X" to the command line. +# See +# ---------------------------------------------------------------------------- + +RESOURCE : $(ICONTARGETFILENAME) + +$(ICONTARGETFILENAME) : + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ + /c24,8 $(ICONDIR)\ScreenshotButtonNormal.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME)&& \ + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 000000000000 -r c316ab048e9d browser/group/Icon.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/group/Icon.mk Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,58 @@ +#/* +# * Name : Icon.mk +# * Description : Application icon makefile +# * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser +# * Website : http://OpenMAR.org +# * +# * Copyright (c) 2010 David Caabeiro +# * +# * All rights reserved. This program and the accompanying materials are made available +# * under the terms of the Eclipse Public License v1.0 which accompanies this +# * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html +# * +# */ + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z +else +ZDIR=$(EPOCROOT)epoc32\data\z +endif + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\OpenMAR_0x2002E1AB.mif + +ICONDIR=..\gfx + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# NOTE: if you have JUSTINTIME enabled for your S60 3rd FP1 or newer SDK +# and this command crashes, consider adding "/X" to the command line. +# See +# ---------------------------------------------------------------------------- + +RESOURCE : $(ICONTARGETFILENAME) + +$(ICONTARGETFILENAME) : $(ICONDIR)\Application.svg + mifconv $(ICONTARGETFILENAME) \ + /c32 $(ICONDIR)\Application.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 000000000000 -r c316ab048e9d browser/ui/inc/ARContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/ui/inc/ARContainer.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,105 @@ +/* + * Name : ARContainer.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef __ARCONTAINER_H__ +#define __ARCONTAINER_H__ + +#include +#include +#include + +#include "POIOverlay.h" +#include "Camera.h" +#include "Screenshot.h" + +class CAknView; + +/** + * @brief AR control class + * + * This class provides the basic view and is in charge of initializing the camera, + * which dictates the refresh rate of the overlays + */ +class CARContainer : public CCoeControl, + public MCoeControlObserver, + public MCoeForegroundObserver, + public CDigitalCamera::MObserver, + public CScreenshot::MObserver +{ +public: + static CARContainer* NewL(CAknView& aView, const TRect& aRect); + ~CARContainer(); + +private: + CARContainer(CAknView& aView); + void ConstructL(const TRect& aRect); + + void CreateButtonGroupL(); + void DeleteButtonGroup(); + + static TInt SensorStart(TAny* aPtr); + void DoSensorStart(); + + static TInt SensorStop(TAny* aPtr); + void DoSensorStop(); + + void ScreenshotStartL(); + void ScreenshotStop(); + +protected: + void SizeChanged(); + void HandlePointerEventL(const TPointerEvent& aPointerEvent); + void HandleResourceChange(TInt aType); + void Draw(const TRect& aRect) const; + + TInt CountComponentControls() const; + CCoeControl* ComponentControl(TInt aIndex) const; + +protected: + // From MCoeControlObserver + void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType); + + // From MCoeForegroundObserver + void HandleGainingForeground(); + void HandleLosingForeground(); + + // From CDigitalCamera::MObserver + void CameraReady(TInt aError); + void CameraFrame(CFbsBitmap& aFrame); + void FocusReady(TInt aError); + + // From CScreenshot::MObserver + void ScreenshotReadyL(TInt aError, const TDesC& aFilename); + +private: + CAknView& iView; + CAknButton* iScreenshotButton; + + CFbsBitmap* iBitmap; + CFbsBitmapDevice* iBitmapDevice; + CFbsBitGc* iBitmapContext; + + enum TButtonId { + EScreenshot, + ETotal + }; + +private: + RPointerArray iOverlayList; + CDigitalCamera* iCamera; + CScreenshot* iScreenshot; + CIdle* iSensorTask; +}; + +#endif // __ARCONTAINER_H__ diff -r 000000000000 -r c316ab048e9d browser/ui/inc/ARView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/ui/inc/ARView.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,54 @@ +/* + * Name : ARView.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef __ARVIEW_H__ +#define __ARVIEW_H__ + +#include + +#include +#include +#include + +class CARContainer; + +/** + * @brief AR Avkon view + */ +class CARView : public CAknView, public MAknToolbarObserver +{ +public: + static CARView* NewL(); + ~CARView(); + +protected: + CARView(); + void ConstructL(); + +protected: + TUid Id() const; + void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage); + void DoDeactivate(); + + void DynInitToolbarL(TInt aResourceId, CAknToolbar* aToolbar); + + void OfferToolbarEventL(TInt aCommand); + void HandleCommandL(TInt aCommand); + +private: + TVwsViewId iPrevViewId; + CARContainer* iRenderer; +}; + +#endif // __ARVIEW_H__ diff -r 000000000000 -r c316ab048e9d browser/ui/inc/AppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/ui/inc/AppUi.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,36 @@ +/* + * Name : AppUi.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef __APPUI_H__ +#define __APPUI_H__ + +#include + +class CSettingManager; + +class CAppUi : public CAknViewAppUi +{ +public: + void ConstructL(); + ~CAppUi(); + +private: + void HandleCommandL(TInt aCommand); + CArrayFix* HelpContextL() const; + +private: + CSettingManager* iSetting; +}; + +#endif // __APPUI_H__ diff -r 000000000000 -r c316ab048e9d browser/ui/inc/Application.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/ui/inc/Application.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,32 @@ +/* + * Name : Application.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef __APPLICATION_H__ +#define __APPLICATION_H__ + +#include +#include "Application.hrh" + +const TUid KUidApplication = { _UID3 }; + +class CApplication : public CAknApplication +{ +public: + TUid AppDllUid() const; + +protected: + CApaDocument* CreateDocumentL(); +}; + +#endif // __APPLICATION_H__ diff -r 000000000000 -r c316ab048e9d browser/ui/inc/Application.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/ui/inc/Application.hrh Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,36 @@ +/* + * Name : Application.hrh + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef __APPLICATION_HRH__ +#define __APPLICATION_HRH__ + +#define _UID3 0x2002E1AB + +enum TViewId { + ESplashView, + EARView +}; + +enum TDialogId +{ + EDialogWait = 0x3000 +}; + +enum TCommandId +{ + EHelp = 0x6000, + EAbout +}; + +#endif // __APPLICATION_HRH__ diff -r 000000000000 -r c316ab048e9d browser/ui/inc/Application.pan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/ui/inc/Application.pan Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,29 @@ +/* + * Name : Application.pan + * Description : Panic definitions + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef __APPLICATION_PAN__ +#define __APPLICATION_PAN__ + +enum TApplicationPanic +{ + +}; + +inline void Panic(TApplicationPanic aReason) +{ + _LIT(appName, "OpenMAR"); + User::Panic(appName, aReason); +} + +#endif // __APPLICATION_PAN__ diff -r 000000000000 -r c316ab048e9d browser/ui/inc/Document.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/ui/inc/Document.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,45 @@ +/* + * Name : Document.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef __DOCUMENT_H__ +#define __DOCUMENT_H__ + +#include + +class CAppUi; +class CEikApplication; + +class CDocument : public CAknDocument +{ +public: + static CDocument* NewL(CEikApplication& aApp); + static CDocument* NewLC(CEikApplication& aApp); + virtual ~CDocument(); + +public: + /** + * CreateAppUiL + * From CEikDocument, CreateAppUiL. + * Create a CcamAppUi object and return a pointer to it. + * The object returned is owned by the Uikon framework. + * @return Pointer to created instance of AppUi. + */ + CEikAppUi* CreateAppUiL(); + +private: + void ConstructL(); + CDocument(CEikApplication& aApp); +}; + +#endif // __DOCUMENT_H__ diff -r 000000000000 -r c316ab048e9d browser/ui/inc/SplashContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/ui/inc/SplashContainer.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,46 @@ +/* + * Name : SplashContainer.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef SPLASHCONTAINER_H_ +#define SPLASHCONTAINER_H_ + +#include +#include + +class CAknView; +class CFbsBitmap; +class CGulIcon; + +class CSplashContainer : public CCoeControl +{ +public: + CSplashContainer(CAknView& aView); + ~CSplashContainer(); + void ConstructL(const TRect& aRect, const CCoeControl* aParent = 0); + +protected: + void HandleResourceChange(TInt aType); + void Draw(const TRect& aRect) const; + +private: + CAknView& iView; + + CFbsBitmap* iBitmap; + CFbsBitmapDevice* iBitmapDevice; + CFbsBitGc* iBitmapContext; + + CGulIcon* iBackground; +}; + +#endif // SPLASHCONTAINER_H_ diff -r 000000000000 -r c316ab048e9d browser/ui/inc/SplashView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/ui/inc/SplashView.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,52 @@ +/* + * Name : SplashView.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef SPLASHVIEW_H_ +#define SPLASHVIEW_H_ + +#include + +#include "ConnectionManager.h" + +class CSettingManager; +class CSplashContainer; + +class CSplashView : public CAknView, + public MConnectionManager +{ +public: + static CSplashView* NewL(CSettingManager& aSetting); + ~CSplashView(); + +protected: + CSplashView(CSettingManager& aSetting); + void ConstructL(); + + // From MConnectionManager + void ConnectionStartedL(TInt aError); + +protected: + TUid Id() const; + void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage); + void DoDeactivate(); + + void HandleCommandL(TInt aCommand); + +private: + CSettingManager& iSetting; + CConnectionManager* iConnection; + CSplashContainer* iContainer; +}; + +#endif // SPLASHVIEW_H_ diff -r 000000000000 -r c316ab048e9d browser/ui/src/ARContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/ui/src/ARContainer.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,371 @@ +/* + * Name : ARContainer.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "ARContainer.h" + +#include +#include + +#include +#include +#include + +#include "Application.hrh" + +#include +#include + +#include "IconLoader.h" +#include "ResetAndDestroy.h" + +#include "Logger.h" + +// Constant definitions +_LIT(KButtonFile, "\\resource\\apps\\Button_0x2002E1AB.mif"); +const TSize KButtonSize(36, 36); + +CARContainer* CARContainer::NewL(CAknView& aView, const TRect& aRect) +{ + CARContainer* self = new(ELeave) CARContainer(aView); + CleanupStack::PushL(self); + self->ConstructL(aRect); + CleanupStack::Pop(self); + + return self; +} + +CARContainer::CARContainer(CAknView& aView) + : iView(aView) +{} + +void CARContainer::ConstructL(const TRect& aRect) +{ + CreateWindowL(); + + CreateButtonGroupL(); + + // This bitmap will contain the camera frame and overlays + iBitmap = new(ELeave) CFbsBitmap; + iBitmap->Create(aRect.Size(), Window().DisplayMode()); + + iBitmapDevice = CFbsBitmapDevice::NewL(iBitmap); + User::LeaveIfError(iBitmapDevice->CreateContext(iBitmapContext)); + + // Make black background to be shown immediately to the user + iBitmapContext->SetBrushColor(KRgbBlack); + iBitmapContext->SetBrushStyle(CFbsBitGc::ESolidBrush); + iBitmapContext->Clear(); + + SetRect(aRect); + + LOGARG("Control rect size is %d x %d", aRect.Width(), aRect.Height()); + + iCoeEnv->AddForegroundObserverL(*this); + +#if defined(__MARM__) + iCamera = CDigitalCamera::NewL(*this); + + // The rect will be the intersection between the camera frame + // and the window rect + TRect cameraRect(TPoint(0, 0), iCamera->ViewportSize()); + cameraRect.Intersection(aRect); +#else + TRect cameraRect(aRect); +#endif + + LOGARG("Viewport rect is (%d, %d, %d, %d)", + cameraRect.iTl.iX, cameraRect.iTl.iY, cameraRect.iBr.iX, cameraRect.iBr.iY); + + iScreenshot = CScreenshot::NewL(*this, cameraRect.Size(), Window().DisplayMode()); + + // Instantiate overlay implementations + RImplInfoPtrArray implementations; + REComSession::ListImplementationsL(TUid::Uid(KOverlayInterfaceUidValue), implementations); + CleanupResetAndDestroyPushL(implementations); + + // Pass container window and rect size to each overlay + OpenMAR::CPOIOverlay::SParameter param = { Window(), cameraRect }; + + for (TInt i = 0; i < implementations.Count(); ++i) + { + const CImplementationInformation* info = implementations[i]; + OpenMAR::CPOIOverlay* plugin = OpenMAR::CPOIOverlay::NewL(info->ImplementationUid(), param); + iOverlayList.AppendL(plugin); + } + + CleanupStack::PopAndDestroy(&implementations); + + // Start camera in low priority task + iSensorTask = CIdle::NewL(CActive::EPriorityIdle); + + TCallBack sensorStart(SensorStart, this); + iSensorTask->Start(sensorStart); + + ActivateL(); +} + +CARContainer::~CARContainer() +{ + DoSensorStop(); + + iOverlayList.ResetAndDestroy(); + iOverlayList.Close(); + + delete iCamera; + delete iScreenshot; + + iCoeEnv->RemoveForegroundObserver(*this); + + delete iBitmapContext; + delete iBitmapDevice; + delete iBitmap; + + DeleteButtonGroup(); +} + +void CARContainer::CreateButtonGroupL() +{ + // Screenshot button + CGulIcon* screenshotNormal = CreateIconL(KButtonFile, EMbmButton_0x2002e1abScreenshotbuttonnormal, EMbmButton_0x2002e1abScreenshotbuttonnormal_mask, KButtonSize); + + iScreenshotButton = CAknButton::NewL(screenshotNormal, 0, 0, 0, KNullDesC, KNullDesC, KAknButtonNoFrame, 0); + iScreenshotButton->SetContainerWindowL(*this); + iScreenshotButton->SetObserver(this); +} + +void CARContainer::DeleteButtonGroup() +{ + delete iScreenshotButton; +} + +TInt CARContainer::SensorStart(TAny* aPtr) +{ + CARContainer* self = static_cast(aPtr); + self->DoSensorStart(); + return KErrNone; +} + +void CARContainer::DoSensorStart() +{ + LOGTXT("Starting sensors.."); + +#if defined(__MARM__) + iCamera->Start(); +#endif + + for (TInt i = 0; i < iOverlayList.Count(); ++i) + iOverlayList[i]->StartL(); +} + +TInt CARContainer::SensorStop(TAny* aPtr) +{ + CARContainer* self = static_cast(aPtr); + self->DoSensorStop(); + return KErrNone; +} + +void CARContainer::DoSensorStop() +{ + LOGTXT("Stopping sensors.."); + + for (TInt i = 0; i < iOverlayList.Count(); ++i) + iOverlayList[i]->Stop(); + +#if defined(__MARM__) + iCamera->Stop(); +#endif +} + +/* + * Before performing the screenshot, disable overlay and sensor activity. + * This way the screenshot image is generated fast. + */ + +void CARContainer::ScreenshotStartL() +{ + iScreenshotButton->SetDimmed(ETrue); + + HandleLosingForeground(); + iScreenshot->RequestL(*iBitmap, iBitmap->SizeInPixels()); +} + +/* + * Resume overlay and sensor activity. + */ +void CARContainer::ScreenshotStop() +{ + HandleGainingForeground(); + + iScreenshotButton->SetDimmed(EFalse); +} + +void CARContainer::SizeChanged() +{ + TRect screenshotButtonRect(TPoint(0, 0), KButtonSize); + screenshotButtonRect.Move(TPoint(Rect().Width() - KButtonSize.iWidth, Rect().Height() - KButtonSize.iHeight)); + + iScreenshotButton->SetRect(screenshotButtonRect); +} + +void CARContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent) +{ +// if (aPointerEvent.iType == TPointerEvent::EButton1Down && iCamera) +// iCamera->StartFocus(); + CCoeControl::HandlePointerEventL(aPointerEvent); +} + +void CARContainer::HandleResourceChange(TInt aType) +{ + LOGARG("CARContainer::HandleResourceChange(%d)", aType); + + CCoeControl::HandleResourceChange(aType); +/* + if (aType == KEikDynamicLayoutVariantSwitch) + { + TRect rect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EApplicationWindow, rect); + SetRect(rect); + } +*/ +} + +void CARContainer::Draw(const TRect& /*aRect*/) const +{ + CWindowGc& gc = SystemGc(); + gc.BitBlt(TPoint(0, 0), iBitmap); +} + +TInt CARContainer::CountComponentControls() const +{ + return ETotal; +} + +CCoeControl* CARContainer::ComponentControl(TInt aIndex) const +{ + switch (aIndex) + { + case EScreenshot: + return iScreenshotButton; + + default: + return 0; + } +} + +void CARContainer::HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType) +{ + if (aEventType == EEventStateChanged) + { + if (aControl == iScreenshotButton) + { + LOGTXT("Screenshot requested"); + + ScreenshotStartL(); + } + } +} + +void CARContainer::HandleGainingForeground() +{ + LOGTXT("Gaining ForegroundL"); + + // Clear bitmap to avoid showing screen capture when back + iBitmapContext->SetBrushColor(KRgbBlack); + iBitmapContext->SetBrushStyle(CGraphicsContext::ESolidBrush); + iBitmapContext->Clear(); + + iSensorTask->Cancel(); + TCallBack sensor(SensorStart, this); + iSensorTask->Start(sensor); +} + +void CARContainer::HandleLosingForeground() +{ + LOGTXT("Losing foreground"); +/* + iSensorTask->Cancel(); + TCallBack sensor(SensorStop, this); + iSensorTask->Start(sensor); +*/ + DoSensorStop(); +} + +void CARContainer::CameraReady(TInt aError) +{ + LOGARG("Camera ready (error %d)", aError); + + // Perform some error handling +} + +void CARContainer::CameraFrame(CFbsBitmap& aFrame) +{ + // Use camera frame as background + iBitmapContext->BitBlt(TPoint(0, 0), &aFrame); + + for (TInt i = 0; i < iOverlayList.Count(); ++i) + { + // Perform overlay rendering + const CFbsBitmap& overlay = iOverlayList[i]->RenderScene(); + // Blend it with the background image + iBitmapContext->BitBlt(TPoint(0, 0), &overlay); + } + + const CFont* font = iEikonEnv->LegendFont(); + iBitmapContext->UseFont(font); + + _LIT(KText, "Focus: %d"); + TBuf<32> text; + text.Format(KText, iOverlayList[0]->GetFocusedPOI()); + + const TPoint pos(10, 20); + + iBitmapContext->DrawText(text, pos); + + // TODO: should call this every Nth frame + User::ResetInactivityTime(); + + DrawNow(); +} + +void CARContainer::FocusReady(TInt aError) +{ + if (aError == KErrNone) + LOGTXT("Focused correctly"); +// else if (aError == KErrECamNotOptimalFocus) +// LOGTXT("Focus not optimal"); +} + +void CARContainer::ScreenshotReadyL(TInt aError, const TDesC& aFilename) +{ + ScreenshotStop(); + + TBuf<128> text; + + if (aError) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote; + HBufC* format = iEikonEnv->AllocReadResourceLC(R_SCREENSHOT_TEXT_ERROR); + text.Format(*format, aError); + CleanupStack::PopAndDestroy(format); + note->ExecuteLD(text); + } + else + { + CAknInformationNote* note = new(ELeave) CAknInformationNote; + HBufC* format = iEikonEnv->AllocReadResourceLC(R_SCREENSHOT_TEXT_OK); + text.Format(*format, &aFilename); + CleanupStack::PopAndDestroy(format); + note->ExecuteLD(text); + } +} diff -r 000000000000 -r c316ab048e9d browser/ui/src/ARView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/ui/src/ARView.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,108 @@ +/* + * Name : ARView.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "ARView.h" + +#include + +#include + +#include "Application.hrh" + +#include "ARContainer.h" + +#include + +#include "Logger.h" + +CARView* CARView::NewL() +{ + CARView* self = new(ELeave) CARView(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +CARView::~CARView() +{ + DoDeactivate(); +} + +CARView::CARView() +{} + +void CARView::ConstructL() +{ + BaseConstructL(R_AR_VIEW); +} + +TUid CARView::Id() const +{ + return TUid::Uid(EARView); +} + +void CARView::DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage) +{ + LOGTXT("CARView::DoActivateL()"); + + if (!iRenderer) + { + iPrevViewId = aPrevViewId; + + // Make status pane invisible + CEikStatusPane* statusPane = StatusPane(); + if (statusPane) + statusPane->MakeVisible(EFalse); + + iRenderer = CARContainer::NewL(*this, AppUi()->ApplicationRect()); + + AppUi()->AddToStackL(*this, iRenderer); + } +} + +void CARView::DoDeactivate() +{ + if (iRenderer) + { + AppUi()->RemoveFromViewStack(*this, iRenderer); + + delete iRenderer; + iRenderer = 0; + } +} + +void CARView::DynInitToolbarL(TInt aResourceId, CAknToolbar* aToolbar) +{ +} + +void CARView::OfferToolbarEventL(TInt aCommand) +{ +// HandleCommandL(aCommand); +} + +void CARView::HandleCommandL(TInt aCommand) +{ + switch (aCommand) + { + case EAknSoftkeyBack: + AppUi()->ActivateLocalViewL(iPrevViewId.iViewUid); + break; + + default: + AppUi()->HandleCommandL(aCommand); + break; + } +} diff -r 000000000000 -r c316ab048e9d browser/ui/src/AppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/ui/src/AppUi.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,120 @@ +/* + * Name : AppUi.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "AppUi.h" + +#include +#include +#include +#include +#include + +#include + +#include "Application.hrh" +#include "Application.pan" +#include "Application.h" + +#include "SettingManager.h" + +#include "SplashView.h" +#include "ARView.h" + +#include "Logger.h" + +void CAppUi::ConstructL() +{ + LOGTXT("Creating AppUi"); + + BaseConstructL(EAknEnableSkin | EAppOrientationLandscape); +// BaseConstructL(EAknEnableSkin); + + iSetting = CSettingManager::NewL(); + + // Set up splash view and make it default + CAknView* splashView = CSplashView::NewL(*iSetting); + CleanupStack::PushL(splashView); + AddViewL(splashView); + CleanupStack::Pop(splashView); + + SetDefaultViewL(*splashView); + + CAknView* arView = CARView::NewL(); + CleanupStack::PushL(arView); + AddViewL(arView); + CleanupStack::Pop(arView); +} + +CAppUi::~CAppUi() +{ + delete iSetting; + + REComSession::FinalClose(); +} + +void CAppUi::HandleCommandL(TInt aCommand) +{ + switch (aCommand) + { + case EEikCmdExit: + case EAknSoftkeyExit: + Exit(); + break; +/* + case EHelp: + { + CArrayFix* buf = CCoeAppUi::AppHelpContextL(); + HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), buf); + } + break; +*/ + case EAbout: + { + CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog(); + dlg->PrepareLC(R_ABOUT_QUERY_DIALOG); + HBufC* title = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TITLE); + dlg->QueryHeading()->SetTextL(*title); + CleanupStack::PopAndDestroy(title); + HBufC* msg = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TEXT); + dlg->SetMessageTextL(*msg); + CleanupStack::PopAndDestroy(msg); + dlg->RunLD(); + } + break; + + default: +// Panic(); + break; + } +} + +CArrayFix* CAppUi::HelpContextL() const +{ +#warning "Please see comment about help and UID3..." +// Note: Help will not work if the application uid3 is not in the +// protected range. The default uid3 range for projects created +// from this template (0xE0000000 - 0xEFFFFFFF) are not in the protected range so that they +// can be self signed and installed on the device during testing. +// Once you get your official uid3 from Symbian Ltd. and find/replace +// all occurrences of uid3 in your project, the context help will +// work. +/* + CArrayFixFlat* array = new(ELeave) CArrayFixFlat(1); + CleanupStack::PushL(array); + array->AppendL(TCoeHelpContext(KUidApplication, KGeneral_Information)); + CleanupStack::Pop(array); + return array; +*/ + return 0; +} diff -r 000000000000 -r c316ab048e9d browser/ui/src/Application.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/ui/src/Application.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,40 @@ +/* + * Name : Application.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Application.h" + +#include + +#include "Application.hrh" +#include "Document.h" + +CApaDocument* CApplication::CreateDocumentL() +{ + return CDocument::NewL(*this); +} + +TUid CApplication::AppDllUid() const +{ + return KUidApplication; +} + +LOCAL_C CApaApplication* NewApplication() +{ + return new CApplication; +} + +GLDEF_C TInt E32Main() +{ + return EikStart::RunApplication(NewApplication); +} diff -r 000000000000 -r c316ab048e9d browser/ui/src/Document.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/ui/src/Document.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,53 @@ +/* + * Name : Document.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Document.h" + +#include "AppUi.h" + +#include "Logger.h" + +CDocument* CDocument::NewL(CEikApplication& aApp) +{ + CDocument* self = NewLC(aApp); + CleanupStack::Pop(self); + return self; +} + +CDocument* CDocument::NewLC(CEikApplication& aApp) +{ + CDocument* self = new(ELeave) CDocument(aApp); + CleanupStack::PushL(self); + self->ConstructL(); + return self; +} + +void CDocument::ConstructL() +{ +} + +CDocument::CDocument(CEikApplication& aApp) + : CAknDocument(aApp) +{ +} + +CDocument::~CDocument() +{ + LOGCLOSE +} + +CEikAppUi* CDocument::CreateAppUiL() +{ + return new(ELeave) CAppUi; +} diff -r 000000000000 -r c316ab048e9d browser/ui/src/SplashContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/ui/src/SplashContainer.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,95 @@ +/* + * Name : SplashContainer.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "SplashContainer.h" + +#include +#include +#include +#include + +#include +#include + +//#include + +//#include "IconLoader.h" + +#include "Logger.h" + +CSplashContainer::CSplashContainer(CAknView& aView) + : iView(aView) +{} + +CSplashContainer::~CSplashContainer() +{ + delete iBackground; + + delete iBitmapContext; + delete iBitmapDevice; + delete iBitmap; +} + +void CSplashContainer::ConstructL(const TRect& aRect, const CCoeControl* aParent) +{ + if (aParent) + SetContainerWindowL(*aParent); + else + CreateWindowL(); + + iBitmap = new(ELeave) CFbsBitmap; + iBitmap->Create(aRect.Size(), Window().DisplayMode()); + + iBitmapDevice = CFbsBitmapDevice::NewL(iBitmap); + User::LeaveIfError(iBitmapDevice->CreateContext(iBitmapContext)); + + iBitmapContext->SetBrushColor(KRgbBlue); + iBitmapContext->SetBrushStyle(CFbsBitGc::ESolidBrush); + iBitmapContext->Clear(); + + const CFont* font = iEikonEnv->LegendFont(); + iBitmapContext->UseFont(font); + + iBitmapContext->SetPenColor(KRgbWhite); + iBitmapContext->SetPenStyle(CFbsBitGc::ESolidPen); + + _LIT(KPrimaryText, "Initializing.."); + iBitmapContext->DrawText(KPrimaryText, TPoint(font->WidthZeroInPixels(), font->FontMaxHeight())); + +// _LIT(KImageFile, "\\resource\\apps\\Splash_0x20026309.mif"); +// iBackground = CreateIconL(KImageFile, EMbmSplash_0x20026309Splash, EMbmSplash_0x20026309Splash_mask, aRect.Size()); + + SetRect(aRect); + ActivateL(); +} + +void CSplashContainer::HandleResourceChange(TInt aType) +{ + LOGARG("CSplashContainer::HandleResourceChange(%d)", aType); + + CCoeControl::HandleResourceChange(aType); + + if (aType == KEikDynamicLayoutVariantSwitch) + { + TRect rect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EApplicationWindow, rect); + SetRect(rect); + } +} + +void CSplashContainer::Draw(const TRect& aRect) const +{ + CWindowGc& gc = SystemGc(); + gc.BitBlt(TPoint(0, 0), iBitmap); +} diff -r 000000000000 -r c316ab048e9d browser/ui/src/SplashView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/ui/src/SplashView.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,114 @@ +/* + * Name : SplashView.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "SplashView.h" + +#include +#include + +#include + +#include "Application.hrh" +#include "SettingManager.h" +#include "SplashContainer.h" + +#include "Logger.h" + +CSplashView* CSplashView::NewL(CSettingManager& aSetting) +{ + CSplashView* self = new(ELeave) CSplashView(aSetting); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +CSplashView::~CSplashView() +{ + delete iContainer; + delete iConnection; +} + +CSplashView::CSplashView(CSettingManager& aSetting) + : iSetting(aSetting) +{} + +void CSplashView::ConstructL() +{ + BaseConstructL(R_SPLASH_VIEW); + + LOGTXT("Initializing splash screen"); + + // Set up connection which should be used by other components + // (providers, etc) to enable faster connections + iConnection = CConnectionManager::NewL(*this, iSetting); +} + +void CSplashView::ConnectionStartedL(TInt aError) +{ + LOGARG("Connection manager returned %d", aError); + + if (aError) + { + // TODO: Handle error condition. Some kind of 'offline mode' should be allowed, + // thus enabling the use of the application in a restricted way + +// if (!AppUi()->IsAppShutterRunning()) +// AppUi()->RunAppShutter(); + } + + // Perform other setup.. + + // Initial set up complete. Switch to main view + AppUi()->ActivateLocalViewL(TUid::Uid(EARView)); +} + +TUid CSplashView::Id() const +{ + return TUid::Uid(ESplashView); +} + +void CSplashView::DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage) +{ + if (!iContainer) + { + // Make status pane invisible + CEikStatusPane* statusPane = StatusPane(); + if (statusPane) + statusPane->MakeVisible(EFalse); + + iContainer = new(ELeave) CSplashContainer(*this); + iContainer->SetMopParent(this); + iContainer->ConstructL(AppUi()->ApplicationRect(), 0); + + AppUi()->AddToStackL(*this, iContainer); + } +} + +void CSplashView::DoDeactivate() +{ + if (iContainer) + { + AppUi()->RemoveFromViewStack(*this, iContainer); + + delete iContainer; + iContainer = 0; + } +} + +void CSplashView::HandleCommandL(TInt aCommand) +{ + AppUi()->HandleCommandL(aCommand); +} diff -r 000000000000 -r c316ab048e9d build/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build/bld.inf Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,28 @@ +/* + * Name : bld.inf + * Description : Component definition file + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +PRJ_PLATFORMS +WINSCW GCCE + +PRJ_MMPFILES + +gnumakefile ..\browser\group\Icon.mk +gnumakefile ..\browser\group\Button.mk + +..\browser\group\Application.mmp + +..\plugin\poi\landmarks\group\Landmarks.mmp +gnumakefile ..\plugin\poi\landmarks\group\LandmarksIcons.mk + +..\plugin\poi\geonames\group\Geonames.mmp diff -r 000000000000 -r c316ab048e9d common/inc/HttpClient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/inc/HttpClient.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,48 @@ +/* + * Name : HttpClient.h + * Description : HTTP helper class + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef HTTPCLIENT_H_ +#define HTTPCLIENT_H_ + +#include +#include + +#include + +class CHttpClient : public CBase +{ +public: + static CHttpClient* NewL(MHTTPTransactionCallback& aCallback); + ~CHttpClient(); + +protected: + CHttpClient(MHTTPTransactionCallback& aCallback); + void ConstructL(); + +public: + RHTTPTransaction GetL(const TDesC8& aUri); + void Stop(RHTTPTransaction& aTransaction); + +protected: + void SetHeaderL(RHTTPHeaders aHeaders, TInt aHdrField, const TDesC8& aHdrValue); + +private: + MHTTPTransactionCallback& iCallback; + + RHTTPSession iSession; + RSocketServ iSocketServ; + RConnection iConnection; +}; + +#endif // HTTPSOURCE_H_ diff -r 000000000000 -r c316ab048e9d common/inc/IconLoader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/inc/IconLoader.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,26 @@ +/* + * Name : IconLoader.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef ICONLOADER_H_ +#define ICONLOADER_H_ + +#include +#include + +class CGulIcon; +class TSize; + +CGulIcon* CreateIconL(const TDesC& aIconFile, TInt aBitmapId, TInt aMaskId, const TSize& aSize = TSize(-1, -1)); + +#endif diff -r 000000000000 -r c316ab048e9d common/inc/Logger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/inc/Logger.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,57 @@ +/* + * Name : Logger.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef LOGGER_H_ +#define LOGGER_H_ + +#include + +#if defined(__DEBUG__) + +#define LOGCLOSE CLogger::Close(); +#define LOGARG(text,param...) { _LIT8(KText, text); CLogger::Write(KText, param); } +#define LOGTXT(text) { _LIT8(KText, text); CLogger::Write(static_cast(KText)); } + +#else + +#define LOGCLOSE +#define LOGARG +#define LOGTXT + +#endif + +class CLogger : public CBase +{ +public: + static void Write(const TDesC8& aText); + static void Write(TRefByValue aFmt, ...); + + static void Close(); + +protected: + static CLogger& InstanceL(); + + void ConstructL(); + ~CLogger(); + + void DoWrite(const TDesC8& aText); + +private: + RFs iFs; + RFile iFile; + + TBuf8<1024> iBuffer; +}; + +#endif diff -r 000000000000 -r c316ab048e9d common/inc/Matrix4d.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/inc/Matrix4d.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,106 @@ +/* + * Name : Matrix4d.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef MATRIX4D_H_ +#define MATRIX4D_H_ + +#include "Scalar.h" +#include "Vector3d.h" +#include "Vector4d.h" + +/** + * @brief Provides needed 4d-matrix functionality and operations + */ +class Matrix4d +{ +public: + Matrix4d(); + Matrix4d(Scalar m00, Scalar m01, Scalar m02, Scalar m03, + Scalar m10, Scalar m11, Scalar m12, Scalar m13, + Scalar m20, Scalar m21, Scalar m22, Scalar m23, + Scalar m30, Scalar m31, Scalar m32, Scalar m33); + + const Vector4d operator*(const Vector4d& v) const; + const Matrix4d& operator*(Scalar s); + + void Load(Scalar m00, Scalar m01, Scalar m02, Scalar m03, + Scalar m10, Scalar m11, Scalar m12, Scalar m13, + Scalar m20, Scalar m21, Scalar m22, Scalar m23, + Scalar m30, Scalar m31, Scalar m32, Scalar m33); + + const Matrix4d Transpose() const; + +//private: + Scalar m[16]; +}; + +inline Matrix4d::Matrix4d() +{ + m[0] = 1; m[1] = 0; m[2] = 0; m[3] = 0; + m[4] = 0; m[5] = 1; m[6] = 0; m[7] = 0; + m[8] = 0; m[9] = 0; m[10] = 1; m[11] = 0; + m[12] = 0; m[13] = 0; m[14] = 0; m[15] = 1; +} + +inline Matrix4d::Matrix4d(Scalar m00, Scalar m01, Scalar m02, Scalar m03, + Scalar m10, Scalar m11, Scalar m12, Scalar m13, + Scalar m20, Scalar m21, Scalar m22, Scalar m23, + Scalar m30, Scalar m31, Scalar m32, Scalar m33) +{ + Load(m00, m01, m02, m03, + m10, m11, m12, m13, + m20, m21, m22, m23, + m30, m31, m32, m33); +} + +inline const Vector4d Matrix4d::operator*(const Vector4d& v) const +{ + return Vector4d( + m[0] * v.mX + m[1] * v.mY + m[2] * v.mZ + m[3] * v.mW, + m[4] * v.mX + m[5] * v.mY + m[6] * v.mZ + m[7] * v.mW, + m[8] * v.mX + m[9] * v.mY + m[10] * v.mZ + m[11] * v.mW, + m[12] * v.mX + m[13] * v.mY + m[14] * v.mZ + m[15] * v.mW + ); +} + +inline const Matrix4d& Matrix4d::operator*(Scalar s) +{ + for (TInt i = 0; i < 16; ++i) + m[i] *= s; + + return *this; +} + +inline void Matrix4d::Load(Scalar m00, Scalar m01, Scalar m02, Scalar m03, + Scalar m10, Scalar m11, Scalar m12, Scalar m13, + Scalar m20, Scalar m21, Scalar m22, Scalar m23, + Scalar m30, Scalar m31, Scalar m32, Scalar m33) +{ + m[0] = m00; m[1] = m01; m[2] = m02; m[3] = m03; + m[4] = m10; m[5] = m11; m[6] = m12; m[7] = m13; + m[8] = m20; m[9] = m21; m[10] = m22; m[11] = m23; + m[12] = m30; m[13] = m31; m[14] = m32; m[15] = m33; +} + +inline const Matrix4d Matrix4d::Transpose() const +{ + return Matrix4d( + m[0], m[4], m[8], m[12], + m[1], m[5], m[9], m[13], + m[2], m[6], m[10], m[14], + m[3], m[7], m[11], m[15] + ); +} + +#endif // MATRIX4D_H_ diff -r 000000000000 -r c316ab048e9d common/inc/Scalar.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/inc/Scalar.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,22 @@ +/* + * Name : Scalar.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef SCALAR_H_ +#define SCALAR_H_ + +#include + +typedef TReal32 Scalar; + +#endif diff -r 000000000000 -r c316ab048e9d common/inc/Vector3d.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/inc/Vector3d.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,61 @@ +/* + * Name : Vector3d.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef VECTOR3D_H_ +#define VECTOR3D_H_ + +#include + +#include "Scalar.h" + +/** + * @brief Provides needed 3d-vector functionality and operations + */ +class Vector3d +{ +public: + Vector3d(Scalar x = 0, Scalar y = 0, Scalar z = 0); + + Scalar Norm() const; + + static const Vector3d Cross(const Vector3d& lhs, const Vector3d& rhs); + +//private: + Scalar mX; + Scalar mY; + Scalar mZ; +}; + +inline Vector3d::Vector3d(Scalar x, Scalar y, Scalar z) + : mX(x), mY(y), mZ(z) +{} + +inline Scalar Vector3d::Norm() const +{ + Scalar sm = mX * mX + mY * mY + mZ * mZ; + + TReal norm = 0; + Math::Sqrt(norm, sm); + + return norm; +} + +inline const Vector3d Vector3d::Cross(const Vector3d& lhs, const Vector3d& rhs) +{ + return Vector3d(lhs.mY * rhs.mZ - lhs.mZ * rhs.mY, + lhs.mZ * rhs.mX - lhs.mX * rhs.mZ, + lhs.mX * rhs.mY - lhs.mY * rhs.mX); +} + +#endif diff -r 000000000000 -r c316ab048e9d common/inc/Vector4d.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/inc/Vector4d.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,39 @@ +/* + * Name : Vector4d.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef VECTOR4D_H_ +#define VECTOR4D_H_ + +#include "Scalar.h" + +/** + * @brief Provides needed 4d-vector functionality and operations + */ +class Vector4d +{ +public: + Vector4d(Scalar x = 0, Scalar y = 0, Scalar z = 0, Scalar w = 0); + +//private: + Scalar mX; + Scalar mY; + Scalar mZ; + Scalar mW; +}; + +inline Vector4d::Vector4d(Scalar x, Scalar y, Scalar z, Scalar w) + : mX(x), mY(y), mZ(z), mW(w) +{} + +#endif diff -r 000000000000 -r c316ab048e9d common/src/HttpClient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/src/HttpClient.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,120 @@ +/* + * Name : HttpClient.cpp + * Description : HTTP helper class + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "HttpClient.h" + +#include +#include + +#include +#include +#include + +#include + +#include "Logger.h" + +CHttpClient* CHttpClient::NewL(MHTTPTransactionCallback& aCallback) +{ + CHttpClient* self = new(ELeave) CHttpClient(aCallback); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +CHttpClient::~CHttpClient() +{ + iSession.Close(); + iConnection.Close(); + iSocketServ.Close(); +} + +CHttpClient::CHttpClient(MHTTPTransactionCallback& aCallback) + : iCallback(aCallback) +{ +} + +void CHttpClient::ConstructL() +{ + User::LeaveIfError(iSocketServ.Connect()); + + User::LeaveIfError(iConnection.Open(iSocketServ)); + + TUint connectionCount = 0; + TInt error = iConnection.EnumerateConnections(connectionCount); + +// if (error || connectionCount < 1) + + TPckgBuf connectionInfo; + error = iConnection.GetConnectionInfo(1, connectionInfo); // First connection + +// if (error) +// LOGARG("Error %d retrieving connection info", error); + + error = iConnection.Attach(connectionInfo, RConnection::EAttachTypeNormal); + +// LOGARG("Connection attached %d", error); + +// LOGTXT("Opening http session"); + + iSession.OpenL(); + + RStringPool strPool = iSession.StringPool(); + RHTTPConnectionInfo connInfo = iSession.ConnectionInfo(); + connInfo.SetPropertyL(strPool.StringF(HTTP::EHttpSocketServ, + RHTTPSession::GetTable()), THTTPHdrVal(iSocketServ.Handle())); + TInt connPtr = reinterpret_cast(&iConnection); + connInfo.SetPropertyL(strPool.StringF(HTTP::EHttpSocketConnection, + RHTTPSession::GetTable()), THTTPHdrVal(connPtr)); +} + +RHTTPTransaction CHttpClient::GetL(const TDesC8& aUri) +{ + TUriParser8 uri; + uri.Parse(aUri); + + LOGARG("URI submitted is %S", &aUri); + + RStringPool strP = iSession.StringPool(); + RStringF method = strP.StringF(HTTP::EGET, RHTTPSession::GetTable()); + + RHTTPTransaction transaction = iSession.OpenTransactionL(uri, iCallback, method); + + _LIT8(KUserAgent, "OpenMAR/1.0 (Symbian)"); + _LIT8(KAccept, "*/*"); + + RHTTPHeaders hdr = transaction.Request().GetHeaderCollection(); + // Add headers appropriate to all methods + SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent); + SetHeaderL(hdr, HTTP::EAccept, KAccept); + + transaction.SubmitL(); + + return transaction; +} + +void CHttpClient::Stop(RHTTPTransaction& aTransaction) +{ + aTransaction.Cancel(); +} + +void CHttpClient::SetHeaderL(RHTTPHeaders aHeaders, TInt aHdrField, const TDesC8& aHdrValue) +{ + RStringF valStr = iSession.StringPool().OpenFStringL(aHdrValue); + THTTPHdrVal val(valStr); + aHeaders.SetFieldL(iSession.StringPool().StringF(aHdrField, RHTTPSession::GetTable()), val); + valStr.Close(); +} diff -r 000000000000 -r c316ab048e9d common/src/IconLoader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/src/IconLoader.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,49 @@ +/* + * Name : IconLoader.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "IconLoader.h" + +#include +#include + +CGulIcon* CreateIconL(const TDesC& aIconFile, TInt aBitmapId, TInt aMaskId, const TSize& aSize) +{ + CFbsBitmap* bitmap = 0; + CFbsBitmap* mask = 0; + + AknIconUtils::CreateIconL(bitmap, mask, aIconFile, aBitmapId, aMaskId); + + AknIconUtils::PreserveIconData(bitmap); + + TSize size; + + if (aSize.iHeight == -1 || aSize.iWidth == -1) + AknIconUtils::GetContentDimensions(bitmap, size); + else + size = aSize; + + AknIconUtils::SetSize(bitmap, size, EAspectRatioPreserved); + AknIconUtils::SetSize(mask, size, EAspectRatioPreserved); + + AknIconUtils::DestroyIconData(bitmap); + + CleanupStack::PushL(bitmap); + CleanupStack::PushL(mask); + + CGulIcon* icon = CGulIcon::NewL(bitmap, mask); + + CleanupStack::Pop(2, bitmap); + + return icon; +} diff -r 000000000000 -r c316ab048e9d common/src/Logger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/src/Logger.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,97 @@ +/* + * Name : Logger.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Logger.h" + +#include +#include + +void CLogger::Write(const TDesC8& aText) +{ + CLogger::InstanceL().DoWrite(aText); +} + +void CLogger::Write(TRefByValue aFmt, ...) +{ + VA_LIST list; + VA_START(list, aFmt); + + CLogger::InstanceL().iBuffer.FormatList(aFmt, list); + CLogger::InstanceL().DoWrite(CLogger::InstanceL().iBuffer); + + VA_END(list); +} + +void CLogger::Close() +{ + delete static_cast(UserSvr::DllTls(0)); + UserSvr::DllFreeTls(0); +} + +CLogger& CLogger::InstanceL() +{ + CLogger* self = static_cast(UserSvr::DllTls(0)); + + if (self == 0) + { + self = new(ELeave) CLogger; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + UserSvr::DllSetTls(0, self); + } + + return *self; +} + +void CLogger::ConstructL() +{ + User::LeaveIfError(iFs.Connect()); + + TFileName logName(PathInfo::PhoneMemoryRootPath()); + TPtrC appName(BaflUtils::ExtractAppNameFromFullName(RThread().FullName())); + logName.Append(appName); + _LIT(KLogFileExt, ".log"); + logName.Append(KLogFileExt); + + BaflUtils::EnsurePathExistsL(iFs, logName); + User::LeaveIfError(iFile.Replace(iFs, logName, EFileShareAny | EFileWrite)); +} + +CLogger::~CLogger() +{ + iFile.Close(); + iFs.Close(); +} + +void CLogger::DoWrite(const TDesC8& aText) +{ + const TInt KTimeRecordSize = 12; + TBuf8 timeText; + + TTime time; + time.HomeTime(); + TDateTime dateTime = time.DateTime(); + + _LIT8(KTimeFormat,"%02d:%02d:%02d.%02d "); + timeText.Format(KTimeFormat, dateTime.Hour(), dateTime.Minute(), dateTime.Second(), dateTime.MicroSecond()); + + iFile.Write(timeText); + iFile.Write(aText); + + _LIT8(KNewLine, "\r\n"); + iFile.Write(KNewLine); +// iFile.Flush(); +} diff -r 000000000000 -r c316ab048e9d interface/InterfaceUid.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/InterfaceUid.hrh Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,22 @@ +/* + * Name : InterfaceUid.hrh + * Description : ECOM interface UIDs + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef INTERFACEUID_HRH_ +#define INTERFACEUID_HRH_ + +#define KOverlayInterfaceUidValue 0x2002E1AC +#define KProviderInterfaceUidValue 0x2002E1AD +#define KObjectInterfaceUidValue 0x2002E1AE + +#endif diff -r 000000000000 -r c316ab048e9d interface/object/POIObject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/object/POIObject.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,85 @@ +/* + * Name : POIObject.h + * Description : ECOM interface definition + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef POIOBJECT_H_ +#define POIOBJECT_H_ + +#include "InterfaceUid.hrh" + +#include + +#include + +#include "Vector3d.h" + +namespace OpenMAR { + +class CPOIProvider; + +/** + * @brief POI object interface definition + * + * + */ +class CPOIObject : public CBase +{ +public: + static CPOIObject* NewL(const TDesC8& aMatch, const CPOIProvider& aProvider); + static CPOIObject* NewL(const TUid aImplementationUid, const CPOIProvider& aProvider); + ~CPOIObject(); + +protected: + CPOIObject(const CPOIProvider& aProvider); + +public: + const TCoordinate& GetCoordinate() const; + void SetCoordinate(const TCoordinate& aCoordinate); + + const Vector3d& GetPosition() const; + void SetPosition(const Vector3d& aPosition); + + TUint32 GetIdentifier() const; + void SetIdentifier(TUint32 aIdentifier); + + const TDesC& GetName() const; + void SetNameL(const TDesC& aName); +/* + const TDesC& GetDescription() const; + void SetDescription(const TDesC& aName); + + TReal32 GetCoverageRadius() const; + void SetCoverageRadius(TReal32 aCoverageRadius); +*/ + virtual void Render() const = 0; + +public: + static TBool IdentityRelation(const CPOIObject& aLeft, const CPOIObject& aRight); + +protected: + const CPOIProvider& iProvider; + + TCoordinate iCoordinate; + Vector3d iPosition; + TUint32 iIdentifier; + HBufC* iName; + +private: + TUid iDtor_ID_Key; +}; + +#include "POIObject.inl" + +} + +#endif // POIOBJECT_H_ diff -r 000000000000 -r c316ab048e9d interface/object/POIObject.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/object/POIObject.inl Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,96 @@ +/* + * Name : POIObject.inl + * Description : ECOM interface definition + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +inline CPOIObject* CPOIObject::NewL(const TDesC8& aMatch, const CPOIProvider& aProvider) +{ + const TUid KCPOIRendererInterfaceUid = { KObjectInterfaceUidValue }; + + TAny* param = const_cast(&aProvider); + + TEComResolverParams resolverParams; + resolverParams.SetDataType(aMatch); + resolverParams.SetWildcardMatch(ETrue); + + TAny* interface = REComSession::CreateImplementationL(KCPOIRendererInterfaceUid, + _FOFF(CPOIObject, iDtor_ID_Key), param, resolverParams); + + return reinterpret_cast (interface); +} + +inline CPOIObject* CPOIObject::NewL(const TUid aImplementationUid, const CPOIProvider& aProvider) +{ + TAny* param = const_cast(&aProvider); + + TAny* interface = REComSession::CreateImplementationL(aImplementationUid, + _FOFF(CPOIObject, iDtor_ID_Key), param); + + return reinterpret_cast (interface); +} + +inline CPOIObject::~CPOIObject() +{ + REComSession::DestroyedImplementation(iDtor_ID_Key); +} + +inline CPOIObject::CPOIObject(const CPOIProvider& aProvider) + : iProvider(aProvider) +{} + +inline const TCoordinate& CPOIObject::GetCoordinate() const +{ + return iCoordinate; +} + +inline void CPOIObject::SetCoordinate(const TCoordinate& aCoordinate) +{ + iCoordinate = aCoordinate; +} + +inline const Vector3d& CPOIObject::GetPosition() const +{ + return iPosition; +} + +inline void CPOIObject::SetPosition(const Vector3d& aPosition) +{ + iPosition = aPosition; +} + +inline TUint32 CPOIObject::GetIdentifier() const +{ + return iIdentifier; +} + +inline void CPOIObject::SetIdentifier(TUint32 aIdentifier) +{ + iIdentifier = aIdentifier; +} + +inline const TDesC& CPOIObject::GetName() const +{ + return iName? *iName : KNullDesC(); +} + +inline void CPOIObject::SetNameL(const TDesC& aName) +{ + delete iName; + iName = 0; + + iName = aName.AllocL(); +} + +inline TBool CPOIObject::IdentityRelation(const CPOIObject& aLeft, const CPOIObject& aRight) +{ + return aLeft.GetIdentifier() == aRight.GetIdentifier(); +} diff -r 000000000000 -r c316ab048e9d interface/overlay/POIOverlay.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/overlay/POIOverlay.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,62 @@ +/* + * Name : POIOverlay.h + * Description : ECOM interface definition + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef POIOVERLAY_H_ +#define POIOVERLAY_H_ + +#include "InterfaceUid.hrh" + +#include + +class RWindow; +class TRect; +class CFbsBitmap; + +namespace OpenMAR { + +/** + * @brief POI overlay interface definition + * + * The overlay is in charge of getting input from sensors for position and orientation + * estimation, and retrieving proper POIs from providers. + * + */ +class CPOIOverlay : public CBase +{ +public: + struct SParameter { + RWindow& iWindow; + const TRect& iRect; + }; + +public: + static CPOIOverlay* NewL(const TDesC8& aMatch, SParameter& aParam); + static CPOIOverlay* NewL(const TUid aImplementationUid, SParameter& aParam); + ~CPOIOverlay(); + + virtual void StartL() = 0; + virtual void Stop() = 0; + virtual const CFbsBitmap& RenderScene() = 0; + + virtual TInt GetFocusedPOI() = 0; + +private: + TUid iDtor_ID_Key; +}; + +#include "POIOverlay.inl" + +} + +#endif // POIOVERLAY_H_ diff -r 000000000000 -r c316ab048e9d interface/overlay/POIOverlay.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/overlay/POIOverlay.inl Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,40 @@ +/* + * Name : POIOverlay.inl + * Description : ECOM interface definition + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +inline CPOIOverlay* CPOIOverlay::NewL(const TDesC8& aMatch, SParameter& aParam) +{ + const TUid KCPOIOverlayInterfaceUid = { KOverlayInterfaceUidValue }; + + TEComResolverParams resolverParams; + resolverParams.SetDataType(aMatch); + resolverParams.SetWildcardMatch(ETrue); + + TAny* interface = REComSession::CreateImplementationL(KCPOIOverlayInterfaceUid, + _FOFF(CPOIOverlay, iDtor_ID_Key), &aParam, resolverParams); + + return reinterpret_cast (interface); +} + +inline CPOIOverlay* CPOIOverlay::NewL(const TUid aImplementationUid, SParameter& aParam) +{ + TAny* interface = REComSession::CreateImplementationL(aImplementationUid, + _FOFF(CPOIOverlay, iDtor_ID_Key), &aParam); + + return reinterpret_cast (interface); +} + +inline CPOIOverlay::~CPOIOverlay() +{ + REComSession::DestroyedImplementation(iDtor_ID_Key); +} diff -r 000000000000 -r c316ab048e9d interface/provider/POIProvider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/provider/POIProvider.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,67 @@ +/* + * Name : POIProvider.h + * Description : ECOM interface definition + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef POIPROVIDER_H_ +#define POIPROVIDER_H_ + +#include "InterfaceUid.hrh" + +#include +#include + +namespace OpenMAR { + +class CPOIProvider; +class CPOIObject; + +/** + * @brief POI provider notifier + */ +class MPOIProviderObserver +{ +public: + virtual void POIProviderLoadedL(CPOIProvider* aProvider, TInt aError) = 0; + virtual void POIObjectCreatedL(CPOIObject* aPOIObject) = 0; + virtual void POIObjectUpdatedL(CPOIObject* aPOIObject) = 0; +}; + +/** + * @brief POI provider interface definition + * + * Retrieves geolocated points of interest from a local or remote resource, + * creating corresponding CPosLandmark objects + */ +class CPOIProvider : public CBase +{ +public: + static CPOIProvider* NewL(const TDesC8& aMatch, const TDesC8& aProviderUri); + static CPOIProvider* NewL(const TUid aImplementationUid, const TDesC8& aProviderUri); + ~CPOIProvider(); + + void SetObserver(MPOIProviderObserver* aObserver); + + virtual void RetrieveL(const TCoordinate& aCoordinate, TReal32 aRadius) = 0; + +protected: + MPOIProviderObserver* iObserver; + +private: + TUid iDtor_ID_Key; +}; + +#include "POIProvider.inl" + +} + +#endif // POIPROVIDER_H_ diff -r 000000000000 -r c316ab048e9d interface/provider/POIProvider.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/provider/POIProvider.inl Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,49 @@ +/* + * Name : POIProvider.inl + * Description : ECOM interface definition + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +inline CPOIProvider* CPOIProvider::NewL(const TDesC8& aMatch, const TDesC8& aProviderUri) +{ + const TUid KCPOIProviderInterfaceUid = { KProviderInterfaceUidValue }; + + TDesC8& param = const_cast(aProviderUri); + + TEComResolverParams resolverParams; + resolverParams.SetDataType(aMatch); + resolverParams.SetWildcardMatch(ETrue); + + TAny* interface = REComSession::CreateImplementationL(KCPOIProviderInterfaceUid, + _FOFF(CPOIProvider, iDtor_ID_Key), ¶m, resolverParams); + + return reinterpret_cast (interface); +} + +inline CPOIProvider* CPOIProvider::NewL(const TUid aImplementationUid, const TDesC8& aProviderUri) +{ + TDesC8& param = const_cast(aProviderUri); + + TAny* interface = REComSession::CreateImplementationL(aImplementationUid, + _FOFF(CPOIProvider, iDtor_ID_Key), ¶m); + + return reinterpret_cast (interface); +} + +inline CPOIProvider::~CPOIProvider() +{ + REComSession::DestroyedImplementation(iDtor_ID_Key); +} + +inline void CPOIProvider::SetObserver(MPOIProviderObserver* aObserver) +{ + iObserver = aObserver; +} diff -r 000000000000 -r c316ab048e9d plugin/poi/geonames/data/Geonames.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/geonames/data/Geonames.rss Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,66 @@ +/* + * Name : Geonames.rss + * Description : Interface collection + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include + +#include "InterfaceUid.hrh" +#include "ImplementationUid.hrh" + +RESOURCE REGISTRY_INFO theInfo +{ + // UID for the DLL + dll_uid = KDllUidValue; + + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = KProviderInterfaceUidValue; + + implementations = + { + // Info for CProvider + IMPLEMENTATION_INFO + { + implementation_uid = KProviderImplementationUidValue; + version_no = 1; + display_name = "Geonames Provider"; + default_data = "geonames"; + opaque_data = ""; + } + }; + } + , + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = KObjectInterfaceUidValue; + + implementations = + { + // Info for CObject + IMPLEMENTATION_INFO + { + implementation_uid = KObjectImplementationUidValue; + version_no = 1; + display_name = "Geonames Object"; + default_data = "geonames"; + opaque_data = ""; + } + }; + } + }; +} diff -r 000000000000 -r c316ab048e9d plugin/poi/geonames/ecom/inc/ImplementationUid.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/geonames/ecom/inc/ImplementationUid.hrh Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,23 @@ +/* + * Name : ImplementationUid.hrh + * Description : ECOM implementation UIDs + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef IMPLEMENTATIONUID_HRH_ +#define IMPLEMENTATIONUID_HRH_ + +#define KDllUidValue 0x2002E1B2 + +#define KProviderImplementationUidValue 0x2002E1B2 +#define KObjectImplementationUidValue 0x2002E1B3 + +#endif diff -r 000000000000 -r c316ab048e9d plugin/poi/geonames/ecom/src/Proxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/geonames/ecom/src/Proxy.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,34 @@ +/* + * Name : Proxy.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include + +#include + +#include "ImplementationUid.hrh" +#include "Provider.h" +#include "Object.h" + +const TImplementationProxy ImplementationTable[] = +{ + IMPLEMENTATION_PROXY_ENTRY(KProviderImplementationUidValue, CProvider::NewL), + IMPLEMENTATION_PROXY_ENTRY(KObjectImplementationUidValue, Geonames::CObject::NewL), +}; + +// Function used to return an instance of the proxy table. +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) +{ + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; +} diff -r 000000000000 -r c316ab048e9d plugin/poi/geonames/group/Geonames.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/geonames/group/Geonames.mmp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,94 @@ +/* + * Name : Geonames.mmp + * Description : Project definition + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +TARGET Geonames_0x2002E1B2.dll +TARGETTYPE PLUGIN + +UID 0x10009D8D 0x2002E1B2 +SECUREID 0x2002E1B2 + +CAPABILITY LocalServices Location NetworkServices ReadUserData ReadDeviceData SwEvent UserEnvironment WriteDeviceData WriteUserData //MultimediaDD + +MACRO __DEBUG__ + +SOURCEPATH ..\ecom\src +SOURCE Proxy.cpp + +SOURCEPATH ..\provider\src +SOURCE Provider.cpp +SOURCE Loader.cpp +SOURCE Entry.cpp + +SOURCEPATH ..\object\src +SOURCE Object.cpp + +SOURCEPATH ..\..\..\..\common\src +SOURCE HttpClient.cpp +SOURCE IconLoader.cpp +SOURCE Logger.cpp + +USERINCLUDE ..\..\..\..\interface +USERINCLUDE ..\..\..\..\interface\provider +USERINCLUDE ..\..\..\..\interface\object + +USERINCLUDE ..\ecom\inc + +USERINCLUDE ..\provider\inc +USERINCLUDE ..\object\inc +USERINCLUDE ..\..\..\..\common\inc + +SYSTEMINCLUDE \epoc32\include + +SOURCEPATH ..\data + +START RESOURCE Geonames.rss + TARGET Geonames_0x2002E1B2.rsc +END + +LIBRARY euser.lib +LIBRARY eikcore.lib +LIBRARY cone.lib +LIBRARY ecom.lib +LIBRARY avkon.lib + +LIBRARY eposlandmarks.lib +LIBRARY hash.lib + +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY PlatformEnv.lib + +LIBRARY SenXml.lib +LIBRARY XmlFramework.lib +LIBRARY charconv.lib + +LIBRARY http.lib +LIBRARY inetprotutil.lib +LIBRARY esock.lib + +LIBRARY libgles_cm.lib +LIBRARY ws32.lib + +LIBRARY bitgdi.lib +LIBRARY fbscli.lib +LIBRARY gdi.lib +LIBRARY egul.lib +LIBRARY ImageConversion.lib +LIBRARY AknIcon.lib + +LIBRARY CentralRepository.lib + +LIBRARY lbs.lib +LIBRARY SensrvClient.lib +LIBRARY SensrvUtil.lib diff -r 000000000000 -r c316ab048e9d plugin/poi/geonames/object/inc/Object.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/geonames/object/inc/Object.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,44 @@ +/* + * Name : Object.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef OBJECT_H_ +#define OBJECT_H_ + +#include "POIObject.h" + +namespace Geonames { + +/** + * @brief Implements basic rendering for geonames.org landmarks + */ +class CObject : public OpenMAR::CPOIObject +{ +public: + static CObject* NewL(OpenMAR::CPOIProvider* aProvider); + ~CObject(); + +protected: + CObject(OpenMAR::CPOIProvider* aProvider); + void ConstructL(); + +public: + void Render() const; + +private: + TUint iTextureId; +}; + +} + +#endif diff -r 000000000000 -r c316ab048e9d plugin/poi/geonames/object/src/Object.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/geonames/object/src/Object.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,175 @@ +/* + * Name : Object.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Object.h" + +#include "Vector3d.h" + +#include +#include +#include +#include +#include + +#include "Logger.h" + +Geonames::CObject* Geonames::CObject::NewL(OpenMAR::CPOIProvider* aProvider) +{ + CObject* self = new(ELeave) Geonames::CObject(aProvider); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +Geonames::CObject::~CObject() +{ + ::glDeleteTextures(1, &iTextureId); +} + +Geonames::CObject::CObject(OpenMAR::CPOIProvider* aProvider) + : OpenMAR::CPOIObject(*aProvider) +{} + +/* + * Create texture to represent the object + */ +void Geonames::CObject::ConstructL() +{ + CFbsBitmap* bitmap = new(ELeave) CFbsBitmap; + CleanupStack::PushL(bitmap); + + // Use a 64x64 bitmap + const TSize bitmapSize(64, 64); + User::LeaveIfError(bitmap->Create(bitmapSize, EColor16MA)); + + CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmap); + CleanupStack::PushL(bitmapDevice); + + CFbsBitGc* bitmapContext = 0; + User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext)); + CleanupStack::PushL(bitmapContext); + + // Define colors to use + bitmapContext->SetBrushColor(KRgbBlue); + bitmapContext->SetBrushStyle(CFbsBitGc::ESolidBrush); + + bitmapContext->SetPenColor(KRgbRed); + bitmapContext->SetPenStyle(CFbsBitGc::ESolidPen); + + const CFont* font = AknLayoutUtils::FontFromId(ELatinPlain12, 0); + bitmapContext->UseFont(font); + + bitmapContext->Clear(); + + const TRect bitmapRect(TPoint(0, 0), bitmapSize); + bitmapContext->DrawRect(bitmapRect); + + // Set some text if needed + _LIT(KTitle, "Test"); + TPoint titlePos(font->MaxNormalCharWidthInPixels(), font->HeightInPixels()); + bitmapContext->DrawText(KTitle(), titlePos); + + // Convert to GL_RGBA + const TInt dataSize = bitmapSize.iWidth * bitmapSize.iHeight * sizeof(TUint32); + TUint8* data = new(ELeave) TUint8[dataSize]; + + bitmap->LockHeap(); + + TUint8* rgb = reinterpret_cast(bitmap->DataAddress()); + + for(TInt i = 0; i < dataSize; i += 4) + { + data[i + 0] = rgb[i + 2]; + data[i + 1] = rgb[i + 1]; + data[i + 2] = rgb[i + 0]; + data[i + 3] = rgb[i + 3]; + } + + ::glGenTextures(1, &iTextureId); + ::glBindTexture(GL_TEXTURE_2D, iTextureId); + + ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + ::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bitmapSize.iWidth, bitmapSize.iHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); + + bitmap->UnlockHeap(); + + delete data; + + CleanupStack::PopAndDestroy(3, bitmap); +} + +void Geonames::CObject::Render() const +{ + /* + * This is a special case for points or planes in space. Given that a usual POI + * does not provide of any transformation to be applied on it, we determine the + * angle in the XY plane with respect to the observer and apply that rotation to + * the object. + * + * This way, all POIs will face the observer regardless their position. Other + * objects (3D Landmarks, etc) should provide their own transformations in some + * proper way. + */ + + TReal angle = 0; + Math::ATan(angle, iPosition.mX, iPosition.mY); + angle *= -KRadToDeg; + + /* + * We could also apply some scaling calculation to compensate the size of + * objects projected at a long distance from the camera. + * For now we just use a constant value + */ + + TReal scale = 128.0f; + + // Apply transformations to the object and render it + + const TInt unity = 1 << 16; + + GLfixed vertices[] = { + -unity / 2, 0, 0, + unity / 2, 0, 0, + -unity / 2, 0, unity, + unity / 2, 0, unity, + }; + + GLfixed texCoords[] = { + 0, unity, + unity, unity, + 0, 0, + unity, 0 + }; + + ::glPushMatrix(); + + ::glTranslatef(iPosition.mX, iPosition.mY, iPosition.mZ); + ::glRotatef(angle, 0, 0, 1); + ::glScalef(scale, 1.0f, scale); + + ::glEnable(GL_TEXTURE_2D); + ::glBindTexture(GL_TEXTURE_2D, iTextureId); + ::glVertexPointer(3, GL_FIXED, 0, vertices); + ::glTexCoordPointer(2, GL_FIXED, 0, texCoords); + ::glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + ::glDisable(GL_TEXTURE_2D); + + ::glPopMatrix(); +} diff -r 000000000000 -r c316ab048e9d plugin/poi/geonames/provider/inc/Entry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/geonames/provider/inc/Entry.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,66 @@ +/* + * Name : Entry.h + * Description : Encapsulates a findNearbyWikipedia entry + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef ENTRY_H_ +#define ENTRY_H_ + +#include +#include + +class CEntry : public CBase +{ +public: + static CEntry* NewL(); + ~CEntry(); + +protected: + CEntry(); + void ConstructL(); + +public: + void Reset(); + + void EnterState(const TDesC8& aTag); + void ExitState(); + void FeedState(const TDesC8& aBytes); + +// TBool IsValid() const; + +protected: + +private: + enum TState { + EUnknown, + ETitle, + ESummary, +// EFeature, + EElevation, + ELat, + ELng, + EWikipediaUrl + } iState; + +//private: +public: + // Limits should be defined by provider (geonames.org) + TBuf8 iTitle; + TBuf8 iSummary; +// TBuf8 iFeature; + TBuf8 iElevation; + TBuf8 iLat; + TBuf8 iLng; + TBuf8 iWikipediaUrl; +}; + +#endif // ENTRY_H_ diff -r 000000000000 -r c316ab048e9d plugin/poi/geonames/provider/inc/Loader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/geonames/provider/inc/Loader.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,86 @@ +/* + * Name : Loader.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef LOADER_H_ +#define LOADER_H_ + +#include +#include +#include +#include + +#include + +//class CPosLandmark; +class TCoordinate; +class CHttpClient; +class CEntry; + +class MLandmarkLoaderObserver +{ +public: + virtual void LandmarkLoaderOpenedL(TInt aError) = 0; + virtual void LandmarkLoaderItemCreatedL(const CPosLandmark& aLandmark) = 0; +}; + +class CLoader : public CBase, public MHTTPTransactionCallback, public Xml::MContentHandler +{ +public: + static CLoader* NewL(MLandmarkLoaderObserver& aObserver); + ~CLoader(); + +protected: + CLoader(MLandmarkLoaderObserver& aObserver); + void ConstructL(); + +public: + void RequestL(const TCoordinate& aPosition, TReal32 aRadius); + +protected: + // From MHTTPTransactionCallback + void MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent); + TInt MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent); + +protected: + // from MContentHandler + void OnStartDocumentL(const Xml::RDocumentParameters& aDocParam, TInt aErrorCode); + void OnEndDocumentL(TInt aErrorCode); + void OnStartElementL(const Xml::RTagInfo& aElement, const Xml::RAttributeArray& aAttributes, TInt aErrorCode); + void OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode); + void OnContentL(const TDesC8& aBytes, TInt aErrorCode); + void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode); + void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); + void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); + void OnSkippedEntityL(const RString& aName, TInt aErrorCode); + void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode); + void OnError(TInt aErrorCode); + TAny* GetExtendedInterface(const TInt32 aUid); + + void NotifyPOIEntryL(); + +private: + MLandmarkLoaderObserver& iObserver; + + CHttpClient* iClient; + Xml::CParser* iParser; + + CEntry* iEntry; + + enum TState { + EInvalid, + EValid + } iState; +}; + +#endif diff -r 000000000000 -r c316ab048e9d plugin/poi/geonames/provider/inc/Provider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/geonames/provider/inc/Provider.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,44 @@ +/* + * Name : Provider.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef PROVIDER_H_ +#define PROVIDER_H_ + +#include "POIProvider.h" +#include "POIObject.h" + +#include "Loader.h" + +class CProvider : public OpenMAR::CPOIProvider, public MLandmarkLoaderObserver +{ +public: + static CProvider* NewL(); + ~CProvider(); + +protected: + CProvider(); + void ConstructL(); + + // From MLandmarkLoaderObserver + void LandmarkLoaderOpenedL(TInt aError); + void LandmarkLoaderItemCreatedL(const CPosLandmark& aLandmark); + +public: + void RetrieveL(const TCoordinate& aCoordinate, TReal32 aRadius); + +private: + CLoader* iLoader; +}; + +#endif diff -r 000000000000 -r c316ab048e9d plugin/poi/geonames/provider/src/Entry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/geonames/provider/src/Entry.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,132 @@ +/* + * Name : Entry.cpp + * Description : Encapsulates a findNearbyWikipedia entry + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Entry.h" + +CEntry* CEntry::NewL() +{ + CEntry* self = new(ELeave) CEntry; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +CEntry::~CEntry() +{} + +CEntry::CEntry() +{} + +void CEntry::ConstructL() +{} + +void CEntry::Reset() +{ + iTitle.Zero(); + iSummary.Zero(); + iElevation.Zero(); + iLat.Zero(); + iLng.Zero(); + iWikipediaUrl.Zero(); +} + +void CEntry::EnterState(const TDesC8& aTag) +{ + _LIT8(KTitleTag, "title"); + _LIT8(KSummaryTag, "summary"); +// _LIT8(KFeatureTag, "feature"); + _LIT8(KElevationTag, "elevation"); + _LIT8(KLatTag, "lat"); + _LIT8(KLngTag, "lng"); + _LIT8(KWikipediaUrlTag, "wikipediaUrl"); + + if (aTag == KTitleTag) + iState = ETitle; + else if (aTag == KSummaryTag) + iState = ESummary; + else if (aTag == KElevationTag) + iState = EElevation; + else if (aTag == KLatTag) + iState = ELat; + else if (aTag == KLngTag) + iState = ELng; + else if (aTag == KWikipediaUrlTag) + iState = EWikipediaUrl; + else + iState = EUnknown; +} + +void CEntry::ExitState() +{ + iState = EUnknown; +} + +void CEntry::FeedState(const TDesC8& aBytes) +{ + switch (iState) + { + case ETitle: + { + TInt space = iTitle.MaxLength() - iTitle.Length(); + TInt min = Min(space, aBytes.Length()); + iTitle.Append(aBytes.Left(min)); + break; + } + + case ESummary: + { + TInt space = iSummary.MaxLength() - iSummary.Length(); + TInt min = Min(space, aBytes.Length()); + iSummary.Append(aBytes.Left(min)); + break; + } + + case EElevation: + { + TInt space = iElevation.MaxLength() - iElevation.Length(); + TInt min = Min(space, aBytes.Length()); + iElevation.Append(aBytes.Left(min)); + break; + } + + case ELat: + { + TInt space = iLat.MaxLength() - iLat.Length(); + TInt min = Min(space, aBytes.Length()); + iLat.Append(aBytes.Left(min)); + break; + } + + case ELng: + { + TInt space = iLng.MaxLength() - iLng.Length(); + TInt min = Min(space, aBytes.Length()); + iLng.Append(aBytes.Left(min)); + break; + } + + case EWikipediaUrl: + { + TInt space = iWikipediaUrl.MaxLength() - iWikipediaUrl.Length(); + TInt min = Min(space, aBytes.Length()); + iWikipediaUrl.Append(aBytes.Left(min)); + break; + } + + default: + break; + } +} diff -r 000000000000 -r c316ab048e9d plugin/poi/geonames/provider/src/Loader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/geonames/provider/src/Loader.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,264 @@ +/* + * Name : Loader.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Loader.h" + +#include "HttpClient.h" +#include "Entry.h" + +#include +#include +#include +#include + +#include +#include + +#include "Logger.h" + +CLoader* CLoader::NewL(MLandmarkLoaderObserver& aObserver) +{ + CLoader* self = new(ELeave) CLoader(aObserver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +CLoader::~CLoader() +{ + delete iEntry; + delete iParser; + delete iClient; +} + +CLoader::CLoader(MLandmarkLoaderObserver& aObserver) + : iObserver(aObserver) +{ +} + +void CLoader::ConstructL() +{ + LOGTXT("[GEONAMES] Creating POI loader"); + + iClient = CHttpClient::NewL(*this); + + _LIT8(KXmlMimeType, "text/xml"); + iParser = Xml::CParser::NewL(KXmlMimeType, *this); + + iEntry = CEntry::NewL(); +} + +void CLoader::RequestL(const TCoordinate& aPosition, TReal32 aRadius) +{ + // Regardless of system locale, always use point as decimal separator character + // Also use a maximum of 6 chars to represent each float + TRealFormat realFormat; + realFormat.iPoint = TChar('.'); + realFormat.iWidth = 8; + realFormat.iPlaces = 5; + + TBuf8 latitude; + latitude.Num(aPosition.Latitude(), realFormat); + + TBuf8 longitude; + longitude.Num(aPosition.Longitude(), realFormat); + + // Convert to kilometers + const TInt radius = static_cast(aRadius / 1000); + + TBuf8<2> langCode; + + // Use device's language to retrieve entries + HBufC* tag = AknLangUtils::DisplayLanguageTagL(); + langCode.Copy(tag->Left(2)); + delete tag; + + // Set a limit to entries retrieved + const TInt maxRows = 20; + + TBuf8<256> uri; + _LIT8(KUri, "http://ws.geonames.org/findNearbyWikipedia?lat=%S&lng=%S&radius=%d&lang=%S&maxRows=%d"); + uri.Format(KUri, &latitude, &longitude, radius, &langCode, maxRows); + + iClient->GetL(uri); +} + +void CLoader::MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent) +{ + switch (aEvent.iStatus) + { + case THTTPEvent::EGotResponseHeaders: + { + RHTTPResponse resp = aTransaction.Response(); + TInt status = resp.StatusCode(); + + // Treat any 2xx HTTP code as successful request + TInt error = HTTPStatus::IsSuccessful(status)? KErrNone : KErrGeneral; + + if (error == KErrNone) + iParser->ParseBeginL(); + + iObserver.LandmarkLoaderOpenedL(error); + + break; + } + + case THTTPEvent::EGotResponseBodyData: + { + MHTTPDataSupplier* body = aTransaction.Response().Body(); + + TPtrC8 dataChunk; + body->GetNextDataPart(dataChunk); + iParser->ParseL(dataChunk); + body->ReleaseData(); + + break; + } + + case THTTPEvent::EResponseComplete: + LOGTXT("[GEONAMES] HTTP response complete"); + + iParser->ParseEndL(); + break ; + + case THTTPEvent::ESucceeded: + case THTTPEvent::EFailed: + { + RHTTPResponse resp = aTransaction.Response(); + TInt status = resp.StatusCode(); + + LOGARG("[GEONAMES] HTTP response status code %d", status); + + aTransaction.Close(); + + break; + } + + default: + LOGARG("[GEONAMES] HTTP unknown event %d", aEvent.iStatus); + + iObserver.LandmarkLoaderOpenedL(KErrUnknown); + + aTransaction.Close(); + break; + } +} + +TInt CLoader::MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent) +{ + return KErrNone; +} + +void CLoader::OnStartDocumentL(const Xml::RDocumentParameters& aDocParam, TInt aErrorCode) +{} + +void CLoader::OnEndDocumentL(TInt aErrorCode) +{} + +void CLoader::OnStartElementL(const Xml::RTagInfo& aElement, const Xml::RAttributeArray& aAttributes, TInt aErrorCode) +{ + _LIT8(KEntryTag, "entry"); + if (aElement.LocalName().DesC() == KEntryTag) + iState = EValid; + else if (iState == EValid) + iEntry->EnterState(aElement.LocalName().DesC()); +} + +void CLoader::OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode) +{ + _LIT8(KEntryTag, "entry"); + if (aElement.LocalName().DesC() == KEntryTag) + { + NotifyPOIEntryL(); + + iEntry->Reset(); + iState = EInvalid; + } + else + iEntry->ExitState(); +} + +void CLoader::OnContentL(const TDesC8& aBytes, TInt aErrorCode) +{ + iEntry->FeedState(aBytes); +} + +void CLoader::OnStartPrefixMappingL(const RString& /*aPrefix*/, const RString& /*aUri*/, TInt /*aErrorCode*/) +{} + +void CLoader::OnEndPrefixMappingL(const RString& /*aPrefix*/, TInt /*aErrorCode*/) +{} + +void CLoader::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, TInt /*aErrorCode*/) +{} + +void CLoader::OnSkippedEntityL(const RString& /*aName*/, TInt /*aErrorCode*/) +{} + +void CLoader::OnProcessingInstructionL(const TDesC8& /*aTarget*/, const TDesC8& /*aData*/, TInt /*aErrorCode*/) +{} + +void CLoader::OnError(TInt /*aErrorCode*/) +{} + +TAny* CLoader::GetExtendedInterface(const TInt32 /*aUid*/) +{ + return 0; +} + +/* + * Notify observer of new XML entry + */ +void CLoader::NotifyPOIEntryL() +{ + CPosLandmark* landmark = CPosLandmark::NewLC(); + + HBufC* title = CnvUtfConverter::ConvertToUnicodeFromUtf8L(iEntry->iTitle); + CleanupStack::PushL(title); + landmark->SetLandmarkNameL(*title); + CleanupStack::PopAndDestroy(title); + + HBufC* description = CnvUtfConverter::ConvertToUnicodeFromUtf8L(iEntry->iSummary); + CleanupStack::PushL(description); + landmark->SetLandmarkDescriptionL(*description); + CleanupStack::PopAndDestroy(description); + + TLex8 lex; + + lex.Assign(iEntry->iLat); + TReal32 lat = 0; + lex.Val(lat); + + lex.Assign(iEntry->iLng); + TReal32 lng = 0; + lex.Val(lng); + + lex.Assign(iEntry->iElevation); + TReal32 elevation = 0; + lex.Val(elevation); + + TCoordinate coordinate(lat, lng, elevation); + landmark->SetPositionL(TLocality(coordinate, 0, 0)); + + HBufC* url = HBufC::NewLC(iEntry->iWikipediaUrl.Length()); + url->Des().Copy(iEntry->iWikipediaUrl); + landmark->SetPositionFieldL(EPositionFieldMediaLinksStart, url->Left(KPosLmMaxTextFieldLength)); + CleanupStack::PopAndDestroy(url); + + iObserver.LandmarkLoaderItemCreatedL(*landmark); + + CleanupStack::PopAndDestroy(landmark); +} diff -r 000000000000 -r c316ab048e9d plugin/poi/geonames/provider/src/Provider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/geonames/provider/src/Provider.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,127 @@ +/* + * Name : Provider.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Provider.h" + +#include +#include + +#include "Logger.h" + +/* + * Generates a unique id using name and coordinates as a seed + */ +TUint32 GenerateIdL(const CPosLandmark& aLandmark) +{ + TPtrC name; + aLandmark.GetLandmarkName(name); + + TLocality coordinate; + aLandmark.GetPosition(coordinate); + + HBufC8* name8 = HBufC8::NewLC(name.Length()); + name8->Des().Copy(name); + + TRealFormat realFormat; + realFormat.iPoint = TChar('.'); // Override TLocale::DecimalSeparator() as separator + realFormat.iWidth = 8; // Set max width of number + realFormat.iPlaces = 5; // Set max width of decimal portion + + TBuf8 latitude; + latitude.Num(coordinate.Latitude(), realFormat); + + TBuf8 longitude; + longitude.Num(coordinate.Longitude(), realFormat); + + CSHA1* hash = CSHA1::NewL(); + CleanupStack::PushL(hash); + hash->Update(*name8); + hash->Update(latitude); + TPtrC8 result = hash->Final(longitude); + + // Use only 32 bits from hash + const TUint32* ptr = reinterpret_cast(result.Ptr()); + TUint32 value = *ptr; + + CleanupStack::PopAndDestroy(2, name8); // hash, name8 + + return value; +} + +// Create instance of concrete ECOM interface implementation +CProvider* CProvider::NewL() +{ + CProvider* self = new(ELeave) CProvider(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +CProvider::~CProvider() +{ + delete iLoader; +} + +CProvider::CProvider() +{ +} + +void CProvider::ConstructL() +{ + iLoader = CLoader::NewL(*this); +} + +void CProvider::LandmarkLoaderOpenedL(TInt aError) +{ + if (iObserver) + iObserver->POIProviderLoadedL(this, aError); +} + +void CProvider::LandmarkLoaderItemCreatedL(const CPosLandmark& aLandmark) +{ + if (iObserver) + { + TPosLmItemId id = aLandmark.LandmarkId(); + + if (id == KPosLmNullItemId) + id = GenerateIdL(aLandmark); + + _LIT8(KObject, "geonames"); + OpenMAR::CPOIObject* object = OpenMAR::CPOIObject::NewL(KObject, *this); + CleanupStack::PushL(object); + + object->SetIdentifier(id); + + TLocality locality; + aLandmark.GetPosition(locality); + object->SetCoordinate(locality); + + TPtrC name; + aLandmark.GetLandmarkName(name); + object->SetNameL(name); + + iObserver->POIObjectCreatedL(object); // Transfers ownership + + CleanupStack::Pop(object); + } +} + +void CProvider::RetrieveL(const TCoordinate& aCoordinate, TReal32 aRadius) +{ + LOGARG("[GEONAMES] Retrieving entries from %f %f %f", aCoordinate.Latitude(), aCoordinate.Longitude(), aCoordinate.Altitude()); + + iLoader->RequestL(aCoordinate, aRadius); +} diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/data/Landmarks.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/data/Landmarks.rss Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,85 @@ +/* + * Name : Landmarks.rss + * Description : Interface collection + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include + +#include "InterfaceUid.hrh" +#include "ImplementationUid.hrh" + +RESOURCE REGISTRY_INFO theInfo +{ + // UID for the DLL. We use UID of first implementation + dll_uid = KDllUidValue; + + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = KOverlayInterfaceUidValue; + + implementations = + { + // Info for COverlay + IMPLEMENTATION_INFO + { + implementation_uid = KOverlayImplementationUidValue; + version_no = 1; + display_name = "Default Overlay"; + default_data = "default"; + opaque_data = ""; + } + }; + } + , + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = KProviderInterfaceUidValue; + + implementations = + { + // Info for CProvider + IMPLEMENTATION_INFO + { + implementation_uid = KProviderImplementationUidValue; + version_no = 1; + display_name = "LMX Provider"; + default_data = "lmx"; + opaque_data = ""; + } + }; + } + , + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = KObjectInterfaceUidValue; + + implementations = + { + // Info for CRenderer + IMPLEMENTATION_INFO + { + implementation_uid = KObjectImplementationUidValue; + version_no = 1; + display_name = "LMX Object"; + default_data = "lmx"; + opaque_data = ""; + } + }; + } + }; +} diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/ecom/inc/ImplementationUid.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/ecom/inc/ImplementationUid.hrh Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,24 @@ +/* + * Name : ImplementationUid.hrh + * Description : ECOM implementation UIDs + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef IMPLEMENTATIONUID_HRH_ +#define IMPLEMENTATIONUID_HRH_ + +#define KDllUidValue 0x2002E1AF + +#define KOverlayImplementationUidValue 0x2002E1AF +#define KProviderImplementationUidValue 0x2002E1B0 +#define KObjectImplementationUidValue 0x2002E1B1 + +#endif diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/ecom/src/Proxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/ecom/src/Proxy.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,36 @@ +/* + * Name : Proxy.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include + +#include + +#include "ImplementationUid.hrh" +#include "Overlay.h" +#include "Provider.h" +#include "Object.h" + +const TImplementationProxy ImplementationTable[] = +{ + IMPLEMENTATION_PROXY_ENTRY(KOverlayImplementationUidValue, COverlay::NewL), + IMPLEMENTATION_PROXY_ENTRY(KProviderImplementationUidValue, CProvider::NewL), + IMPLEMENTATION_PROXY_ENTRY(KObjectImplementationUidValue, CLMXObject::NewL), +}; + +// Function used to return an instance of the proxy table. +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) +{ + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; +} diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/group/Landmarks.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/group/Landmarks.mmp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,101 @@ +/* + * Name : Landmarks.mmp + * Description : Project definition + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +TARGET Landmarks_0x2002E1AF.dll +TARGETTYPE PLUGIN + +UID 0x10009D8D 0x2002E1AF +SECUREID 0x2002E1AF + +CAPABILITY LocalServices Location NetworkServices ReadUserData ReadDeviceData SwEvent UserEnvironment WriteDeviceData WriteUserData //MultimediaDD + +MACRO __DEBUG__ + +SOURCEPATH ..\ecom\src +SOURCE Proxy.cpp + +SOURCEPATH ..\overlay\src +SOURCE Accelerometer.cpp +SOURCE AutoRotation.cpp +SOURCE Magnetometer.cpp +SOURCE Overlay.cpp +SOURCE Manager.cpp +SOURCE Position.cpp + +SOURCEPATH ..\provider\src +SOURCE Provider.cpp +SOURCE Local.cpp +SOURCE Remote.cpp + +SOURCEPATH ..\object\src +SOURCE Object.cpp + +SOURCEPATH ..\..\..\..\common\src +SOURCE HttpClient.cpp +SOURCE IconLoader.cpp +SOURCE Logger.cpp + +USERINCLUDE ..\..\..\..\interface +USERINCLUDE ..\..\..\..\interface\overlay +USERINCLUDE ..\..\..\..\interface\provider +USERINCLUDE ..\..\..\..\interface\object + +USERINCLUDE ..\ecom\inc + +USERINCLUDE ..\overlay\inc +USERINCLUDE ..\provider\inc +USERINCLUDE ..\object\inc +USERINCLUDE ..\..\..\..\common\inc + +SYSTEMINCLUDE \epoc32\include + +SOURCEPATH ..\data +START RESOURCE Landmarks.rss + TARGET Landmarks_0x2002E1AF.rsc +END + +LIBRARY euser.lib +LIBRARY eikcore.lib +LIBRARY cone.lib +LIBRARY ecom.lib + +LIBRARY eposlandmarks.lib +LIBRARY hash.lib + +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY PlatformEnv.lib + +LIBRARY SenXml.lib +LIBRARY XmlFramework.lib + +LIBRARY http.lib +LIBRARY inetprotutil.lib +LIBRARY esock.lib + +LIBRARY libgles_cm.lib +LIBRARY ws32.lib + +LIBRARY bitgdi.lib +LIBRARY fbscli.lib +LIBRARY gdi.lib +LIBRARY egul.lib +LIBRARY ImageConversion.lib +LIBRARY AknIcon.lib + +LIBRARY CentralRepository.lib + +LIBRARY lbs.lib +LIBRARY SensrvClient.lib +LIBRARY SensrvUtil.lib diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/group/LandmarksIcons.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/group/LandmarksIcons.mk Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,63 @@ +#/* +# * Name : LandmarksIcon.mk +# * Description : Icon makefile +# * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser +# * Website : http://OpenMAR.org +# * +# * Copyright (c) 2010 David Caabeiro +# * +# * All rights reserved. This program and the accompanying materials are made available +# * under the terms of the Eclipse Public License v1.0 which accompanies this +# * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html +# * +# */ + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z +else +ZDIR=$(EPOCROOT)epoc32\data\z +endif + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\Landmarks_0x2002E1AF.mif + +HEADERDIR=$(EPOCROOT)epoc32\include +HEADERFILENAME=$(HEADERDIR)\Landmarks_0x2002E1AF.mbg + +ICONDIR=..\renderer\gfx + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +# ---------------------------------------------------------------------------- +# NOTE: if you have JUSTINTIME enabled for your S60 3rd FP1 or newer SDK +# and this command crashes, consider adding "/X" to the command line. +# See +# ---------------------------------------------------------------------------- + +RESOURCE : $(ICONTARGETFILENAME) + +$(ICONTARGETFILENAME) : + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ + /c24,8 $(ICONDIR)\Icon.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME)&& \ + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing + diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/object/gfx/Icon.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/object/gfx/Icon.svg Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/object/inc/Object.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/object/inc/Object.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,40 @@ +/* + * Name : Object.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef OBJECT_H_ +#define OBJECT_H_ + +#include "POIObject.h" + +/** + * @brief Implements basic object rendering for landmarks + */ +class CLMXObject : public OpenMAR::CPOIObject +{ +public: + static CLMXObject* NewL(OpenMAR::CPOIProvider* aProvider); + ~CLMXObject(); + +protected: + CLMXObject(OpenMAR::CPOIProvider* aProvider); + void ConstructL(); + +public: + void Render() const; + +private: + TUint iTextureId; +}; + +#endif diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/object/src/Object.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/object/src/Object.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,213 @@ +/* + * Name : Object.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Object.h" + +#include "IconLoader.h" +#include "Vector3d.h" + +#include +#include +#include +#include +#include + +#include + +#include "Logger.h" + +CLMXObject* CLMXObject::NewL(OpenMAR::CPOIProvider* aProvider) +{ + CLMXObject* self = new(ELeave) CLMXObject(aProvider); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +CLMXObject::~CLMXObject() +{ + ::glDeleteTextures(1, &iTextureId); +} + +CLMXObject::CLMXObject(OpenMAR::CPOIProvider* aProvider) + : OpenMAR::CPOIObject(*aProvider) +{} + +/* + * Landmark objects will make use of an SVG file for rendering (demo purposes) + */ +void CLMXObject::ConstructL() +{ + _LIT(KIconFile, "\\resource\\apps\\Landmarks_0x2002E1AF.mif"); + + CGulIcon* icon = CreateIconL(KIconFile, EMbmLandmarks_0x2002e1afIcon, EMbmLandmarks_0x2002e1afIcon_mask); + CleanupStack::PushL(icon); + + CFbsBitmap* bitmap = icon->Bitmap(); // Ownership NOT transferred + CFbsBitmap* mask = icon->Mask(); // Ownership NOT transferred + + // Always expect 16M bitmap to make conversion to GL_RGBA easier + if (bitmap->DisplayMode() != EColor16M) + { + bitmap = new(ELeave) CFbsBitmap; + CleanupStack::PushL(bitmap); + + User::LeaveIfError(bitmap->Create(icon->Bitmap()->SizeInPixels(), EColor16M)); + + CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmap); + CleanupStack::PushL(bitmapDevice); + + CFbsBitGc* bitmapContext = 0; + User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext)); + CleanupStack::PushL(bitmapContext); + + bitmapContext->BitBlt(TPoint(0, 0), icon->Bitmap()); + + CleanupStack::PopAndDestroy(2, bitmapDevice); + + icon->SetBitmap(bitmap); // Ownership transferred + + CleanupStack::Pop(bitmap); + } + + // Always expect 256 mask to make conversion to GL_RGBA easier + if (mask->DisplayMode() != EGray256) + { + mask = new(ELeave) CFbsBitmap; + CleanupStack::PushL(mask); + + User::LeaveIfError(mask->Create(icon->Mask()->SizeInPixels(), EGray256)); + + CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(mask); + CleanupStack::PushL(bitmapDevice); + + CFbsBitGc* bitmapContext = 0; + User::LeaveIfError(bitmapDevice->CreateContext(bitmapContext)); + CleanupStack::PushL(bitmapContext); + + bitmapContext->BitBlt(TPoint(0, 0), icon->Mask()); + + CleanupStack::PopAndDestroy(2, bitmapDevice); + + icon->SetMask(mask); // Ownership transferred + + CleanupStack::Pop(mask); + } + + // Now bitmap and mask point to either original or converted bitmaps, + // and ownership belongs to icon + + const TSize bitmapSize = bitmap->SizeInPixels(); + + // sizeof(TUint32) == sizeof(RGBA) + const TInt dataSize = bitmapSize.iWidth * bitmapSize.iHeight * sizeof(TUint32); + TUint8* data = new(ELeave) TUint8[dataSize]; + + // Perform copy and conversion from BGR(A) to RGB(A) + bitmap->LockHeap(); + mask->LockHeap(); + + // TODO: Alpha component removed, as it seems to be corrupted from + // subsequent reads from SVG file + + TUint8* rgb = reinterpret_cast(bitmap->DataAddress()); +// TUint8* alpha = reinterpret_cast(mask->DataAddress()); + + for(TInt i = 0, j = 0; i < dataSize; i += 4, j += 3) + { + data[i + 0] = rgb[j + 2]; + data[i + 1] = rgb[j + 1]; + data[i + 2] = rgb[j + 0]; + data[i + 3] = 0xc0; //alpha[i / 4]; + } + + // Generate OpenGL texture + ::glGenTextures(1, &iTextureId); + ::glBindTexture(GL_TEXTURE_2D, iTextureId); + + ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + ::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bitmapSize.iWidth, bitmapSize.iHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); + + mask->UnlockHeap(); + bitmap->UnlockHeap(); + + delete data; + + CleanupStack::PopAndDestroy(icon); +} + +void CLMXObject::Render() const +{ + /* + * This is a special case for points or planes in space. Given that a usual POI + * does not provide of any transformation to be applied on it, we determine the + * angle in the XY plane with respect to the observer and apply that rotation to + * the object. + * + * This way, all POIs will face the observer regardless their position. Other + * objects (3D Landmarks, etc) should provide their own transformations in some + * proper way. + */ + + TReal angle = 0; + Math::ATan(angle, iPosition.mX, iPosition.mY); + angle *= -KRadToDeg; + + /* + * We could also apply some scaling calculation to compensate the size of + * objects projected at a long distance from the camera. + * For now we just use a constant value + */ + + TReal scale = 64.0f; + + // Apply transformations to the object and render it + + const TInt unity = 1 << 16; + + GLfixed vertices[] = { + -unity / 2, 0, 0, + unity / 2, 0, 0, + -unity / 2, 0, unity, + unity / 2, 0, unity, + }; + + GLfixed texCoords[] = { + 0, unity, + unity, unity, + 0, 0, + unity, 0 + }; + + ::glPushMatrix(); + + ::glTranslatef(iPosition.mX, iPosition.mY, iPosition.mZ); + ::glRotatef(angle, 0, 0, 1); + ::glScalef(scale, 1.0f, scale); + + ::glEnable(GL_TEXTURE_2D); + ::glBindTexture(GL_TEXTURE_2D, iTextureId); + ::glVertexPointer(3, GL_FIXED, 0, vertices); + ::glTexCoordPointer(2, GL_FIXED, 0, texCoords); + ::glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + ::glDisable(GL_TEXTURE_2D); + + ::glPopMatrix(); +} diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/overlay/inc/Accelerometer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/overlay/inc/Accelerometer.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,62 @@ +/* + * Name : Accelerometer.h + * Description : Accelerometer helper class + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef ACCELEROMETER_H_ +#define ACCELEROMETER_H_ + +#include "Vector3d.h" + +#include + +class CSensrvChannel; + +/** + * @brief Wrapper class over sensor channel to retrieve data from 3-axis accelerometer + * + * This class also implements a simple bandpass filter + */ +class CAccelerometer : public CBase, + public MSensrvDataListener +{ +public: + static CAccelerometer* NewL(); + ~CAccelerometer(); + +protected: + CAccelerometer(); + void ConstructL(); + +public: + void StartL(); + void Stop(); + + const Vector3d GetValue() const { return Vector3d(iX1, iY1, iZ1); } + +protected: + // From MSensrvDataListener + void DataReceived(CSensrvChannel& aChannel, TInt aCount, TInt aDataLost); + void DataError(CSensrvChannel& aChannel, TSensrvErrorSeverity aError); + void GetDataListenerInterfaceL(TUid aInterfaceUid, TAny*& aInterface); + +private: + CSensrvChannel* iSensorChannel; + + TReal iX1; + TReal iY1; + TReal iZ0; + TReal iZ1; + TReal iZ2; +}; + +#endif diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/overlay/inc/AutoRotation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/overlay/inc/AutoRotation.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,52 @@ +/* + * Name : AutoRotation.h + * Description : Handles device autorotation setting + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef AUTOROTATION_H_ +#define AUTOROTATION_H_ + +#include + +class CRepository; + +/** + * @brief Handles device autorotation setting + * + * The N97 has an issue where the compass gets uncalibrated if autorotation is enabled. + * + */ +class CAutoRotation : public CActive +{ +public: + static CAutoRotation* NewL(); + ~CAutoRotation(); + +protected: + CAutoRotation(); + void ConstructL(); + + void RunL(); + void DoCancel(); + + void Notify(); + +public: + void ResetL(); + void RestoreL(); + +private: + CRepository* iRepository; + TInt iTurnCtrl; +}; + +#endif // AUTOROTATION_H_ diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/overlay/inc/Magnetometer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/overlay/inc/Magnetometer.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,79 @@ +/* + * Name : Magnetometer.h + * Description : Magnetometer helper class + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef MAGNETOMETER_H_ +#define MAGNETOMETER_H_ + +#include "Vector3d.h" + +#include +#include + +class CSensrvChannel; + +/** + * @brief Wrapper class over sensor channel to retrieve data from 3-axis magnetometer + * + * This class also implements a simple lowpass filter + */ +class CMagnetometer : public CBase, + public MSensrvDataListener, + public MSensrvPropertyListener +{ +public: + static CMagnetometer* NewL(); + ~CMagnetometer(); + +protected: + CMagnetometer(); + void ConstructL(); + +public: + void StartL(); + void Stop(); + + const Vector3d GetValue() const { return Vector3d(iX, iY, iZ); } + + enum TCalibration { + ENone, + ELow, + EModerate, + EHigh + }; + + TCalibration Calibration() const { return iCalibration; } + +protected: + // From MSensrvDataListener + void DataReceived(CSensrvChannel& aChannel, TInt aCount, TInt aDataLost); + void DataError(CSensrvChannel& aChannel, TSensrvErrorSeverity aError); + void GetDataListenerInterfaceL(TUid aInterfaceUid, TAny*& aInterface); + + // From MSensrvPropertyListener + void PropertyChanged(CSensrvChannel& aChannel, const TSensrvProperty& aChangedProperty); + void PropertyError(CSensrvChannel& aChannel, TSensrvErrorSeverity aError); + void SetPropertySuccessIndicationChanged(TSetPropertySuccessIndicator aIndication); + void GetPropertyListenerInterfaceL(TUid aInterfaceUid, TAny*& aInterface); + +private: + CSensrvChannel* iSensorChannel; + + TReal iX; + TReal iY; + TReal iZ; + + TCalibration iCalibration; +}; + +#endif diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/overlay/inc/Manager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/overlay/inc/Manager.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,63 @@ +/* + * Name : Manager.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef MANAGER_H_ +#define MANAGER_H_ + +#include "POIProvider.h" +#include "POIObject.h" + +#include "Vector3d.h" + +/** + * @brief Manages points of interest + * + * The manager connects to a group of POI providers and manages a list of POIs + * A caching and filtering mechanism could be implemented + */ +class CManager : public CBase, public OpenMAR::MPOIProviderObserver +{ + friend class COverlay; + +public: + static CManager* NewL(); + ~CManager(); + +protected: + CManager(); + void ConstructL(); + +protected: + // From OpenMAR::MPOIProviderObserver + void POIProviderLoadedL(OpenMAR::CPOIProvider* aProvider, TInt aError); + void POIObjectCreatedL(OpenMAR::CPOIObject* aPOIObject); + void POIObjectUpdatedL(OpenMAR::CPOIObject* aPOIObject); + +protected: + const Vector3d Transform(const TCoordinate& aCoordinate); + +public: + void SetOrigin(const TCoordinate& aCoordinate); + + void RequestL(const TCoordinate& aCoordinate); + void Render() const; + +private: + RPointerArray iProviderList; + + TCoordinate iOrigin; + RPointerArray iObjectList; +}; + +#endif diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/overlay/inc/Overlay.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/overlay/inc/Overlay.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,86 @@ +/* + * Name : Overlay.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef OVERLAY_H_ +#define OVERLAY_H_ + +#include +#include + +#include "POIOverlay.h" + +#include "Matrix4d.h" +#include "Position.h" + +class RWindow; +class CWsBitmap; + +class CAccelerometer; +class CMagnetometer; +class CAutoRotation; +class CManager; + +/** + * @brief Points of interest overlay + * + * Uses orientation and position to request POIs around the current location + */ +class COverlay : public OpenMAR::CPOIOverlay, + public MPositionObserver +{ +public: + static COverlay* NewL(SParameter& aParameter); + ~COverlay(); + +protected: + COverlay(SParameter& aParameter); + void ConstructL(); + +public: + void StartL(); + void Stop(); + const CFbsBitmap& RenderScene(); + +protected: + // From MPositionObserver + void PositionUpdateL(TInt aError, const TPosition& aPosition); + +public: + TInt GetFocusedPOI(); + +private: + CPosition* iPosition; + CAccelerometer* iAccelerometer; + CMagnetometer* iMagnetometer; + CAutoRotation* iAutoRotation; + + CManager* iManager; + +private: + RWindow& iWindow; + TRect iRect; + + EGLDisplay iEglDisplay; + EGLSurface iEglSurface; + EGLConfig iConfig; + EGLContext iEglContext; + + CWsBitmap* iPixmap; + +private: + Matrix4d iProjection; + Matrix4d iModelView; +}; + +#endif // OVERLAY_H_ diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/overlay/inc/Position.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/overlay/inc/Position.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,64 @@ +/* + * Name : Position.h + * Description : Position helper class + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef POSITION_H_ +#define POSITION_H_ + +#include +#include +#include + +class MPositionObserver +{ +public: + virtual void PositionUpdateL(TInt aError, const TPosition& aPosition) = 0; +}; + +/** + * @brief + * + */ +class CPosition : public CActive +{ +public: + static CPosition* NewL(MPositionObserver& aObserver); + ~CPosition(); + +protected: + CPosition(MPositionObserver& aObserver); + void ConstructL(); + +public: + void Request(); + +protected: + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + +private: + MPositionObserver& iObserver; + + RPositionServer iServer; + RPositioner iPositioner; + TPositionInfo iPositionInfo; + + enum TState { + EUnknown, + ECache, + EGps + } iState; +}; + +#endif // POSITION_H_ diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/overlay/src/Accelerometer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/overlay/src/Accelerometer.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,126 @@ +/* + * Name : Accelerometer.cpp + * Description : Accelerometer helper class + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Accelerometer.h" + +#include + +#include +#include +#include + +CAccelerometer* CAccelerometer::NewL() +{ + CAccelerometer* self = new(ELeave) CAccelerometer; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +CAccelerometer::~CAccelerometer() +{ + iSensorChannel->CloseChannel(); +} + +CAccelerometer::CAccelerometer() +{} + +void CAccelerometer::ConstructL() +{ + CSensrvChannelFinder* sensorChannelFinder = CSensrvChannelFinder::NewLC(); + + RSensrvChannelInfoList channelInfoList; + CleanupClosePushL(channelInfoList); + + TSensrvChannelInfo mySearchConditions; + mySearchConditions.iChannelType = KSensrvChannelTypeIdAccelerometerXYZAxisData; + + sensorChannelFinder->FindChannelsL(channelInfoList, mySearchConditions); + + TSensrvChannelInfo channelInfo; + + if (channelInfoList.Count() > 0) + channelInfo = channelInfoList[0]; + else + User::Leave(KErrNotFound); + + CleanupStack::PopAndDestroy(&channelInfoList); + CleanupStack::PopAndDestroy(sensorChannelFinder); + + iSensorChannel = CSensrvChannel::NewL(channelInfo); + iSensorChannel->OpenChannelL(); +} + +void CAccelerometer::StartL() +{ + iSensorChannel->StartDataListeningL(this, 1, 8, 0); +} + +void CAccelerometer::Stop() +{ + iSensorChannel->StopDataListening(); +} + +void CAccelerometer::DataReceived(CSensrvChannel& aChannel, TInt aCount, TInt aDataLost) +{ + if (aChannel.GetChannelInfo().iChannelType == KSensrvChannelTypeIdAccelerometerXYZAxisData) + { + TPckgBuf dataBuffer; + TSensrvAccelerometerAxisData data; + + for (TInt i = 0; i < aCount; ++i) + { + aChannel.GetData(dataBuffer); + + data = dataBuffer(); + // Do something with the date in data variable + // data.iTimeStamp + + // Compensate axis for landscape mode + TInt x = -data.iAxisY; + TInt y = data.iAxisX; + TInt z = data.iAxisZ; +#if 0 + TInt x = data.iAxisX; + TInt y = data.iAxisY; + TInt z = data.iAxisZ; +#endif + const TReal K128 = 0.0078125; // 1/128 + const TReal KPole1 = 0.97; // Pole of lowpass filter applied to X and Y + const TReal KPole2 = 0.90; // Pole of lowpass filter applied to Z + const TReal KPole3 = 0.75; // Pole of highpass filter applied to Z + + // Single-pole lowpass-filtering of X and Y + iX1 = KPole1 * iX1 + ( 1.0 - KPole1 ) * ( K128 * x ); + iY1 = KPole1 * iY1 + ( 1.0 - KPole1 ) * ( K128 * y ); + + // Single-pole lowpass-filtering of Z + iZ0 = KPole2 * iZ1 + ( 1.0 - KPole2 ) * ( K128 * z ); + // 1st order highpass-filtering of Z (zero at 1) + iZ2 = KPole3 * iZ2 + ( 1.0 - KPole3 ) * ( iZ0 - iZ1 ); + + // Update variables for use at next sample + iZ1 = iZ0; + } + } +} + +void CAccelerometer::DataError(CSensrvChannel& aChannel, TSensrvErrorSeverity aError) +{ +} + +void CAccelerometer::GetDataListenerInterfaceL(TUid aInterfaceUid, TAny*& aInterface) +{} diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/overlay/src/AutoRotation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/overlay/src/AutoRotation.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,117 @@ +/* + * Name : AutoRotation.cpp + * Description : Handles device autorotation setting + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "AutoRotation.h" + +#include "Logger.h" + +#include + +// Taken from SensorPluginDomainCrKeys.h +const TUid KCRUidSensorSettings = { 0x10282DF0 }; + +/* + * Bitmask of variated use cases for Turning interaction. + * + * Possible values: + * 0000 0000: No selected use cases, Turning interactions disabled + * 0000 0001: Only Silence calls use case enabled + * 0000 0010: Only Snooze alarm use case enabled + * 0000 0100: Only Display orientation use case enabled + * + * Bitmask may contain different variations of above selections + * + * Value is an integer. + * + * Default value: 7 + */ + +//const TUint32 KSenSetVariationTurnCtrl = 0x00100003; +const TUint32 KSenSettingsTurnCtrl = 0x00000003; + +CAutoRotation* CAutoRotation::NewL() +{ + CAutoRotation* self = new(ELeave) CAutoRotation; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +CAutoRotation::~CAutoRotation() +{ + Cancel(); +} + +CAutoRotation::CAutoRotation() + : CActive(CActive::EPriorityStandard) +{ + CActiveScheduler::Add(this); +} + +void CAutoRotation::ConstructL() +{ + LOGTXT("CAutoRotation::ConstructL()"); + + iRepository = CRepository::NewL(KCRUidSensorSettings); + + RunL(); +} + +void CAutoRotation::RunL() +{ + // Store setting value upon any external change + User::LeaveIfError(iRepository->Get(KSenSettingsTurnCtrl, iTurnCtrl)); + + Notify(); +} + +void CAutoRotation::DoCancel() +{ + iRepository->NotifyCancel(KSenSettingsTurnCtrl); +} + +void CAutoRotation::Notify() +{ + iRepository->NotifyRequest(KSenSettingsTurnCtrl, iStatus); + SetActive(); +} + +/* + * Turn autorotation off + */ +void CAutoRotation::ResetL() +{ + // We don't want to get notification of our own modifications + Cancel(); + + TInt turnCtrl = iTurnCtrl & 0xfffffffb; + User::LeaveIfError(iRepository->Set(KSenSettingsTurnCtrl, turnCtrl)); + + Notify(); +} + +/* + * Restore original value + */ +void CAutoRotation::RestoreL() +{ + // We don't want to get notification of our own modifications + Cancel(); + + User::LeaveIfError(iRepository->Set(KSenSettingsTurnCtrl, iTurnCtrl)); + + Notify(); +} diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/overlay/src/Magnetometer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/overlay/src/Magnetometer.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,155 @@ +/* + * Name : Magnetometer.cpp + * Description : Magnetometer helper class + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Magnetometer.h" + +#include + +#include +#include +#include +#include + +CMagnetometer* CMagnetometer::NewL() +{ + CMagnetometer* self = new(ELeave) CMagnetometer; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +CMagnetometer::~CMagnetometer() +{ + iSensorChannel->CloseChannel(); +} + +CMagnetometer::CMagnetometer() +{} + +void CMagnetometer::ConstructL() +{ + CSensrvChannelFinder* sensorChannelFinder = CSensrvChannelFinder::NewLC(); + + RSensrvChannelInfoList channelInfoList; + CleanupClosePushL(channelInfoList); + + TSensrvChannelInfo mySearchConditions; + mySearchConditions.iChannelType = KSensrvChannelTypeIdMagnetometerXYZAxisData; + + sensorChannelFinder->FindChannelsL(channelInfoList, mySearchConditions); + + TSensrvChannelInfo channelInfo; + + if (channelInfoList.Count() > 0) + channelInfo = channelInfoList[0]; + else + User::Leave(KErrNotFound); + + CleanupStack::PopAndDestroy(&channelInfoList); + CleanupStack::PopAndDestroy(sensorChannelFinder); + + iSensorChannel = CSensrvChannel::NewL(channelInfo); + iSensorChannel->OpenChannelL(); + + // Get current calibration value + TSensrvProperty property; + iSensorChannel->GetPropertyL(KSensrvPropCalibrationLevel, KSensrvItemIndexNone, property); + TInt calibration = 0; + property.GetValue(calibration); + + iCalibration = calibration == 0? ENone : + calibration == 1? ELow : + calibration == 2? EModerate : + calibration == 3? EHigh : ENone; + + iSensorChannel->SetPropertyListenerL(this); +} + +void CMagnetometer::StartL() +{ + iSensorChannel->StartDataListeningL(this, 1, 4, 0); +} + +void CMagnetometer::Stop() +{ + iSensorChannel->StopDataListening(); +} + +void CMagnetometer::DataReceived(CSensrvChannel& aChannel, TInt aCount, TInt aDataLost) +{ + if (aChannel.GetChannelInfo().iChannelType == KSensrvChannelTypeIdMagnetometerXYZAxisData) + { + TPckgBuf dataBuffer; + TSensrvMagnetometerAxisData data; + + for (TInt i = 0; i < aCount; ++i) + { + aChannel.GetData(dataBuffer); + + data = dataBuffer(); + // Do something with the date in data variable + // data.iTimeStamp + + // Compensate axis for landscape mode + TInt x = -data.iAxisYCalibrated; + TInt y = data.iAxisXCalibrated; + TInt z = data.iAxisZCalibrated; +#if 0 + TInt x = data.iAxisXCalibrated; + TInt y = data.iAxisYCalibrated; + TInt z = data.iAxisZCalibrated; +#endif + const TReal KPole = 0.85; + + iX = KPole * iX + (1.0 - KPole) * x; + iY = KPole * iY + (1.0 - KPole) * y; + iZ = KPole * iZ + (1.0 - KPole) * z; + } + } +} + +void CMagnetometer::DataError(CSensrvChannel& aChannel, TSensrvErrorSeverity aError) +{ +} + +void CMagnetometer::GetDataListenerInterfaceL(TUid aInterfaceUid, TAny*& aInterface) +{} + +void CMagnetometer::PropertyChanged(CSensrvChannel& aChannel, const TSensrvProperty& aChangedProperty) +{ + TSensrvChannelInfo info = aChannel.GetChannelInfo(); + + if (info.iChannelType == KSensrvChannelTypeIdMagnetometerXYZAxisData && + aChangedProperty.GetPropertyId() == KSensrvPropCalibrationLevel) + { + TInt calibration = 0; + aChangedProperty.GetValue(calibration); + + iCalibration = calibration == 0? ENone : + calibration == 1? ELow : + calibration == 2? EModerate : + calibration == 3? EHigh : ENone; + } +} + +void CMagnetometer::PropertyError(CSensrvChannel& aChannel, TSensrvErrorSeverity aError) +{} + +void CMagnetometer::SetPropertySuccessIndicationChanged(TSetPropertySuccessIndicator aIndication) +{} + +void CMagnetometer::GetPropertyListenerInterfaceL(TUid aInterfaceUid, TAny*& aInterface) +{} diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/overlay/src/Manager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/overlay/src/Manager.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,145 @@ +/* + * Name : Manager.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Manager.h" + +#include + +#include "Logger.h" + +CManager* CManager::NewL() +{ + CManager* self = new(ELeave) CManager; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +CManager::~CManager() +{ + iObjectList.ResetAndDestroy(); + iObjectList.Close(); + + iProviderList.ResetAndDestroy(); + iProviderList.Close(); +} + +CManager::CManager() +{} + +void CManager::ConstructL() +{ + _LIT8(KUri, ""); + + _LIT8(KLMXProvider, "lmx"); + OpenMAR::CPOIProvider* lmx = OpenMAR::CPOIProvider::NewL(KLMXProvider, KUri); + lmx->SetObserver(this); + iProviderList.AppendL(lmx); + + _LIT8(KGeonamesProvider, "geonames"); + OpenMAR::CPOIProvider* geonames = OpenMAR::CPOIProvider::NewL(KGeonamesProvider, KUri); + geonames->SetObserver(this); + iProviderList.AppendL(geonames); +} + +void CManager::POIProviderLoadedL(OpenMAR::CPOIProvider* aProvider, TInt aError) +{ + LOGARG("Landmark resource %x loaded with error %d", aProvider, aError); + + // Handle error in some way +} + +void CManager::POIObjectCreatedL(OpenMAR::CPOIObject* aPOIObject) +{ + CleanupStack::PushL(aPOIObject); + + // Check if this POI already exists + TInt index = iObjectList.Find(aPOIObject, OpenMAR::CPOIObject::IdentityRelation); + + if (index == KErrNotFound) + { + // Set world position + TCoordinate coordinate = aPOIObject->GetCoordinate(); + aPOIObject->SetPosition(Transform(coordinate)); + + LOGARG("Appending new POI (%d)", aPOIObject->GetIdentifier()); + + iObjectList.AppendL(aPOIObject); + + CleanupStack::Pop(aPOIObject); + } + else + { + LOGARG("POI already exists (%d). Destroying..", aPOIObject->GetIdentifier()); + + CleanupStack::PopAndDestroy(aPOIObject); + } +} + +void CManager::POIObjectUpdatedL(OpenMAR::CPOIObject* aPOIObject) +{} + +/** + * @brief Transform between WGS84 to Euclidean space + * + * Our Euclidean space will be determined by: + * +X : tangential to the ground and pointing to the EAST + * +Y : tangential to the ground and pointing to the NORTH + * +Z : perpendicular to the ground (pointing to the sky) + */ +const Vector3d CManager::Transform(const TCoordinate& aCoordinate) +{ + TReal32 distance = 0; + iOrigin.Distance(aCoordinate, distance); + + TReal32 bearing = 0; + iOrigin.BearingTo(aCoordinate, bearing); + + TReal32 angle = bearing * KDegToRad; + + TReal cos = 0; + TReal sin = 0; + Math::Cos(cos, angle); + Math::Sin(sin, angle); + + // X = sin(bearing) * d = cos(90 - bearing) * d = sin(bearing) * d + // Y = cos(bearing) * d = sin(90 - bearing) * d = cos(bearing) * d + + TReal x = sin * distance; + TReal y = cos * distance; + TReal z = aCoordinate.Altitude(); + + return Vector3d(x, y, z); +} + +void CManager::SetOrigin(const TCoordinate& aCoordinate) +{ + iOrigin = aCoordinate; +} + +void CManager::RequestL(const TCoordinate& aCoordinate) +{ + const TReal32 radius = 3000; + + for (TInt i = 0; i < iProviderList.Count(); ++i) + iProviderList[i]->RetrieveL(aCoordinate, radius); +} + +void CManager::Render() const +{ + for (TInt i = 0; i < iObjectList.Count(); ++i) + iObjectList[i]->Render(); +} diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/overlay/src/Overlay.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/overlay/src/Overlay.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,384 @@ +/* + * Name : Overlay.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Overlay.h" + +#include +#include +#include + +#include "Vector3d.h" +#include "Vector4d.h" + +#include "Accelerometer.h" +#include "Magnetometer.h" +#include "AutoRotation.h" + +#include "Logger.h" + +#include "Manager.h" + +COverlay* COverlay::NewL(SParameter& aParameter) +{ + COverlay* self = new(ELeave) COverlay(aParameter); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +COverlay::COverlay(SParameter& aParameter) + : iWindow(aParameter.iWindow), iRect(aParameter.iRect) +{} + +void COverlay::ConstructL() +{ + LOGTXT("Initializing EGL.."); + + iEglDisplay = ::eglGetDisplay(EGL_DEFAULT_DISPLAY); + + if (iEglDisplay == 0) + { + _LIT(KGetDisplayFailed, "eglGetDisplay failed"); + User::Panic(KGetDisplayFailed, 0); + } + + if (::eglInitialize(iEglDisplay, 0, 0) == EGL_FALSE) + { + _LIT(KInitializeFailed, "eglInitialize failed"); + User::Panic(KInitializeFailed, 0); + } + + EGLConfig* configList = 0; + EGLint configSize = 0; + EGLint numOfConfigs = 0; + + // Get the number of possible EGLConfigs + if (::eglGetConfigs(iEglDisplay, configList, configSize, &numOfConfigs) == EGL_FALSE) + { + _LIT(KGetConfigsFailed, "eglGetConfigs failed"); + User::Panic( KGetConfigsFailed, 0 ); + } + + configSize = numOfConfigs; + + // Allocate memory for the configList + configList = (EGLConfig*) User::Alloc(sizeof(EGLConfig) * configSize); + if (configList == 0) + { + _LIT(KConfigAllocFailed, "Config alloc failed"); + User::Panic(KConfigAllocFailed, 0); + } + + /* + * Define properties for the wanted EGLSurface. To get the best possible + * performance, choose an EGLConfig with a buffersize matching the current + * window's display mode + */ + + TDisplayMode displayMode = iWindow.DisplayMode(); + TInt bufferSize = 0; + + switch (displayMode) + { + case EColor4K: + bufferSize = 12; + break; + + case EColor64K: + bufferSize = 16; + break; + + case EColor16M: + bufferSize = 24; + break; + + case EColor16MU: + case EColor16MA: + case EColor16MAP: + bufferSize = 32; + break; + + default: + _LIT(KDisplayModeError, "Unsupported display mode"); + User::Panic(KDisplayModeError, 0); + break; + } + + // Define properties for the wanted EGLSurface + const EGLint attrib_list[] = { + EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, +// EGL_TRANSPARENT_TYPE, EGL_TRANSPARENT_RGB, + EGL_BUFFER_SIZE, bufferSize, + EGL_NONE + }; + + // Choose an EGLConfig that best matches to the properties in attrib_list_fsaa + if (::eglChooseConfig(iEglDisplay, attrib_list, configList, configSize, &numOfConfigs) == EGL_FALSE) + { + _LIT( KChooseConfigFailed, "eglChooseConfig failed"); + User::Panic(KChooseConfigFailed, 0); + } + + iConfig = configList[0]; // Choose the best EGLConfig. EGLConfigs + // returned by eglChooseConfig are sorted so + // that the best matching EGLConfig is first in + // the list. + User::Free(configList); + + TInt width = iRect.Size().iWidth; + TInt height = iRect.Size().iHeight; + + LOGARG("Window size is %d x %d", width, height); + + const EGLint attrib_list2[] = { + EGL_WIDTH, width, + EGL_HEIGHT, height, + EGL_NONE + }; + + // Create a window where the graphics are blitted + iEglSurface = ::eglCreatePbufferSurface(iEglDisplay, iConfig, attrib_list2); + + if (iEglSurface == 0) + { + _LIT(KCreateWindowSurfaceFailed, "eglCreateWindowSurface failed"); + User::Panic(KCreateWindowSurfaceFailed, 0); + } + + // Create a rendering context + iEglContext = ::eglCreateContext(iEglDisplay, iConfig, EGL_NO_CONTEXT, 0); + + if (iEglContext == 0) + { + _LIT(KCreateContextFailed, "eglCreateContext failed"); + User::Panic(KCreateContextFailed, 0); + } + + // Make the context current. Binds context to the current rendering thread and surface. + if (::eglMakeCurrent(iEglDisplay, iEglSurface, iEglSurface, iEglContext) == EGL_FALSE) + { + _LIT(KMakeCurrentFailed, "eglMakeCurrent failed"); + User::Panic(KMakeCurrentFailed, 0); + } + + // Create a Symbian bitmap where the graphics from the Pbuffer are copied + iPixmap = new(ELeave) CWsBitmap(CCoeEnv::Static()->WsSession()); + iPixmap->Create(iRect.Size(), iWindow.DisplayMode()); + + // Manager is in charge of POIs from different providers + iManager = CManager::NewL(); +} + +COverlay::~COverlay() +{ + delete iManager; + + delete iPixmap; + iPixmap = 0; + + ::eglMakeCurrent(iEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + ::eglDestroyContext(iEglDisplay, iEglContext); + ::eglDestroySurface(iEglDisplay, iEglSurface); + ::eglTerminate(iEglDisplay); +} + +void COverlay::StartL() +{ + // First off we enable the position and orientation sensors + iPosition = CPosition::NewL(*this); + iPosition->Request(); + +#if defined(__MARM__) + iAccelerometer = CAccelerometer::NewL(); + iAccelerometer->StartL(); + + iMagnetometer = CMagnetometer::NewL(); + iMagnetometer->StartL(); + + iAutoRotation = CAutoRotation::NewL(); + iAutoRotation->ResetL(); +#endif + + // We now calculate the view frustum and create the appropriate projection matrix + TReal near = 1.0f; + TReal far = 3000.0f; + + TReal fovy = 0; + Math::Tan(fovy, 45 * KDegToRad / 2); + + TInt width = iWindow.Size().iWidth; + TInt height = iWindow.Size().iHeight; + TReal aspectRatio = static_cast(width) / height; + + TReal top = near * fovy; + TReal bottom = -top; + TReal left = bottom * aspectRatio; + TReal right = top * aspectRatio; + + iProjection.Load( + 2 * near / (right - left), 0, 0, 0, + 0 , 2 * near / (top - bottom), 0, 0, + (right + left) / (right - left), (top + bottom) / (top - bottom), -(far + near) / (far - near), -1, + 0 , 0 , - 2 * far * near / (far - near), 0 + ); + + ::glViewport(0, 0, width, height); + ::glMatrixMode(GL_PROJECTION); + ::glLoadMatrixf(iProjection.m); + + ::glMatrixMode(GL_MODELVIEW); + + ::glEnableClientState(GL_VERTEX_ARRAY); + ::glEnableClientState(GL_TEXTURE_COORD_ARRAY); +// ::glEnableClientState(GL_NORMAL_ARRAY); + + ::glEnable(GL_DEPTH_TEST); + ::glDepthFunc(GL_LESS); + + // Set background transparency + ::glClearColor(0.0f, 0.0f, 0.0f, 0.0f); +} + +void COverlay::Stop() +{ + ::glDisable(GL_DEPTH_TEST); + +// ::glDisableClientState(GL_NORMAL_ARRAY); + ::glDisableClientState(GL_TEXTURE_COORD_ARRAY); + ::glDisableClientState(GL_VERTEX_ARRAY); + +#if defined(__MARM__) + iAutoRotation->RestoreL(); + delete iAutoRotation; + iAutoRotation = 0; + + iMagnetometer->Stop(); + delete iMagnetometer; + iMagnetometer = 0; + + iAccelerometer->Stop(); + delete iAccelerometer; + iAccelerometer = 0; +#endif + + delete iPosition; + iPosition = 0; +} + +const CFbsBitmap& COverlay::RenderScene() +{ + // Estimate orientation based on sensor data +#if defined(__MARM__) +/* + * +X is defined as the cross product Y.Z (it is tangential to + * the ground at the device's current location and roughly points East) + * +Y is tangential to the ground at the device's current location and + * points towards the magnetic North Pole + * +Z points towards the sky and is perpendicular to the ground + */ + Vector3d A = iAccelerometer->GetValue(); + Vector3d E = iMagnetometer->GetValue(); + + Vector3d H = Vector3d::Cross(E, A); + Scalar hNorm = H.Norm(); + H.mX /= hNorm; + H.mY /= hNorm; + H.mZ /= hNorm; + + Scalar aNorm = A.Norm(); + A.mX /= aNorm; + A.mY /= aNorm; + A.mZ /= aNorm; + + Vector3d M = Vector3d::Cross(A, H); + + iModelView.Load( + H.mX, H.mY, H.mZ, 0, + M.mX, M.mY, M.mZ, 0, + A.mX, A.mY, A.mZ, 0, + 0, 0, 0, 1 + ); + ::glLoadMatrixf(iModelView.m); +#else + ::glLoadIdentity(); +#endif + + ::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + iManager->Render(); + + ::eglCopyBuffers(iEglDisplay, iEglSurface, iPixmap); + + return *iPixmap; +} + +/* + * Callback from position provider. We use current position to set up world's origin + * and make request to different providers + */ +void COverlay::PositionUpdateL(TInt aError, const TPosition& aPosition) +{ + LOGARG("Got position: lat=%f,lon=%f,alt=%f", aPosition.Latitude(), aPosition.Longitude(), aPosition.Altitude()); + + // Set the "world" origin + iManager->SetOrigin(aPosition); + // Request POIs for that position + iManager->RequestL(aPosition); +} + +/* + * From the current list of POIs retrieved, find the one that is closest to the + * screen center. + * + * We use both projection and modelview transforms to obtain screen coordinates. + * Note that both matrices are in column-major ordering, so we need to transpose them. + */ +TInt COverlay::GetFocusedPOI() +{ + const TPoint viewportCenter(iRect.Center()); + + TInt mostCentered = KMaxTInt; + TInt focused = KErrNotFound; + + for (TInt i = 0; i < iManager->iObjectList.Count(); ++i) + { + const Vector3d position(iManager->iObjectList[i]->GetPosition()); + + const Vector4d world(position.mX, position.mY, position.mZ, 1); + const Vector4d camera(iModelView.Transpose() * world); + const Vector4d projection(iProjection.Transpose() * camera); + + // Screen transformation + TReal x = projection.mX / projection.mW; + TReal y = projection.mY / projection.mW; + TReal z = projection.mZ / projection.mW; + + TReal screenX = viewportCenter.iX * (x + 1); + TReal screenY = viewportCenter.iY * (y + 1); +// TReal screenZ = (z + 1) / 2; + + TBool visible = (x > -1 && x < 1) && (y > -1 && y < 1) && (z > -1 && z < 1); + TInt centered = (screenX - viewportCenter.iX) * (screenX - viewportCenter.iX) + (screenY - viewportCenter.iY) * (screenY - viewportCenter.iY); + + if (visible && centered < mostCentered) + { + mostCentered = centered; + focused = i; + } + } + + return focused; +} diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/overlay/src/Position.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/overlay/src/Position.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,123 @@ +/* + * Name : Position.cpp + * Description : Position helper class + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Position.h" + +#include "Logger.h" + +CPosition* CPosition::NewL(MPositionObserver& aObserver) +{ + CPosition* self = new(ELeave) CPosition(aObserver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + return self; +} + +CPosition::~CPosition() +{ + Cancel(); + + iPositioner.Close(); + iServer.Close(); +} + +CPosition::CPosition(MPositionObserver& aObserver) + : CActive(CActive::EPriorityStandard), iObserver(aObserver), iState(EUnknown) +{ + CActiveScheduler::Add(this); +} + +void CPosition::ConstructL() +{ + User::LeaveIfError(iServer.Connect()); + User::LeaveIfError(iPositioner.Open(iServer)); + + _LIT(KRequestor, "OpenMAR" ); + User::LeaveIfError(iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KRequestor)); + + const TInt KSecond = 1000000; + TPositionUpdateOptions updateOptions; + updateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(10 * KSecond)); + updateOptions.SetUpdateTimeOut(TTimeIntervalMicroSeconds(30 * KSecond)); + updateOptions.SetMaxUpdateAge(TTimeIntervalMicroSeconds(1 * KSecond)); + updateOptions.SetAcceptPartialUpdates(EFalse); + + User::LeaveIfError(iPositioner.SetUpdateOptions(updateOptions)); +} + +void CPosition::Request() +{ + if (IsActive()) + Cancel(); + + iPositioner.GetLastKnownPosition(iPositionInfo, iStatus); + SetActive(); + + iState = ECache; +} + +void CPosition::RunL() +{ + TPosition position; + iPositionInfo.GetPosition(position); + + TTime now; + now.UniversalTime(); + + TTimeIntervalSeconds interval = 0; + now.SecondsFrom(position.Time(), interval); + + LOGARG("Interval between retrieved position and current time: %d secs", interval.Int()); + + // Compare that retrieved data is not outdated + if (iStatus == KErrNone && interval.Int() < 300) + { + iObserver.PositionUpdateL(iStatus.Int(), position); + } + else if (iStatus == KErrTimedOut) + { + iObserver.PositionUpdateL(iStatus.Int(), position); + } + else + { + iPositioner.NotifyPositionUpdate(iPositionInfo, iStatus); + SetActive(); + + iState = EGps; + } +} + +void CPosition::DoCancel() +{ + switch (iState) + { + case ECache: + iPositioner.CancelRequest(EPositionerGetLastKnownPosition); + break; + + case EGps: + iPositioner.CancelRequest(EPositionerNotifyPositionUpdate); + break; + + default: + break; + }; +} + +TInt CPosition::RunError(TInt aError) +{ + return KErrNone; +} diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/provider/inc/Loader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/provider/inc/Loader.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,46 @@ +/* + * Name : Loader.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef LOADER_H_ +#define LOADER_H_ + +#include + +class CPosLandmark; +class TCoordinate; + +class MLandmarkLoaderObserver +{ +public: + virtual void LandmarkLoaderOpenedL(TInt aError) = 0; + virtual void LandmarkLoaderItemCreatedL(const CPosLandmark& aLandmark) = 0; + virtual void LandmarkLoaderItemUpdatedL(const CPosLandmark& aLandmark) = 0; + virtual void LandmarkLoaderItemDeletedL(const CPosLandmark& aLandmark) = 0; +}; + +/** + * @brief Interface for landmark loader + */ +class MLandmarkLoader +{ +public: + virtual ~MLandmarkLoader() = 0; + + virtual void RequestL(const TCoordinate& aCoordinate, TReal32 aRadius) = 0; +}; + +inline MLandmarkLoader::~MLandmarkLoader() +{} + +#endif diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/provider/inc/Local.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/provider/inc/Local.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,54 @@ +/* + * Name : Local.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef LOCAL_H_ +#define LOCAL_H_ + +#include +#include + +#include "Loader.h" + +class CPosLandmarkDatabase; +class TCoordinate; + +/** + * @brief Retrieves landmarks from a local database + */ +class CLocalLoader : public CActive, public MLandmarkLoader +{ +public: + static CLocalLoader* NewL(MLandmarkLoaderObserver& aObserver, const TDesC8& aProviderUri); + ~CLocalLoader(); + +protected: + CLocalLoader(MLandmarkLoaderObserver& aObserver); + void ConstructL(const TDesC8& aProviderUri); + + // From CActive + void RunL(); + void DoCancel(); + +public: + // From MLandmarkLoader + void RequestL(const TCoordinate& aCoordinate, TReal32 aRadius); + +private: + MLandmarkLoaderObserver& iObserver; + + CPosLandmarkDatabase* iLandmarkDb; + TPosLmEvent iEvent; +}; + +#endif // LOCAL_H_ diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/provider/inc/Provider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/provider/inc/Provider.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,51 @@ +/* + * Name : Provider.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef PROVIDER_H_ +#define PROVIDER_H_ + +#include "POIProvider.h" +#include "POIObject.h" + +#include "Loader.h" +#include "Local.h" +#include "Remote.h" + +/** + * @brief Provider implementation for local and remote landmarks (lmx) + */ +class CProvider : public OpenMAR::CPOIProvider, public MLandmarkLoaderObserver +{ +public: + static CProvider* NewL(const TDesC8& aProviderUri); + ~CProvider(); + +protected: + CProvider(); + void ConstructL(const TDesC8& aProviderUri); + + // From MLandmarkLoaderObserver + void LandmarkLoaderOpenedL(TInt aError); + void LandmarkLoaderItemCreatedL(const CPosLandmark& aLandmark); + void LandmarkLoaderItemUpdatedL(const CPosLandmark& aLandmark); + void LandmarkLoaderItemDeletedL(const CPosLandmark& aLandmark); + +public: + void RetrieveL(const TCoordinate& aCoordinate, TReal32 aRadius); + +private: + MLandmarkLoader* iLoader; +}; + +#endif // PROVIDER_H_ diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/provider/inc/Remote.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/provider/inc/Remote.h Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,66 @@ +/* + * Name : Remote.h + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#ifndef REMOTE_H_ +#define REMOTE_H_ + +#include +#include +#include +#include + +#include "Loader.h" + +class TCoordinate; +class CHttpClient; + +/** + * @brief Retrieves landmarks from a remote database + */ + +class CRemoteLoader : public CActive, public MLandmarkLoader, public MHTTPTransactionCallback +{ +public: + static CRemoteLoader* NewL(MLandmarkLoaderObserver& aObserver, const TDesC8& aProviderUri); + ~CRemoteLoader(); + +protected: + CRemoteLoader(MLandmarkLoaderObserver& aObserver); + void ConstructL(const TDesC8& aProviderUri); + + void RunL(); + void DoCancel(); + +public: + // From MLandmarkLoader + void RequestL(const TCoordinate& aCoordinate, TReal32 aRadius); + +protected: + // From MHTTPTransactionCallback + void MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent); + TInt MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent); + +private: + MLandmarkLoaderObserver& iObserver; + + HBufC8* iBaseUri; + CHttpClient* iClient; + RBuf8 iBuffer; + + CPosLandmarkParser* iParser; + CPosLmOperation* iOperation; + TReal32 iProgress; +}; + +#endif // REMOTE_H_ diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/provider/src/Local.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/provider/src/Local.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,139 @@ +/* + * Name : Local.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Local.h" + +#include +#include + +#include "Logger.h" + +CLocalLoader* CLocalLoader::NewL(MLandmarkLoaderObserver& aObserver, const TDesC8& aProviderUri) +{ + CLocalLoader* self = new(ELeave) CLocalLoader(aObserver); + CleanupStack::PushL(self); + self->ConstructL(aProviderUri); + CleanupStack::Pop(self); + + return self; +} + +CLocalLoader::~CLocalLoader() +{ + Cancel(); + + delete iLandmarkDb; +} + +CLocalLoader::CLocalLoader(MLandmarkLoaderObserver& aObserver) + : CActive(CActive::EPriorityStandard), iObserver(aObserver) +{ + CActiveScheduler::Add(this); +} + +void CLocalLoader::ConstructL(const TDesC8& aProviderUri) +{ + LOGARG("[LANDMARKS] Creating local landmark loader: %S", &aProviderUri); + + HBufC* uri = HBufC::NewLC(aProviderUri.Length()); + uri->Des().Copy(aProviderUri); + +// iLandmarkDb = CPosLandmarkDatabase::OpenL(*uri); + iLandmarkDb = CPosLandmarkDatabase::OpenL(); + + CleanupStack::PopAndDestroy(uri); + + CPosLmOperation* initialization = iLandmarkDb->InitializeL(); + ExecuteAndDeleteLD(initialization); + + iLandmarkDb->NotifyDatabaseEvent(iEvent, iStatus); + SetActive(); +} + +void CLocalLoader::RunL() +{ + LOGARG("[LANDMARKS] Landmark event %d", iEvent.iEventType); + + if (iStatus == KErrNone) + switch (iEvent.iEventType) + { + case EPosLmEventLandmarkCreated: + { + LOGTXT("[LANDMARKS] Got new landmark. Notifying observer"); + + CPosLandmark* landmark = iLandmarkDb->ReadLandmarkLC(iEvent.iLandmarkItemId); + iObserver.LandmarkLoaderItemCreatedL(*landmark); + CleanupStack::PopAndDestroy(landmark); + + break; + } + + case EPosLmEventLandmarkUpdated: + { + LOGTXT("[LANDMARKS] Got updated landmark. Notifying observer"); + + CPosLandmark* landmark = iLandmarkDb->ReadLandmarkLC(iEvent.iLandmarkItemId); + iObserver.LandmarkLoaderItemUpdatedL(*landmark); + CleanupStack::PopAndDestroy(landmark); + + break; + } + + case EPosLmEventLandmarkDeleted: + { + LOGTXT("[LANDMARKS] Landmark was deleted. Notifying observer"); + + CPosLandmark* landmark = CPosLandmark::NewLC(); +// landmark->SetLandmarkIdL(iEvent.iLandmarkItemId); + iObserver.LandmarkLoaderItemDeletedL(*landmark); + CleanupStack::PopAndDestroy(landmark); + + break; + } + + case EPosLmEventNewDefaultDatabaseLocation: + case EPosLmEventMediaRemoved: + default: + break; + } + + iLandmarkDb->NotifyDatabaseEvent(iEvent, iStatus); + SetActive(); +} + +void CLocalLoader::DoCancel() +{ + iLandmarkDb->CancelNotifyDatabaseEvent(); +} + +void CLocalLoader::RequestL(const TCoordinate& aCoordinate, TReal32 aRadius) +{ + iObserver.LandmarkLoaderOpenedL(KErrNone); + + // TODO: Should use CPosLmAreaCriteria to filter + + CPosLmItemIterator* landmarkIterator = iLandmarkDb->LandmarkIteratorL(); + CleanupStack::PushL(landmarkIterator); + + for (TPosLmItemId id = landmarkIterator->NextL(); + id != KPosLmNullItemId; + id = landmarkIterator->NextL()) + { + CPosLandmark* landmark = iLandmarkDb->ReadLandmarkLC(id); + iObserver.LandmarkLoaderItemCreatedL(*landmark); + CleanupStack::PopAndDestroy(landmark); + } + + CleanupStack::PopAndDestroy(landmarkIterator); +} diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/provider/src/Provider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/provider/src/Provider.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,141 @@ +/* + * Name : Provider.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Provider.h" + +#include +#include + +#include "Logger.h" + +/* + * Generate a unique id using coordinate and name as seeds + * + */ + +TUint32 GenerateIdL(const CPosLandmark& aLandmark) +{ + TPtrC name; + aLandmark.GetLandmarkName(name); + + TLocality coordinate; + aLandmark.GetPosition(coordinate); + + HBufC8* name8 = HBufC8::NewLC(name.Length()); + name8->Des().Copy(name); + + TRealFormat realFormat; + realFormat.iPoint = TChar('.'); // Override TLocale::DecimalSeparator() as separator + realFormat.iWidth = 8; // Set max width of number + realFormat.iPlaces = 5; // Set max width of decimal portion + + TBuf8 latitude; + latitude.Num(coordinate.Latitude(), realFormat); + + TBuf8 longitude; + longitude.Num(coordinate.Longitude(), realFormat); + + CSHA1* hash = CSHA1::NewL(); + CleanupStack::PushL(hash); + hash->Update(*name8); + hash->Update(latitude); + TPtrC8 result = hash->Final(longitude); + + const TUint32* ptr = reinterpret_cast(result.Ptr()); + TUint32 value = *ptr; + + CleanupStack::PopAndDestroy(2, name8); // hash, name8 + + return value; +} + + +CProvider* CProvider::NewL(const TDesC8& aProviderUri) +{ + CProvider* self = new(ELeave) CProvider; + CleanupStack::PushL(self); + self->ConstructL(aProviderUri); + CleanupStack::Pop(self); + + return self; +} + +CProvider::~CProvider() +{ + delete iLoader; + + ReleaseLandmarkResources(); +} + +CProvider::CProvider() +{} + +void CProvider::ConstructL(const TDesC8& aProviderUri) +{ + TUriParser8 uri; + uri.Parse(aProviderUri); + + _LIT8(KHttpScheme, "http"); + + if (uri.IsSchemeValid() && uri.Extract(EUriScheme).Compare(KHttpScheme) == 0) + iLoader = CRemoteLoader::NewL(*this, aProviderUri); + else + iLoader = CLocalLoader::NewL(*this, aProviderUri); +} + +void CProvider::LandmarkLoaderOpenedL(TInt aError) +{ + if (iObserver) + iObserver->POIProviderLoadedL(this, aError); +} + +void CProvider::LandmarkLoaderItemCreatedL(const CPosLandmark& aLandmark) +{ + if (iObserver) + { + TPosLmItemId id = aLandmark.LandmarkId(); + + if (id == KPosLmNullItemId) + id = GenerateIdL(aLandmark); + + _LIT8(KObject, "lmx"); + OpenMAR::CPOIObject* object = OpenMAR::CPOIObject::NewL(KObject, *this); + CleanupStack::PushL(object); + + object->SetIdentifier(id); + + TLocality locality; + aLandmark.GetPosition(locality); + object->SetCoordinate(locality); + + iObserver->POIObjectCreatedL(object); // Transfers ownership + + CleanupStack::Pop(object); + } +} + +void CProvider::LandmarkLoaderItemUpdatedL(const CPosLandmark& aLandmark) +{ +} + +void CProvider::LandmarkLoaderItemDeletedL(const CPosLandmark& aLandmark) +{ +} + +void CProvider::RetrieveL(const TCoordinate& aCoordinate, TReal32 aRadius) +{ + LOGARG("[LANDMARKS] Retrieving landmarks from %f %f %f", aCoordinate.Latitude(), aCoordinate.Longitude(), aCoordinate.Altitude()); + + iLoader->RequestL(aCoordinate, aRadius); +} diff -r 000000000000 -r c316ab048e9d plugin/poi/landmarks/provider/src/Remote.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/poi/landmarks/provider/src/Remote.cpp Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,195 @@ +/* + * Name : Remote.cpp + * Description : + * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser + * Website : http://OpenMAR.org + * + * Copyright (c) 2010 David Caabeiro + * + * All rights reserved. This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html + * + */ + +#include "Remote.h" + +#include "HttpClient.h" + +#include +#include +#include +#include +#include + +#include "Logger.h" + +CRemoteLoader* CRemoteLoader::NewL(MLandmarkLoaderObserver& aObserver, const TDesC8& aProviderUri) +{ + CRemoteLoader* self = new(ELeave) CRemoteLoader(aObserver); + CleanupStack::PushL(self); + self->ConstructL(aProviderUri); + CleanupStack::Pop(self); + + return self; +} + +CRemoteLoader::~CRemoteLoader() +{ + iBuffer.Close(); + + delete iParser; + delete iClient; + delete iBaseUri; +} + +CRemoteLoader::CRemoteLoader(MLandmarkLoaderObserver& aObserver) + : CActive(CActive::EPriorityStandard), iObserver(aObserver) +{ + CActiveScheduler::Add(this); +} + +void CRemoteLoader::ConstructL(const TDesC8& aProviderUri) +{ + LOGARG("[LANDMARKS] Creating remote landmark loader: %S", &aProviderUri); + + iBaseUri = aProviderUri.AllocL(); + iClient = CHttpClient::NewL(*this); + + _LIT8(KMimeType, "application/vnd.nokia.landmarkcollection+xml"); + iParser = CPosLandmarkParser::NewL(KMimeType); +} + +void CRemoteLoader::RunL() +{ + if (iStatus == KPosLmOperationNotComplete || iStatus == KErrNone) + { + CPosLandmark* landmark = iParser->LandmarkLC(); + iObserver.LandmarkLoaderItemCreatedL(*landmark); + CleanupStack::PopAndDestroy(landmark); + } + + if (iStatus == KPosLmOperationNotComplete) + { + iOperation->NextStep(iStatus, iProgress); + SetActive(); + } +} + +void CRemoteLoader::DoCancel() +{ + // TODO: Add cancellation code +} + +void CRemoteLoader::RequestL(const TCoordinate& aCoordinate, TReal32 aRadius) +{ + TRealFormat realFormat; + realFormat.iPoint = TChar('.'); // Override TLocale::DecimalSeparator() as separator + realFormat.iWidth = 8; // Set max width of number + realFormat.iPlaces = 5; // Set max width of decimal portion + + TBuf8 latitude; + latitude.Num(aCoordinate.Latitude(), realFormat); + + TBuf8 longitude; + longitude.Num(aCoordinate.Longitude(), realFormat); + + // Convert to integer + TInt radius = static_cast(aRadius); + + TBuf8<256> uri(*iBaseUri); + _LIT8(KParam, "?lat=%S&lon=%S&radius=%d"); + uri.AppendFormat(KParam, &latitude, &longitude, radius); + + LOGARG("[LANDMARKS] Making http request %S", &uri); + + iClient->GetL(uri); +} + +void CRemoteLoader::MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent) +{ + switch (aEvent.iStatus) + { + case THTTPEvent::EGotResponseHeaders: + { + RHTTPResponse resp = aTransaction.Response(); + TInt status = resp.StatusCode(); + + LOGARG("[LANDMARKS] HTTP response status %d", status); + + break; + } + + case THTTPEvent::EGotResponseBodyData: + { + MHTTPDataSupplier* body = aTransaction.Response().Body(); + + TPtrC8 dataChunk; + body->GetNextDataPart(dataChunk); + + // Check if there is enough remaining space + const TInt newLength = iBuffer.Length() + dataChunk.Length(); + if (iBuffer.MaxLength() < newLength) + iBuffer.ReAllocL(newLength); + iBuffer.Append(dataChunk); + + body->ReleaseData(); + + break; + } + + case THTTPEvent::EResponseComplete: + LOGTXT("[LANDMARKS] HTTP response complete"); + + break ; + + case THTTPEvent::ESucceeded: + { + RHTTPResponse resp = aTransaction.Response(); + TInt status = resp.StatusCode(); + + LOGARG("[LANDMARKS] HTTP response succeeded %d", status); + + aTransaction.Close(); + + iObserver.LandmarkLoaderOpenedL(KErrNone); + + iParser->SetInputBuffer(iBuffer); + + iOperation = iParser->ParseContentL(); + + iOperation->NextStep(iStatus, iProgress); + SetActive(); + + break; + } + + case THTTPEvent::EFailed: + { + RHTTPResponse resp = aTransaction.Response(); + TInt status = resp.StatusCode(); + + LOGARG("[LANDMARKS] HTTP response failed %d", status); + + aTransaction.Close(); + + iObserver.LandmarkLoaderOpenedL(KErrCouldNotConnect); + break; + } + + default: + LOGARG("[LANDMARKS] HTTP unknown event %d", aEvent.iStatus); + + aTransaction.Close(); + + iObserver.LandmarkLoaderOpenedL(KErrUnknown); + break; + } +} + +TInt CRemoteLoader::MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent) +{ + iObserver.LandmarkLoaderOpenedL(aError); + + return KErrNone; +} diff -r 000000000000 -r c316ab048e9d sis/License.txt Binary file sis/License.txt has changed diff -r 000000000000 -r c316ab048e9d sis/OpenMAR_N97.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sis/OpenMAR_N97.pkg Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,62 @@ +;/* +; * Name : +; * Description : +; * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser +; * Website : http://OpenMAR.org +; * +; * Copyright (c) 2010 David Caabeiro +; * +; * All rights reserved. This program and the accompanying materials are made available +; * under the terms of the Eclipse Public License v1.0 which accompanies this +; * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html +; * +; */ + +; Installation file for application +; +; This is an auto-generated PKG file by Carbide. +; This file uses variables specific to Carbide builds that will not work +; on command-line builds. If you want to use this generated PKG file from the +; command-line tools you will need to modify the variables with the appropriate +; values: $(EPOCROOT), $(PLATFORM), $(TARGET) +; +;Language - standard language definitions +&EN + +; standard SIS file header +#{"OpenMAR"},(0x2002E1AB),0,50,0 + +;Localised Vendor name +%{"Sequence Point Software S.L."} + +;Unique Vendor name +:"" + +;Supports N97 +[0x20014DDD],0,0,0,{"Nokia N97"} +[0x20014DDE],0,0,0,{"Nokia N97"} +[0x20023766],0,0,0,{"Nokia N97 Mini"} + +; Add any installation notes if applicable +"License.txt"-"",FT,TA + +; Main application +"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\OpenMAR_0x2002E1AB.exe" -"!:\sys\bin\OpenMAR_0x2002E1AB.exe" +"$(EPOCROOT)Epoc32\data\z\resource\apps\OpenMAR_0x2002E1AB.rsc" -"!:\resource\apps\OpenMAR_0x2002E1AB.rsc" +"$(EPOCROOT)Epoc32\data\z\private\10003a3f\apps\OpenMAR_0x2002E1AB_reg.rsc" -"!:\private\10003a3f\import\apps\OpenMAR_0x2002E1AB_reg.rsc" + +; Icon files +"$(EPOCROOT)Epoc32\data\z\resource\apps\OpenMAR_0x2002E1AB.mif" -"!:\resource\apps\OpenMAR_0x2002E1AB.mif" +"$(EPOCROOT)Epoc32\data\z\resource\apps\Button_0x2002E1AB.mif" -"!:\resource\apps\Button_0x2002E1AB.mif" + +; Required for application to be covered by backup/restore facility +"..\sis\backup_registration.xml" -"!:\private\2002E1AB\backup_registration.xml" + +;Plugins +"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\Landmarks_0x2002E1AF.dll" -"!:\sys\bin\Landmarks_0x2002E1AF.dll" +"$(EPOCROOT)Epoc32\data\z\resource\plugins\Landmarks_0x2002E1AF.rsc" -"!:\resource\plugins\Landmarks_0x2002E1AF.rsc" +"$(EPOCROOT)Epoc32\data\z\resource\apps\Landmarks_0x2002E1AF.mif" -"!:\resource\apps\Landmarks_0x2002E1AF.mif" + +"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\Geonames_0x2002E1B2.dll" -"!:\sys\bin\Geonames_0x2002E1B2.dll" +"$(EPOCROOT)Epoc32\data\z\resource\plugins\Geonames_0x2002E1B2.rsc" -"!:\resource\plugins\Geonames_0x2002E1B2.rsc" +;"$(EPOCROOT)Epoc32\data\z\resource\apps\Geonames_0x2002E1B2.mif" -"!:\resource\apps\Geonames_0x2002E1B2.mif" diff -r 000000000000 -r c316ab048e9d sis/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sis/backup_registration.xml Fri Jun 25 12:50:05 2010 +0200 @@ -0,0 +1,5 @@ + + + + +