As Paul said, some of these things require PInvoke's. Others are available directly from the OS or the EMDK.
/////////////////////////////////////// #region Terminal information /// /// Get the OEM string data /// ///
class NativeMethods { /// /// P/Invoke to get the SystemParametersInfo /// /// /// /// /// /// [DllImport("coredll.dll")]
public static extern int SystemParametersInfo(int uiAction, int uiParam, string pvParam, int fWinIni);
/// /// P/Invoke for the OEM Version Number /// /// /// /// [DllImport("CAD.dll")] public static extern int CAD_GetOemVersionNumber(out IntPtr iVerMaj, out IntPtr iVerMin);
/// /// P/Invoke for the OEM Build Number /// /// /// [DllImport("CAD.dll")]
public static extern int CAD_GetOemBuildNumber(out IntPtr iBuild); /// /// Constant to get the OEM info ///
Hi, Not sure there are C# calls to do this but you can PINVOKE some C calls to get this in CAD.dll CAD_GetOemVersionNumber CAD_GetOemBuildNumber CAD_GetLoaderVersionNumber There are some examples in the C EMDK look in C:\PROGRAM FILES\Motorola EMDK for C\v2.1\Samples\C\Standard\SysInfoSample\SysInfoSample.c also attached.
2 Replies
As Paul said, some of these things require PInvoke's. Others are available directly from the OS or the EMDK.
/////////////////////////////////////// #region Terminal information /// /// Get the OEM string data /// ///
private static string GetTerminalInfo() { string szOEMInfo = " "; string strOEMInfo = ""; // Get OEM Info if (NativeMethods.SystemParametersInfo(NativeMethods.SPI_GETOEMINFO, szOEMInfo.Length, szOEMInfo, 0) != 0)
strOEMInfo = szOEMInfo.Substring(0, szOEMInfo.IndexOf(
'\0'));
return strOEMInfo; }
/// /// Get the OS version /// ///
private static string GetOSInfo() { System.OperatingSystem osInfo = System.Environment.OSVersion;
return osInfo.Version.ToString(); }
/// /// Get the Electronic Serial Number /// ///
private static string GetESNInfo() { Symbol.ResourceCoordination.TerminalInfo MyTerminalInfo = new Symbol.ResourceCoordination.TerminalInfo();
if (MyTerminalInfo.ESN != null) { return MyTerminalInfo.ESN.ToString(); } else { return ""; } }
/// /// Get the GUID for this terminal /// ///
private static string GetGUIDInfo() { Symbol.ResourceCoordination.TerminalInfo MyTerminalInfo = new Symbol.ResourceCoordination.TerminalInfo();
System.
Guid g = new Guid();
if (MyTerminalInfo.UniqueUnitID != null) g = new Guid(MyTerminalInfo.UniqueUnitID);
return ("{" + g.ToString() + "}"); }
/// /// Get the OEM data /// ///
private static string GetOEMInfo() { IntPtr iVerMaj = IntPtr.Zero; IntPtr iVerMin = IntPtr.Zero; IntPtr iBuild = IntPtr.Zero;
NativeMethods.CAD_GetOemVersionNumber(out iVerMaj, out iVerMin);
NativeMethods.CAD_GetOemBuildNumber(out iBuild);
return iVerMaj.ToString() + "." + iVerMin.ToString() + "." + iBuild.ToString(); }
class NativeMethods { /// /// P/Invoke to get the SystemParametersInfo /// /// /// /// /// /// [DllImport("coredll.dll")]
public static extern int SystemParametersInfo(int uiAction, int uiParam, string pvParam, int fWinIni);
/// /// P/Invoke for the OEM Version Number /// /// /// /// [DllImport("CAD.dll")] public static extern int CAD_GetOemVersionNumber(out IntPtr iVerMaj, out IntPtr iVerMin);
/// /// P/Invoke for the OEM Build Number /// /// /// [DllImport("CAD.dll")]
public static extern int CAD_GetOemBuildNumber(out IntPtr iBuild); /// /// Constant to get the OEM info ///
public const int SPI_GETOEMINFO = 258;
Hi, Not sure there are C# calls to do this but you can PINVOKE some C calls to get this in CAD.dll CAD_GetOemVersionNumber CAD_GetOemBuildNumber CAD_GetLoaderVersionNumber There are some examples in the C EMDK look in C:\PROGRAM FILES\Motorola EMDK for C\v2.1\Samples\C\Standard\SysInfoSample\SysInfoSample.c also attached.