Beispiel #1
0
        public async Task <TaskParam> TraceAsync(int nChPort, string strMsvIP, TaskParam pTaskparam, string strTaskName, string pCaptureparam, Sobey.Core.Log.ILogger logger)
        {
            MSV_RET ret;

            try
            {
                TASK_PARAM tmptaskparam = new TASK_PARAM();
                ClientParam2MSVTskParam(pTaskparam, ref tmptaskparam);
                TASK_ALL_PARAM_NEW task = new TASK_ALL_PARAM_NEW();
                task.taskParam.ulID    = tmptaskparam.ulID;
                task.taskParam.strName = strTaskName;
                task.nCutLen           = 10;
                task.captureParam      = pCaptureparam;
                //ret = _clientSdk.MSVStartRetrospectTask(strMsvIP, task, nChPort, logger);
                ret = await _clientSdk.MSVStartRetrospectTaskAsync(strMsvIP, task, nChPort, logger).ConfigureAwait(true);

                if (ret != MSV_RET.MSV_SUCCESS)
                {
                    logger.Error($"MSVStartRetrospectTask falied, error:{_clientSdk.MSVGetLastErrorString()} ");
                    return(pTaskparam);
                }
                logger.Info($"MSVStartRetrospectTask end......MsvUdpClientCtrlSDK Trace");
            }
            catch (Exception e)
            {
                logger.Error($"MsvUdpClientCtrlSDK::Trace falied, Exception:{e.Message} ");
                return(null);
            }
            return(null);
        }
Beispiel #2
0
        public async Task <bool> RecordAsync(TASK_ALL_PARAM_NEW allparam, int nChPort, string strMsvIP, Sobey.Core.Log.ILogger logger)
        {
            MSV_RET ret;
            string  strMutPath = "";
            string  strPath    = "";
            int     nMsvRet    = 0;

            try
            {
                var _xml = new XmlDocument();
                _xml.LoadXml(allparam.captureParam);
                XmlElement _root    = _xml.DocumentElement;
                XmlNode    pathNode = _root.SelectSingleNode("multiDest");
                if (pathNode != null)
                {
                    strPath    = pathNode.InnerText;
                    strMutPath = string.Format("<multiDest><taskid>{0}</taskid>{1}</multiDest>", allparam.taskParam.ulID, strPath);
                    //ret = _clientSdk.MSVSetMulDestPath(strMsvIP, strMutPath, logger);
                    ret = await _clientSdk.MSVSetMulDestPathAsync(strMsvIP, nChPort, strMutPath, logger).ConfigureAwait(true);

                    if (ret == MSV_RET.MSV_NETERROR)
                    {
                        logger.Error($"MSVSetMulDestPath::taskName={allparam.taskParam.strName};Error:{_clientSdk.MSVGetLastErrorString()}!");
                    }
                }

                allparam.nCutLen = 10;
                logger.Info($"MsvSDK Record Prepare Cast MSVStartTaskNew Function ip={strMsvIP} port={nChPort} cutlen={allparam.nCutLen}");

                //ret = _clientSdk.MSVStartTaskNew(strMsvIP, m_taskAllParam, nChPort, logger);
                ret     = await _clientSdk.MSVStartTaskNewAsync(strMsvIP, allparam, nChPort, logger).ConfigureAwait(true);;
                nMsvRet = Convert.ToInt32(ret);
                if (ret == MSV_RET.MSV_NETERROR)
                {
                    logger.Error("MsvSDK Record Failed(MSV_NETERROR)!...........MsvUdpClientCtrlSDK::Record");
                    return(false);
                }
                if (ret != MSV_RET.MSV_SUCCESS)
                {
                    logger.Error($"MsvSDK Record Failed {ret} {_clientSdk.MSVGetLastErrorString()}");
                    return(false);
                }
                return(true);
            }
            catch (Exception e)
            {
                logger.Error($"MsvUdpClientCtrlSDK::Record, Exception:{e.Message}");
                return(false);
            }
        }