Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 25 Next »

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;
};                                                                                                                          
                                                                                                                           

ON THIS PAGE


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().


To enable the HID device:

Promise<void> enable()


To disable the HID device. This method is not currently supported:

Promise<void> disable()


To clear all active keystrokes and modifiers:

Promise<void> clear()


To send a keydown event for the specified USB key code:

Promise<void> keyDown(int keycode)


This is the same as keyDown() followed by keyUp():

Promise<void> keyPress(int keycode)


To send a keyup event for the specified USB key code:

Promise<void> keyUp(int keycode)


To return an associative array with the current state of all LED states on the keyboard:

Promise<LedState> getLedState()


To return an associative array with the current state of all modifiers (such as, shift, alt, ctrl):

Promise<ModifierState> getModifierState()


To set the current modifier state as specified by an associative array. Only modifiers that are listed will cause the state to change:

Promise<ModifierState> setModifierState(ModifierState)

Keycode

This interface contains the USB key code. 

  • [int] keycode

USB HID keyboard codes are in section 10 of 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.

  • [bool] optional numLock
  • [bool] optional capsLock
  • [bool] optional scrollLock


ModifierState

Listed modifiers will cause the state to change.

  • [bool] optional leftCtrl
  • [bool] optional leftShift 
  • [bool] optional leftAlt 
  • [bool] optional leftGui 
  • [bool] optional rightCtrl 
  • [bool] optional rightShift 
  • [bool] optional rightAlt 
  • [bool] optional rightGui 


Example

keyem = require('@brightsign/usbhidemulator')
kbd = new keyem()
kbd.addEventListener("ledupdate", function f(e) { console.log(e);})
kbd.enable()

kbd.keyPress(4)



  • No labels