High level Bluetooth Low Energy API and radio abstraction layer
Fork of BLE_API by
Revision 937:4932e700daf2, committed 2015-11-26
- Comitter:
- rgrover1
- Date:
- Thu Nov 26 12:52:06 2015 +0000
- Parent:
- 936:a7bedf42bfb9
- Child:
- 938:66f2fab5cc3a
- Commit message:
- Synchronized with git rev b6216416
Author: Rohit Grover
Merge pull request #108 from marcuschangarm/advert
Changed GapAdvertisingData.addData to take current fields into account when adding data.
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ble.doxyfile Thu Nov 26 12:52:06 2015 +0000 @@ -0,0 +1,1911 @@ +# Doxyfile 1.8.4 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed +# in front of the TAG it is preceding . +# All text after a hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" "). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. + +PROJECT_NAME = "BLE API" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = v2 + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "An abstraction for using Bluetooth Low Energy." + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = apidoc/ + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Latvian, Lithuanian, Norwegian, Macedonian, +# Persian, Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, +# Slovak, Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# 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 = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. Note that you specify absolute paths here, but also +# relative paths, which will be relative from the directory where doxygen is +# started. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, +# and language is one of the parsers supported by doxygen: IDL, Java, +# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, +# C++. For instance to make doxygen treat .inc files as Fortran files (default +# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note +# that for custom extensions you also need to set FILE_PATTERNS otherwise the +# files are not read by doxygen. + +EXTENSION_MAPPING = + +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by by putting a % sign in front of the word +# or globally by setting AUTOLINK_SUPPORT to NO. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES (the +# default) will make doxygen replace the get and set methods by a property in +# the documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields or simple typedef fields will be shown +# inline in the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO (the default), structs, classes, and unions are shown on a separate +# page (for HTML and Man pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can +# be an expensive process and often the same symbol appear multiple times in +# the code, doxygen keeps a cache of pre-resolved symbols. If the cache is too +# small doxygen will become slower. If the cache is too large, memory is wasted. +# The cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid +# range is 0..9, the default is 0, corresponding to a cache size of 2^16 = 65536 +# symbols. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = YES + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = 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 FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if section-label ... \endif +# and \cond section-label ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command <command> <input-file>, where <command> is the value of +# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. Do not use +# file names with spaces, bibtex cannot handle them. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = . + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = *.h *.cpp + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = configs + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command <filter> <input-file>, where <filter> +# is the value of the INPUT_FILTER tag, and <input-file> is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be ignored. +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C, C++ and Fortran comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = 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 = . + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If left blank doxygen will +# generate a default style sheet. Note that it is recommended to use +# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this +# tag will in the future become obsolete. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional +# user-defined cascading style sheet that is included after the standard +# style sheets created by doxygen. Using this option one can overrule +# certain style aspects. This is preferred over using HTML_STYLESHEET +# since it does not replace the standard style sheet and is therefor more +# robust against future updates. Doxygen will copy the style sheet file to +# the output directory. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the style sheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely +# identify the documentation publisher. This should be a reverse domain-name +# style string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters"> +# Qt Help Project / Custom Filters</a>. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes"> +# Qt Help Project / Filter Attributes</a>. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you may also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and +# SVG. The default value is HTML-CSS, which is slower, but has the best +# compatibility. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. +# However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript +# pieces of code that will be used on startup of the MathJax code. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = NO + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a web server instead of a web client using Javascript. +# There are two flavours of web server based search depending on the +# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for +# searching and an index file used by the script. When EXTERNAL_SEARCH is +# enabled the indexing and searching needs to be provided by external tools. +# See the manual for details. + +SERVER_BASED_SEARCH = NO + +# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP +# script for searching. Instead the search results are written to an XML file +# which needs to be processed by an external indexer. Doxygen will invoke an +# external search engine pointed to by the SEARCHENGINE_URL option to obtain +# the search results. Doxygen ships with an example indexer (doxyindexer) and +# search engine (doxysearch.cgi) which are based on the open source search +# engine library Xapian. See the manual for configuration details. + +EXTERNAL_SEARCH = NO + +# The SEARCHENGINE_URL should point to a search engine hosted by a web server +# which will returned the search results when EXTERNAL_SEARCH is enabled. +# Doxygen ships with an example search engine (doxysearch) which is based on +# the open source search engine library Xapian. See the manual for configuration +# details. + +SEARCHENGINE_URL = + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed +# search data is written to a file for indexing by an external tool. With the +# SEARCHDATA_FILE tag the name of this file can be specified. + +SEARCHDATA_FILE = searchdata.xml + +# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the +# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is +# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple +# projects and redirect the results back to the right project. + +EXTERNAL_SEARCH_ID = + +# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen +# projects other than the one defined by this configuration file, but that are +# all added to the same external search index. Each project needs to have a +# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id +# of to a relative location where the documentation can be found. +# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... + +EXTRA_SEARCH_MAPPINGS = + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = YES + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4 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 = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images +# or other source files which should be copied to the LaTeX output directory. +# Note that the files will be copied as-is; there are no commands or markers +# available. + +LATEX_EXTRA_FILES = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load style sheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options related to the DOCBOOK output +#--------------------------------------------------------------------------- + +# If the GENERATE_DOCBOOK tag is set to YES Doxygen will generate DOCBOOK files +# that can be used to generate PDF. + +GENERATE_DOCBOOK = NO + +# The DOCBOOK_OUTPUT tag is used to specify where the DOCBOOK pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in +# front of it. If left blank docbook will be used as the default path. + +DOCBOOK_OUTPUT = docbook + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = WIN32 \ + NTLM \ + USE_LZO \ + ENABLE_FRAGMENT \ + P2MP \ + P2MP_SERVER \ + USE_CRYPTO \ + USE_SSL \ + ENABLE_PLUGIN \ + ENABLE_MANAGEMENT \ + ENABLE_OCC \ + HAVE_GETTIMEOFDAY + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed +# in the related pages index. If set to NO, only the current project's +# pages will be listed. + +EXTERNAL_PAGES = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = NO + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# manageable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50% before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 10 + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 200 + +# 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 = 1000 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = YES + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = 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 \ No newline at end of file
--- a/ble/BLEInstanceBase.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/BLEInstanceBase.h Thu Nov 26 12:52:06 2015 +0000 @@ -21,7 +21,7 @@ #include "ble/SecurityManager.h" #include "ble/BLE.h" -/* forward declarations */ +/* Forward declarations. */ class GattServer; class GattClient;
--- a/ble/CallChainOfFunctionPointersWithContext.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/CallChainOfFunctionPointersWithContext.h Thu Nov 26 12:52:06 2015 +0000 @@ -61,9 +61,9 @@ typedef FunctionPointerWithContext<ContextType> *pFunctionPointerWithContext_t; public: - /** Create an empty chain + /** Create an empty chain. * - * @param size (optional) Initial size of the chain + * @param size (optional) Initial size of the chain. */ CallChainOfFunctionPointersWithContext() : chainHead(NULL) { /* empty */ @@ -73,24 +73,24 @@ clear(); } - /** Add a function at the front of the chain + /** Add a function at the front of the chain. * - * @param function A pointer to a void function + * @param function A pointer to a void function. * * @returns - * The function object created for 'function' + * The function object created for 'function'. */ pFunctionPointerWithContext_t add(void (*function)(ContextType context)) { return common_add(new FunctionPointerWithContext<ContextType>(function)); } - /** Add a function at the front of the chain + /** Add a function at the front of the chain. * - * @param tptr pointer to the object to call the member function on - * @param mptr pointer to the member function to be called + * @param tptr Pointer to the object to call the member function on. + * @param mptr Pointer to the member function to be called. * * @returns - * The function object created for 'tptr' and 'mptr' + * The function object created for 'tptr' and 'mptr'. */ template<typename T> pFunctionPointerWithContext_t add(T *tptr, void (T::*mptr)(ContextType context)) { @@ -115,7 +115,7 @@ } /** Call all the functions in the chain in sequence - * @Note: the stack frames of all the callbacks within the chained + * @Note: The stack frames of all the callbacks within the chained * FunctionPointers will stack up. Hopefully there won't be too many * chained FunctionPointers. */ @@ -140,7 +140,7 @@ private: pFunctionPointerWithContext_t chainHead; - /* disallow copy constructor and assignment operators */ + /* Disallow copy constructor and assignment operators. */ private: CallChainOfFunctionPointersWithContext(const CallChainOfFunctionPointersWithContext &); CallChainOfFunctionPointersWithContext & operator = (const CallChainOfFunctionPointersWithContext &);
--- a/ble/DiscoveredCharacteristic.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/DiscoveredCharacteristic.h Thu Nov 26 12:52:06 2015 +0000 @@ -29,7 +29,7 @@ class DiscoveredCharacteristic { public: struct Properties_t { - uint8_t _broadcast :1; /**< Broadcasting of the value permitted. */ + uint8_t _broadcast :1; /**< Broadcasting the value permitted. */ uint8_t _read :1; /**< Reading the value permitted. */ uint8_t _writeWoResp :1; /**< Writing the value with Write Command permitted. */ uint8_t _write :1; /**< Writing the value with Write Request permitted. */ @@ -47,8 +47,8 @@ bool authSignedWrite(void) const {return _authSignedWrite;} private: - operator uint8_t() const; /* disallow implicit conversion into an integer */ - operator unsigned() const; /* disallow implicit conversion into an integer */ + operator uint8_t() const; /* Disallow implicit conversion into an integer. */ + operator unsigned() const; /* Disallow implicit conversion into an integer. */ }; /** @@ -72,13 +72,13 @@ /** * Initiate (or continue) a read for the value attribute, optionally at a - * given offset. If the Characteristic or Descriptor to be read is longer + * given offset. If the characteristic or descriptor to be read is longer * than ATT_MTU - 1, this function must be called multiple times with * appropriate offset to read the complete value. * - * @return BLE_ERROR_NONE if a read has been initiated, else + * @return BLE_ERROR_NONE if a read has been initiated, or * BLE_ERROR_INVALID_STATE if some internal state about the connection is invalid, or - * BLE_STACK_BUSY if some client procedure already in progress, or + * BLE_STACK_BUSY if some client procedure is already in progress, or * BLE_ERROR_OPERATION_NOT_PERMITTED due to the characteristic's properties. */ ble_error_t read(uint16_t offset = 0) const; @@ -97,9 +97,9 @@ * writeWoResponse operations; the user may want to use the onDataSent() * callback for flow-control. * - * @retval BLE_ERROR_NONE Successfully started the Write procedure, else + * @retval BLE_ERROR_NONE Successfully started the Write procedure, or * BLE_ERROR_INVALID_STATE if some internal state about the connection is invalid, or - * BLE_STACK_BUSY if some client procedure already in progress, or + * BLE_STACK_BUSY if some client procedure is already in progress, or * BLE_ERROR_NO_MEM if there are no available buffers left to process the request, or * BLE_ERROR_OPERATION_NOT_PERMITTED due to the characteristic's properties. */ @@ -110,7 +110,7 @@ * * @param callback * @param matchingUUID - * filter for descriptors. Defaults to wildcard which will discover all descriptors. + * Filter for descriptors. Defaults to wildcard which will discover all descriptors. * * @return BLE_ERROR_NONE if descriptor discovery is launched successfully; else an appropriate error. */ @@ -127,9 +127,9 @@ * @note It is important to note that a write will generate * an onDataWritten() callback when the peer acknowledges the request. * - * @retval BLE_ERROR_NONE Successfully started the Write procedure, else + * @retval BLE_ERROR_NONE Successfully started the Write procedure, or * BLE_ERROR_INVALID_STATE if some internal state about the connection is invalid, or - * BLE_STACK_BUSY if some client procedure already in progress, or + * BLE_STACK_BUSY if some client procedure is already in progress, or * BLE_ERROR_NO_MEM if there are no available buffers left to process the request, or * BLE_ERROR_OPERATION_NOT_PERMITTED due to the characteristic's properties. */
--- a/ble/FunctionPointerWithContext.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/FunctionPointerWithContext.h Thu Nov 26 12:52:06 2015 +0000 @@ -20,7 +20,7 @@ #include <string.h> /** A class for storing and calling a pointer to a static or member void function - * which takes a context. + * that takes a context. */ template <typename ContextType> class FunctionPointerWithContext { @@ -28,19 +28,19 @@ typedef FunctionPointerWithContext<ContextType> *pFunctionPointerWithContext_t; typedef void (*pvoidfcontext_t)(ContextType context); - /** Create a FunctionPointerWithContext, attaching a static function + /** Create a FunctionPointerWithContext, attaching a static function. * - * @param function The void static function to attach (default is none) + * @param function The void static function to attach (default is none). */ FunctionPointerWithContext(void (*function)(ContextType context) = NULL) : _function(NULL), _caller(NULL), _next(NULL) { attach(function); } - /** Create a FunctionPointerWithContext, attaching a member function + /** Create a FunctionPointerWithContext, attaching a member function. * - * @param object The object pointer to invoke the member function on (i.e. the this pointer) - * @param function The address of the void member function to attach + * @param object The object pointer to invoke the member function on (the "this" pointer). + * @param function The address of the void member function to attach. */ template<typename T> FunctionPointerWithContext(T *object, void (T::*member)(ContextType context)) : @@ -48,19 +48,19 @@ attach(object, member); } - /** Attach a static function + /** Attach a static function. * - * @param function The void static function to attach (default is none) + * @param function The void static function to attach (default is none). */ void attach(void (*function)(ContextType context) = NULL) { _function = function; _caller = functioncaller; } - /** Attach a member function + /** Attach a member function. * - * @param object The object pointer to invoke the member function on (i.e. the this pointer) - * @param function The address of the void member function to attach + * @param object The object pointer to invoke the member function on (the "this" pointer). + * @param function The address of the void member function to attach. */ template<typename T> void attach(T *object, void (T::*member)(ContextType context)) { @@ -69,9 +69,9 @@ _caller = &FunctionPointerWithContext::membercaller<T>; } - /** Call the attached static or member function; and if there are chained + /** Call the attached static or member function; if there are chained * FunctionPointers their callbacks are invoked as well. - * @Note: all chained callbacks stack up; so hopefully there won't be too + * @Note: All chained callbacks stack up, so hopefully there won't be too * many FunctionPointers in a chain. */ void call(ContextType context) { _caller(this, context); @@ -83,7 +83,7 @@ } /** - * Setup an external FunctionPointer as a next in the chain of related + * Set up an external FunctionPointer as a next in the chain of related * callbacks. Invoking call() on the head FunctionPointer will invoke all * chained callbacks. * @@ -120,7 +120,7 @@ struct MemberFunctionAndPtr { /* - * forward declaration of a class and a member function to this class. + * Forward declaration of a class and a member function to this class. * Because the compiler doesn't know anything about the forwarded member * function, it will always use the biggest size and the biggest alignment * that a member function can take for objects of type UndefinedMemberFunction. @@ -136,7 +136,7 @@ }; union { - pvoidfcontext_t _function; /**< static function pointer - NULL if none attached */ + pvoidfcontext_t _function; /**< Static function pointer - NULL if none attached */ /** * object this pointer and pointer to member - * _memberFunctionAndPointer._object will be NULL if none attached @@ -146,9 +146,9 @@ void (*_caller)(FunctionPointerWithContext*, ContextType); - pFunctionPointerWithContext_t _next; /**< Optional link to make a chain out of functionPointers; this + pFunctionPointerWithContext_t _next; /**< Optional link to make a chain out of functionPointers. This * allows chaining function pointers without requiring - * external memory to manage the chain. Also refer to + * external memory to manage the chain. Refer to * 'CallChain' as an alternative. */ };
--- a/ble/Gap.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/Gap.h Thu Nov 26 12:52:06 2015 +0000 @@ -24,7 +24,7 @@ #include "CallChainOfFunctionPointersWithContext.h" #include "FunctionPointerWithContext.h" -/* Forward declarations for classes which will only be used for pointers or references in the following. */ +/* Forward declarations for classes that will only be used for pointers or references in the following. */ class GapAdvertisingParams; class GapScanningParams; class GapAdvertisingData; @@ -37,11 +37,11 @@ ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE, ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE }; - typedef enum AddressType_t addr_type_t; /* @Note: deprecated. Use AddressType_t instead. */ + typedef enum AddressType_t addr_type_t; /* @Note: Deprecated. Use AddressType_t instead. */ static const unsigned ADDR_LEN = 6; typedef uint8_t Address_t[ADDR_LEN]; /* 48-bit address, LSB format. */ - typedef Address_t address_t; /* @Note: deprecated. Use Address_t instead. */ + typedef Address_t address_t; /* @Note: Deprecated. Use Address_t instead. */ enum TimeoutSource_t { TIMEOUT_SRC_ADVERTISING = 0x00, /**< Advertising timeout. */ @@ -52,24 +52,24 @@ /** * Enumeration for disconnection reasons. The values for these reasons are - * derived from Nordic's implementation; but the reasons are meant to be - * independent of the transport. If you are returned a reason which is not - * covered by this enumeration, then please refer to the underlying + * derived from Nordic's implementation, but the reasons are meant to be + * independent of the transport. If you are returned a reason that is not + * covered by this enumeration, please refer to the underlying * transport library. */ enum DisconnectionReason_t { CONNECTION_TIMEOUT = 0x08, REMOTE_USER_TERMINATED_CONNECTION = 0x13, - REMOTE_DEV_TERMINATION_DUE_TO_LOW_RESOURCES = 0x14, /**< Remote Device Terminated Connection due to low resources.*/ - REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF = 0x15, /**< Remote Device Terminated Connection due to power off. */ + REMOTE_DEV_TERMINATION_DUE_TO_LOW_RESOURCES = 0x14, /**< Remote device terminated connection due to low resources.*/ + REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF = 0x15, /**< Remote device terminated connection due to power off. */ LOCAL_HOST_TERMINATED_CONNECTION = 0x16, CONN_INTERVAL_UNACCEPTABLE = 0x3B, }; - /* Describes the current state of the device (more than one bit can be set) */ + /* Describes the current state of the device (more than one bit can be set). */ struct GapState_t { - unsigned advertising : 1; /**< peripheral is currently advertising */ - unsigned connected : 1; /**< peripheral is connected to a central */ + unsigned advertising : 1; /**< Peripheral is currently advertising. */ + unsigned connected : 1; /**< Peripheral is connected to a central. */ }; typedef uint16_t Handle_t; /* Type for connection handle. */ @@ -152,7 +152,7 @@ public: /** * Set the BTLE MAC address and type. Please note that the address format is - * LSB (least significant byte first). Please refer to Address_t. + * least significant byte first (LSB). Please refer to Address_t. * * @return BLE_ERROR_NONE on success. */ @@ -170,7 +170,7 @@ * @return BLE_ERROR_NONE on success. */ virtual ble_error_t getAddress(AddressType_t *typeP, Address_t address) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)typeP; (void)address; @@ -230,7 +230,7 @@ Gap::AddressType_t peerAddrType, const ConnectionParams_t *connectionParams, const GapScanningParams *scanParams) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)peerAddr; (void)peerAddrType; (void)connectionParams; @@ -245,7 +245,7 @@ * disconnectionCallback. * * @param reason - * The reason for disconnection to be sent back to the peer. + * The reason for disconnection; to be sent back to the peer. */ virtual ble_error_t disconnect(Handle_t connectionHandle, DisconnectionReason_t reason) { /* avoid compiler warnings about unused variables */ @@ -261,15 +261,15 @@ * disconnectionCallback. * * @param reason - * The reason for disconnection to be sent back to the peer. + * The reason for disconnection; to be sent back to the peer. * - * @note: this version of disconnect() doesn't take a connection handle. It - * will work reliably only for stacks which are limited to a single + * @note: This version of disconnect() doesn't take a connection handle. It + * works reliably only for stacks that are limited to a single * connection. This API should be considered *deprecated* in favour of the - * altertive which takes a connection handle. It will be dropped in the future. + * alternative, which takes a connection handle. It will be dropped in the future. */ virtual ble_error_t disconnect(DisconnectionReason_t reason) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)reason; return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ @@ -288,7 +288,7 @@ * the given structure pointed to by params. */ virtual ble_error_t getPreferredConnectionParams(ConnectionParams_t *params) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)params; return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ @@ -303,7 +303,7 @@ * The structure containing the desired parameters. */ virtual ble_error_t setPreferredConnectionParams(const ConnectionParams_t *params) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)params; return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ @@ -311,12 +311,12 @@ /** * Update connection parameters. - * In the central role this will initiate a Link Layer connection parameter update procedure, - * otherwise in the peripheral role, this will send the corresponding L2CAP request and wait for + * In the central role this will initiate a Link Layer connection parameter update procedure. + * In the peripheral role, this will send the corresponding L2CAP request and wait for * the central to perform the procedure. * * @param[in] handle - * Connection Handle + * Connection Handle. * @param[in] params * Pointer to desired connection parameters. If NULL is provided on a peripheral role, * the parameters in the PPCP characteristic of the GAP service will be used instead. @@ -335,7 +335,7 @@ * The new value for the device-name. This is a UTF-8 encoded, <b>NULL-terminated</b> string. */ virtual ble_error_t setDeviceName(const uint8_t *deviceName) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)deviceName; return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ @@ -373,7 +373,7 @@ * The new value for the device-appearance. */ virtual ble_error_t setAppearance(GapAdvertisingData::Appearance appearance) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)appearance; return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ @@ -385,7 +385,7 @@ * The new value for the device-appearance. */ virtual ble_error_t getAppearance(GapAdvertisingData::Appearance *appearanceP) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)appearanceP; return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ @@ -396,7 +396,7 @@ * @param[in] txPower Radio transmit power in dBm. */ virtual ble_error_t setTxPower(int8_t txPower) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)txPower; return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ @@ -411,7 +411,7 @@ * Out parameter to receive the array's size. */ virtual void getPermittedTxPowerValues(const int8_t **valueArrayPP, size_t *countP) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)valueArrayPP; (void)countP; @@ -430,8 +430,8 @@ */ public: /** - * Returns the current GAP state of the device using a bitmask which - * describes whether the device is advertising and/or connected. + * Returns the current GAP state of the device using a bitmask that + * describes whether the device is advertising or connected. */ GapState_t getState(void) const { return state; @@ -456,7 +456,7 @@ * to ADV_CONNECTABLE_DIRECTED. * * @note: Decreasing this value will allow central devices to detect a - * peripheral faster at the expense of more power being used by the radio + * peripheral faster, at the expense of more power being used by the radio * due to the higher data transmit rate. * * @note: This API is now *deprecated* and will be dropped in the future. @@ -468,7 +468,7 @@ * 'interval' argument. That required an explicit conversion from * milliseconds using Gap::MSEC_TO_GAP_DURATION_UNITS(). This conversion is * no longer required as the new units are milliseconds. Any application - * code depending on the old semantics would need to be updated accordingly. + * code depending on the old semantics needs to be updated accordingly. */ void setAdvertisingInterval(uint16_t interval) { if (interval == 0) { @@ -492,17 +492,14 @@ * Start advertising. */ ble_error_t startAdvertising(void) { - setAdvertisingData(); /* update the underlying stack */ + setAdvertisingData(); /* Update the underlying stack. */ return startAdvertising(_advParams); } /** * Reset any advertising payload prepared from prior calls to * accumulateAdvertisingPayload(). This automatically propagates the re- - * initialized adv payload to the underlying stack. - * - * Note: This should be followed by a call to setAdvertisingPayload() or - * startAdvertising() before the update takes effect. + * initialized advertising payload to the underlying stack. */ void clearAdvertisingPayload(void) { _advPayload.clear(); @@ -512,7 +509,7 @@ /** * Accumulate an AD structure in the advertising payload. Please note that * the payload is limited to 31 bytes. The SCAN_RESPONSE message may be used - * as an additional 31 bytes if the advertising payload proves to be too + * as an additional 31 bytes if the advertising payload is too * small. * * @param[in] flags @@ -532,7 +529,7 @@ /** * Accumulate an AD structure in the advertising payload. Please note that * the payload is limited to 31 bytes. The SCAN_RESPONSE message may be used - * as an additional 31 bytes if the advertising payload proves to be too + * as an additional 31 bytes if the advertising payload is too * small. * * @param app @@ -552,12 +549,11 @@ /** * Accumulate an AD structure in the advertising payload. Please note that * the payload is limited to 31 bytes. The SCAN_RESPONSE message may be used - * as an additional 31 bytes if the advertising payload proves to be too + * as an additional 31 bytes if the advertising payload is too * small. * - * @param app + * @param power * The max transmit power to be used by the controller (in dBm). - * This is only a hint. */ ble_error_t accumulateAdvertisingPayloadTxPower(int8_t power) { ble_error_t rc; @@ -572,11 +568,11 @@ * Accumulate a variable length byte-stream as an AD structure in the * advertising payload. Please note that the payload is limited to 31 bytes. * The SCAN_RESPONSE message may be used as an additional 31 bytes if the - * advertising payload proves to be too small. + * advertising payload is too small. * - * @param type The type which describes the variable length data. - * @param data data bytes. - * @param len length of data. + * @param type The type describing the variable length data. + * @param data Data bytes. + * @param len Length of data. */ ble_error_t accumulateAdvertisingPayload(GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len) { if (type == GapAdvertisingData::COMPLETE_LOCAL_NAME) { @@ -596,14 +592,14 @@ * matching type and length). Note: the length of the new data must be the * same as the old one. * - * @param[in] type The ADV type field which describes the variable length data. - * @param[in] data data bytes. - * @param[in] len length of data. + * @param[in] type The ADV type field describing the variable length data. + * @param[in] data Data bytes. + * @param[in] len Length of data. * * @note: If advertisements are enabled, then the update will take effect immediately. * * @return BLE_ERROR_NONE if the advertisement payload was updated based on - * a <type, len> match; else an appropriate error. + * a <type, len> match; otherwise, an appropriate error. */ ble_error_t updateAdvertisingPayload(GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len) { if (type == GapAdvertisingData::COMPLETE_LOCAL_NAME) { @@ -619,7 +615,7 @@ } /** - * Setup a particular, user-constructed advertisement payload for the + * Set up a particular, user-constructed advertisement payload for the * underlying stack. It would be uncommon for this API to be used directly; * there are other APIs to build an advertisement payload (see above). */ @@ -640,9 +636,9 @@ * Accumulate a variable length byte-stream as an AD structure in the * scanResponse payload. * - * @param[in] type The type which describes the variable length data. - * @param[in] data data bytes. - * @param[in] len length of data. + * @param[in] type The type describing the variable length data. + * @param[in] data Data bytes. + * @param[in] len Length of data. */ ble_error_t accumulateScanResponse(GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len) { ble_error_t rc; @@ -666,13 +662,13 @@ } /** - * Setup parameters for GAP scanning--i.e. observer mode. + * Set up parameters for GAP scanning (observer mode). * @param[in] interval * Scan interval (in milliseconds) [valid values lie between 2.5ms and 10.24s]. * @param[in] window * Scan Window (in milliseconds) [valid values lie between 2.5ms and 10.24s]. * @param[in] timeout - * Scan timeout (in seconds) between 0x0001 and 0xFFFF, 0x0000 disables timeout. + * Scan timeout (in seconds) between 0x0001 and 0xFFFF; 0x0000 disables the timeout. * @param[in] activeScanning * Set to True if active-scanning is required. This is used to fetch the * scan response from a peer if possible. @@ -705,7 +701,7 @@ } /** - * Setup the scanInterval parameter for GAP scanning--i.e. observer mode. + * Set up the scanInterval parameter for GAP scanning (observer mode). * @param[in] interval * Scan interval (in milliseconds) [valid values lie between 2.5ms and 10.24s]. * @@ -724,7 +720,7 @@ } /** - * Setup the scanWindow parameter for GAP scanning--i.e. observer mode. + * Set up the scanWindow parameter for GAP scanning (observer mode). * @param[in] window * Scan Window (in milliseconds) [valid values lie between 2.5ms and 10.24s]. * @@ -756,9 +752,9 @@ } /** - * Setup parameters for GAP scanning--i.e. observer mode. + * Set up parameters for GAP scanning (observer mode). * @param[in] timeout - * Scan timeout (in seconds) between 0x0001 and 0xFFFF, 0x0000 disables timeout. + * Scan timeout (in seconds) between 0x0001 and 0xFFFF; 0x0000 disables the timeout. * * Once the scanning parameters have been configured, scanning can be * enabled by using startScan(). @@ -781,7 +777,7 @@ } /** - * Setup parameters for GAP scanning--i.e. observer mode. + * Set up parameters for GAP scanning (observer mode). * @param[in] activeScanning * Set to True if active-scanning is required. This is used to fetch the * scan response from a peer if possible. @@ -808,7 +804,7 @@ * effect. * * @param[in] callback - * The application specific callback to be invoked upon + * The application-specific callback to be invoked upon * receiving every advertisement report. This can be passed in * as NULL, in which case scanning may not be enabled at all. */ @@ -842,17 +838,17 @@ /** * Initialize radio-notification events to be generated from the stack. - * This API doesn't need to be called directly; + * This API doesn't need to be called directly. * * Radio Notification is a feature that enables ACTIVE and INACTIVE * (nACTIVE) signals from the stack that notify the application when the * radio is in use. * - * The ACTIVE signal is sent before the Radio Event starts. The nACTIVE - * signal is sent at the end of the Radio Event. These signals can be used + * The ACTIVE signal is sent before the radio event starts. The nACTIVE + * signal is sent at the end of the radio event. These signals can be used * by the application programmer to synchronize application logic with radio * activity. For example, the ACTIVE signal can be used to shut off external - * devices to manage peak current drawn during periods when the radio is on, + * devices, to manage peak current drawn during periods when the radio is on, * or to trigger sensor data collection for transmission in the Radio Event. * * @return BLE_ERROR_NONE on successful initialization, otherwise an error code. @@ -882,7 +878,7 @@ } /** - * Setup a particular, user-constructed set of advertisement parameters for + * Set up a particular, user-constructed set of advertisement parameters for * the underlying stack. It would be uncommon for this API to be used * directly; there are other APIs to tweak advertisement parameters * individually. @@ -894,7 +890,7 @@ /* Event callback handlers. */ public: /** - * Setup a callback for timeout events. Refer to TimeoutSource_t for + * Set up a callback for timeout events. Refer to TimeoutSource_t for * possible event types. */ void onTimeout(TimeoutEventCallback_t callback) {timeoutCallback = callback;} @@ -922,18 +918,18 @@ * (nACTIVE) signals from the stack that notify the application when the * radio is in use. * - * The ACTIVE signal is sent before the Radio Event starts. The nACTIVE - * signal is sent at the end of the Radio Event. These signals can be used + * The ACTIVE signal is sent before the radio event starts. The nACTIVE + * signal is sent at the end of the radio event. These signals can be used * by the application programmer to synchronize application logic with radio * activity. For example, the ACTIVE signal can be used to shut off external - * devices to manage peak current drawn during periods when the radio is on, + * devices, to manage peak current drawn during periods when the radio is on, * or to trigger sensor data collection for transmission in the Radio Event. * * @param callback * The application handler to be invoked in response to a radio * ACTIVE/INACTIVE event. * - * or in the other version: + * Or in the other version: * * @param tptr * Pointer to the object of a class defining the member callback @@ -1028,7 +1024,7 @@ CallChainOfFunctionPointersWithContext<const DisconnectionCallbackParams_t*> disconnectionCallChain; private: - /* disallow copy and assignment */ + /* Disallow copy and assignment. */ Gap(const Gap &); Gap& operator=(const Gap &); };
--- a/ble/GapAdvertisingData.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/GapAdvertisingData.h Thu Nov 26 12:52:06 2015 +0000 @@ -28,10 +28,10 @@ /*! \brief This class provides several helper functions to generate properly - formatted GAP Advertising and Scan Response data payloads + formatted GAP Advertising and Scan Response data payloads. \note - See Bluetooth Specification 4.0 (Vol. 3), Part C, Section 11 and 18 + See Bluetooth Specification 4.0 (Vol. 3), Part C, Sections 11 and 18 for further information on Advertising and Scan Response data. \par Advertising and Scan Response Payloads @@ -40,22 +40,22 @@ Specification v4.0, Vol. 3, Part C, Sections 11 and 18). \par - Each AD type has it's own standardized 'assigned number', as defined + Each AD type has its own standardized assigned number, as defined by the Bluetooth SIG: https://www.bluetooth.org/en-us/specification/assigned-numbers/generic-access-profile \par - For convenience sake, all appropriate AD types have been encapsulated - into GapAdvertisingData::DataType. + For convenience, all appropriate AD types are encapsulated + in GapAdvertisingData::DataType. \par Before the AD Types and their payload (if any) can be inserted into the Advertising or Scan Response frames, they need to be formatted as follows: - \li \c Record length (1 byte) - \li \c AD Type (1 byte) - \li \c AD payload (optional, only present if record length > 1) + \li \c Record length (1 byte). + \li \c AD Type (1 byte). + \li \c AD payload (optional; only present if record length > 1). \par This class takes care of properly formatting the payload, performs @@ -80,7 +80,7 @@ \brief A list of Advertising Data types commonly used by peripherals. These AD types are used to describe the capabilities of the - peripheral, and get inserted inside the advertising or scan + peripheral, and are inserted inside the advertising or scan response payloads. \par Source @@ -101,6 +101,7 @@ TX_POWER_LEVEL = 0x0A, /**< TX Power Level (in dBm) */ DEVICE_ID = 0x10, /**< Device ID */ SLAVE_CONNECTION_INTERVAL_RANGE = 0x12, /**< Slave Connection Interval Range */ + LIST_128BIT_SOLICITATION_IDS = 0x15, /**< List of 128 bit service UUIDs the device is looking for */ SERVICE_DATA = 0x16, /**< Service Data */ APPEARANCE = 0x19, /**< \ref Appearance */ ADVERTISING_INTERVAL = 0x1A, /**< Advertising Interval */ @@ -111,7 +112,7 @@ /**********************************************************************/ /*! \brief - A list of values for the FLAGS AD Type + A list of values for the FLAGS AD Type. \note You can use more than one value in the FLAGS AD Type (ex. @@ -122,11 +123,11 @@ */ /**********************************************************************/ enum Flags_t { - LE_LIMITED_DISCOVERABLE = 0x01, /**< *Peripheral device is discoverable for a limited period of time */ - LE_GENERAL_DISCOVERABLE = 0x02, /**< Peripheral device is discoverable at any moment */ - BREDR_NOT_SUPPORTED = 0x04, /**< Peripheral device is LE only */ - SIMULTANEOUS_LE_BREDR_C = 0x08, /**< Not relevant - central mode only */ - SIMULTANEOUS_LE_BREDR_H = 0x10 /**< Not relevant - central mode only */ + LE_LIMITED_DISCOVERABLE = 0x01, /**< *Peripheral device is discoverable for a limited period of time. */ + LE_GENERAL_DISCOVERABLE = 0x02, /**< Peripheral device is discoverable at any moment. */ + BREDR_NOT_SUPPORTED = 0x04, /**< Peripheral device is LE only. */ + SIMULTANEOUS_LE_BREDR_C = 0x08, /**< Not relevant - central mode only. */ + SIMULTANEOUS_LE_BREDR_H = 0x10 /**< Not relevant - central mode only. */ }; typedef enum Flags_t Flags; /* Deprecated type alias. This may be dropped in a future release. */ @@ -134,7 +135,7 @@ /*! \brief A list of values for the APPEARANCE AD Type, which describes the - physical shape or appearance of the device + physical shape or appearance of the device. \par Source \li \c Bluetooth Core Specification Supplement, Part A, Section 1.12 @@ -143,54 +144,54 @@ */ /**********************************************************************/ enum Appearance_t { - UNKNOWN = 0, /**< Unknown of unspecified appearance type */ - GENERIC_PHONE = 64, /**< Generic Phone */ - GENERIC_COMPUTER = 128, /**< Generic Computer */ - GENERIC_WATCH = 192, /**< Generic Watch */ - WATCH_SPORTS_WATCH = 193, /**< Sports Watch */ - GENERIC_CLOCK = 256, /**< Generic Clock */ - GENERIC_DISPLAY = 320, /**< Generic Display */ - GENERIC_REMOTE_CONTROL = 384, /**< Generic Remote Control */ - GENERIC_EYE_GLASSES = 448, /**< Generic Eye Glasses */ - GENERIC_TAG = 512, /**< Generic Tag */ - GENERIC_KEYRING = 576, /**< Generic Keyring */ - GENERIC_MEDIA_PLAYER = 640, /**< Generic Media Player */ - GENERIC_BARCODE_SCANNER = 704, /**< Generic Barcode Scanner */ - GENERIC_THERMOMETER = 768, /**< Generic Thermometer */ - THERMOMETER_EAR = 769, /**< Ear Thermometer */ - GENERIC_HEART_RATE_SENSOR = 832, /**< Generic Heart Rate Sensor */ - HEART_RATE_SENSOR_HEART_RATE_BELT = 833, /**< Belt Heart Rate Sensor */ - GENERIC_BLOOD_PRESSURE = 896, /**< Generic Blood Pressure */ - BLOOD_PRESSURE_ARM = 897, /**< Arm Blood Pressure */ - BLOOD_PRESSURE_WRIST = 898, /**< Wrist Blood Pressure */ - HUMAN_INTERFACE_DEVICE_HID = 960, /**< Human Interface Device (HID) */ - KEYBOARD = 961, /**< Keyboard */ - MOUSE = 962, /**< Mouse */ - JOYSTICK = 963, /**< Joystick */ - GAMEPAD = 964, /**< Gamepad */ - DIGITIZER_TABLET = 965, /**< Digitizer Tablet */ - CARD_READER = 966, /**< Card Read */ - DIGITAL_PEN = 967, /**< Digital Pen */ - BARCODE_SCANNER = 968, /**< Barcode Scanner */ - GENERIC_GLUCOSE_METER = 1024, /**< Generic Glucose Meter */ - GENERIC_RUNNING_WALKING_SENSOR = 1088, /**< Generic Running/Walking Sensor */ - RUNNING_WALKING_SENSOR_IN_SHOE = 1089, /**< In Shoe Running/Walking Sensor */ - RUNNING_WALKING_SENSOR_ON_SHOE = 1090, /**< On Shoe Running/Walking Sensor */ - RUNNING_WALKING_SENSOR_ON_HIP = 1091, /**< On Hip Running/Walking Sensor */ - GENERIC_CYCLING = 1152, /**< Generic Cycling */ - CYCLING_CYCLING_COMPUTER = 1153, /**< Cycling Computer */ - CYCLING_SPEED_SENSOR = 1154, /**< Cycling Speed Senspr */ - CYCLING_CADENCE_SENSOR = 1155, /**< Cycling Cadence Sensor */ - CYCLING_POWER_SENSOR = 1156, /**< Cycling Power Sensor */ - CYCLING_SPEED_AND_CADENCE_SENSOR = 1157, /**< Cycling Speed and Cadence Sensor */ - PULSE_OXIMETER_GENERIC = 3136, /**< Generic Pulse Oximeter */ - PULSE_OXIMETER_FINGERTIP = 3137, /**< Fingertip Pulse Oximeter */ - PULSE_OXIMETER_WRIST_WORN = 3138, /**< Wrist Worn Pulse Oximeter */ - OUTDOOR_GENERIC = 5184, /**< Generic Outdoor */ - OUTDOOR_LOCATION_DISPLAY_DEVICE = 5185, /**< Outdoor Location Display Device */ - OUTDOOR_LOCATION_AND_NAVIGATION_DISPLAY_DEVICE = 5186, /**< Outdoor Location and Navigation Display Device */ - OUTDOOR_LOCATION_POD = 5187, /**< Outdoor Location Pod */ - OUTDOOR_LOCATION_AND_NAVIGATION_POD = 5188 /**< Outdoor Location and Navigation Pod */ + UNKNOWN = 0, /**< Unknown or unspecified appearance type. */ + GENERIC_PHONE = 64, /**< Generic Phone. */ + GENERIC_COMPUTER = 128, /**< Generic Computer. */ + GENERIC_WATCH = 192, /**< Generic Watch. */ + WATCH_SPORTS_WATCH = 193, /**< Sports Watch. */ + GENERIC_CLOCK = 256, /**< Generic Clock. */ + GENERIC_DISPLAY = 320, /**< Generic Display. */ + GENERIC_REMOTE_CONTROL = 384, /**< Generic Remote Control. */ + GENERIC_EYE_GLASSES = 448, /**< Generic Eye Glasses. */ + GENERIC_TAG = 512, /**< Generic Tag. */ + GENERIC_KEYRING = 576, /**< Generic Keyring. */ + GENERIC_MEDIA_PLAYER = 640, /**< Generic Media Player. */ + GENERIC_BARCODE_SCANNER = 704, /**< Generic Barcode Scanner. */ + GENERIC_THERMOMETER = 768, /**< Generic Thermometer. */ + THERMOMETER_EAR = 769, /**< Ear Thermometer. */ + GENERIC_HEART_RATE_SENSOR = 832, /**< Generic Heart Rate Sensor. */ + HEART_RATE_SENSOR_HEART_RATE_BELT = 833, /**< Belt Heart Rate Sensor. */ + GENERIC_BLOOD_PRESSURE = 896, /**< Generic Blood Pressure. */ + BLOOD_PRESSURE_ARM = 897, /**< Arm Blood Pressure. */ + BLOOD_PRESSURE_WRIST = 898, /**< Wrist Blood Pressure. */ + HUMAN_INTERFACE_DEVICE_HID = 960, /**< Human Interface Device (HID). */ + KEYBOARD = 961, /**< Keyboard. */ + MOUSE = 962, /**< Mouse. */ + JOYSTICK = 963, /**< Joystick. */ + GAMEPAD = 964, /**< Gamepad. */ + DIGITIZER_TABLET = 965, /**< Digitizer Tablet. */ + CARD_READER = 966, /**< Card Reader. */ + DIGITAL_PEN = 967, /**< Digital Pen. */ + BARCODE_SCANNER = 968, /**< Barcode Scanner. */ + GENERIC_GLUCOSE_METER = 1024, /**< Generic Glucose Meter. */ + GENERIC_RUNNING_WALKING_SENSOR = 1088, /**< Generic Running/Walking Sensor. */ + RUNNING_WALKING_SENSOR_IN_SHOE = 1089, /**< In Shoe Running/Walking Sensor. */ + RUNNING_WALKING_SENSOR_ON_SHOE = 1090, /**< On Shoe Running/Walking Sensor. */ + RUNNING_WALKING_SENSOR_ON_HIP = 1091, /**< On Hip Running/Walking Sensor. */ + GENERIC_CYCLING = 1152, /**< Generic Cycling. */ + CYCLING_CYCLING_COMPUTER = 1153, /**< Cycling Computer. */ + CYCLING_SPEED_SENSOR = 1154, /**< Cycling Speed Sensor. */ + CYCLING_CADENCE_SENSOR = 1155, /**< Cycling Cadence Sensor. */ + CYCLING_POWER_SENSOR = 1156, /**< Cycling Power Sensor. */ + CYCLING_SPEED_AND_CADENCE_SENSOR = 1157, /**< Cycling Speed and Cadence Sensor. */ + PULSE_OXIMETER_GENERIC = 3136, /**< Generic Pulse Oximeter. */ + PULSE_OXIMETER_FINGERTIP = 3137, /**< Fingertip Pulse Oximeter. */ + PULSE_OXIMETER_WRIST_WORN = 3138, /**< Wrist Worn Pulse Oximeter. */ + OUTDOOR_GENERIC = 5184, /**< Generic Outdoor. */ + OUTDOOR_LOCATION_DISPLAY_DEVICE = 5185, /**< Outdoor Location Display Device. */ + OUTDOOR_LOCATION_AND_NAVIGATION_DISPLAY_DEVICE = 5186, /**< Outdoor Location and Navigation Display Device. */ + OUTDOOR_LOCATION_POD = 5187, /**< Outdoor Location Pod. */ + OUTDOOR_LOCATION_AND_NAVIGATION_POD = 5188 /**< Outdoor Location and Navigation Pod. */ }; typedef enum Appearance_t Appearance; /* Deprecated type alias. This may be dropped in a future release. */ @@ -199,38 +200,109 @@ } /** - * Adds advertising data based on the specified AD type (see DataType) + * Adds advertising data based on the specified AD type (see DataType). * - * @param advDataType The Advertising 'DataType' to add - * @param payload Pointer to the payload contents - * @param len Size of the payload in bytes + * @param advDataType The Advertising 'DataType' to add. + * @param payload Pointer to the payload contents. + * @param len Size of the payload in bytes. * * @return BLE_ERROR_BUFFER_OVERFLOW if the specified data would cause the * advertising buffer to overflow, else BLE_ERROR_NONE. */ ble_error_t addData(DataType advDataType, const uint8_t *payload, uint8_t len) { - /* ToDo: Check if an AD type already exists and if the existing */ - /* value is exclusive or not (flags, etc.) */ + ble_error_t result = BLE_ERROR_BUFFER_OVERFLOW; + + // find field + uint8_t* field = findField(advDataType); + + // Field type already exist, either add to field or replace + if (field) { + switch(advDataType) { + // These fields will be overwritten with the new value + case FLAGS: + case SHORTENED_LOCAL_NAME: + case COMPLETE_LOCAL_NAME: + case TX_POWER_LEVEL: + case DEVICE_ID: + case SLAVE_CONNECTION_INTERVAL_RANGE: + case SERVICE_DATA: + case APPEARANCE: + case ADVERTISING_INTERVAL: + case MANUFACTURER_SPECIFIC_DATA: { + // current field length, with the type subtracted + uint8_t dataLength = field[0] - 1; + + // new data has same length, do in-order replacement + if (len == dataLength) { + for (uint8_t idx = 0; idx < dataLength; idx++) { + field[2 + idx] = payload[idx]; + } + } else { + // check if data fits + if ((_payloadLen - dataLength + len) <= GAP_ADVERTISING_DATA_MAX_PAYLOAD) { + + // remove old field + while ((field + dataLength + 2) < &_payload[_payloadLen]) { + *field = field[dataLength + 2]; + field++; + } + + // reduce length + _payloadLen -= dataLength + 2; + + // add new field + result = appendField(advDataType, payload, len); + } + } - /* Make sure we don't exceed the 31 byte payload limit */ - if (_payloadLen + len + 2 > GAP_ADVERTISING_DATA_MAX_PAYLOAD) { - return BLE_ERROR_BUFFER_OVERFLOW; + break; + } + // These fields will have the new data appended if there is sufficient space + case INCOMPLETE_LIST_16BIT_SERVICE_IDS: + case COMPLETE_LIST_16BIT_SERVICE_IDS: + case INCOMPLETE_LIST_32BIT_SERVICE_IDS: + case COMPLETE_LIST_32BIT_SERVICE_IDS: + case INCOMPLETE_LIST_128BIT_SERVICE_IDS: + case COMPLETE_LIST_128BIT_SERVICE_IDS: + case LIST_128BIT_SOLICITATION_IDS: { + // check if data fits + if ((_payloadLen + len) <= GAP_ADVERTISING_DATA_MAX_PAYLOAD) { + // make room for new field by moving the remainder of the + // advertisement payload "to the right" starting after the + // TYPE field. + uint8_t* end = &_payload[_payloadLen]; + + while (&field[1] < end) { + end[len] = *end; + end--; + } + + // insert new data + for (uint8_t idx = 0; idx < len; idx++) { + field[2 + idx] = payload[idx]; + } + + // increment lengths + field[0] += len; + _payloadLen += len; + + result = BLE_ERROR_NONE; + } + + break; + } + // Field exists but updating it is not supported. Abort operation. + default: + result = BLE_ERROR_NOT_IMPLEMENTED; + break; + } + } else { + // field doesn't exists, insert new + result = appendField(advDataType, payload, len); } - /* Field length */ - memset(&_payload[_payloadLen], len + 1, 1); - _payloadLen++; - - /* Field ID */ - memset(&_payload[_payloadLen], (uint8_t)advDataType, 1); - _payloadLen++; - - /* Payload */ - memcpy(&_payload[_payloadLen], payload, len); - _payloadLen += len; - - return BLE_ERROR_NONE; + return result; } /** @@ -253,7 +325,7 @@ /* A local struct to describe an ADV field. This definition comes from the Bluetooth Core Spec. (v4.2) Part C, Section 11. */ struct ADVField_t { - uint8_t len; /* Describes the length (in bytes) of the following 'type' and 'bytes'. */ + uint8_t len; /* Describes the length (in bytes) of the following type and bytes. */ uint8_t type; /* Should have the same representation of DataType_t (above). */ uint8_t bytes[0]; /* A placeholder for variable length data. */ }; @@ -262,23 +334,23 @@ uint8_t byteIndex = 0; while (byteIndex < _payloadLen) { ADVField_t *currentADV = (ADVField_t *)&_payload[byteIndex]; - if ((currentADV->len == (len + 1)) && /* incoming 'len' only describes the payload, whereas ADV->len describes 'type + payload' */ + if ((currentADV->len == (len + 1)) && /* Incoming len only describes the payload, whereas ADV->len describes [type + payload]. */ (currentADV->type == advDataType)) { memcpy(currentADV->bytes, payload, len); return BLE_ERROR_NONE; } - byteIndex += (currentADV->len + 1); /* advance by len+1; '+1' is needed to span the len field itself. */ + byteIndex += (currentADV->len + 1); /* Advance by len+1; '+1' is needed to span the len field itself. */ } return BLE_ERROR_UNSPECIFIED; } /** - * Helper function to add APPEARANCE data to the advertising payload + * Helper function to add APPEARANCE data to the advertising payload. * * @param appearance - * The APPEARANCE value to add + * The APPEARANCE value to add. * * @return BLE_ERROR_BUFFER_OVERFLOW if the specified data would cause the * advertising buffer to overflow, else BLE_ERROR_NONE. @@ -306,18 +378,18 @@ } /** - * Helper function to add TX_POWER_LEVEL data to the advertising payload + * Helper function to add TX_POWER_LEVEL data to the advertising payload. * * @return BLE_ERROR_BUFFER_OVERFLOW if the specified data would cause the * advertising buffer to overflow, else BLE_ERROR_NONE. */ ble_error_t addTxPower(int8_t txPower) { - /* ToDo: Basic error checking to make sure txPower is in range */ + /* To Do: Basic error checking to make sure txPower is in range. */ return addData(GapAdvertisingData::TX_POWER_LEVEL, (uint8_t *)&txPower, 1); } /** - * Clears the payload and resets the payload length counter + * Clears the payload and resets the payload length counter. */ void clear(void) { memset(&_payload, 0, GAP_ADVERTISING_DATA_MAX_PAYLOAD); @@ -325,27 +397,83 @@ } /** - * Returns a pointer to the the current payload + * Returns a pointer to the current payload. */ const uint8_t *getPayload(void) const { return _payload; } /** - * Returns the current payload length (0..31 bytes) + * Returns the current payload length (0..31 bytes). */ uint8_t getPayloadLen(void) const { return _payloadLen; } /** - * Returns the 16-bit appearance value for this device + * Returns the 16-bit appearance value for this device. */ uint16_t getAppearance(void) const { return (uint16_t)_appearance; } + /** + * Search advertisement data for field. + * Returns pointer to the first element in the field if found, NULL otherwise. + * Where the first element is the length of the field. + */ + const uint8_t* findField(DataType_t type) const { + return findField(type); + } + private: + /** + * Append advertising data based on the specified AD type (see DataType) + */ + ble_error_t appendField(DataType advDataType, const uint8_t *payload, uint8_t len) + { + /* Make sure we don't exceed the 31 byte payload limit */ + if (_payloadLen + len + 2 > GAP_ADVERTISING_DATA_MAX_PAYLOAD) { + return BLE_ERROR_BUFFER_OVERFLOW; + } + + /* Field length. */ + memset(&_payload[_payloadLen], len + 1, 1); + _payloadLen++; + + /* Field ID. */ + memset(&_payload[_payloadLen], (uint8_t)advDataType, 1); + _payloadLen++; + + /* Payload. */ + memcpy(&_payload[_payloadLen], payload, len); + _payloadLen += len; + + return BLE_ERROR_NONE; + } + + /** + * Search advertisement data for field. + * Returns pointer to the first element in the field if found, NULL otherwise. + * Where the first element is the length of the field. + */ + uint8_t* findField(DataType_t type) { + // scan through advertisement data + for (uint8_t idx = 0; idx < _payloadLen; ) { + uint8_t fieldType = _payload[idx + 1]; + + if (fieldType == type) { + return &_payload[idx]; + } + + // advance to next field + idx += _payload[idx] + 1; + } + + // field not found + return NULL; + } + uint8_t _payload[GAP_ADVERTISING_DATA_MAX_PAYLOAD]; uint8_t _payloadLen; uint16_t _appearance;
--- a/ble/GapAdvertisingParams.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/GapAdvertisingParams.h Thu Nov 26 12:52:06 2015 +0000 @@ -20,7 +20,7 @@ /** * This class provides a wrapper for the core advertising parameters, * including the advertising type (Connectable Undirected, - * Non Connectable Undirected, etc.), as well as the advertising and + * Non Connectable Undirected and so on), as well as the advertising and * timeout intervals. */ class GapAdvertisingParams { @@ -32,7 +32,7 @@ /*! * Encapsulates the peripheral advertising modes, which determine how - * the device appears to other central devices in hearing range + * the device appears to other central devices in hearing range. */ enum AdvertisingType_t { ADV_CONNECTABLE_UNDIRECTED, /**< Vol 3, Part C, Section 9.3.4 and Vol 6, Part B, Section 2.3.1.1 */ @@ -40,18 +40,18 @@ ADV_SCANNABLE_UNDIRECTED, /**< Include support for Scan Response payloads, see Vol 6, Part B, Section 2.3.1.4 */ ADV_NON_CONNECTABLE_UNDIRECTED /**< Vol 3, Part C, Section 9.3.2 and Vol 6, Part B, Section 2.3.1.3 */ }; - typedef enum AdvertisingType_t AdvertisingType; /* deprecated type alias. */ + typedef enum AdvertisingType_t AdvertisingType; /* Deprecated type alias. */ public: GapAdvertisingParams(AdvertisingType_t advType = ADV_CONNECTABLE_UNDIRECTED, uint16_t interval = GAP_ADV_PARAMS_INTERVAL_MIN_NONCON, uint16_t timeout = 0) : _advType(advType), _interval(interval), _timeout(timeout) { - /* Interval checks */ + /* Interval checks. */ if (_advType == ADV_CONNECTABLE_DIRECTED) { - /* Interval must be 0 in directed connectable mode */ + /* Interval must be 0 in directed connectable mode. */ _interval = 0; } else if (_advType == ADV_NON_CONNECTABLE_UNDIRECTED) { - /* Min interval is slightly larger than in other modes */ + /* Min interval is slightly larger than in other modes. */ if (_interval < GAP_ADV_PARAMS_INTERVAL_MIN_NONCON) { _interval = GAP_ADV_PARAMS_INTERVAL_MIN_NONCON; } @@ -59,7 +59,7 @@ _interval = GAP_ADV_PARAMS_INTERVAL_MAX; } } else { - /* Stay within interval limits */ + /* Stay within interval limits. */ if (_interval < GAP_ADV_PARAMS_INTERVAL_MIN) { _interval = GAP_ADV_PARAMS_INTERVAL_MIN; } @@ -68,9 +68,9 @@ } } - /* Timeout checks */ + /* Timeout checks. */ if (timeout) { - /* Stay within timeout limits */ + /* Stay within timeout limits. */ if (_timeout > GAP_ADV_PARAMS_TIMEOUT_MAX) { _timeout = GAP_ADV_PARAMS_TIMEOUT_MAX; } @@ -90,14 +90,14 @@ } /** - * @return the advertisement interval (in milliseconds) + * @return the advertisement interval (in milliseconds). */ uint16_t getInterval(void) const { return ADVERTISEMENT_DURATION_UNITS_TO_MS(_interval); } /** - * @return the advertisement interval in units advertisement duration units--i.e. 0.625ms units. + * @return the advertisement interval in advertisement duration units (0.625ms units). */ uint16_t getIntervalInADVUnits(void) const { return _interval; @@ -113,8 +113,8 @@ private: AdvertisingType_t _advType; - uint16_t _interval; /* in ADV duration units (i.e. 0.625ms) */ - uint16_t _timeout; /* in seconds */ + uint16_t _interval; /* In ADV duration units (i.e. 0.625ms). */ + uint16_t _timeout; /* In seconds. */ }; #endif // ifndef __GAP_ADVERTISING_PARAMS_H__ \ No newline at end of file
--- a/ble/GapEvents.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/GapEvents.h Thu Nov 26 12:52:06 2015 +0000 @@ -33,13 +33,13 @@ /*! \brief Identifies GAP events generated by the radio HW when an event - callback occurs + callback occurs. */ /******************************************************************/ typedef enum gapEvent_e { - GAP_EVENT_TIMEOUT = 1, /**< Advertising timed out before a connection was established */ - GAP_EVENT_CONNECTED = 2, /**< A connection was established with a central device */ - GAP_EVENT_DISCONNECTED = 3 /**< A connection was closed or lost with a central device */ + GAP_EVENT_TIMEOUT = 1, /**< Advertising timed out before a connection could be established. */ + GAP_EVENT_CONNECTED = 2, /**< A connection was established with a central device. */ + GAP_EVENT_DISCONNECTED = 3 /**< A connection was closed or lost with a central device. */ } gapEvent_t; };
--- a/ble/GapScanningParams.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/GapScanningParams.h Thu Nov 26 12:52:06 2015 +0000 @@ -19,10 +19,10 @@ class GapScanningParams { public: - static const unsigned SCAN_INTERVAL_MIN = 0x0004; /**< Minimum Scan interval in 625 us units, i.e. 2.5 ms. */ - static const unsigned SCAN_INTERVAL_MAX = 0x4000; /**< Maximum Scan interval in 625 us units, i.e. 10.24 s. */ - static const unsigned SCAN_WINDOW_MIN = 0x0004; /**< Minimum Scan window in 625 us units, i.e. 2.5 ms. */ - static const unsigned SCAN_WINDOW_MAX = 0x4000; /**< Maximum Scan window in 625 us units, i.e. 10.24 s. */ + static const unsigned SCAN_INTERVAL_MIN = 0x0004; /**< Minimum Scan interval in 625us units - 2.5ms. */ + static const unsigned SCAN_INTERVAL_MAX = 0x4000; /**< Maximum Scan interval in 625us units - 10.24s. */ + static const unsigned SCAN_WINDOW_MIN = 0x0004; /**< Minimum Scan window in 625us units - 2.5ms. */ + static const unsigned SCAN_WINDOW_MAX = 0x4000; /**< Maximum Scan window in 625us units - 10.24s. */ static const unsigned SCAN_TIMEOUT_MIN = 0x0001; /**< Minimum Scan timeout in seconds. */ static const unsigned SCAN_TIMEOUT_MAX = 0xFFFF; /**< Maximum Scan timeout in seconds. */ @@ -46,7 +46,7 @@ void setActiveScanning(bool activeScanning); public: - /* @Note: The following return durations in units of 0.625 ms */ + /* @Note: The following return durations in units of 0.625ms */ uint16_t getInterval(void) const {return _interval;} uint16_t getWindow(void) const {return _window; } @@ -54,13 +54,13 @@ bool getActiveScanning(void) const {return _activeScanning;} private: - uint16_t _interval; /**< Scan interval in units of 625us (between 2.5ms to 10.24s). */ - uint16_t _window; /**< Scan window in units of 625us (between 2.5ms to 10.24s). */ - uint16_t _timeout; /**< Scan timeout between 0x0001 and 0xFFFF in seconds, 0x0000 disables timeout. */ - bool _activeScanning; /**< obtain not only the advertising data from the peer device, but also their scanResponse if possible. */ + uint16_t _interval; /**< Scan interval in units of 625us (between 2.5ms and 10.24s). */ + uint16_t _window; /**< Scan window in units of 625us (between 2.5ms and 10.24s). */ + uint16_t _timeout; /**< Scan timeout between 0x0001 and 0xFFFF in seconds; 0x0000 disables timeout. */ + bool _activeScanning; /**< Obtain the peer device's advertising data and (if possible) scanResponse. */ private: - /* disallow copy constructor */ + /* Disallow copy constructor. */ GapScanningParams(const GapScanningParams &); GapScanningParams& operator =(const GapScanningParams &in); };
--- a/ble/GattAttribute.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/GattAttribute.h Thu Nov 26 12:52:06 2015 +0000 @@ -27,16 +27,16 @@ public: /** * @brief Creates a new GattAttribute using the specified - * UUID, value length, and inital value + * UUID, value length, and inital value. * * @param[in] uuid - * The UUID to use for this attribute + * The UUID to use for this attribute. * @param[in] valuePtr * The memory holding the initial value. * @param[in] initialLen - * The min length in bytes of this attribute's value + * The min length in bytes of this attribute's value. * @param[in] maxLen - * The max length in bytes of this attribute's value + * The max length in bytes of this attribute's value. * * @section EXAMPLE * @@ -49,7 +49,7 @@ */ GattAttribute(const UUID &uuid, uint8_t *valuePtr = NULL, uint16_t initialLen = 0, uint16_t maxLen = 0) : _uuid(uuid), _valuePtr(valuePtr), _initialLen(initialLen), _lenMax(maxLen), _len(initialLen), _handle() { - /* empty */ + /* Empty */ } public: @@ -63,15 +63,15 @@ uint8_t *getValuePtr(void) {return _valuePtr; } private: - UUID _uuid; /* Characteristic UUID */ + UUID _uuid; /* Characteristic UUID. */ uint8_t *_valuePtr; - uint16_t _initialLen; /* Initial length of the value */ - uint16_t _lenMax; /* Maximum length of the value */ - uint16_t _len; /* Current length of the value */ + uint16_t _initialLen; /* Initial length of the value. */ + uint16_t _lenMax; /* Maximum length of the value. */ + uint16_t _len; /* Current length of the value. */ Handle_t _handle; private: - /* disallow copy and assignment */ + /* Disallow copy and assignment. */ GattAttribute(const GattAttribute &); GattAttribute& operator=(const GattAttribute &); };
--- a/ble/GattCallbackParamTypes.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/GattCallbackParamTypes.h Thu Nov 26 12:52:06 2015 +0000 @@ -19,21 +19,21 @@ struct GattWriteCallbackParams { enum WriteOp_t { - OP_INVALID = 0x00, /**< Invalid Operation. */ - OP_WRITE_REQ = 0x01, /**< Write Request. */ - OP_WRITE_CMD = 0x02, /**< Write Command. */ - OP_SIGN_WRITE_CMD = 0x03, /**< Signed Write Command. */ - OP_PREP_WRITE_REQ = 0x04, /**< Prepare Write Request. */ - OP_EXEC_WRITE_REQ_CANCEL = 0x05, /**< Execute Write Request: Cancel all prepared writes. */ - OP_EXEC_WRITE_REQ_NOW = 0x06, /**< Execute Write Request: Immediately execute all prepared writes. */ + OP_INVALID = 0x00, /**< Invalid operation. */ + OP_WRITE_REQ = 0x01, /**< Write request. */ + OP_WRITE_CMD = 0x02, /**< Write command. */ + OP_SIGN_WRITE_CMD = 0x03, /**< Signed write command. */ + OP_PREP_WRITE_REQ = 0x04, /**< Prepare write request. */ + OP_EXEC_WRITE_REQ_CANCEL = 0x05, /**< Execute write request: cancel all prepared writes. */ + OP_EXEC_WRITE_REQ_NOW = 0x06, /**< Execute write request: immediately execute all prepared writes. */ }; Gap::Handle_t connHandle; GattAttribute::Handle_t handle; - WriteOp_t writeOp; /**< Type of write operation, */ + WriteOp_t writeOp; /**< Type of write operation. */ uint16_t offset; /**< Offset for the write operation. */ uint16_t len; - const uint8_t *data; /* @note: data might not persist beyond the callback; make a local copy if needed. */ + const uint8_t *data; /* @note: Data might not persist beyond the callback; make a local copy if needed. */ }; struct GattReadCallbackParams { @@ -41,19 +41,19 @@ GattAttribute::Handle_t handle; uint16_t offset; /**< Offset for the read operation. */ uint16_t len; - const uint8_t *data; /* @note: data might not persist beyond the callback; make a local copy if needed. */ + const uint8_t *data; /* @note: Data might not persist beyond the callback; make a local copy if needed. */ }; enum GattAuthCallbackReply_t { AUTH_CALLBACK_REPLY_SUCCESS = 0x00, /**< Success. */ - AUTH_CALLBACK_REPLY_ATTERR_INVALID_HANDLE = 0x0101, /**< ATT Error: Invalid Attribute Handle. */ + AUTH_CALLBACK_REPLY_ATTERR_INVALID_HANDLE = 0x0101, /**< ATT Error: Invalid attribute handle. */ AUTH_CALLBACK_REPLY_ATTERR_READ_NOT_PERMITTED = 0x0102, /**< ATT Error: Read not permitted. */ AUTH_CALLBACK_REPLY_ATTERR_WRITE_NOT_PERMITTED = 0x0103, /**< ATT Error: Write not permitted. */ AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHENTICATION = 0x0105, /**< ATT Error: Authenticated link required. */ - AUTH_CALLBACK_REPLY_ATTERR_INVALID_OFFSET = 0x0107, /**< ATT Error: Offset specified was past the end of the attribute. */ - AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHORIZATION = 0x0108, /**< ATT Error: Used in ATT as Insufficient Authorisation. */ - AUTH_CALLBACK_REPLY_ATTERR_PREPARE_QUEUE_FULL = 0x0109, /**< ATT Error: Used in ATT as Prepare Queue Full. */ - AUTH_CALLBACK_REPLY_ATTERR_ATTRIBUTE_NOT_FOUND = 0x010A, /**< ATT Error: Used in ATT as Attribute not found. */ + AUTH_CALLBACK_REPLY_ATTERR_INVALID_OFFSET = 0x0107, /**< ATT Error: The specified offset was past the end of the attribute. */ + AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHORIZATION = 0x0108, /**< ATT Error: Used in ATT as "insufficient authorization". */ + AUTH_CALLBACK_REPLY_ATTERR_PREPARE_QUEUE_FULL = 0x0109, /**< ATT Error: Used in ATT as "prepare queue full". */ + AUTH_CALLBACK_REPLY_ATTERR_ATTRIBUTE_NOT_FOUND = 0x010A, /**< ATT Error: Used in ATT as "attribute not found". */ AUTH_CALLBACK_REPLY_ATTERR_ATTRIBUTE_NOT_LONG = 0x010B, /**< ATT Error: Attribute cannot be read or written using read/write blob requests. */ AUTH_CALLBACK_REPLY_ATTERR_INVALID_ATT_VAL_LENGTH = 0x010D, /**< ATT Error: Invalid value size. */ AUTH_CALLBACK_REPLY_ATTERR_INSUF_RESOURCES = 0x0111, /**< ATT Error: Encrypted link required. */ @@ -65,9 +65,9 @@ uint16_t offset; /**< Offset for the write operation. */ uint16_t len; /**< Length of the incoming data. */ const uint8_t *data; /**< Incoming data, variable length. */ - GattAuthCallbackReply_t authorizationReply; /* This is the out parameter which needs to be set to - * AUTH_CALLBACK_REPLY_SUCCESS by the callback if the - * request is to proceed. */ + GattAuthCallbackReply_t authorizationReply; /* This is the out parameter that the callback + * needs to set to AUTH_CALLBACK_REPLY_SUCCESS + * for the request to proceed. */ }; struct GattReadAuthCallbackParams { @@ -76,9 +76,9 @@ uint16_t offset; /**< Offset for the read operation. */ uint16_t len; /**< Optional: new length of the outgoing data. */ uint8_t *data; /**< Optional: new outgoing data. Leave at NULL if data is unchanged. */ - GattAuthCallbackReply_t authorizationReply; /* This is the out parameter which needs to be set to - * AUTH_CALLBACK_REPLY_SUCCESS by the callback if the - * request is to proceed. */ + GattAuthCallbackReply_t authorizationReply; /* This is the out parameter that the callback + * needs to set to AUTH_CALLBACK_REPLY_SUCCESS + * for the request to proceed. */ }; /* For encapsulating handle-value update events (notifications or indications) generated at the remote server. */
--- a/ble/GattCharacteristic.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/GattCharacteristic.h Thu Nov 26 12:52:06 2015 +0000 @@ -109,24 +109,24 @@ */ /**************************************************************************/ enum { - BLE_GATT_UNIT_NONE = 0x2700, /**< No specified unit type */ - BLE_GATT_UNIT_LENGTH_METRE = 0x2701, /**< Length, Metre */ - BLE_GATT_UNIT_MASS_KILOGRAM = 0x2702, /**< Mass, Kilogram */ - BLE_GATT_UNIT_TIME_SECOND = 0x2703, /**< Time, Second */ - BLE_GATT_UNIT_ELECTRIC_CURRENT_AMPERE = 0x2704, /**< Electric Current, Ampere */ - BLE_GATT_UNIT_THERMODYNAMIC_TEMPERATURE_KELVIN = 0x2705, /**< Thermodynamic Temperature, Kelvin */ - BLE_GATT_UNIT_AMOUNT_OF_SUBSTANCE_MOLE = 0x2706, /**< Amount of Substance, Mole */ - BLE_GATT_UNIT_LUMINOUS_INTENSITY_CANDELA = 0x2707, /**< Luminous Intensity, Candela */ - BLE_GATT_UNIT_AREA_SQUARE_METRES = 0x2710, /**< Area, Square Metres */ - BLE_GATT_UNIT_VOLUME_CUBIC_METRES = 0x2711, /**< Volume, Cubic Metres*/ - BLE_GATT_UNIT_VELOCITY_METRES_PER_SECOND = 0x2712, /**< Velocity, Metres per Second*/ - BLE_GATT_UNIT_ACCELERATION_METRES_PER_SECOND_SQUARED = 0x2713, /**< Acceleration, Metres per Second Squared */ - BLE_GATT_UNIT_WAVENUMBER_RECIPROCAL_METRE = 0x2714, /**< Wave Number Reciprocal, Metre */ - BLE_GATT_UNIT_DENSITY_KILOGRAM_PER_CUBIC_METRE = 0x2715, /**< Density, Kilogram per Cubic Metre */ + BLE_GATT_UNIT_NONE = 0x2700, /**< No specified unit type. */ + BLE_GATT_UNIT_LENGTH_METRE = 0x2701, /**< Length, metre. */ + BLE_GATT_UNIT_MASS_KILOGRAM = 0x2702, /**< Mass, kilogram. */ + BLE_GATT_UNIT_TIME_SECOND = 0x2703, /**< Time, second. */ + BLE_GATT_UNIT_ELECTRIC_CURRENT_AMPERE = 0x2704, /**< Electric current, ampere. */ + BLE_GATT_UNIT_THERMODYNAMIC_TEMPERATURE_KELVIN = 0x2705, /**< Thermodynamic temperature, kelvin. */ + BLE_GATT_UNIT_AMOUNT_OF_SUBSTANCE_MOLE = 0x2706, /**< Amount of substance, mole. */ + BLE_GATT_UNIT_LUMINOUS_INTENSITY_CANDELA = 0x2707, /**< Luminous intensity, candela. */ + BLE_GATT_UNIT_AREA_SQUARE_METRES = 0x2710, /**< Area, square metres. */ + BLE_GATT_UNIT_VOLUME_CUBIC_METRES = 0x2711, /**< Volume, cubic metres. */ + BLE_GATT_UNIT_VELOCITY_METRES_PER_SECOND = 0x2712, /**< Velocity, metres per second. */ + BLE_GATT_UNIT_ACCELERATION_METRES_PER_SECOND_SQUARED = 0x2713, /**< Acceleration, metres per second squared. */ + BLE_GATT_UNIT_WAVENUMBER_RECIPROCAL_METRE = 0x2714, /**< Wave number reciprocal, metre. */ + BLE_GATT_UNIT_DENSITY_KILOGRAM_PER_CUBIC_METRE = 0x2715, /**< Density, kilogram per cubic metre. */ BLE_GATT_UNIT_SURFACE_DENSITY_KILOGRAM_PER_SQUARE_METRE = 0x2716, /**< */ BLE_GATT_UNIT_SPECIFIC_VOLUME_CUBIC_METRE_PER_KILOGRAM = 0x2717, /**< */ BLE_GATT_UNIT_CURRENT_DENSITY_AMPERE_PER_SQUARE_METRE = 0x2718, /**< */ - BLE_GATT_UNIT_MAGNETIC_FIELD_STRENGTH_AMPERE_PER_METRE = 0x2719, /**< Magnetic Field Strength, Ampere per Metre */ + BLE_GATT_UNIT_MAGNETIC_FIELD_STRENGTH_AMPERE_PER_METRE = 0x2719, /**< Magnetic field strength, ampere per metre. */ BLE_GATT_UNIT_AMOUNT_CONCENTRATION_MOLE_PER_CUBIC_METRE = 0x271A, /**< */ BLE_GATT_UNIT_MASS_CONCENTRATION_KILOGRAM_PER_CUBIC_METRE = 0x271B, /**< */ BLE_GATT_UNIT_LUMINANCE_CANDELA_PER_SQUARE_METRE = 0x271C, /**< */ @@ -134,13 +134,13 @@ BLE_GATT_UNIT_RELATIVE_PERMEABILITY = 0x271E, /**< */ BLE_GATT_UNIT_PLANE_ANGLE_RADIAN = 0x2720, /**< */ BLE_GATT_UNIT_SOLID_ANGLE_STERADIAN = 0x2721, /**< */ - BLE_GATT_UNIT_FREQUENCY_HERTZ = 0x2722, /**< Frequency, Hertz */ - BLE_GATT_UNIT_FORCE_NEWTON = 0x2723, /**< Force, Newton */ - BLE_GATT_UNIT_PRESSURE_PASCAL = 0x2724, /**< Pressure, Pascal */ - BLE_GATT_UNIT_ENERGY_JOULE = 0x2725, /**< Energy, Joule */ - BLE_GATT_UNIT_POWER_WATT = 0x2726, /**< Power, Watt */ - BLE_GATT_UNIT_ELECTRIC_CHARGE_COULOMB = 0x2727, /**< Electrical Charge, Coulomb */ - BLE_GATT_UNIT_ELECTRIC_POTENTIAL_DIFFERENCE_VOLT = 0x2728, /**< Electrical Potential Difference, Voltage */ + BLE_GATT_UNIT_FREQUENCY_HERTZ = 0x2722, /**< Frequency, hertz. */ + BLE_GATT_UNIT_FORCE_NEWTON = 0x2723, /**< Force, newton. */ + BLE_GATT_UNIT_PRESSURE_PASCAL = 0x2724, /**< Pressure, pascal. */ + BLE_GATT_UNIT_ENERGY_JOULE = 0x2725, /**< Energy, joule. */ + BLE_GATT_UNIT_POWER_WATT = 0x2726, /**< Power, watt. */ + BLE_GATT_UNIT_ELECTRIC_CHARGE_COULOMB = 0x2727, /**< Electrical charge, coulomb. */ + BLE_GATT_UNIT_ELECTRIC_POTENTIAL_DIFFERENCE_VOLT = 0x2728, /**< Electrical potential difference, voltage. */ BLE_GATT_UNIT_CAPACITANCE_FARAD = 0x2729, /**< */ BLE_GATT_UNIT_ELECTRIC_RESISTANCE_OHM = 0x272A, /**< */ BLE_GATT_UNIT_ELECTRIC_CONDUCTANCE_SIEMENS = 0x272B, /**< */ @@ -178,58 +178,58 @@ BLE_GATT_UNIT_RADIANT_INTENSITY_WATT_PER_STERADIAN = 0x2755, /**< */ BLE_GATT_UNIT_RADIANCE_WATT_PER_SQUARE_METRE_STERADIAN = 0x2756, /**< */ BLE_GATT_UNIT_CATALYTIC_ACTIVITY_CONCENTRATION_KATAL_PER_CUBIC_METRE = 0x2757, /**< */ - BLE_GATT_UNIT_TIME_MINUTE = 0x2760, /**< Time, Minute */ - BLE_GATT_UNIT_TIME_HOUR = 0x2761, /**< Time, Hour */ - BLE_GATT_UNIT_TIME_DAY = 0x2762, /**< Time, Day */ + BLE_GATT_UNIT_TIME_MINUTE = 0x2760, /**< Time, minute. */ + BLE_GATT_UNIT_TIME_HOUR = 0x2761, /**< Time, hour. */ + BLE_GATT_UNIT_TIME_DAY = 0x2762, /**< Time, day. */ BLE_GATT_UNIT_PLANE_ANGLE_DEGREE = 0x2763, /**< */ BLE_GATT_UNIT_PLANE_ANGLE_MINUTE = 0x2764, /**< */ BLE_GATT_UNIT_PLANE_ANGLE_SECOND = 0x2765, /**< */ BLE_GATT_UNIT_AREA_HECTARE = 0x2766, /**< */ BLE_GATT_UNIT_VOLUME_LITRE = 0x2767, /**< */ BLE_GATT_UNIT_MASS_TONNE = 0x2768, /**< */ - BLE_GATT_UNIT_PRESSURE_BAR = 0x2780, /**< Pressure, Bar */ - BLE_GATT_UNIT_PRESSURE_MILLIMETRE_OF_MERCURY = 0x2781, /**< Pressure, Millimetre of Mercury */ + BLE_GATT_UNIT_PRESSURE_BAR = 0x2780, /**< Pressure, bar. */ + BLE_GATT_UNIT_PRESSURE_MILLIMETRE_OF_MERCURY = 0x2781, /**< Pressure, millimetre of mercury. */ BLE_GATT_UNIT_LENGTH_ANGSTROM = 0x2782, /**< */ BLE_GATT_UNIT_LENGTH_NAUTICAL_MILE = 0x2783, /**< */ BLE_GATT_UNIT_AREA_BARN = 0x2784, /**< */ BLE_GATT_UNIT_VELOCITY_KNOT = 0x2785, /**< */ BLE_GATT_UNIT_LOGARITHMIC_RADIO_QUANTITY_NEPER = 0x2786, /**< */ BLE_GATT_UNIT_LOGARITHMIC_RADIO_QUANTITY_BEL = 0x2787, /**< */ - BLE_GATT_UNIT_LENGTH_YARD = 0x27A0, /**< Length, Yard */ - BLE_GATT_UNIT_LENGTH_PARSEC = 0x27A1, /**< Length, Parsec */ - BLE_GATT_UNIT_LENGTH_INCH = 0x27A2, /**< Length, Inch */ - BLE_GATT_UNIT_LENGTH_FOOT = 0x27A3, /**< Length, Foot */ - BLE_GATT_UNIT_LENGTH_MILE = 0x27A4, /**< Length, Mile */ + BLE_GATT_UNIT_LENGTH_YARD = 0x27A0, /**< Length, yard. */ + BLE_GATT_UNIT_LENGTH_PARSEC = 0x27A1, /**< Length, parsec. */ + BLE_GATT_UNIT_LENGTH_INCH = 0x27A2, /**< Length, inch. */ + BLE_GATT_UNIT_LENGTH_FOOT = 0x27A3, /**< Length, foot. */ + BLE_GATT_UNIT_LENGTH_MILE = 0x27A4, /**< Length, mile. */ BLE_GATT_UNIT_PRESSURE_POUND_FORCE_PER_SQUARE_INCH = 0x27A5, /**< */ - BLE_GATT_UNIT_VELOCITY_KILOMETRE_PER_HOUR = 0x27A6, /**< Velocity, Kilometre per Hour */ - BLE_GATT_UNIT_VELOCITY_MILE_PER_HOUR = 0x27A7, /**< Velocity, Mile per Hour */ - BLE_GATT_UNIT_ANGULAR_VELOCITY_REVOLUTION_PER_MINUTE = 0x27A8, /**< Angular Velocity, Revolution per Minute */ - BLE_GATT_UNIT_ENERGY_GRAM_CALORIE = 0x27A9, /**< Energy, Gram Calorie */ - BLE_GATT_UNIT_ENERGY_KILOGRAM_CALORIE = 0x27AA, /**< Energy, Kilogram Calorie */ - BLE_GATT_UNIT_ENERGY_KILOWATT_HOUR = 0x27AB, /**< Energy, Killowatt Hour */ + BLE_GATT_UNIT_VELOCITY_KILOMETRE_PER_HOUR = 0x27A6, /**< Velocity, kilometre per hour. */ + BLE_GATT_UNIT_VELOCITY_MILE_PER_HOUR = 0x27A7, /**< Velocity, mile per hour. */ + BLE_GATT_UNIT_ANGULAR_VELOCITY_REVOLUTION_PER_MINUTE = 0x27A8, /**< Angular Velocity, revolution per minute. */ + BLE_GATT_UNIT_ENERGY_GRAM_CALORIE = 0x27A9, /**< Energy, gram calorie. */ + BLE_GATT_UNIT_ENERGY_KILOGRAM_CALORIE = 0x27AA, /**< Energy, kilogram calorie. */ + BLE_GATT_UNIT_ENERGY_KILOWATT_HOUR = 0x27AB, /**< Energy, killowatt hour. */ BLE_GATT_UNIT_THERMODYNAMIC_TEMPERATURE_DEGREE_FAHRENHEIT = 0x27AC, /**< */ - BLE_GATT_UNIT_PERCENTAGE = 0x27AD, /**< Percentage */ + BLE_GATT_UNIT_PERCENTAGE = 0x27AD, /**< Percentage. */ BLE_GATT_UNIT_PER_MILLE = 0x27AE, /**< */ BLE_GATT_UNIT_PERIOD_BEATS_PER_MINUTE = 0x27AF, /**< */ BLE_GATT_UNIT_ELECTRIC_CHARGE_AMPERE_HOURS = 0x27B0, /**< */ BLE_GATT_UNIT_MASS_DENSITY_MILLIGRAM_PER_DECILITRE = 0x27B1, /**< */ BLE_GATT_UNIT_MASS_DENSITY_MILLIMOLE_PER_LITRE = 0x27B2, /**< */ - BLE_GATT_UNIT_TIME_YEAR = 0x27B3, /**< Time, Year */ - BLE_GATT_UNIT_TIME_MONTH = 0x27B4, /**< Time, Month */ + BLE_GATT_UNIT_TIME_YEAR = 0x27B3, /**< Time, year. */ + BLE_GATT_UNIT_TIME_MONTH = 0x27B4, /**< Time, month. */ BLE_GATT_UNIT_CONCENTRATION_COUNT_PER_CUBIC_METRE = 0x27B5, /**< */ BLE_GATT_UNIT_IRRADIANCE_WATT_PER_SQUARE_METRE = 0x27B6 /**< */ }; /**************************************************************************/ /*! - \brief Standard GATT number types + \brief Standard GATT number types. \note See Bluetooth Specification 4.0 (Vol. 3), Part G, Section 3.3.3.5.2 \note See http://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorViewer.aspx?u=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml */ /**************************************************************************/ enum { - BLE_GATT_FORMAT_RFU = 0x00, /**< Reserved For Future Use. */ + BLE_GATT_FORMAT_RFU = 0x00, /**< Reserved for future use. */ BLE_GATT_FORMAT_BOOLEAN = 0x01, /**< Boolean. */ BLE_GATT_FORMAT_2BIT = 0x02, /**< Unsigned 2-bit integer. */ BLE_GATT_FORMAT_NIBBLE = 0x03, /**< Unsigned 4-bit integer. */ @@ -261,7 +261,7 @@ /**************************************************************************/ /*! - \brief Standard GATT characteristic properties + \brief Standard GATT characteristic properties. \note See Bluetooth Specification 4.0 (Vol. 3), Part G, Section 3.3.1.1 and Section 3.3.3.1 for Extended Properties @@ -269,14 +269,14 @@ /**************************************************************************/ enum Properties_t { BLE_GATT_CHAR_PROPERTIES_NONE = 0x00, - BLE_GATT_CHAR_PROPERTIES_BROADCAST = 0x01, /**< Permits broadcasts of the Characteristic Value using Server Characteristic Configuration Descriptor. */ - BLE_GATT_CHAR_PROPERTIES_READ = 0x02, /**< Permits reads of the Characteristic Value. */ - BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE = 0x04, /**< Permits writes of the Characteristic Value without response. */ - BLE_GATT_CHAR_PROPERTIES_WRITE = 0x08, /**< Permits writes of the Characteristic Value with response. */ - BLE_GATT_CHAR_PROPERTIES_NOTIFY = 0x10, /**< Permits notifications of a Characteristic Value without acknowledgment. */ - BLE_GATT_CHAR_PROPERTIES_INDICATE = 0x20, /**< Permits indications of a Characteristic Value with acknowledgment. */ - BLE_GATT_CHAR_PROPERTIES_AUTHENTICATED_SIGNED_WRITES = 0x40, /**< Permits signed writes to the Characteristic Value. */ - BLE_GATT_CHAR_PROPERTIES_EXTENDED_PROPERTIES = 0x80 /**< Additional characteristic properties are defined in the Characteristic Extended Properties Descriptor */ + BLE_GATT_CHAR_PROPERTIES_BROADCAST = 0x01, /**< Permits broadcasts of the characteristic value using the Server Characteristic Configuration descriptor. */ + BLE_GATT_CHAR_PROPERTIES_READ = 0x02, /**< Permits reads of the characteristic value. */ + BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE = 0x04, /**< Permits writes of the characteristic value without response. */ + BLE_GATT_CHAR_PROPERTIES_WRITE = 0x08, /**< Permits writes of the characteristic value with response. */ + BLE_GATT_CHAR_PROPERTIES_NOTIFY = 0x10, /**< Permits notifications of a characteristic value without acknowledgment. */ + BLE_GATT_CHAR_PROPERTIES_INDICATE = 0x20, /**< Permits indications of a characteristic value with acknowledgment. */ + BLE_GATT_CHAR_PROPERTIES_AUTHENTICATED_SIGNED_WRITES = 0x40, /**< Permits signed writes to the characteristic value. */ + BLE_GATT_CHAR_PROPERTIES_EXTENDED_PROPERTIES = 0x80 /**< Additional characteristic properties are defined in the Characteristic Extended Properties descriptor */ }; /**************************************************************************/ @@ -288,31 +288,31 @@ */ /**************************************************************************/ struct PresentationFormat_t { - uint8_t gatt_format; /**< Format of the value, see @ref ble_gatt_format_t. */ - int8_t exponent; /**< Exponent for integer data types. Ex. if Exponent = -3 and the char value is 3892, the actual value is 3.892 */ - uint16_t gatt_unit; /**< UUID from Bluetooth Assigned Numbers, see @ref ble_gatt_unit_t. */ - uint8_t gatt_namespace; /**< Namespace from Bluetooth Assigned Numbers, normally '1', see @ref BLE_GATT_CPF_NAMESPACES. */ - uint16_t gatt_nsdesc; /**< Namespace description from Bluetooth Assigned Numbers, normally '0', see @ref BLE_GATT_CPF_NAMESPACES. */ + uint8_t gatt_format; /**< Format of the value; see @ref ble_gatt_format_t. */ + int8_t exponent; /**< Exponent for integer data types. Example: if Exponent = -3 and the char value is 3892, the actual value is 3.892 */ + uint16_t gatt_unit; /**< UUID from Bluetooth Assigned Numbers; see @ref ble_gatt_unit_t. */ + uint8_t gatt_namespace; /**< Namespace from Bluetooth Assigned Numbers, normally '1'; see @ref BLE_GATT_CPF_NAMESPACES. */ + uint16_t gatt_nsdesc; /**< Namespace description from Bluetooth Assigned Numbers, normally '0'; see @ref BLE_GATT_CPF_NAMESPACES. */ }; /** * @brief Creates a new GattCharacteristic using the specified 16-bit - * UUID, value length, and properties + * UUID, value length, and properties. * - * @note The UUID value must be unique in the service and is normally >1 + * @note The UUID value must be unique in the service and is normally >1. * * @param[in] uuid - * The UUID to use for this characteristic + * The UUID to use for this characteristic. * @param[in] valuePtr * The memory holding the initial value. The value is copied - * into the stack when the enclosing service is added; and - * thereafter maintained internally by the stack. + * into the stack when the enclosing service is added, and + * is thereafter maintained internally by the stack. * @param[in] initialLen - * The min length in bytes of this characteristic's value + * The min length in bytes of this characteristic's value. * @param[in] maxLen - * The max length in bytes of this characteristic's value + * The max length in bytes of this characteristic's value. * @param[in] props - * The 8-bit bit field containing the characteristic's properties + * The 8-bit field containing the characteristic's properties. * @param[in] descriptors * A pointer to an array of descriptors to be included within * this characteristic. The memory for the descriptor array is @@ -347,9 +347,9 @@ public: /** - * Setup the minimum security (mode and level) requirements for access to the characteristic's value attribute. + * Set up the minimum security (mode and level) requirements for access to the characteristic's value attribute. * - * @param securityMode Can be one of encryption or signing, with or without protection for MITM (man in the middle attacks). + * @param securityMode Can be one of encryption or signing, with or without protection for man in the middle attacks (MITM). */ void requireSecurity(SecurityManager::SecurityMode_t securityMode) { _requiredSecurity = securityMode; @@ -381,7 +381,7 @@ /** * Helper function meant to be called from the guts of the BLE stack to * determine the authorization reply for a write request. - * @param params to capture the context of the write-auth request; and also contains an out-parameter for reply. + * @param params To capture the context of the write-auth request. Also contains an out-parameter for reply. * @return true if the write is authorized to proceed. */ GattAuthCallbackReply_t authorizeWrite(GattWriteAuthCallbackParams *params) { @@ -389,7 +389,7 @@ return AUTH_CALLBACK_REPLY_SUCCESS; } - params->authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS; /* initialized to no-error by default */ + params->authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS; /* Initialized to no-error by default. */ writeAuthorizationCallback.call(params); return params->authorizationReply; } @@ -397,10 +397,10 @@ /** * Helper function meant to be called from the guts of the BLE stack to * determine the authorization reply for a read request. - * @param params to capture the context of the read-auth request. + * @param params To capture the context of the read-auth request. * - * @NOTE: To authorize/deny the read the params->authorizationReply field - * should be set to true/false. + * @NOTE: To authorize or deny the read the params->authorizationReply field + * should be set to true (authorize) or false (deny). * * If the read is approved and params->data is unchanged (NULL), * the current characteristic value will be used. @@ -415,7 +415,7 @@ return AUTH_CALLBACK_REPLY_SUCCESS; } - params->authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS; /* initialized to no-error by default */ + params->authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS; /* Initialized to no-error by default. */ readAuthorizationCallback.call(params); return params->authorizationReply; } @@ -452,7 +452,7 @@ FunctionPointerWithContext<GattWriteAuthCallbackParams *> writeAuthorizationCallback; private: - /* disallow copy and assignment */ + /* Disallow copy and assignment. */ GattCharacteristic(const GattCharacteristic &); GattCharacteristic& operator=(const GattCharacteristic &); };
--- a/ble/GattClient.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/GattClient.h Thu Nov 26 12:52:06 2015 +0000 @@ -28,8 +28,8 @@ typedef void (*ReadCallback_t)(const GattReadCallbackParams *params); enum WriteOp_t { - GATT_OP_WRITE_REQ = 0x01, /**< Write Request. */ - GATT_OP_WRITE_CMD = 0x02, /**< Write Command. */ + GATT_OP_WRITE_REQ = 0x01, /**< Write request. */ + GATT_OP_WRITE_CMD = 0x02, /**< Write command. */ }; typedef void (*WriteCallback_t)(const GattWriteCallbackParams *params); @@ -42,48 +42,48 @@ public: /** * Launch service discovery. Once launched, application callbacks will be - * invoked for matching services/characteristics. isServiceDiscoveryActive() - * can be used to determine status; and a termination callback (if setup) - * will be invoked at the end. Service discovery can be terminated prematurely - * if needed using terminateServiceDiscovery(). + * invoked for matching services or characteristics. isServiceDiscoveryActive() + * can be used to determine status, and a termination callback (if one was set up) + * will be invoked at the end. Service discovery can be terminated prematurely, + * if needed, using terminateServiceDiscovery(). * * @param connectionHandle * Handle for the connection with the peer. * @param sc - * This is the application callback for matching service. Taken as + * This is the application callback for a matching service. Taken as * NULL by default. Note: service discovery may still be active * when this callback is issued; calling asynchronous BLE-stack * APIs from within this application callback might cause the * stack to abort service discovery. If this becomes an issue, it - * may be better to make local copy of the discoveredService and + * may be better to make a local copy of the discoveredService and * wait for service discovery to terminate before operating on the * service. * @param cc - * This is the application callback for matching characteristic. + * This is the application callback for a matching characteristic. * Taken as NULL by default. Note: service discovery may still be * active when this callback is issued; calling asynchronous * BLE-stack APIs from within this application callback might cause * the stack to abort service discovery. If this becomes an issue, - * it may be better to make local copy of the discoveredCharacteristic + * it may be better to make a local copy of the discoveredCharacteristic * and wait for service discovery to terminate before operating on the * characteristic. * @param matchingServiceUUID - * UUID based filter for specifying a service in which the application is + * UUID-based filter for specifying a service in which the application is * interested. By default it is set as the wildcard UUID_UNKNOWN, * in which case it matches all services. If characteristic-UUID * filter (below) is set to the wildcard value, then a service * callback will be invoked for the matching service (or for every * service if the service filter is a wildcard). * @param matchingCharacteristicUUIDIn - * UUID based filter for specifying characteristic in which the application + * UUID-based filter for specifying characteristic in which the application * is interested. By default it is set as the wildcard UUID_UKNOWN * to match against any characteristic. If both service-UUID - * filter and characteristic-UUID filter are used with non- wildcard + * filter and characteristic-UUID filter are used with non-wildcard * values, then only a single characteristic callback is * invoked for the matching characteristic. * * @note Using wildcard values for both service-UUID and characteristic- - * UUID will result in complete service discovery--callbacks being + * UUID will result in complete service discovery: callbacks being * called for every service and characteristic. * * @note Providing NULL for the characteristic callback will result in @@ -99,36 +99,36 @@ ServiceDiscovery::CharacteristicCallback_t cc = NULL, const UUID &matchingServiceUUID = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN), const UUID &matchingCharacteristicUUIDIn = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)connectionHandle; (void)sc; (void)cc; (void)matchingServiceUUID; (void)matchingCharacteristicUUIDIn; - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */ } /** * Launch service discovery for services. Once launched, service discovery will remain * active with service-callbacks being issued back into the application for matching * services. isServiceDiscoveryActive() can be used to - * determine status; and a termination callback (if setup) will be invoked - * at the end. Service discovery can be terminated prematurely if needed + * determine status, and a termination callback (if set up) will be invoked + * at the end. Service discovery can be terminated prematurely, if needed, * using terminateServiceDiscovery(). * * @param connectionHandle * Handle for the connection with the peer. * @param sc - * This is the application callback for matching service. Note: service discovery may still be active + * This is the application callback for a matching service. Note: service discovery may still be active * when this callback is issued; calling asynchronous BLE-stack * APIs from within this application callback might cause the * stack to abort service discovery. If this becomes an issue, it - * may be better to make local copy of the discoveredService and + * may be better to make a local copy of the discoveredService and * wait for service discovery to terminate before operating on the * service. * @param matchingServiceUUID - * UUID based filter for specifying a service in which the application is + * UUID-based filter for specifying a service in which the application is * interested. By default it is set as the wildcard UUID_UNKNOWN, * in which case it matches all services. * @@ -142,29 +142,29 @@ * that providing NULL for the characteristic callback will result in * characteristic discovery being skipped for each matching * service. This allows for an inexpensive method to discover only - * services. Porter(s) are free to override this. */ + * services. Porters are free to override this. */ } /** * Launch service discovery for services. Once launched, service discovery will remain * active with service-callbacks being issued back into the application for matching * services. isServiceDiscoveryActive() can be used to - * determine status; and a termination callback (if setup) will be invoked - * at the end. Service discovery can be terminated prematurely if needed + * determine status, and a termination callback (if set up) will be invoked + * at the end. Service discovery can be terminated prematurely, if needed, * using terminateServiceDiscovery(). * * @param connectionHandle * Handle for the connection with the peer. * @param sc - * This is the application callback for matching service. Note: service discovery may still be active + * This is the application callback for a matching service. Note: service discovery may still be active * when this callback is issued; calling asynchronous BLE-stack * APIs from within this application callback might cause the * stack to abort service discovery. If this becomes an issue, it - * may be better to make local copy of the discoveredService and + * may be better to make a local copy of the discoveredService and * wait for service discovery to terminate before operating on the * service. * @param startHandle, endHandle - * Handle range within which to limit the search + * Handle range within which to limit the search. * * @return * BLE_ERROR_NONE if service discovery is launched successfully; else an appropriate error. @@ -173,91 +173,91 @@ ServiceDiscovery::ServiceCallback_t callback, GattAttribute::Handle_t startHandle, GattAttribute::Handle_t endHandle) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)connectionHandle; (void)callback; (void)startHandle; (void)endHandle; - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */ } /** * Is service-discovery currently active? */ virtual bool isServiceDiscoveryActive(void) const { - return false; /* Requesting action from porter(s): override this API if this capability is supported. */ + return false; /* Requesting action from porters: override this API if this capability is supported. */ } /** - * Terminate an ongoing service-discovery. This should result in an - * invocation of the TerminationCallback if service-discovery is active. + * Terminate an ongoing service discovery. This should result in an + * invocation of TerminationCallback if service-discovery is active. */ virtual void terminateServiceDiscovery(void) { - /* Requesting action from porter(s): override this API if this capability is supported. */ + /* Requesting action from porters: override this API if this capability is supported. */ } - /* Initiate a Gatt Client read procedure by attribute-handle. */ + /* Initiate a GATT Client read procedure by attribute-handle. */ virtual ble_error_t read(Gap::Handle_t connHandle, GattAttribute::Handle_t attributeHandle, uint16_t offset) const { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)connHandle; (void)attributeHandle; (void)offset; - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */ } /** * Initiate a GATT Client write procedure. * * @param[in] cmd - * Command can be either a write-request (which generates a - * matching response from the peripheral), or a write-command, - * which doesn't require the connected peer to respond. + * Command can be either a write-request (which generates a + * matching response from the peripheral), or a write-command + * (which doesn't require the connected peer to respond). * @param[in] connHandle * Connection handle. * @param[in] attributeHandle - * handle for the target attribtue on the remote GATT server. + * Handle for the target attribtue on the remote GATT server. * @param[in] length - * length of the new value. + * Length of the new value. * @param[in] value - * new value being written. + * New value being written. */ virtual ble_error_t write(GattClient::WriteOp_t cmd, Gap::Handle_t connHandle, GattAttribute::Handle_t attributeHandle, size_t length, const uint8_t *value) const { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)cmd; (void)connHandle; (void)attributeHandle; (void)length; (void)value; - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */ } /* Event callback handlers. */ public: /** - * Setup a callback for read response events. + * Set up a callback for read response events. */ void onDataRead(ReadCallback_t callback) { onDataReadCallback = callback; } /** - * Setup a callback for write response events. - * @Note: write commands (issued using writeWoResponse) don't generate a response. + * Set up a callback for write response events. + * @Note: Write commands (issued using writeWoResponse) don't generate a response. */ void onDataWritten(WriteCallback_t callback) { onDataWriteCallback = callback; } /** - * Setup a callback for write response events. - * @Note: write commands (issued using writeWoResponse) don't generate a response. + * Set up a callback for write response events. + * @Note: Write commands (issued using writeWoResponse) don't generate a response. * * @note: This API is now *deprecated* and will be dropped in the future. * Please use onDataWritten() instead. @@ -267,18 +267,18 @@ } /** - * Setup callback for when serviceDiscovery terminates. + * Set up a callback for when serviceDiscovery terminates. */ virtual void onServiceDiscoveryTermination(ServiceDiscovery::TerminationCallback_t callback) { - (void)callback; /* avoid compiler warnings about ununsed variables */ + (void)callback; /* Avoid compiler warnings about ununsed variables. */ - /* Requesting action from porter(s): override this API if this capability is supported. */ + /* Requesting action from porters: override this API if this capability is supported. */ } /** - * Setup a callback for when GattClient receives an update event - * corresponding to a change in value of a characteristic on the remote - * GattServer. + * Set up a callback for when the GATT client receives an update event + * corresponding to a change in the value of a characteristic on the remote + * GATT server. */ void onHVX(HVXCallback_t callback) { onHVXCallback = callback; @@ -286,7 +286,7 @@ protected: GattClient() { - /* empty */ + /* Empty */ } /* Entry points for the underlying stack to report events back to the user. */ @@ -315,7 +315,7 @@ HVXCallback_t onHVXCallback; private: - /* disallow copy and assignment */ + /* Disallow copy and assignment. */ GattClient(const GattClient &); GattClient& operator=(const GattClient &); };
--- a/ble/GattServer.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/GattServer.h Thu Nov 26 12:52:06 2015 +0000 @@ -28,7 +28,7 @@ public: /* Event callback handlers. */ typedef void (*EventCallback_t)(GattAttribute::Handle_t attributeHandle); - typedef void (*ServerEventCallback_t)(void); /**< independent of any particular attribute */ + typedef void (*ServerEventCallback_t)(void); /**< Independent of any particular attribute. */ protected: GattServer() : @@ -53,14 +53,14 @@ * characteristics contained within. */ virtual ble_error_t addService(GattService &service) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)service; - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */ } /** - * Read the value of a characteristic from the local GattServer + * Read the value of a characteristic from the local GATT server. * @param[in] attributeHandle * Attribute handle for the value attribute of the characteristic. * @param[out] buffer @@ -75,18 +75,18 @@ * @return BLE_ERROR_NONE if a value was read successfully into the buffer. */ virtual ble_error_t read(GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)attributeHandle; (void)buffer; (void)lengthP; - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */ } /** - * Read the value of a characteristic from the local GattServer + * Read the value of a characteristic from the local GATT server. * @param[in] connectionHandle - * Connection Handle. + * Connection handle. * @param[in] attributeHandle * Attribute handle for the value attribute of the characteristic. * @param[out] buffer @@ -100,32 +100,32 @@ * * @return BLE_ERROR_NONE if a value was read successfully into the buffer. * - * @note This API is a version of above with an additional connection handle + * @note This API is a version of the above, with an additional connection handle * parameter to allow fetches for connection-specific multivalued * attributes (such as the CCCDs). */ virtual ble_error_t read(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t *buffer, uint16_t *lengthP) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)connectionHandle; (void)attributeHandle; (void)buffer; (void)lengthP; - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */ } /** - * Update the value of a characteristic on the local GattServer. + * Update the value of a characteristic on the local GATT server. * * @param[in] attributeHandle - * Handle for the value attribute of the Characteristic. + * Handle for the value attribute of the characteristic. * @param[in] value - * A pointer to a buffer holding the new value + * A pointer to a buffer holding the new value. * @param[in] size * Size of the new value (in bytes). * @param[in] localOnly * Should this update be kept on the local - * GattServer regardless of the state of the + * GATT server regardless of the state of the * notify/indicate flag in the CCCD for this * Characteristic? If set to true, no notification * or indication is generated. @@ -133,26 +133,26 @@ * @return BLE_ERROR_NONE if we have successfully set the value of the attribute. */ virtual ble_error_t write(GattAttribute::Handle_t attributeHandle, const uint8_t *value, uint16_t size, bool localOnly = false) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)attributeHandle; (void)value; (void)size; (void)localOnly; - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */ } /** - * Update the value of a characteristic on the local GattServer. A version - * of the same as above with connection handle parameter to allow updates + * Update the value of a characteristic on the local GATT server. A version + * of the same as the above, with a connection handle parameter to allow updates * for connection-specific multivalued attributes (such as the CCCDs). * * @param[in] connectionHandle - * Connection Handle. + * Connection handle. * @param[in] attributeHandle - * Handle for the value attribute of the Characteristic. + * Handle for the value attribute of the characteristic. * @param[in] value - * A pointer to a buffer holding the new value + * A pointer to a buffer holding the new value. * @param[in] size * Size of the new value (in bytes). * @param[in] localOnly @@ -165,54 +165,54 @@ * @return BLE_ERROR_NONE if we have successfully set the value of the attribute. */ virtual ble_error_t write(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, const uint8_t *value, uint16_t size, bool localOnly = false) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)connectionHandle; (void)attributeHandle; (void)value; (void)size; (void)localOnly; - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */ } /** - * Determine the updates-enabled status (notification/indication) for the current connection from a characteristic's CCCD. + * Determine the updates-enabled status (notification or indication) for the current connection from a characteristic's CCCD. * * @param characteristic - * The characteristic + * The characteristic. * @param[out] enabledP * Upon return, *enabledP is true if updates are enabled, else false. * - * @return BLE_ERROR_NONE if the connection and handle are found. false otherwise. + * @return BLE_ERROR_NONE if the connection and handle are found. False otherwise. */ virtual ble_error_t areUpdatesEnabled(const GattCharacteristic &characteristic, bool *enabledP) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)characteristic; (void)enabledP; - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */ } /** - * Determine the connection-specific updates-enabled status (notification/indication) from a characteristic's CCCD. + * Determine the connection-specific updates-enabled status (notification or indication) from a characteristic's CCCD. * * @param connectionHandle - * The connection handle + * The connection handle. * @param[out] enabledP * Upon return, *enabledP is true if updates are enabled, else false. * * @param characteristic - * The characteristic + * The characteristic. * - * @return BLE_ERROR_NONE if the connection and handle are found. false otherwise. + * @return BLE_ERROR_NONE if the connection and handle are found. False otherwise. */ virtual ble_error_t areUpdatesEnabled(Gap::Handle_t connectionHandle, const GattCharacteristic &characteristic, bool *enabledP) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)connectionHandle; (void)characteristic; (void)enabledP; - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */ } /** @@ -220,7 +220,7 @@ * onDataRead(). It should be overridden to return true as applicable. */ virtual bool isOnDataReadAvailable() const { - return false; /* Requesting action from porter(s): override this API if this capability is supported. */ + return false; /* Requesting action from porters: override this API if this capability is supported. */ } /* @@ -231,11 +231,11 @@ * Add a callback for the GATT event DATA_SENT (which is triggered when * updates are sent out by GATT in the form of notifications). * - * @Note: it is possible to chain together multiple onDataSent callbacks + * @Note: It is possible to chain together multiple onDataSent callbacks * (potentially from different modules of an application) to receive updates * to characteristics. * - * @Note: it is also possible to setup a callback into a member function of + * @Note: It is also possible to set up a callback into a member function of * some object. */ void onDataSent(void (*callback)(unsigned count)) {dataSentCallChain.add(callback);} @@ -245,18 +245,18 @@ } /** - * Setup a callback for when an attribute has its value updated by or at the - * connected peer. For a peripheral, this callback triggered when the local + * Set up a callback for when an attribute has its value updated by or at the + * connected peer. For a peripheral, this callback is triggered when the local * GATT server has an attribute updated by a write command from the peer. - * For a Central, this callback is triggered when a response is received for + * For a central, this callback is triggered when a response is received for * a write request. * - * @Note: it is possible to chain together multiple onDataWritten callbacks + * @Note: It is possible to chain together multiple onDataWritten callbacks * (potentially from different modules of an application) to receive updates - * to characteristics. Many services, such as DFU and UART add their own + * to characteristics. Many services, such as DFU and UART, add their own * onDataWritten callbacks behind the scenes to trap interesting events. * - * @Note: it is also possible to setup a callback into a member function of + * @Note: It is also possible to set up a callback into a member function of * some object. */ void onDataWritten(void (*callback)(const GattWriteCallbackParams *eventDataP)) {dataWrittenCallChain.add(callback);} @@ -269,16 +269,16 @@ * Setup a callback to be invoked on the peripheral when an attribute is * being read by a remote client. * - * @Note: this functionality may not be available on all underlying stacks. + * @Note: This functionality may not be available on all underlying stacks. * You could use GattCharacteristic::setReadAuthorizationCallback() as an * alternative. Refer to isOnDataReadAvailable(). * - * @Note: it is possible to chain together multiple onDataRead callbacks + * @Note: It is possible to chain together multiple onDataRead callbacks * (potentially from different modules of an application) to receive updates * to characteristics. Services may add their own onDataRead callbacks * behind the scenes to trap interesting events. * - * @Note: it is also possible to setup a callback into a member function of + * @Note: It is also possible to set up a callback into a member function of * some object. * * @return BLE_ERROR_NOT_IMPLEMENTED if this functionality isn't available; @@ -303,19 +303,19 @@ } /** - * Setup a callback for when notifications/indications are enabled for a - * characteristic on the local GattServer. + * Set up a callback for when notifications or indications are enabled for a + * characteristic on the local GATT server. */ void onUpdatesEnabled(EventCallback_t callback) {updatesEnabledCallback = callback;} /** - * Setup a callback for when notifications/indications are disabled for a - * characteristic on the local GattServer. + * Set up a callback for when notifications or indications are disabled for a + * characteristic on the local GATT server. */ void onUpdatesDisabled(EventCallback_t callback) {updatesDisabledCallback = callback;} /** - * Setup a callback for when the GATT server receives a response for an + * Set up a callback for when the GATT server receives a response for an * indication event sent previously. */ void onConfirmationReceived(EventCallback_t callback) {confirmationReceivedCallback = callback;} @@ -375,7 +375,7 @@ EventCallback_t confirmationReceivedCallback; private: - /* disallow copy and assignment */ + /* Disallow copy and assignment. */ GattServer(const GattServer &); GattServer& operator=(const GattServer &); };
--- a/ble/GattServerEvents.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/GattServerEvents.h Thu Nov 26 12:52:06 2015 +0000 @@ -26,13 +26,13 @@ { public: typedef enum gattEvent_e { - GATT_EVENT_DATA_SENT = 1, /**< Fired when a msg was successfully sent out (notify only?) */ - GATT_EVENT_DATA_WRITTEN = 2, /**< Client wrote data to Server (separate into char and descriptor writes?) */ - GATT_EVENT_UPDATES_ENABLED = 3, /**< Notify/Indicate Enabled in CCCD */ - GATT_EVENT_UPDATES_DISABLED = 4, /**< Notify/Indicate Disabled in CCCD */ - GATT_EVENT_CONFIRMATION_RECEIVED = 5, /**< Response received from Indicate message */ - GATT_EVENT_READ_AUTHORIZATION_REQ = 6, /**< Request application to authorize read */ - GATT_EVENT_WRITE_AUTHORIZATION_REQ = 7, /**< Request application to authorize write */ + GATT_EVENT_DATA_SENT = 1, /**< Fired when a message was successfully sent out (notify only?) */ + GATT_EVENT_DATA_WRITTEN = 2, /**< Client wrote data to the server (separate into char and descriptor writes?) */ + GATT_EVENT_UPDATES_ENABLED = 3, /**< Notify/Indicate enabled in CCCD. */ + GATT_EVENT_UPDATES_DISABLED = 4, /**< Notify/Indicate disabled in CCCD. */ + GATT_EVENT_CONFIRMATION_RECEIVED = 5, /**< Response received from Indicate message. */ + GATT_EVENT_READ_AUTHORIZATION_REQ = 6, /**< Request application to authorize read. */ + GATT_EVENT_WRITE_AUTHORIZATION_REQ = 7, /**< Request application to authorize write. */ } gattEvent_t; };
--- a/ble/GattService.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/GattService.h Thu Nov 26 12:52:06 2015 +0000 @@ -47,16 +47,16 @@ public: /** * @brief Creates a new GattService using the specified 16-bit - * UUID, value length, and properties + * UUID, value length, and properties. * - * @note The UUID value must be unique and is normally >1 + * @note The UUID value must be unique and is normally >1. * * @param[in] uuid - * The UUID to use for this service + * The UUID to use for this service. * @param[in] characteristics - * A pointer to an array of characteristics to be included within this service + * A pointer to an array of characteristics to be included within this service. * @param[in] numCharacteristics - * The number of characteristics + * The number of characteristics. */ GattService(const UUID &uuid, GattCharacteristic *characteristics[], unsigned numCharacteristics) : _primaryServiceID(uuid), _characteristicCount(numCharacteristics), _characteristics(characteristics), _handle(0) {
--- a/ble/SecurityManager.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/SecurityManager.h Thu Nov 26 12:52:06 2015 +0000 @@ -25,17 +25,17 @@ public: enum SecurityMode_t { SECURITY_MODE_NO_ACCESS, - SECURITY_MODE_ENCRYPTION_OPEN_LINK, /**< require no protection, open link. */ - SECURITY_MODE_ENCRYPTION_NO_MITM, /**< require encryption, but no MITM protection. */ - SECURITY_MODE_ENCRYPTION_WITH_MITM, /**< require encryption and MITM protection. */ - SECURITY_MODE_SIGNED_NO_MITM, /**< require signing or encryption, but no MITM protection. */ - SECURITY_MODE_SIGNED_WITH_MITM, /**< require signing or encryption, and MITM protection. */ + SECURITY_MODE_ENCRYPTION_OPEN_LINK, /**< Require no protection, open link. */ + SECURITY_MODE_ENCRYPTION_NO_MITM, /**< Require encryption, but no MITM protection. */ + SECURITY_MODE_ENCRYPTION_WITH_MITM, /**< Require encryption and MITM protection. */ + SECURITY_MODE_SIGNED_NO_MITM, /**< Require signing or encryption, but no MITM protection. */ + SECURITY_MODE_SIGNED_WITH_MITM, /**< Require signing or encryption, and MITM protection. */ }; /** - * @brief Defines possible security status/states. + * @brief Defines possible security status or states. * - * @details Defines possible security status/states of a link when requested by getLinkSecurity(). + * @details Defines possible security status or states of a link when requested by getLinkSecurity(). */ enum LinkSecurityStatus_t { NOT_ENCRYPTED, /**< The link is not secured. */ @@ -44,11 +44,11 @@ }; enum SecurityIOCapabilities_t { - IO_CAPS_DISPLAY_ONLY = 0x00, /**< Display Only. */ - IO_CAPS_DISPLAY_YESNO = 0x01, /**< Display and Yes/No entry. */ - IO_CAPS_KEYBOARD_ONLY = 0x02, /**< Keyboard Only. */ + IO_CAPS_DISPLAY_ONLY = 0x00, /**< Display only. */ + IO_CAPS_DISPLAY_YESNO = 0x01, /**< Display and yes/no entry. */ + IO_CAPS_KEYBOARD_ONLY = 0x02, /**< Keyboard only. */ IO_CAPS_NONE = 0x03, /**< No I/O capabilities. */ - IO_CAPS_KEYBOARD_DISPLAY = 0x04, /**< Keyboard and Display. */ + IO_CAPS_KEYBOARD_DISPLAY = 0x04, /**< Keyboard and display. */ }; enum SecurityCompletionStatus_t { @@ -94,8 +94,8 @@ * * @param[in] enableBonding Allow for bonding. * @param[in] requireMITM Require protection for man-in-the-middle attacks. - * @param[in] iocaps To specify IO capabilities of this peripheral, - * such as availability of a display or keyboard to + * @param[in] iocaps To specify the I/O capabilities of this peripheral, + * such as availability of a display or keyboard, to * support out-of-band exchanges of security data. * @param[in] passkey To specify a static passkey. * @@ -105,29 +105,29 @@ bool requireMITM = true, SecurityIOCapabilities_t iocaps = IO_CAPS_NONE, const Passkey_t passkey = NULL) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)enableBonding; (void)requireMITM; (void)iocaps; (void)passkey; - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if security is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if security is supported. */ } /** * Get the security status of a connection. * * @param[in] connectionHandle Handle to identify the connection. - * @param[out] securityStatusP security status. + * @param[out] securityStatusP Security status. * - * @return BLE_SUCCESS Or appropriate error code indicating reason for failure. + * @return BLE_SUCCESS or appropriate error code indicating the failure reason. */ virtual ble_error_t getLinkSecurity(Gap::Handle_t connectionHandle, LinkSecurityStatus_t *securityStatusP) { - /* avoid compiler warnings about unused variables */ + /* Avoid compiler warnings about unused variables. */ (void)connectionHandle; (void)securityStatusP; - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if security is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if security is supported. */ } /** @@ -135,30 +135,30 @@ * the database within the security manager. * * @retval BLE_ERROR_NONE On success, else an error code indicating reason for failure. - * @retval BLE_ERROR_INVALID_STATE If the API is called without module initialization and/or + * @retval BLE_ERROR_INVALID_STATE If the API is called without module initialization or * application registration. */ virtual ble_error_t purgeAllBondingState(void) { - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if security is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if security is supported. */ } /* Event callback handlers. */ public: /** - * To indicate that security procedure for link has started. + * To indicate that a security procedure for the link has started. */ virtual void onSecuritySetupInitiated(SecuritySetupInitiatedCallback_t callback) {securitySetupInitiatedCallback = callback;} /** - * To indicate that security procedure for link has completed. + * To indicate that the security procedure for the link has completed. */ virtual void onSecuritySetupCompleted(SecuritySetupCompletedCallback_t callback) {securitySetupCompletedCallback = callback;} /** - * To indicate that link with the peer is secured. For bonded devices, - * subsequent re-connections with bonded peer will result only in this callback - * when the link is secured and setup procedures will not occur unless the - * bonding information is either lost or deleted on either or both sides. + * To indicate that the link with the peer is secured. For bonded devices, + * subsequent reconnections with a bonded peer will result only in this callback + * when the link is secured; setup procedures will not occur (unless the + * bonding information is either lost or deleted on either or both sides). */ virtual void onLinkSecured(LinkSecuredCallback_t callback) {linkSecuredCallback = callback;}
--- a/ble/ServiceDiscovery.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/ServiceDiscovery.h Thu Nov 26 12:52:06 2015 +0000 @@ -31,22 +31,22 @@ */ /** - * Callback type for when a matching Service is found during service- + * Callback type for when a matching service is found during service- * discovery. The receiving function is passed in a pointer to a - * DiscoveredService object which will remain valid for the lifetime of the + * DiscoveredService object, which will remain valid for the lifetime of the * callback. Memory for this object is owned by the BLE_API eventing * framework. The application can safely make a persistent shallow-copy of - * this object in order to work with the service beyond the callback. + * this object to work with the service beyond the callback. */ typedef void (*ServiceCallback_t)(const DiscoveredService *); /** - * Callback type for when a matching Characteristic is found during service- + * Callback type for when a matching characteristic is found during service- * discovery. The receiving function is passed in a pointer to a - * DiscoveredCharacteristic object which will remain valid for the lifetime + * DiscoveredCharacteristic object, which will remain valid for the lifetime * of the callback. Memory for this object is owned by the BLE_API eventing * framework. The application can safely make a persistent shallow-copy of - * this object in order to work with the characteristic beyond the callback. + * this object to work with the characteristic beyond the callback. */ typedef void (*CharacteristicCallback_t)(const DiscoveredCharacteristic *); @@ -59,47 +59,47 @@ /** * Launch service discovery. Once launched, service discovery will remain * active with callbacks being issued back into the application for matching - * services/characteristics. isActive() can be used to determine status; and - * a termination callback (if setup) will be invoked at the end. Service - * discovery can be terminated prematurely if needed using terminate(). + * services or characteristics. isActive() can be used to determine status, and + * a termination callback (if set up) will be invoked at the end. Service + * discovery can be terminated prematurely, if needed, using terminate(). * * @param connectionHandle * Handle for the connection with the peer. * @param sc - * This is the application callback for matching service. Taken as + * This is the application callback for a matching service. Taken as * NULL by default. Note: service discovery may still be active * when this callback is issued; calling asynchronous BLE-stack * APIs from within this application callback might cause the * stack to abort service discovery. If this becomes an issue, it - * may be better to make local copy of the discoveredService and + * may be better to make a local copy of the discoveredService and * wait for service discovery to terminate before operating on the * service. * @param cc - * This is the application callback for matching characteristic. + * This is the application callback for a matching characteristic. * Taken as NULL by default. Note: service discovery may still be * active when this callback is issued; calling asynchronous * BLE-stack APIs from within this application callback might cause * the stack to abort service discovery. If this becomes an issue, - * it may be better to make local copy of the discoveredCharacteristic + * it may be better to make a local copy of the discoveredCharacteristic * and wait for service discovery to terminate before operating on the * characteristic. * @param matchingServiceUUID - * UUID based filter for specifying a service in which the application is + * UUID-based filter for specifying a service in which the application is * interested. By default it is set as the wildcard UUID_UNKNOWN, * in which case it matches all services. If characteristic-UUID * filter (below) is set to the wildcard value, then a service * callback will be invoked for the matching service (or for every * service if the service filter is a wildcard). * @param matchingCharacteristicUUIDIn - * UUID based filter for specifying characteristic in which the application + * UUID-based filter for specifying a characteristic in which the application * is interested. By default it is set as the wildcard UUID_UKNOWN * to match against any characteristic. If both service-UUID - * filter and characteristic-UUID filter are used with non- wildcard + * filter and characteristic-UUID filter are used with non-wildcard * values, then only a single characteristic callback is * invoked for the matching characteristic. * * @note Using wildcard values for both service-UUID and characteristic- - * UUID will result in complete service discovery--callbacks being + * UUID will result in complete service discovery: callbacks being * called for every service and characteristic. * * @note Providing NULL for the characteristic callback will result in @@ -122,13 +122,13 @@ virtual bool isActive(void) const = 0; /** - * Terminate an ongoing service-discovery. This should result in an - * invocation of the TerminationCallback if service-discovery is active. + * Terminate an ongoing service discovery. This should result in an + * invocation of the TerminationCallback if service discovery is active. */ virtual void terminate(void) = 0; /** - * Setup callback to be invoked when service discovery is terminated. + * Set up a callback to be invoked when service discovery is terminated. */ virtual void onTermination(TerminationCallback_t callback) = 0;
--- a/ble/UUID.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/UUID.h Thu Nov 26 12:52:06 2015 +0000 @@ -25,8 +25,8 @@ class UUID { public: enum UUID_Type_t { - UUID_TYPE_SHORT = 0, // Short BLE UUID - UUID_TYPE_LONG = 1 // Full 128-bit UUID + UUID_TYPE_SHORT = 0, // Short BLE UUID. + UUID_TYPE_LONG = 1 // Full 128-bit UUID. }; typedef uint16_t ShortUUIDBytes_t; @@ -36,7 +36,7 @@ public: /** - * Creates a new 128-bit UUID + * Creates a new 128-bit UUID. * * @note The UUID is a unique 128-bit (16 byte) ID used to identify * different service or characteristics on the BLE device. @@ -49,7 +49,7 @@ } /** - * Creates a new 16-bit UUID + * Creates a new 16-bit UUID. * * @note The UUID is a unique 16-bit (2 byte) ID used to identify * different service or characteristics on the BLE device. @@ -58,7 +58,7 @@ * 27-byte data payload length of the Link Layer, the BLE specification adds * two additional UUID formats: 16-bit and 32-bit UUIDs. These shortened * formats can be used only with UUIDs that are defined in the Bluetooth - * specification (i.e., that are listed by the Bluetooth SIG as standard + * specification (listed by the Bluetooth SIG as standard * Bluetooth UUIDs). * * To reconstruct the full 128-bit UUID from the shortened version, insert @@ -72,10 +72,10 @@ * vendor-specific UUIDs. In these cases, you’ll need to use the full * 128-bit UUID value at all times. * - * @note we don't yet support 32-bit shortened UUIDs. + * @note We don't yet support 32-bit shortened UUIDs. */ UUID(ShortUUIDBytes_t _shortUUID) : type(UUID_TYPE_SHORT), baseUUID(), shortUUID(_shortUUID) { - /* empty */ + /* Empty */ } UUID(const UUID &source) { @@ -89,7 +89,7 @@ } /** - * Fill in a 128-bit UUID; this is useful when UUID isn't known at the time of object construction. + * Fill in a 128-bit UUID; this is useful when the UUID isn't known at the time of the object construction. */ void setupLong(const LongUUIDBytes_t longUUID) { type = UUID_TYPE_LONG; @@ -132,12 +132,12 @@ private: UUID_Type_t type; // UUID_TYPE_SHORT or UUID_TYPE_LONG - LongUUIDBytes_t baseUUID; /* the base of the long UUID (if + LongUUIDBytes_t baseUUID; /* The base of the long UUID (if * used). Note: bytes 12 and 13 (counting from LSB) * are zeroed out to allow comparison with other long - * UUIDs which differ only in the 16-bit relative + * UUIDs, which differ only in the 16-bit relative * part.*/ - ShortUUIDBytes_t shortUUID; // 16 bit uuid (byte 2-3 using with base) + ShortUUIDBytes_t shortUUID; // 16 bit UUID (byte 2-3 using with base). }; #endif // ifndef __UUID_H__ \ No newline at end of file
--- a/ble/blecommon.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/blecommon.h Thu Nov 26 12:52:06 2015 +0000 @@ -22,9 +22,9 @@ #endif -/** @defgroup BLE_UUID_VALUES Assigned Values for BLE UUIDs +/** @defgroup BLE_UUID_VALUES assigned values for BLE UUIDs. * @{ */ -/* Generic UUIDs, applicable to all services */ +/* Generic UUIDs, applicable to all services. */ enum { BLE_UUID_UNKNOWN = 0x0000, /**< Reserved UUID. */ BLE_UUID_SERVICE_PRIMARY = 0x2800, /**< Primary Service. */ @@ -52,7 +52,7 @@ }; /** @} */ -/** @defgroup BLE_APPEARANCES Bluetooth Appearance values +/** @defgroup BLE_APPEARANCES Bluetooth appearance values. * @note Retrieved from http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml * @{ */ enum { @@ -71,20 +71,20 @@ BLE_APPEARANCE_GENERIC_BARCODE_SCANNER = 704, /**< Generic Barcode Scanner. */ BLE_APPEARANCE_GENERIC_THERMOMETER = 768, /**< Generic Thermometer. */ BLE_APPEARANCE_THERMOMETER_EAR = 769, /**< Thermometer: Ear. */ - BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR = 832, /**< Generic Heart rate Sensor. */ + BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR = 832, /**< Generic Heart Rate Sensor. */ BLE_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT = 833, /**< Heart Rate Sensor: Heart Rate Belt. */ BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE = 896, /**< Generic Blood Pressure. */ BLE_APPEARANCE_BLOOD_PRESSURE_ARM = 897, /**< Blood Pressure: Arm. */ BLE_APPEARANCE_BLOOD_PRESSURE_WRIST = 898, /**< Blood Pressure: Wrist. */ BLE_APPEARANCE_GENERIC_HID = 960, /**< Human Interface Device (HID). */ - BLE_APPEARANCE_HID_KEYBOARD = 961, /**< Keyboard (HID Subtype). */ - BLE_APPEARANCE_HID_MOUSE = 962, /**< Mouse (HID Subtype). */ - BLE_APPEARANCE_HID_JOYSTICK = 963, /**< Joystiq (HID Subtype). */ - BLE_APPEARANCE_HID_GAMEPAD = 964, /**< Gamepad (HID Subtype). */ - BLE_APPEARANCE_HID_DIGITIZERSUBTYPE = 965, /**< Digitizer Tablet (HID Subtype). */ - BLE_APPEARANCE_HID_CARD_READER = 966, /**< Card Reader (HID Subtype). */ - BLE_APPEARANCE_HID_DIGITAL_PEN = 967, /**< Digital Pen (HID Subtype). */ - BLE_APPEARANCE_HID_BARCODE = 968, /**< Barcode Scanner (HID Subtype). */ + BLE_APPEARANCE_HID_KEYBOARD = 961, /**< Keyboard (HID subtype). */ + BLE_APPEARANCE_HID_MOUSE = 962, /**< Mouse (HID subtype). */ + BLE_APPEARANCE_HID_JOYSTICK = 963, /**< Joystick (HID subtype). */ + BLE_APPEARANCE_HID_GAMEPAD = 964, /**< Gamepad (HID subtype). */ + BLE_APPEARANCE_HID_DIGITIZERSUBTYPE = 965, /**< Digitizer Tablet (HID subtype). */ + BLE_APPEARANCE_HID_CARD_READER = 966, /**< Card Reader (HID subtype). */ + BLE_APPEARANCE_HID_DIGITAL_PEN = 967, /**< Digital Pen (HID subtype). */ + BLE_APPEARANCE_HID_BARCODE = 968, /**< Barcode Scanner (HID subtype). */ BLE_APPEARANCE_GENERIC_GLUCOSE_METER = 1024, /**< Generic Glucose Meter. */ BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR = 1088, /**< Generic Running Walking Sensor. */ BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE = 1089, /**< Running Walking Sensor: In-Shoe. */ @@ -98,7 +98,7 @@ BLE_APPEARANCE_CYCLING_SPEED_CADENCE_SENSOR = 1157, /**< Cycling: Speed and Cadence Sensor. */ BLE_APPEARANCE_GENERIC_PULSE_OXIMETER = 3136, /**< Generic Pulse Oximeter. */ BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP = 3137, /**< Fingertip (Pulse Oximeter subtype). */ - BLE_APPEARANCE_PULSE_OXIMETER_WRIST_WORN = 3138, /**< Wrist Worn(Pulse Oximeter subtype). */ + BLE_APPEARANCE_PULSE_OXIMETER_WRIST_WORN = 3138, /**< Wrist Worn (Pulse Oximeter subtype). */ BLE_APPEARANCE_GENERIC_WEIGHT_SCALE = 3200, /**< Generic Weight Scale. */ BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS_ACT = 5184, /**< Generic Outdoor Sports Activity. */ BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_DISP = 5185, /**< Location Display Device (Outdoor Sports Activity subtype). */ @@ -114,14 +114,14 @@ */ /**************************************************************************/ enum ble_error_t { - BLE_ERROR_NONE = 0, /**< No error */ - BLE_ERROR_BUFFER_OVERFLOW = 1, /**< The requested action would cause a buffer overflow and has been aborted */ - BLE_ERROR_NOT_IMPLEMENTED = 2, /**< Requested a feature that isn't yet implement or isn't supported by the target HW */ - BLE_ERROR_PARAM_OUT_OF_RANGE = 3, /**< One of the supplied parameters is outside the valid range */ - BLE_ERROR_INVALID_PARAM = 4, /**< One of the supplied parameters is invalid */ - BLE_STACK_BUSY = 5, /**< The stack is busy */ + BLE_ERROR_NONE = 0, /**< No error. */ + BLE_ERROR_BUFFER_OVERFLOW = 1, /**< The requested action would cause a buffer overflow and has been aborted. */ + BLE_ERROR_NOT_IMPLEMENTED = 2, /**< Requested a feature that isn't yet implemented or isn't supported by the target HW. */ + BLE_ERROR_PARAM_OUT_OF_RANGE = 3, /**< One of the supplied parameters is outside the valid range. */ + BLE_ERROR_INVALID_PARAM = 4, /**< One of the supplied parameters is invalid. */ + BLE_STACK_BUSY = 5, /**< The stack is busy. */ BLE_ERROR_INVALID_STATE = 6, /**< Invalid state. */ - BLE_ERROR_NO_MEM = 7, /**< Out of Memory */ + BLE_ERROR_NO_MEM = 7, /**< Out of memory */ BLE_ERROR_OPERATION_NOT_PERMITTED = 8, BLE_ERROR_INITIALIZATION_INCOMPLETE = 9, BLE_ERROR_ALREADY_INITIALIZED = 10,
--- a/ble/services/BatteryService.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/services/BatteryService.h Thu Nov 26 12:52:06 2015 +0000 @@ -28,11 +28,11 @@ class BatteryService { public: /** - * @param[ref] _ble - * BLE object for the underlying controller. - * @param[in] level - * 8bit batterly level. Usually used to represent percentage of batterly charge remaining. - */ + * @param[ref] _ble + * BLE object for the underlying controller. + * @param[in] level + * 8bit batterly level. Usually used to represent percentage of batterly charge remaining. + */ BatteryService(BLE &_ble, uint8_t level = 100) : ble(_ble), batteryLevel(level),
--- a/ble/services/DeviceInformationService.h Thu Nov 26 12:52:06 2015 +0000 +++ b/ble/services/DeviceInformationService.h Thu Nov 26 12:52:06 2015 +0000 @@ -21,30 +21,41 @@ /** * @class DeviceInformationService -* @brief BLE Device Information Service -* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.device_information.xml +* @brief BLE Device Information Service <br> +* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.device_information.xml <br> * Manufacturer Name String Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.manufacturer_name_string.xml */ class DeviceInformationService { public: /** - * @brief Device Information Service Constructor: copies device-specific information - * into the BLE stack. + * @brief Device Information Service Constructor. * * @param[ref] _ble * BLE object for the underlying controller. * @param[in] manufacturersName - * The name of the manufacturer of the device. + * This characteristic represents the name of the + * manufacturer of the device. The name is copied into the + * BLE stack during this constructor. * @param[in] modelNumber - * The model number that is assigned by the device vendor. + * This characteristic represents the model number that is + * assigned by the device vendor. The value is copied into + * the BLE stack during this constructor. * @param[in] serialNumber - * The serial number for a particular instance of the device. + * This characteristic represents the serial number for a + * particular instance of the device. The value is copied + * into the BLE stack during this constructor. * @param[in] hardwareRevision - * The hardware revision for the hardware within the device. + * This characteristic represents the hardware revision for + * the hardware within the device. The value is copied + * into the BLE stack during this constructor. * @param[in] firmwareRevision - * The device's firmware version. + * This characteristic represents the firmware revision for + * the firmware within the device. The value is copied + * into the BLE stack during this constructor. * @param[in] softwareRevision - * The device's software version. + * This characteristic represents the software revision for + * the software within the device. The value is copied + * into the BLE stack during this constructor. */ DeviceInformationService(BLE &_ble, const char *manufacturersName = NULL, @@ -56,36 +67,36 @@ ble(_ble), manufacturersNameStringCharacteristic(GattCharacteristic::UUID_MANUFACTURER_NAME_STRING_CHAR, (uint8_t *)manufacturersName, - (manufacturersName != NULL) ? strlen(manufacturersName) : 0, /* Min length */ - (manufacturersName != NULL) ? strlen(manufacturersName) : 0, /* Max length */ + (manufacturersName != NULL) ? strlen(manufacturersName) : 0, /* minLength */ + (manufacturersName != NULL) ? strlen(manufacturersName) : 0, /* maxLength */ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ), modelNumberStringCharacteristic(GattCharacteristic::UUID_MODEL_NUMBER_STRING_CHAR, (uint8_t *)modelNumber, - (modelNumber != NULL) ? strlen(modelNumber) : 0, /* Min length */ - (modelNumber != NULL) ? strlen(modelNumber) : 0, /* Max length */ + (modelNumber != NULL) ? strlen(modelNumber) : 0, /* minLength */ + (modelNumber != NULL) ? strlen(modelNumber) : 0, /* maxLength */ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ), serialNumberStringCharacteristic(GattCharacteristic::UUID_SERIAL_NUMBER_STRING_CHAR, (uint8_t *)serialNumber, - (serialNumber != NULL) ? strlen(serialNumber) : 0, /* Min length */ - (serialNumber != NULL) ? strlen(serialNumber) : 0, /* Max length */ + (serialNumber != NULL) ? strlen(serialNumber) : 0, /* minLength */ + (serialNumber != NULL) ? strlen(serialNumber) : 0, /* maxLength */ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ), hardwareRevisionStringCharacteristic(GattCharacteristic::UUID_HARDWARE_REVISION_STRING_CHAR, (uint8_t *)hardwareRevision, - (hardwareRevision != NULL) ? strlen(hardwareRevision) : 0, /* Min length */ - (hardwareRevision != NULL) ? strlen(hardwareRevision) : 0, /* Max length */ + (hardwareRevision != NULL) ? strlen(hardwareRevision) : 0, /* minLength */ + (hardwareRevision != NULL) ? strlen(hardwareRevision) : 0, /* maxLength */ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ), firmwareRevisionStringCharacteristic(GattCharacteristic::UUID_FIRMWARE_REVISION_STRING_CHAR, (uint8_t *)firmwareRevision, - (firmwareRevision != NULL) ? strlen(firmwareRevision) : 0, /* Min length */ - (firmwareRevision != NULL) ? strlen(firmwareRevision) : 0, /* Max length */ + (firmwareRevision != NULL) ? strlen(firmwareRevision) : 0, /* minLength */ + (firmwareRevision != NULL) ? strlen(firmwareRevision) : 0, /* maxLength */ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ), softwareRevisionStringCharacteristic(GattCharacteristic::UUID_SOFTWARE_REVISION_STRING_CHAR, (uint8_t *)softwareRevision, - (softwareRevision != NULL) ? strlen(softwareRevision) : 0, /* Min length */ - (softwareRevision != NULL) ? strlen(softwareRevision) : 0, /* Max length */ + (softwareRevision != NULL) ? strlen(softwareRevision) : 0, /* minLength */ + (softwareRevision != NULL) ? strlen(softwareRevision) : 0, /* maxLength */ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ) { - static bool serviceAdded = false; /* We only add the information service once. */ + static bool serviceAdded = false; /* We should only ever need to add the information service once. */ if (serviceAdded) { return; }
--- a/ble/services/EddystoneConfigService.h Thu Nov 26 12:52:06 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,540 +0,0 @@ -/* mbed Microcontroller Library - * Copyright (c) 2006-2013 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SERVICES_EDDYSTONE_BEACON_CONFIG_SERVICE_H_ -#define SERVICES_EDDYSTONE_BEACON_CONFIG_SERVICE_H_ - -#include "mbed.h" -#include "ble/BLE.h" -#include "ble/services/EddystoneService.h" - -#define UUID_URI_BEACON(FIRST, SECOND) { \ - 0xee, 0x0c, FIRST, SECOND, 0x87, 0x86, 0x40, 0xba, \ - 0xab, 0x96, 0x99, 0xb9, 0x1a, 0xc9, 0x81, 0xd8, \ -} - -static const uint8_t UUID_URI_BEACON_SERVICE[] = UUID_URI_BEACON(0x20, 0x80); -static const uint8_t UUID_LOCK_STATE_CHAR[] = UUID_URI_BEACON(0x20, 0x81); -static const uint8_t UUID_LOCK_CHAR[] = UUID_URI_BEACON(0x20, 0x82); -static const uint8_t UUID_UNLOCK_CHAR[] = UUID_URI_BEACON(0x20, 0x83); -static const uint8_t UUID_URI_DATA_CHAR[] = UUID_URI_BEACON(0x20, 0x84); -static const uint8_t UUID_FLAGS_CHAR[] = UUID_URI_BEACON(0x20, 0x85); -static const uint8_t UUID_ADV_POWER_LEVELS_CHAR[] = UUID_URI_BEACON(0x20, 0x86); -static const uint8_t UUID_TX_POWER_MODE_CHAR[] = UUID_URI_BEACON(0x20, 0x87); -static const uint8_t UUID_BEACON_PERIOD_CHAR[] = UUID_URI_BEACON(0x20, 0x88); -static const uint8_t UUID_RESET_CHAR[] = UUID_URI_BEACON(0x20, 0x89); -extern const uint8_t BEACON_EDDYSTONE[2]; - -/** -* @class EddystoneConfigService -* @brief Eddystone Configuration Service. Can be used to set URL, adjust power levels, and set flags. -* See https://github.com/google/eddystone -* -*/ -class EddystoneConfigService -{ -public: - /** - * @brief Transmission Power Modes for UriBeacon - */ - enum { - TX_POWER_MODE_LOWEST, - TX_POWER_MODE_LOW, - TX_POWER_MODE_MEDIUM, - TX_POWER_MODE_HIGH, - NUM_POWER_MODES - }; - - static const unsigned ADVERTISING_INTERVAL_MSEC = 1000; // Advertising interval for config service. - static const unsigned SERVICE_DATA_MAX = 31; // Maximum size of service data in ADV packets - - typedef uint8_t Lock_t[16]; /* 128 bits */ - typedef int8_t PowerLevels_t[NUM_POWER_MODES]; - - // There are currently 3 subframes defined, URI, UID, and TLM -#define EDDYSTONE_MAX_FRAMETYPE 3 - static const unsigned URI_DATA_MAX = 18; - typedef uint8_t UriData_t[URI_DATA_MAX]; - - // UID Frame Type subfields - static const size_t UID_NAMESPACEID_SIZE = 10; - typedef uint8_t UIDNamespaceID_t[UID_NAMESPACEID_SIZE]; - static const size_t UID_INSTANCEID_SIZE = 6; - typedef uint8_t UIDInstanceID_t[UID_INSTANCEID_SIZE]; - - // Eddystone Frame Type ID - static const uint8_t FRAME_TYPE_UID = 0x00; - static const uint8_t FRAME_TYPE_URL = 0x10; - static const uint8_t FRAME_TYPE_TLM = 0x20; - - static const uint8_t FRAME_SIZE_TLM = 14; // TLM frame is a constant 14Bytes - static const uint8_t FRAME_SIZE_UID = 20; // includes RFU bytes - - struct Params_t { - // Config Data - bool isConfigured; // Flag for configuration being complete, - // True = configured, false = not configured. Reset at instantiation, used for external callbacks. - uint8_t lockedState; - Lock_t lock; - uint8_t flags; - PowerLevels_t advPowerLevels; // Current value of AdvertisedPowerLevels - uint8_t txPowerMode; // Firmware power levels used with setTxPower() - uint16_t beaconPeriod; - // TLM Frame Data - uint8_t tlmVersion; // version of TLM packet - bool tlmEnabled; - float tlmBeaconPeriod; // how often to broadcat TLM frame, in seconds. - // URI Frame Data - uint8_t uriDataLength; - UriData_t uriData; - bool uriEnabled; - float uriBeaconPeriod; // how often to broadcast URIFrame, in seconds. - // UID Frame Data - UIDNamespaceID_t uidNamespaceID; // UUID type, Namespace ID, 10B - UIDInstanceID_t uidInstanceID; // UUID type, Instance ID, 6B - bool uidEnabled; - float uidBeaconPeriod; // how often to broadcast UID Frame, in seconds. - }; - - /** - * @param[ref] ble - * BLEDevice object for the underlying controller. - * @param[in/out] paramsIn - * Reference to application-visible beacon state, loaded - * from persistent storage at startup. - * @param[in] defaultAdvPowerLevelsIn - * Default power-levels array; applies only if the resetToDefaultsFlag is true. - */ - EddystoneConfigService(BLEDevice &bleIn, - Params_t ¶msIn, - PowerLevels_t &defaultAdvPowerLevelsIn, - PowerLevels_t &radioPowerLevelsIn) : - ble(bleIn), - params(paramsIn), // Initialize URL Data - defaultAdvPowerLevels(defaultAdvPowerLevelsIn), - radioPowerLevels(radioPowerLevelsIn), - initSucceeded(false), - resetFlag(), - defaultUidNamespaceID(), // Initialize UID Data - defaultUidInstanceID(), - defaultUidPower(defaultAdvPowerLevelsIn[params.txPowerMode]), - uidIsSet(false), - defaultUriDataLength(), - defaultUriData(), - defaultUrlPower(defaultAdvPowerLevelsIn[params.txPowerMode]), - urlIsSet(false), - tlmIsSet(false), - lockedStateChar(UUID_LOCK_STATE_CHAR, ¶ms.lockedState), - lockChar(UUID_LOCK_CHAR, ¶ms.lock), - uriDataChar(UUID_URI_DATA_CHAR, params.uriData, 0, URI_DATA_MAX, - GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE), - unlockChar(UUID_UNLOCK_CHAR, ¶ms.lock), - flagsChar(UUID_FLAGS_CHAR, ¶ms.flags), - advPowerLevelsChar(UUID_ADV_POWER_LEVELS_CHAR, ¶ms.advPowerLevels), - txPowerModeChar(UUID_TX_POWER_MODE_CHAR, ¶ms.txPowerMode), - beaconPeriodChar(UUID_BEACON_PERIOD_CHAR, ¶ms.beaconPeriod), - resetChar(UUID_RESET_CHAR, &resetFlag) { - // set eddystone as not configured yet. Used to exit config before timeout if GATT services are written to. - params.isConfigured = false; - - lockChar.setWriteAuthorizationCallback(this, &EddystoneConfigService::lockAuthorizationCallback); - unlockChar.setWriteAuthorizationCallback(this, &EddystoneConfigService::unlockAuthorizationCallback); - uriDataChar.setWriteAuthorizationCallback(this, &EddystoneConfigService::uriDataWriteAuthorizationCallback); - flagsChar.setWriteAuthorizationCallback(this, &EddystoneConfigService::basicAuthorizationCallback<uint8_t>); - advPowerLevelsChar.setWriteAuthorizationCallback(this, &EddystoneConfigService::basicAuthorizationCallback<PowerLevels_t>); - txPowerModeChar.setWriteAuthorizationCallback(this, &EddystoneConfigService::powerModeAuthorizationCallback); - beaconPeriodChar.setWriteAuthorizationCallback(this, &EddystoneConfigService::basicAuthorizationCallback<uint16_t>); - resetChar.setWriteAuthorizationCallback(this, &EddystoneConfigService::basicAuthorizationCallback<uint8_t>); - - static GattCharacteristic *charTable[] = { - &lockedStateChar, &lockChar, &unlockChar, &uriDataChar, - &flagsChar, &advPowerLevelsChar, &txPowerModeChar, &beaconPeriodChar, &resetChar - }; - - GattService configService(UUID_URI_BEACON_SERVICE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); - - ble.addService(configService); - ble.onDataWritten(this, &EddystoneConfigService::onDataWrittenCallback); - } - - /** - * @brief Start EddystoneConfig advertising. This function should be called - * after the EddystoneConfig constructor and after all the frames have been added. - * - * @paramsP[in] resetToDefaultsFlag - * Applies to the state of the 'paramsIn' parameter. - * If true, it indicates that paramsIn is potentially - * un-initialized, and default values should be used - * instead. Otherwise, paramsIn overrides the defaults. - */ - void start(bool resetToDefaultsFlag){ - INFO("reset to defaults flag = %d", resetToDefaultsFlag); - if (!resetToDefaultsFlag && (params.uriDataLength > URI_DATA_MAX)) { - INFO("Reset to Defaults triggered"); - resetToDefaultsFlag = true; - } - - if (resetToDefaultsFlag) { - resetToDefaults(); - } else { - updateCharacteristicValues(); - } - - setupEddystoneConfigAdvertisements(); /* Setup advertising for the configService. */ - initSucceeded = true; - } - - /* - * Check if eddystone initialized successfully - */ - bool initSuccessfully(void) const { - return initSucceeded; - } - - /* - * @brief Function to update the default values for the TLM frame. Only applied if Reset Defaults is applied. - * - * @param[in] tlmVersionIn Version of the TLM frame being used - * @param[in] advPeriodInMin how long between TLM frames being advertised, this is measured in minutes. - * - */ - void setDefaultTLMFrameData(uint8_t tlmVersionIn = 0, float advPeriodInSec = 60){ - DBG("Setting Default TLM Data, version = %d, advPeriodInMind= %f", tlmVersionIn, advPeriodInSec); - defaultTlmVersion = tlmVersionIn; - TlmBatteryVoltage = 0; - TlmBeaconTemp = 0x8000; - TlmPduCount = 0; - TlmTimeSinceBoot = 0; - defaultTlmAdvPeriod = advPeriodInSec; - tlmIsSet = true; // flag to add this to eddystone service when config is done - } - - /* - * @brief Function to update the default values for the URI frame. Only applied if Reset Defaults is applied. - * - * @param[in] uriIn url to advertise - * @param[in] advPeriod how long to advertise the url for, measured in number of ADV frames. - * - */ - void setDefaultURIFrameData(const char *uriIn, float advPeriod = 1){ - DBG("Setting Default URI Data"); - // Set URL Frame - EddystoneService::encodeURL(uriIn, defaultUriData, defaultUriDataLength); // encode URL to URL Formatting - if (defaultUriDataLength > URI_DATA_MAX) { - return; - } - INFO("\t URI input = %s : %d", uriIn, defaultUriDataLength); - INFO("\t default URI = %s : %d ", defaultUriData, defaultUriDataLength ); - defaultUriAdvPeriod = advPeriod; - urlIsSet = true; // flag to add this to eddystone service when config is done - } - - /* - * @brief Function to update the default values for the UID frame. Only applied if Reset Defaults is applied. - * - * @param[in] namespaceID 10Byte Namespace ID - * @param[in] instanceID 6Byte Instance ID - * @param[in] advPeriod how long to advertise the URL for, measured in the number of adv frames. - * - */ - void setDefaultUIDFrameData(UIDNamespaceID_t *namespaceID, UIDInstanceID_t *instanceID, float advPeriod = 10){ - //Set UID frame - DBG("Setting default UID Data"); - memcpy(defaultUidNamespaceID, namespaceID, UID_NAMESPACEID_SIZE); - memcpy(defaultUidInstanceID, instanceID, UID_INSTANCEID_SIZE); - defaultUidAdvPeriod = advPeriod; - uidIsSet = true; // flag to add this to eddystone service when config is done - } - - /* Start out by advertising the configService for a limited time after - * startup; and switch to the normal non-connectible beacon functionality - * afterwards. */ - void setupEddystoneConfigAdvertisements() { - const char DEVICE_NAME[] = "eddystone Config"; - - ble.clearAdvertisingPayload(); - - ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); - - // UUID is in different order in the ADV frame (!) - uint8_t reversedServiceUUID[sizeof(UUID_URI_BEACON_SERVICE)]; - for (unsigned int i = 0; i < sizeof(UUID_URI_BEACON_SERVICE); i++) { - reversedServiceUUID[i] = UUID_URI_BEACON_SERVICE[sizeof(UUID_URI_BEACON_SERVICE) - i - 1]; - } - ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS, reversedServiceUUID, sizeof(reversedServiceUUID)); - ble.accumulateAdvertisingPayload(GapAdvertisingData::GENERIC_TAG); - ble.accumulateScanResponse(GapAdvertisingData::COMPLETE_LOCAL_NAME, reinterpret_cast<const uint8_t *>(&DEVICE_NAME), sizeof(DEVICE_NAME)); - ble.accumulateScanResponse( - GapAdvertisingData::TX_POWER_LEVEL, - reinterpret_cast<uint8_t *>(&defaultAdvPowerLevels[EddystoneConfigService::TX_POWER_MODE_LOW]), - sizeof(uint8_t)); - - ble.setTxPower(radioPowerLevels[params.txPowerMode]); - ble.setDeviceName(reinterpret_cast<const uint8_t *>(&DEVICE_NAME)); - ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); - ble.setAdvertisingInterval(ADVERTISING_INTERVAL_MSEC); - } - - /* - * This function actually impliments the Eddystone Beacon service. It can be called with the help of the wrapper function - * to load saved config params, or it can be called explicitly to reset the eddystone beacon to hardcoded values on each reset. - * - */ - void setupEddystoneAdvertisements() { - DBG("Switching Config -> adv"); - // Save params to storage - extern void saveURIBeaconConfigParams(const Params_t *paramsP); /* forward declaration; necessary to avoid a circular dependency. */ - saveURIBeaconConfigParams(¶ms); - INFO("Saved Params to Memory.") - // Setup Eddystone Service - static EddystoneService eddyServ(ble, params.beaconPeriod, radioPowerLevels[params.txPowerMode]); - // Set configured frames (TLM,UID,URI...etc) - if (params.tlmEnabled) { - eddyServ.setTLMFrameData(params.tlmVersion, params.tlmBeaconPeriod); - } - if (params.uriEnabled) { - eddyServ.setURLFrameEncodedData(params.advPowerLevels[params.txPowerMode], (const char *) params.uriData, params.uriDataLength, params.uriBeaconPeriod); - } - if (params.uidEnabled) { - eddyServ.setUIDFrameData(params.advPowerLevels[params.txPowerMode], - (uint8_t *)params.uidNamespaceID, - (uint8_t *)params.uidInstanceID, - params.uidBeaconPeriod); - } - // Start Advertising the eddystone service. - eddyServ.start(); - } - -private: - /* - * This callback is invoked when a GATT client attempts to modify any of the - * characteristics of this service. Attempts to do so are also applied to - * the internal state of this service object. - */ - void onDataWrittenCallback(const GattWriteCallbackParams *writeParams) { - uint16_t handle = writeParams->handle; - - if (handle == lockChar.getValueHandle()) { - // Validated earlier - memcpy(params.lock, writeParams->data, sizeof(Lock_t)); - // Set the state to be locked by the lock code (note: zeros are a valid lock) - params.lockedState = true; - INFO("Device Locked"); - } else if (handle == unlockChar.getValueHandle()) { - // Validated earlier - params.lockedState = false; - INFO("Device Unlocked"); - } else if (handle == uriDataChar.getValueHandle()) { - params.uriDataLength = writeParams->len; - memset(params.uriData, 0x00, URI_DATA_MAX); // clear URI string - memcpy(params.uriData, writeParams->data, writeParams->len); // set URI string - params.uriEnabled = true; - INFO("URI = %s, URILen = %d", writeParams->data, writeParams->len); - } else if (handle == flagsChar.getValueHandle()) { - params.flags = *(writeParams->data); - INFO("flagsChar = 0x%x", params.flags); - } else if (handle == advPowerLevelsChar.getValueHandle()) { - memcpy(params.advPowerLevels, writeParams->data, sizeof(PowerLevels_t)); - INFO("PowerLevelsChar = %4x", params.advPowerLevels); - } else if (handle == txPowerModeChar.getValueHandle()) { - params.txPowerMode = *(writeParams->data); - INFO("TxPowerModeChar = %d", params.txPowerMode); - } else if (handle == beaconPeriodChar.getValueHandle()) { - params.beaconPeriod = *((uint16_t *)(writeParams->data)); - INFO("BeaconPeriod = %d", params.beaconPeriod); - - /* Re-map beaconPeriod to within permissible bounds if necessary. */ - if (params.beaconPeriod != 0) { - bool paramsUpdated = false; - if (params.beaconPeriod < ble.getMinAdvertisingInterval()) { - params.beaconPeriod = ble.getMinAdvertisingInterval(); - paramsUpdated = true; - } else if (params.beaconPeriod > ble.getMaxAdvertisingInterval()) { - params.beaconPeriod = ble.getMaxAdvertisingInterval(); - paramsUpdated = true; - } - if (paramsUpdated) { - ble.updateCharacteristicValue(beaconPeriodChar.getValueHandle(), reinterpret_cast<uint8_t *>(¶ms.beaconPeriod), sizeof(uint16_t)); - } - } - } else if (handle == resetChar.getValueHandle()) { - INFO("Reset triggered from Config Service, resetting to defaults"); - resetToDefaults(); - } - updateCharacteristicValues(); - params.isConfigured = true; // some configuration data has been passed, on disconnect switch to advertising mode. - } - - /* - * Reset the default values. - */ - void resetToDefaults(void) { - INFO("Resetting to defaults"); - // General - params.lockedState = false; - memset(params.lock, 0, sizeof(Lock_t)); - params.flags = 0x10; - memcpy(params.advPowerLevels, defaultAdvPowerLevels, sizeof(PowerLevels_t)); - params.txPowerMode = TX_POWER_MODE_LOW; - params.beaconPeriod = (uint16_t) defaultUriAdvPeriod * 1000; - - // TLM Frame - params.tlmVersion = defaultTlmVersion; - params.tlmBeaconPeriod = defaultTlmAdvPeriod; - params.tlmEnabled = tlmIsSet; - - // URL Frame - memcpy(params.uriData, defaultUriData, URI_DATA_MAX); - params.uriDataLength = defaultUriDataLength; - params.uriBeaconPeriod = defaultUriAdvPeriod; - params.uriEnabled = urlIsSet; - - // UID Frame - memcpy(params.uidNamespaceID, defaultUidNamespaceID, UID_NAMESPACEID_SIZE); - memcpy(params.uidInstanceID, defaultUidInstanceID, UID_INSTANCEID_SIZE); - params.uidBeaconPeriod = defaultUidAdvPeriod; - params.uidEnabled = uidIsSet; - - updateCharacteristicValues(); - } - - /* - * Internal helper function used to update the GATT database following any - * change to the internal state of the service object. - */ - void updateCharacteristicValues(void) { - ble.updateCharacteristicValue(lockedStateChar.getValueHandle(), ¶ms.lockedState, 1); - ble.updateCharacteristicValue(uriDataChar.getValueHandle(), params.uriData, params.uriDataLength); - ble.updateCharacteristicValue(flagsChar.getValueHandle(), ¶ms.flags, 1); - ble.updateCharacteristicValue(beaconPeriodChar.getValueHandle(), - reinterpret_cast<uint8_t *>(¶ms.beaconPeriod), sizeof(uint16_t)); - ble.updateCharacteristicValue(txPowerModeChar.getValueHandle(), ¶ms.txPowerMode, 1); - ble.updateCharacteristicValue(advPowerLevelsChar.getValueHandle(), - reinterpret_cast<uint8_t *>(params.advPowerLevels), sizeof(PowerLevels_t)); - } - -private: - void lockAuthorizationCallback(GattWriteAuthCallbackParams *authParams) { - if (params.lockedState) { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHORIZATION; - } else if (authParams->len != sizeof(Lock_t)) { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_INVALID_ATT_VAL_LENGTH; - } else if (authParams->offset != 0) { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_INVALID_OFFSET; - } else { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS; - } - } - - void unlockAuthorizationCallback(GattWriteAuthCallbackParams *authParams) { - if ((!params.lockedState) && (authParams->len == sizeof(Lock_t))) { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS; - } else if (authParams->len != sizeof(Lock_t)) { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_INVALID_ATT_VAL_LENGTH; - } else if (authParams->offset != 0) { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_INVALID_OFFSET; - } else if (memcmp(authParams->data, params.lock, sizeof(Lock_t)) != 0) { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHORIZATION; - } else { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS; - } - } - - void uriDataWriteAuthorizationCallback(GattWriteAuthCallbackParams *authParams) { - if (params.lockedState) { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHORIZATION; - } else if (authParams->offset != 0) { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_INVALID_OFFSET; - } else { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS; - } - } - - void powerModeAuthorizationCallback(GattWriteAuthCallbackParams *authParams) { - if (params.lockedState) { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHORIZATION; - } else if (authParams->len != sizeof(uint8_t)) { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_INVALID_ATT_VAL_LENGTH; - } else if (authParams->offset != 0) { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_INVALID_OFFSET; - } else if (*((uint8_t *)authParams->data) >= NUM_POWER_MODES) { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_WRITE_NOT_PERMITTED; - } else { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS; - } - } - - template <typename T> - void basicAuthorizationCallback(GattWriteAuthCallbackParams *authParams) { - if (params.lockedState) { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHORIZATION; - } else if (authParams->len != sizeof(T)) { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_INVALID_ATT_VAL_LENGTH; - } else if (authParams->offset != 0) { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_ATTERR_INVALID_OFFSET; - } else { - authParams->authorizationReply = AUTH_CALLBACK_REPLY_SUCCESS; - } - } - - BLEDevice &ble; - Params_t ¶ms; - Ticker timeSinceBootTick; - Timeout switchFrame; - // Default value that is restored on reset - PowerLevels_t &defaultAdvPowerLevels; // this goes into the advertising frames (radio power measured at 1m from device) - PowerLevels_t &radioPowerLevels; // this configures the power levels of the radio - uint8_t lockedState; - bool initSucceeded; - uint8_t resetFlag; - bool switchFlag; - - //UID Default value that is restored on reset - UIDNamespaceID_t defaultUidNamespaceID; - UIDInstanceID_t defaultUidInstanceID; - float defaultUidAdvPeriod; - int8_t defaultUidPower; - uint16_t uidRFU; - bool uidIsSet; - - //URI Default value that is restored on reset - uint8_t defaultUriDataLength; - UriData_t defaultUriData; - int8_t defaultUrlPower; - float defaultUriAdvPeriod; - bool urlIsSet; - - //TLM Default value that is restored on reset - uint8_t defaultTlmVersion; - float defaultTlmAdvPeriod; - volatile uint16_t TlmBatteryVoltage; - volatile uint16_t TlmBeaconTemp; - volatile uint32_t TlmPduCount; - volatile uint32_t TlmTimeSinceBoot; - bool tlmIsSet; - - ReadOnlyGattCharacteristic<uint8_t> lockedStateChar; - WriteOnlyGattCharacteristic<Lock_t> lockChar; - GattCharacteristic uriDataChar; - WriteOnlyGattCharacteristic<Lock_t> unlockChar; - ReadWriteGattCharacteristic<uint8_t> flagsChar; - ReadWriteGattCharacteristic<PowerLevels_t> advPowerLevelsChar; - ReadWriteGattCharacteristic<uint8_t> txPowerModeChar; - ReadWriteGattCharacteristic<uint16_t> beaconPeriodChar; - WriteOnlyGattCharacteristic<uint8_t> resetChar; -}; - -#endif // SERVICES_EDDYSTONE_BEACON_CONFIG_SERVICE_H_ \ No newline at end of file
--- a/ble/services/EddystoneService.h Thu Nov 26 12:52:06 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,651 +0,0 @@ -/* mbed Microcontroller Library - * Copyright (c) 2006-2015 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SERVICES_EDDYSTONEBEACON_H_ -#define SERVICES_EDDYSTONEBEACON_H_ - -#include "ble/BLE.h" -#include "mbed.h" -#include "CircularBuffer.h" -static const uint8_t BEACON_EDDYSTONE[] = {0xAA, 0xFE}; - -//Debug is disabled by default -#if 0 -#define DBG(MSG, ...) printf("[EddyStone: DBG]" MSG " \t[%s,%d]\r\n", \ - ## __VA_ARGS__, \ - __FILE__, \ - __LINE__); -#define WARN(MSG, ...) printf("[EddyStone: WARN]" MSG " \t[%s,%d]\r\n", \ - ## __VA_ARGS__, \ - __FILE__, \ - __LINE__); -#define ERR(MSG, ...) printf("[EddyStone: ERR]" MSG " \t[%s,%d]\r\n", \ - ## __VA_ARGS__, \ - __FILE__, \ - __LINE__); -#else // if 0 -#define DBG(x, ...) //wait_us(10); -#define WARN(x, ...) //wait_us(10); -#define ERR(x, ...) -#endif // if 0 - -#if 0 -#define INFO(x, ...) printf("[EddyStone: INFO]"x " \t[%s,%d]\r\n", \ - ## __VA_ARGS__, \ - __FILE__, \ - __LINE__); -#else // if 0 -#define INFO(x, ...) -#endif // if 0 - -/** -* @class Eddystone -* @brief Eddystone Configuration Service. Can be used to set URL, adjust power levels, and set flags. -* See https://github.com/google/eddystone -* -*/ -class EddystoneService -{ -public: - enum FrameTypes { - NONE, - url, - uid, - tlm - }; - - static const int SERVICE_DATA_MAX = 31; // Maximum size of service data in ADV packets - - // There are currently 3 subframes defined, URI, UID, and TLM -#define EDDYSTONE_MAX_FRAMETYPE 3 - void (*frames[EDDYSTONE_MAX_FRAMETYPE])(uint8_t *, uint32_t); - static const int URI_DATA_MAX = 18; - typedef uint8_t UriData_t[URI_DATA_MAX]; - CircularBuffer<FrameTypes, EDDYSTONE_MAX_FRAMETYPE> overflow; - - // UID Frame Type subfields - static const int UID_NAMESPACEID_SIZE = 10; - typedef uint8_t UIDNamespaceID_t[UID_NAMESPACEID_SIZE]; - static const int UID_INSTANCEID_SIZE = 6; - typedef uint8_t UIDInstanceID_t[UID_INSTANCEID_SIZE]; - - // Eddystone Frame Type ID - static const uint8_t FRAME_TYPE_UID = 0x00; - static const uint8_t FRAME_TYPE_URL = 0x10; - static const uint8_t FRAME_TYPE_TLM = 0x20; - - static const uint8_t FRAME_SIZE_TLM = 14; // TLM frame is a constant 14Bytes - static const uint8_t FRAME_SIZE_UID = 20; // includes RFU bytes - - /** - * Set Eddystone UID Frame information. - * - * @param[in] power TX Power in dB measured at 0 meters from the device. Range of -100 to +20 dB. - * @param[in] namespaceID 10B namespace ID - * @param[in] instanceID 6B instance ID - * @param[in] RFU 2B of RFU, initialized to 0x0000 and not broadcast, included for future reference. - */ - void setUIDFrameData(int8_t power, - UIDNamespaceID_t namespaceID, - UIDInstanceID_t instanceID, - float uidAdvPeriodIn, - uint16_t RFU = 0x0000) { - if (0.0f == uidAdvPeriodIn) { - uidIsSet = false; - return; - } - if (power > 20) { - power = 20; - } - if (power < -100) { - power = -100; - } - - defaultUidPower = power; - memcpy(defaultUidNamespaceID, namespaceID, UID_NAMESPACEID_SIZE); - memcpy(defaultUidInstanceID, instanceID, UID_INSTANCEID_SIZE); - uidRFU = (uint16_t)RFU; // this is probably bad form, but it doesn't really matter yet. - uidAdvPeriod = uidAdvPeriodIn; - uidIsSet = true; // set toggle to advertise UID frames - } - - /* - * Construct UID frame from private variables - * @param[in/out] Data pointer to array to store constructed frame in - * @param[in] maxSize number of bytes left in array, effectively how much empty space is available to write to - * @return number of bytes used. negative number indicates error message. - */ - unsigned constructUIDFrame(uint8_t *Data, uint8_t maxSize) { - unsigned index = 0; - - Data[index++] = FRAME_TYPE_UID; // 1B Type - - if (defaultUidPower > 20) { - defaultUidPower = 20; // enforce range of vaild values. - } - if (defaultUidPower < -100) { - defaultUidPower = -100; - } - Data[index++] = defaultUidPower; // 1B Power @ 0meter - - DBG("UID NamespaceID = '0x"); - for (size_t x = 0; x < UID_NAMESPACEID_SIZE; x++) { // 10B Namespace ID - Data[index++] = defaultUidNamespaceID[x]; - DBG("%x,", defaultUidNamespaceID[x]); - } - DBG("'\r\n"); - - DBG("UID InstanceID = '0x"); - for (size_t x = 0; x< UID_INSTANCEID_SIZE; x++) { // 6B Instance ID - Data[index++] = defaultUidInstanceID[x]; - DBG("%x,", defaultUidInstanceID[x]); - } - DBG("'\r\n"); - - if (0 != uidRFU) { // 2B RFU, include if non-zero, otherwise ignore - Data[index++] = (uint8_t)(uidRFU >> 0); - Data[index++] = (uint8_t)(uidRFU >> 8); - } - DBG("construcUIDFrame %d, %d", maxSize, index); - return index; - } - - /** - * Set Eddystone URL Frame information. - * @param[in] power TX Power in dB measured at 0 meters from the device. - * @param[in] url URL to encode - * @param[in] urlAdvPeriodIn How long to advertise the URL frame (measured in # of adv periods) - * @return false on success, true on failure. - */ - bool setURLFrameData(int8_t power, const char *urlIn, float urlAdvPeriodIn) { - if (0.0f == urlAdvPeriodIn) { - urlIsSet = false; - return false; - } - encodeURL(urlIn, defaultUriData, defaultUriDataLength); // encode URL to URL Formatting - if (defaultUriDataLength > URI_DATA_MAX) { - return true; // error, URL is too big - } - defaultUrlPower = power; - urlAdvPeriod = urlAdvPeriodIn; - urlIsSet = true; - return false; - } - - /** - * Set Eddystone URL Frame information. - * @param[in] power TX Power in dB measured at 0 meters from the device. - * @param[in] encodedUrlIn Encoded URL - * @param[in] encodedUrlInLength Length of the encoded URL - * @param[in] urlAdvPeriodIn How long to advertise the URL frame (measured in # of adv periods) - * @return false on success, true on failure. - */ - bool setURLFrameEncodedData(int8_t power, const char *encodedUrlIn, uint8_t encodedUrlInLength, float urlAdvPeriodIn) { - if (0.0f == urlAdvPeriodIn) { - urlIsSet = false; - return false; - } - memcpy(defaultUriData, encodedUrlIn, encodedUrlInLength); - if (defaultUriDataLength > URI_DATA_MAX) { - return true; // error, URL is too big - } - defaultUrlPower = power; - defaultUriDataLength = encodedUrlInLength; - urlAdvPeriod = urlAdvPeriodIn; - urlIsSet = true; - return false; - } - - /* - * Construct URL frame from private variables - * @param[in/out] Data pointer to array to store constructed frame in - * @param[in] maxSize number of bytes left in array, effectively how much emtpy space is available to write to - * @return number of bytes used. negative number indicates error message. - */ - int constructURLFrame(uint8_t *Data, uint8_t maxSize) { - int index = 0; - Data[index++] = FRAME_TYPE_URL; // 1B Type - Data[index++] = defaultUrlPower; // 1B TX Power - for (int x = 0; x < defaultUriDataLength; x++) { // 18B of URL Prefix + encoded URL - Data[index++] = defaultUriData[x]; - } - DBG("constructURLFrame: %d, %d", maxSize, index); - return index; - } - - /* - * Set Eddystone TLM Frame information. - * @param[in] Version of the TLM beacon data format - * @param[in] advPeriod how often to advertise the TLM frame for (in minutes) - * @param batteryVoltage in milivolts - * @param beaconTemp in 8.8 floating point notation - * - */ - void setTLMFrameData(uint8_t version = 0, - float advPeriod = 60.0f, - uint16_t batteryVoltage = 0, - uint16_t beaconTemp = 0x8000, - uint32_t pduCount = 0, - uint32_t timeSinceBoot = 0) { - if (0.0f == advPeriod) { - tlmIsSet = false; - return; - } - TlmVersion = version; - TlmBatteryVoltage = batteryVoltage; - TlmBeaconTemp = beaconTemp; - TlmPduCount = pduCount; // reset - TlmTimeSinceBoot = timeSinceBoot; // reset - TlmAdvPeriod = advPeriod; - tlmIsSet = true; // TLM Data has been enabled - } - - /* - * Construct TLM frame from private variables - * @param[in/out] Data pointer to array to store constructed frame in - * @param[in] maxSize number of bytes left in array, effectively how much emtpy space is available to write to - * @return number of bytes used. negative number indicates error message. - */ - int constructTLMFrame(uint8_t *Data, uint8_t maxSize) { - uint32_t now = timeSinceBootTimer.read_ms(); - TlmTimeSinceBoot += (now - lastBootTimerRead) / 100; - lastBootTimerRead = now; - - int index = 0; - Data[index++] = FRAME_TYPE_TLM; // Eddystone frame type = Telemetry - Data[index++] = TlmVersion; // TLM Version Number - Data[index++] = (uint8_t)(TlmBatteryVoltage >> 8); // Battery Voltage[0] - Data[index++] = (uint8_t)(TlmBatteryVoltage >> 0); // Battery Voltage[1] - Data[index++] = (uint8_t)(TlmBeaconTemp >> 8); // Beacon Temp[0] - Data[index++] = (uint8_t)(TlmBeaconTemp >> 0); // Beacon Temp[1] - Data[index++] = (uint8_t)(TlmPduCount >> 24); // PDU Count [0] - Data[index++] = (uint8_t)(TlmPduCount >> 16); // PDU Count [1] - Data[index++] = (uint8_t)(TlmPduCount >> 8); // PDU Count [2] - Data[index++] = (uint8_t)(TlmPduCount >> 0); // PDU Count [3] - Data[index++] = (uint8_t)(TlmTimeSinceBoot >> 24); // Time Since Boot [0] - Data[index++] = (uint8_t)(TlmTimeSinceBoot >> 16); // Time Since Boot [1] - Data[index++] = (uint8_t)(TlmTimeSinceBoot >> 8); // Time Since Boot [2] - Data[index++] = (uint8_t)(TlmTimeSinceBoot >> 0); // Time Since Boot [3] - DBG("constructURLFrame: %d, %d", maxSize, index); - return index; - } - - /* - * Update the TLM frame battery voltage value - * @param[in] voltagemv Voltage to update the TLM field battery voltage with (in mV) - * @return nothing - */ - void updateTlmBatteryVoltage(uint16_t voltagemv) { - TlmBatteryVoltage = voltagemv; - } - - /* - * Update the TLM frame beacon temperature - * @param[in] temp Temperature of beacon (in 8.8fpn) - * @return nothing - */ - void updateTlmBeaconTemp(uint16_t temp) { - TlmBeaconTemp = temp; - } - - /* - * Update the TLM frame PDU Count field - * @param[in] pduCount Number of Advertisiting frames sent since powerup - * @return nothing - */ - void updateTlmPduCount(uint32_t pduCount) { - TlmPduCount = pduCount; - } - - /* - * Update the TLM frame Time since boot in 0.1s incriments - * @param[in] timeSinceBoot Time since boot in 0.1s incriments - * @return nothing - */ - void updateTlmTimeSinceBoot(uint32_t timeSinceBoot) { - TlmTimeSinceBoot = timeSinceBoot; - } - - /* - * Update advertising data - * @return true on success, false on failure - */ - bool updateAdvPacket(uint8_t serviceData[], unsigned serviceDataLen) { - // Fields from the Service - DBG("Updating AdvFrame: %d", serviceDataLen); - - ble.clearAdvertisingPayload(); - ble.setAdvertisingType(GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED); - ble.setAdvertisingInterval(100); - ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); - ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, BEACON_EDDYSTONE, sizeof(BEACON_EDDYSTONE)); - ble.accumulateAdvertisingPayload(GapAdvertisingData::SERVICE_DATA, serviceData, serviceDataLen); - - - return true; - } - - /* - * State machine for switching out frames. - * This function is called by the radioNotificationCallback when a frame needs to get swapped out. - * This function exists because of time constraints in the radioNotificationCallback, so it is effectively - * broken up into two functions. - */ - void swapOutFrames(FrameTypes frameType) { - uint8_t serviceData[SERVICE_DATA_MAX]; - unsigned serviceDataLen = 0; - //hard code in the eddystone UUID - serviceData[serviceDataLen++] = BEACON_EDDYSTONE[0]; - serviceData[serviceDataLen++] = BEACON_EDDYSTONE[1]; - - // if certain frames are not enabled, then skip them. Worst case TLM is always enabled - switch (frameType) { - case tlm: - // TLM frame - if (tlmIsSet) { - DBG("Swapping in TLM Frame: version=%x, Batt=%d, Temp = %d, PDUCnt = %d, TimeSinceBoot=%d", - TlmVersion, - TlmBatteryVoltage, - TlmBeaconTemp, - TlmPduCount, - TlmTimeSinceBoot); - serviceDataLen += constructTLMFrame(serviceData + serviceDataLen, 20); - DBG("\t Swapping in TLM Frame: len=%d", serviceDataLen); - updateAdvPacket(serviceData, serviceDataLen); - } - break; - case url: - // URL Frame - if (urlIsSet) { - DBG("Swapping in URL Frame: Power: %d", defaultUrlPower); - serviceDataLen += constructURLFrame(serviceData + serviceDataLen, 20); - DBG("\t Swapping in URL Frame: len=%d ", serviceDataLen); - updateAdvPacket(serviceData, serviceDataLen); - //switchFlag = false; - } - break; - case uid: - // UID Frame - if (uidIsSet) { - DBG("Swapping in UID Frame: Power: %d", defaultUidPower); - serviceDataLen += constructUIDFrame(serviceData + serviceDataLen, 20); - DBG("\t Swapping in UID Frame: len=%d", serviceDataLen); - updateAdvPacket(serviceData, serviceDataLen); - //switchFlag = false; - } - break; - default: - ERR("You have not initialized a Frame yet, please initialize one before starting a beacon"); - ERR("uidIsSet = %d, urlIsSet = %d, tlmIsSet = %d", uidIsSet, urlIsSet, tlmIsSet); - } - } - - /* - * Callback to swap in URL frame - */ - void urlCallback(void) { - DBG("urlCallback"); - if (false == advLock) { - advLock = true; - DBG("advLock = url") - frameIndex = url; - swapOutFrames(frameIndex); - ble.startAdvertising(); - } else { - // Someone else is broadcasting, toss it into the overflow buffer to retransmit when free - INFO("URI(%d) cannot complete, %d is currently broadcasting", url, frameIndex); - FrameTypes x = url; - overflow.push(x); - } - } - - /* - * Callback to swap in UID frame - */ - void uidCallback(void) { - DBG("uidCallback"); - if (false == advLock) { - advLock = true; - DBG("advLock = uid") - frameIndex = uid; - swapOutFrames(frameIndex); - ble.startAdvertising(); - } else { - // Someone else is broadcasting, toss it into the overflow buffer to retransmit when free - INFO("UID(%d) cannot complete, %d is currently broadcasting", uid, frameIndex); - FrameTypes x = uid; // have to do this to satisfy cont vs volatile keywords... sigh... - overflow.push(x); - } - } - - /* - * Callback to swap in TLM frame - */ - void tlmCallback(void) { - DBG("tlmCallback"); - if (false == advLock) { - // OK to broadcast - advLock = true; - DBG("advLock = tlm") - frameIndex = tlm; - swapOutFrames(frameIndex); - ble.startAdvertising(); - } else { - // Someone else is broadcasting, toss it into the overflow buffer to retransmit when free - INFO("TLM(%d) cannot complete, %d is currently broadcasting", tlm, frameIndex); - FrameTypes x = tlm; - overflow.push(x); - } - } - - void stopAdvCallback(void) { - if (overflow.empty()) { - // if nothing left to transmit, stop - ble.stopAdvertising(); - advLock = false; // unlock lock - } else { - // transmit other packets at current time index - FrameTypes x = NONE; - overflow.pop(x); - INFO("Re-Transmitting %d", x); - swapOutFrames(x); - } - } - - /* - * Callback from onRadioNotification(), used to update the PDUCounter and process next state. - */ -#define EDDYSTONE_SWAPFRAME_DELAYMS 1 - void radioNotificationCallback(bool radioActive) { - // Update PDUCount - TlmPduCount++; - // True just before an frame is sent, false just after a frame is sent - if (radioActive) { - // Do Nothing - } else { - // Packet has been sent, disable advertising - stopAdv.attach_us(this, &EddystoneService::stopAdvCallback, 1); - } - } - - /* - * This function explicityly sets the parameters used by the Eddystone beacon. - * this function should be used in leu of the config service. - * - * @param bleIn ble object used to broadcast eddystone information - * @param beaconPeriodus is how often ble broadcasts are mde, in mili seconds - * @param txPowerLevel sets the broadcasting power level. - * - */ - EddystoneService(BLEDevice &bleIn, - uint16_t beaconPeriodus = 100, - uint8_t txPowerIn = 0) : - ble(bleIn), - advPeriodus(beaconPeriodus), - txPower(txPowerIn), - advLock(false), - frameIndex(NONE) { - } - - /* - * @breif this function starts eddystone advertising based on configured frames. - */ - void start(void) { - // Initialize Frame transition, start with URL to pass eddystone validator app on first try - if (urlIsSet) { - frameIndex = url; - urlTicker.attach(this, &EddystoneService::urlCallback, (float) advPeriodus / 1000.0f); - DBG("attached urlCallback every %d seconds", urlAdvPeriod); - } - if (uidIsSet) { - frameIndex = uid; - uidTicker.attach(this, &EddystoneService::uidCallback, uidAdvPeriod); - DBG("attached uidCallback every %d seconds", uidAdvPeriod); - } - if (tlmIsSet) { - frameIndex = tlm; - // Make double sure the PDUCount and TimeSinceBoot fields are set to zero at reset - updateTlmPduCount(0); - updateTlmTimeSinceBoot(0); - lastBootTimerRead = 0; - timeSinceBootTimer.start(); - tlmTicker.attach(this, &EddystoneService::tlmCallback, TlmAdvPeriod); - DBG("attached tlmCallback every %d seconds", TlmAdvPeriod); - } - if (NONE == frameIndex) { - error("No Frames were Initialized! Please initialize a frame before starting an eddystone beacon."); - } - //uidRFU = 0; - - ble.setTxPower(txPower); - ble.gap().onRadioNotification(this, &EddystoneService::radioNotificationCallback); - } - -private: - - // Eddystone Variables - BLEDevice &ble; - uint16_t advPeriodus; - uint8_t txPower; - Timer timeSinceBootTimer; - volatile uint32_t lastBootTimerRead; - volatile bool advLock; - volatile FrameTypes frameIndex; - Timeout stopAdv; - - - // URI Frame Variables - uint8_t defaultUriDataLength; - UriData_t defaultUriData; - int8_t defaultUrlPower; - bool urlIsSet; // flag that enables / disable URI Frames - float urlAdvPeriod; // how long the url frame will be advertised for - Ticker urlTicker; - - // UID Frame Variables - UIDNamespaceID_t defaultUidNamespaceID; - UIDInstanceID_t defaultUidInstanceID; - int8_t defaultUidPower; - uint16_t uidRFU; - bool uidIsSet; // flag that enables / disable UID Frames - float uidAdvPeriod; // how long the uid frame will be advertised for - Ticker uidTicker; - - // TLM Frame Variables - uint8_t TlmVersion; - volatile uint16_t TlmBatteryVoltage; - volatile uint16_t TlmBeaconTemp; - volatile uint32_t TlmPduCount; - volatile uint32_t TlmTimeSinceBoot; - bool tlmIsSet; // flag that enables / disables TLM frames - float TlmAdvPeriod; // number of minutes between adv frames - Ticker tlmTicker; - -public: - /* - * Encode a human-readable URI into the binary format defined by URIBeacon spec (https://github.com/google/uribeacon/tree/master/specification). - */ - static void encodeURL(const char *uriDataIn, UriData_t uriDataOut, uint8_t &sizeofURIDataOut) { - DBG("Encode URL = %s", uriDataIn); - const char *prefixes[] = { - "http://www.", - "https://www.", - "http://", - "https://", - }; - const size_t NUM_PREFIXES = sizeof(prefixes) / sizeof(char *); - const char *suffixes[] = { - ".com/", - ".org/", - ".edu/", - ".net/", - ".info/", - ".biz/", - ".gov/", - ".com", - ".org", - ".edu", - ".net", - ".info", - ".biz", - ".gov" - }; - const size_t NUM_SUFFIXES = sizeof(suffixes) / sizeof(char *); - - sizeofURIDataOut = 0; - memset(uriDataOut, 0, sizeof(UriData_t)); - - if ((uriDataIn == NULL) || (strlen(uriDataIn) == 0)) { - return; - } - - /* - * handle prefix - */ - for (unsigned i = 0; i < NUM_PREFIXES; i++) { - size_t prefixLen = strlen(prefixes[i]); - if (strncmp(uriDataIn, prefixes[i], prefixLen) == 0) { - uriDataOut[sizeofURIDataOut++] = i; - uriDataIn += prefixLen; - break; - } - } - - /* - * handle suffixes - */ - while (*uriDataIn && (sizeofURIDataOut < URI_DATA_MAX)) { - /* check for suffix match */ - unsigned i; - for (i = 0; i < NUM_SUFFIXES; i++) { - size_t suffixLen = strlen(suffixes[i]); - if (strncmp(uriDataIn, suffixes[i], suffixLen) == 0) { - uriDataOut[sizeofURIDataOut++] = i; - uriDataIn += suffixLen; - break; /* from the for loop for checking against suffixes */ - } - } - /* This is the default case where we've got an ordinary character which doesn't match a suffix. */ - INFO("Encoding URI: No Suffix Found"); - if (i == NUM_SUFFIXES) { - uriDataOut[sizeofURIDataOut++] = *uriDataIn; - ++uriDataIn; - } - } - } -}; - -#endif // SERVICES_EDDYSTONEBEACON_H_ \ No newline at end of file
--- a/module.json Thu Nov 26 12:52:06 2015 +0000 +++ b/module.json Thu Nov 26 12:52:06 2015 +0000 @@ -1,6 +1,6 @@ { "name": "ble", - "version": "2.0.4", + "version": "2.0.5", "description": "The BLE module offers a high level abstraction for using Bluetooth Low Energy on multiple platforms.", "keywords": [ "Bluetooth",