Compare commits
63 Commits
Author | SHA1 | Date | |
---|---|---|---|
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,7 +12,9 @@ endif ()
|
||||
|
||||
find_package (Threads REQUIRED)
|
||||
find_package (PkgConfig REQUIRED)
|
||||
# force the libmraa version to be the required version
|
||||
|
||||
# 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.0)
|
||||
message (INFO " found libmraa version: ${MRAA_VERSION}")
|
||||
|
||||
@ -28,7 +30,7 @@ include (GetGitRevisionDescription)
|
||||
git_describe (VERSION "--tags")
|
||||
if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND")
|
||||
message (WARNING " - Install git to compile a production libmraa!")
|
||||
set (VERSION "v0.2.0-dirty")
|
||||
set (VERSION "v0.3.0-dirty")
|
||||
endif ()
|
||||
|
||||
message (INFO " - UPM Version ${VERSION}")
|
||||
@ -56,6 +58,7 @@ option (BUILDDOC "Build all doc." OFF)
|
||||
option (BUILDSWIG "Build swig modules." ON)
|
||||
option (BUILDSWIGPYTHON "Build swig python modules." ON)
|
||||
option (BUILDSWIGNODE "Build swig node modules." ON)
|
||||
option (BUILDEXAMPLES "Build C++ example binaries" OFF)
|
||||
|
||||
if (BUILDDOC)
|
||||
# add a target to generate API documentation with Doxygen
|
||||
@ -68,6 +71,49 @@ if (BUILDDOC)
|
||||
COMMENT "Generating API documentation with Doxygen" VERBATIM
|
||||
)
|
||||
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:]]module</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 ../../../../docs/images/
|
||||
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()
|
||||
|
||||
if (IPK)
|
||||
@ -98,4 +144,7 @@ if (IPK)
|
||||
endif()
|
||||
|
||||
add_subdirectory (src)
|
||||
add_subdirectory (examples/c++)
|
||||
|
||||
if(BUILDEXAMPLES)
|
||||
add_subdirectory (examples/c++)
|
||||
endif()
|
||||
|
10
README.md
@ -29,6 +29,12 @@ Supported [sensor list](http://iotdk.intel.com/docs/master/upm/modules.html) fro
|
||||
|
||||
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
|
||||
|
||||
See @ref building [here](docs/building.md).
|
||||
@ -55,3 +61,7 @@ C/C++ API Documentation
|
||||
==============
|
||||
|
||||
The C/C++ documentation is available [here](http://iotdk.intel.com/docs/master/upm/).
|
||||
|
||||
Version @ref changelog [here](docs/changelog.md).
|
||||
|
||||
List of @ref knownlimitations [here](docs/knownlimitations.md).
|
||||
|
60
cmake/modules/FindNode.cmake
Normal file
@ -0,0 +1,60 @@
|
||||
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}")
|
||||
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_MAJOR "14")
|
||||
set (V8_VERSION_MAJOR "5")
|
||||
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
|
||||
cmake ..
|
||||
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
|
||||
you all the options. The interesting ones are detailed below:
|
||||
|
||||
|
84
docs/changelog.md
Normal file
@ -0,0 +1,84 @@
|
||||
Changelog {#changelog}
|
||||
===============
|
||||
|
||||
Here's a list summarizing some of the key undergoing changes to our library
|
||||
from earlier versions:
|
||||
|
||||
### 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/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/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/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: 37 KiB |
BIN
docs/images/gp2y0a.jpg
Executable file
After Width: | Height: | Size: 44 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/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 |
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 64 KiB |
BIN
docs/images/grovespeaker.jpg
Executable file
After Width: | Height: | Size: 97 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/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/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/max31855.jpg
Executable file
After Width: | Height: | Size: 196 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/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.
|
@ -142,7 +142,6 @@
|
||||
<!-- Layout definition for a group page -->
|
||||
<group>
|
||||
<briefdescription visible="yes"/>
|
||||
<groupgraph visible="$GROUP_GRAPHS"/>
|
||||
<memberdecl>
|
||||
<nestedgroups visible="yes" title="Libraries"/>
|
||||
<dirs visible="yes" title=""/>
|
||||
@ -182,6 +181,7 @@
|
||||
<properties title=""/>
|
||||
<friends title=""/>
|
||||
</memberdef>
|
||||
<groupgraph visible="$GROUP_GRAPHS"/>
|
||||
<authorsection visible="yes"/>
|
||||
</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
|
68
doxy/index.rst
Normal file
@ -0,0 +1,68 @@
|
||||
.. 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>`_.
|
||||
|
||||
``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
|
||||
|
||||
``C/C++ API Documentation``
|
||||
###########################
|
||||
|
||||
The C/C++ API documentation is available `here <http://iotdk.intel.com/docs/master/upm/>`_.
|
||||
|
||||
``Version``
|
||||
###########
|
||||
|
||||
For Version Changelog, please see `here <https://github.com/intel-iot-devkit/upm/blob/master/docs/changelog.md>`_.
|
||||
|
||||
``Limitations and List of Changes``
|
||||
###################################
|
||||
|
||||
For 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`
|
62
doxy/node/docgen.js
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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);
|
||||
|
||||
|
||||
// TODO: create directory structure if doesn't exist
|
||||
var formats = opts.formats.split(',');
|
||||
formats.forEach(function(format){
|
||||
mkdirp('jsdoc/' + format + '/' + opts.module);
|
||||
});
|
||||
|
||||
|
||||
// main
|
||||
xml2js.parse().then(function(specjs) {
|
||||
Promise.all(_.map(formats, function(format) {
|
||||
var generateDocs = require(__dirname + '/generators/' + format + '/generator');
|
||||
var outFile = opts.outdir + '/' + format + '/' + specjs.MODULE + '/doc.js';
|
||||
return fs.writeFileAsync(outFile, generateDocs(specjs));
|
||||
}));
|
||||
});
|
7
doxy/node/generators/jsdoc/conf.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"templates": {
|
||||
"default": {
|
||||
"outputSourceFiles": false
|
||||
}
|
||||
}
|
||||
}
|
88
doxy/node/generators/jsdoc/generator.js
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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) {
|
||||
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;
|
110
doxy/node/generators/ternjs/generator.js
Normal file
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* 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 json for ternjs input
|
||||
function generateDocs(specjs) {
|
||||
var docs = GENERATE_MODULE(specjs.MODULE);
|
||||
GENERATE_TYPE = (function(enums) {
|
||||
return function(type) {
|
||||
return (_.contains(enums, type) ? ('Enum ' + type) : type);
|
||||
}
|
||||
})(_.keys(specjs.ENUMS_BY_GROUP));
|
||||
_.each(specjs.ENUMS, function(enumSpec, enumName) {
|
||||
_.extend(docs[specjs.MODULE], GENERATE_ENUM(enumName, enumSpec));
|
||||
});
|
||||
_.each(specjs.METHODS, function(methodSpec, methodName) {
|
||||
_.extend(docs[specjs.MODULE], GENERATE_METHOD(methodName, methodSpec));
|
||||
});
|
||||
_.each(specjs.CLASSES, function(classSpec, parentClass) {
|
||||
var constructor = classSpec.methods[parentClass];
|
||||
_.extend(docs[specjs.MODULE], GENERATE_METHOD(parentClass, constructor ? constructor : { params: {}, return: {}, description: '' } ));
|
||||
_.each(classSpec.enums, function(enumSpec, enumName) {
|
||||
_.extend(docs[specjs.MODULE][parentClass], GENERATE_ENUM(enumName, enumSpec));
|
||||
});
|
||||
docs[specjs.MODULE][parentClass].prototype = {};
|
||||
_.each(_.omit(classSpec.methods, parentClass), function(methodSpec, methodName) {
|
||||
_.extend(docs[specjs.MODULE][parentClass].prototype, GENERATE_METHOD(methodName, methodSpec));
|
||||
});
|
||||
_.each(classSpec.variables, function(variableSpec, variableName) {
|
||||
_.extend(docs[specjs.MODULE][parentClass].prototype, GENERATE_VARIABLE(variableName, variableSpec));
|
||||
});
|
||||
});
|
||||
return JSON.stringify(docs, null, 2);
|
||||
}
|
||||
|
||||
|
||||
// generate module spec
|
||||
function GENERATE_MODULE(module) {
|
||||
var docs = { '!name': module + 'library' };
|
||||
docs[module] = {};
|
||||
return docs;
|
||||
}
|
||||
|
||||
|
||||
// generate method spec
|
||||
function GENERATE_METHOD(name, spec) {
|
||||
var doc = {};
|
||||
doc[name] = {
|
||||
'!type': 'fn(' + GENERATE_PARAMS(spec.params) + ')' + GENERATE_RETURN(spec.return),
|
||||
'!doc': spec.description
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
// generate parameter signatures for method
|
||||
function GENERATE_PARAMS(spec) {
|
||||
return _.map(spec, function(paramSpec, paramName) {
|
||||
return paramName + ': ' + paramSpec.type;
|
||||
}).join(', ');
|
||||
}
|
||||
|
||||
|
||||
// generate return signature for method
|
||||
function GENERATE_RETURN(spec) {
|
||||
return (_.isEmpty(spec) ? '' : (' -> ' + spec.type));
|
||||
}
|
||||
|
||||
|
||||
// generate enum spec
|
||||
function GENERATE_ENUM(name, spec) {
|
||||
var doc = {};
|
||||
doc[name] = 'Enum ' + spec.type ;
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
// generate variable spec
|
||||
function GENERATE_VARIABLE(name, spec) {
|
||||
var doc = {};
|
||||
doc[name]= spec.type ;
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
module.exports = generateDocs;
|
8
doxy/node/generators/yuidoc/conf.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "UPM",
|
||||
"description": "The UPM API: High Level Sensor Library for Intel IoT Devices Using MRAA",
|
||||
"logo": "http://upload.wikimedia.org/wikipedia/commons/8/8c/Transparent.png",
|
||||
"options": {
|
||||
"outdir": "./html/node"
|
||||
}
|
||||
}
|
138
doxy/node/generators/yuidoc/generator.js
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
/*
|
||||
* 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 YuiDocs-style documentation
|
||||
function generateDocs(specjs) {
|
||||
var docs = GENERATE_MODULE(specjs.MODULE, '');
|
||||
GENERATE_TYPE = (function(enums) {
|
||||
return function(type) {
|
||||
return (_.contains(enums, type) ? ('Enum ' + type) : type);
|
||||
}
|
||||
})(_.keys(specjs.ENUMS_BY_GROUP));
|
||||
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);
|
||||
if (_.isEmpty(specjs.CLASSGROUPS)) {
|
||||
docs += GENERATE_CLASSES(specjs.CLASSES);
|
||||
} else {
|
||||
docs += GENERATE_MODULE('common', '');
|
||||
var grouped = _.flatten(_.pluck(_.values(specjs.CLASSGROUPS), 'classes'));
|
||||
var ungrouped = _.difference(_.keys(specjs.CLASSES), grouped);
|
||||
docs += GENERATE_CLASSES(_.pick(specjs.CLASSES, ungrouped), 'common');
|
||||
_.each(specjs.CLASSGROUPS, function(groupSpec, groupName) {
|
||||
docs += GENERATE_CLASSES(_.pick(specjs.CLASSES, groupSpec.classes), groupName);
|
||||
});
|
||||
// TODO: figure out why yuidoc won't associate the class with the right module if module definitions are interspersed
|
||||
_.each(specjs.CLASSGROUPS, function(groupSpec, groupName) {
|
||||
docs += GENERATE_MODULE(groupName, groupSpec.description);
|
||||
});
|
||||
}
|
||||
return docs;
|
||||
}
|
||||
|
||||
|
||||
// comment wrapper around entire spec
|
||||
function GENERATE_DOC(text) {
|
||||
return '/**\n' + text + ' */\n';
|
||||
}
|
||||
|
||||
|
||||
// generate module spec
|
||||
function GENERATE_MODULE(name, description) {
|
||||
return GENERATE_DOC(description + '\n'
|
||||
+ '@module ' + name + '\n');
|
||||
}
|
||||
|
||||
|
||||
// generate spec for the given list of classes
|
||||
function GENERATE_CLASSES(classes, parent) {
|
||||
return _.reduce(classes, function(memo, classSpec, className) {
|
||||
return memo
|
||||
+ GENERATE_CLASS(className, classSpec.description, parent)
|
||||
+ _.reduce(classSpec.methods, function(memo, methodSpec, methodName) {
|
||||
return memo += GENERATE_METHOD(methodName, methodSpec, className);
|
||||
}, '')
|
||||
+ _.reduce(classSpec.variables, function(memo, variableSpec, variableName) {
|
||||
return memo += GENERATE_VAR(variableName, variableSpec, className);
|
||||
}, '')
|
||||
+ _.reduce(classSpec.enums, function(memo, enumSpec, enumName) {
|
||||
return memo += GENERATE_ENUM(enumName, enumSpec, className);
|
||||
}, '');
|
||||
}, '');
|
||||
}
|
||||
|
||||
|
||||
// generate class spec
|
||||
function GENERATE_CLASS(name, description, parent) {
|
||||
return GENERATE_DOC(description + '\n'
|
||||
+ '@class ' + name + '\n'
|
||||
+ (parent ? ('@module ' + parent + '\n') : ''));
|
||||
}
|
||||
|
||||
|
||||
// generate method spec with parent module/class
|
||||
function GENERATE_METHOD(name, spec, parent) {
|
||||
return GENERATE_DOC(spec.description + '\n'
|
||||
+ '@method ' + name + '\n'
|
||||
+ (parent ? ('@for ' + parent + '\n') : '@for common\n')
|
||||
+ _.reduce(spec.params, function(memo, paramSpec, paramName) {
|
||||
return memo + '@param {' + GENERATE_TYPE(paramSpec.type) + '} ' + paramName + ' ' + paramSpec.description + '\n';
|
||||
}, '')
|
||||
+ ( !_.isEmpty(spec.return) ? ('@return {' + GENERATE_TYPE(spec.return.type) + '} ' + spec.return.description + '\n') : ''));
|
||||
}
|
||||
|
||||
|
||||
// generate enum spec
|
||||
function GENERATE_ENUM(name, spec, parent) {
|
||||
return GENERATE_DOC(spec.description + '\n'
|
||||
+ '@property ' + name + '\n'
|
||||
+ '@type Enum ' + spec.type + '\n'
|
||||
+ '@for ' + (parent ? parent : 'common') + '\n');
|
||||
}
|
||||
|
||||
|
||||
// generate variable specs
|
||||
function GENERATE_VAR(name, spec, parent) {
|
||||
return GENERATE_DOC(spec.description + '\n'
|
||||
+ '@property ' + name + '\n'
|
||||
+ '@type ' + spec.type + '\n'
|
||||
+ '@for ' + parent + '\n');
|
||||
}
|
||||
|
||||
|
||||
// TODO
|
||||
// generate link spec
|
||||
function GENERATE_LINK(text) {
|
||||
return '{{#crossLink "' + text + '"}}{{/crossLink}}';
|
||||
}
|
||||
|
||||
|
||||
module.exports = generateDocs;
|
196
doxy/node/generators/yuidoc/helper.js
vendored
Normal file
@ -0,0 +1,196 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
// extract the field from the class description text
|
||||
function getField(classDescription, field) {
|
||||
var pattern = new RegExp('\\+ __' + field + ':__ [A-Za-z0-9]*');
|
||||
var label = new RegExp('\\+ __' + field + ':__');
|
||||
if (classDescription) {
|
||||
var matched = classDescription.match(pattern);
|
||||
if (matched) {
|
||||
return (matched[0].replace(label, '')).trim();
|
||||
}
|
||||
}
|
||||
return 'other';
|
||||
}
|
||||
|
||||
|
||||
// generate html to group modules by the given field (e.g. category/connection type) of its children classes
|
||||
function listByGroup(modules, classes, field, projectRoot) {
|
||||
|
||||
var moduleClasses = {};
|
||||
var modulesByGroup = {};
|
||||
var i, j;
|
||||
for (i = 0; i < modules.length; i++) {
|
||||
moduleClasses[modules[i].name] = [];
|
||||
}
|
||||
for (i = 0; i < classes.length; i++) {
|
||||
moduleClasses[classes[i].module].push(i);
|
||||
}
|
||||
for (var module in moduleClasses) {
|
||||
var classIndices = moduleClasses[module];
|
||||
var groups = [];
|
||||
for (i = 0; i < classIndices.length; i++) {
|
||||
groups.push(getField(classes[classIndices[i]].description, field));
|
||||
}
|
||||
if (groups.length != 0) {
|
||||
var group = groups[0];
|
||||
var sanitychecked = true;
|
||||
for (i = 1; i < groups.length; i++) {
|
||||
if (groups[i] != group) {
|
||||
sanitychecked = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!sanitychecked) {
|
||||
// TODO
|
||||
}
|
||||
if (group in modulesByGroup) {
|
||||
modulesByGroup[group].push(module);
|
||||
} else {
|
||||
modulesByGroup[group] = [module];
|
||||
}
|
||||
}
|
||||
}
|
||||
var groups = Object.keys(modulesByGroup).sort();
|
||||
var html = '';
|
||||
var pfx = projectRoot + 'modules/';
|
||||
var first = true;
|
||||
for (i = 0; i < groups.length; i++) {
|
||||
var group = groups[i];
|
||||
html += (first ? '' : '</span>');
|
||||
html += '<div class="upmGroup"><div class="right-arrow"></div>' + group + '</div><span class="upmModules" style="display:none">';
|
||||
var moduleNames = modulesByGroup[group];
|
||||
for (j = 0; j < moduleNames.length; j++) {
|
||||
var moduleName = moduleNames[j];
|
||||
html += '<a href="' + pfx + moduleName + '.html">' + moduleName + '</a>';
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
return html;
|
||||
}
|
||||
|
||||
|
||||
// click handler to change direction of arrow and toggle visibility of grouped modules
|
||||
var onClickHandler = "Y.on('domready', function() { \
|
||||
Y.on('click', function(e) { \
|
||||
var classes = this.next('.upmModules').toggleView(); \
|
||||
if (classes.getStyle('display') == 'none') { \
|
||||
this.one('> div').removeClass('down-arrow').addClass('right-arrow'); \
|
||||
} else { \
|
||||
this.one('> div').removeClass('right-arrow').addClass('down-arrow'); \
|
||||
} \
|
||||
}, '.upmGroup'); \
|
||||
});";
|
||||
|
||||
|
||||
// css to generate triangle icons
|
||||
var insertStyles = "Y.one(document.head).append('<style> \
|
||||
div.right-arrow { \
|
||||
width: 0; \
|
||||
height: 0; \
|
||||
border-bottom: 5px solid transparent; \
|
||||
border-top: 5px solid transparent; \
|
||||
border-left: 5px solid #356de4; \
|
||||
font-size: 0; \
|
||||
margin-right: 5px; \
|
||||
vertical-align: 5px; \
|
||||
display: inline; \
|
||||
} \
|
||||
div.down-arrow { \
|
||||
width: 0; \
|
||||
height: 0; \
|
||||
border-left: 5px solid transparent; \
|
||||
border-right: 5px solid transparent; \
|
||||
border-top: 5px solid #356de4; \
|
||||
font-size: 0; \
|
||||
margin-right: 5px; \
|
||||
display: inline; \
|
||||
} \
|
||||
div.upmGroup { \
|
||||
font-weight: bold; \
|
||||
} \
|
||||
</style>');";
|
||||
|
||||
|
||||
var scripts = "YUI().use('node', 'event', function (Y) {"
|
||||
+ onClickHandler
|
||||
+ insertStyles
|
||||
+ "});";
|
||||
|
||||
|
||||
module.exports = {
|
||||
|
||||
listByCategory: function() {
|
||||
return listByGroup(this.modules, this.classes, 'Category', this.projectRoot);
|
||||
},
|
||||
|
||||
listByManufacturer: function() {
|
||||
return listByGroup(this.modules, this.classes, 'Manufacturer', this.projectRoot);
|
||||
},
|
||||
|
||||
listByConnection: function() {
|
||||
return listByGroup(this.modules, this.classes, 'Connection', this.projectRoot);
|
||||
},
|
||||
|
||||
javascripts: function(options) {
|
||||
return '<script type="text/javascript">' + scripts + '</script>';
|
||||
},
|
||||
|
||||
// generate custom cross links
|
||||
// assume lowercase script will be run, so generate class links with lower case
|
||||
customCrossLinks: function() {
|
||||
var selector = 'script[type="class-metadata"]'
|
||||
var html = "<script type='text/javascript'> \
|
||||
var find = function(ar, elem) { \
|
||||
for (var i = 0; i < ar.length; i++) { \
|
||||
if (ar[i] == elem) { \
|
||||
return true; \
|
||||
} \
|
||||
} \
|
||||
return false; \
|
||||
}; \
|
||||
YUI().use('node', 'event', function (Y) { \
|
||||
Y.on('domready', function() { \
|
||||
var classes = Y.all('" + selector + "').getHTML(); \
|
||||
for (var i = 0; i < classes.length; i++) { \
|
||||
classes[i] = classes[i].toLowerCase(); \
|
||||
} \
|
||||
Y.all('span.type').each(function(node) { \
|
||||
var t = node.getHTML(); \
|
||||
if (find(classes, t.toLowerCase())) { \
|
||||
node.setHTML('<a href=' + t.toLowerCase() + '.html>' + t + '</a>'); \
|
||||
} \
|
||||
}); \
|
||||
}); \
|
||||
}); \
|
||||
</script>";
|
||||
for (var i = 0; i < this.classes.length; i++) {
|
||||
html += "<script type='class-metadata'>" + this.classes[i].name + "</script>";
|
||||
}
|
||||
return html;
|
||||
}
|
||||
|
||||
};
|
27
doxy/node/generators/yuidoc/tmpl/LICENSE
Normal file
@ -0,0 +1,27 @@
|
||||
Original Work Copyright 2011 Yahoo! Inc.
|
||||
All rights reserved.
|
||||
|
||||
Modified Work Copyright (c) 2015 Intel Corporation.
|
||||
Author: Heidi Pan <heidi.pan@intel.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Yahoo! Inc. nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
789
doxy/node/generators/yuidoc/tmpl/assets/css/main.css
Normal file
@ -0,0 +1,789 @@
|
||||
/*
|
||||
Font sizes for all selectors other than the body are given in percentages,
|
||||
with 100% equal to 13px. To calculate a font size percentage, multiply the
|
||||
desired size in pixels by 7.6923076923.
|
||||
|
||||
Here's a quick lookup table:
|
||||
|
||||
10px - 76.923%
|
||||
11px - 84.615%
|
||||
12px - 92.308%
|
||||
13px - 100%
|
||||
14px - 107.692%
|
||||
15px - 115.385%
|
||||
16px - 123.077%
|
||||
17px - 130.769%
|
||||
18px - 138.462%
|
||||
19px - 146.154%
|
||||
20px - 153.846%
|
||||
*/
|
||||
|
||||
html {
|
||||
background: #fff;
|
||||
color: #333;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
body {
|
||||
/*font: 13px/1.4 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', 'Bitstream Vera Sans', 'Helvetica', 'Arial', sans-serif;*/
|
||||
font: 13px/1.4 'Helvetica', 'Arial', sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* -- Links ----------------------------------------------------------------- */
|
||||
a {
|
||||
color: #356de4;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
a:hover { text-decoration: underline; }
|
||||
|
||||
/* "Jump to Table of Contents" link is shown to assistive tools, but hidden from
|
||||
sight until it's focused. */
|
||||
.jump {
|
||||
position: absolute;
|
||||
padding: 3px 6px;
|
||||
left: -99999px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.jump:focus { left: 40%; }
|
||||
|
||||
/* -- Paragraphs ------------------------------------------------------------ */
|
||||
p { margin: 1.3em 0; }
|
||||
dd p, td p { margin-bottom: 0; }
|
||||
dd p:first-child, td p:first-child { margin-top: 0; }
|
||||
|
||||
/* -- Headings -------------------------------------------------------------- */
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
color: #D98527;/*was #f80*/
|
||||
font-family: 'Trebuchet MS', sans-serif;
|
||||
font-weight: bold;
|
||||
line-height: 1.1;
|
||||
margin: 1.1em 0 0.5em;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 184.6%;
|
||||
color: #30418C;
|
||||
margin: 0.75em 0 0.5em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 153.846%;
|
||||
color: #E48A2B;
|
||||
}
|
||||
|
||||
h3 { font-size: 138.462%; }
|
||||
|
||||
h4 {
|
||||
border-bottom: 1px solid #DBDFEA;
|
||||
color: #E48A2B;
|
||||
font-size: 115.385%;
|
||||
font-weight: normal;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
h5, h6 { font-size: 107.692%; }
|
||||
|
||||
/* -- Code and examples ----------------------------------------------------- */
|
||||
code, kbd, pre, samp {
|
||||
font-family: Menlo, Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;
|
||||
font-size: 92.308%;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
p code, p kbd, p samp, li code {
|
||||
background: #FCFBFA;
|
||||
border: 1px solid #EFEEED;
|
||||
padding: 0 3px;
|
||||
}
|
||||
|
||||
a code, a kbd, a samp,
|
||||
pre code, pre kbd, pre samp,
|
||||
table code, table kbd, table samp,
|
||||
.intro code, .intro kbd, .intro samp,
|
||||
.toc code, .toc kbd, .toc samp {
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
pre.code, pre.terminal, pre.cmd {
|
||||
overflow-x: auto;
|
||||
*overflow-x: scroll;
|
||||
padding: 0.3em 0.6em;
|
||||
}
|
||||
|
||||
pre.code {
|
||||
background: #FCFBFA;
|
||||
border: 1px solid #EFEEED;
|
||||
border-left-width: 5px;
|
||||
}
|
||||
|
||||
pre.terminal, pre.cmd {
|
||||
background: #F0EFFC;
|
||||
border: 1px solid #D0CBFB;
|
||||
border-left: 5px solid #D0CBFB;
|
||||
}
|
||||
|
||||
/* Don't reduce the font size of <code>/<kbd>/<samp> elements inside <pre>
|
||||
blocks. */
|
||||
pre code, pre kbd, pre samp { font-size: 100%; }
|
||||
|
||||
/* Used to denote text that shouldn't be selectable, such as line numbers or
|
||||
shell prompts. Guess which browser this doesn't work in. */
|
||||
.noselect {
|
||||
-moz-user-select: -moz-none;
|
||||
-khtml-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-o-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
/* -- Lists ----------------------------------------------------------------- */
|
||||
dd { margin: 0.2em 0 0.7em 1em; }
|
||||
dl { margin: 1em 0; }
|
||||
dt { font-weight: bold; }
|
||||
|
||||
/* -- Tables ---------------------------------------------------------------- */
|
||||
caption, th { text-align: left; }
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
td, th {
|
||||
border: 1px solid #fff;
|
||||
padding: 5px 12px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
td { background: #E6E9F5; }
|
||||
td dl { margin: 0; }
|
||||
td dl dl { margin: 1em 0; }
|
||||
td pre:first-child { margin-top: 0; }
|
||||
|
||||
th {
|
||||
background: #D2D7E6;/*#97A0BF*/
|
||||
border-bottom: none;
|
||||
border-top: none;
|
||||
color: #000;/*#FFF1D5*/
|
||||
font-family: 'Trebuchet MS', sans-serif;
|
||||
font-weight: bold;
|
||||
line-height: 1.3;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
|
||||
/* -- Layout and Content ---------------------------------------------------- */
|
||||
#doc {
|
||||
margin: auto;
|
||||
min-width: 1024px;
|
||||
}
|
||||
|
||||
.content { padding: 0 20px 0 25px; }
|
||||
|
||||
.sidebar {
|
||||
padding: 0 15px 0 10px;
|
||||
}
|
||||
#bd {
|
||||
padding: 7px 0 130px;
|
||||
position: relative;
|
||||
width: 99%;
|
||||
}
|
||||
|
||||
/* -- Table of Contents ----------------------------------------------------- */
|
||||
|
||||
/* The #toc id refers to the single global table of contents, while the .toc
|
||||
class refers to generic TOC lists that could be used throughout the page. */
|
||||
|
||||
.toc code, .toc kbd, .toc samp { font-size: 100%; }
|
||||
.toc li { font-weight: bold; }
|
||||
.toc li li { font-weight: normal; }
|
||||
|
||||
/* -- Intro and Example Boxes ----------------------------------------------- */
|
||||
/*
|
||||
.intro, .example { margin-bottom: 2em; }
|
||||
.example {
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
-moz-box-shadow: 0 0 5px #bfbfbf;
|
||||
-webkit-box-shadow: 0 0 5px #bfbfbf;
|
||||
box-shadow: 0 0 5px #bfbfbf;
|
||||
padding: 1em;
|
||||
}
|
||||
.intro {
|
||||
background: none repeat scroll 0 0 #F0F1F8; border: 1px solid #D4D8EB; padding: 0 1em;
|
||||
}
|
||||
*/
|
||||
|
||||
/* -- Other Styles ---------------------------------------------------------- */
|
||||
|
||||
/* These are probably YUI-specific, and should be moved out of Selleck's default
|
||||
theme. */
|
||||
|
||||
.button {
|
||||
border: 1px solid #dadada;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
color: #444;
|
||||
display: inline-block;
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
font-size: 92.308%;
|
||||
font-weight: bold;
|
||||
padding: 4px 13px 3px;
|
||||
-moz-text-shadow: 1px 1px 0 #fff;
|
||||
-webkit-text-shadow: 1px 1px 0 #fff;
|
||||
text-shadow: 1px 1px 0 #fff;
|
||||
white-space: nowrap;
|
||||
|
||||
background: #EFEFEF; /* old browsers */
|
||||
background: -moz-linear-gradient(top, #f5f5f5 0%, #efefef 50%, #e5e5e5 51%, #dfdfdf 100%); /* firefox */
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f5f5f5), color-stop(50%,#efefef), color-stop(51%,#e5e5e5), color-stop(100%,#dfdfdf)); /* webkit */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#dfdfdf',GradientType=0 ); /* ie */
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
border-color: #466899;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
-moz-text-shadow: 1px 1px 0 #222;
|
||||
-webkit-text-shadow: 1px 1px 0 #222;
|
||||
text-shadow: 1px 1px 0 #222;
|
||||
|
||||
background: #6396D8; /* old browsers */
|
||||
background: -moz-linear-gradient(top, #6396D8 0%, #5A83BC 50%, #547AB7 51%, #466899 100%); /* firefox */
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6396D8), color-stop(50%,#5A83BC), color-stop(51%,#547AB7), color-stop(100%,#466899)); /* webkit */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6396D8', endColorstr='#466899',GradientType=0 ); /* ie */
|
||||
}
|
||||
|
||||
.newwindow { text-align: center; }
|
||||
|
||||
.header .version em {
|
||||
display: block;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
||||
#classdocs .item {
|
||||
border-bottom: 1px solid #466899;
|
||||
margin: 1em 0;
|
||||
padding: 1.5em;
|
||||
}
|
||||
|
||||
#classdocs .item .params p,
|
||||
#classdocs .item .returns p,{
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#classdocs .item em code, #classdocs .item em.comment {
|
||||
color: green;
|
||||
}
|
||||
|
||||
#classdocs .item em.comment a {
|
||||
color: green;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#classdocs .foundat {
|
||||
font-size: 11px;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.attrs .emits {
|
||||
margin-left: 2em;
|
||||
padding: .5em;
|
||||
border-left: 1px dashed #ccc;
|
||||
}
|
||||
|
||||
abbr {
|
||||
border-bottom: 1px dashed #ccc;
|
||||
font-size: 80%;
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.prettyprint li.L0,
|
||||
.prettyprint li.L1,
|
||||
.prettyprint li.L2,
|
||||
.prettyprint li.L3,
|
||||
.prettyprint li.L5,
|
||||
.prettyprint li.L6,
|
||||
.prettyprint li.L7,
|
||||
.prettyprint li.L8 {
|
||||
list-style: decimal;
|
||||
}
|
||||
|
||||
ul li p {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.method .name {
|
||||
font-size: 110%;
|
||||
}
|
||||
|
||||
.apidocs .methods .extends .method,
|
||||
.apidocs .properties .extends .property,
|
||||
.apidocs .attrs .extends .attr,
|
||||
.apidocs .events .extends .event {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.apidocs .methods .extends .inherited,
|
||||
.apidocs .properties .extends .inherited,
|
||||
.apidocs .attrs .extends .inherited,
|
||||
.apidocs .events .extends .inherited {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#hd {
|
||||
background: whiteSmoke;
|
||||
background: -moz-linear-gradient(top,#DCDBD9 0,#F6F5F3 100%);
|
||||
background: -webkit-gradient(linear,left top,left bottom,color-stop(0%,#DCDBD9),color-stop(100%,#F6F5F3));
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#dcdbd9',endColorstr='#F6F5F3',GradientType=0);
|
||||
border-bottom: 1px solid #DFDFDF;
|
||||
padding: 0 15px 1px 20px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
#hd img {
|
||||
margin-right: 10px;
|
||||
vertical-align: middle;
|
||||
|
||||
}
|
||||
|
||||
|
||||
img {
|
||||
max-height: 300px;
|
||||
}
|
||||
|
||||
|
||||
/* -- API Docs CSS ---------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
This file is organized so that more generic styles are nearer the top, and more
|
||||
specific styles are nearer the bottom of the file. This allows us to take full
|
||||
advantage of the cascade to avoid redundant style rules. Please respect this
|
||||
convention when making changes.
|
||||
*/
|
||||
|
||||
/* -- Generic TabView styles ------------------------------------------------ */
|
||||
|
||||
/*
|
||||
These styles apply to all API doc tabviews. To change styles only for a
|
||||
specific tabview, see the other sections below.
|
||||
*/
|
||||
|
||||
.yui3-js-enabled .apidocs .tabview {
|
||||
visibility: hidden; /* Hide until the TabView finishes rendering. */
|
||||
_visibility: visible;
|
||||
}
|
||||
|
||||
.apidocs .tabview.yui3-tabview-content { visibility: visible; }
|
||||
.apidocs .tabview .yui3-tabview-panel { background: #fff; }
|
||||
|
||||
/* -- Generic Content Styles ------------------------------------------------ */
|
||||
|
||||
/* Headings */
|
||||
h2, h3, h4, h5, h6 {
|
||||
border: none;
|
||||
color: #30418C;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.link-docs {
|
||||
float: right;
|
||||
font-size: 15px;
|
||||
margin: 4px 4px 6px;
|
||||
padding: 6px 30px 5px;
|
||||
}
|
||||
|
||||
.apidocs { zoom: 1; }
|
||||
|
||||
/* Generic box styles. */
|
||||
.apidocs .box {
|
||||
border: 1px solid;
|
||||
border-radius: 3px;
|
||||
margin: 1em 0;
|
||||
padding: 0 1em;
|
||||
}
|
||||
|
||||
/* A flag is a compact, capsule-like indicator of some kind. It's used to
|
||||
indicate private and protected items, item return types, etc. in an
|
||||
attractive and unobtrusive way. */
|
||||
.apidocs .flag {
|
||||
background: #bababa;
|
||||
border-radius: 3px;
|
||||
color: #fff;
|
||||
font-size: 11px;
|
||||
margin: 0 0.5em;
|
||||
padding: 2px 4px 1px;
|
||||
}
|
||||
|
||||
/* Class/module metadata such as "Uses", "Extends", "Defined in", etc. */
|
||||
.apidocs .meta {
|
||||
background: #f9f9f9;
|
||||
border-color: #efefef;
|
||||
color: #555;
|
||||
font-size: 11px;
|
||||
padding: 3px 6px;
|
||||
}
|
||||
|
||||
.apidocs .meta p { margin: 0; }
|
||||
|
||||
/* Deprecation warning. */
|
||||
.apidocs .box.deprecated,
|
||||
.apidocs .flag.deprecated {
|
||||
background: #fdac9f;
|
||||
border: 1px solid #fd7775;
|
||||
}
|
||||
|
||||
.apidocs .box.deprecated p { margin: 0.5em 0; }
|
||||
.apidocs .flag.deprecated { color: #333; }
|
||||
|
||||
/* Module/Class intro description. */
|
||||
.apidocs .intro {
|
||||
background: #f0f1f8;
|
||||
border-color: #d4d8eb;
|
||||
}
|
||||
|
||||
/* Loading spinners. */
|
||||
#bd.loading .apidocs,
|
||||
#api-list.loading .yui3-tabview-panel {
|
||||
background: #fff url(../img/spinner.gif) no-repeat center 70px;
|
||||
min-height: 150px;
|
||||
}
|
||||
|
||||
#bd.loading .apidocs .content,
|
||||
#api-list.loading .yui3-tabview-panel .apis {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.apidocs .no-visible-items { color: #666; }
|
||||
|
||||
/* Generic inline list. */
|
||||
.apidocs ul.inline {
|
||||
display: inline;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.apidocs ul.inline li { display: inline; }
|
||||
|
||||
/* Comma-separated list. */
|
||||
.apidocs ul.commas li:after { content: ','; }
|
||||
.apidocs ul.commas li:last-child:after { content: ''; }
|
||||
|
||||
/* Keyboard shortcuts. */
|
||||
kbd .cmd { font-family: Monaco, Helvetica; }
|
||||
|
||||
/* -- Generic Access Level styles ------------------------------------------- */
|
||||
.apidocs .item.protected,
|
||||
.apidocs .item.private,
|
||||
.apidocs .index-item.protected,
|
||||
.apidocs .index-item.deprecated,
|
||||
.apidocs .index-item.private {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.show-deprecated .item.deprecated,
|
||||
.show-deprecated .index-item.deprecated,
|
||||
.show-protected .item.protected,
|
||||
.show-protected .index-item.protected,
|
||||
.show-private .item.private,
|
||||
.show-private .index-item.private {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.hide-inherited .item.inherited,
|
||||
.hide-inherited .index-item.inherited {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* -- Generic Item Index styles --------------------------------------------- */
|
||||
.apidocs .index { margin: 1.5em 0 3em; }
|
||||
|
||||
.apidocs .index h3 {
|
||||
border-bottom: 1px solid #efefef;
|
||||
color: #333;
|
||||
font-size: 13px;
|
||||
margin: 2em 0 0.6em;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
.apidocs .index .no-visible-items { margin-top: 2em; }
|
||||
|
||||
.apidocs .index-list {
|
||||
border-color: #efefef;
|
||||
font-size: 12px;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-moz-column-count: 4;
|
||||
-moz-column-gap: 10px;
|
||||
-moz-column-width: 170px;
|
||||
-ms-column-count: 4;
|
||||
-ms-column-gap: 10px;
|
||||
-ms-column-width: 170px;
|
||||
-o-column-count: 4;
|
||||
-o-column-gap: 10px;
|
||||
-o-column-width: 170px;
|
||||
-webkit-column-count: 4;
|
||||
-webkit-column-gap: 10px;
|
||||
-webkit-column-width: 170px;
|
||||
column-count: 4;
|
||||
column-gap: 10px;
|
||||
column-width: 170px;
|
||||
}
|
||||
|
||||
.apidocs .no-columns .index-list {
|
||||
-moz-column-count: 1;
|
||||
-ms-column-count: 1;
|
||||
-o-column-count: 1;
|
||||
-webkit-column-count: 1;
|
||||
column-count: 1;
|
||||
}
|
||||
|
||||
.apidocs .index-item { white-space: nowrap; }
|
||||
|
||||
.apidocs .index-item .flag {
|
||||
background: none;
|
||||
border: none;
|
||||
color: #afafaf;
|
||||
display: inline;
|
||||
margin: 0 0 0 0.2em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* -- Generic API item styles ----------------------------------------------- */
|
||||
.apidocs .args {
|
||||
display: inline;
|
||||
margin: 0 0.5em;
|
||||
}
|
||||
|
||||
.apidocs .flag.chainable { background: #46ca3b; }
|
||||
.apidocs .flag.protected { background: #9b86fc; }
|
||||
.apidocs .flag.private { background: #fd6b1b; }
|
||||
.apidocs .flag.async { background: #356de4; }
|
||||
.apidocs .flag.required { background: #e60923; }
|
||||
|
||||
.apidocs .item {
|
||||
border-bottom: 1px solid #efefef;
|
||||
margin: 1.5em 0 2em;
|
||||
padding-bottom: 2em;
|
||||
}
|
||||
|
||||
.apidocs .item h4,
|
||||
.apidocs .item h5,
|
||||
.apidocs .item h6 {
|
||||
color: #333;
|
||||
font-family: inherit;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
.apidocs .item .description p,
|
||||
.apidocs .item pre.code {
|
||||
margin: 1em 0 0;
|
||||
}
|
||||
|
||||
.apidocs .item .meta {
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.apidocs .item .name {
|
||||
display: inline;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.apidocs .item .type,
|
||||
.apidocs .item .type a,
|
||||
.apidocs .returns-inline {
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.apidocs .item .type,
|
||||
.apidocs .returns-inline {
|
||||
font-size: 11px;
|
||||
margin: 0 0 0 0;
|
||||
}
|
||||
|
||||
.apidocs .item .type a { border-bottom: 1px dotted #afafaf; }
|
||||
.apidocs .item .type a:hover { border: none; }
|
||||
|
||||
/* -- Item Parameter List --------------------------------------------------- */
|
||||
.apidocs .params-list {
|
||||
list-style: square;
|
||||
margin: 1em 0 0 2em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.apidocs .param { margin-bottom: 1em; }
|
||||
|
||||
.apidocs .param .type,
|
||||
.apidocs .param .type a {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.apidocs .param .type {
|
||||
margin: 0 0 0 0.5em;
|
||||
*margin-left: 0.5em;
|
||||
}
|
||||
|
||||
.apidocs .param-name { font-weight: bold; }
|
||||
|
||||
/* -- Item "Emits" block ---------------------------------------------------- */
|
||||
.apidocs .item .emits {
|
||||
background: #f9f9f9;
|
||||
border-color: #eaeaea;
|
||||
}
|
||||
|
||||
/* -- Item "Returns" block -------------------------------------------------- */
|
||||
.apidocs .item .returns .type,
|
||||
.apidocs .item .returns .type a {
|
||||
font-size: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* -- Class Constructor block ----------------------------------------------- */
|
||||
.apidocs .constructor .item {
|
||||
border: none;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
/* -- File Source View ------------------------------------------------------ */
|
||||
.apidocs .file pre.code,
|
||||
#doc .apidocs .file pre.prettyprint {
|
||||
background: inherit;
|
||||
border: none;
|
||||
overflow: visible;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.apidocs .L0,
|
||||
.apidocs .L1,
|
||||
.apidocs .L2,
|
||||
.apidocs .L3,
|
||||
.apidocs .L4,
|
||||
.apidocs .L5,
|
||||
.apidocs .L6,
|
||||
.apidocs .L7,
|
||||
.apidocs .L8,
|
||||
.apidocs .L9 {
|
||||
background: inherit;
|
||||
}
|
||||
|
||||
/* -- Submodule List -------------------------------------------------------- */
|
||||
.apidocs .module-submodule-description {
|
||||
font-size: 12px;
|
||||
margin: 0.3em 0 1em;
|
||||
}
|
||||
|
||||
.apidocs .module-submodule-description p:first-child { margin-top: 0; }
|
||||
|
||||
/* -- Sidebar TabView ------------------------------------------------------- */
|
||||
#api-tabview { margin-top: 0.6em; }
|
||||
|
||||
#api-tabview-filter,
|
||||
#api-tabview-panel {
|
||||
border: 1px solid #dfdfdf;
|
||||
}
|
||||
|
||||
#api-tabview-filter {
|
||||
border-bottom: none;
|
||||
border-top: none;
|
||||
padding: 0.6em 10px 0 10px;
|
||||
}
|
||||
|
||||
#api-tabview-panel { border-top: none; }
|
||||
#api-filter { width: 97%; }
|
||||
|
||||
/* -- Content TabView ------------------------------------------------------- */
|
||||
#classdocs .yui3-tabview-panel { border: none; }
|
||||
|
||||
/* -- Source File Contents -------------------------------------------------- */
|
||||
.prettyprint li.L0,
|
||||
.prettyprint li.L1,
|
||||
.prettyprint li.L2,
|
||||
.prettyprint li.L3,
|
||||
.prettyprint li.L5,
|
||||
.prettyprint li.L6,
|
||||
.prettyprint li.L7,
|
||||
.prettyprint li.L8 {
|
||||
list-style: decimal;
|
||||
}
|
||||
|
||||
/* -- API options ----------------------------------------------------------- */
|
||||
#api-options {
|
||||
font-size: 11px;
|
||||
margin-top: 2.2em;
|
||||
position: absolute;
|
||||
right: 1.5em;
|
||||
}
|
||||
|
||||
/*#api-options label { margin-right: 0.6em; }*/
|
||||
|
||||
/* -- API list -------------------------------------------------------------- */
|
||||
#api-list {
|
||||
margin-top: 1.5em;
|
||||
*zoom: 1;
|
||||
}
|
||||
|
||||
.apis {
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0.5em 0 0.5em 0.4em;
|
||||
}
|
||||
|
||||
.apis a {
|
||||
border: 1px solid transparent;
|
||||
display: block;
|
||||
margin: 0 0 0 -4px;
|
||||
padding: 1px 4px 0;
|
||||
text-decoration: none;
|
||||
_border: none;
|
||||
_display: inline;
|
||||
}
|
||||
|
||||
.apis a:hover,
|
||||
.apis a:focus {
|
||||
background: #E8EDFC;
|
||||
background: -moz-linear-gradient(top, #e8edfc 0%, #becef7 100%);
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#E8EDFC), color-stop(100%,#BECEF7));
|
||||
border-color: #AAC0FA;
|
||||
border-radius: 3px;
|
||||
color: #333;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.api-list-item a:hover,
|
||||
.api-list-item a:focus {
|
||||
font-weight: bold;
|
||||
text-shadow: 1px 1px 1px #fff;
|
||||
}
|
||||
|
||||
.apis .message { color: #888; }
|
||||
.apis .result a { padding: 3px 5px 2px; }
|
||||
|
||||
.apis .result .type {
|
||||
right: 4px;
|
||||
top: 7px;
|
||||
}
|
||||
|
||||
.api-list-item .yui3-highlight {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
51
doxy/node/generators/yuidoc/tmpl/layouts/main.handlebars
Normal file
@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{{htmlTitle}}</title>
|
||||
<link rel="stylesheet" href="{{yuiGridsUrl}}">
|
||||
<link rel="stylesheet" href="{{projectAssets}}/vendor/prettify/prettify-min.css">
|
||||
<link rel="stylesheet" href="{{projectAssets}}/css/main.css" id="site_styles">
|
||||
<link rel="icon" href="{{projectAssets}}/favicon.ico">
|
||||
<script src="{{yuiSeedUrl}}"></script>
|
||||
</head>
|
||||
<body class="yui3-skin-sam">
|
||||
|
||||
<div id="doc">
|
||||
<div id="hd" class="yui3-g header">
|
||||
<div class="yui3-u-3-4">
|
||||
<h1>UPM</h1>
|
||||
<p>
|
||||
The UPM API is a high level sensor library for IoT devices using MRAA. See examples <a href="https://github.com/intel-iot-devkit/upm/tree/master/examples/javascript">here</a>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="bd" class="yui3-g">
|
||||
|
||||
<div class="yui3-u-1-4">
|
||||
<div id="docs-sidebar" class="sidebar apidocs">
|
||||
{{>sidebar}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="yui3-u-3-4">
|
||||
{{>options}}
|
||||
<div class="apidocs">
|
||||
<div id="docs-main">
|
||||
<div class="content">
|
||||
{{>layout_content}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="{{projectAssets}}/vendor/prettify/prettify-min.js"></script>
|
||||
<script>prettyPrint();</script>
|
||||
<script src="{{projectAssets}}/js/yui-prettify.js"></script>
|
||||
<script src="{{projectAssets}}/../api.js"></script>
|
||||
<script src="{{projectAssets}}/js/api-filter.js"></script>
|
||||
<script src="{{projectAssets}}/js/api-list.js"></script>
|
||||
<script src="{{projectAssets}}/js/api-search.js"></script>
|
||||
<script src="{{projectAssets}}/js/apidocs.js"></script>
|
||||
</body>
|
||||
</html>
|
205
doxy/node/generators/yuidoc/tmpl/partials/classes.handlebars
Normal file
@ -0,0 +1,205 @@
|
||||
<h1>{{name}} Class</h1>
|
||||
<div class="box meta">
|
||||
{{#if uses}}
|
||||
<div class="uses">
|
||||
Uses
|
||||
<ul class="inline commas">
|
||||
{{#uses}}
|
||||
<li><a href="{{.}}.html">{{.}}</a></li>
|
||||
{{/uses}}
|
||||
</ul>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if extends}}
|
||||
<div class="extends">
|
||||
Extends {{#crossLink extends}}{{/crossLink}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if foundAt}}
|
||||
<div class="foundat">
|
||||
Defined in: <a href="{{foundAt}}">`{{{file}}}:{{{line}}}`</a>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if module}}
|
||||
{{#if submodule}}
|
||||
Module: {{#crossLinkModule submodule}}{{/crossLinkModule}}<br>
|
||||
Parent Module: {{#crossLinkModule module}}{{/crossLinkModule}}
|
||||
{{else}}
|
||||
Module: {{#crossLinkModule module}}{{/crossLinkModule}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{#if since}}
|
||||
<p>Available since {{since}}</p>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{#if deprecated}}
|
||||
<div class="box deprecated">
|
||||
<p>
|
||||
{{#if deprecationMessage}}
|
||||
<strong>Deprecated:</strong> {{deprecationMessage}}
|
||||
{{else}}
|
||||
This class is deprecated.
|
||||
{{/if}}
|
||||
</p>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="box intro">
|
||||
{{{classDescription}}}
|
||||
</div>
|
||||
|
||||
{{#is_constructor}}
|
||||
<div class="constructor">
|
||||
<h2>Constructor</h2>
|
||||
{{>method}}
|
||||
</div>
|
||||
{{/is_constructor}}
|
||||
|
||||
<div id="classdocs" class="tabview">
|
||||
<ul class="api-class-tabs">
|
||||
<li class="api-class-tab index"><a href="#index">Index</a></li>
|
||||
|
||||
{{#if methods}}
|
||||
<li class="api-class-tab methods"><a href="#methods">Methods</a></li>
|
||||
{{/if}}
|
||||
{{#if properties}}
|
||||
<li class="api-class-tab properties"><a href="#properties">Properties</a></li>
|
||||
{{/if}}
|
||||
{{#if attrs}}
|
||||
<li class="api-class-tab attrs"><a href="#attrs">Attributes</a></li>
|
||||
{{/if}}
|
||||
{{#if events}}
|
||||
<li class="api-class-tab events"><a href="#events">Events</a></li>
|
||||
{{/if}}
|
||||
</ul>
|
||||
|
||||
<div>
|
||||
<div id="index" class="api-class-tabpanel index">
|
||||
<h2 class="off-left">Item Index</h2>
|
||||
|
||||
{{#if methods}}
|
||||
<div class="index-section methods">
|
||||
<h3>Methods</h3>
|
||||
|
||||
<ul class="index-list methods{{#if extends}} extends{{/if}}">
|
||||
{{#methods}}
|
||||
<li class="index-item method{{#if access}} {{access}}{{/if}}{{#if deprecated}} deprecated{{/if}}{{#if overwritten_from}} inherited{{/if}}{{#if extended_from}} inherited{{/if}}">
|
||||
<a href="#method_{{name}}">{{name}}</a>
|
||||
|
||||
{{#if static}}
|
||||
<span class="flag static">static</span>
|
||||
{{/if}}
|
||||
{{#if deprecated}}
|
||||
<span class="flag deprecated">deprecated</span>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/methods}}
|
||||
</ul>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if properties}}
|
||||
<div class="index-section properties">
|
||||
<h3>Properties</h3>
|
||||
|
||||
<ul class="index-list properties{{#if extends}} extends{{/if}}">
|
||||
{{#properties}}
|
||||
<li class="index-item property{{#if access}} {{access}}{{/if}}{{#if deprecated}} deprecated{{/if}}{{#if overwritten_from}} inherited{{/if}}{{#if extended_from}} inherited{{/if}}">
|
||||
<a href="#property_{{name}}">{{name}}</a>
|
||||
|
||||
{{#if static}}
|
||||
<span class="flag static">static</span>
|
||||
{{/if}}
|
||||
{{#if deprecated}}
|
||||
<span class="flag deprecated">deprecated</span>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/properties}}
|
||||
</ul>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if attrs}}
|
||||
<div class="index-section attrs">
|
||||
<h3>Attributes</h3>
|
||||
|
||||
<ul class="index-list attrs{{#if extends}} extends{{/if}}">
|
||||
{{#attrs}}
|
||||
<li class="index-item attr{{#if access}} {{access}}{{/if}}{{#if deprecated}} deprecated{{/if}}{{#if overwritten_from}} inherited{{/if}}{{#if extended_from}} inherited{{/if}}">
|
||||
<a href="#attr_{{name}}">{{name}}</a>
|
||||
</li>
|
||||
{{/attrs}}
|
||||
</ul>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if events}}
|
||||
<div class="index-section events">
|
||||
<h3>Events</h3>
|
||||
|
||||
<ul class="index-list events{{#if extends}} extends{{/if}}">
|
||||
{{#events}}
|
||||
<li class="index-item event{{#if access}} {{access}}{{/if}}{{#if deprecated}} deprecated{{/if}}{{#if overwritten_from}} inherited{{/if}}{{#if extended_from}} inherited{{/if}}">
|
||||
<a href="#event_{{name}}">{{name}}</a>
|
||||
|
||||
{{#if static}}
|
||||
<span class="flag static">static</span>
|
||||
{{/if}}
|
||||
{{#if deprecated}}
|
||||
<span class="flag deprecated">deprecated</span>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/events}}
|
||||
</ul>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{#if methods}}
|
||||
<div id="methods" class="api-class-tabpanel">
|
||||
<h2 class="off-left">Methods</h2>
|
||||
|
||||
{{#methods}}
|
||||
{{>method}}
|
||||
{{/methods}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if properties}}
|
||||
<div id="properties" class="api-class-tabpanel">
|
||||
<h2 class="off-left">Properties</h2>
|
||||
|
||||
{{#properties}}
|
||||
{{>props}}
|
||||
{{/properties}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if attrs}}
|
||||
<div id="attrs" class="api-class-tabpanel">
|
||||
<h2 class="off-left">Attributes</h2>
|
||||
|
||||
{{#attrs}}
|
||||
{{>attrs}}
|
||||
{{/attrs}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if events}}
|
||||
<div id="events" class="api-class-tabpanel">
|
||||
<h2 class="off-left">Events</h2>
|
||||
|
||||
{{#events}}
|
||||
{{>events}}
|
||||
{{/events}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{{customCrossLinks}}}
|
212
doxy/node/generators/yuidoc/tmpl/partials/method.handlebars
Normal file
@ -0,0 +1,212 @@
|
||||
<div id="method_{{name}}" class="method item{{#if access}} {{access}}{{/if}}{{#if deprecated}} deprecated{{/if}}{{#if extended_from}} inherited{{/if}}">
|
||||
<h3 class="name"><code>{{name}}</code></h3>
|
||||
|
||||
{{#if params}}
|
||||
<div class="args">
|
||||
<span class="paren">(</span><ul class="args-list inline commas">
|
||||
{{#params}}
|
||||
<li class="arg">
|
||||
{{#if optional}}
|
||||
<code class="optional">[{{name}}{{#if optdefault}}={{optdefault}}{{/if}}]</code>
|
||||
{{else}}
|
||||
<code>{{name}}</code>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/params}}
|
||||
</ul><span class="paren">)</span>
|
||||
</div>
|
||||
{{else}}
|
||||
<span class="paren">()</span>
|
||||
{{/if}}
|
||||
|
||||
{{#if return}}
|
||||
<span class="returns-inline">
|
||||
<span class="type">{{#crossLink returnType}}{{/crossLink}}</span>
|
||||
</span>
|
||||
{{/if}}
|
||||
|
||||
{{#if deprecated}}
|
||||
<span class="flag deprecated"{{#if deprecationMessage}} title="{{deprecationMessage}}"{{/if}}>deprecated</span>
|
||||
{{/if}}
|
||||
|
||||
{{#if access}}
|
||||
<span class="flag {{access}}">{{access}}</span>
|
||||
{{/if}}
|
||||
|
||||
{{#if final}}
|
||||
<span class="flag final">final</span>
|
||||
{{/if}}
|
||||
|
||||
{{#if static}}
|
||||
<span class="flag static">static</span>
|
||||
{{/if}}
|
||||
|
||||
{{#if chainable}}
|
||||
<span class="flag chainable">chainable</span>
|
||||
{{/if}}
|
||||
|
||||
{{#if async}}
|
||||
<span class="flag async">async</span>
|
||||
{{/if}}
|
||||
|
||||
<div class="meta">
|
||||
{{#if overwritten_from}}
|
||||
<p>Inherited from
|
||||
<a href="{{crossLinkRaw overwritten_from/class}}#method_{{overwritten_from/name}}">
|
||||
{{overwritten_from/class}}
|
||||
</a>
|
||||
{{#if foundAt}}
|
||||
but overwritten in
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{#if extended_from}}
|
||||
<p>Inherited from
|
||||
<a href="{{crossLinkRaw extended_from}}#method_{{name}}">{{extended_from}}</a>:
|
||||
{{else}}
|
||||
{{#providedBy}}
|
||||
<p>Provided by the <a href="../modules/{{.}}.html">{{.}}</a> module.</p>
|
||||
{{/providedBy}}
|
||||
<p>
|
||||
{{#if foundAt}}
|
||||
Defined in
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#if foundAt}}
|
||||
<a href="{{foundAt}}">`{{{file}}}:{{{line}}}`</a>
|
||||
{{/if}}
|
||||
</p>
|
||||
|
||||
|
||||
{{#if deprecationMessage}}
|
||||
<p>Deprecated: {{deprecationMessage}}</p>
|
||||
{{/if}}
|
||||
|
||||
{{#if since}}
|
||||
<p>Available since {{since}}</p>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<div class="description">
|
||||
{{{methodDescription}}}
|
||||
</div>
|
||||
|
||||
{{#if params}}
|
||||
<div class="params">
|
||||
<h4>Parameters:</h4>
|
||||
|
||||
<ul class="params-list">
|
||||
{{#params}}
|
||||
<li class="param">
|
||||
{{#if optional}}
|
||||
<code class="param-name optional">[{{name}}{{#if optdefault}}={{optdefault}}{{/if}}]</code>
|
||||
<span class="type">{{#crossLink type}}{{/crossLink}}</span>
|
||||
<span class="flag optional" title="This parameter is optional.">optional</span>
|
||||
{{else}}
|
||||
<code class="param-name">{{name}}</code>
|
||||
<span class="type">{{#crossLink type}}{{/crossLink}}</span>
|
||||
{{/if}}
|
||||
|
||||
{{#if multiple}}
|
||||
<span class="flag multiple" title="This argument may occur one or more times.">multiple</span>
|
||||
{{/if}}
|
||||
|
||||
<div class="param-description">
|
||||
{{{description}}}
|
||||
</div>
|
||||
|
||||
{{#if props}}
|
||||
<ul class="params-list">
|
||||
{{#props}}
|
||||
<li class="param">
|
||||
{{#if optional}}
|
||||
<code class="param-name optional">[{{name}}{{#if optdefault}}={{optdefault}}{{/if}}]</code>
|
||||
<span class="type">{{#crossLink type}}{{/crossLink}}</span>
|
||||
<span class="flag optional" title="This parameter is optional.">optional</span>
|
||||
{{else}}
|
||||
<code class="param-name">{{name}}</code>
|
||||
<span class="type">{{#crossLink type}}{{/crossLink}}</span>
|
||||
{{/if}}
|
||||
|
||||
<div class="param-description">
|
||||
{{{description}}}
|
||||
</div>
|
||||
|
||||
{{#if props}}
|
||||
<ul class="params-list">
|
||||
{{#props}}
|
||||
<li class="param">
|
||||
{{#if optional}}
|
||||
<code class="param-name optional">[{{name}}{{#if optdefault}}={{optdefault}}{{/if}}]</code>
|
||||
<span class="type">{{#crossLink type}}{{/crossLink}}</span>
|
||||
<span class="flag optional" title="This parameter is optional.">optional</span>
|
||||
{{else}}
|
||||
<code class="param-name">{{name}}</code>
|
||||
<span class="type">{{#crossLink type}}{{/crossLink}}</span>
|
||||
{{/if}}
|
||||
|
||||
<div class="param-description">
|
||||
{{{description}}}
|
||||
</div>
|
||||
</li>
|
||||
{{/props}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/props}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/params}}
|
||||
</ul>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#return}}
|
||||
<div class="returns">
|
||||
<h4>Returns:</h4>
|
||||
|
||||
<div class="returns-description">
|
||||
{{#if description}}
|
||||
{{#if type}}
|
||||
<span class="type">{{#crossLink type}}{{/crossLink}}</span>:
|
||||
{{/if}}
|
||||
{{{description}}}
|
||||
{{else}}
|
||||
{{#if type}}
|
||||
<span class="type">{{#crossLink type}}{{/crossLink}}</span>:
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{/return}}
|
||||
|
||||
{{#throws}}
|
||||
<div class="throws">
|
||||
<h4>Throws:</h4>
|
||||
|
||||
<div class="throws-description">
|
||||
{{#if description}}
|
||||
{{#if type}}
|
||||
<span class="type">{{#crossLink type}}{{/crossLink}}</span>:
|
||||
{{/if}}
|
||||
{{{description}}}
|
||||
{{else}}
|
||||
{{#if type}}
|
||||
<span class="type">{{#crossLink type}}{{/crossLink}}</span>:
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{/throws}}
|
||||
|
||||
{{#example}}
|
||||
<div class="example">
|
||||
<h4>Example:</h4>
|
||||
|
||||
<div class="example-content">
|
||||
{{{.}}}
|
||||
</div>
|
||||
</div>
|
||||
{{/example}}
|
||||
</div>
|
92
doxy/node/generators/yuidoc/tmpl/partials/module.handlebars
Normal file
@ -0,0 +1,92 @@
|
||||
<h1>{{name}} Module</h1>
|
||||
<div class="box clearfix meta">
|
||||
{{#extra}}
|
||||
{{#selleck}}
|
||||
<a class="button link-docs" href="/yui/docs/{{name}}">User Guide & Examples</a>
|
||||
{{/selleck}}
|
||||
{{/extra}}
|
||||
|
||||
{{#if requires}}
|
||||
<div class="uses">
|
||||
Requires
|
||||
<ul class="inline commas">
|
||||
{{#requires}}
|
||||
<li>{{#crossLinkModule .}}{{/crossLinkModule}}</li>
|
||||
{{/requires}}
|
||||
</ul>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if foundAt}}
|
||||
<div class="foundat">
|
||||
Defined in: <a href="{{foundAt}}">`{{{file}}}:{{{line}}}`</a>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if since}}
|
||||
<p>Available since {{since}}</p>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{#if deprecated}}
|
||||
<div class="box deprecated">
|
||||
<p>
|
||||
{{#if deprecationMessage}}
|
||||
<strong>Deprecated:</strong> {{deprecationMessage}}
|
||||
{{else}}
|
||||
This module is deprecated.
|
||||
{{/if}}
|
||||
</p>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="box intro">
|
||||
{{{moduleDescription}}}
|
||||
</div>
|
||||
|
||||
{{#example}}
|
||||
<div class="example">
|
||||
<h4>Example:</h4>
|
||||
<div class="example-content">
|
||||
{{{.}}}
|
||||
</div>
|
||||
</div>
|
||||
{{/example}}
|
||||
|
||||
<div class="yui3-g">
|
||||
<div class="yui3-u-1-2">
|
||||
{{#if moduleClasses}}
|
||||
<p>This module provides the following classes:</p>
|
||||
|
||||
<ul class="module-classes">
|
||||
{{#moduleClasses}}
|
||||
<li class="module-class">
|
||||
<a href="{{../projectRoot}}classes/{{name}}.html">
|
||||
{{displayName}}
|
||||
</a>
|
||||
</li>
|
||||
{{/moduleClasses}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<div class="yui3-u-1-2">
|
||||
{{#if subModules}}
|
||||
<p>This module is a rollup of the following modules:</p>
|
||||
|
||||
<ul class="module-submodules">
|
||||
{{#subModules}}
|
||||
<li class="module-submodule">
|
||||
<a href="{{../projectRoot}}modules/{{name}}.html">
|
||||
{{displayName}}
|
||||
</a>
|
||||
|
||||
<div class="module-submodule-description">
|
||||
{{{description}}}
|
||||
</div>
|
||||
</li>
|
||||
{{/subModules}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
22
doxy/node/generators/yuidoc/tmpl/partials/options.handlebars
Normal file
@ -0,0 +1,22 @@
|
||||
<div id="api-options" hidden>
|
||||
Show:
|
||||
<label for="api-show-inherited">
|
||||
<input type="checkbox" id="api-show-inherited" checked>
|
||||
Inherited
|
||||
</label>
|
||||
|
||||
<label for="api-show-protected">
|
||||
<input type="checkbox" id="api-show-protected">
|
||||
Protected
|
||||
</label>
|
||||
|
||||
<label for="api-show-private">
|
||||
<input type="checkbox" id="api-show-private">
|
||||
Private
|
||||
</label>
|
||||
<label for="api-show-deprecated">
|
||||
<input type="checkbox" id="api-show-deprecated">
|
||||
Deprecated
|
||||
</label>
|
||||
</div>
|
||||
|
119
doxy/node/generators/yuidoc/tmpl/partials/props.handlebars
Normal file
@ -0,0 +1,119 @@
|
||||
<div id="property_{{name}}" class="property item{{#if access}} {{access}}{{/if}}{{#if deprecated}} deprecated{{/if}}{{#if extended_from}} inherited{{/if}}">
|
||||
<h3 class="name"><code>{{name}}</code></h3>
|
||||
<span class="type">{{#crossLink type}}{{/crossLink}}</span>
|
||||
|
||||
{{#if deprecated}}
|
||||
<span class="flag deprecated"{{#if deprecationMessage}} title="{{deprecationMessage}}"{{/if}}>deprecated</span>
|
||||
{{/if}}
|
||||
|
||||
{{#if access}}
|
||||
<span class="flag {{access}}">{{access}}</span>
|
||||
{{/if}}
|
||||
|
||||
{{#if final}}
|
||||
<span class="flag final">final</span>
|
||||
{{/if}}
|
||||
|
||||
{{#if static}}
|
||||
<span class="flag static">static</span>
|
||||
{{/if}}
|
||||
|
||||
<div class="meta">
|
||||
{{#if overwritten_from}}
|
||||
<p>Inherited from
|
||||
<a href="{{crossLinkRaw overwritten_from/class}}#property_{{overwritten_from/name}}">
|
||||
{{overwritten_from/class}}
|
||||
</a>
|
||||
{{#if foundAt}}
|
||||
but overwritten in
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{#if extended_from}}
|
||||
<p>Inherited from
|
||||
<a href="{{crossLinkRaw extended_from}}#property_{{name}}">{{extended_from}}</a>:
|
||||
{{else}}
|
||||
{{#providedBy}}
|
||||
<p>Provided by the <a href="../modules/{{.}}.html">{{.}}</a> module.</p>
|
||||
{{/providedBy}}
|
||||
<p>
|
||||
{{#if foundAt}}
|
||||
Defined in
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#if foundAt}}
|
||||
<a href="{{foundAt}}">`{{{file}}}:{{{line}}}`</a>
|
||||
{{/if}}
|
||||
</p>
|
||||
|
||||
{{#if deprecationMessage}}
|
||||
<p>Deprecated: {{deprecationMessage}}</p>
|
||||
{{/if}}
|
||||
|
||||
{{#if since}}
|
||||
<p>Available since {{since}}</p>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<div class="description">
|
||||
{{{propertyDescription}}}
|
||||
</div>
|
||||
|
||||
{{#if default}}
|
||||
<p><strong>Default:</strong> {{default}}</p>
|
||||
{{/if}}
|
||||
|
||||
{{#example}}
|
||||
<div class="example">
|
||||
<h4>Example:</h4>
|
||||
|
||||
<div class="example-content">
|
||||
{{{.}}}
|
||||
</div>
|
||||
</div>
|
||||
{{/example}}
|
||||
|
||||
{{#if subprops}}
|
||||
<h4>Sub-properties:</h4>
|
||||
|
||||
<ul class="params-list">
|
||||
{{#subprops}}
|
||||
<li class="param">
|
||||
{{#if optional}}
|
||||
<code class="param-name optional">[{{name}}{{#if optdefault}}={{optdefault}}{{/if}}]</code>
|
||||
<span class="type">{{#crossLink type}}{{/crossLink}}</span>
|
||||
<span class="flag optional" title="This property is optional.">optional</span>
|
||||
{{else}}
|
||||
<code class="param-name">{{name}}</code>
|
||||
<span class="type">{{#crossLink type}}{{/crossLink}}</span>
|
||||
{{/if}}
|
||||
|
||||
<div class="param-description">
|
||||
{{{description}}}
|
||||
</div>
|
||||
|
||||
{{#if subprops}}
|
||||
<ul class="params-list">
|
||||
{{#subprops}}
|
||||
<li class="param">
|
||||
{{#if optional}}
|
||||
<code class="param-name optional">[{{name}}{{#if optdefault}}={{optdefault}}{{/if}}]</code>
|
||||
<span class="type">{{#crossLink type}}{{/crossLink}}</span>
|
||||
<span class="flag optional" title="This property is optional.">optional</span>
|
||||
{{else}}
|
||||
<code class="param-name">{{name}}</code>
|
||||
<span class="type">{{#crossLink type}}{{/crossLink}}</span>
|
||||
{{/if}}
|
||||
|
||||
<div class="param-description">
|
||||
{{{description}}}
|
||||
</div>
|
||||
</li>
|
||||
{{/subprops}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{/subprops}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
</div>
|
27
doxy/node/generators/yuidoc/tmpl/partials/sidebar.handlebars
Normal file
@ -0,0 +1,27 @@
|
||||
<div id="api-list">
|
||||
<h2 class="off-left">APIs</h2>
|
||||
<div id="api-tabview" class="tabview">
|
||||
<ul class="tabs">
|
||||
<li><a href="#api-categories">By Category</a></li>
|
||||
<li><a href="#api-connections">By Connection Type</a></li>
|
||||
</ul>
|
||||
|
||||
<div id="api-tabview-filter">
|
||||
<input type="search" id="api-filter" placeholder="Type to filter APIs" hidden>
|
||||
</div>
|
||||
|
||||
<div id="api-tabview-panel">
|
||||
<ul id="api-categories" class="apis modules">
|
||||
{{{listByCategory}}}
|
||||
</ul>
|
||||
|
||||
<ul id="api-connections" class="apis modules">
|
||||
{{{listByConnection}}}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{{javascripts}}}
|
||||
|
||||
</div>
|
45
doxy/node/grammars/xml.peg
Normal file
@ -0,0 +1,45 @@
|
||||
document
|
||||
= _ ignore* _ "<doxygen " _ attr:attr* _ ">" body:elements _ "</doxygen>" _ { return body; }
|
||||
|
||||
|
||||
elements
|
||||
= element*
|
||||
|
||||
element
|
||||
= _ "<" startTag:id _ attr:attr* _ ">" _ children:elements _ "</" endTag:id ">" _ {
|
||||
if (startTag != endTag) {
|
||||
throw new Error("Expected </" + startTag + "> but </" + endTag + "> found.");
|
||||
}
|
||||
return {name: startTag, attr: attr, children: children }
|
||||
}
|
||||
/ "<" tag:id _ attr:attr* _ "/>" _ {
|
||||
return {name: tag, attr: attr }
|
||||
}
|
||||
/ _ text:text _ { return text }
|
||||
|
||||
ignore
|
||||
= "<?xml" _ attr* _ "?>" { return }
|
||||
|
||||
attr
|
||||
= name:id _ "=" _ value:string { return { name:name, value:value } }
|
||||
|
||||
string
|
||||
= '"' '"' _ { return ""; }
|
||||
/ "'" "'" _ { return ""; }
|
||||
/ '"' text:quoted '"' _ { return text; }
|
||||
/ "'" text:quoted "'" _ { return text; }
|
||||
|
||||
quoted
|
||||
= chars:[^<>'" \t\n\r]+ { return chars.join(""); }
|
||||
|
||||
text
|
||||
= chars:[^<> \t\n\r]+ { return chars.join(""); }
|
||||
|
||||
id
|
||||
= chars:[^<>/'"=? \t\n\r]+ { return chars.join(""); }
|
||||
|
||||
_ "whitespace"
|
||||
= whitespace*
|
||||
|
||||
whitespace
|
||||
= [ \t\n\r]
|
125
doxy/node/tolower.js
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Author: Dina M Suehiro <dina.m.suehiro@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 opts = require('commander'), // for command line args
|
||||
fs = require('fs'), // for file system access
|
||||
path = require('path'); // for file path parsing
|
||||
|
||||
// parse command line arguments
|
||||
opts
|
||||
.option('-i, --inputdir [directory]', 'product documents directory', __dirname + '/docs/yuidoc/upm')
|
||||
.parse(process.argv);
|
||||
|
||||
// Set to true for console output
|
||||
var debug = true;
|
||||
|
||||
// Global arrays tracking the files that have been renamed
|
||||
var originalFiles = [];
|
||||
var renamedFiles = [];
|
||||
|
||||
// Filter to get html files from different directories
|
||||
var rootFiles = getHtmlFilenames(opts.inputdir);
|
||||
var classesFiles = getHtmlFilenames(opts.inputdir + "/classes");
|
||||
var modulesFiles = getHtmlFilenames(opts.inputdir + "/modules");
|
||||
|
||||
// Rename files in the classes directory to have lower-cased file names.
|
||||
renameFiles(classesFiles);
|
||||
|
||||
classesFiles = getHtmlFilenames(opts.inputdir + "/classes");
|
||||
|
||||
// Go through the html files and update links to reflect the file names that we changed.
|
||||
renameLinks(rootFiles);
|
||||
renameLinks(classesFiles);
|
||||
renameLinks(modulesFiles);
|
||||
|
||||
// Helper function that returns paths to the html files in the specified directory
|
||||
function getHtmlFilenames (directory)
|
||||
{
|
||||
return fs.readdirSync(directory).map(function (file) {
|
||||
return path.join(directory, file);
|
||||
}).filter(function (file) {
|
||||
return fs.statSync(file).isFile();
|
||||
}).filter(function (file) {
|
||||
return path.extname(file).toLowerCase() == ".html";
|
||||
});
|
||||
}
|
||||
|
||||
// Goes through the files and renames them to be lower-cased and tracks them the
|
||||
// renamed files in the originalFiles[] and renamedFiles[] arrays.
|
||||
function renameFiles(files)
|
||||
{
|
||||
files.forEach(function (file)
|
||||
{
|
||||
var originalName = path.basename(file);
|
||||
var newFileName = originalName.toLowerCase();
|
||||
var directory = path.dirname(file);
|
||||
if (originalName != newFileName)
|
||||
{
|
||||
fs.renameSync(file, directory + "/" + newFileName); //, function(err)
|
||||
|
||||
if (debug)
|
||||
console.log('Renamed: %s --> %s', originalName, newFileName);
|
||||
|
||||
originalFiles.push(originalName);
|
||||
renamedFiles.push(newFileName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Helper function goes through the specified files and does a file/replace of the
|
||||
// originalFiles to the renamedFiles so that the .html links match what has been renamed.
|
||||
function renameLinks (files)
|
||||
{
|
||||
if (originalFiles.length <= 0)
|
||||
{
|
||||
if (debug)
|
||||
console.log("No links to rename.");
|
||||
return;
|
||||
}
|
||||
|
||||
files.forEach(function (file)
|
||||
{
|
||||
// Read the file
|
||||
data = fs.readFileSync(file, 'ascii');
|
||||
|
||||
// Find/replace the file names that were renamed
|
||||
for (var i = 0; i < originalFiles.length; i++)
|
||||
{
|
||||
var findString = '/' + originalFiles[i] + '\"';
|
||||
var replaceString = '/' + renamedFiles[i] + '\"';
|
||||
|
||||
data = data.replace(findString, replaceString);
|
||||
}
|
||||
|
||||
// Write back
|
||||
fs.writeFile(file, data, 'ascii', function (err) {
|
||||
if (err)
|
||||
throw err;
|
||||
});
|
||||
|
||||
if (debug)
|
||||
console.log('Renamed links in: %s', file);
|
||||
});
|
||||
}
|
848
doxy/node/xml2js.js
Normal file
@ -0,0 +1,848 @@
|
||||
/*
|
||||
* 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 peg = require('pegjs')
|
||||
, fs = require('fs')
|
||||
, path = require('path')
|
||||
, Promise = require('bluebird')
|
||||
, _ = require('lodash')
|
||||
, util = require('util');
|
||||
|
||||
|
||||
// use promise-style programming rather than spaghetti callbacks
|
||||
Promise.promisifyAll(fs);
|
||||
|
||||
|
||||
var xml2js = {
|
||||
|
||||
// js-format specs
|
||||
// MODULE: <module name>
|
||||
// ENUMS: {
|
||||
// <enum name>: {
|
||||
// type: <enum type>,
|
||||
// description: <enum description>
|
||||
// }, ...
|
||||
// }
|
||||
// ENUMS_BY_GROUP: {
|
||||
// <enum type>: {
|
||||
// description: <enum group description>
|
||||
// members: [ <enum name>, ... ]
|
||||
// }, ...
|
||||
// }
|
||||
// METHODS: {
|
||||
// <method name>: {
|
||||
// description: <method description>,
|
||||
// params: {
|
||||
// <param name>: {
|
||||
// type: <param type>,
|
||||
// description: <param description >
|
||||
// }, ...
|
||||
// },
|
||||
// return: {
|
||||
// type: <return type>,
|
||||
// description: <return description>
|
||||
// }
|
||||
// }, ...
|
||||
// }
|
||||
// CLASSES: {
|
||||
// <class name>: {
|
||||
// description: <class description>,
|
||||
// methods: { ... },
|
||||
// variables: {
|
||||
// <variable name>: {
|
||||
// type: <variable type>,
|
||||
// description: <variable description>
|
||||
// }
|
||||
// },
|
||||
// enums: { ... },
|
||||
// enums_by_group: { ... }
|
||||
// }, ...
|
||||
// }
|
||||
// CLASSGROUPS: {
|
||||
// <group name>: {
|
||||
// description: <group description>,
|
||||
// classes: [ <class name>, ... ]
|
||||
// }, ...
|
||||
// }
|
||||
MODULE: '',
|
||||
ENUMS: {},
|
||||
ENUMS_BY_GROUP: {},
|
||||
METHODS: {},
|
||||
CLASSES: {},
|
||||
CLASSGROUPS: {},
|
||||
|
||||
|
||||
// baseline c -> js type mapping
|
||||
TYPEMAPS: {
|
||||
'^(const)?\\s*(unsigned|signed)?\\s*(int|short|long|float|double|size_t|u?int\\d{1,2}_t)?$': 'Number',
|
||||
'^bool$': 'Boolean',
|
||||
'^(const)?\\s*(unsigned|signed)?\\s*(char|char\\s*\\*|std::string)$': 'String' // TODO: verify that swig does this mapping
|
||||
},
|
||||
|
||||
|
||||
// custom c -> js type mapping for pointers
|
||||
// ARRAY_TYPEMAPS: {
|
||||
// <pointer data type>: {
|
||||
// arrayType: <swig generated array type that will replace pointers of data type>,
|
||||
// classes: [ <class that contains arrayType>, ... ]
|
||||
// }, ...
|
||||
// }
|
||||
// POINTER_TYPEMAPS: {
|
||||
// <class that contains pointerType>: {
|
||||
// <c pointer data type>: <js swig generated pointer type that will replace pointers of data type>, ...
|
||||
// }, ...
|
||||
// }
|
||||
ARRAY_TYPEMAPS: {},
|
||||
POINTER_TYPEMAPS: {},
|
||||
|
||||
|
||||
// add command line options for this module
|
||||
addOptions: function(opts) {
|
||||
xml2js.opts = opts;
|
||||
return opts
|
||||
.option('-i, --inputdir [directory]', 'directory for xml files', __dirname + '/xml/mraa')
|
||||
.option('-c, --custom [file]', 'json for customizations')
|
||||
.option('-t, --typemaps [directory]', 'directory for custom pointer type maps')
|
||||
.option('-g, --imagedir [directory]', 'directory to link to where the images will be kept', '')
|
||||
.option('-s, --strict', 'leave out methods/variables if unknown type')
|
||||
},
|
||||
|
||||
|
||||
// parse doxygen xml -> js-format specs
|
||||
// TODO: figure out whether we need to document any protected methods/variables
|
||||
parse: function() {
|
||||
var XML_GRAMMAR_SPEC = 'grammars/xml.peg';
|
||||
var NAMESPACE_SPEC = xml2js.opts.inputdir + '/namespace' + xml2js.opts.module + '.xml';
|
||||
var CLASS_SPEC = function(c) { return xml2js.opts.inputdir + '/' + c + '.xml'; }
|
||||
var TYPES_SPEC = xml2js.opts.inputdir + '/types_8h.xml';
|
||||
xml2js.MODULE = xml2js.opts.module;
|
||||
return Promise.join(createXmlParser(XML_GRAMMAR_SPEC),
|
||||
xml2js.opts.typemaps ? initCustomPointerTypemaps(xml2js.opts.typemaps) : Promise.resolve(),
|
||||
fs.readFileAsync(NAMESPACE_SPEC, 'utf8'),
|
||||
fs.existsSync(TYPES_SPEC) ? fs.readFileAsync(TYPES_SPEC, 'utf8') : Promise.resolve(null),
|
||||
function(xmlparser, ignore, xml, xml_types) {
|
||||
if (xml_types != null) {
|
||||
_.extend(xml2js.ENUMS, getEnums(xmlparser.parse(xml_types)[0], false));
|
||||
_.extend(xml2js.ENUMS_BY_GROUP, getEnums(xmlparser.parse(xml_types)[0], true));
|
||||
}
|
||||
var spec_c = xmlparser.parse(xml)[0];
|
||||
_.extend(xml2js.ENUMS, getEnums(spec_c, false));
|
||||
_.extend(xml2js.ENUMS_BY_GROUP, getEnums(spec_c, true));
|
||||
_.extend(xml2js.METHODS, getMethods(spec_c));
|
||||
_.each(getSubclassNames(spec_c), function(className) { xml2js.CLASSES[className] = {} });
|
||||
var parseClasses = _.map(getSubclasses(spec_c), function(c) {
|
||||
return fs.readFileAsync(CLASS_SPEC(c), 'utf8').then(function(xml) {
|
||||
try {
|
||||
var spec_c = xmlparser.parse(xml)[0];
|
||||
var className = getName(spec_c);
|
||||
xml2js.CLASSES[className] = {
|
||||
description: getDescription(spec_c),
|
||||
enums: getEnums(spec_c, false, className),
|
||||
enums_by_group: getEnums(spec_c, true, className),
|
||||
variables: getVariables(spec_c, className),
|
||||
methods: getMethods(spec_c, className)
|
||||
};
|
||||
} catch(e) {
|
||||
console.log(e.toString() + ': class ' + className + ' was not parsed correctly.');
|
||||
}
|
||||
});
|
||||
});
|
||||
var parseGroups = fs.readdirAsync(xml2js.opts.inputdir).then(function(files) {
|
||||
var groupxmlfiles = _.filter(files, function(fn) {
|
||||
return ((path.extname(fn) == '.xml') && (path.basename(fn).search(/^group/) != -1));
|
||||
});
|
||||
return Promise.all(_.map(groupxmlfiles, function(fn) {
|
||||
return fs.readFileAsync(xml2js.opts.inputdir + '/' + fn, 'utf8').then(function(xml) {
|
||||
var spec_c = xmlparser.parse(xml)[0];
|
||||
if (_.isEmpty(getSubmodules(spec_c))) {
|
||||
xml2js.CLASSGROUPS[getName(spec_c)] = {
|
||||
description: getDescription(spec_c),
|
||||
classes: getSubclassNames(spec_c)
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
});
|
||||
return Promise.all(parseClasses.concat(parseGroups));
|
||||
}).then(function() {
|
||||
if (xml2js.opts.custom && fs.existsSync(xml2js.opts.custom)) {
|
||||
return fs.readFileAsync(xml2js.opts.custom, 'utf8').then(function(custom) {
|
||||
try {
|
||||
customizeMethods(JSON.parse(custom));
|
||||
} catch(e) {
|
||||
console.log('invalid custom.json, ignored. ' + e.toString());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log(xml2js.opts.custom ? ('Error: No such customization file exists: ' + xml2js.opts.custom) : 'No customizations given.');
|
||||
}
|
||||
}).then(function() {
|
||||
validateMethods();
|
||||
validateVars();
|
||||
generateCustomPointerClasses();
|
||||
return _.pick(xml2js, 'MODULE', 'ENUMS', 'ENUMS_BY_GROUP', 'METHODS', 'CLASSES', 'CLASSGROUPS');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// create an xml parser
|
||||
function createXmlParser(XML_GRAMMAR_SPEC) {
|
||||
return fs.readFileAsync(XML_GRAMMAR_SPEC, 'utf8').then(function(xmlgrammar) {
|
||||
return peg.buildParser(xmlgrammar);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// configure c->js typemaps from custom swig directives
|
||||
// TODO: many built in assumptions based on current upm file structures & .i customizations
|
||||
function initCustomPointerTypemaps(typemapsdir) {
|
||||
return fs.readdirAsync(typemapsdir).then(function(dirs) {
|
||||
return Promise.all(_.map(dirs, function(dir) {
|
||||
// get all js*.i directives from class-specific subdirectories, to be parsed below for %typemaps directives
|
||||
return fs.readdirAsync(typemapsdir + '/' + dir).then(function(files) {
|
||||
var directive = _.find(files, function(fn) {
|
||||
return ((path.extname(fn) == '.i') && (path.basename(fn).search(/^js/) != -1));
|
||||
});
|
||||
var data = {};
|
||||
if (directive) {
|
||||
data[dir] = typemapsdir + '/' + dir + '/' + directive;
|
||||
}
|
||||
return data;
|
||||
}).catch(function(e) {
|
||||
// get all .i directives from top level directory, and parse for %array_class directives
|
||||
if (e.code == 'ENOTDIR') {
|
||||
var fn = dir;
|
||||
if (path.extname(fn) == '.i') {
|
||||
return fs.readFileAsync(typemapsdir + '/' + fn, 'utf8').then(function(directives) {
|
||||
var arraytypes = _.filter(directives.split(/\n/), function(line) {
|
||||
return (line.search(/^%array_class/) != -1);
|
||||
});
|
||||
_.each(arraytypes, function(arraytype) {
|
||||
var parsed = arraytype.match(/%array_class\(([A-Za-z0-9_]+)[\s]*,[\s]*([A-Za-z0-9_]+)\)/);
|
||||
if (parsed) {
|
||||
var from = parsed[1];
|
||||
var to = parsed[2];
|
||||
xml2js.ARRAY_TYPEMAPS[from] = { arrayType: to, classes: [] };
|
||||
} else {
|
||||
console.log('Incorrectly parsed array_class from ' + fn + ': ' + arraytype);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
}));
|
||||
}).then(function(__directivesFiles) {
|
||||
// parse for %typemaps & %pointer_functions directives
|
||||
var _directivesFiles = _.filter(__directivesFiles, function(data) { return !_.isEmpty(data); });
|
||||
var directivesFiles = _.object(_.map(_directivesFiles, _.keys), _.flatten(_.map(_directivesFiles, _.values)));
|
||||
return Promise.all(_.map(directivesFiles, function(directivesFn, className) {
|
||||
return fs.readFileAsync(directivesFn, 'utf8').then(function(directives) {
|
||||
var typemaps = _.filter(directives.split(/\n/), function(line) {
|
||||
return (line.search(/^%typemap/) != -1);
|
||||
});
|
||||
_.each(typemaps, function(typemap) {
|
||||
var parsed = typemap.match(/%typemap\((in|out)\)[\s]+([A-Za-z0-9_]+[\s]*[\*])/);
|
||||
if (parsed) {
|
||||
var dir = parsed[1]; // TODO: ignored for now
|
||||
var type = normalizePointer(parsed[2]);
|
||||
var datatype = getPointerDataType(type);
|
||||
if (_.has(xml2js.ARRAY_TYPEMAPS, datatype)) {
|
||||
xml2js.ARRAY_TYPEMAPS[datatype].classes.push(className);
|
||||
} else {
|
||||
console.log('Ignored typemap from ' + directivesFn + ': ' + typemap.replace('{', '') + ' (no %array_class directive found for ' + datatype + ')');
|
||||
}
|
||||
} else {
|
||||
console.log('Ignored typemap from ' + directivesFn + ': ' + typemap.replace('{', '') + ' (only considering in/out typemaps of pointer types)');
|
||||
}
|
||||
});
|
||||
var ptrfns = _.filter(directives.split(/\n/), function(line) {
|
||||
return (line.search(/^%pointer_functions/) != -1);
|
||||
});
|
||||
_.each(ptrfns, function(ptrfn) {
|
||||
var parsed = ptrfn.match(/%pointer_functions\(([A-Za-z0-9_]+)[\s]*,[\s]*([A-Za-z0-9_]+)\)/);
|
||||
if (parsed) {
|
||||
var from = parsed[1];
|
||||
var to = parsed[2];
|
||||
if (!_.has(xml2js.POINTER_TYPEMAPS, className)) {
|
||||
xml2js.POINTER_TYPEMAPS[className] = {};
|
||||
}
|
||||
xml2js.POINTER_TYPEMAPS[className][from] = to;
|
||||
}
|
||||
});
|
||||
});
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// generate class specs for custom pointer types
|
||||
function generateCustomPointerClasses() {
|
||||
var arrayTypes = _.pluck(_.values(xml2js.ARRAY_TYPEMAPS), 'arrayType');
|
||||
var pointerTypes = _.uniq(_.flatten(_.map(_.values(xml2js.POINTER_TYPEMAPS), _.values)));
|
||||
_.each(arrayTypes, function(arrayType) {
|
||||
var dataType = _.findKey(xml2js.ARRAY_TYPEMAPS, function(to) { return to.arrayType == arrayType; });
|
||||
xml2js.CLASSES[arrayType] = {
|
||||
description: 'Array of type ' + dataType + '.',
|
||||
enums: {},
|
||||
enums_by_group: {},
|
||||
variables: {},
|
||||
methods: {}
|
||||
};
|
||||
xml2js.CLASSES[arrayType].methods[arrayType] = {
|
||||
description: 'Instantiates the array.',
|
||||
params: {
|
||||
nelements: {
|
||||
type: 'Number',
|
||||
description: 'number of elements in the array'
|
||||
}
|
||||
},
|
||||
return: {}
|
||||
};
|
||||
xml2js.CLASSES[arrayType].methods.getitem = {
|
||||
description: 'Access a particular element in the array.',
|
||||
params: {
|
||||
index: {
|
||||
type: 'Number',
|
||||
description: 'index of array to read from'
|
||||
},
|
||||
},
|
||||
return: {
|
||||
type: getType(dataType),
|
||||
description: 'the value of the element found at the given index of the array'
|
||||
}
|
||||
};
|
||||
xml2js.CLASSES[arrayType].methods.setitem = {
|
||||
description: 'Modify a particular element in the array.',
|
||||
params: {
|
||||
index: {
|
||||
type: 'Number',
|
||||
description: 'index of array to write to'
|
||||
},
|
||||
value: {
|
||||
type: getType(dataType),
|
||||
description: 'the value to set the element found at the given index of the array'
|
||||
}
|
||||
},
|
||||
return: {}
|
||||
};
|
||||
});
|
||||
var pointerDataTypeMap = _.reduce(_.map(_.values(xml2js.POINTER_TYPEMAPS), _.invert), function(memo, typemap) {
|
||||
return _.extend(memo, typemap);
|
||||
}, {});
|
||||
_.each(pointerTypes, function(pointerType) {
|
||||
var dataType = pointerDataTypeMap[pointerType];
|
||||
xml2js.CLASSES[pointerType] = {
|
||||
description: 'Proxy object to data of type ' + dataType + '.',
|
||||
enums: {},
|
||||
enums_by_group: {},
|
||||
variables: {},
|
||||
methods: {}
|
||||
};
|
||||
xml2js.CLASSES[pointerType].methods[pointerType] = {
|
||||
description: 'Instantiates the proxy object.',
|
||||
params: {},
|
||||
return: {}
|
||||
};
|
||||
xml2js.CLASSES[pointerType].methods.value = {
|
||||
description: 'Get the value of the object.',
|
||||
params: {},
|
||||
return: {
|
||||
type: getType(dataType),
|
||||
description: 'the value of the object'
|
||||
}
|
||||
};
|
||||
xml2js.CLASSES[pointerType].methods.assign = {
|
||||
description: 'Set the value of the object.',
|
||||
params: {
|
||||
value: {
|
||||
type: getType(dataType),
|
||||
description: 'the value to set the object to'
|
||||
}
|
||||
},
|
||||
return: {}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// override autogenerated methods with custom configuration
|
||||
function customizeMethods(custom) {
|
||||
_.each(custom, function(classMethods, className) {
|
||||
_.extend(xml2js.CLASSES[className].methods, _.pick(classMethods, function(methodSpec, methodName) {
|
||||
return isValidMethodSpec(methodSpec, className + '.' + methodName);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// make sure methods have valid types, otherwise warn (& don't include if strict)
|
||||
function validateMethods() {
|
||||
xml2js.METHODS = _.pick(xml2js.METHODS, function(methodSpec, methodName) {
|
||||
return hasValidTypes(methodSpec, methodName);
|
||||
});
|
||||
_.each(xml2js.CLASSES, function(classSpec, className) {
|
||||
var valid = _.pick(classSpec.methods, function(methodSpec, methodName) {
|
||||
return hasValidTypes(methodSpec, className + '.' + methodName, className);
|
||||
});
|
||||
if (xml2js.opts.strict) {
|
||||
xml2js.CLASSES[className].methods = valid;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// make sure variables have valid types, otherwise warn (& don't include if strict)
|
||||
function validateVars() {
|
||||
_.each(xml2js.CLASSES, function(classSpec, className) {
|
||||
var valid = _.pick(classSpec.variables, function(varSpec, varName) {
|
||||
return ofValidType(varSpec, className + '.' + varName, className);
|
||||
});
|
||||
if (xml2js.opts.strict) {
|
||||
xml2js.CLASSES[className].variables = valid;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// verify that the json spec is well formatted
|
||||
function isValidMethodSpec(methodSpec, methodName) {
|
||||
var valid = true;
|
||||
var printIgnoredMethodOnce = _.once(function() { console.log(methodName + ' from ' + path.basename(xml2js.opts.custom) + ' is omitted from JS documentation.'); });
|
||||
function checkRule(rule, errMsg) {
|
||||
if (!rule) {
|
||||
printIgnoredMethodOnce();
|
||||
console.log(' ' + errMsg);
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
checkRule(_.has(methodSpec, 'description'), 'no description given');
|
||||
checkRule(_.has(methodSpec, 'params'), 'no params given (specify "params": {} for no params)');
|
||||
_.each(methodSpec.params, function(paramSpec, paramName) {
|
||||
checkRule(_.has(paramSpec, 'type'), 'no type given for param ' + paramName);
|
||||
checkRule(_.has(paramSpec, 'description'), 'no description given for param ' + paramName);
|
||||
});
|
||||
checkRule(_.has(methodSpec, 'return'), 'no return given (specify "return": {} for no return value)');
|
||||
checkRule(_.has(methodSpec.return, 'type'), 'no type given for return value');
|
||||
checkRule(_.has(methodSpec.return, 'description'), 'no description given for return value');
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
// get enum specifications
|
||||
function getEnums(spec_c, bygroup, parent) {
|
||||
var spec_js = {};
|
||||
var enumGroups = _.find(getChildren(spec_c, 'sectiondef'), function(section) {
|
||||
var kind = getAttr(section, 'kind');
|
||||
return ((kind == 'enum') || (kind == 'public-type'));
|
||||
});
|
||||
if (enumGroups) {
|
||||
_.each(enumGroups.children, function(enumGroup) {
|
||||
var enumGroupName = getText(getChild(enumGroup, 'name'), 'name');
|
||||
var enumGroupDescription = getText(getChild(enumGroup, 'detaileddescription'), 'description');
|
||||
var enumGroupVals = getChildren(enumGroup, 'enumvalue');
|
||||
if (bygroup) {
|
||||
spec_js[enumGroupName] = {
|
||||
description: enumGroupDescription,
|
||||
members: []
|
||||
};
|
||||
}
|
||||
_.each(enumGroupVals, function(e) {
|
||||
// TODO: get prefix as option
|
||||
var enumName = getText(getChild(e, 'name'), 'name').replace(/^MRAA_/, '');
|
||||
var enumDescription = getText(getChild(e, 'detaileddescription'), 'description');
|
||||
if (!bygroup) {
|
||||
spec_js[enumName] = {
|
||||
type: enumGroupName,
|
||||
description: enumDescription
|
||||
};
|
||||
} else {
|
||||
spec_js[enumGroupName].members.push(enumName);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return spec_js;
|
||||
}
|
||||
|
||||
|
||||
// get the name for the module/group/class
|
||||
function getName(spec_c) {
|
||||
return getText(getChild(spec_c, 'compoundname'), 'name').replace(xml2js.opts.module + '::', '');
|
||||
}
|
||||
|
||||
|
||||
// get the description for the module/group/class
|
||||
function getDescription(spec_c) {
|
||||
return getText(getChild(spec_c, 'detaileddescription'), 'description');
|
||||
}
|
||||
|
||||
|
||||
// get the classes (xml file names) for the given module
|
||||
function getSubclasses(spec_c) {
|
||||
return _.map(getChildren(spec_c, 'innerclass'), function(innerclass) {
|
||||
return getAttr(innerclass, 'refid');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// get the classes (class names) for the given module
|
||||
function getSubclassNames(spec_c) {
|
||||
return _.map(getChildren(spec_c, 'innerclass'), function(innerclass) {
|
||||
return getText(innerclass).replace(xml2js.opts.module + '::', '');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// get the submodules (xml file names) for the given module
|
||||
function getSubmodules(spec_c) {
|
||||
return _.map(getChildren(spec_c, 'innergroup'), function(innergroup) {
|
||||
return getAttr(innergroup, 'refid');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function hasParams(paramsSpec) {
|
||||
return !(_.isEmpty(paramsSpec) ||
|
||||
((_.size(paramsSpec) == 1) && getText(getChild(paramsSpec[0], 'type')) == 'void'));
|
||||
}
|
||||
|
||||
|
||||
// get method specifications for top-level module or a given class
|
||||
// TODO: overloaded functions
|
||||
// TODO: functions w/ invalid parameter(s)/return
|
||||
function getMethods(spec_c, parent) {
|
||||
var spec_js = {};
|
||||
var methods = _.find(getChildren(spec_c, 'sectiondef'), function(section) {
|
||||
var kind = getAttr(section, 'kind');
|
||||
return ((kind == 'public-func') || (kind == 'func'));
|
||||
});
|
||||
if (methods) {
|
||||
_.each(methods.children, function(method) {
|
||||
var methodName = getText(getChild(method, 'name'), 'name');
|
||||
if (methodName[0] != '~') { // filter out destructors
|
||||
try {
|
||||
var description = getChild(method, 'detaileddescription');
|
||||
var methodDescription = getText(description, 'description');
|
||||
var paramsSpec = getChildren(method, 'param');
|
||||
var params = {};
|
||||
if (hasParams(paramsSpec)) {
|
||||
params = getParams(paramsSpec, getParamsDetails(description), methodName, parent);
|
||||
}
|
||||
var returnSpec = getChild(method, 'type');
|
||||
var retval = {};
|
||||
if (!_.isEmpty(returnSpec)) {
|
||||
retval = getReturn(returnSpec, getReturnDetails(description), methodName, parent);
|
||||
}
|
||||
spec_js[methodName] = {
|
||||
description: methodDescription,
|
||||
params: params,
|
||||
return: retval
|
||||
};
|
||||
} catch(e) {
|
||||
console.log((parent ? (parent + '.') : '') + methodName + ' is omitted from JS documentation.');
|
||||
console.log(' ' + e.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return spec_js;
|
||||
}
|
||||
|
||||
|
||||
// get variable specifications for a class
|
||||
function getVariables(spec_c, parent) {
|
||||
var spec_js = {};
|
||||
var vars = _.find(getChildren(spec_c, 'sectiondef'), function(section) {
|
||||
var kind = getAttr(section, 'kind');
|
||||
return (kind == 'public-attrib');
|
||||
});
|
||||
if (vars) {
|
||||
_.each(_.filter(vars.children, function(variable) {
|
||||
return (getAttr(variable, 'kind') == 'variable');
|
||||
}), function(variable) {
|
||||
var varName = getText(getChild(variable, 'name'), 'name');
|
||||
var varType = getType(getText(getChild(variable, 'type')), parent);
|
||||
var varDescription = getText(getChild(variable, 'detaileddescription'));
|
||||
spec_js[varName] = {
|
||||
type: varType,
|
||||
description: varDescription
|
||||
}
|
||||
});
|
||||
}
|
||||
return spec_js;
|
||||
}
|
||||
|
||||
|
||||
// get return value specs of a method
|
||||
function getReturn(spec_c, details, method, parent) {
|
||||
var retType = getType(getText(spec_c, 'type'), parent);
|
||||
var retDescription = (details ? getText(details, 'description') : '');
|
||||
return ((retType == 'void') ? {} : {
|
||||
type: retType,
|
||||
description: retDescription
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// get paramater specs of a method
|
||||
function getParams(spec_c, details, method, parent) {
|
||||
var spec_js = {};
|
||||
_.each(spec_c, function(param) {
|
||||
try {
|
||||
var paramType = getType(getText(getChild(param, 'type'), 'type'), parent);
|
||||
var paramName = getText(getChild(param, 'declname'), 'name');
|
||||
spec_js[paramName] = { type: paramType };
|
||||
} catch(e) {
|
||||
if (paramType == '...') {
|
||||
spec_js['arguments'] = { type: paramType };
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
});
|
||||
_.each(details, function(param) {
|
||||
var getParamName = function(p) { return getText(getChild(getChild(p, 'parameternamelist'), 'parametername'), 'name'); }
|
||||
var paramName = getParamName(param);
|
||||
var paramDescription = getText(getChild(param, 'parameterdescription'), 'description');
|
||||
if (_.has(spec_js, paramName)) {
|
||||
spec_js[paramName].description = paramDescription;
|
||||
} else {
|
||||
var msg = ' has documentation for an unknown parameter: ' + paramName + '. ';
|
||||
var suggestions = _.difference(_.keys(spec_js), _.map(details, getParamName));
|
||||
var msgAddendum = (!_.isEmpty(suggestions) ? ('Did you mean ' + suggestions.join(', or ') + '?') : '');
|
||||
console.log('Warning: ' + (parent ? (parent + '.') : '') + method + msg + msgAddendum);
|
||||
}
|
||||
});
|
||||
return spec_js;
|
||||
}
|
||||
|
||||
|
||||
// get the equivalent javascript type from the given c type
|
||||
function getType(type_c, parent) {
|
||||
var type_js = type_c;
|
||||
_.find(xml2js.TYPEMAPS, function(to, from) {
|
||||
var pattern = new RegExp(from, 'i');
|
||||
if (type_c.search(pattern) == 0) {
|
||||
type_js = to;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (isPointer(type_js)) {
|
||||
var dataType = getPointerDataType(type_js);
|
||||
var className = parent.toLowerCase();
|
||||
if (_.has(xml2js.ARRAY_TYPEMAPS, dataType) && _.contains(xml2js.ARRAY_TYPEMAPS[dataType].classes, className)) {
|
||||
type_js = xml2js.ARRAY_TYPEMAPS[dataType].arrayType;
|
||||
} else if (_.has(xml2js.POINTER_TYPEMAPS, className) && _.has(xml2js.POINTER_TYPEMAPS[className], dataType)) {
|
||||
type_js = xml2js.POINTER_TYPEMAPS[className][dataType];
|
||||
} else if (_.has(xml2js.CLASSES, dataType)) { // TODO: verify that swig does this mapping
|
||||
type_js = dataType;
|
||||
} else {
|
||||
type_js = dataType + ' *'
|
||||
}
|
||||
}
|
||||
return type_js;
|
||||
}
|
||||
|
||||
|
||||
// verify that all types associated with the method are valid
|
||||
function hasValidTypes(methodSpec, methodName, parent) {
|
||||
var valid = true;
|
||||
var msg = (xml2js.opts.strict ? ' is omitted from JS documentation.' : ' has invalid type(s).');
|
||||
var printIgnoredMethodOnce = _.once(function() { console.log(methodName + msg); });
|
||||
_.each(methodSpec.params, function(paramSpec, paramName) {
|
||||
if (!isValidType(paramSpec.type, parent)) {
|
||||
valid = false;
|
||||
printIgnoredMethodOnce();
|
||||
console.log(' Error: parameter ' + paramName + ' has invalid type ' + typeToString(paramSpec.type));
|
||||
}
|
||||
});
|
||||
if (!_.isEmpty(methodSpec.return) && !isValidType(methodSpec.return.type, parent)) {
|
||||
valid = false;
|
||||
printIgnoredMethodOnce();
|
||||
console.log(' Error: returns invalid type ' + typeToString(methodSpec.return.type));
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
// verify that type of variable is valid
|
||||
function ofValidType(varSpec, varName, parent) {
|
||||
if (isValidType(varSpec.type, parent)) {
|
||||
return true;
|
||||
} else {
|
||||
var msgAddendum = (xml2js.opts.strict ? ' Omitted from JS documentation.' : '');
|
||||
console.log('Error: ' + varName + ' is of invalid type ' + typeToString(varSpec.type) + '.' + msgAddendum);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// verify whether the given type is valid JS
|
||||
function isValidType(type, parent) {
|
||||
return (_.contains(_.values(xml2js.TYPEMAPS), type) ||
|
||||
_.has(xml2js.CLASSES, type) ||
|
||||
_.has(xml2js.ENUMS_BY_GROUP, type) ||
|
||||
_.contains(['Buffer', 'Function', 'mraa_result_t'], type) ||
|
||||
_.has((parent ? xml2js.CLASSES[parent].enums_by_group : []), type) ||
|
||||
isValidPointerType(type, parent));
|
||||
}
|
||||
|
||||
|
||||
function isValidPointerType(type, parent) {
|
||||
var className = parent.toLowerCase();
|
||||
var arrayTypemap = _.find(xml2js.ARRAY_TYPEMAPS, function(to) { return to.arrayType == type; });
|
||||
var valid = ((arrayTypemap && _.contains(arrayTypemap.classes, className)) ||
|
||||
(_.has(xml2js.POINTER_TYPEMAPS, className) && (_.contains(_.values(xml2js.POINTER_TYPEMAPS[className]), type))));
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
// determines whether a type looks like a c pointer
|
||||
function isPointer(type) {
|
||||
return (type.search(/\w+\s*(\*|&)$/) != -1);
|
||||
}
|
||||
|
||||
|
||||
// remove extraneous whitespace from pointer types as canonical representation
|
||||
function normalizePointer(ptr) {
|
||||
return ptr.replace(/\s*$/, '');
|
||||
}
|
||||
|
||||
|
||||
// get the data type of a pointer (e.g. int is the data type of int*)
|
||||
function getPointerDataType(ptr) {
|
||||
return ptr.replace(/\s*(\*|&)$/, '');
|
||||
}
|
||||
|
||||
|
||||
// print more human friendly type for error messages
|
||||
function typeToString(type) {
|
||||
return type.replace('*', '*');
|
||||
}
|
||||
|
||||
|
||||
// get the detailed description of a method's parameters
|
||||
function getParamsDetails(spec_c) {
|
||||
var paras = getChildren(spec_c, 'para');
|
||||
var details = _.find(_.map(paras, function(para) {
|
||||
return getChild(para, 'parameterlist');
|
||||
}), function(obj) { return (obj != undefined); });
|
||||
return (details ? details.children : undefined);
|
||||
}
|
||||
|
||||
|
||||
// get the detailed description of a method's return value
|
||||
function getReturnDetails(spec_c) {
|
||||
var paras = getChildren(spec_c, 'para');
|
||||
return _.find(_.map(paras, function(para) {
|
||||
return getChild(para, 'simplesect');
|
||||
}), function(obj) { return ((obj != undefined) && (getAttr(obj, 'kind') == 'return')); });
|
||||
}
|
||||
|
||||
|
||||
// get (and flatten) the text of the given object
|
||||
function getText(obj, why) {
|
||||
// TODO: links ignored for now, patched for types for
|
||||
var GENERATE_LINK = function(x) { return x + ' '; }
|
||||
return _.reduce(obj.children, function(text, elem) {
|
||||
if (_.isString(elem)) {
|
||||
return text += elem.trim() + ' ';
|
||||
} else if (_.isPlainObject(elem)) {
|
||||
switch(elem.name) {
|
||||
case 'para':
|
||||
return text += getText(elem, why) + ' \n';
|
||||
case 'ref':
|
||||
return text += GENERATE_LINK(getText(elem, why));
|
||||
case 'parameterlist':
|
||||
case 'simplesect':
|
||||
return text; // to be handled elsewhere
|
||||
case 'programlisting':
|
||||
case 'htmlonly':
|
||||
return text; // ignored
|
||||
// TODO: html doesn't seem to work for yuidoc, using markdown for now
|
||||
case 'itemizedlist':
|
||||
return text += '\n' + getText(elem, why) + ' \n \n';
|
||||
case 'listitem':
|
||||
return text += '+ ' + getText(elem, why) + '\n';
|
||||
case 'bold':
|
||||
return text += '__' + getText(elem, why).trim() + '__ ';
|
||||
case 'ulink':
|
||||
return text += '[' + getText(elem, why).trim() + '](' + getAttr(elem, 'url').trim() + ') ';
|
||||
case 'image':
|
||||
// TODO: copy images over; hard coded for now
|
||||
var fn = getAttr(elem, 'name');
|
||||
return text += ' \n \n ';
|
||||
case 'linebreak':
|
||||
return text += ' \n';
|
||||
case 'ndash':
|
||||
return text += '– ';
|
||||
default:
|
||||
// TODO: incomplete list of doxygen xsd implemented
|
||||
console.warn('NYI Unknown Object Type: ' + elem.name);
|
||||
return text;
|
||||
//throw new Error('NYI Unknown Object Type: ' + elem.name);
|
||||
}
|
||||
} else {
|
||||
throw new Error('NYI Unknown Type: ' + (typeof elem));
|
||||
}
|
||||
}, '').trim();
|
||||
}
|
||||
|
||||
|
||||
// get the value of attribute with the given name of the given object
|
||||
function getAttr(obj, name) {
|
||||
return _.find(obj.attr, function(item) {
|
||||
return item.name == name;
|
||||
}).value;
|
||||
}
|
||||
|
||||
|
||||
// get the child object with the given name of the given object
|
||||
function getChild(obj, name) {
|
||||
return _.find(obj.children, function(child) {
|
||||
return child.name == name;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// get all children objects with the given name of the given object
|
||||
function getChildren(obj, name) {
|
||||
return _.filter(obj.children, function(child) {
|
||||
return child.name == name;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// debug helper: print untruncated object
|
||||
function printObj(obj) {
|
||||
console.log(util.inspect(obj, false, null));
|
||||
}
|
||||
|
||||
|
||||
module.exports = xml2js;
|
@ -114,6 +114,14 @@ add_executable (zfm20-register-example zfm20-register.cxx)
|
||||
add_executable (uln200xa-example uln200xa.cxx)
|
||||
add_executable (grovewfs-example grovewfs.cxx)
|
||||
add_executable (isd1820-example isd1820.cxx)
|
||||
add_executable (sx6119-example sx6119.cxx)
|
||||
add_executable (si114x-example si114x.cxx)
|
||||
add_executable (maxsonarez-example maxsonarez.cxx)
|
||||
add_executable (hm11-example hm11.cxx)
|
||||
add_executable (ht9170-example ht9170.cxx)
|
||||
add_executable (h3lis331dl-example h3lis331dl.cxx)
|
||||
add_executable (ad8232-example ad8232.cxx)
|
||||
add_executable (grovescam-example grovescam.cxx)
|
||||
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/hmc5883l)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/grove)
|
||||
@ -206,6 +214,14 @@ include_directories (${PROJECT_SOURCE_DIR}/src/zfm20)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/uln200xa)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/grovewfs)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/isd1820)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/sx6119)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/si114x)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/maxsonarez)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/hm11)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/ht9170)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/h3lis331dl)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/ad8232)
|
||||
include_directories (${PROJECT_SOURCE_DIR}/src/grovescam)
|
||||
|
||||
target_link_libraries (hmc5883l-example hmc5883l ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (groveled-example grove ${CMAKE_THREAD_LIBS_INIT})
|
||||
@ -321,3 +337,11 @@ target_link_libraries (zfm20-register-example zfm20 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (uln200xa-example uln200xa ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovewfs-example grovewfs ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (isd1820-example isd1820 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (sx6119-example sx6119 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (si114x-example si114x ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (maxsonarez-example maxsonarez ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (hm11-example hm11 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (ht9170-example ht9170 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (h3lis331dl-example h3lis331dl ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (ad8232-example ad8232 ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (grovescam-example grovescam ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
65
examples/c++/ad8232.cxx
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.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.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include "ad8232.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate a Ad8232 sensor on digital pins 10 (LO+), 11 (LO-)
|
||||
// and an analog pin, 0 (OUTPUT)
|
||||
upm::AD8232 *ad8232 = new upm::AD8232(10, 11, 0);
|
||||
|
||||
// Output the raw numbers from the ADC, for plotting elsewhere.
|
||||
// A return of 0 indicates a Lead Off (LO) condition.
|
||||
// In theory, this data could be fed to software like Processing
|
||||
// (https://www.processing.org/) to plot the data just like an
|
||||
// EKG you would see in a hospital.
|
||||
while (shouldRun)
|
||||
{
|
||||
cout << ad8232->value() << endl;
|
||||
usleep(1000);
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting" << endl;
|
||||
|
||||
delete ad8232;
|
||||
return 0;
|
||||
}
|
77
examples/c++/grovescam.cxx
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.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.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include "grovescam.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace upm;
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
//! [Interesting]
|
||||
|
||||
// Instantiate a Grove Serial Camera on UART 0
|
||||
upm::GROVESCAM* camera = new upm::GROVESCAM(0);
|
||||
|
||||
// make sure port is initialized properly. 115200 baud is the default.
|
||||
if (!camera->setupTty())
|
||||
{
|
||||
cerr << "Failed to setup tty port parameters" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (camera->init())
|
||||
cout << "Initialized..." << endl;
|
||||
else
|
||||
cout << "init() failed" << endl;
|
||||
|
||||
if (camera->preCapture())
|
||||
cout << "preCapture succeeded..." << endl;
|
||||
else
|
||||
cout << "preCapture failed." << endl;
|
||||
|
||||
if (camera->doCapture())
|
||||
cout << "doCapture succeeded..." << endl;
|
||||
else
|
||||
cout << "doCapture failed." << endl;
|
||||
|
||||
cout << "Image size is " << camera->getImageSize() << " bytes" << endl;
|
||||
|
||||
if (camera->getImageSize() > 0)
|
||||
{
|
||||
cout << "Storing image.jpg..." << endl;
|
||||
if (camera->storeImage("image.jpg"))
|
||||
cout << "storeImage succeeded..." << endl;
|
||||
else
|
||||
cout << "storeImage failed." << endl;
|
||||
}
|
||||
//! [Interesting]
|
||||
|
||||
delete camera;
|
||||
return 0;
|
||||
}
|
80
examples/c++/h3lis331dl.cxx
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Author: Jon Trulson <jtrulson@ics.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.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <iostream>
|
||||
#include "h3lis331dl.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace upm;
|
||||
|
||||
int shouldRun = true;
|
||||
|
||||
void sig_handler(int signo)
|
||||
{
|
||||
if (signo == SIGINT)
|
||||
shouldRun = false;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
signal(SIGINT, sig_handler);
|
||||
|
||||
//! [Interesting]
|
||||
// Instantiate an H3LIS331DL on I2C bus 0
|
||||
|
||||
upm::H3LIS331DL *accel = new upm::H3LIS331DL(H3LIS331DL_I2C_BUS,
|
||||
H3LIS331DL_DEFAULT_I2C_ADDR);
|
||||
|
||||
// Initialize the device with default values
|
||||
accel->init();
|
||||
|
||||
while (shouldRun)
|
||||
{
|
||||
int x, y, z;
|
||||
float ax, ay, az;
|
||||
|
||||
accel->update();
|
||||
|
||||
accel->getRawXYZ(&x, &y, &z);
|
||||
accel->getAcceleration(&ax, &ay, &az);
|
||||
|
||||
cout << "Raw: X = " << x << " Y = " << y << " Z = " << z << endl;
|
||||
|
||||
cout << "Acceleration: AX = " << ax << " AY = " << ay << " AZ = " << az
|
||||
<< endl;
|
||||
|
||||
cout << endl;
|
||||
|
||||
usleep(500000);
|
||||
}
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete accel;
|
||||
return 0;
|
||||
}
|