- Print
Device
- Print
Device Module 0.5.3
Usage
To use the Device module, you can import it into your project from the Firebolt SDK:
import { Device } from '@firebolt-js/sdk'
Overview
A module for querying about the device and it's capabilities.
Events
deviceNameChanged
Get the human readable name of the device
// listen to deviceNameChanged
Device.listen('deviceNameChanged', (data: string) => void): Promise<bigint>
// listen to deviceNameChanged once
Device.once('deviceNameChanged', (data: string) => void): Promise<bigint>
// clear a listener
Device.clear(listenerId?: bigint): void
Event value
Type | Description |
---|---|
string | the device friendly-name |
Promise Resolution
Type | Description |
---|---|
bigint | Listener ID to clear() the callback method and stop receiving the event, e.g. Device.clear(id) |
Examples
##### Getting the device name
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.listen('deviceNameChanged', value => {
console.log(value)
})
Value of value
"Living Room"
JSON-RPC
Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.onDeviceNameChanged",
"params": {}
}
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "Living Room"
}
##### Listen to an event only once
JavaScript
Device.listen('deviceNameChanged', (value) => {
console.log(value)
}).then( (listenerId) => {
Device.clear(listenerId)
})
Alternately, simply call once()
:
Device.once('deviceNameChanged', (value) => {
console.log(value)
})
##### Clear all listeners for an event
JavaScript
Device.clear('deviceNameChanged')
Methods
id
Get the platform back-office device identifier
function id(): Promise<string>
Promise Resolution
Type | Description |
---|---|
string | the id |
Examples
##### Default Example
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.id()
.then(id => {
console.log(id)
})
Value of id
"123"
JSON-RPC
###### Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.id",
"params": {}
}
###### Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "123"
}
distributor
Get the distributor ID for this device
function distributor(): Promise<string>
Promise Resolution
Type | Description |
---|---|
string | the distributor ID |
Examples
##### Getting the distributor ID
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.distributor()
.then(distributorId => {
console.log(distributorId)
})
Value of distributorId
"Company"
JSON-RPC
###### Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.distributor",
"params": {}
}
###### Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "Company"
}
platform
Get the platform ID for this device
function platform(): Promise<string>
Promise Resolution
Type | Description |
---|---|
string | the platform ID |
Examples
##### Getting the platform ID
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.platform()
.then(platformId => {
console.log(platformId)
})
Value of platformId
"WPE"
JSON-RPC
###### Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.platform",
"params": {}
}
###### Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "WPE"
}
uid
Gets a unique id for the current app & device
function uid(): Promise<string>
Promise Resolution
Type | Description |
---|---|
string | a unique ID |
Examples
##### Getting the unique ID
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.uid()
.then(uniqueId => {
console.log(uniqueId)
})
Value of uniqueId
"ee6723b8-7ab3-462c-8d93-dbf61227998e"
JSON-RPC
###### Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.uid",
"params": {}
}
###### Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "ee6723b8-7ab3-462c-8d93-dbf61227998e"
}
type
Get the device type
function type(): Promise<string>
Promise Resolution
Type | Description |
---|---|
string | the device type |
Examples
##### Getting the device type
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.type()
.then(deviceType => {
console.log(deviceType)
})
Value of deviceType
"STB"
JSON-RPC
###### Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.type",
"params": {}
}
###### Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "STB"
}
model
Get the device model
function model(): Promise<string>
Promise Resolution
Type | Description |
---|---|
string | the device model |
Examples
##### Getting the device model
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.model()
.then(model => {
console.log(model)
})
Value of model
"xi6"
JSON-RPC
###### Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.model",
"params": {}
}
###### Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "xi6"
}
sku
Get the device sku
function sku(): Promise<string>
Promise Resolution
Type | Description |
---|---|
string | the device sku |
Examples
##### Getting the device sku
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.sku()
.then(sku => {
console.log(sku)
})
Value of sku
"AX061AEI"
JSON-RPC
###### Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.sku",
"params": {}
}
###### Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "AX061AEI"
}
make
Get the device make
function make(): Promise<string>
Promise Resolution
Type | Description |
---|---|
string | the device make |
Examples
##### Getting the device make
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.make()
.then(make => {
console.log(make)
})
Value of make
"Arris"
JSON-RPC
###### Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.make",
"params": {}
}
###### Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "Arris"
}
version
Get the SDK, OS and other version info
function version(): Promise<object>
Promise Resolution
the versions
Field | Type | Description |
---|---|---|
sdk | SemanticVersion | The Firebolt SDK version |
os | SemanticVersion | The Firebolt OS version |
debug | string | Detail version as a string, for debugging purposes |
Examples
##### Getting the os and sdk versions
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.version()
.then(versions => {
console.log(versions)
})
Value of versions
{
"sdk": {
"major": 0,
"minor": 5,
"patch": 0,
"readable": "Firebolt JS SDK v0.5.0"
},
"os": {
"major": 0,
"minor": 1,
"patch": 0,
"readable": "Firebolt OS v0.1.0"
},
"debug": ""
}
JSON-RPC
###### Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.version",
"params": {}
}
###### Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"sdk": {
"major": 0,
"minor": 5,
"patch": 0,
"readable": "Firebolt JS SDK v0.5.0"
},
"os": {
"major": 0,
"minor": 1,
"patch": 0,
"readable": "Firebolt OS v0.1.0"
},
"debug": ""
}
}
hdcp
Get the supported HDCP profiles
function hdcp(): Promise<BooleanMap>
Promise Resolution
Type | Description |
---|---|
BooleanMap | the supported HDCP profiles |
Examples
##### Getting the supported HDCP profiles
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.hdcp()
.then(supportedHdcpProfiles => {
console.log(supportedHdcpProfiles)
})
Value of supportedHdcpProfiles
{
"hdcp1.4": true,
"hdcp2.2": true
}
JSON-RPC
###### Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.hdcp",
"params": {}
}
###### Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"hdcp1.4": true,
"hdcp2.2": true
}
}
hdr
Get the supported HDR profiles
function hdr(): Promise<BooleanMap>
Promise Resolution
Type | Description |
---|---|
BooleanMap | the supported HDR profiles |
Examples
##### Getting the supported HDR profiles
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.hdr()
.then(supportedHdrProfiles => {
console.log(supportedHdrProfiles)
})
Value of supportedHdrProfiles
{
"hdr10": true,
"hdr10Plus": true,
"dolbyVision": true,
"hlg": true
}
JSON-RPC
###### Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.hdr",
"params": {}
}
###### Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"hdr10": true,
"hdr10Plus": true,
"dolbyVision": true,
"hlg": true
}
}
audio
Get the supported audio profiles
function audio(): Promise<AudioProfiles>
Promise Resolution
Type | Description |
---|---|
AudioProfiles | the supported audio profiles |
Examples
##### Getting the supported audio profiles
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.audio()
.then(supportedAudioProfiles => {
console.log(supportedAudioProfiles)
})
Value of supportedAudioProfiles
{
"stereo": true,
"dolbyDigital5.1": true,
"dolbyDigital5.1+": true,
"dolbyAtmos": true
}
JSON-RPC
###### Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.audio",
"params": {}
}
###### Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"stereo": true,
"dolbyDigital5.1": true,
"dolbyDigital5.1+": true,
"dolbyAtmos": true
}
}
screenResolution
Get the current screen resolution
function screenResolution(): Promise<[bigint, bigint]>
Promise Resolution
Type | Description |
---|---|
[bigint, bigint] | the resolution |
Examples
##### Getting the screen resolution
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.screenResolution()
.then(screenResolution => {
console.log(screenResolution)
})
Value of screenResolution
[
1920,
1080
]
JSON-RPC
###### Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.screenResolution",
"params": {}
}
###### Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
1920,
1080
]
}
videoResolution
Get the current video resolution
function videoResolution(): Promise<[bigint, bigint]>
Promise Resolution
Type | Description |
---|---|
[bigint, bigint] | the resolution |
Examples
##### Getting the video resolution
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.videoResolution()
.then(videoResolution => {
console.log(videoResolution)
})
Value of videoResolution
[
1920,
1080
]
JSON-RPC
###### Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.videoResolution",
"params": {}
}
###### Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
1920,
1080
]
}
name
Get the human readable name of the device
function name(): Promise<string>
Promise Resolution
Type | Description |
---|---|
string | the device friendly-name |
Examples
##### Getting the device name
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.name()
.then(deviceName => {
console.log(deviceName)
})
Value of deviceName
"Living Room"
JSON-RPC
###### Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.name",
"params": {}
}
###### Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "Living Room"
}
network
Get the current network status and type
function network(): Promise<object>
Promise Resolution
the status and type
Field | Type | Description |
---|---|---|
state | NetworkState | |
type | NetworkType |
Examples
##### Getting the network info
JavaScript
import { Device } from '@firebolt-js/sdk'
Device.network()
.then(networkInfo => {
console.log(networkInfo)
})
Value of networkInfo
{
"state": "connected",
"type": "wifi"
}
JSON-RPC
###### Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "device.network",
"params": {}
}
###### Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"state": "connected",
"type": "wifi"
}
}
Schemas
Resolution
type Resolution = [bigint, bigint]
NetworkType
type NetworkType = 'wifi' | 'ethernet' | 'hybrid'
Details
The type of network that is currently active
NetworkState
type NetworkState = 'connected' | 'disconnected'
Details
The type of network that is currently active
AudioProfiles
type AudioProfiles = {
}
See also:
AudioProfile
type AudioProfile;
See also: