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);
};
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: boolean;
bool advertising { get; set; }
VARIANT_BOOL advertising; // get set
Get or set this property to obtain or change a server advertisement mode.
defaultTcpPort: number;
ushort defaultTcpPort { get; set; }
USHORT defaultTcpPort; // get set
Get or set the default TCP port.
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.
// 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.
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.
stopSharingDevice(device: ${ISharedUsbDevice}): void;
void stopSharingDevice(${ISharedUsbDevice} device);
HRESULT stopSharingDevice(${ISharedUsbDevice *#ISharedUsbDevice} device);
device
Stop sharing a given USB device.
restart(): void;
void restart();
HRESULT restart();
Restart Virtual USB server. Restarting a server will temporary break all connections to USB devices.
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.
// This method is not available in scripting environment
void addListener(${IUsbServerListener} pListener);
HRESULT addListener(${IUsbServerListener *#IUsbServerListener} pListener);
pListener
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.
// This method is not available in scripting environment
void removeListener(${IUsbServerListener} pListener);
HRESULT removeListener(${IUsbServerListener *#IUsbServerListener} pListener);
pListener
Removes specified listener object from the list of listener objects.