裝置資訊屬性Device information properties

重要 APIImportant APIs

每個裝置都具有相關聯的 DeviceInformation 屬性,您可以在需要特定資訊或正在建置裝置選取器時使用。Each device has associated DeviceInformation properties that you can use when you need specific information or when you are building a device selector. 這些屬性可以指定為 AQS 篩選器來限制您正在列舉的裝置,以便尋找具有指定特性的裝置。These properties can be specified an AQS filter to limit the devices that you are enumerating over in order to find the devices with the specified traits. 您也可以使用這些屬性,來指定要針對每個裝置傳回的資訊。You can also use these properties to indicate what information you want returned for each device. 這可讓您指定要傳回給應用程式的裝置資訊。That enables you to specify the device information that is returned to your application.

如需在裝置選取器中使用 DeviceInformation 屬性的詳細資訊,請參閱建置裝置選取器For more information about using DeviceInformation properties in your device selector, see Build a device selector. 本主題說明如何要求資訊屬性,同時也會列出一些常見的屬性及其用途。This topic goes into how to request information properties and also lists some common properties and their purpose.

DeviceInformation 物件是由一個身分識別 (DeviceInformation.Id)、一個類型 (DeviceInformation.Kind) 及一個屬性包 (DeviceInformation.Properties) 所組成。A DeviceInformation object is composed of an identity (DeviceInformation.Id), a kind (DeviceInformation.Kind), and a property bag (DeviceInformation.Properties). DeviceInformation 物件的所有其他屬性均衍生自 Properties 屬性包。All of the other properties of a DeviceInformation object are derived from the Properties property bag. 例如,Name 是衍生自 System.ItemNameDisplayFor example, Name is derived from System.ItemNameDisplay. 這表示屬性包一律包含判斷其他屬性所需的資訊。This means that the property bag always contains the information necessary to determine the other properties.

正在要求屬性Requesting properties

DeviceInformation 物件擁有一些基本屬性,例如 IdKind,但是大部分的屬性會儲存在 Properties 底下的屬性包中。A DeviceInformation object has some basic properties, such as Id and Kind, but most of the properties are stored in a property bag under Properties. 因此,屬性包會包含用來從屬性包找出屬性的屬性。Because of this, the property bag contains the properties used to source the properties out of the property bag. 例如,使用 System.ItemNameDisplay 來找出 Name 屬性。For example, use System.ItemNameDisplay to source the Name property. 這是具有使用者易記名稱的通用和已知屬性的案例。This is a case of a common and well-known property that has a user-friendly name. Windows 提供數個使用者易記的名稱,讓查詢屬性更加容易。Windows provides several of these user-friendly names to make querying for properties easier.

當您正在要求屬性時,並不會受限於具有使用者易記名稱的通用屬性。When you are requesting properties, you are not limited to the common properties with user-friendly names. 您可以指定基本的 GUID 和屬性識別碼 (PID) 來要求任何可用的屬性,甚至是個別裝置或驅動程式所提供的自訂屬性。You can specify the underlying GUID and property ID (PID) to request any property that is available, even custom properties that are supplied by an individual device or driver. 指定自訂屬性的格式是 "{GUID} PID"。The format for specifying a custom property is "{GUID} PID". 例如: " {744e3bed-3684-4e16-9f8a-07953a8bf2ab} 7 "。For example: "{744e3bed-3684-4e16-9f8a-07953a8bf2ab} 7".

注意

您可以在設備磁碟機的 device 屬性 key 標頭檔中找到屬性 Guid 清單。You can find the list of property GUIDs in the device property key header file of the device driver.

某些屬性在所有 DeviceInformationKind 物件中是通用的,但大部分都是特定類型獨有的。Some properties are common across all DeviceInformationKind objects, but most are unique to a specific kind. 下列區段會列出一些按個別 DeviceInformationKind 排序的通用屬性。The following sections list some common properties sorted by the individual DeviceInformationKind. 如需不同類型如何彼此關聯的詳細資訊,請參閱 DeviceInformationKindFor more information about how the different kinds relate to one another, see DeviceInformationKind.

