Player APIs (BrightScript & Ja...
JavaScript APIs
usbpowercontrol
7min
the usbpowercontrol object is used to control the power of the usb port for specific supported platforms the supported platforms are xt1144, xd1034, au325, and au335 this object is available on brightsignos 8 2 20 and above usbpowercontrol idl interface usbpowercontrol { promise\<void> powercycleport(string friendly name); promise\<void> powercycleallports(); promise\<void> portpoweron(string friendly name); promise\<void> portpoweroff(string friendly name); }; object creation var usbpowercontrolclass = require("@brightsign/usbpowercontrol"); var usbpowercontrol = new usbpowercontrolclass(); usbpowercontrol use this interface to control power on usb ports powercycleport() promise\<void> powercycleport(string friendly name) allows you to power cycle the vbus on a device that may be stuck on a specific port friendly name string string the friendly name of the specific usb port please refer to the table below to map friendly names to supported platforms for example, call usbpowercontrol powercycleport("usb\ a") to turn the usb power on port 1 of au325 off and on again platform usb friendly name au325 1, 2, 3, 4, 5, 6 "usb\ a", "usb\ b", "usb\ c", "usb\ d", "usb\ e", "usb\ f" au335 type c "usb\ a" xd1034, xt1144 type c, type a "usb\ a", "usb\ b" powercycleallports() promise\<void> powercycleallports() call usbpowercontrol powercycleallports() to turn the power off and on for all usb ports and power cycle all plugged in devices portpoweron() promise\<void> portpoweron(string friendly name) allows you to power on the specified port friendly name string string the friendly name of the specific usb port please refer to the table above to map friendly names on supported platforms portpoweroff() promise\<void> portpoweroff(string friendly name) allows you to power off the specified port friendly name string string the friendly name of the specific usb port please refer to the table above to map friendly names on supported platforms example this example power cycles usb\ a and usb\ b ports const usbpowercontrolclass = require("@brightsign/usbpowercontrol"); const usbpowercontrol = new usbpowercontrolclass(); let promise = usbpowercontrol portpoweroff("usb\ a"); promise then(function(){ console log("a is turned off"); return usbpowercontrol portpoweroff("usb\ b"); }) then(function(){ console log("b is turned off"); return usbpowercontrol portpoweron("usb\ a"); }) then(function(){ console log("a is back on"); return usbpowercontrol portpoweron("usb\ b"); }) then(function(){ console log("b is back on" ); }) catch(function(err){ console log("error"); });