Appearance
Properties
The Properties module is used to get and set settings on Jabra devices and to listen for telemetry data events from devices.
The demo implementation includes details on common properties for Jabra Engage 40 and 50 II headset devices.
Initialize
Before you can use the Properties module in your application, you must initialize the core SDK and install the properties npm packages:
sh
npm install @gnaudio/jabra-properties
npm install @gnaudio/jabra-properties-definitionTo start interacting with Properties, first create an instance of the PropertyModule and then create an instance of the PropertyFactory.
js
// Import the core Property module as well as the default properties definition JSON
import { PropertyModule } from '@gnaudio/jabra-properties';
import propertiesDefinition from '@gnaudio/jabra-properties-definition/properties.json' with { type: "json" }
// Initialize the SDK's properties module
let propertyModule = new PropertyModule();
let propertyFactory = await propertyModule.createPropertyFactory(propertiesDefinition);PropertyMap
To read, write, or watch properties for a device, you need to define a PropertyMap of the properties you intend to use. In this example, we're using selected properties from the Jabra Engage 40, 50, and 50 II headsets.
js
// List the Jabra device properties and prepare them for use on the device
const propertyNames = [
"firmwareVersion",
"backgroundNoiseLevel",
"audioExposure",
"customerSpeaking",
"agentSpeaking",
"microphoneMuteState",
"sidetoneEnabled"
];
const propertyMap = await propertyFactory.createProperties(device, propertyNames);Read/write property
To read the current state of a setting (property) or change a setting, you simply get the property or start a transaction for setting properties.
js
//Read properties from device
const firmwareVersion = await propertyMap.get("firmwareVersion").get();
console.log("Firmware version: " + firmwareVersion, { deviceName: device.name });js
//Write properties to device.
const value = true;
await propertyMap.startTransaction().set("sidetoneEnabled", value).commit();Some settings trigger reboot
Note that some of the settings you can change using properties will trigger Jabra devices to reboot.
Telemetry data
Some properties can be observed for telemetry event data. Examples include the "backgroundNoiseLevel" property available in Jabra Engage 40, 50, and 50 II headsets.
js
// Observing a property
const backgroundNoiseLevelProperty = propertyMap.get("backgroundNoiseLevel");
backgroundNoiseLevelProperty.watch().subscribe({
next(value) {
// When a new value is received
console.log(`${backgroundNoiseLevelProperty.name}: ${value}`);
},
error(e) {
// When an error occurs when setting up or running the watch
if (e instanceof JabraError) {
console.error(`Could not subscribe to ${backgroundNoiseLevelProperty.name}. It may not be supported by device`, { level: "error" });
} else {
console.error(`Failed monitoring ${backgroundNoiseLevelProperty.name}: ${e}`, { level: "error" });
}
},
complete() {
// When the watch is ended. E.g. when the device is disconnected
console.log(`Completed observing ${backgroundNoiseLevelProperty.name}`);
}
});Other properties
In the Properties & Button Customization demo we're detailing common properties of interest for developers for select headset devices. If you're interested in other settings or telemetry data points for Jabra devices, please contact us, detailing what you're looking for.