# jabra

> NodeJS SDK for Jabra Devices

Latest version **1.0.6-16** (published 2018-12-21) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install jabra
pnpm add jabra
yarn add jabra
bun add jabra
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.6-16 |
| Published | 2018-12-21 |
| First published | 2018-02-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 51.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| Author | vikash kumar |
| Maintainers | frederiksen, jabra, sskjabra |

## Links

- npm: https://www.npmjs.com/package/jabra
- Repository: ""
- npm.io page: https://npm.io/package/jabra

## Dependencies (8)

- [ffi](https://npm.io/package/ffi.md) ^2.2.0
- [ref](https://npm.io/package/ref.md) ^1.3.5
- [pino](https://npm.io/package/pino.md) ^4.17.3
- [debug](https://npm.io/package/debug.md) ^3.1.0
- [ref-array](https://npm.io/package/ref-array.md) ^1.2.0
- [ref-union](https://npm.io/package/ref-union.md) ^1.0.1
- [ref-wchar](https://npm.io/package/ref-wchar.md) ^1.0.2
- [ref-struct](https://npm.io/package/ref-struct.md) ^1.1.0

## Recent versions

- 1.0.6-16 (latest) — 2018-12-21
- 1.0.7-1734p-4411 (rc-beta) — 2019-03-06
- 1.10.0-1734p-4415.beta — 2019-03-06
- 1.0.7-1734p-4400 — 2019-03-05
- 1.10.0-3904.beta — 2018-12-12
- 1.0.6-11 — 2018-12-11
- 1.0.6-11.prod — 2018-12-07
- 1.0.6-9.prod — 2018-11-28
- 1.0.6-8.prod — 2018-11-28
- 1.0.6-7.7e1edd1.prod — 2018-11-28
- 1.0.5 — 2018-02-27
- 1.0.4 — 2018-02-26

## README

Jabra Node.js SDK

# Table of Contents
- [Pre-requisite](#pre-requisite)
- [Installation](#installation)
- [Debugging and Logging](#debugging-and-logging)
- [API Reference](#api-reference)
- [Examples](#examples)
    - [Simple Example](#simple-example)
    - [Multiple device management](#multiple-device-management)
- [Features supported](#features-supported)
- [Supported devices](#supported-devices)
- [Bug report](#bug-report)
- [Changelog](#changelog)
- [License](#license)

## Pre-requisite
1. Node.js version v8.x or earlier
2. **On MacOS:** `xcode` & `python 2.7`. By default, Python is installed on macOS but make sure correct version(2.7.x) is installed. Install Xcode from App store or download it from [here](https://developer.apple.com/xcode/download/).
3. **On Windows:** `Visual C++ Build Tools` & `Python 2.7`. You can install all of these using command `npm install --global --production --add-python-to-path windows-build-tools`. To know more about this tool, see [this link.](https://github.com/felixrieseberg/windows-build-tools)

4. **For Electron.JS:** If you are using `asar` packaging then you need to `unpack` some of the resources used in this module. These resources are native library files i.e `libjabra.dll`, `libjabra.dylib` & `libjabra.so`, which is stored in a `shared-lib` folder. By default latest electron builder will automatically unpack, but if it does not work then you can provide below option to your build process. To know more, see [this link](https://www.electron.build/configuration/configuration)

    ```
    "build": {
        "asarUnpack": ["node_modules/jabra"]
    }
    ```

## Installation
This release can be installed via below command.
```
npm install --save jabra@latest
```

## Debugging and Logging
Below environment variables are defined for logging and debugging purpose. User can change the values as per preference.

Environment Variable | Value | Description
--- | --- | ---
DEBUG | jabra | Debug this nodejs module, debug message will be printed on console
LIBJABRA_TRACE_LEVEL | fatal, error, warning(default), info, debug | Log levels
LIBJABRA_RESOURCE_PATH | **On Mac:** ~/Library/Application Support/JabraSDK/ **On Windows:** %appdata%/JabraSDK  | This determine the system path where logs and device related files are written.

## API Reference
API doc is in html format. See doc folder inside installed module `node_module/jabra/doc` and open `index.html`.

## Examples

### Simple Example
This example shows how to ring a Jabra device. User should first register the app on [Jabra developer site](https://developer.jabra.com/) to get appID. User should pass this appID to initialize `jabra` module.

```javascript
const createJabraApp = require('jabra');
const jabra = createJabraApp('123'); // 123 is appID here

jabra.on('attach', (device) => {
    device.on('btnPress', (BTN_TYPE, btnValue) => {
        console.log('New input from device is received: ', jabra.enums.enumDeviceBtnType[BTN_TYPE], btnValue);
    })

    device.isRingerSupportedAsync() // returns promise
        .then((isSupported) => {
            if (isSupported) {
                device.ringAsync() // returns promise
                    .then(() => {
                        console.log('Device starts ringing');
                        setTimeout(() => {
                            device.unringAsync() // returns promise
                                .then(() => {
                                    console.log('Device stops ringing');
                                })
                                .catch((error) => {
                                    console.log('Device did not stop ringing due to ', error);
                                })
                        }, 5000); // stop ringing the device after 5 second
                    })
                    .catch((error) => {
                        console.log('Device did not start ringing due to ', error);
                    })
            }
        })
        .catch((error) => {
            console.log(error);
        })
});

jabra.on('detach', (deviceID, deviceName, productID, vendorID, ESN, isDongleDevice, isInFirmwareUpdateMode, variant, errorStatus) => {
    console.log('Device detached with deviceID:', deviceID);
});
```

### Multiple device management

```javascript
const jabra = require('jabra')('123'); // 123 is appID here
let deviceIDList = []; // store the list of attached deviceID

jabra.on('attach', (device) => {
    deviceIDList.push(device.deviceID);
});

jabra.on('detach', (deviceID) => {
    // logic to remove this deviceID from deviceIDList array
})

// suppose at some time, deviceIDList = [1, 3, 5]

const deviceInstanceList = jabra.getAttachedDevices(); // returns the list(Map data structure) of devices

const device3 = deviceInstanceList.get(deviceIDList[1]); // get device instance whose deviceID=3
device3.ringAsync() // ring device3 returns promise
    .then(() => {
        console.log('Device 3 starts ringing');
    })
    .catch((error) => {
        console.log('Device 3 did not start ringing due to ', error);
    })

const device1 = deviceInstanceList.get(deviceIDList[0]); // get device instance whose deviceID=1
device1.ringAsync() // ring device3 returns promise
    .then(() => {
        console.log('Device 1 starts ringing');
    })
    .catch((error) => {
        console.log('Device 1 did not start ringing due to ', error);
    })
```


**Example:**

```javascript
const jabra = require('jabra')('123'); // 123 is appID here
import { jabraEnums } from 'jabra';
jabra.on('attach', (device) => {
    if(device.connectionType !== jabraEnums.enumDeviceConnectionType.BT){
        device.ringAsync() // ring device3 returns promise
        .then(() => {
            console.log('Device starts ringing');
        })
        .catch((error) => {
            console.log('Device did not start ringing due to ', error);
        })
    }
})
```

## Features supported
    
* Device Information (device name, serial number, battery status)
* Remote Call Control(RCC) functionality support for below commands:	 
  - Answer and End Call    
  - Mute and Unmute Call
  - Hold and Resume Call
  - Ring indication
* Dongle support (Link360 and Link370)

## Supported devices 
* Pro 9470
* Pro 9465
* Pro 9460
* Pro 9450
* Biz 2300
* Motion Office
* Evolve 65 USB
* Biz 2400 II CC
* Pro 930
* Pro 935 (single and dual)
* Pro 925 (single and dual)
* Evolve 40
* Evolve 80
* Link 265
* Evolve 30 II
* Evolve 20
* Evolve 30
* Biz 1500
* Biz 2400 II
* Link 260
* Evolve 65t
* Evolve 75
* Evolve 75e
* Engage 50
* Engage 65
* Engage 75
* Motion UC (over Bluetooth)
* Link 360
* Link 370
* Speak 410
* Speak 510
* Speak 710
* Speak 810
* Link 230
* Link 850
* Link 860 (only settings applicable)

## Bug Report
If you find any bug or have any suggestion then fill in the form at [Jabra developer support site](https://developer.jabra.com/support/) with below details:

1. Bug description with steps to reproduce the issue.
2. Console log after enabling debug mode for this module, see [Debugging and Logging](#debugging-and-logging) section for more.
3. File logs, see [Debugging and Logging](#debugging-and-logging) section for more.

## License
Refer LICENSE.md under installed package directory

---
_Source: https://npm.io/package/jabra · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
