Пример #1
0
        public override void Disconnect()
        {
            int ret = 0;

            try
            {
                DebugLog.Info("SMI Eye Tracker: Disconnect");
                ret = ETDevice.iV_Disconnect();
                if (ret == 1)
                {
                    ETDevice = null;

                    DebugLog.Info("Disconnnected from EyeTracker: {0}:{1}", ServerRecvAddress, ServerRecvPort);
                    IsConnected = false;
                }
                else
                {
                    throw new Exception("Unable to setup disconnect. " + GetErrorMessage(ret));
                }
            }
            catch (Exception e)
            {
                throw new Exception(string.Format("Unable to disconnect from SMI server ({0}:{1}). {2}", ServerRecvAddress, ServerRecvPort, e.Message));
            }
        }
Пример #2
0
        public override void Connect()
        {
            ValidateSettings();

            int ret = 0;

            try
            {
                ETDevice = new EyeTrackingController.EyeTrackingController();
                ETDevice.iV_SetLogger(0, new StringBuilder(this.GetType().Name + ".txt"));

                calibrationCallbackDelegate = new CalibrationCallback(CalibrationCallbackFunction);
                sampleCallbackDelegate      = new GetSampleCallback(GetSampleCallbackFunction);

                ETDevice.iV_SetCalibrationCallback(calibrationCallbackDelegate);
                ETDevice.iV_SetSampleCallback(sampleCallbackDelegate);

                // connect to server
                DebugLog.Info("SMI Eye Tracker: Connect");
                ret = ETDevice.iV_Connect(
                    new StringBuilder(ServerSendAddress), ServerSendPort,
                    new StringBuilder(ServerRecvAddress), ServerRecvPort);
                if (ret == 1)
                {
                    DebugLog.Info("EyeTracker connection established: {0}:{1}", ServerRecvAddress, ServerRecvPort);
                    IsConnected = true;
                }
                else
                {
                    throw new Exception("Unable to connect. " + GetErrorMessage(ret));
                }
            }
            catch (Exception e)
            {
                throw new Exception(string.Format("Unable to connect SMI server ({0}:{1}). {2}", ServerRecvAddress, ServerRecvPort, e.Message));
            }
        }
Пример #3
0
		public override void Disconnect() 
		{
			int ret = 0;
			try
			{
				DebugLog.Info("SMI Eye Tracker: Disconnect");
				ret = ETDevice.iV_Disconnect();
				if (ret == 1)
				{					
					ETDevice = null;
					
					DebugLog.Info("Disconnnected from EyeTracker: {0}:{1}", ServerRecvAddress, ServerRecvPort);
					IsConnected = false;
				}
				else
				{
                    throw new Exception("Unable to setup disconnect. " + GetErrorMessage(ret));
				}
			}
			catch (Exception e)
			{
                throw new Exception(string.Format("Unable to disconnect from SMI server ({0}:{1}). {2}", ServerRecvAddress, ServerRecvPort, e.Message));			}
		}
Пример #4
0
		public override void Connect() 
		{
			ValidateSettings();

			int ret = 0;
			try
			{
				ETDevice = new EyeTrackingController.EyeTrackingController();
				ETDevice.iV_SetLogger(0, new StringBuilder(this.GetType().Name + ".txt"));
				
                calibrationCallbackDelegate = new CalibrationCallback(CalibrationCallbackFunction);
                sampleCallbackDelegate = new GetSampleCallback(GetSampleCallbackFunction);

                ETDevice.iV_SetCalibrationCallback(calibrationCallbackDelegate);
                ETDevice.iV_SetSampleCallback(sampleCallbackDelegate);
								
				// connect to server 
				DebugLog.Info("SMI Eye Tracker: Connect");
				ret = ETDevice.iV_Connect(
					new StringBuilder(ServerSendAddress), ServerSendPort, 
					new StringBuilder(ServerRecvAddress), ServerRecvPort);
				if (ret == 1)
				{
					DebugLog.Info("EyeTracker connection established: {0}:{1}", ServerRecvAddress, ServerRecvPort);
					IsConnected = true;
				}
				else
				{
                    throw new Exception("Unable to connect. " + GetErrorMessage(ret));
				}
			}
			catch (Exception e)
			{
                throw new Exception(string.Format("Unable to connect SMI server ({0}:{1}). {2}", ServerRecvAddress, ServerRecvPort, e.Message));
			}
		}