ovr_sdk

view LibOVR/Src/Service/Service_NetClient.cpp @ 3:f12a8f74fe1f

added the Xcode project
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 21 Jan 2015 11:37:50 +0200
parents
children
line source
1 /************************************************************************************
3 Filename : Service_NetClient.cpp
4 Content : Client for service interface
5 Created : June 12, 2014
6 Authors : Michael Antonov, Kevin Jenkins, Chris Taylor
8 Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved.
10 Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License");
11 you may not use the Oculus VR Rift SDK except in compliance with the License,
12 which is provided at the time of installation or download, or which
13 otherwise accompanies this software in either electronic or hard copy form.
15 You may obtain a copy of the License at
17 http://www.oculusvr.com/licenses/LICENSE-3.2
19 Unless required by applicable law or agreed to in writing, the Oculus VR SDK
20 distributed under the License is distributed on an "AS IS" BASIS,
21 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 See the License for the specific language governing permissions and
23 limitations under the License.
25 ************************************************************************************/
27 #include "Service_NetClient.h"
28 #include "../Net/OVR_MessageIDTypes.h"
30 #if defined (OVR_OS_MAC) || defined(OVR_OS_LINUX)
31 #define GetCurrentProcessId getpid
32 #endif
33 OVR_DEFINE_SINGLETON(OVR::Service::NetClient);
35 namespace OVR { namespace Service {
37 using namespace OVR::Net;
40 //// NetClient
42 NetClient::NetClient() :
43 LatencyTesterAvailable(false),
44 HMDCount(0),
45 EdgeTriggeredHMDCount(false)
46 {
47 GetSession()->AddSessionListener(this);
49 // Register RPC functions
50 registerRPC();
52 Start();
54 // Must be at end of function
55 PushDestroyCallbacks();
56 }
58 NetClient::~NetClient()
59 {
60 }
62 void NetClient::OnSystemDestroy()
63 {
64 onSystemDestroy();
65 }
67 void NetClient::OnThreadDestroy()
68 {
69 onThreadDestroy();
70 }
72 int NetClient::Run()
73 {
74 SetThreadName("NetClient");
76 while (!Terminated)
77 {
78 // Note: There is no watchdog here because the watchdog is part of the private code
80 GetSession()->Poll(false);
82 if (GetSession()->GetActiveSocketsCount() == 0)
83 {
84 Thread::MSleep(10);
85 }
86 }
88 return 0;
89 }
91 void NetClient::OnReceive(ReceivePayload* pPayload, ListenerReceiveResult* lrrOut)
92 {
93 OVR_UNUSED(lrrOut);
94 OVR_UNUSED(pPayload);
95 }
97 void NetClient::OnDisconnected(Connection* conn)
98 {
99 OVR_UNUSED(conn);
101 OVR_DEBUG_LOG(("[NetClient] Disconnected"));
103 EdgeTriggeredHMDCount = false;
104 }
106 void NetClient::OnConnected(Connection* conn)
107 {
108 OVR_UNUSED(conn);
110 OVR_DEBUG_LOG(("[NetClient] Connected to a server running version %d.%d.%d (my version=%d.%d.%d)",
111 conn->RemoteMajorVersion, conn->RemoteMinorVersion, conn->RemotePatchVersion,
112 RPCVersion_Major, RPCVersion_Minor, RPCVersion_Patch));
114 EdgeTriggeredHMDCount = false;
115 }
117 bool NetClient::Connect(bool blocking)
118 {
119 // Set up bind parameters
120 OVR::Net::BerkleyBindParameters bbp;
121 bbp.Address = "::1"; // Bind to localhost only!
122 bbp.blockingTimeout = 5000;
123 OVR::Net::SockAddr sa;
124 sa.Set("::1", VRServicePort, SOCK_STREAM);
126 // Attempt to connect
127 OVR::Net::SessionResult result = GetSession()->ConnectPTCP(&bbp, &sa, blocking);
129 // Already connected counts as success too
130 return result == Net::SessionResult_OK ||
131 result == Net::SessionResult_AlreadyConnected ||
132 result == Net::SessionResult_ConnectInProgress;
133 }
135 void NetClient::Disconnect()
136 {
137 GetSession()->Shutdown();
138 }
140 bool NetClient::IsConnected(bool attemptReconnect, bool blockOnReconnect)
141 {
142 // If it was able to connect,
143 if (GetSession()->GetConnectionCount() > 0)
144 {
145 return true;
146 }
147 else if (attemptReconnect)
148 {
149 // Attempt to connect here
150 Connect(blockOnReconnect);
152 // If it connected,
153 if (GetSession()->GetConnectionCount() > 0)
154 {
155 return true;
156 }
157 }
159 // No connections
160 return false;
161 }
163 void NetClient::GetLocalProtocolVersion(int& major, int& minor, int& patch)
164 {
165 major = RPCVersion_Major;
166 minor = RPCVersion_Minor;
167 patch = RPCVersion_Patch;
168 }
170 bool NetClient::GetRemoteProtocolVersion(int& major, int& minor, int& patch)
171 {
172 Ptr<Connection> conn = GetSession()->GetConnectionAtIndex(0);
174 if (conn)
175 {
176 major = conn->RemoteMajorVersion;
177 minor = conn->RemoteMinorVersion;
178 patch = conn->RemotePatchVersion;
179 return true;
180 }
182 return false;
183 }
186 //// NetClient API
188 const char* NetClient::GetStringValue(VirtualHmdId hmd, const char* key, const char* default_val)
189 {
190 if (!IsConnected(true, true))
191 {
192 return "";
193 }
195 // If a null value is provided,
196 if (!default_val)
197 {
198 default_val = "";
199 }
201 ProfileGetValue1_Str = default_val;
203 OVR::Net::BitStream bsOut, returnData;
204 bsOut.Write(hmd);
205 bsOut.Write(key);
206 bsOut.Write(default_val);
207 if (!GetRPC1()->CallBlocking("GetStringValue_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData))
208 {
209 return "";
210 }
211 if (!returnData.Read(ProfileGetValue1_Str))
212 {
213 OVR_ASSERT(false);
214 }
215 return ProfileGetValue1_Str.ToCStr();
216 }
217 bool NetClient::GetBoolValue(VirtualHmdId hmd, const char* key, bool default_val)
218 {
219 if (!IsConnected(true, true))
220 {
221 return default_val;
222 }
224 OVR::Net::BitStream bsOut, returnData;
225 bsOut.Write(hmd);
226 bsOut.Write(key);
227 bsOut.Write(default_val);
228 if (!GetRPC1()->CallBlocking("GetBoolValue_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData))
229 {
230 return default_val;
231 }
232 uint8_t out = 0;
233 if (!returnData.Read(out))
234 {
235 OVR_ASSERT(false);
236 }
237 return out != 0;
238 }
239 int NetClient::GetIntValue(VirtualHmdId hmd, const char* key, int default_val)
240 {
241 if (!IsConnected(true, true))
242 {
243 return default_val;
244 }
246 OVR::Net::BitStream bsOut, returnData;
247 bsOut.Write(hmd);
248 bsOut.Write(key);
249 bsOut.Write(default_val);
250 if (!GetRPC1()->CallBlocking("GetIntValue_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData))
251 {
252 return default_val;
253 }
254 int32_t out = (int32_t)default_val;
255 if (!returnData.Read(out))
256 {
257 OVR_ASSERT(false);
258 }
259 return out;
260 }
261 double NetClient::GetNumberValue(VirtualHmdId hmd, const char* key, double default_val)
262 {
263 if (!IsConnected(true, true))
264 {
265 return default_val;
266 }
268 OVR::Net::BitStream bsOut, returnData;
269 bsOut.Write(hmd);
270 bsOut.Write(key);
271 bsOut.Write(default_val);
272 if (!GetRPC1()->CallBlocking("GetNumberValue_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData))
273 {
274 return default_val;
275 }
276 double out = 0.;
277 returnData.Read(out);
278 return out;
279 }
280 int NetClient::GetNumberValues(VirtualHmdId hmd, const char* key, double* values, int num_vals)
281 {
282 if (!IsConnected(true, true))
283 {
284 return 0;
285 }
287 OVR::Net::BitStream bsOut, returnData;
288 bsOut.Write(hmd);
289 bsOut.Write(key);
291 int32_t w = (int32_t)num_vals;
292 bsOut.Write(w);
294 if (!GetRPC1()->CallBlocking("GetNumberValues_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData))
295 {
296 return 0;
297 }
299 int32_t out = 0;
300 if (!returnData.Read(out))
301 {
302 OVR_ASSERT(false);
303 }
304 OVR_ASSERT(out >= 0 && out <= num_vals);
305 if (out < 0)
306 {
307 out = 0;
308 }
309 else if (out > num_vals)
310 {
311 out = num_vals;
312 }
314 for (int i = 0; i < out && i < num_vals; i++)
315 {
316 if (!returnData.Read(values[i]))
317 {
318 return i;
319 }
320 }
322 return out;
323 }
325 bool NetClient::SetStringValue(VirtualHmdId hmd, const char* key, const char* val)
326 {
327 if (!IsConnected(true, true))
328 {
329 return false;
330 }
332 OVR::Net::BitStream bsOut;
333 bsOut.Write(hmd);
334 bsOut.Write(key);
336 bsOut.Write(val);
338 if (!GetRPC1()->Signal("SetStringValue_1", &bsOut, GetSession()->GetConnectionAtIndex(0)))
339 {
340 return false;
341 }
343 return true;
344 }
346 bool NetClient::SetBoolValue(VirtualHmdId hmd, const char* key, bool val)
347 {
348 if (!IsConnected(true, true))
349 {
350 return false;
351 }
353 OVR::Net::BitStream bsOut;
354 bsOut.Write(hmd);
355 bsOut.Write(key);
357 uint8_t b = val ? 1 : 0;
358 bsOut.Write(b);
360 if (!GetRPC1()->Signal("SetBoolValue_1", &bsOut, GetSession()->GetConnectionAtIndex(0)))
361 {
362 return false;
363 }
365 return true;
366 }
368 bool NetClient::SetIntValue(VirtualHmdId hmd, const char* key, int val)
369 {
370 if (!IsConnected(true, true))
371 {
372 return false;
373 }
375 OVR::Net::BitStream bsOut;
376 bsOut.Write(hmd);
377 bsOut.Write(key);
379 int32_t w = (int32_t)val;
380 bsOut.Write(w);
382 if (!GetRPC1()->Signal("SetIntValue_1", &bsOut, GetSession()->GetConnectionAtIndex(0)))
383 {
384 return false;
385 }
387 return true;
388 }
390 bool NetClient::SetNumberValue(VirtualHmdId hmd, const char* key, double val)
391 {
392 if (!IsConnected(true, true))
393 {
394 return false;
395 }
397 OVR::Net::BitStream bsOut;
398 bsOut.Write(hmd);
399 bsOut.Write(key);
401 bsOut.Write(val);
403 if (!GetRPC1()->Signal("SetNumberValue_1", &bsOut, GetSession()->GetConnectionAtIndex(0)))
404 {
405 return false;
406 }
408 return true;
409 }
411 bool NetClient::SetNumberValues(VirtualHmdId hmd, const char* key, const double* vals, int num_vals)
412 {
413 if (!IsConnected(true, true))
414 {
415 return false;
416 }
418 OVR::Net::BitStream bsOut;
419 bsOut.Write(hmd);
420 bsOut.Write(key);
422 int32_t w_count = (int32_t)num_vals;
423 bsOut.Write(w_count);
425 for (int i = 0; i < num_vals; i++)
426 {
427 bsOut.Write(vals[i]);
428 }
430 if (!GetRPC1()->Signal("SetNumberValues_1", &bsOut, GetSession()->GetConnectionAtIndex(0)))
431 {
432 return false;
433 }
435 return true;
436 }
438 int NetClient::Hmd_Detect()
439 {
440 if (!IsConnected(true, false))
441 {
442 return 0;
443 }
445 // If using edge-triggered HMD counting,
446 if (EdgeTriggeredHMDCount)
447 {
448 // Return the last update from the server
449 return HMDCount;
450 }
452 // Otherwise: We need to ask the first time
454 OVR::Net::BitStream bsOut, returnData;
456 if (!GetRPC1()->CallBlocking("Hmd_Detect_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData))
457 {
458 return 0;
459 }
461 int32_t out = 0;
462 if (!returnData.Read(out))
463 {
464 OVR_ASSERT(false);
465 }
466 HMDCount = out;
467 EdgeTriggeredHMDCount = true;
468 return out;
469 }
471 bool NetClient::Hmd_Create(int index, HMDNetworkInfo* netInfo)
472 {
473 if (!IsConnected(true, true))
474 {
475 return false;
476 }
478 OVR::Net::BitStream bsOut, returnData;
480 int32_t w = (int32_t)index;
481 bsOut.Write(w);
483 // Need the Pid for driver mode
484 pid_t pid = GetCurrentProcessId();
485 bsOut.Write(pid);
487 if (!GetRPC1()->CallBlocking("Hmd_Create_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData))
488 {
489 return false;
490 }
492 return netInfo->Deserialize(&returnData);
493 }
495 bool NetClient::GetDriverMode(bool& driverInstalled, bool& compatMode, bool& hideDK1Mode)
496 {
497 if (!IsConnected(true, true))
498 {
499 return false;
500 }
502 OVR::Net::BitStream bsOut, returnData;
504 bsOut.Write(InvalidVirtualHmdId);
506 if (!GetRPC1()->CallBlocking("GetDriverMode_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData))
507 {
508 return false;
509 }
511 int32_t w_driverInstalled = 0;
512 int32_t w_compatMode = 0;
513 int32_t w_hideDK1Mode = 0;
514 returnData.Read(w_driverInstalled);
515 returnData.Read(w_compatMode);
516 if (!returnData.Read(w_hideDK1Mode))
517 {
518 return false;
519 }
521 driverInstalled = w_driverInstalled != 0;
522 compatMode = w_compatMode != 0;
523 hideDK1Mode = w_hideDK1Mode != 0;
524 return true;
525 }
527 bool NetClient::SetDriverMode(bool compatMode, bool hideDK1Mode)
528 {
529 if (!IsConnected(true, true))
530 {
531 return false;
532 }
534 OVR::Net::BitStream bsOut, returnData;
536 bsOut.Write(InvalidVirtualHmdId);
538 int32_t w_compatMode, w_hideDK1Mode;
539 w_compatMode = compatMode ? 1 : 0;
540 w_hideDK1Mode = hideDK1Mode ? 1 : 0;
541 bsOut.Write(w_compatMode);
542 bsOut.Write(w_hideDK1Mode);
544 if (!GetRPC1()->CallBlocking("SetDriverMode_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData))
545 {
546 return false;
547 }
549 int32_t out = 0;
550 if (!returnData.Read(out))
551 {
552 OVR_ASSERT(false);
553 return false;
554 }
556 return out != 0;
557 }
559 bool NetClient::Hmd_AttachToWindow(VirtualHmdId hmd, void* hWindow)
560 {
561 if (!IsConnected(false, false))
562 {
563 return false;
564 }
566 OVR::Net::BitStream bsOut;
567 bsOut.Write(hmd);
569 #ifdef OVR_OS_LINUX
570 if (hWindow == NULL)
571 {
572 return false;
573 }
574 unsigned long hWinWord = *(unsigned long *)hWindow;
575 #else
576 UInt64 hWinWord = (UPInt)hWindow;
577 #endif
578 bsOut.Write(hWinWord);
580 if (!GetRPC1()->CallBlocking("Hmd_AttachToWindow_1", &bsOut, GetSession()->GetConnectionAtIndex(0)))
581 {
582 return false;
583 }
585 return true;
586 }
588 void NetClient::Hmd_Release(VirtualHmdId hmd)
589 {
590 if (!IsConnected(false, false))
591 {
592 return;
593 }
595 OVR::Net::BitStream bsOut;
596 bsOut.Write(hmd);
597 bool result = GetRPC1()->CallBlocking("Hmd_Release_1", &bsOut, GetSession()->GetConnectionAtIndex(0));
598 OVR_ASSERT_AND_UNUSED(result, result);
599 }
601 void NetClient::SetLastError(String str)
602 {
603 Hmd_GetLastError_Str = str;
604 }
606 // Last string is cached locally.
607 const char* NetClient::Hmd_GetLastError(VirtualHmdId hmd)
608 {
609 if (hmd == InvalidVirtualHmdId || !IsConnected(false, false))
610 {
611 return Hmd_GetLastError_Str.ToCStr();
612 }
614 OVR::Net::BitStream bsOut, returnData;
615 bsOut.Write(hmd);
616 if (!GetRPC1()->CallBlocking("Hmd_GetLastError_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData))
617 {
618 return Hmd_GetLastError_Str.ToCStr();
619 }
620 if (!returnData.Read(Hmd_GetLastError_Str))
621 {
622 OVR_ASSERT(false);
623 }
624 return Hmd_GetLastError_Str.ToCStr();
625 }
628 // Fills in description about HMD; this is the same as filled in by ovrHmd_Create.
629 // The actual descriptor is a par
630 bool NetClient::Hmd_GetHmdInfo(VirtualHmdId hmd, HMDInfo* hmdInfo)
631 {
632 if (!IsConnected(false, false))
633 {
634 return false;
635 }
637 OVR::Net::BitStream bsOut, returnData;
638 bsOut.Write(hmd);
639 if (!GetRPC1()->CallBlocking("Hmd_GetHmdInfo_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData))
640 {
641 return false;
642 }
644 return NetSessionCommon::DeserializeHMDInfo(&returnData, hmdInfo);
645 }
648 //-------------------------------------------------------------------------------------
649 unsigned int NetClient::Hmd_GetEnabledCaps(VirtualHmdId hmd)
650 {
651 if (!IsConnected(false, false))
652 {
653 return 0;
654 }
656 OVR::Net::BitStream bsOut, returnData;
657 bsOut.Write(hmd);
658 if (!GetRPC1()->CallBlocking("Hmd_GetEnabledCaps_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData))
659 {
660 return 0;
661 }
663 uint32_t c = 0;
664 if (!returnData.Read(c))
665 {
666 OVR_ASSERT(false);
667 }
668 return c;
669 }
671 // Returns new caps after modification
672 unsigned int NetClient::Hmd_SetEnabledCaps(VirtualHmdId hmd, unsigned int hmdCaps)
673 {
674 if (!IsConnected(false, false))
675 {
676 return 0;
677 }
679 OVR::Net::BitStream bsOut, returnData;
680 bsOut.Write(hmd);
682 uint32_t c = (uint32_t)hmdCaps;
683 bsOut.Write(c);
685 if (!GetRPC1()->CallBlocking("Hmd_SetEnabledCaps_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData))
686 {
687 return 0;
688 }
690 c = 0;
691 if (!returnData.Read(c))
692 {
693 OVR_ASSERT(false);
694 }
695 return c;
696 }
699 //-------------------------------------------------------------------------------------
700 // *** Tracking Setup
702 bool NetClient::Hmd_ConfigureTracking(VirtualHmdId hmd, unsigned supportedCaps, unsigned requiredCaps)
703 {
704 if (!IsConnected(false, false))
705 {
706 return false;
707 }
709 OVR::Net::BitStream bsOut, returnData;
710 bsOut.Write(hmd);
712 uint32_t w_sc = supportedCaps;
713 bsOut.Write(w_sc);
714 uint32_t w_rc = requiredCaps;
715 bsOut.Write(w_rc);
717 if (!GetRPC1()->CallBlocking("Hmd_ConfigureTracking_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData))
718 {
719 return false;
720 }
722 uint8_t b;
723 if (!returnData.Read(b))
724 {
725 OVR_ASSERT(false);
726 }
728 return b != 0;
729 }
732 void NetClient::Hmd_ResetTracking(VirtualHmdId hmd)
733 {
734 if (!IsConnected(false, false))
735 {
736 return;
737 }
739 OVR::Net::BitStream bsOut;
740 bsOut.Write(hmd);
741 if (!GetRPC1()->CallBlocking("Hmd_ResetTracking_1", &bsOut, GetSession()->GetConnectionAtIndex(0)))
742 {
743 return;
744 }
745 }
747 bool NetClient::LatencyUtil_ProcessInputs(double startTestSeconds, unsigned char rgbColorOut[3])
748 {
749 if (!IsConnected(false, false))
750 {
751 return false;
752 }
754 if (!LatencyTesterAvailable)
755 {
756 return false;
757 }
759 OVR::Net::BitStream bsOut, returnData;
760 bsOut.Write(startTestSeconds);
761 if (!GetRPC1()->CallBlocking("LatencyUtil_ProcessInputs_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData))
762 {
763 return false;
764 }
766 uint8_t u;
767 returnData.Read(u);
768 rgbColorOut[0] = u;
769 returnData.Read(u);
770 rgbColorOut[1] = u;
771 if (!returnData.Read(u))
772 {
773 return false;
774 }
775 rgbColorOut[2] = u;
777 return true;
778 }
780 const char* NetClient::LatencyUtil_GetResultsString()
781 {
782 if (!IsConnected(false, false))
783 {
784 return NULL;
785 }
787 OVR::Net::BitStream bsOut, returnData;
788 if (!GetRPC1()->CallBlocking("LatencyUtil_GetResultsString_1", &bsOut, GetSession()->GetConnectionAtIndex(0), &returnData))
789 {
790 return NULL;
791 }
793 if (!returnData.Read(LatencyUtil_GetResultsString_Str))
794 {
795 OVR_ASSERT(false);
796 }
798 return LatencyUtil_GetResultsString_Str.ToCStr();
799 }
801 bool NetClient::ShutdownServer()
802 {
803 if (!IsConnected(false, false))
804 {
805 return false;
806 }
808 OVR::Net::BitStream bsOut;
809 GetRPC1()->BroadcastSignal("Shutdown_1", &bsOut);
811 return true;
812 }
815 //// Push Notifications:
817 void NetClient::registerRPC()
818 {
819 #define RPC_REGISTER_SLOT(observerScope, functionName) \
820 observerScope.SetHandler(OVR::Net::Plugins::RPCSlot::FromMember<NetClient, &NetClient::functionName>(this)); pRPC->RegisterSlot(OVR_STRINGIZE(functionName), observerScope);
822 // Register RPC functions:
823 RPC_REGISTER_SLOT(InitialServerStateScope, InitialServerState_1);
824 RPC_REGISTER_SLOT(LatencyTesterAvailableScope, LatencyTesterAvailable_1);
825 RPC_REGISTER_SLOT(DefaultLogOutputScope, DefaultLogOutput_1);
826 RPC_REGISTER_SLOT(HMDCountUpdateScope, HMDCountUpdate_1);
827 }
829 void NetClient::InitialServerState_1(BitStream* userData, ReceivePayload* pPayload)
830 {
831 LatencyTesterAvailable_1(userData, pPayload);
832 }
834 void NetClient::LatencyTesterAvailable_1(BitStream* userData, ReceivePayload* pPayload)
835 {
836 OVR_UNUSED(pPayload);
838 uint8_t b = 0;
839 if (!userData->Read(b))
840 {
841 OVR_ASSERT(false);
842 return;
843 }
845 LatencyTesterAvailable = (b != 0);
846 }
848 void NetClient::DefaultLogOutput_1(BitStream* userData, ReceivePayload* pPayload)
849 {
850 OVR_UNUSED(pPayload);
852 String formattedText;
853 LogMessageType messageType = Log_Text; // Will normally be overwritten below.
854 userData->Read(messageType);
855 if (userData->Read(formattedText))
856 {
857 if (OVR::Log::GetGlobalLog())
858 {
859 OVR::String logStr = "[From Service] ";
860 logStr.AppendString(formattedText);
861 OVR::Log::GetGlobalLog()->LogMessage(messageType, "%s", logStr.ToCStr());
862 }
863 }
864 }
866 void NetClient::HMDCountUpdate_1(BitStream* userData, ReceivePayload* pPayload)
867 {
868 OVR_UNUSED(pPayload);
870 int32_t hmdCount = 0;
871 if (!userData->Read(hmdCount))
872 {
873 OVR_ASSERT(false);
874 return;
875 }
877 HMDCount = hmdCount;
878 EdgeTriggeredHMDCount = true;
879 }
882 }} // namespace OVR::Service