Pārlūkot izejas kodu

CRC16 Data 2byte로 변경 / 필요없는 ALC Enum 제거

디자인 변경 /  ThreseHold Data ,Alarm Data 가져올 수 있도록 수정
PYJ 5 gadi atpakaļ
vecāks
revīzija
5932f15788
42 mainītis faili ar 2063 papildinājumiem un 2180 dzēšanām
  1. BIN
      .vs/Jdas_Mbic/v15/.suo
  2. BIN
      .vs/Jdas_Mbic/v15/Server/sqlite3/storage.ide
  3. BIN
      .vs/Jdas_Mbic/v15/Server/sqlite3/storage.ide-shm
  4. BIN
      .vs/Jdas_Mbic/v15/Server/sqlite3/storage.ide-wal
  5. 3 3
      Jdas_Mbic/App.config
  6. 8 15
      Jdas_Mbic/Func/Bluecell_BootProtocol.cs
  7. 20 62
      Jdas_Mbic/Func/Crc16.cs
  8. 1 1
      Jdas_Mbic/Func/Data_Handler.cs
  9. 2 1
      Jdas_Mbic/Jdas_Mbic.csproj
  10. 1070 1127
      Jdas_Mbic/Main.Designer.cs
  11. 459 378
      Jdas_Mbic/Main.cs
  12. 483 572
      Jdas_Mbic/Main.resx
  13. 13 17
      Jdas_Mbic/Properties/Settings.Designer.cs
  14. BIN
      Jdas_Mbic/bin/Debug/ATT_DL1.xls
  15. BIN
      Jdas_Mbic/bin/Debug/ATT_DL2.xls
  16. BIN
      Jdas_Mbic/bin/Debug/ATT_DL3.xls
  17. BIN
      Jdas_Mbic/bin/Debug/ATT_DL4.xls
  18. BIN
      Jdas_Mbic/bin/Debug/ATT_UL1.xls
  19. BIN
      Jdas_Mbic/bin/Debug/ATT_UL2.xls
  20. BIN
      Jdas_Mbic/bin/Debug/ATT_UL3.xls
  21. BIN
      Jdas_Mbic/bin/Debug/ATT_UL4.xls
  22. BIN
      Jdas_Mbic/bin/Debug/DET_DL1.xls
  23. BIN
      Jdas_Mbic/bin/Debug/DET_DL2.xls
  24. BIN
      Jdas_Mbic/bin/Debug/DET_DL3.xls
  25. BIN
      Jdas_Mbic/bin/Debug/DET_DL4.xls
  26. BIN
      Jdas_Mbic/bin/Debug/DET_UL1.xls
  27. BIN
      Jdas_Mbic/bin/Debug/DET_UL2.xls
  28. BIN
      Jdas_Mbic/bin/Debug/DET_UL3.xls
  29. BIN
      Jdas_Mbic/bin/Debug/DET_UL4.xls
  30. BIN
      Jdas_Mbic/bin/Debug/Jdas_Mbic.exe
  31. 3 3
      Jdas_Mbic/bin/Debug/Jdas_Mbic.exe.config
  32. BIN
      Jdas_Mbic/bin/Debug/Jdas_Mbic.pdb
  33. 0 0
      Jdas_Mbic/bin/Debug/Jdas_Mbic_5_7.exe
  34. BIN
      Jdas_Mbic/obj/Debug/DesignTimeResolveAssemblyReferences.cache
  35. BIN
      Jdas_Mbic/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  36. BIN
      Jdas_Mbic/obj/Debug/Jdas_Mbic.JdasMbic.resources
  37. 1 1
      Jdas_Mbic/obj/Debug/Jdas_Mbic.csproj.CoreCompileInputs.cache
  38. BIN
      Jdas_Mbic/obj/Debug/Jdas_Mbic.csproj.GenerateResource.cache
  39. BIN
      Jdas_Mbic/obj/Debug/Jdas_Mbic.csprojAssemblyReference.cache
  40. BIN
      Jdas_Mbic/obj/Debug/Jdas_Mbic.exe
  41. BIN
      Jdas_Mbic/obj/Debug/Jdas_Mbic.pdb
  42. BIN
      Jdas_Mbic/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll

BIN
.vs/Jdas_Mbic/v15/.suo


BIN
.vs/Jdas_Mbic/v15/Server/sqlite3/storage.ide


BIN
.vs/Jdas_Mbic/v15/Server/sqlite3/storage.ide-shm


BIN
.vs/Jdas_Mbic/v15/Server/sqlite3/storage.ide-wal


+ 3 - 3
Jdas_Mbic/App.config

