示例#1
0
        public Biometrics()
        {
            engine = new ZKFPEngX();

            engine.SensorIndex = 0;
            Status             = (EngineStatus)engine.InitEngine();
            MessageBox.Show(Status.ToString());
            AddActions();
        }
示例#2
0
        public void Client_GetEngineStatus_Test()
        {
            ITaskBroker client = new GridTaskBrokerClient(new GridTaskBrokerCallback());

            string       engineId = Guid.NewGuid().ToString();
            EngineStatus status   = client.GetEngineStatus(engineId);

            _log.DebugFormat("Status: {0}", status.ToString());

            (client as GridTaskBrokerClient).Close();
        }
示例#3
0
 protected String get_status_msg()
 {
     try
     {
         EngineStatus s = engine.Status();
         return("Engine Status: " + s.ToString());
     }
     catch (EngineMessageException)
     {
         return("Engine is offline");
     }
 }
示例#4
0
    void Update()
    {
        if (!accessible)
        {
            return;
        }

        switch (status)
        {
        case EngineStatus.Sleep:
            if (requestFEN.Length > 0)
            {
                status = EngineStatus.SendRequest;
                SendRequest("GET", url + gameId + "/" + ConvertFEN(requestFEN));
                lastRequestFEN = requestFEN;
                requestFEN     = "";
            }
            break;

        case EngineStatus.SendRequest:
            // Just wait for answer from CoreServer
            // TODO : add timeout
            break;

        case EngineStatus.GetResponse:
            if (answer.Length > 0)
            {
                Debug.Log("Response from CoreServer : " + answer);
                ((TextMesh)GetComponent(typeof(TextMesh))).text = answer;
                (GameObject.Find("MainScript")).SendMessage("EngineAnswer", answer);
                answer = "";
                status = EngineStatus.Sleep;
            }
            break;

        case EngineStatus.Error:
            Debug.Log("No response from CoreServer : you may check URI");
            accessible = false;
            LetKnow3D();
            break;

        case EngineStatus.Ended:
            accessible = false;
            LetKnow3D();
            break;

        default:
            Debug.LogWarning("Update status CoreServer not implemented : " + status.ToString());
            break;
        }
    }
示例#5
0
        /// <summary>
        /// Produces a human-readable form of the EngineStatus received
        /// as parameter.
        /// </summary>
        /// <param name="x">The EngineStatus to be transformed to human-readable form.</param>
        /// <returns>The human-readable string form of the EngineStatus x.</returns>
        public static string EngineStatusName(EngineStatus x)
        {
            switch (x)
            {
            case EngineStatus.INIT:         return("Initializing");

            case EngineStatus.WORKING:      return("Working");

            case EngineStatus.OK:           return("Ok");

            case EngineStatus.FAIL:         return("Failed");

            default:  return("Unrecognized Engine Status: " + x.ToString());
            }
        }
示例#6
0
 public IHttpActionResult Status()
 {
     try
     {
         EngineStatus s = engine.Status();
         return(Ok(s.ToString()));
     }
     catch (EngineMessageException ex)
     {
         if (ex.keyword == "offline")
         {
             return(Ok("offline"));
         }
         else
         {
             return(Ok(ex.toMotorErrorMessage()));
         }
     }
 }
示例#7
0
 /// <summary>
 /// Produces a human-readable form of the EngineStatus received
 /// as parameter.
 /// </summary>
 /// <param name="x">The EngineStatus to be transformed to human-readable form.</param>
 /// <returns>The human-readable string form of the EngineStatus x.</returns>
 public static string EngineStatusName(EngineStatus x)
 {
     switch(x)
       {
     case EngineStatus.INIT:		return "Initializing";
     case EngineStatus.WORKING:	return "Working";
     case EngineStatus.OK:		return "Ok";
     case EngineStatus.FAIL:		return "Failed";
     default:  return "Unrecognized Engine Status: "+x.ToString();
       }
 }
示例#8
0
    protected void GetEngineStatus(object sender, EventArgs e)
    {
        EngineStatus s = engine.Status();

        writeLine("Engine Status: " + s.ToString());
    }
示例#9
0
        /// <summary>
        /// Update engine status on the taskbroker
        /// </summary>
        /// <param name="engineId">engine to update the status for</param>
        /// <param name="status">status</param>
        public void UpdateEngineStatus(string engineId, EngineStatus status)
        {
            _log.DebugFormat("Received request to update engine status for engine {0} to {1}", engineId, status.ToString());
            try
            {
                _engineCollection[engineId].Status = status;

                // if an engine wants to register its state as Idle, signal the execute task loop to continue. 
                // It also means the engine has finished processing a task - so let's update the corresponding task's status
                // and notify the client
                if (status == EngineStatus.Idle)
                {
                    _waitTillEngineIdle.Set();
                    RequestHandle request = _taskEngineMap[engineId];
                    request.TaskStatus = TaskStatus.Finished;

                    // notify client
                    _handleCallbackMap[request.Handle].TaskComplete(request);
                    _taskEngineMap.Remove(engineId);
                }
            }
            catch (Exception e)
            {
                _log.ErrorFormat("Error updating engine status for engine {0}: {1}\n{2}", engineId, e.Message, e.StackTrace);
            }
        }
示例#10
0
        /// <summary>
        /// Update engine status on the taskbroker
        /// </summary>
        /// <param name="engineId">engine to update the status for</param>
        /// <param name="status">status</param>
        public void UpdateEngineStatus(string engineId, EngineStatus status)
        {
            _log.DebugFormat("Received request to update engine status for engine {0} to {1}", engineId, status.ToString());
            try
            {
                _engineCollection[engineId].Status = status;

                // if an engine wants to register its state as Idle, signal the execute task loop to continue.
                // It also means the engine has finished processing a task - so let's update the corresponding task's status
                // and notify the client
                if (status == EngineStatus.Idle)
                {
                    _waitTillEngineIdle.Set();
                    RequestHandle request = _taskEngineMap[engineId];
                    request.TaskStatus = TaskStatus.Finished;

                    // notify client
                    _handleCallbackMap[request.Handle].TaskComplete(request);
                    _taskEngineMap.Remove(engineId);
                }
            }
            catch (Exception e)
            {
                _log.ErrorFormat("Error updating engine status for engine {0}: {1}\n{2}", engineId, e.Message, e.StackTrace);
            }
        }