private void parseVisualSearchResponse(String eventValue) { // Debug.Log ("parseVisualSearchResponse: "+eventValue); string[] tokens = eventValue.Split("|"[0]); // Debug.Log ("parseVisualSearchResponse: tokens count "+tokens.Length); if (tokens.Length < 2) { return; } int errorCode = Int32.Parse(tokens[0]); int responseCount = Int32.Parse(tokens[1]); VisualSearchResponse[] response = new VisualSearchResponse[responseCount]; // Debug.Log ("parseVisualSearchResponse: "+responseCount); int j = 2; for (int i = 0; i < responseCount; i++) { response[i].TrackingConfigurationName = tokens[j++]; response[i].TrackingConfiguration = tokens[j++]; } onVisualSearchResult(response, errorCode); }
public static VisualSearchResponse FromPB(metaio.unitycommunication.VisualSearchResponse resp) { VisualSearchResponse ret = new VisualSearchResponse(); ret.trackingConfigurationName = resp.TrackingConfigurationName; ret.trackingConfiguration = resp.TrackingConfiguration; ret.visualSearchScore = resp.VisualSearchScore; ret.metadata = resp.Metadata; return ret; }
public static VisualSearchResponse FromPB(metaio.unitycommunication.VisualSearchResponse resp) { VisualSearchResponse ret = new VisualSearchResponse(); ret.trackingConfigurationName = resp.TrackingConfigurationName; ret.trackingConfiguration = resp.TrackingConfiguration; ret.visualSearchScore = resp.VisualSearchScore; ret.metadata = resp.Metadata; return(ret); }
private void parseVisualSearchResponse(IntPtr eventValuePtr, uint eventValueLength) { byte[] pbAsBytes = new byte[eventValueLength]; Marshal.Copy(eventValuePtr, pbAsBytes, 0, (int)eventValueLength); metaio.unitycommunication.OnVisualSearchResultProtocol pb = metaio.unitycommunication.OnVisualSearchResultProtocol.ParseFrom(pbAsBytes); VisualSearchResponse[] responses = new VisualSearchResponse[pb.ResponsesCount]; for (int i = 0; i < pb.ResponsesCount; ++i) { responses[i] = VisualSearchResponse.FromPB(pb.ResponsesList[i]); } onVisualSearchResult(responses, pb.ErrorCode); }
protected virtual void onVisualSearchResult(VisualSearchResponse[] response, int errorCode) { }