DeviceInterface 屬性DeviceInterface properties

DeviceInterface 是預設值,並且是 app 案例中最常使用的 DeviceInformationKind 物件。DeviceInterface is the default and most common DeviceInformationKind object used in app scenarios. 除非裝置 API 指出不同的特定 DeviceInformationKind,否則這是您應該使用的物件類型。This is the kind of object that you should use unless the device API indicates a different specific DeviceInformationKind.

名稱Name 類型Type 說明Description
System.Devices.ContainerIdSystem.Devices.ContainerId GUIDGUID DeviceInformationKind.DeviceContainer 的身分識別,其中包含涵蓋這個 DeviceInterfaceDeviceIdentity of the DeviceInformationKind.DeviceContainer that contains the Device containing this DeviceInterface. 您可以將此值連同 DeviceInformationKind.DeviceContainer 傳遞至 CreateFromIdAsync,以尋找適當的容器。You can pass this value to CreateFromIdAsync along with DeviceInformationKind.DeviceContainer to find the appropriate container.
System.Devices.InterfaceClassGuidSystem.Devices.InterfaceClassGuid GUIDGUID 此介面代表的介面類別 GUID。The interface class GUID this interface represents.
System.Devices.DeviceInstanceIdSystem.Devices.DeviceInstanceId 字串String 父項 DeviceInformationKind.Device 的身分識別。Identity of the parent DeviceInformationKind.Device. 您可以將此值連同 DeviceInformationKind.Device 傳遞至 CreateFromIdAsync,以尋找適當的裝置。You can pass this value to CreateFromIdAsync along with DeviceInformationKind.Device to find the appropriate device.
System.Devices.InterfaceEnabledSystem.Devices.InterfaceEnabled BooleanBoolean 表示介面是否已啟用。Indicates if the interface is enabled. DeviceInformation.IsEnabled 衍生自此屬性。DeviceInformation.IsEnabled is derived from this property.
System.Devices.GlyphIconSystem.Devices.GlyphIcon 字串String 字符的圖示路徑。Icon path for the glyph.
System.Devices.IsDefaultSystem.Devices.IsDefault BooleanBoolean 表示這是否是 System.Devices.InterfaceClassGuid 的預設裝置。Indicates whether this is the default device for the System.Devices.InterfaceClassGuid. 這通常用於印表機。This is mainly used for printers. 由於有多個音訊預設值,因此這不適用於音訊。This does not work for audio since there are multiple audio defaults. 使用 GetDefaultAudioRenderIdGetDefaultAudioCaptureId 來取得音訊預設值。Use GetDefaultAudioRenderId or GetDefaultAudioCaptureId to get audio defaults.
System.Devices.IconSystem.Devices.Icon 字串String 圖示路徑。Icon path.
System.ItemNameDisplaySystem.ItemNameDisplay 字串String 裝置物件的最佳顯示名稱。The best display name for the device object.

 

裝置屬性Device properties

