如何获取 Motorola (Symbol) 移动设备序列号?

发布于 2024-10-09 13:21:55 字数 197 浏览 8 评论 0原文

如何获取 Motorola (Symbol) 移动设备序列号?

我正在对带有“符号”库的摩托罗拉 ES400 进行编程。

似乎有多种方法可以获取各种扫描仪的序列号,但不能获取实际设备本身的序列号!

有人有什么想法吗?


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

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

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!

Anyone got any ideas?


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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

赴月观长安 2024-10-16 13:21:55

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

这是属性所在的位置:

Symbol.ResourceCoordination.Terminalinfo.ESN

这是我使用反射的方法:

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);
        }

希望这会有所帮助!

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:

Here is where the property is:

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);
        }

Hope this helps!

权谋诡计 2024-10-16 13:21:55

太棒了,谢谢。 Symbol SDK帮助搜索的时候没有找到这个!

刚刚使用:

Symbol.ResourceCoordination.TerminalInfo  Version = new Symbol.ResourceCoordination.TerminalInfo();

        return Version.ESN;

Thats fantatic, thanks. The Symbol SDK help didn't find this when searching!

Just used:

Symbol.ResourceCoordination.TerminalInfo  Version = new Symbol.ResourceCoordination.TerminalInfo();

        return Version.ESN;
木緿 2024-10-16 13:21:55

还发现了这个:

            Symbol.ResourceCoordination.TerminalInfo  Version = new Symbol.ResourceCoordination.TerminalInfo();

        System.Text.StringBuilder MyUUID = new StringBuilder("0x") ;

        if (Version.UniqueUnitID != null)
        {
            //this code is actually from the Motorola SDK guid 
            foreach (byte b in Version.UniqueUnitID)

                MyUUID.Append(b.ToString("X2"));

        }

        return MyUUID.ToString();

Also found this:

            Symbol.ResourceCoordination.TerminalInfo  Version = new Symbol.ResourceCoordination.TerminalInfo();

        System.Text.StringBuilder MyUUID = new StringBuilder("0x") ;

        if (Version.UniqueUnitID != null)
        {
            //this code is actually from the Motorola SDK guid 
            foreach (byte b in Version.UniqueUnitID)

                MyUUID.Append(b.ToString("X2"));

        }

        return MyUUID.ToString();
握住我的手 2024-10-16 13:21:55

这是快速简单的 VB.Net 解决方案:

添加对 Symbol.ResourceCoordination.dll 的引用(我在这里找到了我的:C:\Program Files\Motorola EMDK for .NET\v2.8\SDK\Smart Devices\Symbol.ResourceCoordination。 dll)。

然后使用以下代码访问ESN(电子序列号)值。

Dim Version As New Symbol.ResourceCoordination.TerminalInfo
MsgBox(Version.ESN)

在我们的 MC3190S 扫描仪上运行良好! :)

Here's the quick and easy VB.Net solution:

Add a reference to Symbol.ResourceCoordination.dll (I found mine here: C:\Program Files\Motorola EMDK for .NET\v2.8\SDK\Smart Devices\Symbol.ResourceCoordination.dll).

Then use the following code to access the ESN (Electronic Serial Number) value.

Dim Version As New Symbol.ResourceCoordination.TerminalInfo
MsgBox(Version.ESN)

Worked great on our MC3190S scanners! :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文