Player APIs (BrightScript & Ja...
JavaScript APIs
usbhidemulator
12min
the usbhidemulator allows you to emulate usb hid devices usb keyboards are currently the only supported device type brightsign players with usb c (except for ls3 and ls4) can use this object usbhidemulator idl \[ constructor(string path, string type) ] interface usbhidemulator { promise\<void> enable(); promise\<void> disable(); promise\<void> clear(); promise\<void> keydown(int keycode); 	promise\<void> keypress(int keycode); promise\<void> keyup(int keycode); promise\<ledstate> getledstate(); promise\<modifierstate> getmodifierstate(); promise\<void> setmodifierstate(modifierstate) }; interface ledstate { \[optional] attribute bool numlock; \[optional] attribute bool capslock; \[optional] attribute bool scrolllock; }; interface modifierstate { \[optional] attribute bool leftctrl; \[optional] attribute bool leftshift; \[optional] attribute bool leftalt; \[optional] attribute bool leftgui; \[optional] attribute bool rightctrl; \[optional] attribute bool rightshift; \[optional] attribute bool rightalt; \[optional] attribute bool rightgui; }; object creation to create a usbhidemulator object, first load the @brightsign/usbhidemulator module using the require() method keyem = require('@brightsign/usbhidemulator') kbd = new keyem() usbhideemulator use this interface to configure a usbhidemulator interface the usbhidemulator class also generates "ledupdate" events which can be listened for with addeventlistener() enable() promise\<void> enable() enables the hid device disable() promise\<void> disable() disables the hid device this method is not currently supported clear() clears all active keystrokes and modifiers clears all active keystrokes and modifiers keydown() promise\<void> keydown(int keycode) sends a keydown event for the specified usb key code keypress() promise\<void> keypress(int keycode) this is the same as keydown() followed by keyup() keyup() promise\<void> keyup(int keycode) sends a keyup event for the specified usb key code getledstate() promise\<ledstate> getledstate() returns an associative array with the current state of all led states on the keyboard getmodifierstate() promise\<modifierstate> getmodifierstate() returns an associative array with the current state of all modifiers (such as, shift, alt, ctrl) setmodifierstate() promise\<modifierstate> setmodifierstate(modifierstate) sets the current modifier state as specified by an associative array only modifiers that are listed will cause the state to change keycode this interface contains the usb key code keycode int int usb hid keyboard codes are in section 10 of www usb org/sites/default/files/documents/hut1 12v2 pdf http //www usb org/sites/default/files/documents/hut1 12v2 pdf ledstate this interface sends an led state change if number lock, capital lock, or scroll lock is pressed numlock bool bool optional optional capslock bool bool optional optional scrolllock bool bool optional optional modifierstate listed modifiers will cause the state to change leftctrl bool bool optional optional leftshift bool bool optional optional leftalt bool bool optional optional leftgui bool bool optional optional rightctrl bool bool optional optional rightshift bool bool optional optional rightalt bool bool optional optional rightgui bool bool optional optional example keyem = require('@brightsign/usbhidemulator') kbd = new keyem() kbd addeventlistener("ledupdate", function f(e) { console log(e);}) kbd enable() kbd keypress(4)