private IEnumerator SendQuery()
        {
            yield return(new WaitForSeconds(1F));

            Debug.Log("Sending Query");
            var detectionQuery =
                new VisualDetectionQuery
            {
                Texture = ImageTexture,
                QueryId = 0
            };

            Mission.SocketEventManager.OnQueryRecieved(detectionQuery);
        }
 // Update is called once per frame
 private void Update()
 {
     if (Input.GetKeyDown("space") && On)
     {
         var query = new VisualDetectionQuery
         {
             ArrivalTime   = 0,
             Confidence    = 0f,
             QueryId       = 0,
             RobotId       = 0,
             UserId        = 0,
             ImageFileName = "image-robot-4-1323.png"
         };
         Debug.Log("Sending Test Query");
         query.Arrive();
     }
 }
Esempio n. 3
0
        public static void OnDataRecieved(string queryJson)
        {
            Debug.Log(queryJson);
            var json = JSON.Parse(queryJson);

            var data = json["data"];

            Query query = null;

            switch (json["type"])
            {
            case VisualDetectionQuery.QueryType:
                query = new VisualDetectionQuery
                {
                    ArrivalTime   = MissionTimer.CurrentTime,
                    Confidence    = data["confidence"].AsFloat,
                    QueryId       = data["query_id"].AsInt,
                    RobotId       = data["robot_id"].AsInt,
                    ImageFileName = data["file_path"]
                };
                break;

            case AudioDetectionQuery.QueryType:
                query = new AudioDetectionQuery
                {
                    ArrivalTime   = MissionTimer.CurrentTime,
                    Confidence    = data["confidence"].AsFloat,
                    QueryId       = data["query_id"].AsInt,
                    RobotId       = data["robot_id"].AsInt,
                    AudioFileName = data["file_path"]
                };
                break;

            default:
                Debug.Log("Query Type Not Recognized.");
                break;
            }

            if (query != null)
            {
                Debug.Log("Query Arriving");
                query.Arrive();
            }
        }