名稱Name 類型Type 說明Description
System.Devices.ClassGuidSystem.Devices.ClassGuid GUIDGUID 裝置安裝期間使用的裝置類別。Device class used during device installation. 如需詳細資訊,請參閱裝置安裝類別For more information, see Device Setup Classes.
System.Devices.CompatibleIdsSystem.Devices.CompatibleIds String[]String[] 裝置的相容識別碼。The compatible ids of the device. Windows 判斷要安裝在裝置上的最佳驅動程式時會用到這些資訊。These are used when Windows is determining the best driver to install on the device. 如需詳細資訊,請參閱相容識別碼For more information, see Compatible ID.
System.Devices.ContainerIdSystem.Devices.ContainerId GUIDGUID 包含此裝置之 DeviceInformationKind.DeviceContainer 的身分識別。Identity of the DeviceInformationKind.DeviceContainer that includes this device. 您可以將此值連同 DeviceInformationKind.DeviceContainer 傳遞至 CreateFromIdAsync,以尋找適當的容器。You can pass this value to CreateFromIdAsync along with DeviceInformationKind.DeviceContainer to find the appropriate container.
System.Devices.DeviceCapabilitiesSystem.Devices.DeviceCapabilities UInt32UInt32 _ _ 在CfgMgr32中定義之 CM DEVCAP X 功能旗標的位 or。A bitwise-OR of the CM_DEVCAP_X capabilities flags that are defined in CfgMgr32.h. 如需詳細資訊,請參閱 DEVPKEY _ 裝置 _ 功能For more information, see DEVPKEY_Device_Capabilities.
System.Devices.DeviceHasProblemSystem.Devices.DeviceHasProblem BooleanBoolean 裝置目前出現問題且很可能無法正常運作。The device currently has a problem and is likely not functioning correctly. 這可能是因為過期、遺漏或不正確的驅動程式所導致。This could be due to an outdated, missing, or invalid driver.
System.Devices.DeviceInstanceIdSystem.Devices.DeviceInstanceId 字串String 裝置的身分識別。The identity of the device. 這也會是 DeviceInformation.Id 的值。This is also the value of DeviceInformation.Id.
System.Devices.DeviceManufacturerSystem.Devices.DeviceManufacturer 字串String 裝置的製造商。The manufacturer of the device.
System.Devices.HardwareIdsSystem.Devices.HardwareIds String[]String[] 裝置的硬體識別碼。The hardware ids of the device. Windows 在判斷要安裝的最佳驅動程式時會用到這些識別碼。Windows uses these ids when determining the best driver to install. 裝置廠商可以使用這個屬性,從他們的 app 中識別他們的裝置。Device vendors can use this property to identify their device from their app. 如需詳細資訊,請參閱硬體識別碼For more information, see Hardware ID.
System.Devices.ParentSystem.Devices.Parent 字串String 父項裝置的 DeviceInformation.IdThe DeviceInformation.Id of the parent device. 這是指連線父項,不是 DeviceContainer 父項。This is the connection parent, not the DeviceContainer parent.
System.Devices.PresentSystem.Devices.Present BooleanBoolean 表示裝置目前是否存在並可以使用。Indicates whether the device is currently present and available.
System.ItemNameDisplaySystem.ItemNameDisplay 字串String 此裝置物件的最佳顯示名稱。The best display name for this device object. 在此案例中,這不一定是最佳的使用者名稱。In this case, this is not necessarily the best name for users. 藉由參考相關聯的 DeviceContainerDeviceInterfaceSystem.ItemNameDisplay,就能找到更有可能的使用者易記名稱候選項目。A more likely candidate for a user-friendly name could be found by referencing the System.ItemNameDisplay of the associated DeviceContainer or DeviceInterface.

 

DeviceContainer 屬性DeviceContainer properties

