init
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d59650563232a0b4d842f7e0557cf0a2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,32 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ed8e0fc79c6b704499850c068ba0ac1
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,32 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86e073f28b6dd8c4d9b6b3b6fe638b31
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 89232d6dd6475634a989a733ca609d72
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8af63f3a49855bc49ab30a54897228fc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "AssistantCoreSDKEditor",
|
||||
"references": [
|
||||
"GUID:a7c32ded21d3b9b42a71cdf39f2ed8da"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a32f21e557428c84e845c18e46d9284f
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 13ae9debef50c7e46a015123dfc48813
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Based off Unity forum post https://forum.unity.com/threads/how-to-change-the-name-of-list-elements-in-the-inspector.448910/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Core.Utilities
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(ArrayElementTitleAttribute))]
|
||||
public class ArrayElementTitleDrawer : PropertyDrawer
|
||||
{
|
||||
public override float GetPropertyHeight(SerializedProperty property,
|
||||
GUIContent label)
|
||||
{
|
||||
return EditorGUI.GetPropertyHeight(property, label, true);
|
||||
}
|
||||
|
||||
protected virtual ArrayElementTitleAttribute Attribute
|
||||
{
|
||||
get { return (ArrayElementTitleAttribute) attribute; }
|
||||
}
|
||||
|
||||
SerializedProperty titleNameProp;
|
||||
|
||||
public override void OnGUI(Rect position,
|
||||
SerializedProperty property,
|
||||
GUIContent label)
|
||||
{
|
||||
string name = null;
|
||||
if (string.IsNullOrEmpty(Attribute.varname))
|
||||
{
|
||||
titleNameProp = property.serializedObject.FindProperty(property.propertyPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
string fullPathName = property.propertyPath + "." + Attribute.varname;
|
||||
titleNameProp = property.serializedObject.FindProperty(fullPathName);
|
||||
}
|
||||
|
||||
if (null != titleNameProp)
|
||||
{
|
||||
name = GetTitle();
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(Attribute.fallbackName))
|
||||
{
|
||||
name = Attribute.fallbackName;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
name = label.text;
|
||||
}
|
||||
|
||||
EditorGUI.PropertyField(position, property, new GUIContent(name, label.tooltip), true);
|
||||
}
|
||||
|
||||
private string GetTitle()
|
||||
{
|
||||
switch (titleNameProp.propertyType)
|
||||
{
|
||||
case SerializedPropertyType.Generic:
|
||||
break;
|
||||
case SerializedPropertyType.Integer:
|
||||
return titleNameProp.intValue.ToString();
|
||||
case SerializedPropertyType.Boolean:
|
||||
return titleNameProp.boolValue.ToString();
|
||||
case SerializedPropertyType.Float:
|
||||
return titleNameProp.floatValue.ToString();
|
||||
case SerializedPropertyType.String:
|
||||
return titleNameProp.stringValue;
|
||||
case SerializedPropertyType.Color:
|
||||
return titleNameProp.colorValue.ToString();
|
||||
case SerializedPropertyType.ObjectReference:
|
||||
return titleNameProp.objectReferenceValue?.ToString();
|
||||
case SerializedPropertyType.LayerMask:
|
||||
break;
|
||||
case SerializedPropertyType.Enum:
|
||||
return titleNameProp.enumNames[titleNameProp.enumValueIndex];
|
||||
case SerializedPropertyType.Vector2:
|
||||
return titleNameProp.vector2Value.ToString();
|
||||
case SerializedPropertyType.Vector3:
|
||||
return titleNameProp.vector3Value.ToString();
|
||||
case SerializedPropertyType.Vector4:
|
||||
return titleNameProp.vector4Value.ToString();
|
||||
case SerializedPropertyType.Rect:
|
||||
break;
|
||||
case SerializedPropertyType.ArraySize:
|
||||
break;
|
||||
case SerializedPropertyType.Character:
|
||||
break;
|
||||
case SerializedPropertyType.AnimationCurve:
|
||||
break;
|
||||
case SerializedPropertyType.Bounds:
|
||||
break;
|
||||
case SerializedPropertyType.Gradient:
|
||||
break;
|
||||
case SerializedPropertyType.Quaternion:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99800bf0e26831a41983faa658759631
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa3bcde078d02604fb774938a2a9ea66
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
namespace Oculus.Voice.Core.Utilities
|
||||
{
|
||||
public class AssistantEditorUtils
|
||||
{
|
||||
public static T GetFieldValue<T>(object obj, string name)
|
||||
{
|
||||
// Set the flags so that private and public fields from instances will be found
|
||||
var bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
|
||||
var field = obj.GetType().GetField(name, bindingFlags);
|
||||
return (T) field?.GetValue(obj);
|
||||
}
|
||||
|
||||
public static void SetFieldValue<T>(object obj, string name, T value)
|
||||
{
|
||||
// Set the flags so that private and public fields from instances will be found
|
||||
var bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
|
||||
var field = obj.GetType().GetField(name, bindingFlags);
|
||||
field?.SetValue(obj, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91dbfa5ea168d9444aeca84e19716861
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 08b982f4564aa084e9f123b2855d6881
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 719ae09d6be753e46845c9b349912e3e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using Oculus.Voice.Core.Bindings.Interfaces;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Android
|
||||
{
|
||||
public class AndroidServiceConnection : IConnection
|
||||
{
|
||||
private AndroidJavaObject mAssistantServiceConnection;
|
||||
|
||||
private string serviceFragmentClass;
|
||||
private string serviceGetter;
|
||||
|
||||
public bool IsConnected => null != mAssistantServiceConnection;
|
||||
|
||||
public AndroidJavaObject AssistantServiceConnection => mAssistantServiceConnection;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a connection manager of the given type
|
||||
/// </summary>
|
||||
/// <param name="serviceFragmentClassName">The fully qualified class name of the service fragment that will manage this connection</param>
|
||||
/// <param name="serviceGetterMethodName">The name of the method that will return an instance of the service</param>
|
||||
/// TODO: We should make the getBlahService simply getService() within each fragment implementation.
|
||||
public AndroidServiceConnection(string serviceFragmentClassName, string serviceGetterMethodName)
|
||||
{
|
||||
serviceFragmentClass = serviceFragmentClassName;
|
||||
serviceGetter = serviceGetterMethodName;
|
||||
}
|
||||
|
||||
public void Connect(string version)
|
||||
{
|
||||
if (null == mAssistantServiceConnection)
|
||||
{
|
||||
AndroidJNIHelper.debug = true;
|
||||
|
||||
AndroidJavaClass unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
|
||||
AndroidJavaObject activity = unityPlayerClass.GetStatic<AndroidJavaObject>("currentActivity");
|
||||
|
||||
using (AndroidJavaClass assistantBackgroundFragment = new AndroidJavaClass(serviceFragmentClass))
|
||||
{
|
||||
mAssistantServiceConnection =
|
||||
assistantBackgroundFragment.CallStatic<AndroidJavaObject>("createAndAttach", activity, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
mAssistantServiceConnection.Call("detach");
|
||||
}
|
||||
|
||||
public AndroidJavaObject GetService()
|
||||
{
|
||||
return mAssistantServiceConnection.Call<AndroidJavaObject>(serviceGetter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85f4ff04745e1ab459e49eb38bc288b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Android
|
||||
{
|
||||
public class BaseAndroidConnectionImpl<T> where T : BaseServiceBinding
|
||||
{
|
||||
private string fragmentClassName;
|
||||
protected T service;
|
||||
protected readonly AndroidServiceConnection serviceConnection;
|
||||
|
||||
public bool IsConnected => serviceConnection.IsConnected;
|
||||
|
||||
public BaseAndroidConnectionImpl(string className)
|
||||
{
|
||||
fragmentClassName = className;
|
||||
serviceConnection = new AndroidServiceConnection(className, "getService");
|
||||
}
|
||||
|
||||
#region Service Connection
|
||||
|
||||
public virtual void Connect(string version)
|
||||
{
|
||||
serviceConnection.Connect(version);
|
||||
var serviceInstance = serviceConnection.GetService();
|
||||
if (null == serviceInstance)
|
||||
{
|
||||
throw new Exception("Unable to get service connection from " + fragmentClassName);
|
||||
}
|
||||
|
||||
service = (T) Activator.CreateInstance(typeof(T), serviceInstance);
|
||||
}
|
||||
|
||||
public virtual void Disconnect()
|
||||
{
|
||||
service.Shutdown();
|
||||
serviceConnection.Disconnect();
|
||||
service = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class BaseServiceBinding
|
||||
{
|
||||
protected AndroidJavaObject binding;
|
||||
|
||||
protected BaseServiceBinding(AndroidJavaObject sdkInstance)
|
||||
{
|
||||
binding = sdkInstance;
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
binding.Call("shutdown");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa5e9cb2d6b763f4c983b82092bb192d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e17b7500d9de2e4fbb25afa6264094e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
using Oculus.Voice.Core.Bindings.Interfaces;
|
||||
using Oculus.Voice.Core.Utilities;
|
||||
using UnityEngine;
|
||||
using Debug = UnityEngine.Debug;
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Android.PlatformLogger
|
||||
{
|
||||
public class VoiceSDKConsoleLoggerImpl : IVoiceSDKLogger
|
||||
{
|
||||
public bool IsUsingPlatformIntegration { get; set; }
|
||||
public string WitApplication { get; set; }
|
||||
public bool ShouldLogToConsole { get; set; }
|
||||
private static readonly string TAG = "VoiceSDKConsoleLogger";
|
||||
|
||||
private bool loggedFirstTranscriptionTime = false;
|
||||
public void LogInteractionStart(string requestId, string witApi)
|
||||
{
|
||||
if (!ShouldLogToConsole) return;
|
||||
loggedFirstTranscriptionTime = false;
|
||||
Debug.Log($"{TAG}: Interaction started with request ID: " + requestId);
|
||||
Debug.Log($"{TAG}: WitApi: " + witApi);
|
||||
Debug.Log($"{TAG}: request_start_time: " + DateTimeUtility.ElapsedMilliseconds.ToString());
|
||||
Debug.Log($"{TAG}: WitAppID: " + WitApplication);
|
||||
Debug.Log($"{TAG}: PackageName: " + Application.identifier);
|
||||
}
|
||||
|
||||
public void LogInteractionEndSuccess()
|
||||
{
|
||||
if (!ShouldLogToConsole) return;
|
||||
Debug.Log($"{TAG}: Interaction finished successfully");
|
||||
Debug.Log($"{TAG}: request_end_time: " + DateTimeUtility.ElapsedMilliseconds.ToString());
|
||||
}
|
||||
|
||||
public void LogInteractionEndFailure(string errorMessage)
|
||||
{
|
||||
if (!ShouldLogToConsole) return;
|
||||
Debug.Log($"{TAG}: Interaction finished with error: " + errorMessage);
|
||||
Debug.Log($"{TAG}: request_end_time: " + DateTimeUtility.ElapsedMilliseconds.ToString());
|
||||
}
|
||||
|
||||
public void LogInteractionPoint(string interactionPoint)
|
||||
{
|
||||
if (!ShouldLogToConsole) return;
|
||||
Debug.Log($"{TAG}: Interaction point: " + interactionPoint);
|
||||
Debug.Log($"{TAG}: {interactionPoint}_start_time: " + DateTimeUtility.ElapsedMilliseconds.ToString());
|
||||
}
|
||||
|
||||
public void LogAnnotation(string annotationKey, string annotationValue)
|
||||
{
|
||||
if (!ShouldLogToConsole) return;
|
||||
Debug.Log($"{TAG}: Logging key-value pair: {annotationKey}::{annotationValue}");
|
||||
}
|
||||
|
||||
public void LogFirstTranscriptionTime()
|
||||
{
|
||||
if (!loggedFirstTranscriptionTime)
|
||||
{
|
||||
loggedFirstTranscriptionTime = true;
|
||||
LogInteractionPoint("firstPartialTranscriptionTime");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cbb89bbe77dad204f9e4a1322943320d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Android.PlatformLogger
|
||||
{
|
||||
public class VoiceSDKLoggerBinding : BaseServiceBinding
|
||||
{
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public VoiceSDKLoggerBinding(AndroidJavaObject loggerInstance) : base(loggerInstance) {}
|
||||
|
||||
public void Connect()
|
||||
{
|
||||
binding.Call<bool>("connect");
|
||||
}
|
||||
|
||||
public void LogInteractionStart(string requestId, string startTime)
|
||||
{
|
||||
binding.Call("logInteractionStart", requestId, startTime);
|
||||
}
|
||||
|
||||
public void LogInteractionEndSuccess(string endTime)
|
||||
{
|
||||
binding.Call("logInteractionEndSuccess", endTime);
|
||||
}
|
||||
|
||||
public void LogInteractionEndFailure(string endTime, string errorMessage)
|
||||
{
|
||||
binding.Call("logInteractionEndFailure", endTime, errorMessage);
|
||||
}
|
||||
|
||||
public void LogInteractionPoint(string interactionPoint, string time)
|
||||
{
|
||||
binding.Call("logInteractionPoint", interactionPoint, time);
|
||||
}
|
||||
|
||||
public void LogAnnotation(string annotationKey, string annotationValue)
|
||||
{
|
||||
binding.Call("logAnnotation", annotationKey, annotationValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02f219e3a02e4055b3df9be4f5786e5a
|
||||
timeCreated: 1652919643
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using Oculus.Voice.Core.Bindings.Interfaces;
|
||||
using Oculus.Voice.Core.Utilities;
|
||||
using UnityEngine;
|
||||
using Debug = UnityEngine.Debug;
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Android.PlatformLogger
|
||||
{
|
||||
public class VoiceSDKPlatformLoggerImpl : BaseAndroidConnectionImpl<VoiceSDKLoggerBinding>, IVoiceSDKLogger
|
||||
{
|
||||
public bool IsUsingPlatformIntegration { get; set; }
|
||||
public string WitApplication { get; set; }
|
||||
public bool ShouldLogToConsole
|
||||
{
|
||||
get => consoleLoggerImpl.ShouldLogToConsole;
|
||||
set => consoleLoggerImpl.ShouldLogToConsole = value;
|
||||
}
|
||||
private VoiceSDKConsoleLoggerImpl consoleLoggerImpl = new VoiceSDKConsoleLoggerImpl();
|
||||
public VoiceSDKPlatformLoggerImpl() : base(
|
||||
"com.oculus.assistant.api.unity.logging.UnityPlatformLoggerServiceFragment")
|
||||
{
|
||||
}
|
||||
|
||||
private bool loggedFirstTranscriptionTime = false;
|
||||
|
||||
public override void Connect(string version)
|
||||
{
|
||||
base.Connect(version);
|
||||
service.Connect();
|
||||
Debug.Log(
|
||||
$"Logging Platform integration initialization complete.");
|
||||
}
|
||||
|
||||
public override void Disconnect()
|
||||
{
|
||||
Debug.Log("Logging Platform integration shutdown");
|
||||
base.Disconnect();
|
||||
}
|
||||
|
||||
public void LogInteractionStart(string requestId, string witApi)
|
||||
{
|
||||
loggedFirstTranscriptionTime = false;
|
||||
consoleLoggerImpl.LogInteractionStart(requestId, witApi);
|
||||
service.LogInteractionStart(requestId, DateTimeUtility.ElapsedMilliseconds.ToString());
|
||||
LogAnnotation("isUsingPlatform", IsUsingPlatformIntegration.ToString());
|
||||
LogAnnotation("witApi", witApi);
|
||||
LogAnnotation("witAppId", WitApplication);
|
||||
LogAnnotation("package", Application.identifier);
|
||||
}
|
||||
|
||||
public void LogInteractionEndSuccess()
|
||||
{
|
||||
consoleLoggerImpl.LogInteractionEndSuccess();
|
||||
service.LogInteractionEndSuccess(DateTimeUtility.ElapsedMilliseconds.ToString());
|
||||
}
|
||||
|
||||
public void LogInteractionEndFailure(string errorMessage)
|
||||
{
|
||||
consoleLoggerImpl.LogInteractionEndFailure(errorMessage);
|
||||
service.LogInteractionEndFailure(DateTimeUtility.ElapsedMilliseconds.ToString(), errorMessage);
|
||||
}
|
||||
|
||||
public void LogInteractionPoint(string interactionPoint)
|
||||
{
|
||||
consoleLoggerImpl.LogInteractionPoint(interactionPoint);
|
||||
service.LogInteractionPoint(interactionPoint, DateTimeUtility.ElapsedMilliseconds.ToString());
|
||||
}
|
||||
|
||||
public void LogAnnotation(string annotationKey, string annotationValue)
|
||||
{
|
||||
consoleLoggerImpl.LogAnnotation(annotationKey, annotationValue);
|
||||
service.LogAnnotation(annotationKey, annotationValue);
|
||||
}
|
||||
|
||||
public void LogFirstTranscriptionTime()
|
||||
{
|
||||
if (!loggedFirstTranscriptionTime)
|
||||
{
|
||||
loggedFirstTranscriptionTime = true;
|
||||
LogInteractionPoint("firstPartialTranscriptionTime");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eee6ea0d8b185f54b8cba025115dea67
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "AssistantCoreSDKRuntime"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a7c32ded21d3b9b42a71cdf39f2ed8da
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a116b0921542354a9d57799cba768bd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Interfaces
|
||||
{
|
||||
public interface IConnection
|
||||
{
|
||||
void Connect(string version);
|
||||
void Disconnect();
|
||||
|
||||
bool IsConnected { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a8340504b2574441afe16939acde7ae
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Interfaces
|
||||
{
|
||||
public interface IVoiceSDKLogger
|
||||
{
|
||||
bool IsUsingPlatformIntegration { get; set; }
|
||||
bool ShouldLogToConsole { get; set; }
|
||||
string WitApplication { get; set; }
|
||||
void LogInteractionStart(string requestId, string witApi);
|
||||
void LogInteractionEndSuccess();
|
||||
void LogInteractionEndFailure(string errorMessage);
|
||||
void LogInteractionPoint(string interactionPoint);
|
||||
void LogAnnotation(string annotationKey, string annotationValue);
|
||||
void LogFirstTranscriptionTime();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1120ad58e6347809f136d52caa7638f
|
||||
timeCreated: 1652979217
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48dd050ce4e9b904fa2888ae3c2724d2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Based off Unity forum post https://forum.unity.com/threads/how-to-change-the-name-of-list-elements-in-the-inspector.448910/
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Core.Utilities
|
||||
{
|
||||
public class ArrayElementTitleAttribute : PropertyAttribute
|
||||
{
|
||||
public string varname;
|
||||
public string fallbackName;
|
||||
|
||||
public ArrayElementTitleAttribute(string elementTitleVar = null, string fallbackName = null)
|
||||
{
|
||||
varname = elementTitleVar;
|
||||
this.fallbackName = fallbackName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd85a8631126f474f8d69375b5cc2bf4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Oculus.Voice.Core.Utilities
|
||||
{
|
||||
public class DateTimeUtility
|
||||
{
|
||||
public static DateTime UtcNow
|
||||
{
|
||||
get => DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public static long ElapsedMilliseconds
|
||||
{
|
||||
get => UtcNow.Ticks / TimeSpan.TicksPerMillisecond;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 572733f79a0d4ca698f549719e65df51
|
||||
timeCreated: 1653065378
|
||||
Reference in New Issue
Block a user