private static void Core_OnSendData() { if (CachedSnapshots.Keys.Count <= 0) { CognitiveVR.Util.logDebug("Sensor.SendData found no data"); return; } var sceneSettings = Core.TrackingScene; if (sceneSettings == null) { CognitiveVR.Util.logDebug("Sensor.SendData found no SceneKeySettings"); return; } StringBuilder sb = new StringBuilder(1024); sb.Append("{"); JsonUtil.SetString("name", Core.UniqueID, sb); sb.Append(","); if (!string.IsNullOrEmpty(CognitiveVR_Preferences.LobbyId)) { JsonUtil.SetString("lobbyId", CognitiveVR_Preferences.LobbyId, sb); sb.Append(","); } JsonUtil.SetString("sessionid", Core.SessionID, sb); sb.Append(","); JsonUtil.SetDouble("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 = Constants.POSTSENSORDATA(sceneSettings.SceneId, sceneSettings.VersionNumber); //byte[] outBytes = System.Text.UTF8Encoding.UTF8.GetBytes(); //CognitiveVR_Manager.Instance.StartCoroutine(CognitiveVR_Manager.Instance.PostJsonRequest(outBytes, url)); NetworkManager.Post(url, sb.ToString()); }