【问题标题】:Motorola MC55 Unique ID摩托罗拉 MC55 唯一 ID
【发布时间】:2011-09-20 09:10:51
【问题描述】:

在摩托罗拉 MC55 中,我想获取扫描仪的工厂或唯一 ID 或序列号。如何在 vb.net 中编码?

【问题讨论】:

    标签: vb.net windows-mobile unique-key


    【解决方案1】:

    因为它是一个移动设备,它会有一个IMEI 号码,那怎么样?您可以使用ATD*#06# 或AT++CGSN 检索它。

    【讨论】:

    • 但是您需要在调制解调器上插入 SIM 卡。
    • IMEI 是内置值,是吗? @Alex K.,我们怎么能得到它?我们需要使用任何第三方吗?
    • 你是如何与设备交互的?
    【解决方案2】:

    您可以通过 P/Invoke 获取设备的 DeviceUniqueID

     //DeviceID for Win Mobile >= 5.0
        [DllImport("coredll.dll")]
        private extern static int GetDeviceUniqueID([In, Out] byte[] appdata, int cbApplictionData, int dwDeviceIDVersion,
                                                    [In, Out] byte[] deviceIDOuput, out uint pcbDeviceIDOutput);
    
    
    
    
      private static string getDeviceID()
        {
                string appString = "Your App Name";
                byte[] appData = new byte[appString.Length];
                for (int count = 0; count < appString.Length; count++)
                {
                    appData[count] = (byte)appString[count];
                }
    
                int appDataSize = appData.Length;
                byte[] DeviceOutput = new byte[20];
                uint SizeOut = 20;
                GetDeviceUniqueID(appData, appDataSize, 1, DeviceOutput, out SizeOut);
    
                string idString = "";
                for (int i = 0; i < DeviceOutput.Length; i++)
                {
                    if (i == 4 || i == 6 || i == 8 || i == 10)
                        idString = String.Format("{0}-{1}", idString, DeviceOutput[i].ToString("x2"));
                    else
                        idString = String.Format("{0}{1}", idString, DeviceOutput[i].ToString("x2"));
                }
                return idString;
    
        }
    

    编辑:注意这是一个 C# 解决方案,很抱歉起初我没有看到您想要 VB 解决方案,但对于任何想要 C# 解决方案的人来说,这应该适合您。

    【讨论】:

      猜你喜欢
      • 2011-08-05
      • 1970-01-01
      • 2014-02-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多