9.0.2 • Published 3 years ago

onvif-rx v9.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

0930282e-7f18-11e6-948a-00546393fd93

About

This library aims to provide an easy way to interact with ONVIF devices from within Node. It is built with TypeScript to provide IDE's easy access to documentation and typing information.

The API is generated dynamically by reading ONVIF WSDL and XSD files.

This library is very early and not garaunteed to work for evey camera. Feel free to create a Github issue if it's not working for you.

This library does not "discover" devices on the network - for that try onvif-probe-rx

Docs

For more information about the TypeScript API checkout the generated API docs.

Roadmap

  • Generate API with typings and docs from WSDL's and XSD's
  • Execute simple (parameter-less) requests
  • Execute requests with paremeters

Node Installation

This package is designed to be run in both the browser and node environments.

npm i onvif-rx

Browser Installation (expiremental)

<head>
 <!-- simplest method, gets the latest version, but not minifed -->
 <script src="https://unpkg.com/onvif-rx"></script>
 
 <!-- RECOMMENDED: use a specific version to avoid a redirect and get a minified version --> 
 <script src="https://unpkg.com/onvif-rx@x.x.x/dist/onvif-rx-umd.min.js"></script>
</head>

Usage

The library is designed to be used in 2 distinct ways.

  • Managed - you construct a manged device using service URL and username/password combo. This makes running commands painless.
  • Ad Hoc - you can call methods individually with different username/passwords if needed.

Managed Usage

import { createManagedDeviceInNode } from 'onvif-rx'

const device = createManagedDeviceInNode({
  deviceUrl: 'http://192.168.1.11/onvif/device_service',
  password: 'admin',
  username: '1234'
})

device.api.Device.GetUsers()
  .toPromise()
  .then(res=> {
    res.match({ // results are wrapped in a managed object for safer processing
      ok: success => console.log(success.json), // successful response object
      fail: railure => console.log(railure.status, railure.statusMessage) // request failure object
    })
  }) 

Ad Hoc Usage

import { Device } from 'onvif-rx'
import { maybe } from 'typescript-monads'

Device.GetUsers()
  .run({
    system: DEFAULT_NODE_ENV,
    deviceUrl: 'http://192.168.1.11/onvif/device_service',
    user: maybe({ // currently requires a wrapper object, will improve in the future
      username: 'admin',
      password: '1234'
    })
  })
  .toPromise()
  .then(res=> {
    res.match({
      ok: success => console.log(success.json), // successful response object
      fail: railure => console.log(railure.status, railure.statusMessage) // request failure object
    })
  }) 
9.0.2

3 years ago

9.0.1

3 years ago

9.0.0

3 years ago

8.0.0

5 years ago

7.3.2

5 years ago

7.3.1

5 years ago

7.3.0

5 years ago

7.2.1

5 years ago

7.2.0

5 years ago

7.1.2

6 years ago

7.1.1

6 years ago

7.1.0

6 years ago

7.0.0

6 years ago

6.0.1

6 years ago

6.0.0

6 years ago

5.0.1

6 years ago

5.0.0

6 years ago

4.0.0

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.1.0

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago