如何获得摩托罗拉(Symbol)移动设备序列号? [英] How to obtain a Motorola (Symbol) Mobile Device Serial Number?

查看:24
本文介绍了如何获得摩托罗拉(Symbol)移动设备序列号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取摩托罗拉(Symbol)移动设备序列号?

How to obtain a Motorola (Symbol) Mobile Device Serial Number?

我正在编写带有符号"库的摩托罗拉 ES400.

I'm programming the Motorola ES400 which comes with "Symbol" libraries.

似乎有一些方法可以获得各种扫描仪的序列号,但没有获得实际设备本身的序列号!

There seems to be ways of getting the serial numbers of the various scanners, but not of the actual device itself!

有人有什么想法吗?

TerminalInfo 返回的序列号"(显示在设备上)和电子序列号"有什么区别?

Whats the difference between "serial number" (as shown on the device) and "electronic serial number" returned by TerminalInfo?

推荐答案

我刚刚在 MC9090 设备上解决了这个问题,它也使用了符号库(不确定它们是否相同,但这值得一试).我使用反射是因为我有来自不同制造商的设备并希望运行相同的代码.您可以直接从属性访问此字段或使用反射:

I just dealt with this on the MC9090 device, which also uses the Symbol libraries (not sure if they are the same, but this is worth a shot). I used reflection because I have devices from different manufacturers and want the same code to run. You could access this field directly from the property or use reflection:

这里是房产所在:

Symbol.ResourceCoordination.Terminalinfo.ESN

这是我使用反射的方法:

Here is my method using reflection:

try
        {                   
                Assembly symbolApi = Assembly.LoadFrom("Symbol.ResourceCoordination.dll");      

                Type terminalInfo = null;

                foreach (Type t in symbolApi.GetTypes())
                {
                    if (t.Name == "TerminalInfo")
                    {
                        terminalInfo = t;                       
                        break;
                    }
                }

                LogService.log(terminalInfo.Name);

                if (terminalInfo != null)
                {
                    object objTerminalInfo = Activator.CreateInstance(terminalInfo);

                    PropertyInfo esn = null;
                    foreach (PropertyInfo info in terminalInfo.GetProperties())
                    {                           
                        if (info.Name == "ESN")
                        {
                            esn = info;
                            break;
                        }
                    }

                    if (esn != null)
                    {
                        object objSn = esn.GetValue(objTerminalInfo, null);
                        sn = objSn.ToString();
                    }
                }
                else
                    LogService.log("TerminalInfo type not found in " + symbolApi.FullName);

        }
        catch (MissingFieldException e)
        {               
            LogService.log("MissingFieldException, not Symbol Unit: " + e.Message);
        }
        catch (Exception e)
        {
            LogService.log("Error in SymbolAPI: " + e.Message);
        }

希望这会有所帮助!

这篇关于如何获得摩托罗拉(Symbol)移动设备序列号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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