SDK for consuming Botlink XRD (eXtended Range Datalink) services for drones.
This package is not currently published to the NPM registry, so you'll need to add it to your project using a slightly different syntax than normal.
yarn add git+https://github.com/botlink/botlink-xrd-sdk.git#semver:^0.3.1
or
npm install --save git+https://github.com/botlink/botlink-xrd-sdk.git#semver:^0.3.1
The version identifier is optional if you would always like to use the latest release.
This package contains TypeScript code that needs to be compiled and C++ code which may or may not need to be compiled.
The following directions assume yarn is installed.
This package uses a Node.js native addon written in C++ to provide bindings to the Botlink C++ Client Library that is included in the Botlink C++ SDK.
If using a tagged version of this package, a prebuilt release of the C++ code may be available. To download the prebuilt release, simply run the command yarn
.
If a prebuilt release is not available, yarn
falls back to compiling the C++ code. See the next section.
If a prebuilt release is not available, when yarn
runs, yarn
instead downloads a release of the Botlink C++ SDK (if available), and then builds the C++ Node.js bindings using node-gyp. Please refer to the node-gyp page for dependencies required to build C++ code.
If a release of the Botlink C++ SDK is not available for your platform and/or architecture, then building the C++ Node.js bindings is not possible.
If you already have a local copy of the Botlink C++ SDK and desire to use this SDK, set the environment variable BOTLINKSDK_DIR
to the location of the SDK and then run yarn
. When the BOTLINKSDK_DIR
environment variable is set, yarn
skips trying to download a release of the Botlink C++ SDK and uses the SDK pointed to by BOTLINKSDK_DIR
instead.
If you desire to force recompilation of the C++ bindings (e.g., you do not want to use a prebuilt release of the C++ bindings), run yarn rebuild-bindings
.
To publish a build of the C++ bindings, follow the directions in the S3 Hosting section of the node-pre-gyp readme.
Run yarn build
to compile the TypeScript. The resulting JavaScript code is found in dist/
.
See src/napi/lib/binding.ts
for the TypeScript API.
TypeDoc API documentation can be viewed at https://botlink.github.io/botlink-xrd-sdk/typedoc/index.html.
To use botlink-xrd-sdk in a TypeScript project, import src/napi/lib/binding.ts
. To use in a JavaScript project, build compile the TypeScript code as described above, and import dist/src/napi/lib/binding.js
.
The SDK includes TypeDoc documentation.
To build the TypeDoc documentation, run yarn build-typedoc
. Note that this
deletes the dist/
folder as for some reason TypeDoc does not like to run if
dist/
exists. The resulting TypeDoc documentation is in docs/
. It can be
viewed by opening docs/index.html
in a web browser.
To update the TypeDoc documentation hosted at https://botlink.github.io/botlink-xrd-sdk do the following:
- Follow the steps under "Building"
- Make sure the
botlink-xrd-sdk-gh-pages
submodule is up to dategit submodule update --init --recursive
cd botlink-xrd-sdk-gh-pages
git fetch
git checkout -b gh-pages origin/gh-pages
orgit merge --ff-only origin/gh-pages
if a local branch already exists and is checked out
- Update the TypeDoc documentation in
botlink-xrd-sdk-gh-pages
cd botlink-xrd-sdk-gh-pages
git rm -r typedoc
mv ../docs ./typedoc
git add typedoc
git commit
and write an appropriate commit messagegit push origin gh-pages
- The changes to the TypeDoc hosted at https://botlink.github.io/botlink-xrd-sdk should be visible now