Compare commits
102 Commits
Author | SHA1 | Date | |
---|---|---|---|
3d453811fb | |||
67b0b9b219 | |||
502b928aff | |||
a9cb0718fe | |||
a1dac4228a | |||
6e2587576d | |||
f8179328cf | |||
dae5c67c02 | |||
eb2ff59fe5 | |||
b36eb487eb | |||
bc61e9f86b | |||
61175740f6 | |||
a41f59984f | |||
0bab36a95a | |||
ff88313462 | |||
3f5c357971 | |||
d2e11d6f11 | |||
3e82dd8d0a | |||
4f5030ecf7 | |||
784e8a3eb8 | |||
7fbe71102a | |||
6f34162ac5 | |||
46ab65a344 | |||
d8cf4c82a5 | |||
ab14f4f82e | |||
56cbeb6183 | |||
6efe6916ba | |||
ea544e8391 | |||
0c46dd28be | |||
d493c015fd | |||
1e3797ec48 | |||
6effb25bd6 | |||
796f188cb3 | |||
e0bc9573d4 | |||
5733918a2f | |||
6740932c47 | |||
9fb0ca3466 | |||
d6ce082274 | |||
3587162611 | |||
2f1bad1c29 | |||
443888825f | |||
3872259687 | |||
14f80e779e | |||
8965d56c93 | |||
8614cb322a | |||
4390c30be8 | |||
fcf2b9c6aa | |||
89c9239798 | |||
062a7cb826 | |||
d614719d1d | |||
cbe7b64a97 | |||
f893613e99 | |||
5bc5379640 | |||
f537a5cd4c | |||
54c2c8db76 | |||
33b508110e | |||
ed52f0e5cb | |||
3772c807b4 | |||
d6f756a174 | |||
60c9e76bcc | |||
65a19d1779 | |||
1079cb7cdd | |||
bfbbb04065 | |||
7d6a755908 | |||
6727843477 | |||
aa8b2c5774 | |||
35394cee19 | |||
b633ecf97f | |||
d36499eac8 | |||
45c279f2eb | |||
a742459248 | |||
1a31085cce | |||
517f6c1e88 | |||
c8d0aee873 | |||
5547d99609 | |||
3d63b80c97 | |||
597b2a6f70 | |||
59d10e81ab | |||
d776edbab2 | |||
4ca399845f | |||
4759d70541 | |||
34b28928de | |||
94da23a1fd | |||
abfe85ab7d | |||
7271d4f5c4 | |||
c7ed54d037 | |||
b1d999e70b | |||
124a9eb41d | |||
479a9553f6 | |||
31c4f470fe | |||
53b58225a4 | |||
ae0d99369b | |||
bcdaccf68d | |||
a6aa972c1c | |||
67bd592ed9 | |||
dea82728af | |||
98f4bcde31 | |||
bb59d5db7a | |||
3abd3a5ee9 | |||
9bb485367a | |||
769b31e0ec | |||
52540a678a |
122
.clang-format
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
Language: Cpp
|
||||||
|
|
||||||
|
# Access modifiers in the middle
|
||||||
|
AccessModifierOffset: -2
|
||||||
|
|
||||||
|
# Align escaped newlines as far left as possible
|
||||||
|
AlignEscapedNewlinesLeft: true
|
||||||
|
|
||||||
|
# Align all trailing comments
|
||||||
|
AlignTrailingComments: true
|
||||||
|
|
||||||
|
# Don't allow parameters to be placed on the next line, even though BinPackParameters is false
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
|
|
||||||
|
# Do not allow short functions/if statements/loops on a single line
|
||||||
|
AllowShortFunctionsOnASingleLine: false
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
|
||||||
|
# Don't force breaks before multiline strings
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
|
||||||
|
# Don't force breaks before template declarations
|
||||||
|
AlwaysBreakTemplateDeclarations: false
|
||||||
|
|
||||||
|
# Force breaks after definition return type
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: true
|
||||||
|
|
||||||
|
# Arguments and parameters are either on one line or on one line each
|
||||||
|
BinPackArguments: false
|
||||||
|
BinPackParameters: false
|
||||||
|
|
||||||
|
# Do not break before binary operators
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
|
||||||
|
# Use the linux brace breaking style: Attach braces to context except for braces on functions,
|
||||||
|
# namespaces and class definitions
|
||||||
|
BreakBeforeBraces: Linux
|
||||||
|
|
||||||
|
# Do not place ternary operators after line breaks
|
||||||
|
BreakBeforeTernaryOperators: false
|
||||||
|
|
||||||
|
# In the constructor initializers do not align the comma with the colon
|
||||||
|
BreakConstructorInitializersBeforeComma: false
|
||||||
|
|
||||||
|
# Force columns to be less than 100 characters
|
||||||
|
ColumnLimit: 100
|
||||||
|
|
||||||
|
# Constructor initializer all in one line or all on their own line
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
|
|
||||||
|
# Indent constructor initializers
|
||||||
|
ConstructorInitializerIndentWidth: 8
|
||||||
|
|
||||||
|
# Do not indent continuations
|
||||||
|
ContinuationIndentWidth: 0
|
||||||
|
|
||||||
|
# Do not use braced lists in c++11 style
|
||||||
|
Cpp11BracedListStyle: false
|
||||||
|
|
||||||
|
# Do not derive pointer alignment
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
|
||||||
|
# Case labes are indented
|
||||||
|
IndentCaseLabels: true
|
||||||
|
|
||||||
|
# Do not indent function declarations
|
||||||
|
IndentFunctionDeclarationAfterType: false
|
||||||
|
|
||||||
|
# Indentation is 4 characters
|
||||||
|
IndentWidth: 4
|
||||||
|
|
||||||
|
# Do not keep empty lines at start of blocks
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
|
||||||
|
# Keep at most 2 consecutive empty lines
|
||||||
|
MaxEmptyLinesToKeep: 2
|
||||||
|
|
||||||
|
# Do not indent namespaces
|
||||||
|
NamespaceIndentation: None
|
||||||
|
|
||||||
|
# Spaces for ObjC properties and protocol lists
|
||||||
|
ObjCSpaceAfterProperty: true
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
|
||||||
|
# Penalties
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 100
|
||||||
|
PenaltyBreakComment: 10
|
||||||
|
PenaltyBreakFirstLessLess: 0
|
||||||
|
PenaltyBreakString: 100
|
||||||
|
PenaltyExcessCharacter: 20
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 20
|
||||||
|
|
||||||
|
# Force pointers to typename (i.e. char* a instead of char *a)
|
||||||
|
PointerAlignment: Left
|
||||||
|
|
||||||
|
# Spaces after C-style casts and before assignments
|
||||||
|
SpaceAfterCStyleCast: true
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
|
||||||
|
# Only space before parentheses if they are control statements
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
|
||||||
|
# Single space before trailing comments
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
|
||||||
|
# No spaces in parentheses, angles, or square brackets
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
|
||||||
|
# Use c++11 as the language standard
|
||||||
|
Standard: Cpp11
|
||||||
|
|
||||||
|
# Tabs are 4 characters wide
|
||||||
|
TabWidth: 4
|
||||||
|
|
||||||
|
# Don't use tabs for indentation :-(
|
||||||
|
UseTab: Never
|
||||||
|
|
@ -12,8 +12,10 @@ endif ()
|
|||||||
|
|
||||||
find_package (Threads REQUIRED)
|
find_package (Threads REQUIRED)
|
||||||
find_package (PkgConfig REQUIRED)
|
find_package (PkgConfig REQUIRED)
|
||||||
# force the libmraa version to be the required version
|
|
||||||
pkg_check_modules (MRAA REQUIRED mraa>=0.6.0)
|
# force a libmraa search and minimum required version every time a config is generated
|
||||||
|
unset(MRAA_FOUND CACHE)
|
||||||
|
pkg_check_modules (MRAA REQUIRED mraa>=0.6.2)
|
||||||
message (INFO " found libmraa version: ${MRAA_VERSION}")
|
message (INFO " found libmraa version: ${MRAA_VERSION}")
|
||||||
|
|
||||||
# Appends the cmake/modules path to MAKE_MODULE_PATH variable.
|
# Appends the cmake/modules path to MAKE_MODULE_PATH variable.
|
||||||
@ -28,7 +30,7 @@ include (GetGitRevisionDescription)
|
|||||||
git_describe (VERSION "--tags")
|
git_describe (VERSION "--tags")
|
||||||
if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND")
|
if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND")
|
||||||
message (WARNING " - Install git to compile a production libmraa!")
|
message (WARNING " - Install git to compile a production libmraa!")
|
||||||
set (VERSION "v0.2.0-dirty")
|
set (VERSION "v0.3.1-dirty")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
message (INFO " - UPM Version ${VERSION}")
|
message (INFO " - UPM Version ${VERSION}")
|
||||||
@ -56,18 +58,66 @@ option (BUILDDOC "Build all doc." OFF)
|
|||||||
option (BUILDSWIG "Build swig modules." ON)
|
option (BUILDSWIG "Build swig modules." ON)
|
||||||
option (BUILDSWIGPYTHON "Build swig python modules." ON)
|
option (BUILDSWIGPYTHON "Build swig python modules." ON)
|
||||||
option (BUILDSWIGNODE "Build swig node modules." ON)
|
option (BUILDSWIGNODE "Build swig node modules." ON)
|
||||||
|
option (BUILDEXAMPLES "Build C++ example binaries" OFF)
|
||||||
|
|
||||||
if (BUILDDOC)
|
if (BUILDDOC)
|
||||||
# add a target to generate API documentation with Doxygen
|
# add a target to generate API documentation with Doxygen
|
||||||
find_package (Doxygen)
|
find_package (Doxygen)
|
||||||
if (DOXYGEN_FOUND)
|
if (DOXYGEN_FOUND)
|
||||||
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
||||||
|
file(GLOB PNG_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/docs docs/*.png)
|
||||||
|
foreach(PNG_FILE ${PNG_FILES})
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/${PNG_FILE} ${CMAKE_CURRENT_BINARY_DIR}/html/docs/${PNG_FILE} COPYONLY)
|
||||||
|
endforeach()
|
||||||
add_custom_target (doc
|
add_custom_target (doc
|
||||||
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
COMMENT "Generating API documentation with Doxygen" VERBATIM
|
COMMENT "Generating API documentation with Doxygen" VERBATIM
|
||||||
)
|
)
|
||||||
endif (DOXYGEN_FOUND)
|
endif (DOXYGEN_FOUND)
|
||||||
|
# check if Sphinx is installed and add target to generate API documentation
|
||||||
|
find_package (Sphinx)
|
||||||
|
if(SPHINX_FOUND AND BUILDSWIG AND BUILDSWIGPYTHON)
|
||||||
|
# python required for Sphinx build
|
||||||
|
find_package (PythonLibs)
|
||||||
|
string (REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
|
||||||
|
list (GET PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR)
|
||||||
|
list (GET PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR)
|
||||||
|
set (SITE_PACKAGES ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
|
||||||
|
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/pydoc/conf.py @ONLY)
|
||||||
|
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/index.rst ${CMAKE_CURRENT_BINARY_DIR}/pydoc/index.rst COPYONLY)
|
||||||
|
add_custom_target (pydoc ALL
|
||||||
|
COMMAND rm -r -f ${CMAKE_BINARY_DIR}/pyupm && mkdir -p ${CMAKE_BINARY_DIR}/pyupm
|
||||||
|
COMMAND find ${CMAKE_BINARY_DIR}/src -name "_pyupm_*.so" -exec cp {} ${CMAKE_BINARY_DIR}/pyupm \;
|
||||||
|
COMMAND find ${CMAKE_BINARY_DIR}/src -name "pyupm_*.py" -exec cp {} ${CMAKE_BINARY_DIR}/pyupm \;
|
||||||
|
COMMAND ${SPHINX_API_EXECUTABLE} -f -o pydoc ${CMAKE_BINARY_DIR}/pyupm
|
||||||
|
# todo: use a separate cmake FILE module for string replacement instead
|
||||||
|
COMMAND ${SPHINX_EXECUTABLE} -b html pydoc html/python
|
||||||
|
COMMAND sed -i.bak s|\">pyupm_|\">|g html/python/index.html html/python/modules.html
|
||||||
|
COMMAND sed -i.bak s|[[:space:]][mM]odule</a>|</a>|g html/python/index.html html/python/modules.html
|
||||||
|
DEPENDS doc
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMENT "Generating API documentation with Sphinx" VERBATIM
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
# check if Yuidoc is installed and add target for API documentation
|
||||||
|
find_package(Yuidoc)
|
||||||
|
if(YUIDOC_FOUND AND BUILDSWIGNODE)
|
||||||
|
# node required for Yuidoc documentation
|
||||||
|
find_package(Node)
|
||||||
|
file(GLOB_RECURSE JSDOC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/doxy/node doxy/node/*)
|
||||||
|
foreach(JSDOC_FILE ${JSDOC_FILES})
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxy/node/${JSDOC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${JSDOC_FILE} COPYONLY)
|
||||||
|
endforeach()
|
||||||
|
add_custom_target(jsdoc ALL
|
||||||
|
COMMAND ${NODE_EXECUTABLE} docgen -m upm -i xml -t ${CMAKE_CURRENT_SOURCE_DIR}/src -g ../../
|
||||||
|
COMMAND ${YUIDOC_EXECUTABLE} -C --no-sort --helpers generators/yuidoc/helper.js --themedir generators/yuidoc/tmpl -o html/node jsdoc/yuidoc/upm
|
||||||
|
COMMAND ${NODE_EXECUTABLE} tolower -i html/node
|
||||||
|
DEPENDS doc
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMENT "Generating API documentation with Yuidoc" VERBATIM
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (IPK)
|
if (IPK)
|
||||||
@ -98,4 +148,7 @@ if (IPK)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory (src)
|
add_subdirectory (src)
|
||||||
add_subdirectory (examples/c++)
|
|
||||||
|
if(BUILDEXAMPLES)
|
||||||
|
add_subdirectory (examples/c++)
|
||||||
|
endif()
|
||||||
|
2
LICENSE
@ -1,4 +1,4 @@
|
|||||||
Copyright © 2014 Intel Corporation
|
Copyright © 2014-2015 Intel Corporation
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
a copy of this software and associated documentation files (the
|
a copy of this software and associated documentation files (the
|
||||||
|
23
README.md
@ -23,12 +23,21 @@ may also create more complex structures in order to interface with them.
|
|||||||
|
|
||||||
Browse through the list of all [examples](https://github.com/intel-iot-devkit/upm/tree/master/examples).
|
Browse through the list of all [examples](https://github.com/intel-iot-devkit/upm/tree/master/examples).
|
||||||
|
|
||||||
|
Multi-sensor samples for the starter and specialized kits can be found in the
|
||||||
|
[iot-devkit-samples](https://github.com/intel-iot-devkit/iot-devkit-samples) repository.
|
||||||
|
|
||||||
### Supported Sensors
|
### Supported Sensors
|
||||||
|
|
||||||
Supported [sensor list](http://iotdk.intel.com/docs/master/upm/modules.html) from API documentation.
|
Supported [sensor list](http://iotdk.intel.com/docs/master/upm/modules.html) from API documentation.
|
||||||
|
|
||||||
You can also refer to the [Intel® IoT Developer Zone](https://software.intel.com/iot/sensors).
|
You can also refer to the [Intel® IoT Developer Zone](https://software.intel.com/iot/sensors).
|
||||||
|
|
||||||
|
### IDE Integration
|
||||||
|
|
||||||
|
If you would like to create Eclipse IDE projects using the UPM C++ samples,
|
||||||
|
please follow the instructions posted [here](https://software.intel.com/en-us/node/551014).
|
||||||
|
This will show you how to import the code and configure your project.
|
||||||
|
|
||||||
### Building UPM
|
### Building UPM
|
||||||
|
|
||||||
See @ref building [here](docs/building.md).
|
See @ref building [here](docs/building.md).
|
||||||
@ -51,7 +60,17 @@ Make sure you add yourself as an author on every new code file submitted.
|
|||||||
If you are providing a fix with significant changes, feel free to add yourself
|
If you are providing a fix with significant changes, feel free to add yourself
|
||||||
as a contributor. Signing-off your commits is mandatory.
|
as a contributor. Signing-off your commits is mandatory.
|
||||||
|
|
||||||
C/C++ API Documentation
|
API Documentation
|
||||||
==============
|
==============
|
||||||
|
|
||||||
The C/C++ documentation is available [here](http://iotdk.intel.com/docs/master/upm/).
|
@htmlonly
|
||||||
|
|
||||||
|
<a href="http://iotdk.intel.com/docs/master/upm/modules.html"><img src="docs/c++.png"/></a>
|
||||||
|
<a href="http://iotdk.intel.com/docs/master/upm/python"><img src="docs/python.png"/></a>
|
||||||
|
<a href="http://iotdk.intel.com/docs/master/upm/node"><img src="docs/node.png"/></a>
|
||||||
|
|
||||||
|
@endhtmlonly
|
||||||
|
|
||||||
|
Version @ref changelog [here](docs/changelog.md).
|
||||||
|
|
||||||
|
List of @ref knownlimitations [here](docs/knownlimitations.md).
|
||||||
|
61
cmake/modules/FindNode.cmake
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
find_program (NODE_EXECUTABLE NAMES node
|
||||||
|
HINTS
|
||||||
|
$ENV{NODE_DIR}
|
||||||
|
PATH_SUFFIXES bin
|
||||||
|
DOC "Node.js interpreter"
|
||||||
|
)
|
||||||
|
|
||||||
|
include (FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
find_path (NODE_ROOT_DIR "node/node.h" "src/node.h"
|
||||||
|
PATHS /usr/include/nodejs /usr/local/include/nodejs)
|
||||||
|
|
||||||
|
set (NODE_INCLUDE_DIRS
|
||||||
|
${NODE_ROOT_DIR}/src
|
||||||
|
${NODE_ROOT_DIR}/node
|
||||||
|
${NODE_ROOT_DIR}/deps/v8/include
|
||||||
|
${NODE_ROOT_DIR}/deps/uv/include
|
||||||
|
)
|
||||||
|
|
||||||
|
find_package_handle_standard_args (Node DEFAULT_MSG
|
||||||
|
NODE_EXECUTABLE
|
||||||
|
NODE_INCLUDE_DIRS
|
||||||
|
)
|
||||||
|
|
||||||
|
if (NODE_EXECUTABLE)
|
||||||
|
execute_process(COMMAND ${NODE_EXECUTABLE} --version
|
||||||
|
OUTPUT_VARIABLE _VERSION
|
||||||
|
RESULT_VARIABLE _NODE_VERSION_RESULT)
|
||||||
|
execute_process(COMMAND ${NODE_EXECUTABLE} -e "console.log(process.versions.v8)"
|
||||||
|
OUTPUT_VARIABLE _V8_VERSION
|
||||||
|
RESULT_VARIABLE _V8_RESULT)
|
||||||
|
if (NOT _NODE_VERSION_RESULT AND NOT _V8_RESULT)
|
||||||
|
string (REPLACE "v" "" NODE_VERSION_STRING "${_VERSION}")
|
||||||
|
string (REPLACE "." ";" _VERSION_LIST "${NODE_VERSION_STRING}")
|
||||||
|
list (GET _VERSION_LIST 0 NODE_VERSION_MAJOR)
|
||||||
|
list (GET _VERSION_LIST 1 NODE_VERSION_MINOR)
|
||||||
|
list (GET _VERSION_LIST 2 NODE_VERSION_PATCH)
|
||||||
|
set (V8_VERSION_STRING ${_V8_VERSION})
|
||||||
|
string (REPLACE "." ";" _V8_VERSION_LIST "${_V8_VERSION}")
|
||||||
|
string (REPLACE "." "" V8_DEFINE_STRING "${_V8_VERSION}")
|
||||||
|
string (STRIP ${V8_DEFINE_STRING} V8_DEFINE_STRING)
|
||||||
|
list (GET _V8_VERSION_LIST 0 V8_VERSION_MAJOR)
|
||||||
|
list (GET _V8_VERSION_LIST 1 V8_VERSION_MINOR)
|
||||||
|
list (GET _V8_VERSION_LIST 2 V8_VERSION_PATCH)
|
||||||
|
# we end up with a nasty newline so strip everything that isn't a number
|
||||||
|
string (REGEX MATCH "^[0-9]*" V8_VERSION_PATCH ${V8_VERSION_PATCH})
|
||||||
|
else ()
|
||||||
|
set (NODE_VERSION_STRING "0.10.30")
|
||||||
|
set (NODE_VERSION_MAJOR "0")
|
||||||
|
set (NODE_VERSION_MINOR "10")
|
||||||
|
set (NODE_VERSION_PATCH "30")
|
||||||
|
set (V8_VERSION_MAJOR "3")
|
||||||
|
set (V8_VERSION_MINOR "28")
|
||||||
|
set (V8_VERSION_PATCH "72")
|
||||||
|
set (V8_VERSION_STRING "3.28.72")
|
||||||
|
message ("defaulted to node 0.10.30")
|
||||||
|
endif ()
|
||||||
|
message ("INFO - Node version is " ${NODE_VERSION_STRING} "INFO - Node using v8 " ${V8_VERSION_STRING})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
mark_as_advanced (NODE_EXECUTABLE)
|
31
cmake/modules/FindSphinx.cmake
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
find_program (SPHINX_EXECUTABLE NAMES sphinx-build
|
||||||
|
HINTS $ENV{SPHINX_DIR}
|
||||||
|
PATH_SUFFIXES bin
|
||||||
|
DOC "Sphinx documentation html generator"
|
||||||
|
)
|
||||||
|
|
||||||
|
find_program (SPHINX_API_EXECUTABLE NAMES sphinx-apidoc
|
||||||
|
HINTS $ENV{SPHINX_DIR}
|
||||||
|
PATH_SUFFIXES bin
|
||||||
|
DOC "Sphinx documentation rst generator"
|
||||||
|
)
|
||||||
|
|
||||||
|
include (FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
find_package_handle_standard_args (Sphinx DEFAULT_MSG
|
||||||
|
SPHINX_EXECUTABLE
|
||||||
|
SPHINX_API_EXECUTABLE
|
||||||
|
)
|
||||||
|
|
||||||
|
# Get Sphinx version
|
||||||
|
if (SPHINX_EXECUTABLE)
|
||||||
|
execute_process(COMMAND ${SPHINX_EXECUTABLE} --version
|
||||||
|
OUTPUT_VARIABLE SPHINX_VERSION)
|
||||||
|
if(SPHINX_VERSION)
|
||||||
|
string(REGEX MATCH "([0-9]\\.[0-9]\\.[0-9])" SPHINX_VERSION_STR ${SPHINX_VERSION})
|
||||||
|
message ("INFO - Sphinx version is " ${SPHINX_VERSION_STR})
|
||||||
|
endif()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
mark_as_advanced (SPHINX_EXECUTABLE)
|
||||||
|
mark_as_advanced (SPHINX_API_EXECUTABLE)
|
23
cmake/modules/FindYuidoc.cmake
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
find_program (YUIDOC_EXECUTABLE NAMES yuidoc
|
||||||
|
HINTS $ENV{YUIDOC_DIR}
|
||||||
|
PATHS usr usr/local
|
||||||
|
PATH_SUFFIXES bin
|
||||||
|
DOC "Yuidoc documentation generator"
|
||||||
|
)
|
||||||
|
|
||||||
|
include (FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
find_package_handle_standard_args (Yuidoc DEFAULT_MSG
|
||||||
|
YUIDOC_EXECUTABLE
|
||||||
|
)
|
||||||
|
|
||||||
|
# Get Yuidoc version
|
||||||
|
if (YUIDOC_EXECUTABLE)
|
||||||
|
execute_process(COMMAND ${YUIDOC_EXECUTABLE} --version
|
||||||
|
ERROR_VARIABLE YUIDOC_VERSION)
|
||||||
|
if(YUIDOC_VERSION)
|
||||||
|
message ("INFO - Yuidoc version is " ${YUIDOC_VERSION})
|
||||||
|
endif()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
mark_as_advanced (YUIDOC_EXECUTABLE)
|
@ -21,8 +21,12 @@ mkdir build
|
|||||||
cd build
|
cd build
|
||||||
cmake ..
|
cmake ..
|
||||||
make
|
make
|
||||||
|
make install
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
The last command will create the include/ and lib/ directories with a copy of
|
||||||
|
the headers and library objects respectively in your build location.
|
||||||
|
|
||||||
Our cmake configure has a number of options, *cmake-gui* or *ccmake* can show
|
Our cmake configure has a number of options, *cmake-gui* or *ccmake* can show
|
||||||
you all the options. The interesting ones are detailed below:
|
you all the options. The interesting ones are detailed below:
|
||||||
|
|
||||||
|
BIN
docs/c++.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
93
docs/changelog.md
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
Changelog {#changelog}
|
||||||
|
===============
|
||||||
|
|
||||||
|
Here's a list summarizing some of the key undergoing changes to our library
|
||||||
|
from earlier versions:
|
||||||
|
|
||||||
|
### v0.3.1
|
||||||
|
|
||||||
|
* Updated index pages for API documentation and cross-linked them
|
||||||
|
* More images were added for Grove, Adafruit and Sparkfun sensors along with
|
||||||
|
licensing information
|
||||||
|
* Addressed several issues reported by static code analysis tools
|
||||||
|
* Added support for Grove NFC Tag sensor
|
||||||
|
* Fixed several typos in library and sensor names
|
||||||
|
|
||||||
|
### v0.3.0
|
||||||
|
|
||||||
|
* New CMake targets to build python and node documentation with Sphinx and
|
||||||
|
Yuidoc
|
||||||
|
* Edited sensor names, library descriptions and doxygen tags for consistency
|
||||||
|
* Added support for several new sensors
|
||||||
|
* Fixed the TH02 sensor driver and made major improvements to i2clcd driver
|
||||||
|
* Updated and added new images for a lot of the existing sensors
|
||||||
|
* Added this changelog
|
||||||
|
|
||||||
|
### v0.2.0
|
||||||
|
|
||||||
|
* Passed 100 supported sensor drivers
|
||||||
|
* Updated header files with new doxygen tags for improved API documentation
|
||||||
|
generation
|
||||||
|
* Added python examples for sensors
|
||||||
|
* Fixed the buzzer and servo drivers for the Intel Edison
|
||||||
|
* Renamed bmp and gp2y sensor classes to be more generic
|
||||||
|
* Completely revamped implementation for tm1637
|
||||||
|
|
||||||
|
### v0.1.9
|
||||||
|
|
||||||
|
* Passed 50 supported sensor drivers
|
||||||
|
* Starter Kit and Additional Roadshow and Hackaton sensors added
|
||||||
|
* Several examples and documentation updates submitted
|
||||||
|
* Wrote new proper SWIG typemaps for arrays
|
||||||
|
* Fixed the i2clcd write function, improved several other sensors
|
||||||
|
|
||||||
|
### v0.1.8
|
||||||
|
|
||||||
|
* Added MQ series gas sensors and a few others
|
||||||
|
* Generated Doxygen layout file to improve API look and feel
|
||||||
|
* Several sensor documentation updates
|
||||||
|
|
||||||
|
### v0.1.7
|
||||||
|
|
||||||
|
* Fixed SWIG node build issues
|
||||||
|
* Added lpd8806 digital led strip
|
||||||
|
|
||||||
|
### v0.1.6
|
||||||
|
|
||||||
|
* Fixed SWIG python builds
|
||||||
|
* Extended i2clcd devices with new functions
|
||||||
|
* Made SWIG interface improvements and added extra types
|
||||||
|
* Added nrf8001 BLE support
|
||||||
|
* Few other sensor additions and fixes
|
||||||
|
|
||||||
|
### v0.1.5
|
||||||
|
|
||||||
|
* New drivers for microphone and mpu9150
|
||||||
|
* Added generic driver for stepper motors
|
||||||
|
* Updated all code to use MRAA and version dependency
|
||||||
|
|
||||||
|
### v0.1.4
|
||||||
|
|
||||||
|
* Added new bmp/gy pressure sensor and updated servo
|
||||||
|
* Started UPM documentation and related pages
|
||||||
|
* Updated MRAA dependencies
|
||||||
|
|
||||||
|
### v0.1.3
|
||||||
|
|
||||||
|
* Updated SWIG support for some sensors
|
||||||
|
* New sensor support for mma7455 accelerometer
|
||||||
|
|
||||||
|
### v0.1.2
|
||||||
|
|
||||||
|
* Several new sensors added
|
||||||
|
* Documentation fixes
|
||||||
|
* IPK generation
|
||||||
|
|
||||||
|
### v0.1.1
|
||||||
|
|
||||||
|
* Updated MRAA dependency
|
||||||
|
|
||||||
|
### v0.1.0
|
||||||
|
|
||||||
|
* Initial release with some basic grove sensors and hmc5883
|
||||||
|
* Doxygen and SWIG support implemented
|
BIN
docs/images/a110x.jpg
Executable file
After Width: | Height: | Size: 22 KiB |
BIN
docs/images/ad8232.jpg
Executable file
After Width: | Height: | Size: 222 KiB |
BIN
docs/images/adafruitms1438.jpg
Executable file
After Width: | Height: | Size: 168 KiB |
BIN
docs/images/adafruitss.jpg
Executable file
After Width: | Height: | Size: 173 KiB |
BIN
docs/images/adc121c021.jpg
Executable file
After Width: | Height: | Size: 15 KiB |
BIN
docs/images/apds9002.jpg
Executable file
After Width: | Height: | Size: 22 KiB |
BIN
docs/images/at42qt1070.jpg
Executable file
After Width: | Height: | Size: 178 KiB |
BIN
docs/images/biss0001.jpg
Executable file
After Width: | Height: | Size: 31 KiB |
BIN
docs/images/buzzer.jpg
Executable file
After Width: | Height: | Size: 9.7 KiB |
BIN
docs/images/cjq4435.jpg
Executable file
After Width: | Height: | Size: 110 KiB |
BIN
docs/images/ds1307.jpg
Executable file
After Width: | Height: | Size: 28 KiB |
BIN
docs/images/ecs1030.jpg
Executable file
After Width: | Height: | Size: 69 KiB |
BIN
docs/images/enc03r.jpg
Executable file
After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 166 KiB After Width: | Height: | Size: 166 KiB |
BIN
docs/images/flex.jpg
Executable file
After Width: | Height: | Size: 12 KiB |
BIN
docs/images/gp2y0a.jpg
Executable file
After Width: | Height: | Size: 44 KiB |
BIN
docs/images/grovebutton.jpg
Executable file
After Width: | Height: | Size: 164 KiB |
BIN
docs/images/grovecollision.jpg
Executable file
After Width: | Height: | Size: 27 KiB |
BIN
docs/images/groveehr.jpg
Executable file
After Width: | Height: | Size: 83 KiB |
BIN
docs/images/groveeldriver.jpg
Executable file
After Width: | Height: | Size: 10 KiB |
BIN
docs/images/groveelectromagnet.jpg
Executable file
After Width: | Height: | Size: 6.6 KiB |
BIN
docs/images/groveemg.jpg
Executable file
After Width: | Height: | Size: 41 KiB |
BIN
docs/images/grovegsr.jpg
Executable file
After Width: | Height: | Size: 15 KiB |
BIN
docs/images/groveled.jpg
Executable file
After Width: | Height: | Size: 138 KiB |
BIN
docs/images/grovelight.jpg
Executable file
After Width: | Height: | Size: 22 KiB |
BIN
docs/images/grovelinefinder.jpg
Executable file
After Width: | Height: | Size: 77 KiB |
BIN
docs/images/groveloudness.jpg
Executable file
After Width: | Height: | Size: 9.4 KiB |
BIN
docs/images/grovemd.jpg
Executable file
After Width: | Height: | Size: 167 KiB |
BIN
docs/images/grovemoisture.jpg
Executable file
After Width: | Height: | Size: 3.3 KiB |
BIN
docs/images/groveo2.jpg
Executable file
After Width: | Height: | Size: 79 KiB |
BIN
docs/images/groverelay.jpg
Executable file
After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 64 KiB |
BIN
docs/images/grovescam.jpg
Executable file
After Width: | Height: | Size: 135 KiB |
BIN
docs/images/grovespeaker.jpg
Executable file
After Width: | Height: | Size: 97 KiB |
BIN
docs/images/grovetemp.jpg
Executable file
After Width: | Height: | Size: 21 KiB |
BIN
docs/images/grovevdiv.jpg
Executable file
After Width: | Height: | Size: 105 KiB |
BIN
docs/images/grovewater.jpg
Executable file
After Width: | Height: | Size: 11 KiB |
BIN
docs/images/grovewfs.jpg
Executable file
After Width: | Height: | Size: 90 KiB |
BIN
docs/images/guvas12d.jpg
Executable file
After Width: | Height: | Size: 100 KiB |
BIN
docs/images/h3lis331dl.jpg
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
docs/images/hm11.jpg
Executable file
After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 41 KiB |
BIN
docs/images/hmtrp.jpg
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
docs/images/ina132.jpg
Executable file
After Width: | Height: | Size: 14 KiB |
BIN
docs/images/isd1820.jpg
Executable file
After Width: | Height: | Size: 10 KiB |
BIN
docs/images/joystick12.jpg
Executable file
After Width: | Height: | Size: 22 KiB |
BIN
docs/images/l298.jpg
Executable file
After Width: | Height: | Size: 169 KiB |
BIN
docs/images/lcm1602.jpeg
Normal file
After Width: | Height: | Size: 194 KiB |
BIN
docs/images/ldt0028.jpg
Executable file
After Width: | Height: | Size: 108 KiB |
BIN
docs/images/lpd8806.jpg
Executable file
After Width: | Height: | Size: 52 KiB |
BIN
docs/images/m24lr64e.jpg
Executable file
After Width: | Height: | Size: 24 KiB |
BIN
docs/images/max31855.jpg
Executable file
After Width: | Height: | Size: 196 KiB |
BIN
docs/images/maxsonarez.jpg
Executable file
After Width: | Height: | Size: 60 KiB |
BIN
docs/images/mhz16.jpg
Executable file
After Width: | Height: | Size: 16 KiB |
BIN
docs/images/mlx90614.jpg
Executable file
After Width: | Height: | Size: 170 KiB |
BIN
docs/images/mma7455.jpg
Executable file
After Width: | Height: | Size: 67 KiB |
BIN
docs/images/mma7660.jpg
Executable file
After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 142 KiB After Width: | Height: | Size: 142 KiB |
BIN
docs/images/nunchuck.jpg
Executable file
After Width: | Height: | Size: 16 KiB |
BIN
docs/images/otp538u.jpg
Executable file
After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 432 KiB After Width: | Height: | Size: 233 KiB |
Before Width: | Height: | Size: 165 KiB After Width: | Height: | Size: 165 KiB |
Before Width: | Height: | Size: 219 KiB After Width: | Height: | Size: 131 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
BIN
docs/images/si114x.jpg
Executable file
After Width: | Height: | Size: 191 KiB |
BIN
docs/images/sm130.jpg
Executable file
After Width: | Height: | Size: 114 KiB |
BIN
docs/images/st7735.jpg
Executable file
After Width: | Height: | Size: 149 KiB |
BIN
docs/images/stepmotor.jpg
Executable file
After Width: | Height: | Size: 52 KiB |
BIN
docs/images/sx6119.jpg
Executable file
After Width: | Height: | Size: 32 KiB |
BIN
docs/images/ta12200.jpg
Executable file
After Width: | Height: | Size: 19 KiB |
BIN
docs/images/tcs3414cs.jpg
Executable file
After Width: | Height: | Size: 29 KiB |
BIN
docs/images/th02.jpg
Executable file
After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
BIN
docs/images/ttp223.jpg
Executable file
After Width: | Height: | Size: 11 KiB |
BIN
docs/images/ublox6.jpg
Executable file
After Width: | Height: | Size: 22 KiB |
BIN
docs/images/uln200xa.jpg
Executable file
After Width: | Height: | Size: 22 KiB |
BIN
docs/images/waterlevel.jpg
Executable file
After Width: | Height: | Size: 15 KiB |
BIN
docs/images/wt5001.jpg
Executable file
After Width: | Height: | Size: 37 KiB |
BIN
docs/images/yg1006.jpg
Executable file
After Width: | Height: | Size: 95 KiB |
BIN
docs/images/zfm20.jpg
Executable file
After Width: | Height: | Size: 2.7 KiB |
51
docs/knownlimitations.md
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
Known Limitations {#knownlimitations}
|
||||||
|
===============
|
||||||
|
|
||||||
|
Some sensors do not work seamlessly with a specific board. This means that they
|
||||||
|
are either incompatible or work only under specific settings. This is a list of
|
||||||
|
such sensors and known workarounds if they exist.
|
||||||
|
|
||||||
|
#### Grove Sensors
|
||||||
|
|
||||||
|
* **Grove I2C Touch Sensor** v1.3 is incompatible with the Intel Edison using
|
||||||
|
the Arduino board, but will work with the Mini-breakout if supplied with at
|
||||||
|
least 4V. Revision v1.2 works well on all Intel boards.
|
||||||
|
* **Grove Nunchuck** only works with the Intel Galileo boards and is unusable
|
||||||
|
on the Intel Edison boards.
|
||||||
|
* **Grove 3-Axis Digital Gyroscope** (ITG-3200) is not compatible with the
|
||||||
|
Intel Edison Arduino board but will work with the Mini-breakout.
|
||||||
|
* **Grove 3-Axis Digital Accelerometer** (ADXL345) only works with the Intel
|
||||||
|
Edison Arduino board when powered from the 3.3V line.
|
||||||
|
* **Grove 96x96 OLED Display** will not work on the Intel Edison with Arduino
|
||||||
|
breakout.
|
||||||
|
* **Grove 128x64 OLED Display** will not work on the Intel Edison with Arduino
|
||||||
|
breakout.
|
||||||
|
* **Grove Barometer** (BMP085) has an unstable connection on the Intel Edison
|
||||||
|
using the Arduino breakout and does not run properly.
|
||||||
|
* **Grove 6-Axis Accelerometer & Compass** (LSM303) fails to write to the
|
||||||
|
configuration register properly and returns invalid data.
|
||||||
|
* **Grove I2C ADC Converter** does not show up on the I2C bus on the Intel
|
||||||
|
Edison with the Arduino board.
|
||||||
|
* **Grove I2C Motor Driver** is not compatible with the Intel Galileo due to
|
||||||
|
the inability to change the I2C bus speed to 100 KHz.
|
||||||
|
* **Grove CO2 Sensor** will return zeroed data and is unusable on the Intel
|
||||||
|
Galileo.
|
||||||
|
* **Grove BLE** (HM-11) does not return data on the Intel Galileo board.
|
||||||
|
|
||||||
|
#### Adafruit Sensors
|
||||||
|
|
||||||
|
* **Adafruit Motor Shield** (1438) is not detected on the I2C bus when
|
||||||
|
connected to the Intel Edison with an Arduino breakout.
|
||||||
|
|
||||||
|
#### Other Sensors
|
||||||
|
|
||||||
|
* **MPU9150** might return inaccurate data.
|
||||||
|
|
||||||
|
#### General
|
||||||
|
|
||||||
|
Some I2C sensors add too much capacitance to the SDA line of the Intel Edison
|
||||||
|
Arduino breakout board, thus the signal sticks to a logic 1. When this happens,
|
||||||
|
other sensors connected to the I2C bus are unusable. While there is no generic
|
||||||
|
solution for this limitation, in most cases the sensor works on the Intel
|
||||||
|
Edison Mini-breakout. When this board is not an option, the sensor can be
|
||||||
|
sometimes replaced with the same model from a different vendor.
|
@ -80,7 +80,7 @@ useful to us and converting it to a double.
|
|||||||
|
|
||||||
Our final example, very easy to use API!
|
Our final example, very easy to use API!
|
||||||
|
|
||||||
@snippet examples/max31855.cxx Interesting
|
@snippet examples/c++/max31855.cxx Interesting
|
||||||
|
|
||||||
### Building
|
### Building
|
||||||
|
|
||||||
|
BIN
docs/node.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
docs/python.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
@ -142,7 +142,6 @@
|
|||||||
<!-- Layout definition for a group page -->
|
<!-- Layout definition for a group page -->
|
||||||
<group>
|
<group>
|
||||||
<briefdescription visible="yes"/>
|
<briefdescription visible="yes"/>
|
||||||
<groupgraph visible="$GROUP_GRAPHS"/>
|
|
||||||
<memberdecl>
|
<memberdecl>
|
||||||
<nestedgroups visible="yes" title="Libraries"/>
|
<nestedgroups visible="yes" title="Libraries"/>
|
||||||
<dirs visible="yes" title=""/>
|
<dirs visible="yes" title=""/>
|
||||||
@ -182,6 +181,7 @@
|
|||||||
<properties title=""/>
|
<properties title=""/>
|
||||||
<friends title=""/>
|
<friends title=""/>
|
||||||
</memberdef>
|
</memberdef>
|
||||||
|
<groupgraph visible="$GROUP_GRAPHS"/>
|
||||||
<authorsection visible="yes"/>
|
<authorsection visible="yes"/>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
|
352
doxy/conf.py.in
Normal file
@ -0,0 +1,352 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# . documentation build configuration file, created by
|
||||||
|
# sphinx-quickstart on Thu May 1 18:34:23 2014.
|
||||||
|
#
|
||||||
|
# This file is execfile()d with the current directory set to its
|
||||||
|
# containing dir.
|
||||||
|
#
|
||||||
|
# Note that not all possible configuration values are present in this
|
||||||
|
# autogenerated file.
|
||||||
|
#
|
||||||
|
# All configuration values have a default; values that are commented out
|
||||||
|
# serve to show the default.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import shlex
|
||||||
|
|
||||||
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
|
sys.path.insert(0, "@CMAKE_CURRENT_BINARY_DIR@/pyupm/")
|
||||||
|
sys.path.insert(0, "@MRAA_LIBDIR@@LIB_SUFFIX@")
|
||||||
|
|
||||||
|
# -- General configuration ------------------------------------------------
|
||||||
|
|
||||||
|
# Custom flags and filters if needed
|
||||||
|
# autodoc_default_flags = ['members', 'private-members', 'special-members', 'undoc-members', 'show-inheritance']
|
||||||
|
|
||||||
|
# def autodoc_skip_member(app, what, name, obj, skip, options):
|
||||||
|
# exclusions = ('__weakref__', # special-members
|
||||||
|
# '__doc__', '__module__', '__dict__', # undoc-members
|
||||||
|
# 'swig_import_helper'
|
||||||
|
# )
|
||||||
|
# exclude = name in exclusions
|
||||||
|
# return skip or exclude
|
||||||
|
|
||||||
|
# def setup(app):
|
||||||
|
# app.connect('autodoc-skip-member', autodoc_skip_member)
|
||||||
|
|
||||||
|
# If your documentation needs a minimal Sphinx version, state it here.
|
||||||
|
#needs_sphinx = '1.0'
|
||||||
|
|
||||||
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||||
|
# ones.
|
||||||
|
extensions = [
|
||||||
|
'sphinx.ext.autodoc',
|
||||||
|
'sphinx.ext.todo',
|
||||||
|
'sphinx.ext.viewcode',
|
||||||
|
]
|
||||||
|
|
||||||
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
|
templates_path = ['_templates']
|
||||||
|
|
||||||
|
# The suffix of source filenames.
|
||||||
|
source_suffix = '.rst'
|
||||||
|
|
||||||
|
# The encoding of source files.
|
||||||
|
#source_encoding = 'utf-8-sig'
|
||||||
|
|
||||||
|
# The master toctree document.
|
||||||
|
master_doc = 'index'
|
||||||
|
|
||||||
|
# General information about the project.
|
||||||
|
project = 'upm'
|
||||||
|
copyright = '2015, Intel Corporation'
|
||||||
|
|
||||||
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
|
# |version| and |release|, also used in various other places throughout the
|
||||||
|
# built documents.
|
||||||
|
#
|
||||||
|
# The short X.Y version.
|
||||||
|
version = '@upm_VERSION_STRING@'
|
||||||
|
# The full version, including alpha/beta/rc tags.
|
||||||
|
release = '@VERSION@'
|
||||||
|
|
||||||
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
|
# for a list of supported languages.
|
||||||
|
#language = None
|
||||||
|
|
||||||
|
# There are two options for replacing |today|: either, you set today to some
|
||||||
|
# non-false value, then it is used:
|
||||||
|
#today = ''
|
||||||
|
# Else, today_fmt is used as the format for a strftime call.
|
||||||
|
#today_fmt = '%B %d, %Y'
|
||||||
|
|
||||||
|
# List of patterns, relative to source directory, that match files and
|
||||||
|
# directories to ignore when looking for source files.
|
||||||
|
exclude_patterns = ['_build', '**/.git', '**/CMakeFiles/**', '**/CMakeLists.txt']
|
||||||
|
|
||||||
|
# The reST default role (used for this markup: `text`) to use for all
|
||||||
|
# documents.
|
||||||
|
#default_role = None
|
||||||
|
|
||||||
|
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||||
|
#add_function_parentheses = True
|
||||||
|
|
||||||
|
# If true, the current module name will be prepended to all description
|
||||||
|
# unit titles (such as .. function::).
|
||||||
|
#add_module_names = True
|
||||||
|
|
||||||
|
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||||
|
# output. They are ignored by default.
|
||||||
|
#show_authors = False
|
||||||
|
|
||||||
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
|
pygments_style = 'sphinx'
|
||||||
|
|
||||||
|
# A list of ignored prefixes for module index sorting.
|
||||||
|
#modindex_common_prefix = []
|
||||||
|
|
||||||
|
# If true, keep warnings as "system message" paragraphs in the built documents.
|
||||||
|
#keep_warnings = False
|
||||||
|
|
||||||
|
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||||
|
todo_include_todos = True
|
||||||
|
|
||||||
|
# -- Options for HTML output ----------------------------------------------
|
||||||
|
|
||||||
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
|
# a list of builtin themes.
|
||||||
|
html_theme = 'default'
|
||||||
|
#html_theme = '@SPHINX_THEME@'
|
||||||
|
|
||||||
|
# Theme options are theme-specific and customize the look and feel of a theme
|
||||||
|
# further. For a list of options available for each theme, see the
|
||||||
|
# documentation.
|
||||||
|
#html_theme_options = {}
|
||||||
|
|
||||||
|
# Add any paths that contain custom themes here, relative to this directory.
|
||||||
|
#html_theme_path = ['@SPHINX_THEME_DIR@']
|
||||||
|
|
||||||
|
# The name for this set of Sphinx documents. If None, it defaults to
|
||||||
|
# "<project> v<release> documentation".
|
||||||
|
#html_title = None
|
||||||
|
|
||||||
|
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||||
|
#html_short_title = None
|
||||||
|
|
||||||
|
# The name of an image file (relative to this directory) to place at the top
|
||||||
|
# of the sidebar.
|
||||||
|
#html_logo = None
|
||||||
|
|
||||||
|
# The name of an image file (within the static path) to use as favicon of the
|
||||||
|
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||||
|
# pixels large.
|
||||||
|
#html_favicon = None
|
||||||
|
|
||||||
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
|
html_static_path = ['_static']
|
||||||
|
|
||||||
|
# Add any extra paths that contain custom files (such as robots.txt or
|
||||||
|
# .htaccess) here, relative to this directory. These files are copied
|
||||||
|
# directly to the root of the documentation.
|
||||||
|
#html_extra_path = []
|
||||||
|
|
||||||
|
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||||
|
# using the given strftime format.
|
||||||
|
#html_last_updated_fmt = '%b %d, %Y'
|
||||||
|
|
||||||
|
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||||
|
# typographically correct entities.
|
||||||
|
#html_use_smartypants = True
|
||||||
|
|
||||||
|
# Custom sidebar templates, maps document names to template names.
|
||||||
|
#html_sidebars = {}
|
||||||
|
|
||||||
|
# Additional templates that should be rendered to pages, maps page names to
|
||||||
|
# template names.
|
||||||
|
#html_additional_pages = {}
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#html_domain_indices = True
|
||||||
|
|
||||||
|
# If false, no index is generated.
|
||||||
|
#html_use_index = True
|
||||||
|
|
||||||
|
# If true, the index is split into individual pages for each letter.
|
||||||
|
#html_split_index = False
|
||||||
|
|
||||||
|
# If true, links to the reST sources are added to the pages.
|
||||||
|
#html_show_sourcelink = True
|
||||||
|
|
||||||
|
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||||
|
#html_show_sphinx = True
|
||||||
|
|
||||||
|
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||||
|
#html_show_copyright = True
|
||||||
|
|
||||||
|
# If true, an OpenSearch description file will be output, and all pages will
|
||||||
|
# contain a <link> tag referring to it. The value of this option must be the
|
||||||
|
# base URL from which the finished HTML is served.
|
||||||
|
#html_use_opensearch = ''
|
||||||
|
|
||||||
|
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||||
|
#html_file_suffix = None
|
||||||
|
|
||||||
|
# Output file base name for HTML help builder.
|
||||||
|
htmlhelp_basename = 'upmdoc'
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for LaTeX output ---------------------------------------------
|
||||||
|
|
||||||
|
latex_elements = {
|
||||||
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
|
#'papersize': 'letterpaper',
|
||||||
|
|
||||||
|
# The font size ('10pt', '11pt' or '12pt').
|
||||||
|
#'pointsize': '10pt',
|
||||||
|
|
||||||
|
# Additional stuff for the LaTeX preamble.
|
||||||
|
#'preamble': '',
|
||||||
|
}
|
||||||
|
|
||||||
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
|
# (source start file, target name, title,
|
||||||
|
# author, documentclass [howto, manual, or own class]).
|
||||||
|
latex_documents = [
|
||||||
|
('index', 'sphinx.tex', '. Documentation',
|
||||||
|
'Author', 'manual'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# The name of an image file (relative to this directory) to place at the top of
|
||||||
|
# the title page.
|
||||||
|
#latex_logo = None
|
||||||
|
|
||||||
|
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||||
|
# not chapters.
|
||||||
|
#latex_use_parts = False
|
||||||
|
|
||||||
|
# If true, show page references after internal links.
|
||||||
|
#latex_show_pagerefs = False
|
||||||
|
|
||||||
|
# If true, show URL addresses after external links.
|
||||||
|
#latex_show_urls = False
|
||||||
|
|
||||||
|
# Documents to append as an appendix to all manuals.
|
||||||
|
#latex_appendices = []
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#latex_domain_indices = True
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for manual page output ---------------------------------------
|
||||||
|
|
||||||
|
# One entry per manual page. List of tuples
|
||||||
|
# (source start file, name, description, authors, manual section).
|
||||||
|
man_pages = [
|
||||||
|
('index', 'sphinx', '. Documentation',
|
||||||
|
['Author'], 1)
|
||||||
|
]
|
||||||
|
|
||||||
|
# If true, show URL addresses after external links.
|
||||||
|
#man_show_urls = False
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for Texinfo output -------------------------------------------
|
||||||
|
|
||||||
|
# Grouping the document tree into Texinfo files. List of tuples
|
||||||
|
# (source start file, target name, title, author,
|
||||||
|
# dir menu entry, description, category)
|
||||||
|
texinfo_documents = [
|
||||||
|
('index', 'sphinx', '. Documentation',
|
||||||
|
'Author', 'sphinx', 'One line description of project.',
|
||||||
|
'Miscellaneous'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Documents to append as an appendix to all manuals.
|
||||||
|
#texinfo_appendices = []
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#texinfo_domain_indices = True
|
||||||
|
|
||||||
|
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||||
|
#texinfo_show_urls = 'footnote'
|
||||||
|
|
||||||
|
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||||
|
#texinfo_no_detailmenu = False
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for Epub output ----------------------------------------------
|
||||||
|
|
||||||
|
# Bibliographic Dublin Core info.
|
||||||
|
epub_title = '.'
|
||||||
|
epub_author = 'UPM'
|
||||||
|
epub_publisher = 'UPM'
|
||||||
|
epub_copyright = '2015, Intel Corporation'
|
||||||
|
|
||||||
|
# The basename for the epub file. It defaults to the project name.
|
||||||
|
#epub_basename = '.'
|
||||||
|
|
||||||
|
# The HTML theme for the epub output. Since the default themes are not optimized
|
||||||
|
# for small screen space, using the same theme for HTML and epub output is
|
||||||
|
# usually not wise. This defaults to 'epub', a theme designed to save visual
|
||||||
|
# space.
|
||||||
|
#epub_theme = 'epub'
|
||||||
|
|
||||||
|
# The language of the text. It defaults to the language option
|
||||||
|
# or en if the language is not set.
|
||||||
|
#epub_language = ''
|
||||||
|
|
||||||
|
# The scheme of the identifier. Typical schemes are ISBN or URL.
|
||||||
|
#epub_scheme = ''
|
||||||
|
|
||||||
|
# The unique identifier of the text. This can be a ISBN number
|
||||||
|
# or the project homepage.
|
||||||
|
#epub_identifier = ''
|
||||||
|
|
||||||
|
# A unique identification for the text.
|
||||||
|
#epub_uid = ''
|
||||||
|
|
||||||
|
# A tuple containing the cover image and cover page html template filenames.
|
||||||
|
#epub_cover = ()
|
||||||
|
|
||||||
|
# A sequence of (type, uri, title) tuples for the guide element of content.opf.
|
||||||
|
#epub_guide = ()
|
||||||
|
|
||||||
|
# HTML files that should be inserted before the pages created by sphinx.
|
||||||
|
# The format is a list of tuples containing the path and title.
|
||||||
|
#epub_pre_files = []
|
||||||
|
|
||||||
|
# HTML files shat should be inserted after the pages created by sphinx.
|
||||||
|
# The format is a list of tuples containing the path and title.
|
||||||
|
#epub_post_files = []
|
||||||
|
|
||||||
|
# A list of files that should not be packed into the epub file.
|
||||||
|
epub_exclude_files = ['search.html']
|
||||||
|
|
||||||
|
# The depth of the table of contents in toc.ncx.
|
||||||
|
#epub_tocdepth = 3
|
||||||
|
|
||||||
|
# Allow duplicate toc entries.
|
||||||
|
#epub_tocdup = True
|
||||||
|
|
||||||
|
# Choose between 'default' and 'includehidden'.
|
||||||
|
#epub_tocscope = 'default'
|
||||||
|
|
||||||
|
# Fix unsupported image types using the PIL.
|
||||||
|
#epub_fix_images = False
|
||||||
|
|
||||||
|
# Scale large images.
|
||||||
|
#epub_max_image_width = 0
|
||||||
|
|
||||||
|
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||||
|
#epub_show_urls = 'inline'
|
||||||
|
|
||||||
|
# If false, no index is generated.
|
||||||
|
#epub_use_index = True
|
81
doxy/index.rst
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
.. UPM Python documentation master file, created by Sisinty Sasmita Patra
|
||||||
|
UPM Team on Thu May 14 15:58:46 2015.
|
||||||
|
You can adapt this file completely to your liking, but it should at least
|
||||||
|
contain the root `toctree` directive.
|
||||||
|
|
||||||
|
**Welcome to UPM Python Documentation!**
|
||||||
|
=========================================
|
||||||
|
|
||||||
|
.. include:: ../../README.md
|
||||||
|
:start-after: ==============
|
||||||
|
:end-before: ### Example
|
||||||
|
|
||||||
|
``Building UPM``
|
||||||
|
################
|
||||||
|
|
||||||
|
For building UPM, please follow this `link <https://github.com/intel-iot-devkit/upm/blob/master/docs/building.md>`_.
|
||||||
|
|
||||||
|
``Examples``
|
||||||
|
############
|
||||||
|
|
||||||
|
Multi-sensor samples for the starter and specialized kits can be found in the `iot-devkit-samples <https://github.com/intel-iot-devkit/iot-devkit-samples>`_
|
||||||
|
repository.
|
||||||
|
|
||||||
|
Individual sensor usage examples for python are available `here <https://github.com/intel-iot-devkit/upm/tree/master/examples/python>`_.
|
||||||
|
|
||||||
|
``Making your own UPM Module``
|
||||||
|
##############################
|
||||||
|
|
||||||
|
This `link <https://github.com/intel-iot-devkit/upm/blob/master/docs/porting.md>`_ has more information on making a new UPM module.
|
||||||
|
|
||||||
|
There is also an example available for max31855 `sensor <https://github.com/intel-iot-devkit/upm/blob/master/docs/max31855.md>`_.
|
||||||
|
|
||||||
|
``Naming Conventions and Rules for New UPM Contributions``
|
||||||
|
##########################################################
|
||||||
|
|
||||||
|
Before you begin development, please take a look at our naming `conventions <https://github.com/intel-iot-devkit/upm/blob/master/docs/naming.md>`_.
|
||||||
|
|
||||||
|
Also, please read the guidelines for contributions to `UPM <https://github.com/intel-iot-devkit/upm/blob/master/docs/contributions.md>`_.
|
||||||
|
|
||||||
|
Don't forget to check the documentation `section <https://github.com/intel-iot-devkit/upm/blob/master/docs/documentation.md>`_.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
* Make sure you add yourself as an author on every new code file submitted.
|
||||||
|
* If you are providing a fix with significant changes, feel free to add yourself as a contributor.
|
||||||
|
* Signing-off your commits is mandatory.
|
||||||
|
|
||||||
|
``List of Available Sensors Drivers``
|
||||||
|
######################################
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
modules
|
||||||
|
|
||||||
|
``Other API Documentation``
|
||||||
|
###########################
|
||||||
|
|
||||||
|
.. image:: ../docs/c++.png
|
||||||
|
:target: http://iotdk.intel.com/docs/master/upm/modules.html
|
||||||
|
.. image:: ../docs/python.png
|
||||||
|
:target: http://iotdk.intel.com/docs/master/upm/python
|
||||||
|
.. image:: ../docs/node.png
|
||||||
|
:target: http://iotdk.intel.com/docs/master/upm/node
|
||||||
|
|
||||||
|
``Version Changelog``
|
||||||
|
#####################
|
||||||
|
|
||||||
|
For our Version Changelog, please see `here <https://github.com/intel-iot-devkit/upm/blob/master/docs/changelog.md>`_.
|
||||||
|
|
||||||
|
``Known Limitations``
|
||||||
|
###################################
|
||||||
|
|
||||||
|
For the List of Known Limitations, please see `here <https://github.com/intel-iot-devkit/upm/blob/master/docs/knownlimitations.md>`_.
|
||||||
|
|
||||||
|
``Indices and tables``
|
||||||
|
######################
|
||||||
|
|
||||||
|
* :ref:`genindex`
|
||||||
|
* :ref:`modindex`
|
||||||
|
* :ref:`search`
|
59
doxy/node/docgen.js
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Author: Heidi Pan <heidi.pan@intel.com>
|
||||||
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
* the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// dependencies
|
||||||
|
var xml2js = require('./xml2js')
|
||||||
|
, fs = require('fs')
|
||||||
|
, Promise = require('bluebird')
|
||||||
|
, opts = require('commander')
|
||||||
|
, _ = require('lodash')
|
||||||
|
, mkdirp = require('mkdirp');
|
||||||
|
|
||||||
|
|
||||||
|
// parse command line arguments
|
||||||
|
_.extend(opts, { addOptions: function(module) { return module.addOptions(opts); } });
|
||||||
|
opts
|
||||||
|
.option('-m, --module [module]', 'module name for which to build documentation', 'mraa')
|
||||||
|
.option('-f, --formats [formats]', 'format for js comments', 'yuidoc,ternjs')
|
||||||
|
.option('-o, --outdir [directory]', 'top directory to build documentation', __dirname + '/jsdoc')
|
||||||
|
.addOptions(xml2js)
|
||||||
|
.parse(process.argv);
|
||||||
|
|
||||||
|
|
||||||
|
// use promise-style programming rather than spaghetti callbacks
|
||||||
|
Promise.promisifyAll(fs);
|
||||||
|
Promise.promisifyAll(mkdirp);
|
||||||
|
|
||||||
|
|
||||||
|
// main
|
||||||
|
xml2js.parse().then(function(specjs) {
|
||||||
|
var formats = opts.formats.split(',');
|
||||||
|
Promise.all(_.map(formats, function(format) {
|
||||||
|
var generateDocs = require(__dirname + '/generators/' + format + '/generator');
|
||||||
|
var dir = opts.outdir + '/' + format + '/' + specjs.MODULE;
|
||||||
|
return mkdirp.mkdirpAsync(dir).then(function() {
|
||||||
|
return fs.writeFileAsync(dir + '/doc.js', generateDocs(specjs));
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
});
|
7
doxy/node/generators/jsdoc/conf.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"templates": {
|
||||||
|
"default": {
|
||||||
|
"outputSourceFiles": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
89
doxy/node/generators/jsdoc/generator.js
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
* Author: Heidi Pan <heidi.pan@intel.com>
|
||||||
|
* Copyright (c) 2015 Intel Corporation.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
* the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// dependencies
|
||||||
|
var _ = require('lodash');
|
||||||
|
|
||||||
|
|
||||||
|
// generate JSDoc-style documentation
|
||||||
|
function generateDocs(specjs) {
|
||||||
|
var docs = GENERATE_MODULE(specjs.MODULE);
|
||||||
|
docs = _.reduce(specjs.METHODS, function(memo, methodSpec, methodName) {
|
||||||
|
return memo += GENERATE_METHOD(methodName, methodSpec);
|
||||||
|
}, docs);
|
||||||
|
docs = _.reduce(specjs.ENUMS, function(memo, enumSpec, enumName) {
|
||||||
|
return memo += GENERATE_ENUM(enumName, enumSpec);
|
||||||
|
}, docs);
|
||||||
|
docs = _.reduce(specjs.CLASSES, function(memo, classSpec, parentClass) {
|
||||||
|
return _.reduce(classSpec.methods, function(memo, methodSpec, methodName) {
|
||||||
|
return memo += GENERATE_METHOD(methodName, methodSpec, parentClass);
|
||||||
|
}, memo);
|
||||||
|
}, docs);
|
||||||
|
return docs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// comment wrapper around entire spec
|
||||||
|
function GENERATE_DOC(text) {
|
||||||
|
return '/**\n' + text + ' */\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// generate module spec
|
||||||
|
function GENERATE_MODULE(module) {
|
||||||
|
return GENERATE_DOC('@module ' + module + '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// generate method spec with parent module/class
|
||||||
|
function GENERATE_METHOD(name, spec, parent) {
|
||||||
|
name = name.replace(/!+$/, '');
|
||||||
|
return GENERATE_DOC(spec.description + '\n'
|
||||||
|
+ '@method ' + name + '\n'
|
||||||
|
+ '@instance\n'
|
||||||
|
+ (parent ? ('@memberof ' + parent + '\n') : '')
|
||||||
|
+ _.reduce(spec.params, function(memo, paramSpec, paramName) {
|
||||||
|
return '@param {' + paramSpec.type + '} ' + paramName + ' ' + paramSpec.description + '\n';
|
||||||
|
}, '')
|
||||||
|
+ ( !_.isEmpty(spec.return) ? ('@return {' + spec.return.type + '} ' + spec.return.description + '\n') : ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// generate enum spec
|
||||||
|
function GENERATE_ENUM(name, spec) {
|
||||||
|
return GENERATE_DOC(spec.description + '\n\n'
|
||||||
|
+ '@var ' + name + '\n'
|
||||||
|
+ '@type Enum(' + spec.type + ')\n'
|
||||||
|
+ '@instance\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
// generate link spec
|
||||||
|
function GENERATE_LINK(text) {
|
||||||
|
return '{@link ' + text + '}';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = generateDocs;
|