-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f847e30
Showing
23 changed files
with
6,907 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
insert_final_newline = false | ||
trim_trailing_whitespace = false | ||
|
||
[*.{js,json,ts,mts,yml,yaml}] | ||
indent_size = 2 | ||
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/**/*.js | ||
dist/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"env": { | ||
"browser": false, | ||
"es6": true, | ||
"node": true | ||
}, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "tsconfig.json", | ||
"sourceType": "module", | ||
"ecmaVersion": 2020 | ||
}, | ||
"plugins": ["@typescript-eslint", "jest"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:jest/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
// The following rule is enabled only to supplement the inline suppression | ||
// examples, and because it is not a recommended rule, you should either | ||
// disable it, or understand what it enforces. | ||
// https://typescript-eslint.io/rules/explicit-function-return-type/ | ||
"@typescript-eslint/explicit-function-return-type": "warn", | ||
"@typescript-eslint/no-unused-vars": "warn" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# These are supported funding model platforms | ||
|
||
github: [datagutt] | ||
patreon: # Replace with a single Patreon username | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: # Replace with a single Ko-fi username | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # Replace with a single Liberapay username | ||
issuehunt: # Replace with a single IssueHunt username | ||
otechie: # Replace with a single Otechie username | ||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Node.js CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: volta-cli/action@v4 | ||
- uses: pnpm/action-setup@v4 | ||
name: Install pnpm | ||
with: | ||
version: 9.5.0 | ||
run_install: false | ||
- run: pnpm i | ||
- run: pnpm run lint | ||
- run: pnpm test | ||
- run: pnpm run build | ||
env: | ||
CI: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Release package | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: volta-cli/action@v4 | ||
|
||
- uses: pnpm/action-setup@v4 | ||
name: Install pnpm | ||
with: | ||
version: 9.5.0 | ||
run_install: false | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: pnpm | ||
registry-url: https://registry.npmjs.org | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Build 🏗 | ||
run: pnpm build | ||
|
||
- name: Publish 🚀 | ||
shell: bash | ||
run: pnpm publish --access public --no-git-checks | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Dependencies | ||
node_modules/ | ||
|
||
# Coverage | ||
coverage | ||
|
||
# Transpiled files | ||
dist/ | ||
|
||
# VS Code | ||
.vscode | ||
!.vscode/tasks.js | ||
|
||
# JetBrains IDEs | ||
.idea/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Misc | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.mts"], | ||
"options": { | ||
"parser": "typescript" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Thomas Lekanger | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# node-osmo | ||
|
||
Typescript library for controlling DJI Osmo Action 3, Action 4 and Pocket 3 using BLE (Bluetooth Low Energy) | ||
|
||
Features: | ||
|
||
- [x] Pairing | ||
- [x] Connecting to Wi-Fi | ||
- [x] Selecting resolution, FPS, bitrate and stabilizer mode | ||
- [x] Going live to a specified RTMP server | ||
- [x] Getting battery percentage | ||
|
||
## Getting Started | ||
|
||
This project is intended to be used with the latest Active LTS release of Node.js. | ||
|
||
## Available Scripts | ||
|
||
- `clean` - remove coverage data, Jest cache and transpiled files, | ||
- `prebuild` - lint source files and tests before building, | ||
- `build` - transpile TypeScript to ES6, | ||
- `build:watch` - interactive watch mode to automatically transpile source files, | ||
- `lint` - lint source files and tests, | ||
- `prettier` - reformat files, | ||
- `test` - run tests, | ||
- `test:watch` - interactive watch mode to automatically re-run tests | ||
|
||
## Thanks | ||
This library would not be possible without these great people and projects: | ||
|
||
- [Spillmaker](https://github.com/spillmaker) - Initial reverse-engineering of the protocol | ||
- [Moblin](https://github.com/eerimoq/moblin) - Implementation was highly inspired from this project | ||
|
||
## License | ||
|
||
Licensed under the MIT License. See the [LICENSE](https://github.com/datagutt/node-osmo/blob/main/LICENSE) file for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { | ||
DjiDevice, | ||
djiDeviceBitrates, | ||
DjiDeviceImageStabilization, | ||
DjiDeviceModel, | ||
DjiDeviceResolution, | ||
} from './dist/index.js'; | ||
|
||
/* | ||
import { DjiDeviceScanner, DjiDiscoveredDevice } from './dist/index.js'; | ||
const { shared: scanner } = DjiDeviceScanner; | ||
console.log('Starting DJI device scanner...'); | ||
scanner.startScanningForDevices(); | ||
scanner.on( | ||
'deviceDiscovered', | ||
async ({ peripheral, model, modelName }: DjiDiscoveredDevice) => { | ||
const device = new DjiDevice(); | ||
console.log('Discovered device:', device, peripheral, model, modelName); | ||
}, | ||
); | ||
scanner.stopScanningForDevices(); | ||
*/ | ||
|
||
const device = new DjiDevice('id-of-device', DjiDeviceModel.osmoAction4); | ||
console.log('Discovered device:', peripheral); | ||
await device.startLiveStream( | ||
'Wi-Fi-Name', // wi-fi name | ||
'Wi-Fi-Password', // wi-fi password | ||
'rtmp://1.3.3.7:1935/live/rtmp', // rtmp url | ||
DjiDeviceResolution.r1080p, // resolution | ||
30, | ||
djiDeviceBitrates[djiDeviceBitrates.length - 1], // bitrate | ||
DjiDeviceImageStabilization.RockSteadyPlus, // stabilization mode | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export default { | ||
testEnvironment: 'node', | ||
preset: 'ts-jest/presets/default-esm', | ||
transform: { | ||
'^.+\\.m?[tj]s?$': ['ts-jest', { useESM: true }], | ||
}, | ||
moduleNameMapper: { | ||
'^(\\.{1,2}/.*)\\.(m)?js$': '$1', | ||
}, | ||
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(m)?ts$', | ||
coverageDirectory: 'coverage', | ||
collectCoverageFrom: [ | ||
'src/**/*.ts', | ||
'src/**/*.mts', | ||
'!src/**/*.d.ts', | ||
'!src/**/*.d.mts', | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"name": "node-osmo", | ||
"version": "0.0.0", | ||
"description": "Typescript library for controlling DJI Osmo Action 4 and Pocket 3 using BLE (Bluetooth Low Energy)", | ||
"type": "module", | ||
"source": "./src", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"engines": { | ||
"node": ">= 20.9" | ||
}, | ||
"files": [ | ||
"dist", | ||
"README.md" | ||
], | ||
"devDependencies": { | ||
"@types/jest": "~29.5", | ||
"@types/node": "~20", | ||
"@typescript-eslint/eslint-plugin": "~7.6", | ||
"@typescript-eslint/parser": "~7.6", | ||
"eslint": "~8.56", | ||
"eslint-config-prettier": "~9.1", | ||
"eslint-plugin-jest": "~28.2", | ||
"jest": "~29.7", | ||
"prettier": "~3.2", | ||
"rimraf": "~5.0", | ||
"ts-api-utils": "~1.3", | ||
"ts-jest": "~29.1", | ||
"typescript": "~5.4" | ||
}, | ||
"scripts": { | ||
"start": "node demo.js", | ||
"clean": "rimraf coverage build tmp", | ||
"prebuild": "npm run lint", | ||
"build": "tsc -p tsconfig.json", | ||
"build:watch": "tsc -w -p tsconfig.json", | ||
"build:release": "npm run clean && tsc -p tsconfig.release.json", | ||
"lint": "eslint . --ext .ts --ext .mts", | ||
"test": "jest --coverage", | ||
"prettier": "prettier --config .prettierrc --write .", | ||
"test:watch": "jest --watch" | ||
}, | ||
"author": "Thomas Lekanger <[email protected]>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"tslib": "~2.6", | ||
"crc-full": "1.1.0", | ||
"@abandonware/noble": "^1.9.2-25", | ||
"bytebuf": "^1.2.0", | ||
"node-osmo": "file:./" | ||
}, | ||
"volta": { | ||
"node": "20.15.1", | ||
"pnpm": "9.5.0" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
Oops, something went wrong.