public void CheckSSRPHandShakeResponse(String response) { boss.hud.addText("Verifying SSRP HandShake Response"); //is response in a formate we understand isAuthenticated = false; boss.ssrpIcon.action("verify"); try { response_raw = (SSRP_response_raw)Deserialize(typeof(SSRP_response_raw), response); // validation process stubb bool responseOk = false; if (responseOk) { isAuthenticated = true; boss.ssrpIcon.On(); sendAuthenticatedSSRPQuery(); } } catch { SSRP_Connection_Error(); } }
private void LoadSensorData() { string filePath = Application.dataPath + gameDataProjectFilePath; string dataAsJson = File.ReadAllText(filePath); if (File.Exists(filePath)) { string ssrp_response_string = File.ReadAllText(filePath); SSRP_response_raw response_raw = (SSRP_response_raw)Deserialize(typeof(SSRP_response_raw), ssrp_response_string); SSRP_contextResponse[] loraSensors_unordered_List = response_raw.contextResponses; SSRP_contextResponse loraSensor_0 = loraSensors_unordered_List[0]; Debug.Log(loraSensor_0.description()); Debug.Log(loraSensor_0.list_attributes()); Debug.Log("Hello VS17 breakpointDebugger"); } }
public IEnumerator loadBundle() { boss = PersistantManager.Instance; string uri = "file:///" + Application.dataPath + "/AssetBundles/" + assetBundleName; UnityEngine.Networking.UnityWebRequest request = UnityEngine.Networking.UnityWebRequest.GetAssetBundle(uri, 0); yield return(request.SendWebRequest()); // yield return request.Send(); AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(request); //ssrp_response_string = bundle.Load<>; TextAsset charDataFile2 = bundle.LoadAsset(fileName) as TextAsset; ssrp_response_string = charDataFile2.text; response_raw = (SSRP_response_raw)Deserialize(typeof(SSRP_response_raw), ssrp_response_string); boss.entityManager.importEntity(response_raw.contextResponses); /* * GameObject cube = bundle.LoadAsset<GameObject>("Cube"); * * GameObject sprite = bundle.LoadAsset<GameObject>("Sprite"); * Instantiate(cube); * Instantiate(sprite); * // */ }
public bool okResponse(SSRP_response_raw sSRP_Response_Raw) { SSRP_contextResponse[] context_response = sSRP_Response_Raw.contextResponses; bool valid = true; foreach (SSRP_contextResponse cr in context_response) { if (cr.isCorrupt()) { valid = false; } } return(valid); }
public void CheckSSRPQueryResponse(String response) { boss.hud.addText("Check SSRP Query Response"); boss.ssrpIcon.action("Verify"); try { boss.ssrpIcon.On(); response_raw = (SSRP_response_raw)Deserialize(typeof(SSRP_response_raw), response); // validation process stubb isAuthenticated = true; sendAuthenticatedSSRPQuery(); } catch { SSRP_Connection_Error(); } }
private void readStoredResponseFromFile() { string filePath = Application.dataPath + gameDataProjectFilePath; boss.hud.addText("Read Stored Response From File()"); if (File.Exists(filePath)) { ssrp_response_string = File.ReadAllText(filePath); response_raw = (SSRP_response_raw)Deserialize(typeof(SSRP_response_raw), ssrp_response_string); entityManager.importEntity(response_raw.contextResponses); // entityManager.open(vuforiaMarkerId); } else { Debug.LogError("Internal Warning: Stored Response From File() Error"); boss.hud.addText("Internal Warning: Stored Response From File() Error ??????? "); } }
private SSRP_contextResponse[] validateDataFrom(string loc) { Boolean issue = false; TextAsset txtAsset; string str = ""; if (loc != "") { try { //txtAsset = Resources.Load(loc, typeof(TextAsset)) as TextAsset; // forward slash boss.hud.addText(loc + ": text Obj found"); } catch { boss.hud.addText(loc + ": text Obj not found"); return(null); } try { //str = txtAsset.text; boss.hud.addText(loc + ": got.text "); } catch { boss.hud.addText(loc + ": no.text"); } } else { //str = ssrp_response_string; //ServerConnect sc = new ServerConnect(); //sc.getsecond(); if (ServerConnect.txt != null) { str = ServerConnect.txt; } Debug.Log(ServerConnect.txt); } if (str == "") { boss.hud.addText(loc + ":str empy"); return(null); } try { boss.hud.addText(loc + ":deserialized"); response_raw = (SSRP_response_raw)Deserialize(typeof(SSRP_response_raw), str); } catch { boss.hud.addText(loc + ": failed to deserialize"); return(null); } try { issue = !okResponse(response_raw); boss.hud.addText(loc + ":parsed"); } catch { boss.hud.addText(loc + " :parse fail"); return(null); } boss.hud.addText(loc + ":validated"); return(response_raw.contextResponses); }
private void readStoredResponseFromFile() { if (!reading) { reading = true; boss.hud.addText("readStoredResponseFromFile()"); Boolean issue = true; boss = PersistantManager.Instance; boss.workingIcon.On(); boss.targetManager.dynamicLoadofVuforiaDataBase(VuforiaDatabaseName); // File.io stuff /* * string file = Application.dataPath + "/" + fileName; * string plainPath = Application.dataPath + "/" + gameDataProjectFilePath + "/" + fileName; */ // standard unity stuff the last in the list forces the read from ssrp_response_string string fileNpath = gameDataProjectFilePath + "/" + fileName; List <string> locations = new List <string>() { fileName, fileNpath, "" }; SSRP_contextResponse[] validatedResponse = null; response_raw = null; if (currentCount >= maxReadTimer) { boss.hud.addText("Attempted to read " + maxReadTimer + "times: STOP LOADING"); isBeating = false; return; } // don't use .txt foreach (string loc in locations) { if (validatedResponse == null) { SSRP_contextResponse[] temp = validateDataFrom(loc); if (temp != null) { validatedResponse = validateDataFrom(loc); } } } if (validatedResponse != null) { boss.hud.addText("Importing validatedResponse into SSRP entity manager for Filtering"); boss.entityManager.importEntity(validatedResponse); currentCount++; } boss.workingIcon.Off(); reading = false; } }