/// <summary> /// Initialize the ISkill member instance if does not exists or conform to the specified device as well as the ISkillBinding member instance /// </summary> /// <param name="device"></param> /// <returns></returns> public async Task InitializeSkillAsync(ISkillExecutionDevice device = null) { if (Skill == null || device != null && Skill.Device != device) { Skill = await Descriptor.CreateSkillAsync(device); Binding = await Skill.CreateSkillBindingAsync(); } }
/// <summary> /// Initialize the ObjectTracker skill /// </summary> /// <param name="device"></param> /// <returns></returns> private async Task InitializeObjectTrackerAsync(ISkillExecutionDevice device = null) { if (device != null) { m_trackerSkill = await m_trackerDescriptor.CreateSkillAsync(device) as ObjectTrackerSkill; } else { m_trackerSkill = await m_trackerDescriptor.CreateSkillAsync() as ObjectTrackerSkill; } m_trackerBindings = new List <ObjectTrackerBinding>(); m_trackerHistories = new List <Queue <TrackerResult> >(); }
/// <summary> /// Initialize the skill related members /// </summary> /// <param name="executionDevice"></param> /// <returns></returns> private async Task InitializeSkillAsync(ISkillExecutionDevice executionDevice = null) { m_descriptor = new ObjectTrackerDescriptor(); m_availableExecutionDevices = await m_descriptor.GetSupportedExecutionDevicesAsync(); if (m_availableExecutionDevices.Count == 0) { NotifyUser("No execution devices available, this skill cannot run on this device", NotifyType.ErrorMessage); return; // Abort } // Either create skill using provided execution device or let skill create with default device if none provided if (executionDevice != null) { m_skill = await m_descriptor.CreateSkillAsync(executionDevice) as ObjectTrackerSkill; } else { m_skill = await m_descriptor.CreateSkillAsync() as ObjectTrackerSkill; } m_bindings = new List <ObjectTrackerBinding>(); m_trackerHistory = new List <Queue <TrackerResult> >(); }
public SkillExecutionDeviceWrappper(ISkillExecutionDevice device) { Device = device; }
/// <summary> /// Get a list of strings extracted from the ISkillExecutionDevice describing it /// </summary> /// <param name="desc"></param> /// <returns></returns> public static List <KeyValuePair <string, string> > GetSkillExecutionDeviceStrings(ISkillExecutionDevice device) { if (device == null) { return(new List <KeyValuePair <string, string> >()); } List <KeyValuePair <string, string> > result = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("Name", $"{device.Name}"), new KeyValuePair <string, string>("Kind", $"{device.ExecutionDeviceKind}"), }; if (device is SkillExecutionDeviceCPU) { SkillExecutionDeviceCPU cpuDevice = device as SkillExecutionDeviceCPU; result.Add(new KeyValuePair <string, string>("CoreCount", $"{cpuDevice.CoreCount}")); } else if (device is SkillExecutionDeviceDirectX) { SkillExecutionDeviceDirectX directXDevice = device as SkillExecutionDeviceDirectX; result.Add(new KeyValuePair <string, string>("DedicatedVideoMemory", $"{directXDevice.DedicatedVideoMemory}")); result.Add(new KeyValuePair <string, string>("MaxSupportedFeatureLevel", $"{directXDevice.MaxSupportedFeatureLevel}")); result.Add(new KeyValuePair <string, string>("IsDefault", $"{directXDevice.IsDefault}")); result.Add(new KeyValuePair <string, string>("HighPerformanceIndex", $"{directXDevice.HighPerformanceIndex}")); result.Add(new KeyValuePair <string, string>("PowerSavingIndex", $"{directXDevice.PowerSavingIndex}")); result.Add(new KeyValuePair <string, string>("AdapterId", $"{directXDevice.AdapterId}")); } return(result); }