名稱Name 類型Type 說明Description
System.Devices.CategorySystem.Devices.Category String[]String[] 裝置所屬類別的說明清單。A list of descriptions of the categories the device belongs to. 這份清單會以單數類別的形式提供。This list is provided as singular categories. 例如,「顯示器」、「電話」或「音訊裝置」。For example, "Display", "Phone", or "Audio device".
System.Devices.CategoryIdsSystem.Devices.CategoryIds String[]String[] 包含此裝置所屬類別的清單。Contains a list of categories this device belongs to. 例如,Audio.HeadphoneDisplay.MonitorInput.GamingFor example, Audio.Headphone, Display.Monitor, or Input.Gaming.
System.Devices.CategoryPluralSystem.Devices.CategoryPlural String[]String[] 裝置所屬類別的說明清單。A list of descriptions of the categories the device belongs to. 這份清單會以複數類別的形式提供。This list is provided as plural categories. 例如,「顯示器」、「電話」或「音訊裝置」。For example, "Displays", "Phones", or "Audio devices".
System.Devices.CompatibleIdsSystem.Devices.CompatibleIds String[]String[] 所有子項 DeviceInformationKind.Device 物件的相容識別碼集合。The collection of compatible ids for all the child DeviceInformationKind.Device objects.
System.Devices.ConnectedSystem.Devices.Connected BooleanBoolean 表示裝置目前是否與系統連線。Indicates whether the device is currently connected to the system or not.
System.Devices.GlyphIconSystem.Devices.GlyphIcon 字串String 字符的圖示路徑。Icon path for the glyph.
System.Devices.HardwareIdsSystem.Devices.HardwareIds String[]String[] 所有子項 DeviceInformationKind.Device 物件的硬體識別碼集合。The collection of hardware ids for all the child DeviceInformationKind.Device objects.
System.Devices.IconSystem.Devices.Icon 字串String 圖示路徑。Icon path.
System.Devices.LocalMachineSystem.Devices.LocalMachine BooleanBoolean 如果這個 DeviceContainer 代表系統本身則為 true;如果裝置不在系統內則為 falseTrue if this DeviceContainer represents the system itself, false if the device is external to the system.
System.Devices.ManufacturerSystem.Devices.Manufacturer 字串String 裝置的製造商。The manufacturer of the device.
System.Devices.ModelNameSystem.Devices.ModelName 字串String 裝置容器的型號名稱。Model name of the device container.
System.Devices.PairedSystem.Devices.Paired BooleanBoolean 表示目前已與系統配對的任何子項 DeviceInformationKind.Device 物件是無線還是網路裝置。Indicates whether any of the child DeviceInformationKind.Device objects are wireless or network devices that are currently paired with the system.
System.ItemNameDisplaySystem.ItemNameDisplay 字串String 此裝置的最佳顯示名稱。The best display name for this device.

 

DeviceInterfaceClass 屬性DeviceInterfaceClass properties

名稱Name 類型Type 說明Description
System.ItemNameDisplaySystem.ItemNameDisplay 字串String 此裝置的最佳顯示名稱。The best display name for this device.

 

DevicePanel 屬性DevicePanel properties

名稱Name 類型Type 說明Description
PanelId。System.Devices.Panel.PanelId 字串String DevicePanel物件的識別碼。The identifier of the DevicePanel object.
PanelGroup。System.Devices.Panel.PanelGroup 字串String PanelGroup的識別碼。The identifier of the parent PanelGroup.

AssociationEndpoint 屬性AssociationEndpoint properties

