2023-02-09 23:31:22 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) Cloud Software Group, Inc.
|
2017-11-17 12:19:01 +01:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1) Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* 2) Redistributions in binary form must reproduce the above
|
|
|
|
* copyright notice, this list of conditions and the following
|
|
|
|
* disclaimer in the documentation and/or other materials
|
|
|
|
* provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
|
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
|
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.ComponentModel;
|
|
|
|
using System.Globalization;
|
2021-04-13 11:05:38 +02:00
|
|
|
using System.Linq;
|
2017-11-17 12:19:01 +01:00
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
|
|
|
|
namespace XenAPI
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// A physical USB device
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
public partial class PUSB : XenObject<PUSB>
|
|
|
|
{
|
2019-06-19 10:11:30 +02:00
|
|
|
#region Constructors
|
|
|
|
|
2017-11-17 12:19:01 +01:00
|
|
|
public PUSB()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public PUSB(string uuid,
|
|
|
|
XenRef<USB_group> USB_group,
|
|
|
|
XenRef<Host> host,
|
|
|
|
string path,
|
|
|
|
string vendor_id,
|
|
|
|
string vendor_desc,
|
|
|
|
string product_id,
|
|
|
|
string product_desc,
|
|
|
|
string serial,
|
|
|
|
string version,
|
|
|
|
string description,
|
|
|
|
bool passthrough_enabled,
|
2020-01-28 12:46:11 +01:00
|
|
|
Dictionary<string, string> other_config,
|
|
|
|
double speed)
|
2017-11-17 12:19:01 +01:00
|
|
|
{
|
|
|
|
this.uuid = uuid;
|
|
|
|
this.USB_group = USB_group;
|
|
|
|
this.host = host;
|
|
|
|
this.path = path;
|
|
|
|
this.vendor_id = vendor_id;
|
|
|
|
this.vendor_desc = vendor_desc;
|
|
|
|
this.product_id = product_id;
|
|
|
|
this.product_desc = product_desc;
|
|
|
|
this.serial = serial;
|
|
|
|
this.version = version;
|
|
|
|
this.description = description;
|
|
|
|
this.passthrough_enabled = passthrough_enabled;
|
|
|
|
this.other_config = other_config;
|
2020-01-28 12:46:11 +01:00
|
|
|
this.speed = speed;
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
2019-06-19 10:11:30 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Creates a new PUSB from a Hashtable.
|
|
|
|
/// Note that the fields not contained in the Hashtable
|
|
|
|
/// will be created with their default values.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="table"></param>
|
|
|
|
public PUSB(Hashtable table)
|
|
|
|
: this()
|
|
|
|
{
|
|
|
|
UpdateFrom(table);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2018-02-16 17:27:30 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Updates each field of this instance with the value of
|
|
|
|
/// the corresponding field of a given PUSB.
|
|
|
|
/// </summary>
|
2021-04-13 11:05:38 +02:00
|
|
|
public override void UpdateFrom(PUSB record)
|
2017-11-17 12:19:01 +01:00
|
|
|
{
|
2021-04-13 11:05:38 +02:00
|
|
|
uuid = record.uuid;
|
|
|
|
USB_group = record.USB_group;
|
|
|
|
host = record.host;
|
|
|
|
path = record.path;
|
|
|
|
vendor_id = record.vendor_id;
|
|
|
|
vendor_desc = record.vendor_desc;
|
|
|
|
product_id = record.product_id;
|
|
|
|
product_desc = record.product_desc;
|
|
|
|
serial = record.serial;
|
|
|
|
version = record.version;
|
|
|
|
description = record.description;
|
|
|
|
passthrough_enabled = record.passthrough_enabled;
|
|
|
|
other_config = record.other_config;
|
|
|
|
speed = record.speed;
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
2018-02-16 17:27:30 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Given a Hashtable with field-value pairs, it updates the fields of this PUSB
|
|
|
|
/// with the values listed in the Hashtable. Note that only the fields contained
|
|
|
|
/// in the Hashtable will be updated and the rest will remain the same.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="table"></param>
|
2018-02-16 17:27:30 +01:00
|
|
|
public void UpdateFrom(Hashtable table)
|
2017-11-17 12:19:01 +01:00
|
|
|
{
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("uuid"))
|
2018-02-23 17:06:32 +01:00
|
|
|
uuid = Marshalling.ParseString(table, "uuid");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("USB_group"))
|
2018-02-23 17:06:32 +01:00
|
|
|
USB_group = Marshalling.ParseRef<USB_group>(table, "USB_group");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("host"))
|
2018-02-23 17:06:32 +01:00
|
|
|
host = Marshalling.ParseRef<Host>(table, "host");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("path"))
|
2018-02-23 17:06:32 +01:00
|
|
|
path = Marshalling.ParseString(table, "path");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("vendor_id"))
|
2018-02-23 17:06:32 +01:00
|
|
|
vendor_id = Marshalling.ParseString(table, "vendor_id");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("vendor_desc"))
|
2018-02-23 17:06:32 +01:00
|
|
|
vendor_desc = Marshalling.ParseString(table, "vendor_desc");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("product_id"))
|
2018-02-23 17:06:32 +01:00
|
|
|
product_id = Marshalling.ParseString(table, "product_id");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("product_desc"))
|
2018-02-23 17:06:32 +01:00
|
|
|
product_desc = Marshalling.ParseString(table, "product_desc");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("serial"))
|
2018-02-23 17:06:32 +01:00
|
|
|
serial = Marshalling.ParseString(table, "serial");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("version"))
|
2018-02-23 17:06:32 +01:00
|
|
|
version = Marshalling.ParseString(table, "version");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("description"))
|
2018-02-23 17:06:32 +01:00
|
|
|
description = Marshalling.ParseString(table, "description");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("passthrough_enabled"))
|
2018-02-23 17:06:32 +01:00
|
|
|
passthrough_enabled = Marshalling.ParseBool(table, "passthrough_enabled");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("other_config"))
|
2023-08-20 13:28:53 +02:00
|
|
|
other_config = Maps.ToDictionary_string_string(Marshalling.ParseHashTable(table, "other_config"));
|
2020-01-28 12:46:11 +01:00
|
|
|
if (table.ContainsKey("speed"))
|
|
|
|
speed = Marshalling.ParseDouble(table, "speed");
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public bool DeepEquals(PUSB other)
|
|
|
|
{
|
|
|
|
if (ReferenceEquals(null, other))
|
|
|
|
return false;
|
|
|
|
if (ReferenceEquals(this, other))
|
|
|
|
return true;
|
|
|
|
|
2023-08-20 13:28:53 +02:00
|
|
|
return Helper.AreEqual2(_uuid, other._uuid) &&
|
|
|
|
Helper.AreEqual2(_USB_group, other._USB_group) &&
|
|
|
|
Helper.AreEqual2(_host, other._host) &&
|
|
|
|
Helper.AreEqual2(_path, other._path) &&
|
|
|
|
Helper.AreEqual2(_vendor_id, other._vendor_id) &&
|
|
|
|
Helper.AreEqual2(_vendor_desc, other._vendor_desc) &&
|
|
|
|
Helper.AreEqual2(_product_id, other._product_id) &&
|
|
|
|
Helper.AreEqual2(_product_desc, other._product_desc) &&
|
|
|
|
Helper.AreEqual2(_serial, other._serial) &&
|
|
|
|
Helper.AreEqual2(_version, other._version) &&
|
|
|
|
Helper.AreEqual2(_description, other._description) &&
|
|
|
|
Helper.AreEqual2(_passthrough_enabled, other._passthrough_enabled) &&
|
|
|
|
Helper.AreEqual2(_other_config, other._other_config) &&
|
|
|
|
Helper.AreEqual2(_speed, other._speed);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public override string SaveChanges(Session session, string opaqueRef, PUSB server)
|
|
|
|
{
|
|
|
|
if (opaqueRef == null)
|
2018-02-14 12:03:48 +01:00
|
|
|
{
|
|
|
|
System.Diagnostics.Debug.Assert(false, "Cannot create instances of this type on the server");
|
2017-11-17 12:19:01 +01:00
|
|
|
return "";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual2(_other_config, server._other_config))
|
|
|
|
{
|
|
|
|
PUSB.set_other_config(session, opaqueRef, _other_config);
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
2021-04-13 11:05:38 +02:00
|
|
|
|
2017-11-17 12:19:01 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Get a record containing the current state of the given PUSB.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
public static PUSB get_record(Session session, string _pusb)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_record(session.opaque_ref, _pusb);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get a reference to the PUSB instance with the specified UUID.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_uuid">UUID of object to return</param>
|
|
|
|
public static XenRef<PUSB> get_by_uuid(Session session, string _uuid)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_by_uuid(session.opaque_ref, _uuid);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the uuid field of the given PUSB.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
public static string get_uuid(Session session, string _pusb)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_uuid(session.opaque_ref, _pusb);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the USB_group field of the given PUSB.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
public static XenRef<USB_group> get_USB_group(Session session, string _pusb)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_usb_group(session.opaque_ref, _pusb);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the host field of the given PUSB.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
public static XenRef<Host> get_host(Session session, string _pusb)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_host(session.opaque_ref, _pusb);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the path field of the given PUSB.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
public static string get_path(Session session, string _pusb)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_path(session.opaque_ref, _pusb);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the vendor_id field of the given PUSB.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
public static string get_vendor_id(Session session, string _pusb)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_vendor_id(session.opaque_ref, _pusb);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the vendor_desc field of the given PUSB.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
public static string get_vendor_desc(Session session, string _pusb)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_vendor_desc(session.opaque_ref, _pusb);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the product_id field of the given PUSB.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
public static string get_product_id(Session session, string _pusb)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_product_id(session.opaque_ref, _pusb);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the product_desc field of the given PUSB.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
public static string get_product_desc(Session session, string _pusb)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_product_desc(session.opaque_ref, _pusb);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the serial field of the given PUSB.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
public static string get_serial(Session session, string _pusb)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_serial(session.opaque_ref, _pusb);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the version field of the given PUSB.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
public static string get_version(Session session, string _pusb)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_version(session.opaque_ref, _pusb);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the description field of the given PUSB.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
public static string get_description(Session session, string _pusb)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_description(session.opaque_ref, _pusb);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the passthrough_enabled field of the given PUSB.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
public static bool get_passthrough_enabled(Session session, string _pusb)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_passthrough_enabled(session.opaque_ref, _pusb);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the other_config field of the given PUSB.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
public static Dictionary<string, string> get_other_config(Session session, string _pusb)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_other_config(session.opaque_ref, _pusb);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
2020-01-28 12:46:11 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Get the speed field of the given PUSB.
|
2020-06-17 10:48:49 +02:00
|
|
|
/// First published in Citrix Hypervisor 8.2.
|
2020-01-28 12:46:11 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
public static double get_speed(Session session, string _pusb)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_speed(session.opaque_ref, _pusb);
|
2020-01-28 12:46:11 +01:00
|
|
|
}
|
|
|
|
|
2017-11-17 12:19:01 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Set the other_config field of the given PUSB.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
/// <param name="_other_config">New value to set</param>
|
|
|
|
public static void set_other_config(Session session, string _pusb, Dictionary<string, string> _other_config)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
session.JsonRpcClient.pusb_set_other_config(session.opaque_ref, _pusb, _other_config);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Add the given key-value pair to the other_config field of the given PUSB.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
/// <param name="_key">Key to add</param>
|
|
|
|
/// <param name="_value">Value to add</param>
|
|
|
|
public static void add_to_other_config(Session session, string _pusb, string _key, string _value)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
session.JsonRpcClient.pusb_add_to_other_config(session.opaque_ref, _pusb, _key, _value);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Remove the given key and its corresponding value from the other_config field of the given PUSB. If the key is not in that Map, then do nothing.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
/// <param name="_key">Key to remove</param>
|
|
|
|
public static void remove_from_other_config(Session session, string _pusb, string _key)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
session.JsonRpcClient.pusb_remove_from_other_config(session.opaque_ref, _pusb, _key);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_host">The host</param>
|
|
|
|
public static void scan(Session session, string _host)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
session.JsonRpcClient.pusb_scan(session.opaque_ref, _host);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_host">The host</param>
|
|
|
|
public static XenRef<Task> async_scan(Session session, string _host)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.async_pusb_scan(session.opaque_ref, _host);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
/// <param name="_value">passthrough is enabled when true and disabled with false</param>
|
|
|
|
public static void set_passthrough_enabled(Session session, string _pusb, bool _value)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
session.JsonRpcClient.pusb_set_passthrough_enabled(session.opaque_ref, _pusb, _value);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
|
|
|
/// <param name="_value">passthrough is enabled when true and disabled with false</param>
|
|
|
|
public static XenRef<Task> async_set_passthrough_enabled(Session session, string _pusb, bool _value)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.async_pusb_set_passthrough_enabled(session.opaque_ref, _pusb, _value);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return a list of all the PUSBs known to the system.
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
public static List<XenRef<PUSB>> get_all(Session session)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_all(session.opaque_ref);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get all the PUSB Records at once, in a single XML RPC call
|
2017-11-22 15:33:26 +01:00
|
|
|
/// First published in XenServer 7.3.
|
2017-11-17 12:19:01 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
public static Dictionary<XenRef<PUSB>, PUSB> get_all_records(Session session)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.pusb_get_all_records(session.opaque_ref);
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Unique identifier/object reference
|
|
|
|
/// </summary>
|
|
|
|
public virtual string uuid
|
|
|
|
{
|
|
|
|
get { return _uuid; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _uuid))
|
|
|
|
{
|
|
|
|
_uuid = value;
|
|
|
|
NotifyPropertyChanged("uuid");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private string _uuid = "";
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// USB group the PUSB is contained in
|
|
|
|
/// </summary>
|
|
|
|
[JsonConverter(typeof(XenRefConverter<USB_group>))]
|
|
|
|
public virtual XenRef<USB_group> USB_group
|
|
|
|
{
|
|
|
|
get { return _USB_group; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _USB_group))
|
|
|
|
{
|
|
|
|
_USB_group = value;
|
|
|
|
NotifyPropertyChanged("USB_group");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private XenRef<USB_group> _USB_group = new XenRef<USB_group>("OpaqueRef:NULL");
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Physical machine that owns the USB device
|
|
|
|
/// </summary>
|
|
|
|
[JsonConverter(typeof(XenRefConverter<Host>))]
|
|
|
|
public virtual XenRef<Host> host
|
|
|
|
{
|
|
|
|
get { return _host; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _host))
|
|
|
|
{
|
|
|
|
_host = value;
|
|
|
|
NotifyPropertyChanged("host");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private XenRef<Host> _host = new XenRef<Host>("OpaqueRef:NULL");
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// port path of USB device
|
|
|
|
/// </summary>
|
|
|
|
public virtual string path
|
|
|
|
{
|
|
|
|
get { return _path; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _path))
|
|
|
|
{
|
|
|
|
_path = value;
|
|
|
|
NotifyPropertyChanged("path");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private string _path = "";
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// vendor id of the USB device
|
|
|
|
/// </summary>
|
|
|
|
public virtual string vendor_id
|
|
|
|
{
|
|
|
|
get { return _vendor_id; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _vendor_id))
|
|
|
|
{
|
|
|
|
_vendor_id = value;
|
|
|
|
NotifyPropertyChanged("vendor_id");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private string _vendor_id = "";
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// vendor description of the USB device
|
|
|
|
/// </summary>
|
|
|
|
public virtual string vendor_desc
|
|
|
|
{
|
|
|
|
get { return _vendor_desc; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _vendor_desc))
|
|
|
|
{
|
|
|
|
_vendor_desc = value;
|
|
|
|
NotifyPropertyChanged("vendor_desc");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private string _vendor_desc = "";
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// product id of the USB device
|
|
|
|
/// </summary>
|
|
|
|
public virtual string product_id
|
|
|
|
{
|
|
|
|
get { return _product_id; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _product_id))
|
|
|
|
{
|
|
|
|
_product_id = value;
|
|
|
|
NotifyPropertyChanged("product_id");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private string _product_id = "";
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// product description of the USB device
|
|
|
|
/// </summary>
|
|
|
|
public virtual string product_desc
|
|
|
|
{
|
|
|
|
get { return _product_desc; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _product_desc))
|
|
|
|
{
|
|
|
|
_product_desc = value;
|
|
|
|
NotifyPropertyChanged("product_desc");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private string _product_desc = "";
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// serial of the USB device
|
|
|
|
/// </summary>
|
|
|
|
public virtual string serial
|
|
|
|
{
|
|
|
|
get { return _serial; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _serial))
|
|
|
|
{
|
|
|
|
_serial = value;
|
|
|
|
NotifyPropertyChanged("serial");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private string _serial = "";
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// USB device version
|
|
|
|
/// </summary>
|
|
|
|
public virtual string version
|
|
|
|
{
|
|
|
|
get { return _version; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _version))
|
|
|
|
{
|
|
|
|
_version = value;
|
|
|
|
NotifyPropertyChanged("version");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private string _version = "";
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// USB device description
|
|
|
|
/// </summary>
|
|
|
|
public virtual string description
|
|
|
|
{
|
|
|
|
get { return _description; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _description))
|
|
|
|
{
|
|
|
|
_description = value;
|
|
|
|
NotifyPropertyChanged("description");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private string _description = "";
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// enabled for passthrough
|
|
|
|
/// </summary>
|
|
|
|
public virtual bool passthrough_enabled
|
|
|
|
{
|
|
|
|
get { return _passthrough_enabled; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _passthrough_enabled))
|
|
|
|
{
|
|
|
|
_passthrough_enabled = value;
|
|
|
|
NotifyPropertyChanged("passthrough_enabled");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private bool _passthrough_enabled = false;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// additional configuration
|
|
|
|
/// </summary>
|
2018-02-27 15:52:46 +01:00
|
|
|
[JsonConverter(typeof(StringStringMapConverter))]
|
2017-11-17 12:19:01 +01:00
|
|
|
public virtual Dictionary<string, string> other_config
|
|
|
|
{
|
|
|
|
get { return _other_config; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _other_config))
|
|
|
|
{
|
|
|
|
_other_config = value;
|
|
|
|
NotifyPropertyChanged("other_config");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private Dictionary<string, string> _other_config = new Dictionary<string, string>() {};
|
2020-01-28 12:46:11 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// USB device speed
|
2020-06-17 10:48:49 +02:00
|
|
|
/// First published in Citrix Hypervisor 8.2.
|
2020-01-28 12:46:11 +01:00
|
|
|
/// </summary>
|
|
|
|
public virtual double speed
|
|
|
|
{
|
|
|
|
get { return _speed; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _speed))
|
|
|
|
{
|
|
|
|
_speed = value;
|
|
|
|
NotifyPropertyChanged("speed");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private double _speed = -1.000;
|
2017-11-17 12:19:01 +01:00
|
|
|
}
|
|
|
|
}
|