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()); }