如何使用Windows IOT获取Raspberry PI 2的处理器序列号 [英] How to get the processor serial number of Raspberry PI 2 with Windows IOT

查看:113
本文介绍了如何使用Windows IOT获取Raspberry PI 2的处理器序列号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要获取运行Windows 10 IoT的Raspberry Pi2的处理器序列号.

I need to get the processor serial number of a Raspberry Pi2 that is running windows 10 IoT.

推荐答案

通常,它位于Windows.System.Profile.HardwareIdentification命名空间内.不幸的是,这是Win10 IoT Core不支持的命名空间之一.

Usually this is within the Windows.System.Profile.HardwareIdentification namespace. Unfortunately, that's one of the unsupported namespaces with Win10 IoT Core.

相反,为了识别金属,我使用的是来自网络适配器的信息:

Instead, to identify the metal, I'm using info from the network adaptor(s):

    public static HashSet<string> NetworkIds()
    {
        var result = new HashSet<string>();

        var networkProfiles = Windows.Networking.Connectivity.NetworkInformation.GetConnectionProfiles().ToList();

        foreach (var net in networkProfiles)
        {
            result.Add(net.NetworkAdapter.NetworkAdapterId.ToString());
        }

        return result;
    }

当然,这并不是完全防错的,但到目前为止,这是我看到的获得合理可靠的设备ID的唯一方法.

Of course, this is not completely error proof, but, so far, the only way I can see to get a reasonably reliable device ID.

这篇关于如何使用Windows IOT获取Raspberry PI 2的处理器序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