修改重复定义
This commit is contained in:
@@ -10,171 +10,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
{
|
||||
public class V8
|
||||
{
|
||||
// 结构体定义
|
||||
public struct AreaPos
|
||||
{
|
||||
public int enable;
|
||||
public int x;
|
||||
public int y;
|
||||
public int width;
|
||||
public int height;
|
||||
}
|
||||
|
||||
public struct SpotPos
|
||||
{
|
||||
public int enable;
|
||||
public int x;
|
||||
public int y;
|
||||
}
|
||||
|
||||
public struct LinePos
|
||||
{
|
||||
public int enable;
|
||||
public int sta_x;
|
||||
public int sta_y;
|
||||
public int end_x;
|
||||
public int end_y;
|
||||
}
|
||||
|
||||
public struct ImagePos
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
public AreaPos[] area;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
public SpotPos[] spot;
|
||||
public LinePos line;
|
||||
}
|
||||
|
||||
public struct AreaTemp
|
||||
{
|
||||
public int enable;
|
||||
public int max_temp;
|
||||
public int max_temp_x;
|
||||
public int max_temp_y;
|
||||
public int min_temp;
|
||||
public int min_temp_x;
|
||||
public int min_temp_y;
|
||||
public int ave_temp;
|
||||
}
|
||||
|
||||
public struct SpotTemp
|
||||
{
|
||||
public int enable;
|
||||
public int temp;
|
||||
}
|
||||
|
||||
public struct LineTemp
|
||||
{
|
||||
public int enable;
|
||||
public int max_temp;
|
||||
public int max_temp_x;
|
||||
public int max_temp_y;
|
||||
public int min_temp;
|
||||
public int min_temp_x;
|
||||
public int min_temp_y;
|
||||
public int ave_temp;
|
||||
}
|
||||
|
||||
public struct GlobaTemp
|
||||
{
|
||||
public int max_temp;
|
||||
public int max_temp_x;
|
||||
public int max_temp_y;
|
||||
public int min_temp;
|
||||
public int min_temp_x;
|
||||
public int min_temp_y;
|
||||
}
|
||||
|
||||
public struct ImageTemp
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
public AreaTemp[] area;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
public SpotTemp[] spot;
|
||||
public LineTemp line;
|
||||
public GlobaTemp globa;
|
||||
}
|
||||
|
||||
public struct EmailServer
|
||||
{
|
||||
public int enable;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
|
||||
public char[] recv_addr;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
|
||||
public char[] send_addr;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
|
||||
public char[] send_pwd;
|
||||
}
|
||||
|
||||
public struct TftpServer
|
||||
{
|
||||
public int enable;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
|
||||
public char[] tftp_addr;
|
||||
}
|
||||
|
||||
public struct NetworkEth
|
||||
{
|
||||
public int enable;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
|
||||
public char[] static_ip;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
|
||||
public char[] netmask;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
|
||||
public char[] gateway;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
|
||||
public char[] dns1;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
|
||||
public char[] dns2;
|
||||
}
|
||||
|
||||
public struct EnvirParam
|
||||
{
|
||||
public int method;
|
||||
public int num;
|
||||
public float emissivity;
|
||||
public float airTemp;
|
||||
public float targetTemp;
|
||||
public float atmosTrans;
|
||||
public float distance;
|
||||
public float infraredTemp;
|
||||
public float infraredRadia;
|
||||
}
|
||||
|
||||
public struct AlarmParam
|
||||
{
|
||||
public int method;
|
||||
public int num;
|
||||
public int active;
|
||||
public int condition;
|
||||
public int captrue;
|
||||
public int disableCalib;
|
||||
public int email;
|
||||
public int digital;
|
||||
public int ftp;
|
||||
public float threshold;
|
||||
public float hysteresis;
|
||||
public int thresholeTime;
|
||||
}
|
||||
|
||||
public struct FocusParam
|
||||
{
|
||||
public int method;
|
||||
public int x;
|
||||
public int y;
|
||||
public int width;
|
||||
public int height;
|
||||
}
|
||||
|
||||
public struct TimeParam
|
||||
{
|
||||
public int year;
|
||||
public char month;
|
||||
public char day;
|
||||
public char hour;
|
||||
public char minute;
|
||||
public char second;
|
||||
}
|
||||
// 结构体引用已移至SharedStructures类
|
||||
|
||||
// 常量定义
|
||||
private const int SDK_PORT = 5000;
|
||||
@@ -523,7 +359,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
}
|
||||
|
||||
public void Set_area_pos(int index, AreaPos area_data)
|
||||
public void Set_area_pos(int index, SharedStructures.AreaPos area_data)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -531,7 +367,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
byte[] command = new byte[] { 0x03, 0x01, (byte)index, 0x00 };
|
||||
|
||||
// 添加区域数据
|
||||
byte[] dataBytes = new byte[16]; // 足够容纳AreaPos结构
|
||||
byte[] dataBytes = new byte[16]; // 足够容纳SharedStructures.AreaPos结构
|
||||
Array.Copy(BitConverter.GetBytes(area_data.enable), 0, dataBytes, 0, 4);
|
||||
Array.Copy(BitConverter.GetBytes(area_data.x), 0, dataBytes, 4, 4);
|
||||
Array.Copy(BitConverter.GetBytes(area_data.y), 0, dataBytes, 8, 4);
|
||||
@@ -547,7 +383,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
}
|
||||
|
||||
public AreaPos Get_area_pos(int index)
|
||||
public SharedStructures.AreaPos Get_area_pos(int index)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -556,7 +392,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
// 解析响应数据
|
||||
AreaPos area_data = new AreaPos();
|
||||
SharedStructures.AreaPos area_data = new SharedStructures.AreaPos();
|
||||
if (response.Length >= 16)
|
||||
{
|
||||
area_data.enable = BitConverter.ToInt32(response, 0);
|
||||
@@ -566,16 +402,16 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
return area_data;
|
||||
}
|
||||
return new AreaPos();
|
||||
return new SharedStructures.AreaPos();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取区域位置失败: {ex.Message}");
|
||||
return new AreaPos();
|
||||
return new SharedStructures.AreaPos();
|
||||
}
|
||||
}
|
||||
|
||||
public void Set_spot_pos(int index, SpotPos spot_data)
|
||||
public void Set_spot_pos(int index, SharedStructures.SpotPos spot_data)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -596,7 +432,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
}
|
||||
|
||||
public SpotPos Get_spot_pos(int index)
|
||||
public SharedStructures.SpotPos Get_spot_pos(int index)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -604,7 +440,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
SpotPos spot_data = new SpotPos();
|
||||
SharedStructures.SpotPos spot_data = new SharedStructures.SpotPos();
|
||||
if (response.Length >= 12)
|
||||
{
|
||||
spot_data.enable = BitConverter.ToInt32(response, 0);
|
||||
@@ -613,16 +449,16 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
return spot_data;
|
||||
}
|
||||
return new SpotPos();
|
||||
return new SharedStructures.SpotPos();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取点位置失败: {ex.Message}");
|
||||
return new SpotPos();
|
||||
return new SharedStructures.SpotPos();
|
||||
}
|
||||
}
|
||||
|
||||
public LinePos Line_pos
|
||||
public SharedStructures.LinePos Line_pos
|
||||
{
|
||||
set
|
||||
{
|
||||
@@ -654,7 +490,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
LinePos line_data = new LinePos();
|
||||
SharedStructures.LinePos line_data = new SharedStructures.LinePos();
|
||||
if (response.Length >= 20)
|
||||
{
|
||||
line_data.enable = BitConverter.ToInt32(response, 0);
|
||||
@@ -665,17 +501,17 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
return line_data;
|
||||
}
|
||||
return new LinePos();
|
||||
return new SharedStructures.LinePos();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取线位置失败: {ex.Message}");
|
||||
return new LinePos();
|
||||
return new SharedStructures.LinePos();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ImagePos All_pos
|
||||
public SharedStructures.ImagePos All_pos
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -686,20 +522,20 @@ namespace JoyD.Windows.CS.Toprie
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
// 创建默认的ImagePos对象
|
||||
ImagePos data = new ImagePos();
|
||||
data.area = new AreaPos[6];
|
||||
data.spot = new SpotPos[6];
|
||||
SharedStructures.ImagePos data = new SharedStructures.ImagePos();
|
||||
data.area = new SharedStructures.AreaPos[6];
|
||||
data.spot = new SharedStructures.SpotPos[6];
|
||||
|
||||
// 这里应该解析完整的响应数据
|
||||
// 简化实现,返回默认值
|
||||
return data;
|
||||
}
|
||||
return new ImagePos();
|
||||
return new SharedStructures.ImagePos();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取所有位置失败: {ex.Message}");
|
||||
return new ImagePos();
|
||||
return new SharedStructures.ImagePos();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -932,7 +768,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
}
|
||||
|
||||
public EmailServer Email_server
|
||||
public SharedStructures.EmailServer Email_server
|
||||
{
|
||||
set
|
||||
{
|
||||
@@ -940,7 +776,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
{
|
||||
byte[] command = new byte[] { 0x07, 0x01, 0x00, 0x00 };
|
||||
|
||||
// 序列化EmailServer结构体
|
||||
// 序列化SharedStructures.EmailServer结构体
|
||||
byte[] dataBytes = new byte[64]; // 足够容纳所有字段
|
||||
Array.Copy(BitConverter.GetBytes(value.enable), 0, dataBytes, 0, 4);
|
||||
// 复制字符串到字节数组
|
||||
@@ -962,19 +798,19 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return new EmailServer();
|
||||
return new SharedStructures.EmailServer();
|
||||
}
|
||||
return new EmailServer();
|
||||
return new SharedStructures.EmailServer();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取邮件服务器失败: {ex.Message}");
|
||||
return new EmailServer();
|
||||
return new SharedStructures.EmailServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TftpServer Tftp_server
|
||||
public SharedStructures.TftpServer Tftp_server
|
||||
{
|
||||
set
|
||||
{
|
||||
@@ -1002,19 +838,19 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return new TftpServer();
|
||||
return new SharedStructures.TftpServer();
|
||||
}
|
||||
return new TftpServer();
|
||||
return new SharedStructures.TftpServer();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取TFTP服务器失败: {ex.Message}");
|
||||
return new TftpServer();
|
||||
return new SharedStructures.TftpServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public NetworkEth Network_eth
|
||||
public SharedStructures.NetworkEth Network_eth
|
||||
{
|
||||
set
|
||||
{
|
||||
@@ -1042,14 +878,14 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return new NetworkEth();
|
||||
return new SharedStructures.NetworkEth();
|
||||
}
|
||||
return new NetworkEth();
|
||||
return new SharedStructures.NetworkEth();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取网络参数失败: {ex.Message}");
|
||||
return new NetworkEth();
|
||||
return new SharedStructures.NetworkEth();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1092,7 +928,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
}
|
||||
|
||||
public void Set_envir_param(EnvirParam data)
|
||||
public void Set_envir_param(SharedStructures.EnvirParam data)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1119,7 +955,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
}
|
||||
|
||||
public EnvirParam Get_area_envir_param(int index)
|
||||
public SharedStructures.EnvirParam Get_area_envir_param(int index)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1127,18 +963,18 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return new EnvirParam();
|
||||
return new SharedStructures.EnvirParam();
|
||||
}
|
||||
return new EnvirParam();
|
||||
return new SharedStructures.EnvirParam();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取区域环境参数失败: {ex.Message}");
|
||||
return new EnvirParam();
|
||||
return new SharedStructures.EnvirParam();
|
||||
}
|
||||
}
|
||||
|
||||
public EnvirParam Get_spot_envir_param(int index)
|
||||
public SharedStructures.EnvirParam Get_spot_envir_param(int index)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1146,18 +982,18 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return new EnvirParam();
|
||||
return new SharedStructures.EnvirParam();
|
||||
}
|
||||
return new EnvirParam();
|
||||
return new SharedStructures.EnvirParam();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取点环境参数失败: {ex.Message}");
|
||||
return new EnvirParam();
|
||||
return new SharedStructures.EnvirParam();
|
||||
}
|
||||
}
|
||||
|
||||
public EnvirParam Get_line_envir_param()
|
||||
public SharedStructures.EnvirParam Get_line_envir_param()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1165,18 +1001,18 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return new EnvirParam();
|
||||
return new SharedStructures.EnvirParam();
|
||||
}
|
||||
return new EnvirParam();
|
||||
return new SharedStructures.EnvirParam();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取线环境参数失败: {ex.Message}");
|
||||
return new EnvirParam();
|
||||
return new SharedStructures.EnvirParam();
|
||||
}
|
||||
}
|
||||
|
||||
public EnvirParam Get_globa_envir_param()
|
||||
public SharedStructures.EnvirParam Get_globa_envir_param()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1184,18 +1020,18 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return new EnvirParam();
|
||||
return new SharedStructures.EnvirParam();
|
||||
}
|
||||
return new EnvirParam();
|
||||
return new SharedStructures.EnvirParam();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取全局环境参数失败: {ex.Message}");
|
||||
return new EnvirParam();
|
||||
return new SharedStructures.EnvirParam();
|
||||
}
|
||||
}
|
||||
|
||||
public void Set_alarm_param(AlarmParam data)
|
||||
public void Set_alarm_param(SharedStructures.AlarmParam data)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1227,7 +1063,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
}
|
||||
|
||||
public AlarmParam Get_area_alarm_param(int index)
|
||||
public SharedStructures.AlarmParam Get_area_alarm_param(int index)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1235,18 +1071,18 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return new AlarmParam();
|
||||
return new SharedStructures.AlarmParam();
|
||||
}
|
||||
return new AlarmParam();
|
||||
return new SharedStructures.AlarmParam();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取区域报警参数失败: {ex.Message}");
|
||||
return new AlarmParam();
|
||||
return new SharedStructures.AlarmParam();
|
||||
}
|
||||
}
|
||||
|
||||
public AlarmParam Get_spot_alarm_param(int index)
|
||||
public SharedStructures.AlarmParam Get_spot_alarm_param(int index)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1254,18 +1090,37 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return new AlarmParam();
|
||||
return new SharedStructures.AlarmParam();
|
||||
}
|
||||
return new AlarmParam();
|
||||
return new SharedStructures.AlarmParam();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取点报警参数失败: {ex.Message}");
|
||||
return new AlarmParam();
|
||||
return new SharedStructures.AlarmParam();
|
||||
}
|
||||
}
|
||||
|
||||
public AlarmParam Get_line_alarm_param()
|
||||
public SharedStructures.AlarmParam Get_globa_alarm_param()
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] command = new byte[] { 0x11, 0x05, 0x00, 0x00 };
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return new SharedStructures.AlarmParam();
|
||||
}
|
||||
return new SharedStructures.AlarmParam();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取全局报警参数失败: {ex.Message}");
|
||||
return new SharedStructures.AlarmParam();
|
||||
}
|
||||
}
|
||||
|
||||
public SharedStructures.AlarmParam Get_line_alarm_param()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1273,18 +1128,18 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return new AlarmParam();
|
||||
return new SharedStructures.AlarmParam();
|
||||
}
|
||||
return new AlarmParam();
|
||||
return new SharedStructures.AlarmParam();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取线报警参数失败: {ex.Message}");
|
||||
return new AlarmParam();
|
||||
return new SharedStructures.AlarmParam();
|
||||
}
|
||||
}
|
||||
|
||||
public AreaTemp Get_area_temp(int index)
|
||||
public SharedStructures.AreaTemp Get_area_temp(int index)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1292,18 +1147,18 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return new AreaTemp();
|
||||
return new SharedStructures.AreaTemp();
|
||||
}
|
||||
return new AreaTemp();
|
||||
return new SharedStructures.AreaTemp();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取区域温度失败: {ex.Message}");
|
||||
return new AreaTemp();
|
||||
return new SharedStructures.AreaTemp();
|
||||
}
|
||||
}
|
||||
|
||||
public SpotTemp Get_spot_temp(int index)
|
||||
public SharedStructures.SpotTemp Get_spot_temp(int index)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1311,18 +1166,18 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return new SpotTemp();
|
||||
return new SharedStructures.SpotTemp();
|
||||
}
|
||||
return new SpotTemp();
|
||||
return new SharedStructures.SpotTemp();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取点温度失败: {ex.Message}");
|
||||
return new SpotTemp();
|
||||
return new SharedStructures.SpotTemp();
|
||||
}
|
||||
}
|
||||
|
||||
public LineTemp Get_line_temp()
|
||||
public SharedStructures.LineTemp Get_line_temp()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1330,18 +1185,18 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return new LineTemp();
|
||||
return new SharedStructures.LineTemp();
|
||||
}
|
||||
return new LineTemp();
|
||||
return new SharedStructures.LineTemp();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取线温度失败: {ex.Message}");
|
||||
return new LineTemp();
|
||||
return new SharedStructures.LineTemp();
|
||||
}
|
||||
}
|
||||
|
||||
public GlobaTemp Get_globa_temp()
|
||||
public SharedStructures.GlobaTemp Get_globa_temp()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1349,18 +1204,18 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return new GlobaTemp();
|
||||
return new SharedStructures.GlobaTemp();
|
||||
}
|
||||
return new GlobaTemp();
|
||||
return new SharedStructures.GlobaTemp();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取全局温度失败: {ex.Message}");
|
||||
return new GlobaTemp();
|
||||
return new SharedStructures.GlobaTemp();
|
||||
}
|
||||
}
|
||||
|
||||
public ImageTemp Get_all_temp()
|
||||
public SharedStructures.ImageTemp Get_all_temp()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1368,14 +1223,14 @@ namespace JoyD.Windows.CS.Toprie
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return new ImageTemp();
|
||||
return new SharedStructures.ImageTemp();
|
||||
}
|
||||
return new ImageTemp();
|
||||
return new SharedStructures.ImageTemp();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取所有温度数据失败: {ex.Message}");
|
||||
return new ImageTemp();
|
||||
return new SharedStructures.ImageTemp();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1467,7 +1322,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
{
|
||||
byte[] command = new byte[] { 0x15, 0x02, 0x00, 0x00, (byte)cmd.Length };
|
||||
Array.Resize(ref command, command.Length + cmd.Length);
|
||||
Array.Copy(cmd, 0, command, 5, cmd.Length);
|
||||
Array.Copy(cmd, 0, command, 2, cmd.Length);
|
||||
|
||||
SendCommand(command, out _);
|
||||
}
|
||||
@@ -1477,7 +1332,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
}
|
||||
|
||||
public void Autofocus(FocusParam data)
|
||||
public void Autofocus(SharedStructures.FocusParam data)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1644,18 +1499,18 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
}
|
||||
|
||||
public void Set_time(TimeParam data)
|
||||
public void Set_time(SharedStructures.TimeParam data)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] command = new byte[] { 0x1B, 0x01, 0x00, 0x00 };
|
||||
byte[] dataBytes = new byte[11]; // 1个int + 5个char
|
||||
Array.Copy(BitConverter.GetBytes(data.year), 0, dataBytes, 0, 4);
|
||||
dataBytes[4] = data.month;
|
||||
dataBytes[5] = data.day;
|
||||
dataBytes[6] = data.hour;
|
||||
dataBytes[7] = data.minute;
|
||||
dataBytes[8] = data.second;
|
||||
dataBytes[4] = (byte)data.month;
|
||||
dataBytes[5] = (byte)data.day;
|
||||
dataBytes[6] = (byte)data.hour;
|
||||
dataBytes[7] = (byte)data.minute;
|
||||
dataBytes[8] = (byte)data.second;
|
||||
Array.Resize(ref command, command.Length + dataBytes.Length);
|
||||
Array.Copy(dataBytes, 0, command, 4, dataBytes.Length);
|
||||
|
||||
@@ -1666,5 +1521,46 @@ namespace JoyD.Windows.CS.Toprie
|
||||
Console.WriteLine($"设置系统时间失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
// 新增方法:设置图像模式
|
||||
public void SetImageMode(int mode)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 构建设置图像模式命令
|
||||
byte[] command = new byte[] { 0x02, 0x07, 0x00, 0x00 };
|
||||
byte[] valueBytes = BitConverter.GetBytes(mode);
|
||||
Array.Resize(ref command, command.Length + valueBytes.Length);
|
||||
Array.Copy(valueBytes, 0, command, 4, valueBytes.Length);
|
||||
|
||||
SendCommand(command, out _);
|
||||
Console.WriteLine($"设置图像模式为: {mode}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"设置图像模式失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
// 新增方法:获取图像数据
|
||||
public byte[] GetImageData()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 构建获取图像数据命令
|
||||
byte[] command = new byte[] { 0x02, 0x08, 0x00, 0x00 };
|
||||
|
||||
if (SendCommand(command, out byte[] response))
|
||||
{
|
||||
return response;
|
||||
}
|
||||
return new byte[0];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"获取图像数据失败: {ex.Message}");
|
||||
return new byte[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user