2 * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Runtime.InteropServices;
22 [StructLayout(LayoutKind.Sequential)]
23 internal struct MiscVersionInfoStruct
26 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MaxVersionLen)]
27 internal string SwVersion;
28 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MaxVersionLen)]
29 internal string HwVersion;
30 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MaxVersionLen)]
31 internal string CalDate;
32 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscProdCodeMaxLen)]
33 internal string ProductCode;
34 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.ModelIdMaxLen)]
35 internal string ModelId;
37 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscPrlEriVersionMaxLen*3)]
38 internal string PrlVersion;
40 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscPrlEriVersionMaxLen * 3)]
41 internal string EriVersion;
44 [StructLayout(LayoutKind.Sequential)]
45 internal struct MiscSerialNumInfoStruct
47 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeSnMaxLen)]
49 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeSnMaxLen)]
51 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeSnMaxLen)]
53 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeSnMaxLen)]
54 internal string ImeiSv;
57 [StructLayout(LayoutKind.Sequential)]
58 internal struct MiscDeviceInfoStruct
60 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeDeviceNameMaxLen + 1)]
61 internal string Vendor;
62 [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeDeviceNameMaxLen + 1)]
63 internal string Device;
66 internal class ModemStructConversions
68 internal static MiscVersionInformation ConvertVersionStruct(MiscVersionInfoStruct infoStruct)
70 MiscVersionInformation versionInfo = new MiscVersionInformation();
71 versionInfo.CalcDate = infoStruct.CalDate;
72 versionInfo.EriNamNum = infoStruct.EriNam;
73 versionInfo.EriVers = infoStruct.EriVersion;
74 versionInfo.HwVers = infoStruct.HwVersion;
75 versionInfo.SwVers = infoStruct.SwVersion;
76 versionInfo.PrlNamNum = infoStruct.PrlNam;
77 versionInfo.PrlVers = infoStruct.PrlVersion;
78 versionInfo.ProdCode = infoStruct.ProductCode;
79 versionInfo.Version = infoStruct.Mask;
80 versionInfo.Model = infoStruct.ModelId;
84 internal static MiscSerialNumberInformation ConvertSerialNumberStruct(MiscSerialNumInfoStruct infoStruct)
86 MiscSerialNumberInformation serialNumberInfo = new MiscSerialNumberInformation();
87 serialNumberInfo.SzEsn = infoStruct.Esn;
88 serialNumberInfo.SzImei = infoStruct.Imei;
89 serialNumberInfo.SzImeiSv = infoStruct.ImeiSv;
90 serialNumberInfo.SzMeid = infoStruct.MeId;
91 return serialNumberInfo;
94 internal static MiscDeviceInfo ConvertMiscInfoStruct(MiscDeviceInfoStruct infoStruct)
96 MiscDeviceInfo deviceInfo = new MiscDeviceInfo();
97 deviceInfo.Vendor = infoStruct.Vendor;
98 deviceInfo.Device = infoStruct.Device;