开发者

Motorola MC55 Unique ID

开发者 https://www.devze.com 2023-04-06 06:33 出处:网络
In Motorola MC55, I\'d like to get the factory or unique id or serial no of the scanner. How to 开发者_C百科code it in vb.net?Since its a piece of mobile equipment it will have an IMEI number, so how

In Motorola MC55, I'd like to get the factory or unique id or serial no of the scanner. How to 开发者_C百科code it in vb.net?


Since its a piece of mobile equipment it will have an IMEI number, so how about that? You can retreive it with ATD*#06# or AT++CGSN.


You could P/Invoke to get the DeviceUniqueID of the device

 //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;

    }

EDIT: NOTE this is a C# solution sorry at first i did not see that you wanted VB solution, but for anyone wanting a C# solution, this should work for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号