复用SDK
This commit is contained in:
@@ -2,7 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace a8sdk
|
namespace JoyD.Windows.CS.Toprie
|
||||||
{
|
{
|
||||||
public class A8SDK
|
public class A8SDK
|
||||||
{
|
{
|
||||||
@@ -172,56 +172,89 @@ namespace a8sdk
|
|||||||
public char second;
|
public char second;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 私有字段
|
// TODO: 添加DllImport声明
|
||||||
|
// [DllImport(@"SDK\a8sdk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "sdk_initialize")]
|
||||||
|
// private static extern int SdkInitialize();
|
||||||
|
// ... 其他DllImport声明 ...
|
||||||
|
|
||||||
private readonly IntPtr ipx;
|
private readonly IntPtr ipx;
|
||||||
|
|
||||||
// 构造函数和析构函数
|
|
||||||
public A8SDK(string ip)
|
public A8SDK(string ip)
|
||||||
{
|
{
|
||||||
// TODO: 实现IP指针转换
|
ipx = Marshal.StringToHGlobalAnsi(ip);
|
||||||
ipx = IntPtr.Zero;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~A8SDK()
|
~A8SDK()
|
||||||
{
|
{
|
||||||
// TODO: 实现资源释放
|
Marshal.FreeHGlobal(ipx);
|
||||||
|
// 注意:不再直接调用SdkDestroy(),全局资源由静态方法SDK_destroy()统一管理
|
||||||
}
|
}
|
||||||
|
|
||||||
// 静态方法
|
|
||||||
public static int SDK_initialize()
|
public static int SDK_initialize()
|
||||||
{
|
{
|
||||||
// TODO: 实现SDK初始化
|
// TODO: 实现SDK初始化 - 需添加DllImport声明
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int SDK_destroy()
|
public static int SDK_destroy()
|
||||||
{
|
{
|
||||||
// TODO: 实现SDK清理
|
// TODO: 实现SDK清理 - 需添加DllImport声明
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String SDK_serch_device(int list_len)
|
public static String SDK_serch_device(int list_len)
|
||||||
{
|
{
|
||||||
// TODO: 实现设备搜索
|
// TODO: 实现设备搜索 - 需添加DllImport声明
|
||||||
return string.Empty;
|
// 根据list_len参数分配足够的内存,至少128字节
|
||||||
|
int bufferSize = Math.Max(128, list_len);
|
||||||
|
IntPtr device_list = Marshal.AllocHGlobal(bufferSize);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 调用SDK搜索设备,并检查返回值
|
||||||
|
// int result = SdkSearchDevice(device_list, list_len);
|
||||||
|
// if (result != 0)
|
||||||
|
// {
|
||||||
|
// // 搜索失败,返回空字符串或错误信息
|
||||||
|
// return string.Empty;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 安全地将非托管内存转换为字符串
|
||||||
|
string str = Marshal.PtrToStringAnsi(device_list);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// 捕获可能的异常
|
||||||
|
Console.WriteLine($"搜索设备时出错: {ex.Message}");
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
// 确保在任何情况下都释放内存
|
||||||
|
Marshal.FreeHGlobal(device_list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 方法实现
|
|
||||||
public void Shutter_correction()
|
public void Shutter_correction()
|
||||||
{
|
{
|
||||||
// TODO: 实现快门校正
|
// TODO: 实现快门校正 - 需添加DllImport声明
|
||||||
|
// SdkShutterCorrection(ipx);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Shutter_times
|
public int Shutter_times
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取快门时间
|
// TODO: 实现获取快门时间 - 需添加DllImport声明
|
||||||
return 0;
|
int i = 0;
|
||||||
|
// unsafe { SdkGetShutterAutoCorrection(ipx, &i); }
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置快门时间
|
// TODO: 实现设置快门时间 - 需添加DllImport声明
|
||||||
|
// SdkSetShutterAutoCorrection(ipx, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,12 +262,15 @@ namespace a8sdk
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取色板
|
// TODO: 实现获取色板 - 需添加DllImport声明
|
||||||
return 0;
|
int i = 0;
|
||||||
|
// unsafe { SdkGetColorPlate(ipx, &i); }
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置色板
|
// TODO: 实现设置色板 - 需添加DllImport声明
|
||||||
|
// SdkSetColorPlate(ipx, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,12 +278,15 @@ namespace a8sdk
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取镜像模式
|
// TODO: 实现获取镜像模式 - 需添加DllImport声明
|
||||||
return 0;
|
int i = 0;
|
||||||
|
// unsafe { SdkGetVideoMirror(ipx, &i); }
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置镜像模式
|
// TODO: 实现设置镜像模式 - 需添加DllImport声明
|
||||||
|
// SdkSetVideoMirror(ipx, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,47 +294,62 @@ namespace a8sdk
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取视频模式
|
// TODO: 实现获取视频模式 - 需添加DllImport声明
|
||||||
return 0;
|
int i = 0;
|
||||||
|
// unsafe { SdkGetVideoMode(ipx, &i); }
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置视频模式
|
// TODO: 实现设置视频模式 - 需添加DllImport声明
|
||||||
|
// SdkSetVideoMode(ipx, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Set_area_pos(int index, AreaPos area_data)
|
public void Set_area_pos(int index, AreaPos area_data)
|
||||||
{
|
{
|
||||||
// TODO: 实现设置区域位置
|
// TODO: 实现设置区域位置 - 需添加DllImport声明
|
||||||
|
// unsafe { SdkSetAreaPos(ipx, index, &area_data); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public AreaPos Get_area_pos(int index)
|
public AreaPos Get_area_pos(int index)
|
||||||
{
|
{
|
||||||
// TODO: 实现获取区域位置
|
// TODO: 实现获取区域位置 - 需添加DllImport声明
|
||||||
return new AreaPos();
|
AreaPos area_data = new AreaPos();
|
||||||
|
// unsafe { SdkGetAreaPos(ipx, index, &area_data); }
|
||||||
|
return area_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Set_spot_pos(int index, SpotPos spot_data)
|
public void Set_spot_pos(int index, SpotPos spot_data)
|
||||||
{
|
{
|
||||||
// TODO: 实现设置点位置
|
// TODO: 实现设置点位置 - 需添加DllImport声明
|
||||||
|
// unsafe { SdkSetSpotPos(ipx, index, &spot_data); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpotPos Get_spot_pos(int index)
|
public SpotPos Get_spot_pos(int index)
|
||||||
{
|
{
|
||||||
// TODO: 实现获取点位置
|
// TODO: 实现获取点位置 - 需添加DllImport声明
|
||||||
return new SpotPos();
|
SpotPos spot_data = new SpotPos();
|
||||||
|
// unsafe { SdkGetSpotPos(ipx, index, &spot_data); }
|
||||||
|
return spot_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinePos Line_pos
|
public LinePos Line_pos
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置线位置
|
// TODO: 实现设置线位置 - 需添加DllImport声明
|
||||||
|
// unsafe
|
||||||
|
// {
|
||||||
|
// SdkSetLinePos(ipx, &value);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取线位置
|
// TODO: 实现获取线位置 - 需添加DllImport声明
|
||||||
return new LinePos();
|
LinePos line_data = new LinePos();
|
||||||
|
// unsafe { SdkGetLinePos(ipx, &line_data); }
|
||||||
|
return line_data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,8 +357,13 @@ namespace a8sdk
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取所有位置
|
// TODO: 实现获取所有位置 - 需添加DllImport声明
|
||||||
return new ImagePos();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(ImagePos)));
|
||||||
|
ImagePos data = new ImagePos();
|
||||||
|
// SdkGetAllPos(ipx, ip);
|
||||||
|
// data = (ImagePos)Marshal.PtrToStructure(ip, typeof(ImagePos));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,12 +371,15 @@ namespace a8sdk
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置温度范围
|
// TODO: 实现设置温度范围 - 需添加DllImport声明
|
||||||
|
// SdkSetTempRange(ipx, value);
|
||||||
}
|
}
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取温度范围
|
// TODO: 实现获取温度范围 - 需添加DllImport声明
|
||||||
return 0;
|
int i = 0;
|
||||||
|
// unsafe { SdkGetTempRange(ipx, &i); }
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,12 +387,15 @@ namespace a8sdk
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置X偏移
|
// TODO: 实现设置X偏移 - 需添加DllImport声明
|
||||||
|
// SdkSetVideoIspXOffset(ipx, value);
|
||||||
}
|
}
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取X偏移
|
// TODO: 实现获取X偏移 - 需添加DllImport声明
|
||||||
return 0;
|
int i = 0;
|
||||||
|
// unsafe { SdkGetVideoIspXOffset(ipx, &i); }
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,12 +403,15 @@ namespace a8sdk
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置Y偏移
|
// TODO: 实现设置Y偏移 - 需添加DllImport声明
|
||||||
|
// SdkSetVideoIspYOffset(ipx, value);
|
||||||
}
|
}
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取Y偏移
|
// TODO: 实现获取Y偏移 - 需添加DllImport声明
|
||||||
return 0;
|
int i = 0;
|
||||||
|
// unsafe { SdkGetVideoIspYOffset(ipx, &i); }
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,12 +419,15 @@ namespace a8sdk
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置X缩放
|
// TODO: 实现设置X缩放 - 需添加DllImport声明
|
||||||
|
// SdkSetVideoIspXScale(ipx, value);
|
||||||
}
|
}
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取X缩放
|
// TODO: 实现获取X缩放 - 需添加DllImport声明
|
||||||
return 0;
|
int i = 0;
|
||||||
|
// unsafe { SdkGetVideoIspXScale(ipx, &i); }
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,12 +435,15 @@ namespace a8sdk
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置Y缩放
|
// TODO: 实现设置Y缩放 - 需添加DllImport声明
|
||||||
|
// SdkSetVideoIspYScale(ipx, value);
|
||||||
}
|
}
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取Y缩放
|
// TODO: 实现获取Y缩放 - 需添加DllImport声明
|
||||||
return 0;
|
int i = 0;
|
||||||
|
// unsafe { SdkGetVideoIspYScale(ipx, &i); }
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,12 +451,15 @@ namespace a8sdk
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置LED
|
// TODO: 实现设置LED - 需添加DllImport声明
|
||||||
|
// SdkSetLed(ipx, value);
|
||||||
}
|
}
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取LED状态
|
// TODO: 实现获取LED状态 - 需添加DllImport声明
|
||||||
return 0;
|
int i = 0;
|
||||||
|
// unsafe { SdkGetLed(ipx, &i); }
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,12 +467,21 @@ namespace a8sdk
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置邮件服务器
|
// TODO: 实现设置邮件服务器 - 需添加DllImport声明
|
||||||
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(EmailServer)));
|
||||||
|
Marshal.StructureToPtr(value, ip, true);
|
||||||
|
// SdkSetEmailServer(ipx, ip);
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
}
|
}
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取邮件服务器
|
// TODO: 实现获取邮件服务器 - 需添加DllImport声明
|
||||||
return new EmailServer();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(EmailServer)));
|
||||||
|
EmailServer data = new EmailServer();
|
||||||
|
// SdkGetEmailServer(ipx, ip);
|
||||||
|
// data = (EmailServer)Marshal.PtrToStructure(ip, typeof(EmailServer));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,12 +489,21 @@ namespace a8sdk
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置TFTP服务器
|
// TODO: 实现设置TFTP服务器 - 需添加DllImport声明
|
||||||
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(TftpServer)));
|
||||||
|
Marshal.StructureToPtr(value, ip, true);
|
||||||
|
// SdkSetTftpServer(ipx, ip);
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
}
|
}
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取TFTP服务器
|
// TODO: 实现获取TFTP服务器 - 需添加DllImport声明
|
||||||
return new TftpServer();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(TftpServer)));
|
||||||
|
TftpServer data = new TftpServer();
|
||||||
|
// SdkGetTftpServer(ipx, ip);
|
||||||
|
// data = (TftpServer)Marshal.PtrToStructure(ip, typeof(TftpServer));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,12 +511,21 @@ namespace a8sdk
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置网络参数
|
// TODO: 实现设置网络参数 - 需添加DllImport声明
|
||||||
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NetworkEth)));
|
||||||
|
Marshal.StructureToPtr(value, ip, true);
|
||||||
|
// SdkSetNetworkEth(ipx, ip);
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
}
|
}
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取网络参数
|
// TODO: 实现获取网络参数 - 需添加DllImport声明
|
||||||
return new NetworkEth();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NetworkEth)));
|
||||||
|
NetworkEth data = new NetworkEth();
|
||||||
|
// SdkGetNetworkEth(ipx, ip);
|
||||||
|
// data = (NetworkEth)Marshal.PtrToStructure(ip, typeof(NetworkEth));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,166 +533,285 @@ namespace a8sdk
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置融合距离
|
// TODO: 实现设置融合距离 - 需添加DllImport声明
|
||||||
|
// SdkSetFusionDistance(ipx, value);
|
||||||
}
|
}
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取融合距离
|
// TODO: 实现获取融合距离 - 需添加DllImport声明
|
||||||
return 0;
|
int i = 0;
|
||||||
|
// unsafe { SdkGetFusionDistance(ipx, &i); }
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Set_envir_param(EnvirParam data)
|
public void Set_envir_param(EnvirParam data)
|
||||||
{
|
{
|
||||||
// TODO: 实现设置环境参数
|
// TODO: 实现设置环境参数 - 需添加DllImport声明
|
||||||
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(EnvirParam)));
|
||||||
|
Marshal.StructureToPtr(data, ip, true);
|
||||||
|
// SdkSetEnvirParam(ipx, ip);
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnvirParam Get_area_envir_param(int index)
|
public EnvirParam Get_area_envir_param(int index)
|
||||||
{
|
{
|
||||||
// TODO: 实现获取区域环境参数
|
// TODO: 实现获取区域环境参数 - 需添加DllImport声明
|
||||||
return new EnvirParam();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(EnvirParam)));
|
||||||
|
EnvirParam data = new EnvirParam();
|
||||||
|
// SdkGetAreaEnvirParam(ipx, index, ip);
|
||||||
|
// data = (EnvirParam)Marshal.PtrToStructure(ip, typeof(EnvirParam));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnvirParam Get_spot_envir_param(int index)
|
public EnvirParam Get_spot_envir_param(int index)
|
||||||
{
|
{
|
||||||
// TODO: 实现获取点环境参数
|
// TODO: 实现获取点环境参数 - 需添加DllImport声明
|
||||||
return new EnvirParam();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(EnvirParam)));
|
||||||
|
EnvirParam data = new EnvirParam();
|
||||||
|
// SdkGetSpotEnvirParam(ipx, index, ip);
|
||||||
|
// data = (EnvirParam)Marshal.PtrToStructure(ip, typeof(EnvirParam));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnvirParam Get_line_envir_param()
|
public EnvirParam Get_line_envir_param()
|
||||||
{
|
{
|
||||||
// TODO: 实现获取线环境参数
|
// TODO: 实现获取线环境参数 - 需添加DllImport声明
|
||||||
return new EnvirParam();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(EnvirParam)));
|
||||||
|
EnvirParam data = new EnvirParam();
|
||||||
|
// SdkGetLineEnvirParam(ipx, 0, ip);
|
||||||
|
// data = (EnvirParam)Marshal.PtrToStructure(ip, typeof(EnvirParam));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnvirParam Get_globa_envir_param()
|
public EnvirParam Get_globa_envir_param()
|
||||||
{
|
{
|
||||||
// TODO: 实现获取全局环境参数
|
// TODO: 实现获取全局环境参数 - 需添加DllImport声明
|
||||||
return new EnvirParam();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(EnvirParam)));
|
||||||
|
EnvirParam data = new EnvirParam();
|
||||||
|
// SdkGetGlobaEnvirParam(ipx, ip);
|
||||||
|
// data = (EnvirParam)Marshal.PtrToStructure(ip, typeof(EnvirParam));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Set_alarm_param(AlarmParam data)
|
public void Set_alarm_param(AlarmParam data)
|
||||||
{
|
{
|
||||||
// TODO: 实现设置报警参数
|
// TODO: 实现设置报警参数 - 需添加DllImport声明
|
||||||
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(AlarmParam)));
|
||||||
|
Marshal.StructureToPtr(data, ip, true);
|
||||||
|
// SdkSetAlarmParam(ipx, ip);
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlarmParam Get_area_alarm_param(int index)
|
public AlarmParam Get_area_alarm_param(int index)
|
||||||
{
|
{
|
||||||
// TODO: 实现获取区域报警参数
|
// TODO: 实现获取区域报警参数 - 需添加DllImport声明
|
||||||
return new AlarmParam();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(AlarmParam)));
|
||||||
|
AlarmParam data = new AlarmParam();
|
||||||
|
// SdkGetAreaAlarmParam(ipx, index, ip);
|
||||||
|
// data = (AlarmParam)Marshal.PtrToStructure(ip, typeof(AlarmParam));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlarmParam Get_spot_alarm_param(int index)
|
public AlarmParam Get_spot_alarm_param(int index)
|
||||||
{
|
{
|
||||||
// TODO: 实现获取点报警参数
|
// TODO: 实现获取点报警参数 - 需添加DllImport声明
|
||||||
return new AlarmParam();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(AlarmParam)));
|
||||||
|
AlarmParam data = new AlarmParam();
|
||||||
|
// SdkGetSpotAlarmParam(ipx, index, ip);
|
||||||
|
// data = (AlarmParam)Marshal.PtrToStructure(ip, typeof(AlarmParam));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlarmParam Get_globa_alarm_param()
|
public AlarmParam Get_globa_alarm_param()
|
||||||
{
|
{
|
||||||
// TODO: 实现获取全局报警参数
|
// TODO: 实现获取全局报警参数 - 需添加DllImport声明
|
||||||
return new AlarmParam();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(AlarmParam)));
|
||||||
|
AlarmParam data = new AlarmParam();
|
||||||
|
// SdkGetLineAlarmParam(ipx, 0, ip);
|
||||||
|
// data = (AlarmParam)Marshal.PtrToStructure(ip, typeof(AlarmParam));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlarmParam Get_line_alarm_param()
|
public AlarmParam Get_line_alarm_param()
|
||||||
{
|
{
|
||||||
// TODO: 实现获取线报警参数
|
// TODO: 实现获取线报警参数 - 需添加DllImport声明
|
||||||
return new AlarmParam();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(AlarmParam)));
|
||||||
|
AlarmParam data = new AlarmParam();
|
||||||
|
// SdkGetLineAlarmParam(ipx, 0, ip);
|
||||||
|
// data = (AlarmParam)Marshal.PtrToStructure(ip, typeof(AlarmParam));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AreaTemp Get_area_temp(int index)
|
public AreaTemp Get_area_temp(int index)
|
||||||
{
|
{
|
||||||
// TODO: 实现获取区域温度
|
// TODO: 实现获取区域温度 - 需添加DllImport声明
|
||||||
return new AreaTemp();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(AreaTemp)));
|
||||||
|
AreaTemp data = new AreaTemp();
|
||||||
|
// SdkGetAreaTempData(ipx, index, ip);
|
||||||
|
// data = (AreaTemp)Marshal.PtrToStructure(ip, typeof(AreaTemp));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpotTemp Get_spot_temp(int index)
|
public SpotTemp Get_spot_temp(int index)
|
||||||
{
|
{
|
||||||
// TODO: 实现获取点温度
|
// TODO: 实现获取点温度 - 需添加DllImport声明
|
||||||
return new SpotTemp();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(SpotTemp)));
|
||||||
|
SpotTemp data = new SpotTemp();
|
||||||
|
// SdkGetSpotTempData(ipx, index, ip);
|
||||||
|
// data = (SpotTemp)Marshal.PtrToStructure(ip, typeof(SpotTemp));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LineTemp Get_line_temp()
|
public LineTemp Get_line_temp()
|
||||||
{
|
{
|
||||||
// TODO: 实现获取线温度
|
// TODO: 实现获取线温度 - 需添加DllImport声明
|
||||||
return new LineTemp();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(LineTemp)));
|
||||||
|
LineTemp data = new LineTemp();
|
||||||
|
// SdkGetLineTempData(ipx, 0, ip);
|
||||||
|
// data = (LineTemp)Marshal.PtrToStructure(ip, typeof(LineTemp));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GlobaTemp Get_globa_temp()
|
public GlobaTemp Get_globa_temp()
|
||||||
{
|
{
|
||||||
// TODO: 实现获取全局温度
|
// TODO: 实现获取全局温度 - 需添加DllImport声明
|
||||||
return new GlobaTemp();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(GlobaTemp)));
|
||||||
|
GlobaTemp data = new GlobaTemp();
|
||||||
|
// SdkGetGlobaTempData(ipx, ip);
|
||||||
|
// data = (GlobaTemp)Marshal.PtrToStructure(ip, typeof(GlobaTemp));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageTemp Get_all_temp()
|
public ImageTemp Get_all_temp()
|
||||||
{
|
{
|
||||||
// TODO: 实现获取所有温度数据
|
// TODO: 实现获取所有温度数据 - 需添加DllImport声明
|
||||||
return new ImageTemp();
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(ImageTemp)));
|
||||||
|
ImageTemp data = new ImageTemp();
|
||||||
|
// SdkGetAllTempData(ipx, ip);
|
||||||
|
// data = (ImageTemp)Marshal.PtrToStructure(ip, typeof(ImageTemp));
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Power_reboot()
|
public void Power_reboot()
|
||||||
{
|
{
|
||||||
// TODO: 实现设备重启
|
// TODO: 实现设备重启 - 需添加DllImport声明
|
||||||
|
// SdkPowerReboot(ipx);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Param_recover()
|
public void Param_recover()
|
||||||
{
|
{
|
||||||
// TODO: 实现参数恢复
|
// TODO: 实现参数恢复 - 需添加DllImport声明
|
||||||
|
// SdkParamRecover(ipx);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
// TODO: 实现设备更新
|
// TODO: 实现设备更新 - 需添加DllImport声明
|
||||||
|
// SdkUpdate(ipx);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Heartbeat()
|
public int Heartbeat()
|
||||||
{
|
{
|
||||||
// TODO: 实现心跳检测
|
// TODO: 实现心跳检测 - 需添加DllImport声明
|
||||||
return 0;
|
try
|
||||||
|
{
|
||||||
|
// 确保ipx指针有效
|
||||||
|
if (ipx == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Console.WriteLine("SDK实例IP指针无效");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// int result = SdkHeartbeat(ipx);
|
||||||
|
return 0; // 默认返回0表示成功
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"心跳检测异常: {ex.Message}");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Set_uart(int nSpeed, int nBits, char nEvent, int nStop)
|
public void Set_uart(int nSpeed, int nBits, char nEvent, int nStop)
|
||||||
{
|
{
|
||||||
// TODO: 实现设置串口
|
// TODO: 实现设置串口 - 需添加DllImport声明
|
||||||
|
// SdkSetUart(ipx, nSpeed, nBits, nEvent, nStop);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Send_uart_command(byte[] cmd)
|
public void Send_uart_command(byte[] cmd)
|
||||||
{
|
{
|
||||||
// TODO: 实现发送串口命令
|
// TODO: 实现发送串口命令 - 需添加DllImport声明
|
||||||
|
IntPtr ip = Marshal.AllocHGlobal(cmd.Length);
|
||||||
|
char len = (char)cmd.Length;
|
||||||
|
// SdkSendUartCommand(ipx, ip, len);
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Autofocus(FocusParam data)
|
public void Autofocus(FocusParam data)
|
||||||
{
|
{
|
||||||
// TODO: 实现自动对焦
|
// TODO: 实现自动对焦 - 需添加DllImport声明
|
||||||
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(FocusParam)));
|
||||||
|
Marshal.StructureToPtr(data, ip, true);
|
||||||
|
// SdkAutofocus(ipx, ip);
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Set_device_name(string data)
|
public void Set_device_name(string data)
|
||||||
{
|
{
|
||||||
// TODO: 实现设置设备名称
|
// TODO: 实现设置设备名称 - 需添加DllImport声明
|
||||||
|
IntPtr ip = Marshal.StringToHGlobalAnsi(data);
|
||||||
|
// SdkSetDeviceName(ipx, ip);
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Get_device_name()
|
public string Get_device_name()
|
||||||
{
|
{
|
||||||
// TODO: 实现获取设备名称
|
// TODO: 实现获取设备名称 - 需添加DllImport声明
|
||||||
return string.Empty;
|
IntPtr ip = Marshal.AllocHGlobal(128);
|
||||||
|
// SdkGetDeviceName(ipx, ip);
|
||||||
|
string str = Marshal.PtrToStringAnsi(ip);
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] Get_detect_number()
|
public byte[] Get_detect_number()
|
||||||
{
|
{
|
||||||
// TODO: 实现获取检测编号
|
// TODO: 实现获取检测编号 - 需添加DllImport声明
|
||||||
return new byte[0];
|
IntPtr ip = Marshal.AllocHGlobal(20);
|
||||||
|
// SdkGetDetectNumber(ipx, ip);
|
||||||
|
byte[] data = new byte[20];
|
||||||
|
// Marshal.Copy(ip, data, 0, 20);
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public char Temp_frame
|
public char Temp_frame
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置温度帧
|
// TODO: 实现设置温度帧 - 需添加DllImport声明
|
||||||
|
// SdkSetTempFrame(ipx, value);
|
||||||
}
|
}
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取温度帧
|
// TODO: 实现获取温度帧 - 需添加DllImport声明
|
||||||
return (char)0;
|
char i = (char)0;
|
||||||
|
// unsafe { SdkGetTempFrame(ipx, &i); }
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -596,12 +819,15 @@ namespace a8sdk
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// TODO: 实现设置报警输出
|
// TODO: 实现设置报警输出 - 需添加DllImport声明
|
||||||
|
// SdkSetAlarmOut(ipx, value);
|
||||||
}
|
}
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取报警输入
|
// TODO: 实现获取报警输入 - 需添加DllImport声明
|
||||||
return (char)0;
|
char i = (char)0;
|
||||||
|
// unsafe { SdkGetAlarmIn(ipx, &i); }
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -609,14 +835,20 @@ namespace a8sdk
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// TODO: 实现获取补偿温度
|
// TODO: 实现获取补偿温度 - 需添加DllImport声明
|
||||||
return 0;
|
int i = 0;
|
||||||
|
// unsafe { SdkGetCompTemp(ipx, &i); }
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Set_time(TimeParam data)
|
public void Set_time(TimeParam data)
|
||||||
{
|
{
|
||||||
// TODO: 实现设置系统时间
|
// TODO: 实现设置系统时间 - 需添加DllImport声明
|
||||||
|
IntPtr ip = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(TimeParam)));
|
||||||
|
Marshal.StructureToPtr(data, ip, true);
|
||||||
|
// SdkSetTime(ipx, ip);
|
||||||
|
Marshal.FreeHGlobal(ip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user