mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-12-23 08:56:02 +01:00
759 lines
29 KiB
C#
759 lines
29 KiB
C#
|
/*
|
||
|
* Copyright (c) Citrix Systems, Inc.
|
||
|
* All rights reserved.
|
||
|
*
|
||
|
* 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 CookComputing.XmlRpc;
|
||
|
|
||
|
|
||
|
namespace XenAPI
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// Describes the physical usb device
|
||
|
/// First published in Unreleased.
|
||
|
/// </summary>
|
||
|
public partial class PUSB : XenObject<PUSB>
|
||
|
{
|
||
|
public PUSB()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
public PUSB(string uuid,
|
||
|
XenRef<USB_group> USB_group,
|
||
|
XenRef<VUSB> attached,
|
||
|
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,
|
||
|
Dictionary<string, string> other_config)
|
||
|
{
|
||
|
this.uuid = uuid;
|
||
|
this.USB_group = USB_group;
|
||
|
this.attached = attached;
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Creates a new PUSB from a Proxy_PUSB.
|
||
|
/// </summary>
|
||
|
/// <param name="proxy"></param>
|
||
|
public PUSB(Proxy_PUSB proxy)
|
||
|
{
|
||
|
this.UpdateFromProxy(proxy);
|
||
|
}
|
||
|
|
||
|
public override void UpdateFrom(PUSB update)
|
||
|
{
|
||
|
uuid = update.uuid;
|
||
|
USB_group = update.USB_group;
|
||
|
attached = update.attached;
|
||
|
host = update.host;
|
||
|
path = update.path;
|
||
|
vendor_id = update.vendor_id;
|
||
|
vendor_desc = update.vendor_desc;
|
||
|
product_id = update.product_id;
|
||
|
product_desc = update.product_desc;
|
||
|
serial = update.serial;
|
||
|
version = update.version;
|
||
|
description = update.description;
|
||
|
passthrough_enabled = update.passthrough_enabled;
|
||
|
other_config = update.other_config;
|
||
|
}
|
||
|
|
||
|
internal void UpdateFromProxy(Proxy_PUSB proxy)
|
||
|
{
|
||
|
uuid = proxy.uuid == null ? null : (string)proxy.uuid;
|
||
|
USB_group = proxy.USB_group == null ? null : XenRef<USB_group>.Create(proxy.USB_group);
|
||
|
attached = proxy.attached == null ? null : XenRef<VUSB>.Create(proxy.attached);
|
||
|
host = proxy.host == null ? null : XenRef<Host>.Create(proxy.host);
|
||
|
path = proxy.path == null ? null : (string)proxy.path;
|
||
|
vendor_id = proxy.vendor_id == null ? null : (string)proxy.vendor_id;
|
||
|
vendor_desc = proxy.vendor_desc == null ? null : (string)proxy.vendor_desc;
|
||
|
product_id = proxy.product_id == null ? null : (string)proxy.product_id;
|
||
|
product_desc = proxy.product_desc == null ? null : (string)proxy.product_desc;
|
||
|
serial = proxy.serial == null ? null : (string)proxy.serial;
|
||
|
version = proxy.version == null ? null : (string)proxy.version;
|
||
|
description = proxy.description == null ? null : (string)proxy.description;
|
||
|
passthrough_enabled = (bool)proxy.passthrough_enabled;
|
||
|
other_config = proxy.other_config == null ? null : Maps.convert_from_proxy_string_string(proxy.other_config);
|
||
|
}
|
||
|
|
||
|
public Proxy_PUSB ToProxy()
|
||
|
{
|
||
|
Proxy_PUSB result_ = new Proxy_PUSB();
|
||
|
result_.uuid = (uuid != null) ? uuid : "";
|
||
|
result_.USB_group = (USB_group != null) ? USB_group : "";
|
||
|
result_.attached = (attached != null) ? attached : "";
|
||
|
result_.host = (host != null) ? host : "";
|
||
|
result_.path = (path != null) ? path : "";
|
||
|
result_.vendor_id = (vendor_id != null) ? vendor_id : "";
|
||
|
result_.vendor_desc = (vendor_desc != null) ? vendor_desc : "";
|
||
|
result_.product_id = (product_id != null) ? product_id : "";
|
||
|
result_.product_desc = (product_desc != null) ? product_desc : "";
|
||
|
result_.serial = (serial != null) ? serial : "";
|
||
|
result_.version = (version != null) ? version : "";
|
||
|
result_.description = (description != null) ? description : "";
|
||
|
result_.passthrough_enabled = passthrough_enabled;
|
||
|
result_.other_config = Maps.convert_to_proxy_string_string(other_config);
|
||
|
return result_;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Creates a new PUSB from a Hashtable.
|
||
|
/// </summary>
|
||
|
/// <param name="table"></param>
|
||
|
public PUSB(Hashtable table)
|
||
|
{
|
||
|
uuid = Marshalling.ParseString(table, "uuid");
|
||
|
USB_group = Marshalling.ParseRef<USB_group>(table, "USB_group");
|
||
|
attached = Marshalling.ParseRef<VUSB>(table, "attached");
|
||
|
host = Marshalling.ParseRef<Host>(table, "host");
|
||
|
path = Marshalling.ParseString(table, "path");
|
||
|
vendor_id = Marshalling.ParseString(table, "vendor_id");
|
||
|
vendor_desc = Marshalling.ParseString(table, "vendor_desc");
|
||
|
product_id = Marshalling.ParseString(table, "product_id");
|
||
|
product_desc = Marshalling.ParseString(table, "product_desc");
|
||
|
serial = Marshalling.ParseString(table, "serial");
|
||
|
version = Marshalling.ParseString(table, "version");
|
||
|
description = Marshalling.ParseString(table, "description");
|
||
|
passthrough_enabled = Marshalling.ParseBool(table, "passthrough_enabled");
|
||
|
other_config = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "other_config"));
|
||
|
}
|
||
|
|
||
|
public bool DeepEquals(PUSB other)
|
||
|
{
|
||
|
if (ReferenceEquals(null, other))
|
||
|
return false;
|
||
|
if (ReferenceEquals(this, other))
|
||
|
return true;
|
||
|
|
||
|
return Helper.AreEqual2(this._uuid, other._uuid) &&
|
||
|
Helper.AreEqual2(this._USB_group, other._USB_group) &&
|
||
|
Helper.AreEqual2(this._attached, other._attached) &&
|
||
|
Helper.AreEqual2(this._host, other._host) &&
|
||
|
Helper.AreEqual2(this._path, other._path) &&
|
||
|
Helper.AreEqual2(this._vendor_id, other._vendor_id) &&
|
||
|
Helper.AreEqual2(this._vendor_desc, other._vendor_desc) &&
|
||
|
Helper.AreEqual2(this._product_id, other._product_id) &&
|
||
|
Helper.AreEqual2(this._product_desc, other._product_desc) &&
|
||
|
Helper.AreEqual2(this._serial, other._serial) &&
|
||
|
Helper.AreEqual2(this._version, other._version) &&
|
||
|
Helper.AreEqual2(this._description, other._description) &&
|
||
|
Helper.AreEqual2(this._passthrough_enabled, other._passthrough_enabled) &&
|
||
|
Helper.AreEqual2(this._other_config, other._other_config);
|
||
|
}
|
||
|
|
||
|
public override string SaveChanges(Session session, string opaqueRef, PUSB server)
|
||
|
{
|
||
|
if (opaqueRef == null)
|
||
|
{
|
||
|
System.Diagnostics.Debug.Assert(false, "Cannot create instances of this type on the server");
|
||
|
return "";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (!Helper.AreEqual2(_passthrough_enabled, server._passthrough_enabled))
|
||
|
{
|
||
|
PUSB.set_passthrough_enabled(session, opaqueRef, _passthrough_enabled);
|
||
|
}
|
||
|
if (!Helper.AreEqual2(_other_config, server._other_config))
|
||
|
{
|
||
|
PUSB.set_other_config(session, opaqueRef, _other_config);
|
||
|
}
|
||
|
if (!Helper.AreEqual2(_USB_group, server._USB_group))
|
||
|
{
|
||
|
PUSB.set_USB_group(session, opaqueRef, _USB_group);
|
||
|
}
|
||
|
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// Get a record containing the current state of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
return new PUSB((Proxy_PUSB)session.proxy.pusb_get_record(session.uuid, (_pusb != null) ? _pusb : "").parse());
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Get a reference to the PUSB instance with the specified UUID.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
return XenRef<PUSB>.Create(session.proxy.pusb_get_by_uuid(session.uuid, (_uuid != null) ? _uuid : "").parse());
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Get the uuid field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
return (string)session.proxy.pusb_get_uuid(session.uuid, (_pusb != null) ? _pusb : "").parse();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Get the USB_group field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
return XenRef<USB_group>.Create(session.proxy.pusb_get_usb_group(session.uuid, (_pusb != null) ? _pusb : "").parse());
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Get the attached field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </summary>
|
||
|
/// <param name="session">The session</param>
|
||
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
||
|
public static XenRef<VUSB> get_attached(Session session, string _pusb)
|
||
|
{
|
||
|
return XenRef<VUSB>.Create(session.proxy.pusb_get_attached(session.uuid, (_pusb != null) ? _pusb : "").parse());
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Get the host field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
return XenRef<Host>.Create(session.proxy.pusb_get_host(session.uuid, (_pusb != null) ? _pusb : "").parse());
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Get the path field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
return (string)session.proxy.pusb_get_path(session.uuid, (_pusb != null) ? _pusb : "").parse();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Get the vendor_id field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
return (string)session.proxy.pusb_get_vendor_id(session.uuid, (_pusb != null) ? _pusb : "").parse();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Get the vendor_desc field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
return (string)session.proxy.pusb_get_vendor_desc(session.uuid, (_pusb != null) ? _pusb : "").parse();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Get the product_id field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
return (string)session.proxy.pusb_get_product_id(session.uuid, (_pusb != null) ? _pusb : "").parse();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Get the product_desc field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
return (string)session.proxy.pusb_get_product_desc(session.uuid, (_pusb != null) ? _pusb : "").parse();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Get the serial field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
return (string)session.proxy.pusb_get_serial(session.uuid, (_pusb != null) ? _pusb : "").parse();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Get the version field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
return (string)session.proxy.pusb_get_version(session.uuid, (_pusb != null) ? _pusb : "").parse();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Get the description field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
return (string)session.proxy.pusb_get_description(session.uuid, (_pusb != null) ? _pusb : "").parse();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Get the passthrough_enabled field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
return (bool)session.proxy.pusb_get_passthrough_enabled(session.uuid, (_pusb != null) ? _pusb : "").parse();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Get the other_config field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
return Maps.convert_from_proxy_string_string(session.proxy.pusb_get_other_config(session.uuid, (_pusb != null) ? _pusb : "").parse());
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Set the passthrough_enabled field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </summary>
|
||
|
/// <param name="session">The session</param>
|
||
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
||
|
/// <param name="_passthrough_enabled">New value to set</param>
|
||
|
public static void set_passthrough_enabled(Session session, string _pusb, bool _passthrough_enabled)
|
||
|
{
|
||
|
session.proxy.pusb_set_passthrough_enabled(session.uuid, (_pusb != null) ? _pusb : "", _passthrough_enabled).parse();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Set the other_config field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
session.proxy.pusb_set_other_config(session.uuid, (_pusb != null) ? _pusb : "", Maps.convert_to_proxy_string_string(_other_config)).parse();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Add the given key-value pair to the other_config field of the given PUSB.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
session.proxy.pusb_add_to_other_config(session.uuid, (_pusb != null) ? _pusb : "", (_key != null) ? _key : "", (_value != null) ? _value : "").parse();
|
||
|
}
|
||
|
|
||
|
/// <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.
|
||
|
/// First published in Unreleased.
|
||
|
/// </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)
|
||
|
{
|
||
|
session.proxy.pusb_remove_from_other_config(session.uuid, (_pusb != null) ? _pusb : "", (_key != null) ? _key : "").parse();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
///
|
||
|
/// First published in Unreleased.
|
||
|
/// </summary>
|
||
|
/// <param name="session">The session</param>
|
||
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
||
|
/// <param name="_value">The group to which the PUSB will be moved</param>
|
||
|
public static void set_USB_group(Session session, string _pusb, string _value)
|
||
|
{
|
||
|
session.proxy.pusb_set_usb_group(session.uuid, (_pusb != null) ? _pusb : "", (_value != null) ? _value : "").parse();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
///
|
||
|
/// First published in Unreleased.
|
||
|
/// </summary>
|
||
|
/// <param name="session">The session</param>
|
||
|
/// <param name="_pusb">The opaque_ref of the given pusb</param>
|
||
|
/// <param name="_value">The group to which the PUSB will be moved</param>
|
||
|
public static XenRef<Task> async_set_USB_group(Session session, string _pusb, string _value)
|
||
|
{
|
||
|
return XenRef<Task>.Create(session.proxy.async_pusb_set_usb_group(session.uuid, (_pusb != null) ? _pusb : "", (_value != null) ? _value : "").parse());
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
///
|
||
|
/// First published in Unreleased.
|
||
|
/// </summary>
|
||
|
/// <param name="session">The session</param>
|
||
|
public static void scan(Session session)
|
||
|
{
|
||
|
session.proxy.pusb_scan(session.uuid).parse();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
///
|
||
|
/// First published in Unreleased.
|
||
|
/// </summary>
|
||
|
/// <param name="session">The session</param>
|
||
|
public static XenRef<Task> async_scan(Session session)
|
||
|
{
|
||
|
return XenRef<Task>.Create(session.proxy.async_pusb_scan(session.uuid).parse());
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Return a list of all the PUSBs known to the system.
|
||
|
/// First published in Unreleased.
|
||
|
/// </summary>
|
||
|
/// <param name="session">The session</param>
|
||
|
public static List<XenRef<PUSB>> get_all(Session session)
|
||
|
{
|
||
|
return XenRef<PUSB>.Create(session.proxy.pusb_get_all(session.uuid).parse());
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Get all the PUSB Records at once, in a single XML RPC call
|
||
|
/// First published in Unreleased.
|
||
|
/// </summary>
|
||
|
/// <param name="session">The session</param>
|
||
|
public static Dictionary<XenRef<PUSB>, PUSB> get_all_records(Session session)
|
||
|
{
|
||
|
return XenRef<PUSB>.Create<Proxy_PUSB>(session.proxy.pusb_get_all_records(session.uuid).parse());
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Unique identifier/object reference
|
||
|
/// </summary>
|
||
|
public virtual string uuid
|
||
|
{
|
||
|
get { return _uuid; }
|
||
|
set
|
||
|
{
|
||
|
if (!Helper.AreEqual(value, _uuid))
|
||
|
{
|
||
|
_uuid = value;
|
||
|
Changed = true;
|
||
|
NotifyPropertyChanged("uuid");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
private string _uuid;
|
||
|
|
||
|
/// <summary>
|
||
|
/// USB group the pUSB is contained in
|
||
|
/// </summary>
|
||
|
public virtual XenRef<USB_group> USB_group
|
||
|
{
|
||
|
get { return _USB_group; }
|
||
|
set
|
||
|
{
|
||
|
if (!Helper.AreEqual(value, _USB_group))
|
||
|
{
|
||
|
_USB_group = value;
|
||
|
Changed = true;
|
||
|
NotifyPropertyChanged("USB_group");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
private XenRef<USB_group> _USB_group;
|
||
|
|
||
|
/// <summary>
|
||
|
/// VUSB running on this PUSB
|
||
|
/// </summary>
|
||
|
public virtual XenRef<VUSB> attached
|
||
|
{
|
||
|
get { return _attached; }
|
||
|
set
|
||
|
{
|
||
|
if (!Helper.AreEqual(value, _attached))
|
||
|
{
|
||
|
_attached = value;
|
||
|
Changed = true;
|
||
|
NotifyPropertyChanged("attached");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
private XenRef<VUSB> _attached;
|
||
|
|
||
|
/// <summary>
|
||
|
/// Physical machine that owns the USB device
|
||
|
/// </summary>
|
||
|
public virtual XenRef<Host> host
|
||
|
{
|
||
|
get { return _host; }
|
||
|
set
|
||
|
{
|
||
|
if (!Helper.AreEqual(value, _host))
|
||
|
{
|
||
|
_host = value;
|
||
|
Changed = true;
|
||
|
NotifyPropertyChanged("host");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
private XenRef<Host> _host;
|
||
|
|
||
|
/// <summary>
|
||
|
/// port path of usb device
|
||
|
/// </summary>
|
||
|
public virtual string path
|
||
|
{
|
||
|
get { return _path; }
|
||
|
set
|
||
|
{
|
||
|
if (!Helper.AreEqual(value, _path))
|
||
|
{
|
||
|
_path = value;
|
||
|
Changed = true;
|
||
|
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;
|
||
|
Changed = true;
|
||
|
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;
|
||
|
Changed = true;
|
||
|
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;
|
||
|
Changed = true;
|
||
|
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;
|
||
|
Changed = true;
|
||
|
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;
|
||
|
Changed = true;
|
||
|
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;
|
||
|
Changed = true;
|
||
|
NotifyPropertyChanged("version");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
private string _version;
|
||
|
|
||
|
/// <summary>
|
||
|
/// usb device descritption
|
||
|
/// </summary>
|
||
|
public virtual string description
|
||
|
{
|
||
|
get { return _description; }
|
||
|
set
|
||
|
{
|
||
|
if (!Helper.AreEqual(value, _description))
|
||
|
{
|
||
|
_description = value;
|
||
|
Changed = true;
|
||
|
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;
|
||
|
Changed = true;
|
||
|
NotifyPropertyChanged("passthrough_enabled");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
private bool _passthrough_enabled;
|
||
|
|
||
|
/// <summary>
|
||
|
/// additional configuration
|
||
|
/// </summary>
|
||
|
public virtual Dictionary<string, string> other_config
|
||
|
{
|
||
|
get { return _other_config; }
|
||
|
set
|
||
|
{
|
||
|
if (!Helper.AreEqual(value, _other_config))
|
||
|
{
|
||
|
_other_config = value;
|
||
|
Changed = true;
|
||
|
NotifyPropertyChanged("other_config");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
private Dictionary<string, string> _other_config;
|
||
|
}
|
||
|
}
|