public void UnassignUSB(int id) { UsbdaemonProxy usbManager; ProxyBuilder.Create(out usbManager, DbusEndpointUriComponents.Create(EndpointBuilder)); usbManager.ProxyInterface.unassign_device(id); }
public IDictionary <int, XenUSB> GetUSB() { var list = new SortedList <int, XenUSB>(); string uuid = this.UUID; UsbdaemonProxy usbManager; ProxyBuilder.Create(out usbManager, DbusEndpointUriComponents.Create(EndpointBuilder)); int[] devices; usbManager.ProxyInterface.list_devices(out devices); string name; int stateID; USBState state; string vm_name; string detail; foreach (int device in devices) { usbManager.ProxyInterface.get_device_info(device, uuid, out name, out stateID, out vm_name, out detail); if (stateID < 0) { continue; } switch (stateID) { case 0: { state = USBState.Unassigned; break; } case 4: case 5: case 6: { state = USBState.Assigned; break; } default: { state = USBState.Unavailable; break; } } list.Add(device, new XenUSB() { State = state, Name = name, Description = detail, AssignedVM = vm_name }); } return(list); }
private void CreateSignalProxies() { ProxyBuilder.Create(out ConfigSignal, DbusEndpointUriComponents.Create(EndpointBuilder)); ProxyBuilder.Create(out StateSignal, DbusEndpointUriComponents.Create(EndpointBuilder)); ProxyBuilder.Create(out HostSignal, DbusEndpointUriComponents.Create(EndpointBuilder)); ProxyBuilder.Create(out UpdateSignal, DbusEndpointUriComponents.Create(EndpointBuilder)); ProxyBuilder.Create(out USBSignal, DbusEndpointUriComponents.Create(EndpointBuilder)); ProxyBuilder.Create(out RequestSignal, DbusEndpointUriComponents.Create(EndpointBuilder)); }
public bool XenStoreWrite(string path, string value) { XenClientGuestServiceProxy XenClientGuestService; ProxyBuilder.Create(out XenClientGuestService, DbusEndpointUriComponents.Create(EndpointBuilder)); try { return(XenClientGuestService.ProxyInterface.XenStoreWrite(path, value)); } finally { XenClientGuestService.Close(); } }
public void SetAcceleration(int a) { XenClientGuestServiceProxy XenClientGuestService; ProxyBuilder.Create(out XenClientGuestService, DbusEndpointUriComponents.Create(EndpointBuilder)); try { XenClientGuestService.ProxyInterface.SetAcceleration((uint)a); } finally { XenClientGuestService.Close(); } }
public bool SetAutorun(bool doToggle) { XenClientGuestServiceProxy XenClientGuestService; ProxyBuilder.Create(out XenClientGuestService, DbusEndpointUriComponents.Create(EndpointBuilder)); try { return(XenClientGuestService.ProxyInterface.TogglePluginAutorun(doToggle)); } finally { XenClientGuestService.Close(); } }
internal void OnRequestedAttention(object sender, RequestedAttentionArgs e) { VmProxy vmProxy; ProxyBuilder.Create(out vmProxy, DbusEndpointUriComponents.Create("com.citrix.xenclient.xenmgr", e.ObjPath.ToString())); int slot = vmProxy.ProxyInterface.slot; if (slot >= 0 && slot <= 9) { OnAlert("com.citrix.xenclient.xenmgr.host.guestreq", "requested_attention:switchable", new string[] { vmProxy.ProxyInterface.name, slot.ToString() }); } else { OnAlert("com.citrix.xenclient.xenmgr.host.guestreq", "requested_attention", new string[] { vmProxy.ProxyInterface.name, slot.ToString() }); } }
public void Switch(XenVM vm) { // Don't allow this VM to switch if it does not have focus. if (CheckVmFocus()) // If this vm has focus { com.citrix.xenclient.xenmgr.vm.wcf.Contracts.Clients.VmProxy switchVm; ProxyBuilder.Create(out switchVm, DbusEndpointUriComponents.Create(EndpointBuilder, "com.citrix.xenclient.xenmgr", vm.Path.Path)); try { switchVm.ProxyInterface.@switch(); } finally { switchVm.Close(); } } // Ends if this vm has focus }
private bool CheckVmFocus() { com.citrix.xenclient.input.wcf.Contracts.Clients.InputProxy input; ProxyBuilder.Create(out input, DbusEndpointUriComponents.CreateForPath(EndpointBuilder, "/")); com.citrix.xenclient.xenmgr.wcf.Contracts.Clients.XenmgrProxy xenmgr; ProxyBuilder.Create(out xenmgr, DbusEndpointUriComponents.CreateForPath(EndpointBuilder, "/")); bool gotFocus = false; try { // Get the focus vm's domid. Int32 focusDomid; input.ProxyInterface.get_focus_domid(out focusDomid); Udbus.Types.UdbusObjectPath pathFocusVm; // Find the focus vm's path from the domid. xenmgr.ProxyInterface.find_vm_by_domid(focusDomid, out pathFocusVm); com.citrix.xenclient.xenmgr.vm.wcf.Contracts.Clients.VmProxy focusVm; ProxyBuilder.Create(out focusVm, DbusEndpointUriComponents.Create(EndpointBuilder, "com.citrix.xenclient.xenmgr", pathFocusVm.Path)); try { // See if the focus vm's uuid matches our uuid. gotFocus = focusVm.ProxyInterface.uuid == this.UUID; } finally { focusVm.Close(); } } finally { input.Close(); xenmgr.Close(); } return(gotFocus); }
public IDictionary <int, XenVM> GetVMs() { var list = new SortedList <int, XenVM>(); XenmgrProxy vmManager; UdbusObjectPath[] vmPaths; ProxyBuilder.Create(out vmManager, DbusEndpointUriComponents.Create(EndpointBuilder)); vmManager.ProxyInterface.list_vms(out vmPaths); VmProxy vmProxy; string type; Image image = null; int slot; foreach (Udbus.Types.UdbusObjectPath path in vmPaths) { ProxyBuilder.Create(out vmProxy, DbusEndpointUriComponents.Create(EndpointBuilder, "com.citrix.xenclient.xenmgr", path.Path)); bool hidden = false; if (vmProxy.ProxyInterface.slot != 0) // If not uivm { // Hidden if hidden :) if (vmProxy.ProxyInterface.hidden_in_ui) { continue; } // Hidden if not running if (vmProxy.ProxyInterface.state != "running") { continue; } // Hidden if not user VM type type = vmProxy.ProxyInterface.type; if (type != "svm" && type != "pvm") { continue; } image = getImage(vmProxy); } // Ends if not uivm else // Else uivm { type = vmProxy.ProxyInterface.type; hidden = true; } // Ends else uivm slot = vmProxy.ProxyInterface.slot; // Hidden if out of range if (slot > 9) { continue; } list.Add(slot, new XenVM() { Hidden = hidden, Image = image, Name = vmProxy.ProxyInterface.name, Slot = slot, UUID = vmProxy.ProxyInterface.uuid, Path = path }); } return(list); }