using System;
|
|
namespace TProduct.Link.Kedi
|
{
|
public class SiMsg压力
|
{
|
public byte[] BuildMessage()
|
{
|
byte[] commandSend = new byte[8];
|
commandSend[0] = 0x01;
|
commandSend[1] = 0x03;
|
commandSend[2] = 0x00;
|
commandSend[3] = 0x04;
|
commandSend[4] = 0x00;
|
commandSend[5] = 0x04;
|
|
long num = 0;
|
for (int i = 1; i <= 5; i++)
|
{
|
num += commandSend[i];
|
}
|
long hex_h; long hex_l;//???
|
SiKdMsgHelper.CreateCRC(num, out hex_h, out hex_l);
|
|
commandSend[6] = Convert.ToByte(hex_h);
|
commandSend[7] = Convert.ToByte(hex_l);
|
|
return commandSend;
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="data"></param>
|
/// <param name="inelt_press"></param>
|
/// <param name="outlet_press"></param>
|
/// <returns></returns>
|
public string AbstactByteValue(byte[] data, out double inelt_press_ma, out double outlet_press_ma)
|
{//???
|
int j = 0;
|
if (data[3 + j * 2] == 0xF && data[4 + j * 2] == 0xA0)
|
inelt_press_ma = 0;
|
else
|
inelt_press_ma = (data[3 + j * 2] * 256 + data[4 + j * 2]) / 1000;
|
|
j = 1;
|
if (data[3 + j * 2] == 0xF && data[4 + j * 2] == 0xA0)
|
outlet_press_ma = 0;
|
else
|
outlet_press_ma = (data[3 + j * 2] * 256 + data[4 + j * 2]) / 1000;
|
|
return null;
|
}
|
}
|
}
|