|
@@ -31,7 +31,8 @@ namespace Jdas_Mbic
|
31
|
31
|
{
|
32
|
32
|
Bluecell_Header = 0,
|
33
|
33
|
Bluecell_Type,
|
34
|
|
- Bluecell_Length,
|
|
34
|
+ Bluecell_Length_H,
|
|
35
|
+ Bluecell_Length_L,
|
35
|
36
|
Bluecell_CrcIndex,
|
36
|
37
|
Bluecell_data,
|
37
|
38
|
}
|
|
@@ -42,84 +43,7 @@ namespace Jdas_Mbic
|
42
|
43
|
TYPE_BLUECELL_SAVE = 3,
|
43
|
44
|
TYPE_BLUECELL_ACK = 4,
|
44
|
45
|
};
|
45
|
|
- struct BLUESTATUS_st
|
46
|
|
- {
|
47
|
|
- byte bluecell_header;
|
48
|
|
- byte bluecell_type;
|
49
|
|
- byte bluecell_length;
|
50
|
|
- byte bluecell_crcindex;
|
51
|
|
- byte Selftest0;
|
52
|
|
- byte Selftest1;
|
53
|
|
- byte Selftest2;
|
54
|
|
- byte Selftest3;
|
55
|
|
- byte ATT_DL1_PATH;
|
56
|
|
- byte ATT_DL2_PATH;
|
57
|
|
- byte ATT_DL3_PATH;
|
58
|
|
- byte ATT_DL4_PATH;
|
59
|
|
- byte ATT_UL1_PATH;
|
60
|
|
- byte ATT_UL2_PATH;
|
61
|
|
- byte ATT_UL3_PATH;
|
62
|
|
- byte ATT_UL4_PATH;
|
63
|
|
- byte ATT_DL1_H;
|
64
|
|
- byte ATT_DL1_L;
|
65
|
|
- byte ATT_DL2_H;
|
66
|
|
- byte ATT_DL2_L;
|
67
|
|
- byte ATT_DL3_H;
|
68
|
|
- byte ATT_DL3_L;
|
69
|
|
- byte ATT_DL4_H;
|
70
|
|
- byte ATT_DL4_L;
|
71
|
|
- byte ATT_UL1_H;
|
72
|
|
- byte ATT_UL1_L;
|
73
|
|
- byte ATT_UL2_H;
|
74
|
|
- byte ATT_UL2_L;
|
75
|
|
- byte ATT_UL3_H;
|
76
|
|
- byte ATT_UL3_L;
|
77
|
|
- byte ATT_UL4_H;
|
78
|
|
- byte ATT_UL4_L;
|
79
|
|
- byte DET_DL1_IN_H;
|
80
|
|
- byte DET_DL1_IN_L;
|
81
|
|
- byte DET_DL2_IN_H;
|
82
|
|
- byte DET_DL2_IN_L;
|
83
|
|
- byte DET_DL3_IN_H;
|
84
|
|
- byte DET_DL3_IN_L;
|
85
|
|
- byte DET_DL4_IN_H;
|
86
|
|
- byte DET_DL4_IN_L;
|
87
|
|
- byte DET_UL1_IN_H;
|
88
|
|
- byte DET_UL1_IN_L;
|
89
|
|
- byte DET_UL2_IN_H;
|
90
|
|
- byte DET_UL2_IN_L;
|
91
|
|
- byte DET_UL3_IN_H;
|
92
|
|
- byte DET_UL3_IN_L;
|
93
|
|
- byte DET_UL4_IN_H;
|
94
|
|
- byte DET_UL4_IN_L;
|
95
|
|
- byte DET_TEMP_H;
|
96
|
|
- byte DET_TEMP_L;
|
97
|
|
- byte ATT_AGC1_ONOFF;
|
98
|
|
- byte ATT_ALC1_ONOFF;
|
99
|
|
- byte ATT_AGC2_ONOFF;
|
100
|
|
- byte ATT_ALC2_ONOFF;
|
101
|
|
- byte ATT_AGC3_ONOFF;
|
102
|
|
- byte ATT_ALC3_ONOFF;
|
103
|
|
- byte ATT_AGC4_ONOFF;
|
104
|
|
- byte ATT_ALC4_ONOFF;
|
105
|
|
- byte ATT_AGC1_H;
|
106
|
|
- byte ATT_AGC1_L;
|
107
|
|
- byte ATT_ALC1_H;
|
108
|
|
- byte ATT_ALC1_L;
|
109
|
|
- byte ATT_AGC2_H;
|
110
|
|
- byte ATT_AGC2_L;
|
111
|
|
- byte ATT_ALC2_H;
|
112
|
|
- byte ATT_ALC2_L;
|
113
|
|
- byte ATT_AGC3_H;
|
114
|
|
- byte ATT_AGC3_L;
|
115
|
|
- byte ATT_ALC3_H;
|
116
|
|
- byte ATT_ALC3_L;
|
117
|
|
- byte ATT_AGC4_H;
|
118
|
|
- byte ATT_AGC4_L;
|
119
|
|
- byte ATT_ALC4_H;
|
120
|
|
- byte ATT_ALC4_L;
|
121
|
|
- byte bluecell_crc;
|
122
|
|
- };
|
|
46
|
+
|
123
|
47
|
enum MBICProt_st
|
124
|
48
|
{
|
125
|
49
|
MBIC_PREAMBLE_0 = 0,
|
|
@@ -222,9 +146,38 @@ namespace Jdas_Mbic
|
222
|
146
|
Bluecell_ATT_UL2_USER,
|
223
|
147
|
Bluecell_ATT_UL3_USER,
|
224
|
148
|
Bluecell_ATT_UL4_USER,
|
|
149
|
+ BLuecell_ATT_ALC1,
|
|
150
|
+ BLuecell_ATT_ALC2,
|
|
151
|
+ BLuecell_ATT_ALC3,
|
|
152
|
+ BLuecell_ATT_ALC4,
|
|
153
|
+ Bluecell_BankSelect,
|
|
154
|
+
|
225
|
155
|
|
226
|
156
|
};
|
227
|
157
|
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
228
|
181
|
Serial serial;
|
229
|
182
|
/*bluecell Header*/
|
230
|
183
|
public const byte Bluecell_Header0 = 0x42;//ASCII : B
|
|
@@ -238,8 +191,8 @@ namespace Jdas_Mbic
|
238
|
191
|
Crc16 crc16 = new Crc16();
|
239
|
192
|
public const byte BLUECELL_HEADER = 0xBE;
|
240
|
193
|
public const byte BLUECELL_TAILER = 0xEB;
|
241
|
|
- const byte BLUECELL_RESET_LENGTH = 6;
|
242
|
|
- const byte BLUECELL_FIX_DATA_LENGTH = 3;
|
|
194
|
+ const byte BLUECELL_RESET_LENGTH = 9;
|
|
195
|
+ const byte BLUECELL_FIX_DATA_LENGTH = 4;
|
243
|
196
|
|
244
|
197
|
const byte MBIC_HEADER_SIZE = 22;
|
245
|
198
|
const byte MBIC_PREAMBLE0 = 0x16;
|
|
@@ -263,7 +216,8 @@ namespace Jdas_Mbic
|
263
|
216
|
public byte[] MBIC_HeaderMergeFunction(byte[] data, int Length)
|
264
|
217
|
{
|
265
|
218
|
byte[] ret = new byte[data.Length + 22 + 3];
|
266
|
|
- UInt16 CRCData = crc16.CRC16_Generate(data, data.Length);
|
|
219
|
+ UInt16 CRCData = 0;
|
|
220
|
+ // UInt16 CRCData = crc16.CRC16_Generate(data, data.Length);
|
267
|
221
|
/*
|
268
|
222
|
TAIL
|
269
|
223
|
*/
|
|
@@ -313,28 +267,34 @@ namespace Jdas_Mbic
|
313
|
267
|
|
314
|
268
|
public void Bluecell_Reset(object serial)
|
315
|
269
|
{
|
316
|
|
- this.serial = (Serial)serial;
|
|
270
|
+ UInt16 Length = (BLUECELL_RESET_LENGTH - BLUECELL_FIX_DATA_LENGTH);
|
317
|
271
|
byte[] temp_buf = new byte[BLUECELL_RESET_LENGTH];
|
|
272
|
+ UInt16 CRCRET = crc16.CRC16_Generate(temp_buf, Length);
|
|
273
|
+ this.serial = (Serial)serial;
|
318
|
274
|
temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
|
319
|
275
|
temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (byte)Bluecell_Prot_t.TYPE_BLUECELL_RESET;
|
320
|
|
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length] = BLUECELL_RESET_LENGTH - BLUECELL_FIX_DATA_LENGTH;
|
321
|
|
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = (byte)Bluecell_ProtIndex_p.Bluecell_data;
|
322
|
|
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = crc16.STH30_CreateCrc(temp_buf, BLUECELL_RESET_LENGTH - 3);
|
323
|
|
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = BLUECELL_TAILER;
|
|
276
|
+ temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = Convert.ToByte(Length & 0x00FF << 8);
|
|
277
|
+ temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = Convert.ToByte(Length & 0x00FF);
|
|
278
|
+ temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 0;
|
|
279
|
+ temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = Convert.ToByte(CRCRET & 0xFF00 >> 8);
|
|
280
|
+ temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = Convert.ToByte(CRCRET & 0x00FF);
|
|
281
|
+ temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = BLUECELL_TAILER;
|
324
|
282
|
this.serial.Serial_DataSend(temp_buf, temp_buf.Length);
|
325
|
283
|
}
|
326
|
284
|
public void Bluecell_RF_Status_Req(object serial)
|
327
|
285
|
{
|
328
|
286
|
Crc16 crc16 = new Crc16();
|
329
|
287
|
this.serial = (Serial)serial;
|
330
|
|
- byte[] temp_buf = new byte[7];
|
331
|
|
-
|
|
288
|
+ byte[] temp_buf = new byte[8];
|
|
289
|
+ byte[] MBIC_DATA = { 0x16, 0x16, 0x16, 0x16, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x14, 0x06, 0x09, 0x00, 0x0c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03 };
|
|
290
|
+ //this.serial.Serial_DataSend(MBIC_DATA, MBIC_DATA.Length);
|
|
291
|
+ //return;
|
332
|
292
|
temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
|
333
|
293
|
temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (int)DATATYPE.Bluecell_StatusReq;
|
334
|
|
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length] = Convert.ToByte(temp_buf.Length - 3);
|
335
|
|
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = Convert.ToByte(temp_buf.Length - 2);
|
336
|
|
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 0] = Convert.ToByte((crc16.CRC16_Generate(temp_buf, temp_buf[2]) & 0xFF00) >> 8);
|
337
|
|
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = Convert.ToByte((crc16.CRC16_Generate(temp_buf, temp_buf[2]) & 0x00FF));
|
|
294
|
+ temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = 0;//Convert.ToByte(temp_buf.Length - 4);
|
|
295
|
+ temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = Convert.ToByte(temp_buf.Length - 4);
|
|
296
|
+ temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 0] = Convert.ToByte((crc16.CRC16_Generate(temp_buf, temp_buf.Length - 4) & 0xFF00) >> 8);
|
|
297
|
+ temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = Convert.ToByte((crc16.CRC16_Generate(temp_buf, temp_buf.Length - 4) & 0x00FF));
|
338
|
298
|
//Convert.ToByte((Updatedata.Length & 0xFF00) >> 8);
|
339
|
299
|
temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = BLUECELL_TAILER;
|
340
|
300
|
this.serial.Serial_DataSend(temp_buf, temp_buf.Length);
|