Example #1
0
 public void Terminate()
 {
     Stop();
     Console.WriteLine("disconnect server...");
     PQ.DisconnectServer();
     State = DeviceState.Uninitialized;
 }
Example #2
0
        private void ConnectToServer()
        {
            int    err_code = (int)EPQT_Error.PQMTE_SUCCESS;
            string local_ip = "127.0.0.1";

            Console.WriteLine("connect to server...");
            if ((err_code = PQ.ConnectServer(local_ip, PQ.PQMT_DEFAULT_CLIENT_PORT)) != (int)EPQT_Error.PQMTE_SUCCESS)
            {
                throw new СonnectionServerException($"connect server fail, socket errror code:{err_code}");
            }

            Console.WriteLine("connect success, send request.");
            PQ.TouchClientRequest tcq = new PQ.TouchClientRequest();
            tcq.type = (int)EPQT_TRequest.RQST_RAWDATA_ALL | (int)EPQT_TRequest.RQST_GESTURE_ALL;

            if ((err_code = PQ.SendRequest(ref tcq)) != (int)EPQT_Error.PQMTE_SUCCESS)
            {
                throw new СonnectionServerException($"send request fail, errror code:{err_code}");
            }

            if ((err_code = PQ.GetServerResolution(OnGetServerResolution, IntPtr.Zero)) != (int)EPQT_Error.PQMTE_SUCCESS)
            {
                throw new СonnectionServerException($"get server resolution fail, errror code:{err_code}");
            }

            Console.WriteLine("send request success, start recv.");
        }
Example #3
0
        private void BindToTouchOverlayEvents()
        {
            OnReceivePointFrameFunc = new PQ.PFuncOnReceivePointFrame(OnReceivePointFrame);
            OnServerBreakFunc       = new PQ.PFuncOnServerBreak(OnServerBreak);
            OnReceiveErrorFunc      = new PQ.PFuncOnReceiveError(OnReceiveError);
            OnGetDeviceInfoFunc     = new PQ.PFuncOnGetDeviceInfo(OnGetDeviceInfo);

            PQ.SetOnReceivePointFrame(OnReceivePointFrameFunc, IntPtr.Zero);
            PQ.SetOnServerBreak(OnServerBreakFunc, IntPtr.Zero);
            PQ.SetOnReceiveError(OnReceiveErrorFunc, IntPtr.Zero);
            PQ.SetOnGetDeviceInfo(OnGetDeviceInfoFunc, IntPtr.Zero);
        }
Example #4
0
 private void OnServerBreak(IntPtr param, IntPtr callbackObject)
 {
     Console.WriteLine("server break, disconnect here");
     PQ.DisconnectServer();
 }