public static void StartTask(object param) { AclasSDK_Args args = (AclasSDK_Args)param; AclasSDK_Initialize(null); uint iAddr = MakeHostToDWord(args.host); uint DataType = args.dataType; TASSDKDeviceInfo DeviceInfo = new TASSDKDeviceInfo(); // 链接不上 bInfo = False;剩的去 ping 了 // 链接超时时间、重试次数在 AclasSDK.ini 中配置 // GetDeviceTimeOut=2000 + GetDeviceTryCount=2 --> 10 秒超时时间 bool boolInfo = AclasSDK_GetDevicesInfo(iAddr, 0, ASSDK_ProtocolType_None, ref DeviceInfo); if (boolInfo) { Utils.StdoutToNodeJs(DISPATCH_CMD, new ResponseAclas(-1)); // 开始 TASSDKOnProgressEvent OnProgress = new TASSDKOnProgressEvent(OnProgressEvent); AclasSDK_WaitForTask(AclasSDK_ExecTaskA(DeviceInfo.Addr, DeviceInfo.Port, DeviceInfo.ProtocolType, ASSDK_ProcType_Down, DataType, args.fileName, OnProgress, null)); // 执行结束,直接释放 AclasSDK_Finalize(); } else { Utils.StdoutToNodeJs(DISPATCH_CMD, new ResponseAclas(501)); // 链接不上 } }
private void btnDownLoad_Click(object sender, EventArgs e) { uint iAddr; uint DataType; // 数据类型。 // ASSDK_DataType_PLU = $0000; PLU // ASSDK_DataType_HotKey = $0003; 热键 DataType = Convert.ToUInt32(tbDataType.Text); iAddr = MakeHostToDWord(tbDeviceIP.Text); TASSDKDeviceInfo DeviceInfo = new TASSDKDeviceInfo(); if (AclasSDK_GetDevicesInfo(iAddr, 0, ASSDK_ProtocolType_None, ref DeviceInfo)) { TASSDKOnProgressEvent OnProgress = new TASSDKOnProgressEvent(OnProgressEvent); AclasSDK_WaitForTask(AclasSDK_ExecTaskA(DeviceInfo.Addr, DeviceInfo.Port, DeviceInfo.ProtocolType, ASSDK_ProcType_Down, DataType, tbFileName.Text, OnProgress, null)); // clear PLU //AclasSDK_WaitForTask(AclasSDK_ExecTaskA(DeviceInfo.Addr, DeviceInfo.Port, DeviceInfo.ProtocolType, // ASSDK_ProcType_Del, ASSDK_DataType_PLU, "*", OnProgress, null)); } }
static public extern Boolean AclasSDK_GetDevicesInfo(UInt32 Addr, UInt32 Port, UInt32 ProtocolType, ref TASSDKDeviceInfo DeviceInfo);