Motorola MC55 Unique ID
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.
精彩评论