Exemple #1
0
        public void MSVTskParam2ClientParam(TASK_PARAM pTaskparam, ref TaskParam tmptaskparam)
        {
            tmptaskparam.taskID     = Convert.ToInt32(pTaskparam.ulID);
            tmptaskparam.inOutCount = pTaskparam.nInOutCount;
            tmptaskparam.cutLen     = 0;
            tmptaskparam.isRetro    = pTaskparam.bRetrospect;
            //byte[] y = new byte[4096];
            //y = pTaskparam.TaskName.Cast<byte>().ToArray();
            tmptaskparam.taskName = pTaskparam.strName;
            int nlen = 0;

            nlen = pTaskparam.dwInFrame.Length;
            tmptaskparam.inOutCount = nlen;
            tmptaskparam.tmBeg      = pTaskparam.tmBeg;
            tmptaskparam.inFrame    = new int[100];
            tmptaskparam.outFrame   = new int[100];
            tmptaskparam.totalFrame = new int[100];
            for (int i = 0; i < 100; i++)
            {
                tmptaskparam.inFrame[i]    = Convert.ToInt32(pTaskparam.dwInFrame[i]);
                tmptaskparam.outFrame[i]   = Convert.ToInt32(pTaskparam.dwOutFrame[i]);
                tmptaskparam.totalFrame[i] = Convert.ToInt32(pTaskparam.dwTotalFrame[i]);
            }
            tmptaskparam.retroFrame = 0;
            tmptaskparam.isPlanMode = true;
            tmptaskparam.tmBeg      = pTaskparam.tmBeg;
        }
Exemple #2
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);
        }
Exemple #3
0
        public void ClientParam2MSVTskParam(TaskParam tmptaskparam, ref TASK_PARAM pTaskparam)
        {
            if (tmptaskparam != null)
            {
                pTaskparam.ulID        = tmptaskparam.taskID;
                pTaskparam.nInOutCount = tmptaskparam.inOutCount;
                pTaskparam.strName     = tmptaskparam.taskName;
                if (pTaskparam.nInOutCount > 0)
                {
                    pTaskparam.dwInFrame    = new ulong[100];
                    pTaskparam.dwOutFrame   = new ulong[100];
                    pTaskparam.dwTotalFrame = new ulong[100];
                    for (int i = 0; i < pTaskparam.nInOutCount; i++)
                    {
                        pTaskparam.dwInFrame[i]    = Convert.ToUInt64(tmptaskparam.inFrame[i]);
                        pTaskparam.dwOutFrame[i]   = Convert.ToUInt64(tmptaskparam.outFrame[i]);
                        pTaskparam.dwTotalFrame[i] = Convert.ToUInt64(tmptaskparam.totalFrame[i]);
                    }

                    //pTaskparam.bUseTime = 0;
                    pTaskparam.bUseTime = false;
                }
                else
                {
                    // Add by chenzhi 2012-01-14
                    // TODO: 增加对计划任务采集的支持
                    //if (tmptaskparam.isPlanMode)
                    //{
                    //    pTaskparam.bUseTime = 2;
                    //}
                    //else
                    //{
                    //    pTaskparam.bUseTime = 1;
                    //}
                    pTaskparam.bUseTime = true;
                }
            }
        }
