diff options
author | Brad Davis <[email protected]> | 2014-10-24 12:56:30 -0700 |
---|---|---|
committer | Brad Davis <[email protected]> | 2014-10-24 12:56:30 -0700 |
commit | 496894ecced1b0a4ae5ab176902bbd0f43a31ed1 (patch) | |
tree | 8b7d4be1fc8508253d399d98da6143212ceb8f3c /LibOVR/Src/Service | |
parent | 911239601768bacf9420ab9cfeffed7e861844ac (diff) |
Updating to 0.4.3 SDK0.4.3-official
Diffstat (limited to 'LibOVR/Src/Service')
-rw-r--r-- | LibOVR/Src/Service/Service_NetClient.cpp | 72 | ||||
-rw-r--r-- | LibOVR/Src/Service/Service_NetClient.h | 9 | ||||
-rw-r--r-- | LibOVR/Src/Service/Service_NetSessionCommon.cpp | 12 | ||||
-rw-r--r-- | LibOVR/Src/Service/Service_NetSessionCommon.h | 6 |
4 files changed, 54 insertions, 45 deletions
diff --git a/LibOVR/Src/Service/Service_NetClient.cpp b/LibOVR/Src/Service/Service_NetClient.cpp index 8c3e232..fc29499 100644 --- a/LibOVR/Src/Service/Service_NetClient.cpp +++ b/LibOVR/Src/Service/Service_NetClient.cpp @@ -5,16 +5,16 @@ Content : Client for service interface Created : June 12, 2014 Authors : Michael Antonov, Kevin Jenkins, Chris Taylor -Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. -Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License"); +Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); you may not use the Oculus VR Rift 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 -http://www.oculusvr.com/licenses/LICENSE-3.1 +http://www.oculusvr.com/licenses/LICENSE-3.2 Unless required by applicable law or agreed to in writing, the Oculus VR SDK distributed under the License is distributed on an "AS IS" BASIS, @@ -27,7 +27,7 @@ limitations under the License. #include "Service_NetClient.h" #include "../Net/OVR_MessageIDTypes.h" -#ifdef OVR_OS_MAC +#if defined (OVR_OS_MAC) || defined(OVR_OS_LINUX) #define GetCurrentProcessId getpid #endif OVR_DEFINE_SINGLETON(OVR::Service::NetClient); @@ -51,6 +51,7 @@ NetClient::NetClient() : Start(); + // Must be at end of function PushDestroyCallbacks(); } @@ -199,7 +200,7 @@ const char* NetClient::GetStringValue(VirtualHmdId hmd, const char* key, const c bsOut.Write(default_val); if (!GetRPC1()->CallBlocking("GetStringValue_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData)) { - OVR_ASSERT(false); + return ""; } if (!returnData.Read(ProfileGetValue1_Str)) { @@ -220,7 +221,7 @@ bool NetClient::GetBoolValue(VirtualHmdId hmd, const char* key, bool default_val bsOut.Write(default_val); if (!GetRPC1()->CallBlocking("GetBoolValue_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData)) { - OVR_ASSERT(false); + return default_val; } uint8_t out = 0; if (!returnData.Read(out)) @@ -242,7 +243,7 @@ int NetClient::GetIntValue(VirtualHmdId hmd, const char* key, int default_val) bsOut.Write(default_val); if (!GetRPC1()->CallBlocking("GetIntValue_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData)) { - OVR_ASSERT(false); + return default_val; } int32_t out = (int32_t)default_val; if (!returnData.Read(out)) @@ -264,7 +265,7 @@ double NetClient::GetNumberValue(VirtualHmdId hmd, const char* key, double defau bsOut.Write(default_val); if (!GetRPC1()->CallBlocking("GetNumberValue_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData)) { - OVR_ASSERT(false); + return default_val; } double out = 0.; returnData.Read(out); @@ -286,7 +287,7 @@ int NetClient::GetNumberValues(VirtualHmdId hmd, const char* key, double* values if (!GetRPC1()->CallBlocking("GetNumberValues_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData)) { - OVR_ASSERT(false); + return 0; } int32_t out = 0; @@ -330,7 +331,6 @@ bool NetClient::SetStringValue(VirtualHmdId hmd, const char* key, const char* va if (!GetRPC1()->Signal("SetStringValue_1", &bsOut, GetSession()->GetConnectionAtIndex(0))) { - OVR_ASSERT(false); return false; } @@ -353,7 +353,6 @@ bool NetClient::SetBoolValue(VirtualHmdId hmd, const char* key, bool val) if (!GetRPC1()->Signal("SetBoolValue_1", &bsOut, GetSession()->GetConnectionAtIndex(0))) { - OVR_ASSERT(false); return false; } @@ -376,7 +375,6 @@ bool NetClient::SetIntValue(VirtualHmdId hmd, const char* key, int val) if (!GetRPC1()->Signal("SetIntValue_1", &bsOut, GetSession()->GetConnectionAtIndex(0))) { - OVR_ASSERT(false); return false; } @@ -398,7 +396,6 @@ bool NetClient::SetNumberValue(VirtualHmdId hmd, const char* key, double val) if (!GetRPC1()->Signal("SetNumberValue_1", &bsOut, GetSession()->GetConnectionAtIndex(0))) { - OVR_ASSERT(false); return false; } @@ -426,7 +423,6 @@ bool NetClient::SetNumberValues(VirtualHmdId hmd, const char* key, const double* if (!GetRPC1()->Signal("SetNumberValues_1", &bsOut, GetSession()->GetConnectionAtIndex(0))) { - OVR_ASSERT(false); return false; } @@ -453,7 +449,6 @@ int NetClient::Hmd_Detect() if (!GetRPC1()->CallBlocking("Hmd_Detect_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData)) { - OVR_ASSERT(false); return 0; } @@ -479,15 +474,12 @@ bool NetClient::Hmd_Create(int index, HMDNetworkInfo* netInfo) int32_t w = (int32_t)index; bsOut.Write(w); -#if defined(OVR_OS_WIN32) || defined(OVR_OS_MAC) // Need the Pid for driver mode pid_t pid = GetCurrentProcessId(); bsOut.Write(pid); -#endif if (!GetRPC1()->CallBlocking("Hmd_Create_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData)) { - OVR_ASSERT(false); return false; } @@ -507,7 +499,6 @@ bool NetClient::GetDriverMode(bool& driverInstalled, bool& compatMode, bool& hid if (!GetRPC1()->CallBlocking("GetDriverMode_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData)) { - OVR_ASSERT(false); return false; } @@ -546,7 +537,6 @@ bool NetClient::SetDriverMode(bool compatMode, bool hideDK1Mode) if (!GetRPC1()->CallBlocking("SetDriverMode_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData)) { - OVR_ASSERT(false); return false; } @@ -570,12 +560,19 @@ bool NetClient::Hmd_AttachToWindow(VirtualHmdId hmd, void* hWindow) OVR::Net::BitStream bsOut; bsOut.Write(hmd); + #ifdef OVR_OS_LINUX + if (hWindow == NULL) + { + return false; + } + unsigned long hWinWord = *(unsigned long *)hWindow; + #else UInt64 hWinWord = (UPInt)hWindow; + #endif bsOut.Write(hWinWord); if (!GetRPC1()->CallBlocking("Hmd_AttachToWindow_1", &bsOut, GetSession()->GetConnectionAtIndex(0))) { - OVR_ASSERT(false); return false; } @@ -591,10 +588,8 @@ void NetClient::Hmd_Release(VirtualHmdId hmd) OVR::Net::BitStream bsOut; bsOut.Write(hmd); - if (!GetRPC1()->CallBlocking("Hmd_Release_1", &bsOut, GetSession()->GetConnectionAtIndex(0))) - { - OVR_ASSERT(false); - } + bool result = GetRPC1()->CallBlocking("Hmd_Release_1", &bsOut, GetSession()->GetConnectionAtIndex(0)); + OVR_ASSERT_AND_UNUSED(result, result); } void NetClient::SetLastError(String str) @@ -614,7 +609,6 @@ const char* NetClient::Hmd_GetLastError(VirtualHmdId hmd) bsOut.Write(hmd); if (!GetRPC1()->CallBlocking("Hmd_GetLastError_1", &bsOut, GetSession()->GetConnectionAtIndex(0))) { - OVR_ASSERT(false); return Hmd_GetLastError_Str.ToCStr(); } if (!bsOut.Read(Hmd_GetLastError_Str)) @@ -638,7 +632,6 @@ bool NetClient::Hmd_GetHmdInfo(VirtualHmdId hmd, HMDInfo* hmdInfo) bsOut.Write(hmd); if (!GetRPC1()->CallBlocking("Hmd_GetHmdInfo_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData)) { - OVR_ASSERT(false); return false; } @@ -658,7 +651,6 @@ unsigned int NetClient::Hmd_GetEnabledCaps(VirtualHmdId hmd) bsOut.Write(hmd); if (!GetRPC1()->CallBlocking("Hmd_GetEnabledCaps_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData)) { - OVR_ASSERT(false); return 0; } @@ -686,7 +678,6 @@ unsigned int NetClient::Hmd_SetEnabledCaps(VirtualHmdId hmd, unsigned int hmdCap if (!GetRPC1()->CallBlocking("Hmd_SetEnabledCaps_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData)) { - OVR_ASSERT(false); return 0; } @@ -719,7 +710,6 @@ bool NetClient::Hmd_ConfigureTracking(VirtualHmdId hmd, unsigned supportedCaps, if (!GetRPC1()->CallBlocking("Hmd_ConfigureTracking_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData)) { - OVR_ASSERT(false); return false; } @@ -744,7 +734,6 @@ void NetClient::Hmd_ResetTracking(VirtualHmdId hmd) bsOut.Write(hmd); if (!GetRPC1()->CallBlocking("Hmd_ResetTracking_1", &bsOut, GetSession()->GetConnectionAtIndex(0))) { - OVR_ASSERT(false); return; } } @@ -765,7 +754,6 @@ bool NetClient::LatencyUtil_ProcessInputs(double startTestSeconds, unsigned char bsOut.Write(startTestSeconds); if (!GetRPC1()->CallBlocking("LatencyUtil_ProcessInputs_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData)) { - OVR_ASSERT(false); return false; } @@ -793,7 +781,6 @@ const char* NetClient::LatencyUtil_GetResultsString() OVR::Net::BitStream bsOut, returnData; if (!GetRPC1()->CallBlocking("LatencyUtil_GetResultsString_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData)) { - OVR_ASSERT(false); return NULL; } @@ -829,6 +816,7 @@ void NetClient::registerRPC() // Register RPC functions: RPC_REGISTER_SLOT(InitialServerStateScope, InitialServerState_1); RPC_REGISTER_SLOT(LatencyTesterAvailableScope, LatencyTesterAvailable_1); + RPC_REGISTER_SLOT(DefaultLogOutputScope, DefaultLogOutput_1); RPC_REGISTER_SLOT(HMDCountUpdateScope, HMDCountUpdate_1); } @@ -851,6 +839,24 @@ void NetClient::LatencyTesterAvailable_1(BitStream* userData, ReceivePayload* pP LatencyTesterAvailable = (b != 0); } +void NetClient::DefaultLogOutput_1(BitStream* userData, ReceivePayload* pPayload) +{ + OVR_UNUSED(pPayload); + + String formattedText; + LogMessageType messageType = Log_Text; // Will normally be overwritten below. + userData->Read(messageType); + if (userData->Read(formattedText)) + { + if (OVR::Log::GetGlobalLog()) + { + OVR::String logStr = "[From Service] "; + logStr.AppendString(formattedText); + OVR::Log::GetGlobalLog()->LogMessage(messageType, "%s", logStr.ToCStr()); + } + } +} + void NetClient::HMDCountUpdate_1(BitStream* userData, ReceivePayload* pPayload) { OVR_UNUSED(pPayload); diff --git a/LibOVR/Src/Service/Service_NetClient.h b/LibOVR/Src/Service/Service_NetClient.h index 96a8ad9..ab7906e 100644 --- a/LibOVR/Src/Service/Service_NetClient.h +++ b/LibOVR/Src/Service/Service_NetClient.h @@ -5,16 +5,16 @@ Content : Client for service interface Created : June 12, 2014 Authors : Michael Antonov, Kevin Jenkins, Chris Taylor -Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. -Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License"); +Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); you may not use the Oculus VR Rift 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 -http://www.oculusvr.com/licenses/LICENSE-3.1 +http://www.oculusvr.com/licenses/LICENSE-3.2 Unless required by applicable law or agreed to in writing, the Oculus VR SDK distributed under the License is distributed on an "AS IS" BASIS, @@ -136,6 +136,9 @@ protected: ObserverScope<Net::Plugins::RPCSlot> LatencyTesterAvailableScope; void LatencyTesterAvailable_1(BitStream* userData, ReceivePayload* pPayload); + ObserverScope<Net::Plugins::RPCSlot> DefaultLogOutputScope; + void DefaultLogOutput_1(BitStream* userData, ReceivePayload* pPayload); + ObserverScope<Net::Plugins::RPCSlot> HMDCountUpdateScope; void HMDCountUpdate_1(BitStream* userData, ReceivePayload* pPayload); }; diff --git a/LibOVR/Src/Service/Service_NetSessionCommon.cpp b/LibOVR/Src/Service/Service_NetSessionCommon.cpp index 9f8d863..80392a8 100644 --- a/LibOVR/Src/Service/Service_NetSessionCommon.cpp +++ b/LibOVR/Src/Service/Service_NetSessionCommon.cpp @@ -5,16 +5,16 @@ Content : Server for service interface Created : June 12, 2014 Authors : Kevin Jenkins, Chris Taylor -Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. -Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License"); +Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); you may not use the Oculus VR Rift 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 -http://www.oculusvr.com/licenses/LICENSE-3.1 +http://www.oculusvr.com/licenses/LICENSE-3.2 Unless required by applicable law or agreed to in writing, the Oculus VR SDK distributed under the License is distributed on an "AS IS" BASIS, @@ -253,13 +253,13 @@ static const char* KeyNames[][NetSessionCommon::ENumTypes] = { /* EGetStringValue */ { "CameraSerial", "CameraUUID", 0 }, /* EGetBoolValue */ { "ReleaseDK2Sensors", "ReleaseLegacySensors", 0 }, /* EGetIntValue */ { 0 }, - /* EGetNumberValue */{ "CenterPupilDepth", 0 }, + /* EGetNumberValue */{ "CenterPupilDepth", "LoggingMask", 0 }, /* EGetNumberValues */{ "NeckModelVector3f", 0 }, /* ESetStringValue */ { 0 }, /* ESetBoolValue */ { "ReleaseDK2Sensors", "ReleaseLegacySensors", 0 }, /* ESetIntValue */ { 0 }, - /* ESetNumberValue */{ "CenterPupilDepth", 0 }, - /* ESetNumberValues */{ "NeckModelVector3f", 0 } + /* ESetNumberValue */{ "CenterPupilDepth", "LoggingMask", 0 }, + /* ESetNumberValues */{ "NeckModelVector3f", 0 }, }; bool IsInStringArray(const char* a[], const char* key) diff --git a/LibOVR/Src/Service/Service_NetSessionCommon.h b/LibOVR/Src/Service/Service_NetSessionCommon.h index f6de30c..79c0cfb 100644 --- a/LibOVR/Src/Service/Service_NetSessionCommon.h +++ b/LibOVR/Src/Service/Service_NetSessionCommon.h @@ -5,16 +5,16 @@ Content : Shared networking for service Created : June 12, 2014 Authors : Kevin Jenkins, Chris Taylor -Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. -Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License"); +Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); you may not use the Oculus VR Rift 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 -http://www.oculusvr.com/licenses/LICENSE-3.1 +http://www.oculusvr.com/licenses/LICENSE-3.2 Unless required by applicable law or agreed to in writing, the Oculus VR SDK distributed under the License is distributed on an "AS IS" BASIS, |