How to get the serial number of a Motorola mobile device (Symbol)?

How to get the serial number of a Motorola mobile device (Symbol)?

I am programming the Motorola ES400, which comes with the Symbol libraries.

There seem to be ways to get the serial numbers of the various scanners, but not the device itself!

Does anyone have any ideas?


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

+3
source share
4 answers

MC9090, Symbol ( , , , ). , , . :

:

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

, !

+4

, . Symbol SDK !

:

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

        return Version.ESN;
0

:

            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();
0

VB.Net:

Symbol.ResourceCoordination.dll( : C:\Program Files\Motorola EMDK .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)

Works great on our MC3190S scanners! :)

0
source

Source: https://habr.com/ru/post/1782919/


All Articles