Skip to content

Commit

Permalink
feat: rewrite (#28)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: complete rewrite
  • Loading branch information
patrickmichalina authored Oct 2, 2019
1 parent c72be2a commit 986bfb0
Show file tree
Hide file tree
Showing 31 changed files with 7,860 additions and 2,936 deletions.
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.4.0
12.11.0
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.4.0
12.11.0
56 changes: 26 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,57 @@
<h1 align="center" style="border-bottom: none;">onvif-probe-rx</h1>
<h3 align="center">Continous monitoring of ONVIF IP cameras.</h3>
<h1 align="center" style="border-bottom: none;">camera-probe</h1>
<h3 align="center">Realtime scanning and discovery of networked cameras.</h3>
<p align="center">
<a href="https://circleci.com/gh/patrickmichalina/onvif-probe-rx">
<img alt="circeci" src="https://circleci.com/gh/patrickmichalina/onvif-probe-rx.svg?style=shield">
<a href="https://circleci.com/gh/patrickmichalina/camera-probe">
<img alt="circeci" src="https://circleci.com/gh/patrickmichalina/camera-probe.svg?style=shield">
</a>
<!-- <a href="https://codeclimate.com/github/patrickmichalina/onvif-probe-rx/test_coverage">
<a href="https://codeclimate.com/github/patrickmichalina/camera-probe/test_coverage">
<img src="https://api.codeclimate.com/v1/badges/f40c9fff2927e49c3ea2/test_coverage" />
</a>
<a href="https://codeclimate.com/github/patrickmichalina/onvif-probe-rx/maintainability">
<a href="https://codeclimate.com/github/patrickmichalina/camera-probe/maintainability">
<img alt="codeclimate" src="https://api.codeclimate.com/v1/badges/f40c9fff2927e49c3ea2/maintainability">
</a> -->
</a>
</p>
<p align="center">
<a href="https://greenkeeper.io">
<img alt="greenkeeper" src="https://badges.greenkeeper.io/semantic-release/semantic-release.svg">
</a>
<a href="https://david-dm.org/patrickmichalina/onvif-probe-rx">
<img alt="greenkeeper" src="https://david-dm.org/patrickmichalina/onvif-probe-rx/status.svg">
<a href="https://david-dm.org/patrickmichalina/camera-probe">
<img alt="greenkeeper" src="https://david-dm.org/patrickmichalina/camera-probe/status.svg">
</a>
<a href="https://david-dm.org/patrickmichalina/onvif-probe-rx?type=dev">
<img alt="greenkeeper" src="https://david-dm.org/patrickmichalina/onvif-probe-rx/dev-status.svg">
<a href="https://david-dm.org/patrickmichalina/camera-probe?type=dev">
<img alt="greenkeeper" src="https://david-dm.org/patrickmichalina/camera-probe/dev-status.svg">
</a>
</p>
<p align="center">
<a href="https://github.com/semantic-release/semantic-release">
<img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg">
</a>
<a href="https://www.npmjs.com/package/onvif-probe-rx">
<img alt="npm latest version" src="https://img.shields.io/npm/v/onvif-probe-rx/latest.svg">
<a href="https://www.npmjs.com/package/camera-probe">
<img alt="npm latest version" src="https://img.shields.io/npm/v/camera-probe/latest.svg">
</a>
</p>


## Installation
This package is designed to be run in a Node environment. For the best developer experience use Typescript.
This package is designed to be run in Node. For the best developer experience use Typescript.
```sh
$ npm i onvif-probe-rx
$ npm i camera-probe
```

## CLI
For CLI usage its easier to install globally like so:
```sh
$ npm i -g onvif-probe-rx
$ npm i -g camera-probe

// starting listening
$ onvif-probe
$ camera-probe
```

## Usage
Starts probing the network using the default configuration.
```ts
import { startProbingONVIFDevices } from 'onvif-probe-rx'
import { devices$ } from 'camera-probe'

startProbingONVIFDevices()
.subscribe(console.info)
devices$().subscribe(console.info)
```

```js
Expand Down Expand Up @@ -98,9 +96,9 @@ startProbingONVIFDevices()
If you'd like to tweak default settings feel free to override in the `.run()` method.

```ts
import { probeONVIFDevices } from 'onvif-probe-rx'
import { probe } from 'camera-probe'

probeONVIFDevices()
probe()
.run({
PORTS: [3702],
PROBE_NETWORK_TIMEOUT_MS: 20000
Expand All @@ -111,18 +109,16 @@ probeONVIFDevices()
## Default Configuration
```ts
export const DEFAULT_CONFIG: IProbeConfig = {
PORTS: [139, 445, 1124, 3702],
IP_SCANNER: {
ENABLED: true,
IP_ADDRESSES: [],
PREFIXES: []
DOM_PARSER: new DOMParser(),
PORTS: {
UPNP: [1900],
WS_DISCOVERY: [3702]
},
MULTICAST_ADDRESS: '239.255.255.250',
PROBE_SAMPLE_TIME_MS: 2000,
PROBE_SAMPLE_START_DELAY_TIME_MS: 0,
PROBE_NETWORK_TIMEOUT_MS: 2000 * 1.5,
PROBE_SAMPLE_START_DELAY_TIME_MS: 0,
ONVIF_DEVICES: ['NetworkVideoTransmitter', 'Device', 'NetworkVideoDisplay'],
DOM_PARSER: new DOMParser(),
NOT_FOUND_STRING: 'unknown'
}
```
5 changes: 4 additions & 1 deletion circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defaults: &defaults
docker:
- image: circleci/node:11.13.0
- image: circleci/node:12.9.1

version: 2
jobs:
Expand All @@ -20,6 +20,9 @@ jobs:
- run:
name: Lint
command: npm run lint
- run:
name: Unit Test
command: npm test
- run:
name: Rollup
command: npm run rollup
Expand Down
13 changes: 8 additions & 5 deletions cli.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { writeFileSync, chmodSync } from 'fs'
import { writeFileSync, chmodSync, existsSync, mkdirSync } from 'fs'
import { resolve } from 'path'
import { ensureDirSync } from 'fs-extra'

const dir = resolve('dist')
const outPath = resolve(dir, 'onvif-probe')
const outPath = resolve(dir, 'camera-probe')

ensureDirSync(dir)
writeFileSync(outPath, '#!/usr/bin/env node\nrequire(\'../\').startProbingONVIFDevicesCli()')
// tslint:disable-next-line: no-if-statement
if (!existsSync(dir)){
mkdirSync(dir)
}

writeFileSync(outPath, '#!/usr/bin/env node\nrequire(\'../\').startCli()')
chmodSync(outPath, '755')
Loading

0 comments on commit 986bfb0

Please sign in to comment.