Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Tapi / Tizen.Tapi / ModemStructs.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18 using System.Runtime.InteropServices;
19
20 namespace Tizen.Tapi
21 {
22     [StructLayout(LayoutKind.Sequential)]
23     internal struct MiscVersionInfoStruct
24     {
25         internal byte Mask;
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;
36         internal byte PrlNam;
37         [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscPrlEriVersionMaxLen*3)]
38         internal string PrlVersion;
39         internal byte EriNam;
40         [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscPrlEriVersionMaxLen * 3)]
41         internal string EriVersion;
42     }
43
44     [StructLayout(LayoutKind.Sequential)]
45     internal struct MiscSerialNumInfoStruct
46     {
47         [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeSnMaxLen)]
48         internal string Esn;
49         [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeSnMaxLen)]
50         internal string MeId;
51         [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeSnMaxLen)]
52         internal string Imei;
53         [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeSnMaxLen)]
54         internal string ImeiSv;
55     }
56
57     [StructLayout(LayoutKind.Sequential)]
58     internal struct MiscDeviceInfoStruct
59     {
60         [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeDeviceNameMaxLen + 1)]
61         internal string Vendor;
62         [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeDeviceNameMaxLen + 1)]
63         internal string Device;
64     }
65
66     internal class ModemStructConversions
67     {
68         internal static MiscVersionInformation ConvertVersionStruct(MiscVersionInfoStruct infoStruct)
69         {
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;
81             return versionInfo;
82         }
83
84         internal static MiscSerialNumberInformation ConvertSerialNumberStruct(MiscSerialNumInfoStruct infoStruct)
85         {
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;
92         }
93
94         internal static MiscDeviceInfo ConvertMiscInfoStruct(MiscDeviceInfoStruct infoStruct)
95         {
96             MiscDeviceInfo deviceInfo = new MiscDeviceInfo();
97             deviceInfo.Vendor = infoStruct.Vendor;
98             deviceInfo.Device = infoStruct.Device;
99             return deviceInfo;
100         }
101     }
102 }