@@ -1,6 +1,6 @@
1
-<?xml version="1.0" encoding="utf-8" ?>
1
+<?xml version="1.0" encoding="utf-8"?>
2 2
 <configuration>
3 3
     <startup> 
4
-        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
4
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/>
5 5
     </startup>
6
-</configuration>
6
+</configuration>

+ 8 - 15
Jdas_Mbic/Func/Bluecell_BootProtocol.cs

@@ -138,14 +138,8 @@ namespace Jdas_Mbic
138 138
             ATT_DL4_PATH = 0x42,
139 139
             ATT_UL4_PATH = 0x46,
140 140
             ATT_SelfTest4 = 0x48,
141
-            ALC1_EN = 0x51,
142
-            ALC2_EN = 0x52,
143
-            ALC3_EN = 0x53,
144
-            ALC4_EN = 0x54,
145
-            AGC1_EN = 0x61,
146
-            AGC2_EN = 0x62,
147
-            AGC3_EN = 0x63,
148
-            AGC4_EN = 0x64,
141
+            Bluecell_ULO_ALC_ON_OFF = 0x51,
142
+            Bluecell_DLI_AGC_ON_OFF = 0x61,
149 143
             ATT_TableSet = 0x70,
150 144
             ATT_TableGet = 0x71,
151 145
             Bluecell_StatusReq = 0x77,
@@ -154,15 +148,11 @@ namespace Jdas_Mbic
154 148
             Bluecell_DL2_USER = 0x81,
155 149
             Bluecell_DL3_USER = 0x82,
156 150
             Bluecell_DL4_USER = 0x83,
157
-
158 151
             Bluecell_UL1_USER = 0x84,
159 152
             Bluecell_UL2_USER = 0x85,
160 153
             Bluecell_UL3_USER = 0x86,
161 154
             Bluecell_UL4_USER = 0x87,
162 155
             Bluecell_TEMP_USER = 0x88,
163
-
164
-            Bluecell_DLI_AGC_ON_OFF,
165
-            Bluecell_ULO_ALC_ON_OFF,
166 156
             Bluecell_DLI_AGC_Threshold,
167 157
             Bluecell_DLI_AGC_Threshold_Default,
168 158
             Bluecell_DLI_Shutdown_ON_OFF,
@@ -201,6 +191,7 @@ namespace Jdas_Mbic
201 191
             Bluecell_ATT_UL2_USER,
202 192
             Bluecell_ATT_UL3_USER,
203 193
             Bluecell_ATT_UL4_USER,
194
+
204 195
         };
205 196
 
206 197
         Serial serial;
@@ -235,14 +226,16 @@ namespace Jdas_Mbic
235 226
         {
236 227
             Crc16 crc16 = new Crc16();
237 228
             this.serial = (Serial)serial;
238
-            byte[] temp_buf = new byte[6];
229
+            byte[] temp_buf = new byte[7];
239 230
 
240 231
             temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
241 232
             temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (int)DATATYPE.Bluecell_StatusReq;
242 233
             temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length] = Convert.ToByte(temp_buf.Length - 3);
243 234
             temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = Convert.ToByte(temp_buf.Length - 2);
244
-            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 0] = crc16.STH30_CreateCrc(temp_buf, temp_buf[2]);
245
-            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = BLUECELL_TAILER;
235
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 0] = Convert.ToByte((crc16.CRC16_Generate(temp_buf, temp_buf[2]) & 0xFF00) >> 8);
236
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = Convert.ToByte((crc16.CRC16_Generate(temp_buf, temp_buf[2]) & 0x00FF));
237
+            //Convert.ToByte((Updatedata.Length & 0xFF00) >> 8);
238
+            temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = BLUECELL_TAILER;
246 239
             this.serial.Serial_DataSend(temp_buf, temp_buf.Length);
247 240
 
248 241
         }

+ 20 - 62
Jdas_Mbic/Func/Crc16.cs

@@ -10,7 +10,7 @@ namespace Jdas_Mbic
10 10
 
11 11
     class Crc16
