コード例 #1
0
ファイル: FaceIDUtil.cs プロジェクト: xujd/iCabinet
        public void Destroy()
        {
            uint lResult = 0;
            //lResult = NETSDK.SIRIUS_StopRealPlay(UserID, 0);
            //if (0 != lResult)
            //{
            //    Console.WriteLine("停止码流预览失败!错误编码:{0:d}", lResult);
            //    return;
            //}
            //Console.WriteLine("停止码流预览成功!");
            int iCameraIndex = 0;

            lResult = NETSDK.SIRIUS_DeleteCamera(UserID, iCameraIndex);
            if (0 != lResult)
            {
                Console.WriteLine("删除摄像机失败!错误编码:{0:d}", lResult);
            }
            else
            {
                Console.WriteLine("删除摄像机成功!");
            }

            if (UserID > 0)
            {
                // 注销服务器
                lResult = NETSDK.SIRIUS_Logout(UserID);
                if (0 != lResult)
                {
                    var msg = string.Format("注销FaceID服务器失败!错误编码:{2:d}", lResult);
                    Log.WriteLog("ERROR-FACEID:" + msg);
                }
                else
                {
                    Log.WriteLog("ERROR-FACEID:注销FaceID服务器成功!");
                    Thread.Sleep(1 * 1000); // Notes:等待注销消息

                    UserID = 0;
                }
            }
            // 销毁SDK
            lResult = NETSDK.SIRIUS_Cleanup();
            if (0 != lResult)
            {
                Console.WriteLine("销毁SDK失败!错误编码:%d", lResult);
            }
            else
            {
                Console.WriteLine("销毁SDK成功!");
            }
        }
コード例 #2
0
ファイル: FaceIDUtil.cs プロジェクト: xujd/iCabinet
        public int OpenRealData()
        {
            uint lResult;

            pWaitFlag = Marshal.AllocHGlobal(sizeof(uint));//声明一个同样大小的空间
            Marshal.WriteInt32(pWaitFlag, 1);
            int iWaitFlag = Marshal.ReadInt32(pWaitFlag);

            mycall  = new NETSDK.SIRIUS_pfnMessageCallBack(this.MessageCallBack);
            lResult = NETSDK.SIRIUS_SetMessageCallBack(mycall, pWaitFlag);
            if (0 != lResult)
            {
                Console.WriteLine("注册回调函数失败!错误编码:{0:d}", lResult);
                return(-1);
            }
            Console.WriteLine("注册回调函数成功!");

            // 添加摄像机
            int iCameraIndex = 0;

            // 先删除一次
            lResult = NETSDK.SIRIUS_DeleteCamera(UserID, iCameraIndex);

            NETSDK.DEV_LOGIN_INFO stDevLoginInfo;
            stDevLoginInfo.eType        = NETSDK.COLLECTOR_TYPE_USB_CAMERA;
            stDevLoginInfo.szIPAddr     = "";
            stDevLoginInfo.iPort        = 0;
            stDevLoginInfo.szUserName   = "";
            stDevLoginInfo.szPassWord   = "";
            stDevLoginInfo.iStreamIndex = 0;
            stDevLoginInfo.szDevName    = "USB摄像机";

            lResult = NETSDK.SIRIUS_AddCamera(UserID, iCameraIndex, ref stDevLoginInfo);
            if (0 != lResult)
            {
                Console.WriteLine("添加摄像机失败!错误编码:{0:d}", lResult);
                return(-1);
            }
            Console.WriteLine("添加摄像机成功!");
            //// 注册码流回调函数
            //realDataCall = new NETSDK.SIRIUS_pfnRealDataCallBack(this.RealDataCallBack);
            //lResult = NETSDK.SIRIUS_SetRealDataCallBack(realDataCall, IntPtr.Zero);
            //if (0 != lResult)
            //{
            //    Console.WriteLine("注册码流回调函数失败!错误编码:{0:d}", lResult);
            //    return -1;
            //}
            //Console.WriteLine("注册码流回调函数成功!\n");

            //// 启动码流预览
            //lResult = NETSDK.SIRIUS_StartRealPlay(UserID, 0);
            //if (0 != lResult)
            //{
            //    Console.WriteLine("启动码流预览失败!错误编码:{0:d}", lResult);
            //    return -1;
            //}
            //Console.WriteLine("启动码流预览成功!\n");


            return(0);
        }