名稱Name 類型Type 說明Description
System.Devices.Aep.AepIdSystem.Devices.Aep.AepId 字串String 此裝置的身分識別。Identity of this device. 這也會是 DeviceInformation.Id 的值。This is also the value of DeviceInformation.Id.
System.Devices.Aep.CanPairSystem.Devices.Aep.CanPair BooleanBoolean 表示裝置是否可與系統配對。Indicates if the device can be paired with the system or not. DeviceInformationPairing.CanPair 衍生自此屬性。DeviceInformationPairing.CanPair is derived from this property.
System.Devices.Aep.CategorySystem.Devices.Aep.Category String[]String[] 裝置的所屬類別。The categories that the device is part of. 例如,印表機或相機。For example, printer or camera.
System.Devices.Aep.ContainerIdSystem.Devices.Aep.ContainerId GUIDGUID 父項 AssociationEndpointContainer 物件的識別碼。The id of the parent AssociationEndpointContainer object.
System.Devices.Aep.DeviceAddressSystem.Devices.Aep.DeviceAddress 字串String 裝置的位址。The address of the device. 如果裝置為網路裝置,則這會是 IP 位址。If the device is a network device, this is the IP address.
System.Devices.Aep.IsConnectedSystem.Devices.Aep.IsConnected BooleanBoolean 表示裝置目前是否與系統連線。Indicates if the device is currently connected to the system.
System.Devices.Aep.IsPairedSystem.Devices.Aep.IsPaired BooleanBoolean 表示裝置目前是否已配對。Indicates if the device is currently paired. DeviceInformationPairing.IsPaired 衍生自此屬性。DeviceInformationPairing.IsPaired is derived from this property.
System.Devices.Aep.IsPresentSystem.Devices.Aep.IsPresent BooleanBoolean 指出裝置目前是否存在,這表示該裝置存在且可透過網路或無線通訊協定來探索。Indicates if the device is currently present, meaning the device is live and discovered over the network or wireless protocol. 一旦裝置與系統配對後,系統便會快取裝置。Once a device has been paired with the system, the device is cached. 之後,查詢 AssociationEndpoint 物件時,系統便會自動探索裝置。After this, the device will be automatically discovered when querying for AssociationEndpoint objects. 因此,您不能依賴只使用查詢來探索裝置,以指出裝置目前是否可供使用。Because of this, you cannot rely on just discovering the device with a query to indicate whether or not it is currently usable. 這就是為什麼這個屬性很重要的原因。That is why this property is important.
System.Devices.Aep.ManufacturerSystem.Devices.Aep.Manufacturer 字串String 裝置的製造商。The manufacturer of the device.
System.Devices.Aep.ModelIdSystem.Devices.Aep.ModelId GUIDGUID 裝置的型號識別碼。The model id of the device.
System.Devices.Aep.ModelNameSystem.Devices.Aep.ModelName 字串String 裝置的型號名稱。The model name of the device.
System.Devices.Aep.ProtocolIdSystem.Devices.Aep.ProtocolId GUIDGUID 表示用來探索此 AssocationEndpoint 裝置的通訊協定。Indicates the protocol used to discover this AssocationEndpoint device.
System.Devices.Aep.SignalStrengthSystem.Devices.Aep.SignalStrength Int32Int32 裝置的訊號強度。The signal strength of the device. 這個屬性僅適用於某些通訊協定。This property is only applicable for some protocols.
System.ItemNameDisplaySystem.ItemNameDisplay 字串String 裝置的最佳顯示名稱。The best display name for the device.

 

AssociationEndpointContainer 屬性AssociationEndpointContainer properties

