Virtual USB Tools - Advanced USB to TCP/IP network configurations for your USB usage scenario
Download Virtual USB Tools Hide this button

IUsbServer Interface

interface IUsbServer {
    // Properties
    readonly ${running}: boolean;
    ${advertising}: boolean;
    ${defaultTcpPort}: number;
    ${listeningEndpoints}: string;
    readonly ${localDevicesJs}: ${IUsbDevice}[];
    readonly ${sharedDevicesJs}: ${ISharedUsbDevice}[];

    // Methods
    ${shareDevice}(device: ${IUsbDevice}, authKey?: string): ${ISharedUsbDevice};
    ${stopSharingDevice}(device: ${ISharedUsbDevice}): void;
    ${restart}(): void;
    ${reloadSettings}(): void;
}
public interface IUsbServer
{
    // Properties
    bool ${running} { get; }
    bool ${advertising} { get; set; }
    ushort ${defaultTcpPort} { get; set; }
    string ${listeningEndpoints} { get; set; }
    Array ${localDevices} { get; }
    Array ${sharedDevices} { get; }

    // Methods
    ${ISharedUsbDevice} ${shareDevice}(${IUsbDevice} device, object authKey);
    void ${stopSharingDevice}(${ISharedUsbDevice} device);
    void ${restart}();
    void ${reloadSettings}();
    void ${addListener}(${IUsbServerListener} pListener);
    void ${removeListener}(${IUsbServerListener} pListener);
}
struct IUsbServer : IDispatch
{
    // Properties
    VARIANT_BOOL ${running};  // get 
    VARIANT_BOOL ${advertising};  // get set 
    USHORT ${defaultTcpPort};  // get set 
    _bstr_t ${listeningEndpoints};  // get set 
    SAFEARRAY(${IUsbDevice}) ${localDevices};  // get 
    SAFEARRAY(${ISharedUsbDevice}) ${sharedDevices};  // get 

    // Methods
    ${ISharedUsbDevicePtr#ISharedUsbDevice} ${shareDevice}(${IUsbDevice *#IUsbDevice} device, const _variant_t & authKey);
    HRESULT ${stopSharingDevice}(${ISharedUsbDevice *#ISharedUsbDevice} device);
    HRESULT ${restart}();
    HRESULT ${reloadSettings}();
    HRESULT ${addListener}(${IUsbServerListener *#IUsbServerListener} pListener);
    HRESULT ${removeListener}(${IUsbServerListener *#IUsbServerListener} pListener);
};

IUsbServer Properties

running

readonly running: boolean;
bool running { get; }
VARIANT_BOOL running;  // get 

Holds true if the Virtual USB Server is running, false otherwise. Do not use the API if this property is false and re-install the Virtual USB Server as soon as possible.

advertising

advertising: boolean;
bool advertising { get; set; }
VARIANT_BOOL advertising;  // get set 

Get or set this property to obtain or change a server advertisement mode.

defaultTcpPort

defaultTcpPort: number;
ushort defaultTcpPort { get; set; }
USHORT defaultTcpPort;  // get set 

Get or set the default TCP port.

listeningEndpoints

listeningEndpoints: string;
string listeningEndpoints { get; set; }
_bstr_t listeningEndpoints;  // get set 

Get a set a comma-separated list of local endpoints the server listens on.

localDevices

// This property is not available in scripting environment
Array localDevices { get; }
SAFEARRAY(${IUsbDevice}) localDevices;  // get 

Returns a list of all supported USB devices. USB devices that are currently disconnected are also included in this list.

localDevicesJs

readonly localDevicesJs: ${IUsbDevice}[];
// This property is not available in managed environment
// This property is not available in native environment

Returns a list of all supported USB devices. USB devices that are currently disconnected are also included in this list.

sharedDevices

// This property is not available in scripting environment
Array sharedDevices { get; }
SAFEARRAY(${ISharedUsbDevice}) sharedDevices;  // get 

Returns a list of all shared USB devices.

sharedDevicesJs

readonly sharedDevicesJs: ${ISharedUsbDevice}[];
// This property is not available in managed environment
// This property is not available in native environment

Returns a list of all shared USB devices.

IUsbServer Methods

shareDevice

shareDevice(device: ${IUsbDevice}, authKey?: string): ${ISharedUsbDevice};
${ISharedUsbDevice} shareDevice(${IUsbDevice} device, object authKey);
${ISharedUsbDevicePtr#ISharedUsbDevice} shareDevice(${IUsbDevice *#IUsbDevice} device, const _variant_t & authKey);
device
A reference to a device you want to share.
authKey
An optional string that contains an authentication key.

Share a given USB device with an optional authentication key.

stopSharingDevice

stopSharingDevice(device: ${ISharedUsbDevice}): void;
void stopSharingDevice(${ISharedUsbDevice} device);
HRESULT stopSharingDevice(${ISharedUsbDevice *#ISharedUsbDevice} device);
device
A reference to a shared USB device.

Stop sharing a given USB device.

restart

restart(): void;
void restart();
HRESULT restart();

Restart Virtual USB server. Restarting a server will temporary break all connections to USB devices.

reloadSettings

reloadSettings(): void;
void reloadSettings();
HRESULT reloadSettings();

Reload updated settings. All current connections will remain active, but server will stop listening for new connections, apply updated settings and start listening on new configured endpoints.

addListener

// This method is not available in scripting environment
void addListener(${IUsbServerListener} pListener);
HRESULT addListener(${IUsbServerListener *#IUsbServerListener} pListener);
pListener
Pointer or reference to the listener interface implemented by the caller.

Adds specified listener object to the list of listener objects. When new USB device is connected, library calls methods of the supplied listener object, passing a reference to a connected device.

removeListener

// This method is not available in scripting environment
void removeListener(${IUsbServerListener} pListener);
HRESULT removeListener(${IUsbServerListener *#IUsbServerListener} pListener);
pListener
Pointer or reference to the listener interface implemented by the caller.

Removes specified listener object from the list of listener objects.