Example #1
0
    // retrieve kinematic info from the Kinectic server
    private IEnumerator FetchKinecticData()
    {
        Action <APIService.APIError, APIService.IResponse> GetData = (error, response) => {
            if (null != error)
            {
                Debug.LogWarning(error.Message);
                isFetchingData = false;
                return;
            }
            if (null != response)
            {
                Dictionary <string, object> payloadData = response.Payload.Data;
                if (null != payloadData)
                {
                    if (null != NewBodyDataEvent)
                    {
                        NewBodyDataEvent(payloadData);
                    }
                }
            }
        };

        while (isFetchingData)
        {
            yield return(new WaitForSeconds(kinecticInterval));

            if (null != NewBodyDataEvent)
            {
                APIService.IRequest req = kinecticService.CreateRequest(APIService.RequestMethod.GET, this.endpoints["Kinematic"], null);
                StartCoroutine(kinecticService.SendRequest(req, GetData));
            }
        }
    }
Example #2
0
 // test the backend
 private void TestEndpoint()
 {
     if (!apiService)
     {
         return;
     }
     APIService.IRequest req = apiService.CreateRequest(APIService.RequestMethod.GET, this.endpoints["Test"], null);
     CallAPI(req, this.callback, false);
 }