12 12
     {
13
-        private readonly ushort[] Table_CRC16 = {
13
+        private ushort[] Table_CRC16 = {
14 14
             0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
15 15
             0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
16 16
             0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
@@ -53,74 +53,32 @@ namespace Jdas_Mbic
53 53
         //-----------------------------------------------
54 54
         //UART CRC üũ �Լ�
55 55
         //-----------------------------------------------
56
-        public ushort CRC16_Generate(byte[] buf_ptr, int len)
56
+        /*public ushort crc16(byte[] crcdata, uint len)
57 57
         {
58
-            byte dt = 0;
59
-            ushort crc16 = 0;
60
-            ushort index = 4;
61
-            len *= 8;
62
-            for (crc16 = (ushort)0x0000; len >= 8; len -= 8)
63
-            {
64
-                crc16 = (ushort)(Table_CRC16[(crc16 >> 8) ^ (ushort)(buf_ptr[index++])] ^ (crc16 << 8));
65
-            }
66
-
67
-            if (len != 0)
68
-            {
69
-                dt = (byte)( buf_ptr[index] << 8);
58
+            ushort crc = 0;
59
+            for (int counter = 0; counter < len; counter++)
60
+                crc = (crc << 8) ^ Table_CRC16[(((crc >> 8) ^ crcdata[counter]) & 0x00FF)];
61
+            return crc;
62
+        }*/
63
+    
70 64
 
71
-                while (len != 0)
72
-                {
73
-                    len--;
65
+        public bool CRC16_Check(byte[] buf_ptr, int len,ushort checksum)
66
+        {
67
+            ushort crc = 0;
68
+            for (int counter = 0; counter < len; counter++)
69
+                crc = (ushort)((crc << 8) ^ Table_CRC16[(int)(((crc >> 8) ^ buf_ptr[counter]) & 0x00FF)]);
74 70
 
75
-                    if (((crc16 ^ dt) & ((ushort)1 << 15)) != 0)
76
-                    {
77
-                        crc16 = (ushort)(crc16 << 1);
78
-                        crc16 = (ushort)(crc16 ^ 0x1021);
79
-                    }
80
-                    else
81
-                    {
82
-                        crc16 = (ushort)(crc16 << 1);
83
-                    }
84
-                    dt = (byte)(dt << 1);
85
-                }
86
-            }
87
-            return (crc16);
71
+            return (crc == checksum ? false : true);
88 72
         }
89
-
90
-        public EtError CRC16_Check(byte[] buf_ptr, int len, ushort checksum)
73
+        public ushort CRC16_Generate(byte[] buf_ptr, int len)
91 74
         {
92
-            byte dt = 0;
93
-            ushort crc16 = 0;
94
-            ushort index = 4;
95
-
96
-            len *= 8;
97
-            for (crc16 = (ushort)0x0000; len >= 8; len -= 8, index++)
98
-            {
99
-                crc16 = (ushort)(Table_CRC16[(crc16 >> 8) ^ (ushort)(buf_ptr[index])] ^ (crc16 << 8));
100
-            }
101
-
102
-            if (len != 0)
103
-            {
104
-                dt = (byte)(buf_ptr[index] << 8);
105
-
106
-                while (len != 0)
107
-                {
108
-                    len--;
75
+            ushort crc = 0;
76
+            for (int counter = 0; counter < len; counter++)
77
+                crc = (ushort)((crc << 8) ^ Table_CRC16[(int)(((crc >> 8) ^ buf_ptr[counter]) & 0x00FF)]);
109 78
 
110
-                    if (((crc16 ^ dt) & ((ushort)1 << 15)) != 0)
111
-                    {
112
-                        crc16 = (ushort)(crc16 << 1);
113
-                        crc16 = (ushort)(crc16 ^ 0x1021);
114
-                    }
115
-                    else
116
-                    {
117
-                        crc16 = (ushort)(crc16 << 1);
118
-                    }
119
-                    dt = (byte)(dt << 1);
120
-                }
121
-            }
122
-            return (crc16 == checksum ? EtError.CHECKSUM_ERROR : EtError.NO_ERROR);
79
+            return crc;
123 80
         }
81
+        
124 82
         public bool STH30_CheckCrc(byte[] data, byte nbrOfBytes, byte checksum)
125 83
         {
126 84
             byte bit;        // bit mask

+ 1 - 1
Jdas_Mbic/Func/Data_Handler.cs

@@ -44,7 +44,7 @@ namespace Jdas_Mbic
44 44
             crcindex = (byte)(length + 1);
45 45
             try
46 46
             {
47
-            ret = crc.STH30_CheckCrc(data,length,data[crcindex]);
47
+            ret = crc.CRC16_Check(data,length,data[crcindex]);
48 48
             }
49 49
             catch(Exception e)
50 50
             {

+ 2 - 1
Jdas_Mbic/Jdas_Mbic.csproj

@@ -8,10 +8,11 @@
8 8
     <OutputType>WinExe</OutputType>
9 9
     <RootNamespace>Jdas_Mbic</RootNamespace>
10 10
     <AssemblyName>Jdas_Mbic</AssemblyName>
11
-    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
11
+    <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
12 12
     <FileAlignment>512</FileAlignment>
13 13
     <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14 14
     <Deterministic>true</Deterministic>
15
+    <TargetFrameworkProfile />
15 16
   </PropertyGroup>
16 17
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17 18
     <PlatformTarget>AnyCPU</PlatformTarget>

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1070 - 1127
Jdas_Mbic/Main.Designer.cs


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 459 - 378
Jdas_Mbic/Main.cs


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 483 - 572
Jdas_Mbic/Main.resx


+ 13 - 17
Jdas_Mbic/Properties/Settings.Designer.cs

@@ -1,28 +1,24 @@
1 1
 //------------------------------------------------------------------------------
2 2
 // <auto-generated>
3
-//     This code was generated by a tool.
4
-//     Runtime Version:4.0.30319.42000
3
+//     이 코드는 도구를 사용하여 생성되었습니다.
4
+//     런타임 버전:4.0.30319.42000
5 5
 //
6
-//     Changes to this file may cause incorrect behavior and will be lost if
7
-//     the code is regenerated.
6
+//     파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
7
+//     이러한 변경 내용이 손실됩니다.
8 8
 // </auto-generated>
9 9
 //------------------------------------------------------------------------------
10 10
 
11
-namespace Jdas_Mbic.Properties
12
-{
13
-
14
-
11
+namespace Jdas_Mbic.Properties {
12
+    
13
+    
15 14
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17
-    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18
-    {
19
-
15
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
16
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17
+        
20 18
         private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21
-
22
-        public static Settings Default
23
-        {
24
-            get
25
-            {
19
+        
20
+        public static Settings Default {
21
+            get {
26 22
                 return defaultInstance;
27 23
             }
28 24
         }

BIN
Jdas_Mbic/bin/Debug/ATT_DL1.xls


BIN
Jdas_Mbic/bin/Debug/ATT_DL2.xls


BIN
Jdas_Mbic/bin/Debug/ATT_DL3.xls


BIN
Jdas_Mbic/bin/Debug/ATT_DL4.xls


BIN
Jdas_Mbic/bin/Debug/ATT_UL1.xls


BIN
Jdas_Mbic/bin/Debug/ATT_UL2.xls


BIN
Jdas_Mbic/bin/Debug/ATT_UL3.xls


BIN
Jdas_Mbic/bin/Debug/ATT_UL4.xls


BIN
Jdas_Mbic/bin/Debug/DET_DL1.xls


BIN
Jdas_Mbic/bin/Debug/DET_DL2.xls


BIN
Jdas_Mbic/bin/Debug/DET_DL3.xls


BIN
Jdas_Mbic/bin/Debug/DET_DL4.xls


BIN
Jdas_Mbic/bin/Debug/DET_UL1.xls


BIN
Jdas_Mbic/bin/Debug/DET_UL2.xls


BIN
Jdas_Mbic/bin/Debug/DET_UL3.xls


BIN
Jdas_Mbic/bin/Debug/DET_UL4.xls


BIN
Jdas_Mbic/bin/Debug/Jdas_Mbic.exe


+ 3 - 3
Jdas_Mbic/bin/Debug/Jdas_Mbic.exe.config

@@ -1,6 +1,6 @@
1
-<?xml version="1.0" encoding="utf-8" ?>
1
+<?xml version="1.0" encoding="utf-8"?>
2 2
 <configuration>
3 3
     <startup> 
4
-        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
4
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/>
5 5
     </startup>
6
-</configuration>
6
+</configuration>

BIN
Jdas_Mbic/bin/Debug/Jdas_Mbic.pdb


Jdas_Mbic/bin/Debug/Jdas_MbicNEw.exe → Jdas_Mbic/bin/Debug/Jdas_Mbic_5_7.exe


BIN
Jdas_Mbic/obj/Debug/DesignTimeResolveAssemblyReferences.cache


BIN
Jdas_Mbic/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache


BIN
Jdas_Mbic/obj/Debug/Jdas_Mbic.JdasMbic.resources


+ 1 - 1
Jdas_Mbic/obj/Debug/Jdas_Mbic.csproj.CoreCompileInputs.cache

@@ -1 +1 @@
1
-a0e135a49a434b394a1b2ba0915f88a4bd649a39
1
+95e1a81e0f614a0b53c0f1bb982a476768c2eb15

BIN
Jdas_Mbic/obj/Debug/Jdas_Mbic.csproj.GenerateResource.cache


BIN
Jdas_Mbic/obj/Debug/Jdas_Mbic.csprojAssemblyReference.cache


BIN
Jdas_Mbic/obj/Debug/Jdas_Mbic.exe


BIN
Jdas_Mbic/obj/Debug/Jdas_Mbic.pdb


BIN
Jdas_Mbic/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll