Exemplo n.º 1
0
        static void SendManifest(string json, int versionNumber, System.Action callback)
        {
            var settings = CognitiveVR_Preferences.FindCurrentScene();

            if (settings == null)
            {
                Debug.LogWarning("Send Manifest settings are null " + UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().path);
                string s = UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().name;
                if (string.IsNullOrEmpty(s))
                {
                    s = "Unknown Scene";
                }
                EditorUtility.DisplayDialog("Dynamic Object Manifest Upload Failed", "Could not find the Scene Settings for \"" + s + "\". Are you sure you've saved, exported and uploaded this scene to SceneExplorer?", "Ok");
                return;
            }

            string url = CognitiveStatics.POSTDYNAMICMANIFEST(settings.SceneId, versionNumber);

            Util.logDebug("Send Manifest Contents: " + json);

            //upload manifest
            Dictionary <string, string> headers = new Dictionary <string, string>();

            if (EditorCore.IsDeveloperKeyValid)
            {
                headers.Add("Authorization", "APIKEY:DEVELOPER " + EditorCore.DeveloperKey);
                headers.Add("Content-Type", "application/json");
            }
            PostManifestResponseAction = callback;
            EditorNetwork.Post(url, json, PostManifestResponse, headers, false);//AUTH
        }
Exemplo n.º 2
0
        /// <summary>
        /// Upload all data from local storage. will call completed after everything has been uploaded, failed if not connected to internet or local storage not enabled
        /// </summary>
        /// <param name="completedCallback"></param>
        /// <param name="failedCallback"></param>
        public static void UploadAllLocalData(System.Action completedCallback, System.Action failedCallback)
        {
            if (!isuploadingfromcache)
            {
                Debug.Log("NETWORK UploadAllLocalData");
                if (string.IsNullOrEmpty(CognitiveStatics.ApplicationKey))
                {
                    CognitiveStatics.Initialize();
                }

                //upload from local storage
                if (!CognitiveVR_Preferences.Instance.LocalStorage)
                {
                    if (failedCallback != null)
                    {
                        failedCallback.Invoke();
                    }
                    return;
                }

                if (lc == null)
                {
                    lc = new LocalCache(Sender, null);
                }

                cacheCompletedAction = completedCallback;
                cacheFailedAction    = failedCallback;

                Sender.LoopUploadFromLocalCache();
            }
            else
            {
                Debug.Log("UploadAllLocalData cannot upload all local data - already in upload loop!");
            }
        }
Exemplo n.º 3
0
        //static System.Action RefreshSceneVersionComplete;
        /// <summary>
        /// get collection of versions of scene
        /// </summary>
        /// <param name="refreshSceneVersionComplete"></param>
        public static void RefreshMediaSources()
        {
            Debug.Log("refresh media sources");
            //gets the scene version from api and sets it to the current scene
            string currentSceneName = UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().name;
            var    currentSettings  = CognitiveVR_Preferences.FindScene(currentSceneName);

            if (currentSettings != null)
            {
                if (!IsDeveloperKeyValid)
                {
                    Debug.Log("Developer key invalid"); return;
                }

                if (currentSettings == null)
                {
                    Debug.Log("SendSceneVersionRequest no scene settings!");
                    return;
                }
                string url = CognitiveStatics.GETMEDIASOURCELIST();

                Dictionary <string, string> headers = new Dictionary <string, string>();
                if (EditorCore.IsDeveloperKeyValid)
                {
                    headers.Add("Authorization", "APIKEY:DEVELOPER " + EditorCore.DeveloperKey);
                }

                EditorNetwork.Get(url, GetMediaSourcesResponse, headers, true, "Get Scene Version");//AUTH
            }
            else
            {
                Debug.Log("No scene versions for scene: " + currentSceneName);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// uses the Response 'callback' when the question set is recieved from the dashboard. if offline, tries to get question set from local cache
        /// </summary>
        /// <param name="hookname"></param>
        /// <param name="callback"></param>
        /// <param name="timeout"></param>
        public static void GetExitPollQuestions(string hookname, Response callback, float timeout = 3)
        {
            string url     = CognitiveStatics.GETEXITPOLLQUESTIONSET(hookname);
            var    request = UnityWebRequest.Get(url);

            request.SetRequestHeader("Content-Type", "application/json");
            request.SetRequestHeader("X-HTTP-Method-Override", "GET");
            request.SetRequestHeader("Authorization", CognitiveStatics.ApplicationKey);
            request.Send();

            Sender.StartCoroutine(Sender.WaitForExitpollResponse(request, hookname, callback, timeout));
        }
Exemplo n.º 5
0
        public static void UploadScreenshot()
        {
            //get scene id
            var currentScene = CognitiveVR_Preferences.FindCurrentScene();

            if (currentScene == null)
            {
                Debug.Log("Could not find current scene");
                return;
            }
            if (string.IsNullOrEmpty(currentScene.SceneId))
            {
                Debug.Log(currentScene.SceneName + " scene has not been uploaded!");
                return;
            }


            //file popup
            string path = EditorUtility.OpenFilePanel("Select Screenshot", "", "png");

            if (path.Length == 0)
            {
                return;
            }

            string filename = Path.GetFileName(path);

            if (EditorUtility.DisplayDialog("Upload Screenshot", "Upload " + filename + " to " + currentScene.SceneName + " version " + currentScene.VersionNumber + "?", "Upload", "Cancel"))
            {
                string url = CognitiveStatics.POSTSCREENSHOT(currentScene.SceneId, currentScene.VersionNumber);

                var bytes = File.ReadAllBytes(path);

                WWWForm form = new WWWForm();
                form.AddBinaryData("screenshot", bytes, "screenshot.png");

                var headers = new Dictionary <string, string>();

                foreach (var v in form.headers)
                {
                    headers[v.Key] = v.Value;
                }

                if (EditorCore.IsDeveloperKeyValid)
                {
                    headers.Add("Authorization", "APIKEY:DEVELOPER " + EditorCore.DeveloperKey);
                }

                EditorNetwork.Post(url, form, UploadScreenhotResponse, headers, false);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Starts a CognitiveVR session. Records hardware info, creates network manager
        /// </summary>
        public static Error Init(Transform HMDCamera)
        {
            _hmd = HMDCamera;
            CognitiveStatics.Initialize();
            CustomEvent.Initialize();

            Error error = Error.None;

            // Have we already initialized CognitiveVR?
            if (IsInitialized)
            {
                Util.logWarning("CognitiveVR has already been initialized, no need to re-initialize");
                error = Error.AlreadyInitialized;
            }

            if (error == Error.None)
            {
                SetSessionProperty("c3d.app.name", Application.productName);
                SetSessionProperty("c3d.app.version", Application.version);
                SetSessionProperty("c3d.app.engine.version", Application.unityVersion);
                SetSessionProperty("c3d.device.type", SystemInfo.deviceType.ToString());
                SetSessionProperty("c3d.device.cpu", SystemInfo.processorType);
                SetSessionProperty("c3d.device.model", SystemInfo.deviceModel);
                SetSessionProperty("c3d.device.gpu", SystemInfo.graphicsDeviceName);
                SetSessionProperty("c3d.device.os", SystemInfo.operatingSystem);
                SetSessionProperty("c3d.device.memory", Mathf.RoundToInt(SystemInfo.systemMemorySize / 1024));

                DeviceId = UnityEngine.SystemInfo.deviceUniqueIdentifier;
                SetSessionProperty("c3d.deviceid", DeviceId);

                //initialize Network Manager early, before gameplay actually starts
                var temp = NetworkManager.Sender;

                DynamicManager.Initialize();
                DynamicObjectCore.Initialize();

                _timestamp = Util.Timestamp();
                //set session timestamp
                if (string.IsNullOrEmpty(_sessionId))
                {
                    _sessionId = (int)SessionTimeStamp + "_" + DeviceId;
                }

                IsInitialized = true;
            }

            return(error);
        }
Exemplo n.º 7
0
        /// <summary>
        /// get collection of versions of scene
        /// </summary>
        /// <param name="refreshSceneVersionComplete"></param>
        public static void RefreshSceneVersion(System.Action refreshSceneVersionComplete)
        {
            Debug.Log("refresh scene version");
            //gets the scene version from api and sets it to the current scene
            string currentSceneName = UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().name;
            var    currentSettings  = CognitiveVR_Preferences.FindScene(currentSceneName);

            if (currentSettings != null)
            {
                if (!IsDeveloperKeyValid)
                {
                    Debug.Log("Developer key invalid"); return;
                }

                if (currentSettings == null)
                {
                    Debug.Log("SendSceneVersionRequest no scene settings!");
                    return;
                }
                if (string.IsNullOrEmpty(currentSettings.SceneId))
                {
                    if (refreshSceneVersionComplete != null)
                    {
                        refreshSceneVersionComplete.Invoke();
                    }
                    return;
                }

                RefreshSceneVersionComplete = refreshSceneVersionComplete;
                string url = CognitiveStatics.GETSCENEVERSIONS(currentSettings.SceneId);

                Dictionary <string, string> headers = new Dictionary <string, string>();
                if (EditorCore.IsDeveloperKeyValid)
                {
                    headers.Add("Authorization", "APIKEY:DEVELOPER " + EditorCore.DeveloperKey);
                }

                EditorNetwork.Get(url, GetSceneVersionResponse, headers, true, "Get Scene Version");//AUTH
            }
            else
            {
                Debug.Log("No scene versions for scene: " + currentSceneName);
            }
        }
Exemplo n.º 8
0
        public static void PostExitpollAnswers(string stringcontent, string questionSetName, int questionSetVersion)
        {
            string url = CognitiveStatics.POSTEXITPOLLRESPONSES(questionSetName, questionSetVersion);

            var bytes   = System.Text.UTF8Encoding.UTF8.GetBytes(stringcontent);
            var request = UnityWebRequest.Put(url, bytes);

            request.method = "POST";
            request.SetRequestHeader("Content-Type", "application/json");
            request.SetRequestHeader("X-HTTP-Method-Override", "POST");
            request.SetRequestHeader("Authorization", CognitiveStatics.ApplicationKey);
            request.Send();

            Sender.StartCoroutine(Sender.WaitForFullResponse(request, stringcontent, Sender.GenericPostFullResponse, true));

            if (CognitiveVR_Preferences.Instance.EnableDevLogging)
            {
                Util.logDevelopment(url + " " + stringcontent);
            }
        }
Exemplo n.º 9
0
        //get dynamic object aggregation manifest for the current scene
        void GetManifest()
        {
            var currentSceneSettings = CognitiveVR_Preferences.FindCurrentScene();

            if (currentSceneSettings == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(currentSceneSettings.SceneId))
            {
                Util.logWarning("Get Manifest current scene doesn't have an id!");
                return;
            }

            string url = CognitiveStatics.GETDYNAMICMANIFEST(currentSceneSettings.VersionId);

            Dictionary <string, string> headers = new Dictionary <string, string>();

            if (EditorCore.IsDeveloperKeyValid)
            {
                headers.Add("Authorization", "APIKEY:DEVELOPER " + EditorCore.DeveloperKey);
            }
            EditorNetwork.Get(url, GetManifestResponse, headers, false);//AUTH
        }
Exemplo n.º 10
0
        private static void Core_OnSendData()
        {
            if (Fixations.Count <= 0)
            {
                CognitiveVR.Util.logDebug("Fixations.SendData found no data"); return;
            }

            //TODO should hold until extreme batch size reached
            if (string.IsNullOrEmpty(Core.TrackingSceneId))
            {
                CognitiveVR.Util.logDebug("Fixations.SendData could not find scene settings for scene! do not upload fixations to sceneexplorer");
                Fixations.Clear();
                return;
            }


            nextSendTime = Time.realtimeSinceStartup + CognitiveVR_Preferences.Instance.FixationSnapshotMaxTimer;
            lastSendTime = Time.realtimeSinceStartup;


            StringBuilder sb = new StringBuilder(1024);

            sb.Append("{");
            JsonUtil.SetString("userid", Core.UniqueID, sb);
            sb.Append(",");
            JsonUtil.SetString("sessionid", Core.SessionID, sb);
            sb.Append(",");
            JsonUtil.SetInt("timestamp", (int)Core.SessionTimeStamp, sb);
            sb.Append(",");
            JsonUtil.SetInt("part", jsonPart, sb);
            sb.Append(",");
            jsonPart++;

            sb.Append("\"data\":[");
            for (int i = 0; i < Fixations.Count; i++)
            {
                sb.Append("{");
                JsonUtil.SetDouble("time", System.Convert.ToDouble((double)Fixations[i].StartMs / 1000.0), sb);
                sb.Append(",");
                JsonUtil.SetLong("duration", Fixations[i].DurationMs, sb);
                sb.Append(",");
                JsonUtil.SetFloat("maxradius", Fixations[i].MaxRadius, sb);
                sb.Append(",");

                if (Fixations[i].IsLocal)
                {
                    JsonUtil.SetString("objectid", Fixations[i].DynamicObjectId, sb);
                    sb.Append(",");
                    JsonUtil.SetVector("p", Fixations[i].LocalPosition, sb);
                }
                else
                {
                    JsonUtil.SetVector("p", Fixations[i].WorldPosition, sb);
                }
                sb.Append("},");
            }
            if (Fixations.Count > 0)
            {
                sb.Remove(sb.Length - 1, 1); //remove last comma from fixation object
            }

            sb.Append("]}");

            Fixations.Clear();

            string url = CognitiveStatics.POSTFIXATIONDATA(Core.TrackingSceneId, Core.TrackingSceneVersionNumber);

            NetworkManager.Post(url, sb.ToString());
        }
Exemplo n.º 11
0
        private static void Core_OnSendData()
        {
            if (CachedSnapshots.Keys.Count <= 0)
            {
                CognitiveVR.Util.logDebug("Sensor.SendData found no data"); return;
            }

            //TODO should hold until extreme batch size reached
            if (string.IsNullOrEmpty(Core.TrackingSceneId))
            {
                CognitiveVR.Util.logDebug("Sensor.SendData could not find scene settings for scene! do not upload sensors to sceneexplorer");
                CachedSnapshots.Clear();
                currentSensorSnapshots = 0;
                return;
            }


            nextSendTime = Time.realtimeSinceStartup + CognitiveVR_Preferences.Instance.SensorSnapshotMaxTimer;
            lastSendTime = Time.realtimeSinceStartup;


            StringBuilder sb = new StringBuilder(1024);

            sb.Append("{");
            JsonUtil.SetString("name", Core.UniqueID, sb);
            sb.Append(",");

            if (!string.IsNullOrEmpty(Core.LobbyId))
            {
                JsonUtil.SetString("lobbyId", Core.LobbyId, sb);
                sb.Append(",");
            }

            JsonUtil.SetString("sessionid", Core.SessionID, sb);
            sb.Append(",");
            JsonUtil.SetInt("timestamp", (int)Core.SessionTimeStamp, sb);
            sb.Append(",");
            JsonUtil.SetInt("part", jsonPart, sb);
            sb.Append(",");
            jsonPart++;
            JsonUtil.SetString("formatversion", "1.0", sb);
            sb.Append(",");


            sb.Append("\"data\":[");
            foreach (var k in CachedSnapshots.Keys)
            {
                sb.Append("{");
                JsonUtil.SetString("name", k, sb);
                sb.Append(",");
                sb.Append("\"data\":[");
                foreach (var v in CachedSnapshots[k])
                {
                    sb.Append(v);
                    sb.Append(",");
                }
                if (CachedSnapshots.Values.Count > 0)
                {
                    sb.Remove(sb.Length - 1, 1); //remove last comma from data array
                }
                sb.Append("]");
                sb.Append("}");
                sb.Append(",");
            }
            if (CachedSnapshots.Keys.Count > 0)
            {
                sb.Remove(sb.Length - 1, 1); //remove last comma from sensor object
            }
            sb.Append("]}");

            CachedSnapshots.Clear();
            currentSensorSnapshots = 0;

            string url = CognitiveStatics.POSTSENSORDATA(Core.TrackingSceneId, Core.TrackingSceneVersionNumber);

            //byte[] outBytes = System.Text.UTF8Encoding.UTF8.GetBytes();
            //CognitiveVR_Manager.Instance.StartCoroutine(CognitiveVR_Manager.Instance.PostJsonRequest(outBytes, url));
            NetworkManager.Post(url, sb.ToString());
        }
Exemplo n.º 12
0
        static IEnumerator WriteJson()
        {
            while (true)
            {
                if (!ReadyToWriteJson)
                {
                    yield return(null);
                }
                else
                {
                    int totalDataToWrite = queuedManifest.Count + queuedSnapshots.Count;
                    totalDataToWrite = Mathf.Min(totalDataToWrite, CognitiveVR_Preferences.S_DynamicExtremeSnapshotCount);

                    var builder       = new System.Text.StringBuilder(200 + 128 * totalDataToWrite);
                    int manifestCount = Mathf.Min(queuedManifest.Count, totalDataToWrite);
                    int count         = Mathf.Min(queuedSnapshots.Count, totalDataToWrite - manifestCount);

                    if (queuedSnapshots.Count - count == 0 && queuedManifest.Count - manifestCount == 0)
                    {
                        ReadyToWriteJson = false;
                    }

                    bool threadDone = true;

                    builder.Append("{");

                    //header
                    JsonUtil.SetString("userid", Core.DeviceId, builder);
                    builder.Append(",");

                    if (!string.IsNullOrEmpty(Core.LobbyId))
                    {
                        JsonUtil.SetString("lobbyId", Core.LobbyId, builder);
                        builder.Append(",");
                    }

                    JsonUtil.SetDouble("timestamp", (int)Core.SessionTimeStamp, builder);
                    builder.Append(",");
                    JsonUtil.SetString("sessionid", Core.SessionID, builder);
                    builder.Append(",");
                    JsonUtil.SetInt("part", jsonPart, builder);
                    builder.Append(",");
                    jsonPart++;
                    JsonUtil.SetString("formatversion", "1.0", builder);
                    builder.Append(",");

                    //manifest entries
                    if (manifestCount > 0)
                    {
                        builder.Append("\"manifest\":{");
                        threadDone = false;

                        if (WriteImmediate)
                        {
                            for (int i = 0; i < manifestCount; i++)
                            {
                                if (i != 0)
                                {
                                    builder.Append(',');
                                }
                                var manifestentry = queuedManifest.Dequeue();
                                SetManifestEntry(manifestentry, builder);
                            }
                            threadDone = true;
                        }
                        else
                        {
                            new System.Threading.Thread(() =>
                            {
                                for (int i = 0; i < manifestCount; i++)
                                {
                                    if (i != 0)
                                    {
                                        builder.Append(',');
                                    }
                                    var manifestentry = queuedManifest.Dequeue();
                                    SetManifestEntry(manifestentry, builder);
                                }
                                threadDone = true;
                            }).Start();

                            while (!threadDone)
                            {
                                yield return(null);
                            }
                        }

                        if (count > 0)
                        {
                            builder.Append("},");
                        }
                        else
                        {
                            builder.Append("}");
                        }
                    }

                    //snapshots
                    if (count > 0)
                    {
                        builder.Append("\"data\":[");
                        threadDone = false;
                        if (WriteImmediate)
                        {
                            for (int i = 0; i < count; i++)
                            {
                                if (i != 0)
                                {
                                    builder.Append(',');
                                }
                                var snap = queuedSnapshots.Dequeue();
                                SetSnapshot(snap, builder);
                                snap.ReturnToPool();
                            }
                            threadDone = true;
                        }
                        else
                        {
                            new System.Threading.Thread(() =>
                            {
                                for (int i = 0; i < count; i++)
                                {
                                    if (i != 0)
                                    {
                                        builder.Append(',');
                                    }
                                    var snap = queuedSnapshots.Dequeue();
                                    SetSnapshot(snap, builder);
                                    snap.ReturnToPool();
                                }
                                threadDone = true;
                            }).Start();

                            while (!threadDone)
                            {
                                yield return(null);
                            }
                        }
                        builder.Append("]");
                    }
                    builder.Append("}");

                    string s   = builder.ToString();
                    string url = CognitiveStatics.POSTDYNAMICDATA(Core.TrackingSceneId, Core.TrackingSceneVersionNumber);
                    NetworkManager.Post(url, s);
                    DynamicManager.DynamicObjectSendEvent();
                }
            }
        }
Exemplo n.º 13
0
        static void SendTransactions()
        {
            if (cachedEvents == 0)
            {
                return;
            }

            if (!Core.IsInitialized)
            {
                return;
            }

            //TODO should hold until extreme batch size reached
            if (string.IsNullOrEmpty(Core.TrackingSceneId))
            {
                Util.logDebug("Instrumentation.SendTransactions could not find CurrentSceneId! has scene been uploaded and CognitiveVR_Manager.Initialize been called?");
                cachedEvents        = 0;
                eventBuilder.Length = 0;
                return;
            }

            autoTimer_nextSendTime = Time.realtimeSinceStartup + CognitiveVR_Preferences.Instance.DynamicSnapshotMaxTimer;
            minTimer_lastSendTime  = Time.realtimeSinceStartup;

            cachedEvents = 0;
            //bundle up header stuff and transaction data

            //clear the transaction builder
            builder.Length = 0;

            //CognitiveVR.Util.logDebug("package transaction event data " + partCount);
            //when thresholds are reached, etc

            builder.Append("{");

            //header
            JsonUtil.SetString("userid", Core.DeviceId, builder);
            builder.Append(",");

            if (!string.IsNullOrEmpty(Core.LobbyId))
            {
                JsonUtil.SetString("lobbyId", Core.LobbyId, builder);
                builder.Append(",");
            }

            JsonUtil.SetDouble("timestamp", Core.SessionTimeStamp, builder);
            builder.Append(",");
            JsonUtil.SetString("sessionid", Core.SessionID, builder);
            builder.Append(",");
            JsonUtil.SetInt("part", partCount, builder);
            partCount++;
            builder.Append(",");

            JsonUtil.SetString("formatversion", "1.0", builder);
            builder.Append(",");

            //events
            builder.Append("\"data\":[");

            builder.Append(eventBuilder.ToString());

            if (eventBuilder.Length > 0)
            {
                builder.Remove(builder.Length - 1, 1); //remove the last comma
            }
            builder.Append("]");

            builder.Append("}");

            eventBuilder.Length = 0;

            //send transaction contents to scene explorer

            string packagedEvents = builder.ToString();

            //sends all packaged transaction events from instrumentaiton subsystem to events endpoint on scene explorer
            string url = CognitiveStatics.POSTEVENTDATA(Core.TrackingSceneId, Core.TrackingSceneVersionNumber);

            NetworkManager.Post(url, packagedEvents);
            if (OnCustomEventSend != null)
            {
                OnCustomEventSend.Invoke();
            }
        }
Exemplo n.º 14
0
        private static void SendGazeData()
        {
            if (gazeCount == 0)
            {
                return;
            }

            if (string.IsNullOrEmpty(Core.TrackingSceneId))
            {
                Util.logDebug("Cognitive GazeCore.SendData could not find scene settings for scene! do not upload gaze to sceneexplorer");
                //dump gaze data
                gazebuilder.Length = 9;
                gazeCount          = 0;
                return;
            }

            if (gazebuilder[gazebuilder.Length - 1] == ',')
            {
                gazebuilder = gazebuilder.Remove(gazebuilder.Length - 1, 1);
            }

            gazebuilder.Append("],");

            gazeCount = 0;

            //header
            JsonUtil.SetString("userid", Core.UniqueID, gazebuilder);
            gazebuilder.Append(",");

            if (!string.IsNullOrEmpty(Core.LobbyId))
            {
                JsonUtil.SetString("lobbyId", Core.LobbyId, gazebuilder);
                gazebuilder.Append(",");
            }

            JsonUtil.SetDouble("timestamp", (int)Core.SessionTimeStamp, gazebuilder);
            gazebuilder.Append(",");
            JsonUtil.SetString("sessionid", Core.SessionID, gazebuilder);
            gazebuilder.Append(",");
            JsonUtil.SetInt("part", jsonPart, gazebuilder);
            jsonPart++;
            gazebuilder.Append(",");

            JsonUtil.SetString("hmdtype", HMDName, gazebuilder);

            gazebuilder.Append(",");
            JsonUtil.SetFloat("interval", CognitiveVR.CognitiveVR_Preferences.Instance.SnapshotInterval, gazebuilder);
            gazebuilder.Append(",");

            JsonUtil.SetString("formatversion", "1.0", gazebuilder);

            if (Core.GetNewSessionProperties(false).Count > 0)
            {
                gazebuilder.Append(",");
                gazebuilder.Append("\"properties\":{");
                foreach (var kvp in Core.GetNewSessionProperties(true))
                {
                    if (kvp.Value.GetType() == typeof(string))
                    {
                        JsonUtil.SetString(kvp.Key, (string)kvp.Value, gazebuilder);
                    }
                    else
                    {
                        JsonUtil.SetObject(kvp.Key, kvp.Value, gazebuilder);
                    }
                    gazebuilder.Append(",");
                }
                gazebuilder.Remove(gazebuilder.Length - 1, 1); //remove comma
                gazebuilder.Append("}");
            }
            gazebuilder.Append("}");

            var    sceneSettings = Core.TrackingScene;
            string url           = CognitiveStatics.POSTGAZEDATA(sceneSettings.SceneId, sceneSettings.VersionNumber);

            CognitiveVR.NetworkManager.Post(url, gazebuilder.ToString());

            //gazebuilder = new StringBuilder(70 * CognitiveVR_Preferences.Instance.GazeSnapshotCount + 200);
            gazebuilder.Length = 9;
            //gazebuilder.Append("{\"data\":[");
        }