名稱Name 類型Type 說明Description
System.Devices.AepContainer.CategoriesSystem.Devices.AepContainer.Categories String[]String[] 裝置的所屬類別。The categories that the device is part of. 例如,印表機或相機。For example, printer or camera.
System.Devices.AepContainer.ChildrenSystem.Devices.AepContainer.Children String[]String[] 屬於這個容器之 AssocationEndpoint 物件的識別碼集合。The collection of ids for the AssocationEndpoint objects that are part of this container.
System.Devices.AepContainer.CanPairSystem.Devices.AepContainer.CanPair BooleanBoolean 表示其中一個子項 AssociationEndpoint 裝置是否可與系統配對。Indicates if one of the child AssociationEndpoint devices can be paired with the system or not. DeviceInformationPairing.CanPair 衍生自此屬性。DeviceInformationPairing.CanPair is derived from this property.
System.Devices.AepContainer.ContainerIdSystem.Devices.AepContainer.ContainerId GUIDGUID 此裝置的身分識別。Identity of this device. 這也會是 DeviceInformation.Id 的值 (但採用 GUID 形式)。This is also the value of DeviceInformation.Id, but in GUID form.
System.Devices.AepContainer.IsPairedSystem.Devices.AepContainer.IsPaired BooleanBoolean 表示目前是否已與其中一個子項 AssociationEndpoint 裝置配對。Indicates if one of the child AssociationEndpoint devices is currently paired. DeviceInformationPairing.IsPaired 衍生自此屬性。DeviceInformationPairing.IsPaired is derived from this property.
System.Devices.AepContainer.IsPresentSystem.Devices.AepContainer.IsPresent BooleanBoolean 指出其中一個子項 AssociationEndpoint 裝置目前是否存在,這表示該裝置存在且可透過網路或無線通訊協定來探索。Indicates if one of the child AssociationEndpoint devices is currently present, meaning the device is live and discovered over the network or wireless protocol. 一旦裝置與系統配對後,系統便會快取裝置。Once a device has been paired with the system, the device is cached. 之後,查詢 AssociationEndpoint 物件時,系統便會自動探索裝置。After this, the device will be automatically discovered when querying for AssociationEndpoint objects. 因此,您不能依賴只使用查詢來探索裝置,以指出裝置目前是否可供使用。Because of this, you cannot rely on just discovering the device with a query to indicate whether or not it is currently usable. 這就是為什麼這個屬性很重要的原因。That is why this property is important.
System.Devices.AepContainer.ManufacturerSystem.Devices.AepContainer.Manufacturer 字串String 裝置的製造商。The manufacturer of the device.
System.Devices.AepContainer.ModelIdsSystem.Devices.AepContainer.ModelIds String[]String[] 裝置的型號識別碼清單。A list of model ids for the device. 每個型號都是採用字串形式的 GUID。Each model is a GUID in string form.
System.Devices.AepContainer.ModelNameSystem.Devices.AepContainer.ModelName 字串String 裝置的型號名稱。The model name of the device.
System.Devices.AepContainer.ProtocolIdsSystem.Devices.AepContainer.ProtocolIds Guid[]GUID[] 協助建置 AssociationEndpointContainer 物件的通訊協定識別碼清單。A list of protocol ids that have contributed to building this AssociationEndpointContainer object. 請記住,AssociationEndpointContainer 裝置的建立方式是,針對同一個實體裝置收集所有透過不同通訊協定探索到的 AssociationEndpoint 裝置來建立。Keep in mind that an AssociationEndpointContainer device is created by collecting all AssociationEndpoint devices discovered over different protocols for the same physical device.
System.Devices.AepContainer.SupportedUriSchemesSystem.Devices.AepContainer.SupportedUriSchemes String[]String[] 此裝置支援的傳播 URI 配置清單。List of casting URI schemes supported by this device.
System.Devices.AepContainer.SupportsAudioSystem.Devices.AepContainer.SupportsAudio BooleanBoolean 表示此裝置是否支援音效傳播。Indicates if this device supports audio casting.
System.Devices.AepContainer.SupportsImagesSystem.Devices.AepContainer.SupportsImages BooleanBoolean 表示此裝置是否支援影像傳播。Indicates if this device supports image casting.
System.Devices.AepContainer.SupportsVideoSystem.Devices.AepContainer.SupportsVideo BooleanBoolean 表示此裝置是否支援視訊傳播。Indicates if this device supports video casting.
System.ItemNameDisplaySystem.ItemNameDisplay 字串String 裝置的最佳顯示名稱。The best display name for the device.

 

AssociationEndpointService 屬性AssociationEndpointService properties

名稱Name 類型Type 說明Description
System.Devices.AepService.AepIdSystem.Devices.AepService.AepId 字串String 父項 AssociationEndpoint 物件的識別碼。The identifier of the parent AssociationEndpoint object.
System.Devices.AepService.ContainerIdSystem.Devices.AepService.ContainerId GUIDGUID 父項 AssociationEndpointContainer 物件的識別碼。The identifier of the parent AssociationEndpointContainer object.
System.Devices.AepService.ParentAepIsPairedSystem.Devices.AepService.ParentAepIsPaired BooleanBoolean 表示父項 AssociationEndpoint 物件是否已與系統配對。Indicates whether the parent AssociationEndpoint object is paired with the system.
System.Devices.AepService.ProtocolIdSystem.Devices.AepService.ProtocolId GUIDGUID 用來探索此裝置的通訊協定身分識別。Identity of the protocol used to discover this device.
System.Devices.AepService.ServiceClassIdSystem.Devices.AepService.ServiceClassId GUIDGUID 此裝置所代表的服務身分識別。Iidentity of the service represented by this device.
AepService. ServiceIdSystem.Devices.AepService.ServiceId 字串String 此服務的身分識別。Identity of this service. 這也會是 DeviceInformation.Id 的值。This is also the value of DeviceInformation.Id.
System.ItemNameDisplaySystem.ItemNameDisplay 字串String 服務的最佳顯示名稱。The best display name for the service.