Exemple #4
0
        public TASK_ALL_PARAM_NEW RecordReady(int nChPort, string strMsvIP, TaskParam pTaskparam, string strTaskName, string pCaptureparam, Sobey.Core.Log.ILogger logger)
        {
            if (pTaskparam == null)
            {
                logger.Error("RecordReady: pTaskparam is null!");
                return(null);
            }
            TASK_PARAM param     = new TASK_PARAM();
            TASK_PARAM taskParam = new TASK_PARAM();

            try
            {
                logger.Info($"MsvSDK Record Ready!,taskID:{pTaskparam.taskID},pCaptureparam:{pCaptureparam} ");
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(pCaptureparam);
                XmlNode root = doc.DocumentElement;
                //string curDate = DateTime.Now.ToString("yyyy-MM-dd") + '\\';
                string curDate = DateTime.Now.ToString("yyyy-MM-dd");
                if (root != null)
                {
                    //XmlNode _capTure = root.SelectSingleNode("CAPTUREPARAM");

                    XmlNode _fileName0 = root.SelectSingleNode("path0FileName");
                    if (_fileName0 != null)
                    {
                        string fileName0 = _fileName0.InnerText;
                        //fileName0 += curDate;
                        //                         int nIndex = fileName0.LastIndexOf('\\');
                        //                         if (nIndex == fileName0.Length - 1)
                        //                             fileName0 = fileName0.Substring(0, nIndex);
                        //                         int nPos = fileName0.LastIndexOf('\\');
                        //                         fileName0 = fileName0.Insert(nPos + 1, curDate);
                        //fileName0 = fileName0.Substring(0, nPos + 1);
                        //fileName0 = fileName0 + curDate;
                        fileName0            = fileName0.Replace("yyyy-mm-dd", curDate);
                        _fileName0.InnerText = fileName0;
                    }
                    else
                    {
                        logger.Error("Not find fileName0:");
                    }
                    XmlNode _fileName1 = root.SelectSingleNode("path1FileName");
                    if (_fileName1 != null)
                    {
                        string fileName1 = _fileName1.InnerText;
                        //fileName1 += curDate;
                        //                         int nIndex = fileName1.LastIndexOf('\\');
                        //                         if (nIndex == fileName1.Length - 1)
                        //                             fileName1 = fileName1.Substring(0, nIndex);
                        //                         int nPos = fileName1.LastIndexOf('\\');
                        //                         fileName1 = fileName1.Insert(nPos + 1, curDate);
                        //fileName1 = fileName1.Substring(0, nPos + 1);
                        //fileName1 = fileName1 + curDate;
                        fileName1            = fileName1.Replace("yyyy-mm-dd", curDate);
                        _fileName1.InnerText = fileName1;
                    }
                    else
                    {
                        logger.Error("Not find fileName1:");
                    }
                }
                else
                {
                    logger.Error("root is null");
                }
                pCaptureparam = doc.InnerXml;
                logger.Info($"MsvSDK Record Ready!, taskID:{pTaskparam.taskID}, lastCapture:{pCaptureparam}...........RecordReady");
                ClientParam2MSVTskParam(pTaskparam, ref param);
                taskParam.bRetrospect    = param.bRetrospect;
                taskParam.bUseTime       = param.bUseTime;
                taskParam.channel        = param.channel;
                taskParam.dwCutClipFrame = param.dwCutClipFrame;
                taskParam.nInOutCount    = param.nInOutCount;
                taskParam.strName        = param.strName;
                for (int i = 0; i < taskParam.nInOutCount; i++)
                {
                    taskParam.dwInFrame[i]    = param.dwInFrame[i];
                    taskParam.dwOutFrame[i]   = param.dwOutFrame[i];
                    taskParam.dwTotalFrame[i] = param.dwTotalFrame[i];
                }


                taskParam.nSignalID = param.nSignalID;
                taskParam.nTimeCode = param.nTimeCode;
                //m_taskparam.strDesc.Format(_T("%s"),pTaskparam->strDesc);
                //m_taskParam.strName = strTaskName;

                taskParam.tmBeg     = DateTime.Now;
                taskParam.tmEnd     = DateTime.Now;
                taskParam.ulID      = param.ulID;
                taskParam.TaskMode  = (TASK_MODE)param.TaskMode;
                taskParam.TaskState = (TASK_STATE)param.TaskState;

                //m_taskAllParam.captureParam = pCaptureparam;
                //m_taskAllParam.nCutLen = 10;
                //m_taskAllParam.taskParam = m_taskParam;
                //m_taskAllParam.taskParam.strName = strTaskName;
                logger.Info($"curent strTaskName: {strTaskName}");

                return(new TASK_ALL_PARAM_NEW()
                {
                    captureParam = pCaptureparam, nCutLen = 10, taskParam = taskParam
                });
            }
            catch (Exception e)
            {
                logger.Error($"MsvUdpClientCtrlSDK::RecordReady, Exception:{e.Message}");
                return(null);
            }
        }