High level Bluetooth Low Energy API and radio abstraction layer
Fork of BLE_API by
Revision 1042:21a86ac7f5b1, committed 2016-01-11
- Comitter:
- vcoubard
- Date:
- Mon Jan 11 08:51:25 2016 +0000
- Parent:
- 1041:bfc5b9b6ecf5
- Child:
- 1043:18094711b012
- Commit message:
- Synchronized with git rev 582789ea
Author: Vincent Coubard
Add function template makeFunctionPointer wich help to create
FunctionPointerWithContext<ContextType> instances.
Changed in this revision
--- a/.gitignore Thu Dec 10 09:15:05 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -# Ignore the generated Doxygen output -apidoc/ \ No newline at end of file
--- a/CONTRIBUTING.md Thu Dec 10 09:15:05 2015 +0000 +++ b/CONTRIBUTING.md Mon Jan 11 08:51:25 2016 +0000 @@ -1,7 +1,7 @@ # Hello! -We are an open source project of [ARM mbed](https://www.mbed.com). Contributions via [pull request](https://github.com/ARMmbed/ble/pulls), and [bug reports](https://github.com/ARMmbed/ble/issues) are welcome! +We are an open source project of [ARM mbed](www.mbed.com). Contributions via [pull request](https://github.com/armmbed/yotta/pulls), and [bug reports](https://github.com/armmbed/yotta/issues) are welcome! -Please submit your pull request to the `develop` branch of [this module](https://github.com/ARMmbed/ble/tree/develop). Commits to develop will be merge into the master branch at the time of the next release. +Please submit your pull request to the 'develop' branch of this module. Commits to develop will merge into master at the time of the next release. # Contributor agreement -For your pull request to be accepted, we will need you to agree to our [contributor agreement](https://developer.mbed.org/contributor_agreement/) to give us the necessary rights to use and distribute your contributions. (To click through the agreement create an account on mbed.com and log in.) \ No newline at end of file +For your pull request to be accepted, we will need you to agree to our [contributor agreement](http://developer.mbed.org/contributor_agreement/) to give us the necessary rights to use and distribute your contributions. (To click through the agreement create an account on mbed.com and log in.) \ No newline at end of file
--- a/DOXYGEN_FRONTPAGE.md Thu Dec 10 09:15:05 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -# BLE API {#mainpage} - -The BLE module within mbed OS offers a high abstraction level for using -Bluetooth Low Energy on multiple platforms. - -This documentation describes the internal structure of the mbed -[BLE API](https://github.com/armmbed/ble). - -For getting started with BLE on mbed, check our [introduction -page](https://docs.mbed.com/docs/ble-intros/en/latest/). - -For mbed OS examples using BLE, check [this -repository](https://github.com/armmbed/ble-examples). For mbed-classic -examples, please refer to [code under mbed.org](https://developer.mbed.org/teams/Bluetooth-Low-Energy/code/). - -## Supported Services - -Currently supported reference services include: - -* [Battery](@ref BatteryService) -* [Device Firmware Update (DFU)](@ref DFUService) -* [Device Information](@ref DeviceInformationService) -* [Health Thermometer](@ref HealthThermometerService) -* [Heart Rate](@ref HeartRateService) -* [UART](@ref UARTService) -* [UriBeacon](@ref URIBeaconConfigService) -* [iBeacon](@ref iBeacon) - -The [documentation](https://docs.mbed.com/docs/ble-intros/en/latest/AdvSamples/Overview/) -contains an overview on how to create new, application-specific services. \ No newline at end of file
--- a/README.md Thu Dec 10 09:15:05 2015 +0000 +++ b/README.md Mon Jan 11 08:51:25 2016 +0000 @@ -1,28 +1,21 @@ # mbed Bluetooth Low Energy Stack -This is the Github repo for the `BLE_API` used by developer.mbed.org. Please see the [mbed BLE Homepage](https://developer.mbed.org/teams/Bluetooth-Low-Energy/) for all documentation, code examples and general help. +This is the github repo for the BLE_API used by developer.mbed.org. Please see [mbed BLE Homepage](http://developer.mbed.org/teams/Bluetooth-Low-Energy/) for all documentation, code examples and general help. # Supported Services -Supported GATT services and constantly being added and can be found in the [ble/services/](https://github.com/ARMmbed/ble/tree/master/ble/services) folder. - -Currently supported services include: -* Battery +Supported GATT services and constantly being added and can be found in the /services folder. +Currently supported services include: +* Battery * Device Firmware Update (DFU) -* Device Information -* Eddystone Configuration Service +* Device Information * Health Thermometer * Heart Rate -* Link Loss * UART * UriBeacon * iBeacon -The [documentation](https://docs.mbed.com/docs/ble-intros/en/latest/AdvSamples/Overview/) -contains an overview on how to create new, application-specific services. - -# Getting Started -The mbed BLE API is meant to be used in projects on developer.mbed.org. Please see examples and sample project files there. +# Getting Started +The mbed BLE API is meant to be used in projects on developer.mbed.org. Please see examples and sample project files there. A good starting point are these pages: -* [mbed BLE Homepage](https://developer.mbed.org/teams/Bluetooth-Low-Energy/) for all things BLE -* [mbed BLE Getting Started Guide](https://developer.mbed.org/forum/team-63-Bluetooth-Low-Energy-community/topic/5262/) a wonderful primer on using BLE with mbed -* [mbed BLE doc](https://docs.mbed.com/docs/ble-intros/en/latest/) for an introduction to mbed BLE -* [mbed BLE API page](https://docs.mbed.com/docs/ble-api/en/latest/api/index.html) for the Doxygen API documentation \ No newline at end of file +* [mbed BLE Homepage](http://developer.mbed.org/teams/Bluetooth-Low-Energy/) for all things BLE +* [mbed BLE Getting Started Guide](http://developer.mbed.org/forum/team-63-Bluetooth-Low-Energy-community/topic/5262/) a wonderful primer on using BLE with mbed +* [mbed BLE API page](http://developer.mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/docs/tip/) for the API in generated by doxygen \ No newline at end of file
--- a/ble.doxyfile Thu Dec 10 09:15:05 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1919 +0,0 @@ -# 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 = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. Note that you specify absolute paths here, but also -# relative paths, which will be relative from the directory where doxygen is -# started. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful if your file system -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding -# "class=itcl::class" will allow you to use the command class in the -# itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. -# -# Note: For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. - -EXTENSION_MAPPING = h=C++ - -# 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 = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal -# scope will be included in the documentation. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespaces are hidden. - -EXTRACT_ANON_NSPACES = 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 = YES - -# 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 = YES - -# 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 = doxygen_warn.log - -#--------------------------------------------------------------------------- -# 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 *.md - -# 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 CONTRIBUTING.md README.md - -# 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 = DOXYGEN_FRONTPAGE.md - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C, C++ and Fortran comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. -# Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = . - -# 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. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# 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 = YES - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. -# There are two flavours of web server based search depending on the -# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for -# searching and an index file used by the script. When EXTERNAL_SEARCH is -# enabled the indexing and searching needs to be provided by external tools. -# See the manual for details. - -SERVER_BASED_SEARCH = NO - -# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP -# script for searching. Instead the search results are written to an XML file -# which needs to be processed by an external indexer. Doxygen will invoke an -# external search engine pointed to by the SEARCHENGINE_URL option to obtain -# the search results. Doxygen ships with an example indexer (doxyindexer) and -# search engine (doxysearch.cgi) which are based on the open source search -# engine library Xapian. See the manual for configuration details. - -EXTERNAL_SEARCH = NO - -# The SEARCHENGINE_URL should point to a search engine hosted by a web server -# which will returned the search results when EXTERNAL_SEARCH is enabled. -# Doxygen ships with an example search engine (doxysearch) which is based on -# the open source search engine library Xapian. See the manual for configuration -# details. - -SEARCHENGINE_URL = - -# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed -# search data is written to a file for indexing by an external tool. With the -# SEARCHDATA_FILE tag the name of this file can be specified. - -SEARCHDATA_FILE = searchdata.xml - -# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the -# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is -# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple -# projects and redirect the results back to the right project. -# This tag requires that the tag SEARCHENGINE is set to YES. - -EXTERNAL_SEARCH_ID = - -# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen -# projects other than the one defined by this configuration file, but that are -# all added to the same external search index. Each project needs to have a -# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id -# of to a relative location where the documentation can be found. -# The format is: EXTRA_SEARCH_MAPPINGS = 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 = TARGET_NRF51822 - -# 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 = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = 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/BLE.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/BLE.h Mon Jan 11 08:51:25 2016 +0000 @@ -30,12 +30,12 @@ #include "mbed_error.h" #endif -/* Forward declaration for the implementation class */ +/* forward declaration for the implementation class */ class BLEInstanceBase; /** - * The base class used to abstract away BLE-capable radio transceivers or SOCs, - * so that the BLE API can work with any radio transparently. + * The base class used to abstract away BLE capable radio transceivers or SOCs, + * to enable this BLE API to work with any radio transparently. */ class BLE { @@ -48,13 +48,13 @@ * @param ble * A reference to the BLE instance being initialized. * @param error - * Captures the result of initialization. It is set to + * This captures the result of initialization. It is set to * BLE_ERROR_NONE if initialization completed successfully. Else * the error value is implementation specific. */ struct InitializationCompleteCallbackContext { - BLE& ble; /* Reference to the BLE object that has been initialized */ - ble_error_t error; /* Error status of the initialization. It is set to BLE_ERROR_NONE if initialization completed successfully. */ + BLE& ble; /* Reference to the BLE object which has been initialized */ + ble_error_t error; /* Error status of the initialization. It is set to BLE_ERROR_NONE initialization completed successfully. */ }; /** @@ -72,15 +72,15 @@ * * init() hands control to the underlying BLE module to accomplish * initialization. This initialization may tacitly depend on other hardware - * setup (such as clocks or power-modes) that happens early on during - * system startup. It may not be safe to call init() from a global static - * context where ordering is compiler-specific and can't be guaranteed - it + * setup (such as clocks or power-modes) which happens early on during + * system startup. It may not be safe to call init() from global static + * context where ordering is compiler specific and can't be guaranteed--it * is safe to call BLE::init() from within main(). * * @param initCompleteCallback * A callback for when initialization completes for a BLE - * instance. This is an optional parameter; if no callback is - * set up the application can still determine the status of + * instance. This is an optional parameter, if no callback is + * setup the application can still determine the status of * initialization using BLE::hasInitialized() (see below). * * @return BLE_ERROR_NONE if the initialization procedure was started @@ -91,8 +91,8 @@ * * @note In some cases, initialization is instantaneous (or blocking); if * so, it is acceptable for the stack-specific implementation of init() - * to invoke the completion callback directly (within its own - * context). + * to invoke the completion callback directly--i.e. within its own + * context. * * @note Nearly all BLE APIs would return * BLE_ERROR_INITIALIZATION_INCOMPLETE if used on an instance before the @@ -121,7 +121,7 @@ * @return true if initialization has completed for the underlying BLE * transport. * - * The application can set up a callback to signal completion of + * The application can setup a callback to signal completion of * initialization when using init(). Otherwise, this method can be used to * poll the state of initialization. */ @@ -138,7 +138,7 @@ * This call allows the application to get the BLE stack version information. * * @return A pointer to a const string representing the version. - * Note: The string is owned by BLE_API. + * Note: The string is owned by the BLE_API. */ const char *getVersion(void); @@ -173,8 +173,8 @@ /** * Yield control to the BLE stack or to other tasks waiting for events. This - * is a sleep function that will return when there is an application-specific - * interrupt, but the MCU might wake up several times before + * is a sleep function which will return when there is an application + * specific interrupt, but the MCU might wake up several times before * returning (to service the stack). This is not always interchangeable with * WFE(). */ @@ -196,19 +196,19 @@ * directly, as it returns references to singletons. * * @param[in] id - * Instance-ID. This should be less than NUM_INSTANCES + * Instance-ID. This should be less than NUM_INSTANCES in order * for the returned BLE singleton to be useful. * - * @return a reference to a single object. + * @return a reference to a single object */ static BLE &Instance(InstanceID_t id = DEFAULT_INSTANCE); /** - * Constructor for a handle to a BLE instance (the BLE stack). BLE handles - * are thin wrappers around a transport object (that is, ptr. to + * Constructor for a handle to a BLE instance (i.e. BLE stack). BLE handles + * are thin wrappers around a transport object (i.e. ptr. to * BLEInstanceBase). * - * It is better to create BLE objects as singletons accessed through the + * BLE objects are are better created as singletons accessed through the * Instance() method. If multiple BLE handles are constructed for the same * interface (using this constructor), they will share the same underlying * transport object. @@ -279,8 +279,8 @@ * This field must be set to 0 if connectionMode is equal * to ADV_CONNECTABLE_DIRECTED. * - * @note: Decreasing this value allows central devices to detect a - * peripheral faster, at the expense of more power being used by the radio + * @note: Decreasing this value will allow central devices to detect a + * 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. @@ -292,7 +292,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 needs to be updated accordingly. + * code depending on the old semantics would need to be updated accordingly. */ void setAdvertisingInterval(uint16_t interval) { gap().setAdvertisingInterval(interval); @@ -349,7 +349,7 @@ } /** - * Set up a particular, user-constructed set of advertisement parameters for + * Setup 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 (see above). @@ -379,11 +379,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 is too + * as an additional 31 bytes if the advertising payload proves to be too * small. * * @param[in] flags - * The flags to add. Please refer to + * The flags to be added. Please refer to * GapAdvertisingData::Flags for valid flags. Multiple * flags may be specified in combination. * @@ -399,7 +399,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 is too + * as an additional 31 bytes if the advertising payload proves to be too * small. * * @param[in] app @@ -417,7 +417,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 is too + * as an additional 31 bytes if the advertising payload proves to be too * small. * * @param[in] app @@ -437,11 +437,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 is too small. + * advertising payload proves to be too small. * - * @param type The type that describes the variable length data. - * @param data Data bytes. - * @param len Data length. + * @param type The type which describes the variable length data. + * @param data data bytes. + * @param len length of data. * * @note: This API is now *deprecated* and will be dropped in the future. * You should use the parallel API from Gap directly. A former call to @@ -482,7 +482,7 @@ /** * Reset any advertising payload prepared from prior calls to * accumulateAdvertisingPayload(). This automatically propagates the re- - * initialized advertising payload to the underlying stack. + * initialized adv payload to the underlying stack. * * @note: This API is now *deprecated* and will be dropped in the future. * You should use the parallel API from Gap directly. A former call to @@ -512,9 +512,9 @@ * Accumulate a variable length byte-stream as an AD structure in the * scanResponse payload. * - * @param[in] type The type that describes the variable length data. - * @param[in] data Data bytes. - * @param[in] len Data length. + * @param[in] type The type which describes the variable length data. + * @param[in] data data bytes. + * @param[in] len length of data. * * @note: This API is now *deprecated* and will be dropped in the future. * You should use the parallel API from Gap directly. A former call to @@ -563,13 +563,13 @@ } /** - * Set up parameters for GAP scanning (observer mode). + * Setup parameters for GAP scanning--i.e. 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 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. @@ -599,7 +599,7 @@ } /** - * Set up the scanInterval parameter for GAP scanning (observer mode). + * Setup the scanInterval parameter for GAP scanning--i.e. observer mode. * @param[in] interval * Scan interval (in milliseconds) [valid values lie between 2.5ms and 10.24s]. * @@ -623,7 +623,7 @@ } /** - * Set up the scanWindow parameter for GAP scanning (observer mode). + * Setup the scanWindow parameter for GAP scanning--i.e. observer mode. * @param[in] window * Scan Window (in milliseconds) [valid values lie between 2.5ms and 10.24s]. * @@ -647,9 +647,9 @@ } /** - * Set up parameters for GAP scanning (observer mode). + * Setup parameters for GAP scanning--i.e. 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 timeout. * * The scanning window divided by the interval determines the duty cycle for * scanning. For example, if the interval is 100ms and the window is 10ms, @@ -673,7 +673,7 @@ } /** - * Set up parameters for GAP scanning (observer mode). + * Setup parameters for GAP scanning--i.e. 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. @@ -695,7 +695,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. * @@ -742,9 +742,9 @@ * @param connectionParams * Connection parameters. * @param scanParams - * Paramters to use while scanning for the peer. + * Paramters to be used while scanning for the peer. * @return BLE_ERROR_NONE if connection establishment procedure is started - * successfully. The onConnection callback (if set) is invoked upon + * successfully. The onConnection callback (if set) will be invoked upon * a connection event. * * @note: This API is now *deprecated* and will be dropped in the future. @@ -760,43 +760,43 @@ } /** - * This call initiates the disconnection procedure, and its completion is - * communicated to the application with an invocation of the + * This call initiates the disconnection procedure, and its completion will + * be communicated to the application with an invocation of the * onDisconnection callback. * * @param[in] connectionHandle * @param[in] reason - * The reason for disconnection; sent back to the peer. + * The reason for disconnection to be sent back to the peer. */ ble_error_t disconnect(Gap::Handle_t connectionHandle, Gap::DisconnectionReason_t reason) { return gap().disconnect(connectionHandle, reason); } /** - * This call initiates the disconnection procedure, and its completion - * is communicated to the application with an invocation of the + * This call initiates the disconnection procedure, and its completion will + * be communicated to the application with an invocation of the * onDisconnection callback. * * @param reason - * The reason for disconnection; sent back to the peer. + * The reason for disconnection to be sent back to the peer. * * @note: This API is now *deprecated* and will be dropped in the future. * You should use the parallel API from Gap directly. A former call to * ble.disconnect(reason) should be replaced with * ble.gap().disconnect(reason). * - * @note: This version of disconnect() doesn't take a connection handle. It - * works reliably only for stacks that are limited to a single + * @note: this version of disconnect() doesn't take a connection handle. It + * will work reliably only for stacks which are limited to a single * connection. This API should be considered *deprecated* in favour of the - * alternative, 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. */ ble_error_t disconnect(Gap::DisconnectionReason_t reason) { return gap().disconnect(reason); } /** - * Returns the current GAP state of the device using a bitmask that - * describes whether the device is advertising or connected. + * Returns the current GAP state of the device using a bitmask which + * describes whether the device is advertising and/or connected. * * @note: This API is now *deprecated* and will be dropped in the future. * You should use the parallel API from Gap directly. A former call to @@ -808,7 +808,7 @@ } /** - * Get the GAP peripheral's preferred connection parameters. These are the + * Get the GAP peripheral preferred connection parameters. These are the * defaults that the peripheral would like to have in a connection. The * choice of the connection parameters is eventually up to the central. * @@ -829,7 +829,7 @@ } /** - * Set the GAP peripheral's preferred connection parameters. These are the + * Set the GAP peripheral preferred connection parameters. These are the * defaults that the peripheral would like to have in a connection. The * choice of the connection parameters is eventually up to the central. * @@ -977,7 +977,7 @@ } /** - * Read the value of a characteristic from the local GattServer. + * Read the value of a characteristic from the local GattServer * @param[in] attributeHandle * Attribute handle for the value attribute of the characteristic. * @param[out] buffer @@ -985,7 +985,7 @@ * @param[in/out] lengthP * Length of the buffer being supplied. If the attribute * value is longer than the size of the supplied buffer, - * this variable will return the total attribute value length + * this variable will hold upon return the total attribute value length * (excluding offset). The application may use this * information to allocate a suitable buffer size. * @@ -1001,7 +1001,7 @@ } /** - * Read the value of a characteristic from the local GattServer. + * Read the value of a characteristic from the local GattServer * @param[in] connectionHandle * Connection Handle. * @param[in] attributeHandle @@ -1011,13 +1011,13 @@ * @param[in/out] lengthP * Length of the buffer being supplied. If the attribute * value is longer than the size of the supplied buffer, - * this variable will return the total attribute value length + * this variable will hold upon return the total attribute value length * (excluding offset). The application may use this * information to allocate a suitable buffer size. * * @return BLE_ERROR_NONE if a value was read successfully into the buffer. * - * @note This API is a version of the above, with an additional connection handle + * @note This API is a version of above with an additional connection handle * parameter to allow fetches for connection-specific multivalued * attributes (such as the CCCDs). * @@ -1034,16 +1034,16 @@ * Update the value of a characteristic on the local GattServer. * * @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 * notify/indicate flag in the CCCD for this - * characteristic? If set to true, no notification + * Characteristic? If set to true, no notification * or indication is generated. * * @return BLE_ERROR_NONE if we have successfully set the value of the attribute. @@ -1062,7 +1062,7 @@ /** * Update the value of a characteristic on the local GattServer. A version - * of the above, with a connection handle parameter to allow updates + * of the same as above with connection handle parameter to allow updates * for connection-specific multivalued attributes (such as the CCCDs). * * @param[in] connectionHandle @@ -1070,7 +1070,7 @@ * @param[in] attributeHandle * 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 @@ -1097,14 +1097,14 @@ /** * Enable the BLE stack's Security Manager. The Security Manager implements - * the cryptographic algorithms and protocol exchanges that allow two + * the actual cryptographic algorithms and protocol exchanges that allow two * devices to securely exchange data and privately detect each other. * Calling this API is a prerequisite for encryption and pairing (bonding). * * @param[in] enableBonding Allow for bonding. - * @param[in] requireMITM Require protection against man-in-the-middle attacks. - * @param[in] iocaps To specify the I/O capabilities of this peripheral, - * such as availability of a display or keyboard, to + * @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 * support out-of-band exchanges of security data. * @param[in] passkey To specify a static passkey. * @@ -1126,9 +1126,9 @@ * 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 the reason of failure. + * @return BLE_SUCCESS Or appropriate error code indicating reason for failure. * * @note: This API is now *deprecated* and will be dropped in the future. * You should use the parallel API from SecurityManager directly. A former @@ -1143,8 +1143,8 @@ * Delete all peer device context and all related bonding information from * the database within the security manager. * - * @retval BLE_ERROR_NONE On success; else returns an error code indicating the reason for the failure. - * @retval BLE_ERROR_INVALID_STATE If the API is called without module initialization or + * @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 * application registration. * * @note: This API is now *deprecated* and will be dropped in the future. @@ -1157,7 +1157,7 @@ } /** - * Set up a callback for timeout events. Refer to Gap::TimeoutSource_t for + * Setup a callback for timeout events. Refer to Gap::TimeoutSource_t for * possible event types. * * @note: This API is now *deprecated* and will be dropped in the future. @@ -1170,7 +1170,7 @@ } /** - * Set up a callback for connection events. Refer to Gap::ConnectionEventCallback_t. + * Setup a callback for connection events. Refer to Gap::ConnectionEventCallback_t. * * @note: This API is now *deprecated* and will be dropped in the future. * You should use the parallel API from Gap directly. A former call @@ -1200,15 +1200,15 @@ /** * Radio Notification is a feature that enables ACTIVE and INACTIVE - * (nACTIVE) signals from the stack. These notify the application when the + * (nACTIVE) signals from the stack that notify the application when the * radio is in use. The signal is sent using software interrupt. * - * 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, - * or to trigger sensor data collection for transmission in the radio event. + * 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 @@ -1227,11 +1227,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 set up a callback into a member function of + * @Note: it is also possible to setup a callback into a member function of * some object. * * @note: This API is now *deprecated* and will be dropped in the future. @@ -1247,18 +1247,18 @@ } /** - * 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 + * 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 * 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 * 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 set up a callback into a member function of + * @Note: it is also possible to setup a callback into a member function of * some object. * * @note: This API is now *deprecated* and will be dropped in the future. @@ -1274,19 +1274,19 @@ } /** - * Set up a callback to be invoked on the peripheral when an attribute is + * 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. * - * @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 set up a callback into a member function of + * @Note: it is also possible to setup a callback into a member function of * some object. * * @return BLE_ERROR_NOT_IMPLEMENTED if this functionality isn't available; @@ -1305,7 +1305,7 @@ } /** - * Set up a callback for when notifications or indications are enabled for a + * Setup a callback for when notifications/indications are enabled for a * characteristic on the local GattServer. * * @note: This API is now *deprecated* and will be dropped in the future. @@ -1318,7 +1318,7 @@ } /** - * Set up a callback for when notifications or indications are disabled for a + * Setup a callback for when notifications/indications are disabled for a * characteristic on the local GattServer. * * @note: This API is now *deprecated* and will be dropped in the future. @@ -1331,7 +1331,7 @@ } /** - * Set up a callback for when the GATT server receives a response for an + * Setup a callback for when the GATT server receives a response for an * indication event sent previously. * * @note: This API is now *deprecated* and will be dropped in the future. @@ -1344,7 +1344,7 @@ } /** - * Set up a callback for when the security setup procedure (key generation + * Setup a callback for when the security setup procedure (key generation * and exchange) for a link has started. This will be skipped for bonded * devices. The callback is passed in parameters received from the peer's * security request: bool allowBonding, bool requireMITM, and @@ -1360,7 +1360,7 @@ } /** - * Set up a callback for when the security setup procedure (key generation + * Setup a callback for when the security setup procedure (key generation * and exchange) for a link has completed. This will be skipped for bonded * devices. The callback is passed in the success/failure status of the * security setup procedure. @@ -1375,9 +1375,9 @@ } /** - * Set up a callback for when a 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, and setup procedures will not + * Setup a callback for when a link with the peer is secured. For bonded + * devices, subsequent reconnections 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. The callback is passed in a SecurityManager::SecurityMode_t according * to the level of security in effect for the secured link. @@ -1392,7 +1392,7 @@ } /** - * Set up a callback for successful bonding, meaning that link-specific security + * Setup a callback for successful bonding; i.e. that link-specific security * context is stored persistently for a peer device. * * @note: This API is now *deprecated* and will be dropped in the future. @@ -1405,10 +1405,10 @@ } /** - * Set up a callback for when the passkey needs to be displayed on a + * Setup a callback for when the passkey needs to be displayed on a * peripheral with DISPLAY capability. This happens when security is - * configured to prevent Man-In-The-Middle attacks, and the peers need to exchange - * a passkey (or PIN) to authenticate the connection + * configured to prevent Man-In-The-Middle attacks, and a PIN (or passkey) + * needs to be exchanged between the peers to authenticate the connection * attempt. * * @note: This API is now *deprecated* and will be dropped in the future. @@ -1435,7 +1435,7 @@ private: InstanceID_t instanceID; - BLEInstanceBase *transport; /* The device-specific backend */ + BLEInstanceBase *transport; /* the device specific backend */ }; typedef BLE BLEDevice; /* DEPRECATED. This type alias is retained for the sake of compatibility with older
--- a/ble/BLEInstanceBase.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/BLEInstanceBase.h Mon Jan 11 08:51:25 2016 +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 Dec 10 09:15:05 2015 +0000 +++ b/ble/CallChainOfFunctionPointersWithContext.h Mon Jan 11 08:51:25 2016 +0000 @@ -18,7 +18,6 @@ #include <string.h> #include "FunctionPointerWithContext.h" -#include "SafeBool.h" /** Group one or more functions in an instance of a CallChainOfFunctionPointersWithContext, then call them in @@ -57,14 +56,14 @@ */ template <typename ContextType> -class CallChainOfFunctionPointersWithContext : public SafeBool<CallChainOfFunctionPointersWithContext<ContextType> > { +class CallChainOfFunctionPointersWithContext { public: 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 */ @@ -74,73 +73,30 @@ 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)) { return common_add(new FunctionPointerWithContext<ContextType>(tptr, mptr)); } - /** Add a function at the front of the chain. - * - * @param func The FunctionPointerWithContext to add. - */ - pFunctionPointerWithContext_t add(const FunctionPointerWithContext<ContextType>& func) { - return common_add(new FunctionPointerWithContext<ContextType>(func)); - } - - /** - * Detach a function pointer from a callchain - * - * @oaram toDetach FunctionPointerWithContext to detach from this callchain - * - * @return true if a function pointer has been detached and false otherwise - */ - bool detach(const FunctionPointerWithContext<ContextType>& toDetach) { - pFunctionPointerWithContext_t current = chainHead; - pFunctionPointerWithContext_t previous = NULL; - - while (current) { - if(*current == toDetach) { - if(previous == NULL) { - if(currentCalled == current) { - currentCalled = NULL; - } - chainHead = current->getNext(); - } else { - if(currentCalled == current) { - currentCalled = previous; - } - previous->chainAsNext(current->getNext()); - } - delete current; - return true; - } - - previous = current; - current = current->getNext(); - } - - return false; - } - /** Clear the call chain (remove all functions in the chain). */ void clear(void) { @@ -159,56 +115,16 @@ } /** Call all the functions in the chain in sequence + * @Note: the stack frames of all the callbacks within the chained + * FunctionPointers will stack up. Hopefully there won't be too many + * chained FunctionPointers. */ void call(ContextType context) { - ((const CallChainOfFunctionPointersWithContext*) this)->call(context); - } - - /** - * @brief same as above but const - */ - void call(ContextType context) const { - currentCalled = chainHead; - - while(currentCalled) { - currentCalled->call(context); - // if this was the head and the call removed the head - if(currentCalled == NULL) { - currentCalled = chainHead; - } else { - currentCalled = currentCalled->getNext(); - } + if (chainHead) { + chainHead->call(context); } } - /** - * @brief same as above but with function call operator - * \code - * - * void first(bool); - * void second(bool); - * - * CallChainOfFunctionPointerWithContext<bool> foo; - * - * foo.attach(first); - * foo.attach(second); - * - * // call the callchain like a function - * foo(true); - * - * \endcode - */ - void operator()(ContextType context) const { - call(context); - } - - /** - * @brief bool conversion operation - */ - bool toBool() const { - return chainHead != NULL; - } - private: pFunctionPointerWithContext_t common_add(pFunctionPointerWithContext_t pf) { if (chainHead == NULL) { @@ -223,13 +139,8 @@ private: pFunctionPointerWithContext_t chainHead; - // iterator during a function call, this has to be mutable because the call function is const. - // Note: mutable is the correct behaviour here, the iterator never leak outside the object. - // So the object can still be seen as logically const even if it change its internal state - mutable pFunctionPointerWithContext_t currentCalled; - - /* 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 Dec 10 09:15:05 2015 +0000 +++ b/ble/DiscoveredCharacteristic.h Mon Jan 11 08:51:25 2016 +0000 @@ -29,7 +29,7 @@ class DiscoveredCharacteristic { public: struct Properties_t { - uint8_t _broadcast :1; /**< Broadcasting the value permitted. */ + uint8_t _broadcast :1; /**< Broadcasting of 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,19 +72,17 @@ /** * 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, or + * @return BLE_ERROR_NONE if a read has been initiated, else * BLE_ERROR_INVALID_STATE if some internal state about the connection is invalid, or - * BLE_STACK_BUSY if some client procedure is already in progress, or + * BLE_STACK_BUSY if some client procedure already in progress, or * BLE_ERROR_OPERATION_NOT_PERMITTED due to the characteristic's properties. */ ble_error_t read(uint16_t offset = 0) const; - ble_error_t read(uint16_t offset, const GattClient::ReadCallback_t& onRead) const; - /** * Perform a write without response procedure. * @@ -99,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, or + * @retval BLE_ERROR_NONE Successfully started the Write procedure, else * BLE_ERROR_INVALID_STATE if some internal state about the connection is invalid, or - * BLE_STACK_BUSY if some client procedure is already in progress, or + * BLE_STACK_BUSY if some client procedure 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. */ @@ -112,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. */ @@ -129,21 +127,16 @@ * @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, or + * @retval BLE_ERROR_NONE Successfully started the Write procedure, else * BLE_ERROR_INVALID_STATE if some internal state about the connection is invalid, or - * BLE_STACK_BUSY if some client procedure is already in progress, or + * BLE_STACK_BUSY if some client procedure 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. */ ble_error_t write(uint16_t length, const uint8_t *value) const; - /** - * Same as above but register the callback wich will be called once the data has been written - */ - ble_error_t write(uint16_t length, const uint8_t *value, const GattClient::WriteCallback_t& onRead) const; - - void setupLongUUID(UUID::LongUUIDBytes_t longUUID, UUID::ByteOrder_t order = UUID::MSB) { - uuid.setupLong(longUUID, order); + void setupLongUUID(UUID::LongUUIDBytes_t longUUID) { + uuid.setupLong(longUUID); } public:
--- a/ble/DiscoveredService.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/DiscoveredService.h Mon Jan 11 08:51:25 2016 +0000 @@ -36,8 +36,8 @@ endHandle = endHandleIn; } - void setupLongUUID(UUID::LongUUIDBytes_t longUUID, UUID::ByteOrder_t order = UUID::MSB) { - uuid.setupLong(longUUID, order); + void setupLongUUID(UUID::LongUUIDBytes_t longUUID) { + uuid.setupLong(longUUID); } public:
--- a/ble/FunctionPointerWithContext.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/FunctionPointerWithContext.h Mon Jan 11 08:51:25 2016 +0000 @@ -18,31 +18,29 @@ #define MBED_FUNCTIONPOINTER_WITH_CONTEXT_H #include <string.h> -#include "SafeBool.h" /** A class for storing and calling a pointer to a static or member void function - * that takes a context. + * which takes a context. */ template <typename ContextType> -class FunctionPointerWithContext : public SafeBool<FunctionPointerWithContext<ContextType> > { +class FunctionPointerWithContext { public: typedef FunctionPointerWithContext<ContextType> *pFunctionPointerWithContext_t; - typedef const FunctionPointerWithContext<ContextType> *cpFunctionPointerWithContext_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) : - _memberFunctionAndPointer(), _caller(NULL), _next(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 (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 (i.e. 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)) : @@ -50,30 +48,19 @@ attach(object, member); } - FunctionPointerWithContext(const FunctionPointerWithContext& that) : - _memberFunctionAndPointer(that._memberFunctionAndPointer), _caller(that._caller), _next(NULL) { - } - - FunctionPointerWithContext& operator=(const FunctionPointerWithContext& that) { - _memberFunctionAndPointer = that._memberFunctionAndPointer; - _caller = that._caller; - _next = NULL; - return *this; - } - - /** 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 (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 (i.e. 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)) { @@ -82,37 +69,21 @@ _caller = &FunctionPointerWithContext::membercaller<T>; } - /** Call the attached static or member function; if there are chained + /** Call the attached static or member function; and 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) const { + void call(ContextType context) { _caller(this, context); + + /* Propagate the call to next in the chain. */ + if (_next) { + _next->call(context); + } } /** - * @brief Same as above - */ - void operator()(ContextType context) const { - call(context); - } - - /** Same as above, workaround for mbed os FunctionPointer implementation. */ - void call(ContextType context) { - ((const FunctionPointerWithContext*) this)->call(context); - } - - typedef void (FunctionPointerWithContext::*bool_type)() const; - - /** - * implementation of safe bool operator - */ - bool toBool() const { - return (_function || _memberFunctionAndPointer._object); - } - - /** - * Set up an external FunctionPointer as a next in the chain of related + * Setup an external FunctionPointer as a next in the chain of related * callbacks. Invoking call() on the head FunctionPointer will invoke all * chained callbacks. * @@ -130,18 +101,9 @@ return (pvoidfcontext_t)_function; } - friend bool operator==(const FunctionPointerWithContext& lhs, const FunctionPointerWithContext& rhs) { - return rhs._caller == lhs._caller && - memcmp( - &rhs._memberFunctionAndPointer, - &lhs._memberFunctionAndPointer, - sizeof(rhs._memberFunctionAndPointer) - ) == 0; - } - private: template<typename T> - static void membercaller(cpFunctionPointerWithContext_t self, ContextType context) { + static void membercaller(pFunctionPointerWithContext_t self, ContextType context) { if (self->_memberFunctionAndPointer._object) { T *o = static_cast<T *>(self->_memberFunctionAndPointer._object); void (T::*m)(ContextType); @@ -150,7 +112,7 @@ } } - static void functioncaller(cpFunctionPointerWithContext_t self, ContextType context) { + static void functioncaller(pFunctionPointerWithContext_t self, ContextType context) { if (self->_function) { self->_function(context); } @@ -158,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. @@ -174,19 +136,19 @@ }; 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 */ - mutable MemberFunctionAndPtr _memberFunctionAndPointer; + MemberFunctionAndPtr _memberFunctionAndPointer; }; - void (*_caller)(const FunctionPointerWithContext*, ContextType); + 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. Refer to + * external memory to manage the chain. Also refer to * 'CallChain' as an alternative. */ };
--- a/ble/Gap.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/Gap.h Mon Jan 11 08:51:25 2016 +0000 @@ -24,7 +24,7 @@ #include "CallChainOfFunctionPointersWithContext.h" #include "FunctionPointerWithContext.h" -/* Forward declarations for classes that will only be used for pointers or references in the following. */ +/* Forward declarations for classes which 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 that is not - * covered by this enumeration, 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 which is not + * covered by this enumeration, then 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. */ @@ -140,15 +140,10 @@ return (durationInMillis * 1000) / UNIT_1_25_MS; } - typedef FunctionPointerWithContext<TimeoutSource_t> TimeoutEventCallback_t; - typedef CallChainOfFunctionPointersWithContext<TimeoutSource_t> TimeoutEventCallbackChain_t; - typedef FunctionPointerWithContext<const ConnectionCallbackParams_t *> ConnectionEventCallback_t; - typedef CallChainOfFunctionPointersWithContext<const ConnectionCallbackParams_t *> ConnectionEventCallbackChain_t; - - typedef FunctionPointerWithContext<const DisconnectionCallbackParams_t*> DisconnectionEventCallback_t; - typedef CallChainOfFunctionPointersWithContext<const DisconnectionCallbackParams_t*> DisconnectionEventCallbackChain_t; - + typedef void (*TimeoutEventCallback_t)(TimeoutSource_t source); + typedef void (*ConnectionEventCallback_t)(const ConnectionCallbackParams_t *params); + typedef void (*DisconnectionEventCallback_t)(const DisconnectionCallbackParams_t *params); typedef FunctionPointerWithContext<bool> RadioNotificationEventCallback_t; /* @@ -157,7 +152,7 @@ public: /** * Set the BTLE MAC address and type. Please note that the address format is - * least significant byte first (LSB). Please refer to Address_t. + * LSB (least significant byte first). Please refer to Address_t. * * @return BLE_ERROR_NONE on success. */ @@ -175,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; @@ -183,16 +178,14 @@ } /** - * @return Minimum Advertising interval in milliseconds for connectable - * undirected and connectable directed event types. + * @return Minimum Advertising interval in milliseconds. */ virtual uint16_t getMinAdvertisingInterval(void) const { return 0; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** - * @return Minimum Advertising interval in milliseconds for scannable - * undirected and non-connectable undirected event types. + * @return Minimum Advertising interval in milliseconds for non-connectible mode. */ virtual uint16_t getMinNonConnectableAdvertisingInterval(void) const { return 0; /* Requesting action from porter(s): override this API if this capability is supported. */ @@ -237,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; @@ -252,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 */ @@ -268,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 - * works reliably only for stacks that are limited to a single + * @note: this version of disconnect() doesn't take a connection handle. It + * will work reliably only for stacks which are limited to a single * connection. This API should be considered *deprecated* in favour of the - * alternative, which takes a connection handle. It will be dropped in the future. + * altertive 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. */ @@ -295,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. */ @@ -310,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. */ @@ -318,12 +311,12 @@ /** * Update connection parameters. - * 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 + * 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 * 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. @@ -342,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. */ @@ -380,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. */ @@ -392,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. */ @@ -403,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. */ @@ -418,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; @@ -437,8 +430,8 @@ */ public: /** - * Returns the current GAP state of the device using a bitmask that - * describes whether the device is advertising or connected. + * Returns the current GAP state of the device using a bitmask which + * describes whether the device is advertising and/or connected. */ GapState_t getState(void) const { return state; @@ -463,14 +456,19 @@ * 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. + * You should use the parallel API from Gap directly. A former call to + * ble.setAdvertisingInterval(...) should now be achieved using + * ble.gap().setAdvertisingInterval(...). + * * @Note: [WARNING] This API previously used 0.625ms as the unit for its * '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 needs to be updated accordingly. + * code depending on the old semantics would need to be updated accordingly. */ void setAdvertisingInterval(uint16_t interval) { if (interval == 0) { @@ -494,14 +492,17 @@ * 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 advertising payload to the underlying stack. + * initialized adv payload to the underlying stack. + * + * Note: This should be followed by a call to setAdvertisingPayload() or + * startAdvertising() before the update takes effect. */ void clearAdvertisingPayload(void) { _advPayload.clear(); @@ -511,7 +512,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 is too + * as an additional 31 bytes if the advertising payload proves to be too * small. * * @param[in] flags @@ -531,7 +532,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 is too + * as an additional 31 bytes if the advertising payload proves to be too * small. * * @param app @@ -551,11 +552,12 @@ /** * 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 is too + * as an additional 31 bytes if the advertising payload proves to be too * small. * - * @param power + * @param app * 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; @@ -570,11 +572,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 is too small. + * advertising payload proves to be too small. * - * @param type The type describing the variable length data. - * @param data Data bytes. - * @param len Length of data. + * @param type The type which describes 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) { @@ -594,14 +596,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 describing the variable length data. - * @param[in] data Data bytes. - * @param[in] len Length of data. + * @param[in] type The ADV type field which describes 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; otherwise, an appropriate error. + * a <type, len> match; else an appropriate error. */ ble_error_t updateAdvertisingPayload(GapAdvertisingData::DataType type, const uint8_t *data, uint8_t len) { if (type == GapAdvertisingData::COMPLETE_LOCAL_NAME) { @@ -617,7 +619,7 @@ } /** - * Set up a particular, user-constructed advertisement payload for the + * Setup 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). */ @@ -638,9 +640,9 @@ * Accumulate a variable length byte-stream as an AD structure in the * scanResponse payload. * - * @param[in] type The type describing the variable length data. - * @param[in] data Data bytes. - * @param[in] len Length of data. + * @param[in] type The type which describes 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; @@ -664,13 +666,13 @@ } /** - * Set up parameters for GAP scanning (observer mode). + * Setup parameters for GAP scanning--i.e. 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 the timeout. + * Scan timeout (in seconds) between 0x0001 and 0xFFFF, 0x0000 disables 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. @@ -703,7 +705,7 @@ } /** - * Set up the scanInterval parameter for GAP scanning (observer mode). + * Setup the scanInterval parameter for GAP scanning--i.e. observer mode. * @param[in] interval * Scan interval (in milliseconds) [valid values lie between 2.5ms and 10.24s]. * @@ -722,7 +724,7 @@ } /** - * Set up the scanWindow parameter for GAP scanning (observer mode). + * Setup the scanWindow parameter for GAP scanning--i.e. observer mode. * @param[in] window * Scan Window (in milliseconds) [valid values lie between 2.5ms and 10.24s]. * @@ -754,9 +756,9 @@ } /** - * Set up parameters for GAP scanning (observer mode). + * Setup parameters for GAP scanning--i.e. observer mode. * @param[in] timeout - * Scan timeout (in seconds) between 0x0001 and 0xFFFF; 0x0000 disables the timeout. + * Scan timeout (in seconds) between 0x0001 and 0xFFFF, 0x0000 disables timeout. * * Once the scanning parameters have been configured, scanning can be * enabled by using startScan(). @@ -779,7 +781,7 @@ } /** - * Set up parameters for GAP scanning (observer mode). + * Setup parameters for GAP scanning--i.e. 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. @@ -806,7 +808,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. */ @@ -840,17 +842,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. @@ -880,7 +882,7 @@ } /** - * Set up a particular, user-constructed set of advertisement parameters for + * Setup 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. @@ -892,27 +894,13 @@ /* Event callback handlers. */ public: /** - * Set up a callback for timeout events. Refer to TimeoutSource_t for + * Setup a callback for timeout events. Refer to TimeoutSource_t for * possible event types. - * @note It is possible to unregister callbacks using onTimeout().detach(callback) */ - void onTimeout(TimeoutEventCallback_t callback) { - timeoutCallbackChain.add(callback); - } - - /** - * @brief provide access to the callchain of timeout event callbacks - * It is possible to register callbacks using onTimeout().add(callback); - * It is possible to unregister callbacks using onTimeout().detach(callback) - * @return The timeout event callbacks chain - */ - TimeoutEventCallbackChain_t& onTimeout() { - return timeoutCallbackChain; - } + void onTimeout(TimeoutEventCallback_t callback) {timeoutCallback = callback;} /** * Append to a chain of callbacks to be invoked upon GAP connection. - * @note It is possible to unregister callbacks using onConnection().detach(callback) */ void onConnection(ConnectionEventCallback_t callback) {connectionCallChain.add(callback);} @@ -920,18 +908,7 @@ void onConnection(T *tptr, void (T::*mptr)(const ConnectionCallbackParams_t*)) {connectionCallChain.add(tptr, mptr);} /** - * @brief provide access to the callchain of connection event callbacks - * It is possible to register callbacks using onConnection().add(callback); - * It is possible to unregister callbacks using onConnection().detach(callback) - * @return The connection event callbacks chain - */ - ConnectionEventCallbackChain_t& onConnection() { - return connectionCallChain; - } - - /** * Append to a chain of callbacks to be invoked upon GAP disconnection. - * @note It is possible to unregister callbacks using onDisconnection().detach(callback) */ void onDisconnection(DisconnectionEventCallback_t callback) {disconnectionCallChain.add(callback);} @@ -939,34 +916,24 @@ void onDisconnection(T *tptr, void (T::*mptr)(const DisconnectionCallbackParams_t*)) {disconnectionCallChain.add(tptr, mptr);} /** - * @brief provide access to the callchain of disconnection event callbacks - * It is possible to register callbacks using onDisconnection().add(callback); - * It is possible to unregister callbacks using onDisconnection().detach(callback) - * @return The disconnection event callbacks chain - */ - DisconnectionEventCallbackChain_t& onDisconnection() { - return disconnectionCallChain; - } - - /** * Set the application callback for radio-notification events. * * 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. * * @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 @@ -977,10 +944,12 @@ */ void onRadioNotification(void (*callback)(bool param)) { radioNotificationCallback.attach(callback); + initRadioNotification(); } template <typename T> void onRadioNotification(T *tptr, void (T::*mptr)(bool)) { radioNotificationCallback.attach(tptr, mptr); + initRadioNotification(); } protected: @@ -991,7 +960,7 @@ _scanResponse(), state(), scanningActive(false), - timeoutCallbackChain(), + timeoutCallback(NULL), radioNotificationCallback(), onAdvertisementReport(), connectionCallChain(), @@ -1037,8 +1006,8 @@ } void processTimeoutEvent(TimeoutSource_t source) { - if (timeoutCallbackChain) { - timeoutCallbackChain(source); + if (timeoutCallback) { + timeoutCallback(source); } } @@ -1052,14 +1021,14 @@ bool scanningActive; protected: - TimeoutEventCallbackChain_t timeoutCallbackChain; - RadioNotificationEventCallback_t radioNotificationCallback; - AdvertisementReportCallback_t onAdvertisementReport; - ConnectionEventCallbackChain_t connectionCallChain; - DisconnectionEventCallbackChain_t disconnectionCallChain; + TimeoutEventCallback_t timeoutCallback; + RadioNotificationEventCallback_t radioNotificationCallback; + AdvertisementReportCallback_t onAdvertisementReport; + CallChainOfFunctionPointersWithContext<const ConnectionCallbackParams_t*> connectionCallChain; + 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 Dec 10 09:15:05 2015 +0000 +++ b/ble/GapAdvertisingData.h Mon Jan 11 08:51:25 2016 +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, Sections 11 and 18 + See Bluetooth Specification 4.0 (Vol. 3), Part C, Section 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 its own standardized assigned number, as defined + Each AD type has it's 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, all appropriate AD types are encapsulated - in GapAdvertisingData::DataType. + For convenience sake, all appropriate AD types have been encapsulated + into 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 are inserted inside the advertising or scan + peripheral, and get inserted inside the advertising or scan response payloads. \par Source @@ -101,7 +101,6 @@ 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 */ @@ -112,7 +111,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. @@ -123,11 +122,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. */ @@ -135,7 +134,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 @@ -144,54 +143,54 @@ */ /**********************************************************************/ enum Appearance_t { - 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. */ + 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 */ }; typedef enum Appearance_t Appearance; /* Deprecated type alias. This may be dropped in a future release. */ @@ -200,109 +199,38 @@ } /** - * 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) { - 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); - } - } + /* ToDo: Check if an AD type already exists and if the existing */ + /* value is exclusive or not (flags, etc.) */ - 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); + /* 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; } - return result; + /* 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; } /** @@ -325,7 +253,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. */ }; @@ -334,23 +262,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. @@ -378,18 +306,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) { - /* To Do: Basic error checking to make sure txPower is in range. */ + /* ToDo: 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); @@ -397,83 +325,27 @@ } /** - * Returns a pointer to the current payload. + * Returns a pointer to the 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 Dec 10 09:15:05 2015 +0000 +++ b/ble/GapAdvertisingParams.h Mon Jan 11 08:51:25 2016 +0000 @@ -20,7 +20,7 @@ /** * This class provides a wrapper for the core advertising parameters, * including the advertising type (Connectable Undirected, - * Non Connectable Undirected and so on), as well as the advertising and + * Non Connectable Undirected, etc.), 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 advertisement duration units (0.625ms units). + * @return the advertisement interval in units advertisement duration units--i.e. 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 Dec 10 09:15:05 2015 +0000 +++ b/ble/GapEvents.h Mon Jan 11 08:51:25 2016 +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 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. */ + 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 */ } gapEvent_t; };
--- a/ble/GapScanningParams.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/GapScanningParams.h Mon Jan 11 08:51:25 2016 +0000 @@ -19,10 +19,10 @@ class GapScanningParams { public: - 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_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_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.625ms */ + /* @Note: The following return durations in units of 0.625 ms */ 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 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. */ + 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. */ private: - /* Disallow copy constructor. */ + /* disallow copy constructor */ GapScanningParams(const GapScanningParams &); GapScanningParams& operator =(const GapScanningParams &in); };
--- a/ble/GattAttribute.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/GattAttribute.h Mon Jan 11 08:51:25 2016 +0000 @@ -27,18 +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] len - * The length in bytes of this attribute's value. + * @param[in] initialLen + * The min length in bytes of this attribute's value * @param[in] maxLen - * The max length in bytes of this attribute's value. - * @param[in] hasVariableLen - * Whether the attribute's value length changes overtime. + * The max length in bytes of this attribute's value * * @section EXAMPLE * @@ -49,31 +47,31 @@ * * @endcode */ - GattAttribute(const UUID &uuid, uint8_t *valuePtr = NULL, uint16_t len = 0, uint16_t maxLen = 0, bool hasVariableLen = true) : - _uuid(uuid), _valuePtr(valuePtr), _lenMax(maxLen), _len(len), _hasVariableLen(hasVariableLen), _handle() { - /* Empty */ + 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 */ } public: - Handle_t getHandle(void) const {return _handle; } - const UUID &getUUID(void) const {return _uuid; } - uint16_t getLength(void) const {return _len; } - uint16_t getMaxLength(void) const {return _lenMax; } - uint16_t *getLengthPtr(void) {return &_len; } - void setHandle(Handle_t id) {_handle = id; } - uint8_t *getValuePtr(void) {return _valuePtr; } - bool hasVariableLength(void) const {return _hasVariableLen;} + Handle_t getHandle(void) const {return _handle; } + const UUID &getUUID(void) const {return _uuid; } + uint16_t getLength(void) const {return _len; } + uint16_t getInitialLength(void) const {return _initialLen;} + uint16_t getMaxLength(void) const {return _lenMax; } + uint16_t *getLengthPtr(void) {return &_len; } + void setHandle(Handle_t id) {_handle = id; } + uint8_t *getValuePtr(void) {return _valuePtr; } private: - UUID _uuid; /* Characteristic UUID. */ + UUID _uuid; /* Characteristic UUID */ uint8_t *_valuePtr; - uint16_t _lenMax; /* Maximum length of the value. */ - uint16_t _len; /* Current length of the value. */ - bool _hasVariableLen; + 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 Dec 10 09:15:05 2015 +0000 +++ b/ble/GattCallbackParamTypes.h Mon Jan 11 08:51:25 2016 +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: 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_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_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 that the callback - * needs to set to AUTH_CALLBACK_REPLY_SUCCESS - * for the request to proceed. */ + 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. */ }; 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 that the callback - * needs to set to AUTH_CALLBACK_REPLY_SUCCESS - * for the request to proceed. */ + 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. */ }; /* For encapsulating handle-value update events (notifications or indications) generated at the remote server. */
--- a/ble/GattCharacteristic.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/GattCharacteristic.h Mon Jan 11 08:51:25 2016 +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 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 */ + 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 */ }; /**************************************************************************/ @@ -288,33 +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. 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. */ + 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. */ }; /** * @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 - * is thereafter maintained internally by the stack. - * @param[in] len - * The length in bytes of this characteristic's value. + * into the stack when the enclosing service is added; and + * thereafter maintained internally by the stack. + * @param[in] initialLen + * The min length in bytes of this characteristic's value * @param[in] maxLen - * The max length in bytes of this characteristic's value. - * @param[in] hasVariableLen - * Whether the attribute's value length changes over time. + * The max length in bytes of this characteristic's value * @param[in] props - * The 8-bit field containing the characteristic's properties. + * The 8-bit 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 @@ -323,20 +321,19 @@ * @param[in] numDescriptors * The number of descriptors in the previous array. * - * @NOTE: If valuePtr == NULL, length == 0, and properties == READ + * @NOTE: If valuePtr == NULL, initialLength == 0, and properties == READ * for the value attribute of a characteristic, then that particular * characteristic may be considered optional and dropped while * instantiating the service with the underlying BLE stack. */ GattCharacteristic(const UUID &uuid, uint8_t *valuePtr = NULL, - uint16_t len = 0, + uint16_t initialLen = 0, uint16_t maxLen = 0, uint8_t props = BLE_GATT_CHAR_PROPERTIES_NONE, GattAttribute *descriptors[] = NULL, - unsigned numDescriptors = 0, - bool hasVariableLen = true) : - _valueAttribute(uuid, valuePtr, len, maxLen, hasVariableLen), + unsigned numDescriptors = 0) : + _valueAttribute(uuid, valuePtr, initialLen, maxLen), _properties(props), _requiredSecurity(SecurityManager::SECURITY_MODE_ENCRYPTION_OPEN_LINK), _descriptors(descriptors), @@ -350,9 +347,9 @@ public: /** - * Set up the minimum security (mode and level) requirements for access to the characteristic's value attribute. + * Setup 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 man in the middle attacks (MITM). + * @param securityMode Can be one of encryption or signing, with or without protection for MITM (man in the middle attacks). */ void requireSecurity(SecurityManager::SecurityMode_t securityMode) { _requiredSecurity = securityMode; @@ -384,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. Also contains an out-parameter for reply. + * @param params to capture the context of the write-auth request; and also contains an out-parameter for reply. * @return true if the write is authorized to proceed. */ GattAuthCallbackReply_t authorizeWrite(GattWriteAuthCallbackParams *params) { @@ -392,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; } @@ -400,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 or deny the read the params->authorizationReply field - * should be set to true (authorize) or false (deny). + * @NOTE: To authorize/deny the read the params->authorizationReply field + * should be set to true/false. * * If the read is approved and params->data is unchanged (NULL), * the current characteristic value will be used. @@ -418,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; } @@ -455,7 +452,7 @@ FunctionPointerWithContext<GattWriteAuthCallbackParams *> writeAuthorizationCallback; private: - /* Disallow copy and assignment. */ + /* disallow copy and assignment */ GattCharacteristic(const GattCharacteristic &); GattCharacteristic& operator=(const GattCharacteristic &); }; @@ -469,7 +466,7 @@ GattAttribute *descriptors[] = NULL, unsigned numDescriptors = 0) : GattCharacteristic(uuid, reinterpret_cast<uint8_t *>(valuePtr), sizeof(T), sizeof(T), - BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties, descriptors, numDescriptors, false) { + BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties, descriptors, numDescriptors) { /* empty */ } }; @@ -525,7 +522,7 @@ GattAttribute *descriptors[] = NULL, unsigned numDescriptors = 0) : GattCharacteristic(uuid, reinterpret_cast<uint8_t *>(valuePtr), sizeof(T) * NUM_ELEMENTS, sizeof(T) * NUM_ELEMENTS, - BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties, descriptors, numDescriptors, false) { + BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties, descriptors, numDescriptors) { /* empty */ } };
--- a/ble/GattClient.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/GattClient.h Mon Jan 11 08:51:25 2016 +0000 @@ -23,23 +23,18 @@ #include "GattCallbackParamTypes.h" -#include "CallChainOfFunctionPointersWithContext.h" - class GattClient { public: - typedef FunctionPointerWithContext<const GattReadCallbackParams*> ReadCallback_t; - typedef CallChainOfFunctionPointersWithContext<const GattReadCallbackParams*> ReadCallbackChain_t; + 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 FunctionPointerWithContext<const GattWriteCallbackParams*> WriteCallback_t; - typedef CallChainOfFunctionPointersWithContext<const GattWriteCallbackParams*> WriteCallbackChain_t; + typedef void (*WriteCallback_t)(const GattWriteCallbackParams *params); - typedef FunctionPointerWithContext<const GattHVXCallbackParams*> HVXCallback_t; - typedef CallChainOfFunctionPointersWithContext<const GattHVXCallbackParams*> HVXCallbackChain_t; + typedef void (*HVXCallback_t)(const GattHVXCallbackParams *params); /* * The following functions are meant to be overridden in the platform-specific sub-class. @@ -47,48 +42,48 @@ public: /** * Launch service discovery. Once launched, application callbacks will be - * 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(). + * 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(). * * @param connectionHandle * Handle for the connection with the peer. * @param sc - * This is the application callback for a matching service. Taken as + * This is the application callback for 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 a local copy of the discoveredService and + * may be better to make 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 a matching characteristic. + * This is the application callback for 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 a local copy of the discoveredCharacteristic + * it may be better to make 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 @@ -104,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 porters: override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): 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 set up) will be invoked - * at the end. Service discovery can be terminated prematurely, if needed, + * determine status; and a termination callback (if setup) 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 a matching service. Note: service discovery may still be active + * This is the application callback for 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 a local copy of the discoveredService and + * may be better to make 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. * @@ -147,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. Porters are free to override this. */ + * services. Porter(s) 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 set up) will be invoked - * at the end. Service discovery can be terminated prematurely, if needed, + * determine status; and a termination callback (if setup) 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 a matching service. Note: service discovery may still be active + * This is the application callback for 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 a local copy of the discoveredService and + * may be better to make 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. @@ -178,115 +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 porters: override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** * Is service-discovery currently active? */ virtual bool isServiceDiscoveryActive(void) const { - return false; /* Requesting action from porters: override this API if this capability is supported. */ + return false; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** - * Terminate an ongoing service discovery. This should result in an - * invocation of 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 terminateServiceDiscovery(void) { - /* Requesting action from porters: override this API if this capability is supported. */ + /* Requesting action from porter(s): 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 porters: override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): 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 porters: override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /* Event callback handlers. */ public: /** - * Set up a callback for read response events. - * It is possible to remove registered callbacks using - * onDataRead().detach(callbackToRemove) + * Setup a callback for read response events. */ void onDataRead(ReadCallback_t callback) { - onDataReadCallbackChain.add(callback); - } - - /** - * @brief provide access to the callchain of read callbacks - * It is possible to register callbacks using onDataRead().add(callback); - * It is possible to unregister callbacks using onDataRead().detach(callback) - * @return The read callbacks chain - */ - ReadCallbackChain_t& onDataRead() { - return onDataReadCallbackChain; + onDataReadCallback = callback; } /** - * Set up a callback for write response events. - * It is possible to remove registered callbacks using - * onDataWritten().detach(callbackToRemove). - * @Note: Write commands (issued using writeWoResponse) don't generate a response. + * Setup a callback for write response events. + * @Note: write commands (issued using writeWoResponse) don't generate a response. */ void onDataWritten(WriteCallback_t callback) { - onDataWriteCallbackChain.add(callback); + onDataWriteCallback = callback; } /** - * @brief provide access to the callchain of data written callbacks - * It is possible to register callbacks using onDataWritten().add(callback); - * It is possible to unregister callbacks using onDataWritten().detach(callback) - * @return The data written callbacks chain - */ - WriteCallbackChain_t& onDataWritten() { - return onDataWriteCallbackChain; - } - - /** - * Set up a callback for write response events. - * @Note: Write commands (issued using writeWoResponse) don't generate a response. + * Setup 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. @@ -296,63 +267,55 @@ } /** - * Set up a callback for when serviceDiscovery terminates. + * Setup 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 porters: override this API if this capability is supported. */ + /* Requesting action from porter(s): override this API if this capability is supported. */ } /** - * 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. - * It is possible to remove registered callbacks using onHVX().detach(callbackToRemove). + * Setup a callback for when GattClient receives an update event + * corresponding to a change in value of a characteristic on the remote + * GattServer. */ void onHVX(HVXCallback_t callback) { - onHVXCallbackChain.add(callback); - } - - - /** - * @brief provide access to the callchain of HVX callbacks - * It is possible to register callbacks using onHVX().add(callback); - * It is possible to unregister callbacks using onHVX().detach(callback) - * @return The HVX callbacks chain - */ - HVXCallbackChain_t& onHVX() { - return onHVXCallbackChain; + onHVXCallback = callback; } protected: GattClient() { - /* Empty */ + /* empty */ } /* Entry points for the underlying stack to report events back to the user. */ public: void processReadResponse(const GattReadCallbackParams *params) { - onDataReadCallbackChain(params); + if (onDataReadCallback) { + onDataReadCallback(params); + } } void processWriteResponse(const GattWriteCallbackParams *params) { - onDataWriteCallbackChain(params); + if (onDataWriteCallback) { + onDataWriteCallback(params); + } } void processHVXEvent(const GattHVXCallbackParams *params) { - if (onHVXCallbackChain) { - onHVXCallbackChain(params); + if (onHVXCallback) { + onHVXCallback(params); } } protected: - ReadCallbackChain_t onDataReadCallbackChain; - WriteCallbackChain_t onDataWriteCallbackChain; - HVXCallbackChain_t onHVXCallbackChain; + ReadCallback_t onDataReadCallback; + WriteCallback_t onDataWriteCallback; + HVXCallback_t onHVXCallback; private: - /* Disallow copy and assignment. */ + /* disallow copy and assignment */ GattClient(const GattClient &); GattClient& operator=(const GattClient &); };
--- a/ble/GattServer.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/GattServer.h Mon Jan 11 08:51:25 2016 +0000 @@ -26,18 +26,9 @@ class GattServer { public: - /* Event callback handlers. */ - typedef FunctionPointerWithContext<unsigned> DataSentCallback_t; - typedef CallChainOfFunctionPointersWithContext<unsigned> DataSentCallbackChain_t; - - typedef FunctionPointerWithContext<const GattWriteCallbackParams*> DataWrittenCallback_t; - typedef CallChainOfFunctionPointersWithContext<const GattWriteCallbackParams*> DataWrittenCallbackChain_t; - - typedef FunctionPointerWithContext<const GattReadCallbackParams*> DataReadCallback_t; - typedef CallChainOfFunctionPointersWithContext<const GattReadCallbackParams *> DataReadCallbackChain_t; - - typedef FunctionPointerWithContext<GattAttribute::Handle_t> EventCallback_t; + typedef void (*EventCallback_t)(GattAttribute::Handle_t attributeHandle); + typedef void (*ServerEventCallback_t)(void); /**< independent of any particular attribute */ protected: GattServer() : @@ -62,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 porters: override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** - * Read the value of a characteristic from the local GATT server. + * Read the value of a characteristic from the local GattServer * @param[in] attributeHandle * Attribute handle for the value attribute of the characteristic. * @param[out] buffer @@ -84,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 porters: override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** - * Read the value of a characteristic from the local GATT server. + * Read the value of a characteristic from the local GattServer * @param[in] connectionHandle - * Connection handle. + * Connection Handle. * @param[in] attributeHandle * Attribute handle for the value attribute of the characteristic. * @param[out] buffer @@ -109,32 +100,32 @@ * * @return BLE_ERROR_NONE if a value was read successfully into the buffer. * - * @note This API is a version of the above, with an additional connection handle + * @note This API is a version of 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 porters: override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** - * Update the value of a characteristic on the local GATT server. + * Update the value of a characteristic on the local GattServer. * * @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 - * GATT server regardless of the state of the + * GattServer 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. @@ -142,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 porters: override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** - * 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 + * Update the value of a characteristic on the local GattServer. A version + * of the same as above with 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 @@ -174,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 porters: override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** - * Determine the updates-enabled status (notification or indication) for the current connection from a characteristic's CCCD. + * Determine the updates-enabled status (notification/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 porters: override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** - * Determine the connection-specific updates-enabled status (notification or indication) from a characteristic's CCCD. + * Determine the connection-specific updates-enabled status (notification/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 porters: override this API if this capability is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if this capability is supported. */ } /** @@ -229,7 +220,7 @@ * onDataRead(). It should be overridden to return true as applicable. */ virtual bool isOnDataReadAvailable() const { - return false; /* Requesting action from porters: override this API if this capability is supported. */ + return false; /* Requesting action from porter(s): override this API if this capability is supported. */ } /* @@ -240,81 +231,60 @@ * 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 set up a callback into a member function of + * @Note: it is also possible to setup a callback into a member function of * some object. */ - void onDataSent(const DataSentCallback_t& callback) {dataSentCallChain.add(callback);} + void onDataSent(void (*callback)(unsigned count)) {dataSentCallChain.add(callback);} template <typename T> void onDataSent(T *objPtr, void (T::*memberPtr)(unsigned count)) { dataSentCallChain.add(objPtr, memberPtr); } /** - * @brief get the callback chain called when the event DATA_EVENT is triggered. - */ - DataSentCallbackChain_t& onDataSent() { - return dataSentCallChain; - } - - /** - * 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 + * 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 * 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 set up a callback into a member function of + * @Note: it is also possible to setup a callback into a member function of * some object. - * - * @Note It is possible to unregister a callback using onDataWritten().detach(callback) */ - void onDataWritten(const DataWrittenCallback_t& callback) {dataWrittenCallChain.add(callback);} + void onDataWritten(void (*callback)(const GattWriteCallbackParams *eventDataP)) {dataWrittenCallChain.add(callback);} template <typename T> void onDataWritten(T *objPtr, void (T::*memberPtr)(const GattWriteCallbackParams *context)) { dataWrittenCallChain.add(objPtr, memberPtr); } /** - * @brief provide access to the callchain of data written event callbacks - * It is possible to register callbacks using onDataWritten().add(callback); - * It is possible to unregister callbacks using onDataWritten().detach(callback) - * @return The data written event callbacks chain - */ - DataWrittenCallbackChain_t& onDataWritten() { - return dataWrittenCallChain; - } - - /** * 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 set up a callback into a member function of + * @Note: it is also possible to setup a callback into a member function of * some object. * - * @Note It is possible to unregister a callback using onDataRead().detach(callback) - * * @return BLE_ERROR_NOT_IMPLEMENTED if this functionality isn't available; * else BLE_ERROR_NONE. */ - ble_error_t onDataRead(const DataReadCallback_t& callback) { + ble_error_t onDataRead(void (*callback)(const GattReadCallbackParams *eventDataP)) { if (!isOnDataReadAvailable()) { return BLE_ERROR_NOT_IMPLEMENTED; } @@ -333,29 +303,19 @@ } /** - * @brief provide access to the callchain of data read event callbacks - * It is possible to register callbacks using onDataRead().add(callback); - * It is possible to unregister callbacks using onDataRead().detach(callback) - * @return The data read event callbacks chain - */ - DataReadCallbackChain_t& onDataRead() { - return dataReadCallChain; - } - - /** - * Set up a callback for when notifications or indications are enabled for a - * characteristic on the local GATT server. + * Setup a callback for when notifications/indications are enabled for a + * characteristic on the local GattServer. */ void onUpdatesEnabled(EventCallback_t callback) {updatesEnabledCallback = callback;} /** - * Set up a callback for when notifications or indications are disabled for a - * characteristic on the local GATT server. + * Setup a callback for when notifications/indications are disabled for a + * characteristic on the local GattServer. */ void onUpdatesDisabled(EventCallback_t callback) {updatesDisabledCallback = callback;} /** - * Set up a callback for when the GATT server receives a response for an + * Setup a callback for when the GATT server receives a response for an * indication event sent previously. */ void onConfirmationReceived(EventCallback_t callback) {confirmationReceivedCallback = callback;} @@ -363,11 +323,15 @@ /* Entry points for the underlying stack to report events back to the user. */ protected: void handleDataWrittenEvent(const GattWriteCallbackParams *params) { - dataWrittenCallChain.call(params); + if (dataWrittenCallChain.hasCallbacksAttached()) { + dataWrittenCallChain.call(params); + } } void handleDataReadEvent(const GattReadCallbackParams *params) { - dataReadCallChain.call(params); + if (dataReadCallChain.hasCallbacksAttached()) { + dataReadCallChain.call(params); + } } void handleEvent(GattServerEvents::gattEvent_e type, GattAttribute::Handle_t attributeHandle) { @@ -393,7 +357,9 @@ } void handleDataSentEvent(unsigned count) { - dataSentCallChain.call(count); + if (dataSentCallChain.hasCallbacksAttached()) { + dataSentCallChain.call(count); + } } protected: @@ -401,15 +367,15 @@ uint8_t characteristicCount; private: - DataSentCallbackChain_t dataSentCallChain; - DataWrittenCallbackChain_t dataWrittenCallChain; - DataReadCallbackChain_t dataReadCallChain; - EventCallback_t updatesEnabledCallback; - EventCallback_t updatesDisabledCallback; - EventCallback_t confirmationReceivedCallback; + CallChainOfFunctionPointersWithContext<unsigned> dataSentCallChain; + CallChainOfFunctionPointersWithContext<const GattWriteCallbackParams *> dataWrittenCallChain; + CallChainOfFunctionPointersWithContext<const GattReadCallbackParams *> dataReadCallChain; + EventCallback_t updatesEnabledCallback; + EventCallback_t updatesDisabledCallback; + EventCallback_t confirmationReceivedCallback; private: - /* Disallow copy and assignment. */ + /* disallow copy and assignment */ GattServer(const GattServer &); GattServer& operator=(const GattServer &); };
--- a/ble/GattServerEvents.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/GattServerEvents.h Mon Jan 11 08:51:25 2016 +0000 @@ -26,13 +26,13 @@ { public: typedef enum gattEvent_e { - 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. */ + 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 */ } gattEvent_t; };
--- a/ble/GattService.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/GattService.h Mon Jan 11 08:51:25 2016 +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/SafeBool.h Thu Dec 10 09:15:05 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +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 BLE_API_SAFE_BOOL_H_ -#define BLE_API_SAFE_BOOL_H_ - -//safe bool idiom, see : http://www.artima.com/cppsource/safebool.html - -namespace SafeBool_ { -/** - * @brief Base class for all intances of SafeBool, - * This base class reduce instantiation of trueTag function - */ -class base { - template<typename> - friend class SafeBool; - -protected: - //the bool type is a pointer to method which can be used in boolean context - typedef void (base::*BoolType_t)() const; - - // non implemented call, use to disallow conversion between unrelated types - void invalidTag() const; - - // member function which indicate true value - void trueTag() const {} -}; - - -} - -/** - * @brief template class SafeBool use CRTP to made boolean conversion easy and correct. - * Derived class should implement the function bool toBool() const to make this work. Inheritance - * should be public. - * - * @tparam T Type of the derived class - * - * \code - * - * class A : public SafeBool<A> { - * public: - * - * // boolean conversion - * bool toBool() { - * - * } - * }; - * - * class B : public SafeBool<B> { - * public: - * - * // boolean conversion - * bool toBool() const { - * - * } - * }; - * - * A a; - * B b; - * - * // will compile - * if(a) { - * - * } - * - * // compilation error - * if(a == b) { - * - * } - * - * - * \endcode - */ -template <typename T> -class SafeBool : public SafeBool_::base { -public: - /** - * bool operator implementation, derived class has to provide bool toBool() const function. - */ - operator BoolType_t() const { - return (static_cast<const T*>(this))->toBool() - ? &SafeBool<T>::trueTag : 0; - } -}; - -//Avoid conversion to bool between different classes -template <typename T, typename U> -void operator==(const SafeBool<T>& lhs,const SafeBool<U>& rhs) { - lhs.invalidTag(); -// return false; -} - -//Avoid conversion to bool between different classes -template <typename T,typename U> -void operator!=(const SafeBool<T>& lhs,const SafeBool<U>& rhs) { - lhs.invalidTag(); -// return false; -} - -#endif /* BLE_API_SAFE_BOOL_H_ */ \ No newline at end of file
--- a/ble/SecurityManager.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/SecurityManager.h Mon Jan 11 08:51:25 2016 +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 or states. + * @brief Defines possible security status/states. * - * @details Defines possible security status or states of a link when requested by getLinkSecurity(). + * @details Defines possible security status/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 the I/O capabilities of this peripheral, - * such as availability of a display or keyboard, to + * @param[in] iocaps To specify IO 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 porters: override this API if security is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): 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 the failure reason. + * @return BLE_SUCCESS Or appropriate error code indicating reason for failure. */ 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 porters: override this API if security is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): 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 or + * @retval BLE_ERROR_INVALID_STATE If the API is called without module initialization and/or * application registration. */ virtual ble_error_t purgeAllBondingState(void) { - return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if security is supported. */ + return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porter(s): override this API if security is supported. */ } /* Event callback handlers. */ public: /** - * To indicate that a security procedure for the link has started. + * To indicate that security procedure for link has started. */ virtual void onSecuritySetupInitiated(SecuritySetupInitiatedCallback_t callback) {securitySetupInitiatedCallback = callback;} /** - * To indicate that the security procedure for the link has completed. + * To indicate that security procedure for link has completed. */ virtual void onSecuritySetupCompleted(SecuritySetupCompletedCallback_t callback) {securitySetupCompletedCallback = callback;} /** - * 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). + * 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. */ virtual void onLinkSecured(LinkSecuredCallback_t callback) {linkSecuredCallback = callback;}
--- a/ble/ServiceDiscovery.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/ServiceDiscovery.h Mon Jan 11 08:51:25 2016 +0000 @@ -31,75 +31,75 @@ */ /** - * 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 to work with the service beyond the callback. + * this object in order to work with the service beyond the callback. */ - typedef FunctionPointerWithContext<const DiscoveredService *> ServiceCallback_t; + 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 to work with the characteristic beyond the callback. + * this object in order to work with the characteristic beyond the callback. */ - typedef FunctionPointerWithContext<const DiscoveredCharacteristic *> CharacteristicCallback_t; + typedef void (*CharacteristicCallback_t)(const DiscoveredCharacteristic *); /** * Callback type for when serviceDiscovery terminates. */ - typedef FunctionPointerWithContext<Gap::Handle_t> TerminationCallback_t; + typedef void (*TerminationCallback_t)(Gap::Handle_t connectionHandle); public: /** * Launch service discovery. Once launched, service discovery will remain * active with callbacks being issued back into the application for matching - * 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(). + * 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(). * * @param connectionHandle * Handle for the connection with the peer. * @param sc - * This is the application callback for a matching service. Taken as + * This is the application callback for 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 a local copy of the discoveredService and + * may be better to make 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 a matching characteristic. + * This is the application callback for 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 a local copy of the discoveredCharacteristic + * it may be better to make 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 a 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 @@ -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; /** - * Set up a callback to be invoked when service discovery is terminated. + * Setup callback to be invoked when service discovery is terminated. */ virtual void onTermination(TerminationCallback_t callback) = 0;
--- a/ble/UUID.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/UUID.h Mon Jan 11 08:51:25 2016 +0000 @@ -19,120 +19,37 @@ #include <stdint.h> #include <string.h> -#include <algorithm> #include "blecommon.h" -/** - * A trivial converter for single hexadecimal character to unsigned-int. - * @param c hexadecimal character. - * @return the corresponding value as unsigned int. - */ -static uint8_t char2int(char c) { - if ((c >= '0') && (c <= '9')) { - return c - '0'; - } else if ((c >= 'a') && (c <= 'f')) { - return c - 'a' + 10; - } else if ((c >= 'A') && (c <= 'F')) { - return c - 'A' + 10; - } else { - return 0; - } -} - 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 }; - /** - * An enumeration to specify byte ordering of the long version of the UUID. - */ - typedef enum { - MSB, /*!< Most-significant byte first (at the smallest address) */ - LSB /*!< least-significant byte first (at the smallest address) */ - } ByteOrder_t; - typedef uint16_t ShortUUIDBytes_t; static const unsigned LENGTH_OF_LONG_UUID = 16; typedef uint8_t LongUUIDBytes_t[LENGTH_OF_LONG_UUID]; - static const unsigned MAX_UUID_STRING_LENGTH = LENGTH_OF_LONG_UUID * 2 + 4; - public: - /** - * 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. - * - * @param stringUUID - * The 128-bit (16-byte) UUID as a human readable const-string. - * Format: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX - * Upper and lower case supported. Hyphens are optional, but only - * upto four of them. The UUID is stored internally as a 16 byte - * array, LSB (little endian), which is opposite from the string. - */ - UUID(const char* stringUUID) : type(UUID_TYPE_LONG), baseUUID(), shortUUID(0) { - bool nibble = false; - uint8_t byte = 0; - size_t baseIndex = 0; - uint8_t tempUUID[LENGTH_OF_LONG_UUID]; - - // Iterate through string, abort if NULL is encountered prematurely. - // Ignore upto four hyphens. - for (size_t index = 0; (index < MAX_UUID_STRING_LENGTH) && (baseIndex < LENGTH_OF_LONG_UUID); index++) { - if (stringUUID[index] == '\0') { - // error abort - break; - } else if (stringUUID[index] == '-') { - // ignore hyphen - continue; - } else if (nibble) { - // got second nibble - byte |= char2int(stringUUID[index]); - nibble = false; - - // store copy - tempUUID[baseIndex++] = byte; - } else { - // got first nibble - byte = char2int(stringUUID[index]) << 4; - nibble = true; - } - } - - // populate internal variables if string was successfully parsed - if (baseIndex == LENGTH_OF_LONG_UUID) { - setupLong(tempUUID, UUID::MSB); - } else { - const uint8_t sig[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, - 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB }; - setupLong(sig, UUID::MSB); - } - } - - /** - * 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. * * @param longUUID - * The 128-bit (16-byte) UUID value. - * @param order - * The bit order of the UUID, MSB by default. + * The 128-bit (16-byte) UUID value, MSB first (big-endian). */ - UUID(const LongUUIDBytes_t longUUID, ByteOrder_t order = UUID::MSB) : type(UUID_TYPE_LONG), baseUUID(), shortUUID(0) { - setupLong(longUUID, order); + UUID(const LongUUIDBytes_t longUUID) : type(UUID_TYPE_LONG), baseUUID(), shortUUID(0) { + setupLong(longUUID); } /** - * 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. @@ -141,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 (listed by the Bluetooth SIG as standard + * specification (i.e., that are listed by the Bluetooth SIG as standard * Bluetooth UUIDs). * * To reconstruct the full 128-bit UUID from the shortened version, insert @@ -155,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) { @@ -172,17 +89,12 @@ } /** - * Fill in a 128-bit UUID; this is useful when the UUID isn't known at the time of the object construction. + * Fill in a 128-bit UUID; this is useful when UUID isn't known at the time of object construction. */ - void setupLong(const LongUUIDBytes_t longUUID, ByteOrder_t order = UUID::MSB) { + void setupLong(const LongUUIDBytes_t longUUID) { type = UUID_TYPE_LONG; - if (order == UUID::MSB) { - // Switch endian. Input is big-endian, internal representation is little endian. - std::reverse_copy(longUUID, longUUID + LENGTH_OF_LONG_UUID, baseUUID); - } else { - std::copy(longUUID, longUUID + LENGTH_OF_LONG_UUID, baseUUID); - } - shortUUID = (uint16_t)((baseUUID[13] << 8) | (baseUUID[12])); + memcpy(baseUUID, longUUID, LENGTH_OF_LONG_UUID); + shortUUID = (uint16_t)((longUUID[2] << 8) | (longUUID[3])); } public: @@ -220,8 +132,12 @@ private: UUID_Type_t type; // UUID_TYPE_SHORT or UUID_TYPE_LONG - LongUUIDBytes_t baseUUID; // The long UUID - ShortUUIDBytes_t shortUUID; // 16 bit UUID + 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 + * part.*/ + 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 Dec 10 09:15:05 2015 +0000 +++ b/ble/blecommon.h Mon Jan 11 08:51:25 2016 +0000 @@ -22,7 +22,9 @@ #endif -/*! @brief Assigned values for BLE UUIDs. */ +/** @defgroup BLE_UUID_VALUES Assigned Values for BLE UUIDs + * @{ */ +/* Generic UUIDs, applicable to all services */ enum { BLE_UUID_UNKNOWN = 0x0000, /**< Reserved UUID. */ BLE_UUID_SERVICE_PRIMARY = 0x2800, /**< Primary Service. */ @@ -48,10 +50,11 @@ BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR = 0x2A03, /**< Reconnection Address Characteristic. */ BLE_UUID_GAP_CHARACTERISTIC_PPCP = 0x2A04, /**< Peripheral Preferred Connection Parameters Characteristic. */ }; +/** @} */ -/*! 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 { BLE_APPEARANCE_UNKNOWN = 0, /**< Unknown. */ BLE_APPEARANCE_GENERIC_PHONE = 64, /**< Generic Phone. */ @@ -68,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, /**< 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_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_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. */ @@ -95,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). */ @@ -103,18 +106,22 @@ BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_POD = 5187, /**< Location Pod (Outdoor Sports Activity subtype). */ BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_POD = 5188, /**< Location and Navigation Pod (Outdoor Sports Activity subtype). */ }; - +/** @} */ -/*! @brief Error codes for the BLE API. */ +/**************************************************************************/ +/*! + \brief Error codes for the BLE API +*/ +/**************************************************************************/ 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 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_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_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 Dec 10 09:15:05 2015 +0000 +++ b/ble/services/BatteryService.h Mon Jan 11 08:51:25 2016 +0000 @@ -21,18 +21,18 @@ /** * @class BatteryService -* @brief BLE Battery Service. This service displays the battery level from 0% to 100%, represented as an 8bit number. -* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.battery_service.xml +* @brief BLE Battery Service. This service displays the battery level from 0%->100% represented as a 8bit number.<br> +* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.battery_service.xml <br> * Battery Level Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.battery_level.xml */ 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), @@ -45,11 +45,11 @@ } /** - * @brief Update the battery level with a new value. [Valid values lie between 0 and 100]; - * anything outside this range will be ignored. + * @brief Update the battery level with a new value. Valid values range from + * 0..100. Anything outside this range will be ignored. * * @param newLevel - * Update to battery level. + * update to battery level. */ void updateBatteryLevel(uint8_t newLevel) { batteryLevel = newLevel;
--- a/ble/services/DFUService.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/services/DFUService.h Mon Jan 11 08:51:25 2016 +0000 @@ -14,17 +14,13 @@ * limitations under the License. */ -#ifdef TARGET_NRF51822 /* DFU only supported on nrf51 platforms */ - #ifndef __BLE_DFU_SERVICE_H__ #define __BLE_DFU_SERVICE_H__ #include "ble/BLE.h" #include "ble/UUID.h" -extern "C" { -#include "dfu_app_handler.h" -} +extern "C" void bootloader_start(void); extern const uint8_t DFUServiceBaseUUID[]; extern const uint16_t DFUServiceShortUUID; @@ -41,20 +37,20 @@ class DFUService { public: /** - * @brief Signature for the handover callback. The application may provide this - * callback when setting up the DFU service. The callback is then + * @brief Signature for the handover callback. The application may provide such a + * callback when setting up the DFU service, in which case it will be * invoked before handing control over to the bootloader. */ typedef void (*ResetPrepare_t)(void); public: /** - * @brief Adds Device Firmware Update Service to an existing BLE object. + * @brief Adds Device Firmware Update service to an existing ble object. * * @param[ref] _ble * BLE object for the underlying controller. * @param[in] _handoverCallback - * Application-specific handover callback. + * Application specific handover callback. */ DFUService(BLE &_ble, ResetPrepare_t _handoverCallback = NULL) : ble(_ble), @@ -63,12 +59,12 @@ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE), controlBytes(), packetBytes() { - static bool serviceAdded = false; /* We only add the DFU service once. */ + static bool serviceAdded = false; /* We should only ever need to add the DFU service once. */ if (serviceAdded) { return; } - /* Set an initial value for control bytes, so that the application's DFU service can + /* Set an initial value for control bytes so that the application's DFUService can * be distinguished from the real DFU service provided by the bootloader. */ controlBytes[0] = 0xFF; controlBytes[1] = 0xFF; @@ -84,7 +80,7 @@ } /** - * @brief Get the handle for the value attribute of the control characteristic. + * @brief get the handle for the value attribute of the control characteristic. */ uint16_t getControlHandle(void) const { return controlPoint.getValueHandle(); @@ -92,7 +88,7 @@ /** * @brief This callback allows the DFU service to receive the initial trigger to - * hand control over to the bootloader. First, the application is given a + * handover control to the bootloader; but first the application is given a * chance to clean up. * * @param[in] params @@ -100,20 +96,12 @@ */ virtual void onDataWritten(const GattWriteCallbackParams *params) { if (params->handle == controlPoint.getValueHandle()) { - /* At present, writing anything will do the trick - this needs to be improved. */ + /* At present, writing anything will do the trick--this needs to be improved. */ if (handoverCallback) { handoverCallback(); } - // Call bootloader_start implicitly trough a event handler call - // it is a work around for bootloader_start not being public in sdk 8.1 - ble_dfu_t p_dfu; - ble_dfu_evt_t p_evt; - - p_dfu.conn_handle = params->connHandle; - p_evt.ble_dfu_evt_type = BLE_DFU_START; - - dfu_app_on_dfu_evt(&p_dfu, &p_evt); + bootloader_start(); } } @@ -124,23 +112,22 @@ protected: BLE &ble; - /**< Writing to the control characteristic triggers the handover to DFU - * bootloader. At present, writing anything will do the trick - this needs + /**< Writing to the control characteristic triggers the handover to dfu- + * bootloader. At present, writing anything will do the trick--this needs * to be improved. */ WriteOnlyArrayGattCharacteristic<uint8_t, SIZEOF_CONTROL_BYTES> controlPoint; - /**< The packet characteristic in this service doesn't do anything meaningful; - * it is only a placeholder to mimic the corresponding characteristic in the + /**< The packet characteristic in this service doesn't do anything meaningful, but + * is only a placeholder to mimic the corresponding characteristic in the * actual DFU service implemented by the bootloader. Without this, some - * FOTA clients might get confused, because service definitions change after + * FOTA clients might get confused as service definitions change after * handing control over to the bootloader. */ GattCharacteristic packet; uint8_t controlBytes[SIZEOF_CONTROL_BYTES]; uint8_t packetBytes[SIZEOF_PACKET_BYTES]; - static ResetPrepare_t handoverCallback; /**< Application-specific handover callback. */ + static ResetPrepare_t handoverCallback; /**< application specific handover callback. */ }; -#endif /* #ifndef __BLE_DFU_SERVICE_H__*/ -#endif /* #ifdef TARGET_NRF51822 */ \ No newline at end of file +#endif /* #ifndef __BLE_DFU_SERVICE_H__*/ \ No newline at end of file
--- a/ble/services/DeviceInformationService.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/services/DeviceInformationService.h Mon Jan 11 08:51:25 2016 +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 Dec 10 09:15:05 2015 +0000 +++ b/ble/services/EddystoneConfigService.h Mon Jan 11 08:51:25 2016 +0000 @@ -17,8 +17,6 @@ #ifndef SERVICES_EDDYSTONE_BEACON_CONFIG_SERVICE_H_ #define SERVICES_EDDYSTONE_BEACON_CONFIG_SERVICE_H_ -#warning ble/services/EddystoneConfigService.h is deprecated. Please use the example in 'github.com/ARMmbed/ble-examples/tree/master/BLE_EddystoneService'. - #include "mbed.h" #include "ble/BLE.h" #include "ble/services/EddystoneService.h" @@ -42,7 +40,7 @@ /** * @class EddystoneConfigService -* @brief Eddystone Configuration Service. Used to set URL, adjust power levels, and set flags. +* @brief Eddystone Configuration Service. Can be used to set URL, adjust power levels, and set flags. * See https://github.com/google/eddystone * */ @@ -61,54 +59,54 @@ }; 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. + static const unsigned SERVICE_DATA_MAX = 31; // Maximum size of service data in ADV packets - typedef uint8_t Lock_t[16]; /* 128 bits. */ + typedef uint8_t Lock_t[16]; /* 128 bits */ typedef int8_t PowerLevels_t[NUM_POWER_MODES]; - // There are currently three subframes defined: URI, UID, and TLM. + // 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. + // 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. + // 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 14B. - static const uint8_t FRAME_SIZE_UID = 20; // includes RFU bytes. + 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. + 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(). + 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. + uint8_t tlmVersion; // version of TLM packet bool tlmEnabled; - float tlmBeaconPeriod; // How often to broadcat TLM frame, in seconds. + 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. + 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. + 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. + float uidBeaconPeriod; // how often to broadcast UID Frame, in seconds. }; /** @@ -118,19 +116,19 @@ * Reference to application-visible beacon state, loaded * from persistent storage at startup. * @param[in] defaultAdvPowerLevelsIn - * Default power-levels array; applies only if resetToDefaultsFlag is true. + * 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. + params(paramsIn), // Initialize URL Data defaultAdvPowerLevels(defaultAdvPowerLevelsIn), radioPowerLevels(radioPowerLevelsIn), initSucceeded(false), resetFlag(), - defaultUidNamespaceID(), // Initialize UID data. + defaultUidNamespaceID(), // Initialize UID Data defaultUidInstanceID(), defaultUidPower(defaultAdvPowerLevelsIn[params.txPowerMode]), uidIsSet(false), @@ -149,7 +147,7 @@ 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. + // 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); @@ -195,12 +193,12 @@ updateCharacteristicValues(); } - setupEddystoneConfigAdvertisements(); /* Set up advertising for the config service. */ + setupEddystoneConfigAdvertisements(); /* Setup advertising for the configService. */ initSucceeded = true; } /* - * Check if Eddystone initialized successfully. + * Check if eddystone initialized successfully */ bool initSuccessfully(void) const { return initSucceeded; @@ -209,8 +207,8 @@ /* * @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, measured in minutes. + * @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){ @@ -221,35 +219,35 @@ TlmPduCount = 0; TlmTimeSinceBoot = 0; defaultTlmAdvPeriod = advPeriodInSec; - tlmIsSet = true; // Flag to add this to Eddystone service when config is done. + 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, measured in number of ADV frames. + * @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. + 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. + 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, measured in the number of ADV frames. + * @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){ @@ -258,12 +256,12 @@ 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. + uidIsSet = true; // flag to add this to eddystone service when config is done } - /* Start out by advertising the config service for a limited time after - * startup, then switch to the normal non-connectible beacon functionality. - */ + /* 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"; @@ -271,7 +269,7 @@ ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); - // UUID is in a different order in the ADV frame (!) + // 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]; @@ -292,18 +290,18 @@ /* * 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. + * 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. + // 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.") - // Set up Eddystone Service. + // Setup Eddystone Service static EddystoneService eddyServ(ble, params.beaconPeriod, radioPowerLevels[params.txPowerMode]); - // Set configured frames (TLM, UID, URI and so on). + // Set configured frames (TLM,UID,URI...etc) if (params.tlmEnabled) { eddyServ.setTLMFrameData(params.tlmVersion, params.tlmBeaconPeriod); } @@ -316,7 +314,7 @@ (uint8_t *)params.uidInstanceID, params.uidBeaconPeriod); } - // Start advertising the Eddystone service. + // Start Advertising the eddystone service. eddyServ.start(); } @@ -330,19 +328,19 @@ uint16_t handle = writeParams->handle; if (handle == lockChar.getValueHandle()) { - // Validated earlier. + // 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). + // 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. + // 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. + 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()) { @@ -377,7 +375,7 @@ resetToDefaults(); } updateCharacteristicValues(); - params.isConfigured = true; // Some configuration data has been passed; on disconnect switch to advertising mode. + params.isConfigured = true; // some configuration data has been passed, on disconnect switch to advertising mode. } /* @@ -385,7 +383,7 @@ */ void resetToDefaults(void) { INFO("Resetting to defaults"); - // General. + // General params.lockedState = false; memset(params.lock, 0, sizeof(Lock_t)); params.flags = 0x10; @@ -393,18 +391,18 @@ params.txPowerMode = TX_POWER_MODE_LOW; params.beaconPeriod = (uint16_t) defaultUriAdvPeriod * 1000; - // TLM Frame. + // TLM Frame params.tlmVersion = defaultTlmVersion; params.tlmBeaconPeriod = defaultTlmAdvPeriod; params.tlmEnabled = tlmIsSet; - // URL Frame. + // URL Frame memcpy(params.uriData, defaultUriData, URI_DATA_MAX); params.uriDataLength = defaultUriDataLength; params.uriBeaconPeriod = defaultUriAdvPeriod; params.uriEnabled = urlIsSet; - // UID Frame. + // UID Frame memcpy(params.uidNamespaceID, defaultUidNamespaceID, UID_NAMESPACEID_SIZE); memcpy(params.uidInstanceID, defaultUidInstanceID, UID_INSTANCEID_SIZE); params.uidBeaconPeriod = defaultUidAdvPeriod; @@ -496,15 +494,15 @@ 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. + // 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. + //UID Default value that is restored on reset UIDNamespaceID_t defaultUidNamespaceID; UIDInstanceID_t defaultUidInstanceID; float defaultUidAdvPeriod; @@ -512,14 +510,14 @@ uint16_t uidRFU; bool uidIsSet; - //URI default value that is restored on reset. + //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. + //TLM Default value that is restored on reset uint8_t defaultTlmVersion; float defaultTlmAdvPeriod; volatile uint16_t TlmBatteryVoltage;
--- a/ble/services/EddystoneService.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/services/EddystoneService.h Mon Jan 11 08:51:25 2016 +0000 @@ -17,8 +17,6 @@ #ifndef SERVICES_EDDYSTONEBEACON_H_ #define SERVICES_EDDYSTONEBEACON_H_ -#warning ble/services/EddystoneService.h is deprecated. Please use the example in 'github.com/ARMmbed/ble-examples/tree/master/BLE_EddystoneService'. - #include "ble/BLE.h" #include "mbed.h" #include "CircularBuffer.h"
--- a/ble/services/EnvironmentalService.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/services/EnvironmentalService.h Mon Jan 11 08:51:25 2016 +0000 @@ -21,10 +21,10 @@ /** * @class EnvironmentalService -* @brief BLE Environmental Service. This service provides temperature, humidity and pressure measurement. -* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.environmental_sensing.xml -* Temperature: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.temperature.xml -* Humidity: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.humidity.xml +* @brief BLE Environmental Service. This service provides the location of the thermometer and the temperature. <br> +* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.environmental_sensing.xml <br> +* Temperature: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.temperature.xml <br> +* Humidity: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.humidity.xml <br> * Pressure: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.pressure.xml */ class EnvironmentalService {
--- a/ble/services/HealthThermometerService.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/services/HealthThermometerService.h Mon Jan 11 08:51:25 2016 +0000 @@ -21,34 +21,34 @@ /** * @class HealthThermometerService -* @brief BLE Health Thermometer Service. This service provides the location of the thermometer and the temperature. -* Service: https://developer.bluetooth.org/gatt/profiles/Pages/ProfileViewer.aspx?u=org.bluetooth.profile.health_thermometer.xml -* Temperature Measurement: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.temperature_measurement.xml +* @brief BLE Health Thermometer Service. This service provides the location of the thermometer and the temperature. <br> +* Service: https://developer.bluetooth.org/gatt/profiles/Pages/ProfileViewer.aspx?u=org.bluetooth.profile.health_thermometer.xml <br> +* Temperature Measurement: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.temperature_measurement.xml <br> * Temperature Type: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.temperature_type.xml */ class HealthThermometerService { public: /** - * @enum Sensor Location. - * @brief Location of sensor on the body. + * @enum Sensor Location + * @brief Location of sensor on the body */ enum SensorLocation_t { - LOCATION_ARMPIT = 1, /*!< Armpit. */ - LOCATION_BODY, /*!< Body. */ - LOCATION_EAR, /*!< Ear. */ - LOCATION_FINGER, /*!< Finger. */ + LOCATION_ARMPIT = 1, /*!< armpit */ + LOCATION_BODY, /*!< body */ + LOCATION_EAR, /*!< ear */ + LOCATION_FINGER, /*!< finger */ LOCATION_GI_TRACT, /*!< GI tract */ - LOCATION_MOUTH, /*!< Mouth. */ - LOCATION_RECTUM, /*!< Rectum. */ - LOCATION_TOE, /*!< Toe. */ - LOCATION_EAR_DRUM, /*!< Eardrum. */ + LOCATION_MOUTH, /*!< mouth */ + LOCATION_RECTUM, /*!< rectum */ + LOCATION_TOE, /*!< toe */ + LOCATION_EAR_DRUM, /*!< ear drum */ }; public: /** - * @brief Add the Health Thermometer Service to an existing BLE object, initialize with temperature and location. - * @param[ref] _ble Reference to the BLE device. - * @param[in] initialTemp Initial value in celsius. + * @brief Add the Health Thermometer Service to an existing ble object, initialize with temperature and location. + * @param[ref] _ble reference to the BLE device + * @param[in] initialTemp initial value in celsius * @param[in] _location */ HealthThermometerService(BLE &_ble, float initialTemp, uint8_t _location) : @@ -64,10 +64,10 @@ } /** - * @brief Update the temperature being broadcast. + * @brief Update the temperature being broadcast * * @param[in] temperature - * Floating point value of the temperature. + * Floating point value of the temperature * */ void updateTemperature(float temperature) { @@ -80,14 +80,14 @@ /** * @brief Update the location. * @param loc - * New location value. + * new location value. */ void updateLocation(SensorLocation_t loc) { ble.gattServer().write(tempLocation.getValueHandle(), reinterpret_cast<uint8_t *>(&loc), sizeof(uint8_t)); } private: - /* Private internal representation for the bytes used to work with the vaulue of the temperature characteristic. */ + /* Private internal representation for the bytes used to work with the vaulue of the heart-rate characteristic. */ struct TemperatureValueBytes { static const unsigned OFFSET_OF_FLAGS = 0; static const unsigned OFFSET_OF_VALUE = OFFSET_OF_FLAGS + sizeof(uint8_t); @@ -101,7 +101,7 @@ static const uint8_t TEMPERATURE_UNITS_FAHRENHEIT = 1; TemperatureValueBytes(float initialTemperature) : bytes() { - /* Assumption: temperature values are expressed in celsius */ + /* assumption: temperature values are expressed in Celsius */ bytes[OFFSET_OF_FLAGS] = (TEMPERATURE_UNITS_CELSIUS << TEMPERATURE_UNITS_FLAG_POS) | (false << TIMESTAMP_FLAG_POS) | (false << TEMPERATURE_TYPE_FLAG_POS); @@ -128,15 +128,15 @@ * @return The temperature in 11073-20601 FLOAT-Type format. */ uint32_t quick_ieee11073_from_float(float temperature) { - uint8_t exponent = 0xFE; //Exponent is -2 + uint8_t exponent = 0xFE; //exponent is -2 uint32_t mantissa = (uint32_t)(temperature * 100); return (((uint32_t)exponent) << 24) | mantissa; } private: - /* First byte: 8-bit flags. Second field is a float holding the temperature value. */ - /* See https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.temperature_measurement.xml */ + /* First byte = 8-bit flags, Second field is a float holding the temperature value. */ + /* See --> https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.temperature_measurement.xml */ uint8_t bytes[SIZEOF_VALUE_BYTES]; };
--- a/ble/services/HeartRateService.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/services/HeartRateService.h Mon Jan 11 08:51:25 2016 +0000 @@ -21,35 +21,35 @@ /** * @class HeartRateService -* @brief BLE Service for HeartRate. This BLE Service contains the location of the sensor and the heart rate in beats per minute. -* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.heart_rate.xml -* HRM Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml +* @brief BLE Service for HeartRate. This BLE Service contains the location of the sensor, the heartrate in beats per minute. <br> +* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.heart_rate.xml <br> +* HRM Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml <br> * Location: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.body_sensor_location.xml */ class HeartRateService { public: /** * @enum SensorLocation - * @brief Location of the heart rate sensor on body. + * @brief Location of HeartRate sensor on body. */ enum { - LOCATION_OTHER = 0, /*!< Other location. */ - LOCATION_CHEST, /*!< Chest. */ - LOCATION_WRIST, /*!< Wrist. */ - LOCATION_FINGER, /*!< Finger. */ - LOCATION_HAND, /*!< Hand. */ - LOCATION_EAR_LOBE, /*!< Earlobe. */ - LOCATION_FOOT, /*!< Foot. */ + LOCATION_OTHER = 0, /*!< Other Location */ + LOCATION_CHEST, /*!< Chest */ + LOCATION_WRIST, /*!< Wrist */ + LOCATION_FINGER, /*!< Finger */ + LOCATION_HAND, /*!< Hand */ + LOCATION_EAR_LOBE, /*!< Earlobe */ + LOCATION_FOOT, /*!< Foot */ }; public: /** - * @brief Constructor with 8-bit HRM Counter value. + * @brief Constructor with 8bit HRM Counter value. * * @param[ref] _ble * Reference to the underlying BLE. * @param[in] hrmCounter (8-bit) - * Initial value for the HRM counter. + * initial value for the hrm counter. * @param[in] location * Sensor's location. */ @@ -70,7 +70,7 @@ * @param[in] _ble * Reference to the underlying BLE. * @param[in] hrmCounter (8-bit) - * Initial value for the HRM counter. + * initial value for the hrm counter. * @param[in] location * Sensor's location. */ @@ -86,10 +86,10 @@ } /** - * @brief Set a new 8-bit value for the heart rate. + * @brief Set a new 8-bit value for heart rate. * * @param[in] hrmCounter - * Heart rate in BPM. + * HeartRate in bpm. */ void updateHeartRate(uint8_t hrmCounter) { valueBytes.updateHeartRate(hrmCounter); @@ -97,10 +97,10 @@ } /** - * Set a new 16-bit value for the heart rate. + * Set a new 16-bit value for heart rate. * * @param[in] hrmCounter - * Heart rate in BPM. + * HeartRate in bpm. */ void updateHeartRate(uint16_t hrmCounter) { valueBytes.updateHeartRate(hrmCounter); @@ -108,8 +108,8 @@ } /** - * This callback allows the heart rate service to receive updates to the - * controlPoint characteristic. + * This callback allows the HeartRateService to receive updates to the + * controlPoint Characteristic. * * @param[in] params * Information about the characterisitc being updated. @@ -118,7 +118,7 @@ if (params->handle == controlPoint.getValueAttribute().getHandle()) { /* Do something here if the new value is 1; else you can override this method by * extending this class. - * @NOTE: If you are extending this class, be sure to also call + * @NOTE: if you are extending this class, be sure to also call * ble.onDataWritten(this, &ExtendedHRService::onDataWritten); in * your constructor. */ @@ -135,9 +135,9 @@ } protected: - /* Private internal representation for the bytes used to work with the value of the heart rate characteristic. */ + /* Private internal representation for the bytes used to work with the vaulue of the heart-rate characteristic. */ struct HeartRateValueBytes { - static const unsigned MAX_VALUE_BYTES = 3; /* Flags, and up to two bytes for heart rate. */ + static const unsigned MAX_VALUE_BYTES = 3; /* FLAGS + up to two bytes for heart-rate */ static const unsigned FLAGS_BYTE_INDEX = 0; static const unsigned VALUE_FORMAT_BITNUM = 0; @@ -175,8 +175,8 @@ } private: - /* First byte: 8-bit values, no extra info. Second byte: uint8_t HRM value */ - /* See https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml */ + /* First byte = 8-bit values, no extra info, Second byte = uint8_t HRM value */ + /* See --> https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml */ uint8_t valueBytes[MAX_VALUE_BYTES]; };
--- a/ble/services/LinkLossService.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/services/LinkLossService.h Mon Jan 11 08:51:25 2016 +0000 @@ -21,9 +21,9 @@ /** * @class LinkLossService -* @brief This service defines behavior when a link is lost between two devices. -* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.link_loss.xml -* Alertness Level Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.alert_level.xml +* @brief This service defines behavior when a link is lost between two devices. <br> +* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.link_loss.xml <br> +* Alertness Level Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.alert_level.xml <br> */ class LinkLossService { public: @@ -67,7 +67,7 @@ } /** - * Update alertness level. + * Update Alertness Level. */ void setAlertLevel(AlertLevel_t newLevel) { alertLevel = newLevel; @@ -75,7 +75,7 @@ protected: /** - * This callback allows receiving updates to the AlertLevel characteristic. + * This callback allows receiving updates to the AlertLevel Characteristic. * * @param[in] params * Information about the characterisitc being updated.
--- a/ble/services/UARTService.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/services/UARTService.h Mon Jan 11 08:51:25 2016 +0000 @@ -40,12 +40,12 @@ extern const uint8_t UARTServiceRXCharacteristicUUID[UUID::LENGTH_OF_LONG_UUID]; /** -* @class UARTService. -* @brief BLE Service to enable UART over BLE. +* @class UARTService +* @brief BLE Service to enable UART over BLE */ class UARTService { public: - /**< Maximum length of data (in bytes) that the UART service module can transmit to the peer. */ + /**< Maximum length of data (in bytes) that can be transmitted by the UART service module to the peer. */ static const unsigned BLE_UART_SERVICE_MAX_DATA_LEN = (BLE_GATT_MTU_SIZE_DEFAULT - 3); public: @@ -87,20 +87,20 @@ /** * We attempt to collect bytes before pushing them to the UART RX - * characteristic; writing to the RX characteristic then generates + * characteristic--writing to the RX characteristic will then generate * notifications for the client. Updates made in quick succession to a - * notification-generating characteristic result in data being buffered - * in the Bluetooth stack as notifications are sent out. The stack has - * its limits for this buffering - typically a small number under 10. + * notification-generating characteristic will result in data being buffered + * in the bluetooth stack as notifications are sent out. The stack will have + * its limits for this buffering; typically a small number under 10. * Collecting data into the sendBuffer buffer helps mitigate the rate of * updates. But we shouldn't buffer a large amount of data before updating - * the characteristic, otherwise the client needs to turn around and make + * the characteristic otherwise the client will need to turn around and make * a long read request; this is because notifications include only the first * 20 bytes of the updated data. * - * @param buffer The received update. - * @param length Number of characters to be appended. - * @return Number of characters appended to the rxCharacteristic. + * @param buffer The received update + * @param length Amount of characters to be appended. + * @return Amount of characters appended to the rxCharacteristic. */ size_t write(const void *_buffer, size_t length) { size_t origLength = length; @@ -112,13 +112,13 @@ unsigned bytesRemainingInSendBuffer = BLE_UART_SERVICE_MAX_DATA_LEN - sendBufferIndex; unsigned bytesToCopy = (length < bytesRemainingInSendBuffer) ? length : bytesRemainingInSendBuffer; - /* Copy bytes into sendBuffer. */ + /* copy bytes into sendBuffer */ memcpy(&sendBuffer[sendBufferIndex], &buffer[bufferIndex], bytesToCopy); length -= bytesToCopy; sendBufferIndex += bytesToCopy; bufferIndex += bytesToCopy; - /* Have we collected enough? */ + /* have we collected enough? */ if ((sendBufferIndex == BLE_UART_SERVICE_MAX_DATA_LEN) || // (sendBuffer[sendBufferIndex - 1] == '\r') || (sendBuffer[sendBufferIndex - 1] == '\n')) { @@ -134,14 +134,14 @@ /** * Helper function to write out strings. * @param str The received string. - * @return Number of characters appended to the rxCharacteristic. + * @return Amount of characters appended to the rxCharacteristic. */ size_t writeString(const char *str) { return write(str, strlen(str)); } /** - * Override for Stream::_putc(). + * Override for Stream::_putc() * @param c * This function writes the character c, cast to an unsigned char, to stream. * @return @@ -152,7 +152,7 @@ } /** - * Override for Stream::_getc(). + * Override for Stream::_getc() * @return * The character read. */ @@ -168,7 +168,7 @@ /** * This callback allows the UART service to receive updates to the * txCharacteristic. The application should forward the call to this - * function from the global onDataWritten() callback handler; if that's + * function from the global onDataWritten() callback handler; or if that's * not used, this method can be used as a callback directly. */ void onDataWritten(const GattWriteCallbackParams *params) {
--- a/ble/services/URIBeaconConfigService.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/services/URIBeaconConfigService.h Mon Jan 11 08:51:25 2016 +0000 @@ -47,18 +47,18 @@ class URIBeaconConfigService { public: /** - * @brief Transmission power modes for UriBeacon. + * @brief Transmission Power Modes for UriBeacon */ - static const uint8_t TX_POWER_MODE_LOWEST = 0; /*!< Lowest TX power mode. */ - static const uint8_t TX_POWER_MODE_LOW = 1; /*!< Low TX power mode. */ - static const uint8_t TX_POWER_MODE_MEDIUM = 2; /*!< Medium TX power mode. */ - static const uint8_t TX_POWER_MODE_HIGH = 3; /*!< High TX power mode. */ - static const unsigned NUM_POWER_MODES = 4; /*!< Number of power modes defined. */ + static const uint8_t TX_POWER_MODE_LOWEST = 0; /*!< Lowest TX power mode */ + static const uint8_t TX_POWER_MODE_LOW = 1; /*!< Low TX power mode */ + static const uint8_t TX_POWER_MODE_MEDIUM = 2; /*!< Medium TX power mode */ + static const uint8_t TX_POWER_MODE_HIGH = 3; /*!< High TX power mode */ + static const unsigned NUM_POWER_MODES = 4; /*!< Number of Power Modes defined */ static const int ADVERTISING_INTERVAL_MSEC = 1000; // Advertising interval for config service. - static const int SERVICE_DATA_MAX = 31; // Maximum size of service data in ADV packets. + static const int SERVICE_DATA_MAX = 31; // Maximum size of service data in ADV packets - typedef uint8_t Lock_t[16]; /* 128 bits. */ + typedef uint8_t Lock_t[16]; /* 128 bits */ typedef int8_t PowerLevels_t[NUM_POWER_MODES]; static const int URI_DATA_MAX = 18; @@ -69,8 +69,8 @@ uint8_t uriDataLength; UriData_t uriData; uint8_t flags; - PowerLevels_t advPowerLevels; // Current value of AdvertisedPowerLevels. - uint8_t txPowerMode; // Firmware power levels used with setTxPower(). + PowerLevels_t advPowerLevels; // Current value of AdvertisedPowerLevels + uint8_t txPowerMode; // Firmware power levels used with setTxPower() uint16_t beaconPeriod; }; @@ -86,9 +86,9 @@ * un-initialized, and default values should be used * instead. Otherwise, paramsIn overrides the defaults. * @param[in] defaultUriDataIn - * Default un-encoded URI. Applies only if the resetToDefaultsFlag is true. + * Default un-encoded URI; applies only if the resetToDefaultsFlag is true. * @param[in] defaultAdvPowerLevelsIn - * Default power-levels array. Applies only if the resetToDefaultsFlag is true. + * Default power-levels array; applies only if the resetToDefaultsFlag is true. */ URIBeaconConfigService(BLE &bleIn, Params_t ¶msIn, @@ -148,7 +148,7 @@ ble.addService(configService); ble.onDataWritten(this, &URIBeaconConfigService::onDataWrittenCallback); - setupURIBeaconConfigAdvertisements(); /* Set up advertising for the config service. */ + setupURIBeaconConfigAdvertisements(); /* Setup advertising for the configService. */ initSucceeded = true; } @@ -157,9 +157,9 @@ return initSucceeded; } - /* Start out by advertising the config service for a limited time after - * startup. Then switch to the normal non-connectible beacon functionality. - */ + /* Start out by advertising the configService for a limited time after + * startup; and switch to the normal non-connectible beacon functionality + * afterwards. */ void setupURIBeaconConfigAdvertisements() { const char DEVICE_NAME[] = "mUriBeacon Config"; @@ -186,14 +186,14 @@ ble.gap().setAdvertisingInterval(GapAdvertisingParams::MSEC_TO_ADVERTISEMENT_DURATION_UNITS(ADVERTISING_INTERVAL_MSEC)); } - /* Helper function to switch to the non-connectible normal mode for UriBeacon. This gets called after a timeout. */ + /* Helper function to switch to the non-connectible normal mode for URIBeacon. This gets called after a timeout. */ void setupURIBeaconAdvertisements() { /* Reinitialize the BLE stack. This will clear away the existing services and advertising state. */ ble.shutdown(); ble.init(); - // Fields from the service. + // Fields from the Service unsigned beaconPeriod = params.beaconPeriod; unsigned txPowerMode = params.txPowerMode; unsigned uriDataLength = params.uriDataLength; @@ -201,7 +201,7 @@ URIBeaconConfigService::PowerLevels_t &advPowerLevels = params.advPowerLevels; uint8_t flags = params.flags; - extern void saveURIBeaconConfigParams(const Params_t *paramsP); /* Forward declaration; necessary to avoid a circular dependency. */ + extern void saveURIBeaconConfigParams(const Params_t *paramsP); /* forward declaration; necessary to avoid a circular dependency. */ saveURIBeaconConfigParams(¶ms); ble.gap().clearAdvertisingPayload(); @@ -224,7 +224,7 @@ } private: - // True if the lock bits are non-zero. + // True if the lock bits are non-zero bool isLocked() { Lock_t testLock; memset(testLock, 0, sizeof(Lock_t)); @@ -233,19 +233,19 @@ /* * This callback is invoked when a GATT client attempts to modify any of the - * characteristics of this service. These attempts are also applied to + * 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, + // Validated earlier memcpy(params.lock, writeParams->data, sizeof(Lock_t)); - // Use isLocked() in case bits are being set to all zeros. + // use isLocked() in case bits are being set to all 0's lockedState = isLocked(); } else if (handle == unlockChar.getValueHandle()) { - // Validated earlier. + // Validated earlier memset(params.lock, 0, sizeof(Lock_t)); lockedState = false; } else if (handle == uriDataChar.getValueHandle()) { @@ -260,7 +260,7 @@ } else if (handle == beaconPeriodChar.getValueHandle()) { params.beaconPeriod = *((uint16_t *)(writeParams->data)); - /* Remap beaconPeriod to within permissible bounds if necessary. */ + /* Re-map beaconPeriod to within permissible bounds if necessary. */ if (params.beaconPeriod != 0) { bool paramsUpdated = false; if (params.beaconPeriod < ble.gap().getMinAdvertisingInterval()) { @@ -378,9 +378,9 @@ BLE &ble; Params_t ¶ms; - size_t defaultUriDataLength; // Default value that is restored on reset. - UriData_t defaultUriData; // Default value that is restored on reset. - PowerLevels_t &defaultAdvPowerLevels; // Default value that is restored on reset. + size_t defaultUriDataLength; // Default value that is restored on reset + UriData_t defaultUriData; // Default value that is restored on reset + PowerLevels_t &defaultAdvPowerLevels; // Default value that is restored on reset uint8_t lockedState; bool initSucceeded; @@ -398,7 +398,7 @@ public: /* - * Encode a human-readable URI into the binary format defined by the UriBeacon spec (https://github.com/google/uribeacon/tree/master/specification). + * Encode a human-readable URI into the binary format defined by URIBeacon spec (https://github.com/google/uribeacon/tree/master/specification). */ static void encodeURI(const char *uriDataIn, UriData_t uriDataOut, size_t &sizeofURIDataOut) { const char *prefixes[] = { @@ -447,7 +447,7 @@ } /* - * Handle suffixes. + * handle suffixes */ while (*uriDataIn && (sizeofURIDataOut < URI_DATA_MAX)) { /* check for suffix match */ @@ -457,10 +457,10 @@ if (strncmp(uriDataIn, suffixes[i], suffixLen) == 0) { uriDataOut[sizeofURIDataOut++] = i; uriDataIn += suffixLen; - break; /* From the for loop for checking against suffixes. */ + break; /* from the for loop for checking against suffixes */ } } - /* This is the default case where we've got an ordinary character that doesn't match a suffix. */ + /* This is the default case where we've got an ordinary character which doesn't match a suffix. */ if (i == NUM_SUFFIXES) { uriDataOut[sizeofURIDataOut++] = *uriDataIn; ++uriDataIn;
--- a/ble/services/iBeacon.h Thu Dec 10 09:15:05 2015 +0000 +++ b/ble/services/iBeacon.h Mon Jan 11 08:51:25 2016 +0000 @@ -21,7 +21,7 @@ /** * @class iBeacon -* @brief iBeacon Service. This sets up a device to broadcast advertising packets to mimic an iBeacon. +* @brief iBeacon Service. This sets up a device to broadcast advertising packets to mimic an iBeacon<br> */ class iBeacon { @@ -56,12 +56,12 @@ uint16_t compID = 0x004C) : ble(_ble), data(uuid, majNum, minNum, txP, compID) { - // Generate the 0x020106 part of the iBeacon Prefix. + // Generate the 0x020106 part of the iBeacon Prefix ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE ); - // Generate the 0x1AFF part of the iBeacon Prefix. + // Generate the 0x1AFF part of the iBeacon Prefix ble.accumulateAdvertisingPayload(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, data.raw, sizeof(data.raw)); - // Set advertising type. + // Set advertising type ble.setAdvertisingType(GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED); }
--- a/module.json Thu Dec 10 09:15:05 2015 +0000 +++ b/module.json Mon Jan 11 08:51:25 2016 +0000 @@ -1,6 +1,6 @@ { "name": "ble", - "version": "2.1.11", + "version": "2.0.3", "description": "The BLE module offers a high level abstraction for using Bluetooth Low Energy on multiple platforms.", "keywords": [ "Bluetooth", @@ -13,7 +13,7 @@ "url": "https://github.com/ARMmbed/ble.git", "type": "git" }, - "homepage": "https://developer.mbed.org/teams/Bluetooth-Low-Energy/", + "homepage": "http://mbed.org/ble", "licenses": [ { "url": "https://spdx.org/licenses/Apache-2.0", @@ -26,7 +26,7 @@ "x-nucleo-idb0xa1": "ARMmbed/ble-x-nucleo-idb0xa1" }, "nrf51822": { - "ble-nrf51822": "^2.1.3" + "ble-nrf51822": "^2.0.0" }, "cordio": { "ble-wicentric": "~0.0.4"
--- a/source/DiscoveredCharacteristic.cpp Thu Dec 10 09:15:05 2015 +0000 +++ b/source/DiscoveredCharacteristic.cpp Mon Jan 11 08:51:25 2016 +0000 @@ -31,52 +31,6 @@ return gattc->read(connHandle, valueHandle, offset); } -struct OneShotReadCallback { - static void launch(GattClient* client, Gap::Handle_t connHandle, - GattAttribute::Handle_t handle, const GattClient::ReadCallback_t& cb) { - OneShotReadCallback* oneShot = new OneShotReadCallback(client, connHandle, handle, cb); - oneShot->attach(); - // delete will be made when this callback is called - } - -private: - OneShotReadCallback(GattClient* client, Gap::Handle_t connHandle, - GattAttribute::Handle_t handle, const GattClient::ReadCallback_t& cb) : - _client(client), - _connHandle(connHandle), - _handle(handle), - _callback(cb) { } - - void attach() { - _client->onDataRead(makeFunctionPointer(this, &OneShotReadCallback::call)); - } - - void call(const GattReadCallbackParams* params) { - // verifiy that it is the right characteristic on the right connection - if (params->connHandle == _connHandle && params->handle == _handle) { - _callback(params); - _client->onDataRead().detach(makeFunctionPointer(this, &OneShotReadCallback::call)); - delete this; - } - } - - GattClient* _client; - Gap::Handle_t _connHandle; - GattAttribute::Handle_t _handle; - GattClient::ReadCallback_t _callback; -}; - -ble_error_t DiscoveredCharacteristic::read(uint16_t offset, const GattClient::ReadCallback_t& onRead) const { - ble_error_t error = read(offset); - if (error) { - return error; - } - - OneShotReadCallback::launch(gattc, connHandle, valueHandle, onRead); - - return error; -} - ble_error_t DiscoveredCharacteristic::write(uint16_t length, const uint8_t *value) const { @@ -105,52 +59,6 @@ return gattc->write(GattClient::GATT_OP_WRITE_CMD, connHandle, valueHandle, length, value); } -struct OneShotWriteCallback { - static void launch(GattClient* client, Gap::Handle_t connHandle, - GattAttribute::Handle_t handle, const GattClient::WriteCallback_t& cb) { - OneShotWriteCallback* oneShot = new OneShotWriteCallback(client, connHandle, handle, cb); - oneShot->attach(); - // delete will be made when this callback is called - } - -private: - OneShotWriteCallback(GattClient* client, Gap::Handle_t connHandle, - GattAttribute::Handle_t handle, const GattClient::WriteCallback_t& cb) : - _client(client), - _connHandle(connHandle), - _handle(handle), - _callback(cb) { } - - void attach() { - _client->onDataWritten(makeFunctionPointer(this, &OneShotWriteCallback::call)); - } - - void call(const GattWriteCallbackParams* params) { - // verifiy that it is the right characteristic on the right connection - if (params->connHandle == _connHandle && params->handle == _handle) { - _callback(params); - _client->onDataWritten().detach(makeFunctionPointer(this, &OneShotWriteCallback::call)); - delete this; - } - } - - GattClient* _client; - Gap::Handle_t _connHandle; - GattAttribute::Handle_t _handle; - GattClient::WriteCallback_t _callback; -}; - -ble_error_t DiscoveredCharacteristic::write(uint16_t length, const uint8_t *value, const GattClient::WriteCallback_t& onRead) const { - ble_error_t error = write(length, value); - if (error) { - return error; - } - - OneShotWriteCallback::launch(gattc, connHandle, valueHandle, onRead); - - return error; -} - ble_error_t DiscoveredCharacteristic::discoverDescriptors(DescriptorCallback_t callback, const UUID &matchingUUID) const {
--- a/source/services/DFUService.cpp Thu Dec 10 09:15:05 2015 +0000 +++ b/source/services/DFUService.cpp Mon Jan 11 08:51:25 2016 +0000 @@ -14,8 +14,6 @@ * limitations under the License. */ -#ifdef TARGET_NRF51822 /* DFU only supported on nrf51 platforms */ - #include "ble/services/DFUService.h" const uint8_t DFUServiceBaseUUID[] = { @@ -39,6 +37,4 @@ 0x15, 0x23, 0x78, 0x5F, 0xEA, 0xBC, 0xD1, 0x23, }; -DFUService::ResetPrepare_t DFUService::handoverCallback = NULL; - -#endif /* #ifdef TARGET_NRF51822 */ \ No newline at end of file +DFUService::ResetPrepare_t DFUService::handoverCallback = NULL; \ No newline at end of file