diff options
author | Sven Gothel <[email protected]> | 2015-03-28 01:43:35 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-03-28 01:43:35 +0100 |
commit | 4207f9c279e832e3afcb3f5fc6cd8d84cb4cfe4c (patch) | |
tree | cf3671058d55b47ab6cb6f36f369928606137628 /LibOVR/Src/Service/Service_NetSessionCommon.h | |
parent | c29cd1a2fbff6282bab956ad61661ac9d48c4e6e (diff) |
Bump OculusVR RIFT SDK to 0.5.0.1vanilla_0.5.0.1
Diffstat (limited to 'LibOVR/Src/Service/Service_NetSessionCommon.h')
-rwxr-xr-x[-rw-r--r--] | LibOVR/Src/Service/Service_NetSessionCommon.h | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/LibOVR/Src/Service/Service_NetSessionCommon.h b/LibOVR/Src/Service/Service_NetSessionCommon.h index 79c0cfb..eefc292 100644..100755 --- a/LibOVR/Src/Service/Service_NetSessionCommon.h +++ b/LibOVR/Src/Service/Service_NetSessionCommon.h @@ -27,11 +27,14 @@ limitations under the License. #ifndef OVR_Service_NetSessionCommon_h #define OVR_Service_NetSessionCommon_h -#include "../OVR_CAPI.h" -#include "../Net/OVR_RPC1.h" -#include "../Kernel/OVR_Threads.h" -#include "../Net/OVR_BitStream.h" -#include "../Kernel/OVR_System.h" +#include <atomic> + +#include "OVR_CAPI.h" +#include "Kernel/OVR_Threads.h" +#include "Kernel/OVR_System.h" +#include "Net/OVR_RPC1.h" +#include "Net/OVR_BitStream.h" + namespace OVR { @@ -52,6 +55,13 @@ static const int32_t InvalidVirtualHmdId = -1; // Localhost-bound TCP port that the service listens on for VR apps static const int VRServicePort = 30322; // 0x7672 = "vr" little-endian +// Stores the names of shared memory regions +struct SharedMemoryNames +{ + String Hmd; + String Camera; +}; + // HMDInfo section related to networking struct HMDNetworkInfo { @@ -63,19 +73,25 @@ struct HMDNetworkInfo // Network identifier for HMD VirtualHmdId NetId; - // Name of the shared memory object - String SharedMemoryName; + // Names of the shared memory objects + SharedMemoryNames SharedMemoryName; - void Serialize(Net::BitStream* bs) + bool Serialize(Net::BitStream* bs, bool write = true) { - bs->Write(NetId); - bs->Write(SharedMemoryName); - } - bool Deserialize(Net::BitStream* bs) - { - bs->Read(NetId); - return bs->Read(SharedMemoryName); + bs->Serialize(write, NetId); + bs->Serialize(write, SharedMemoryName.Hmd); + if (!bs->Serialize(write, SharedMemoryName.Camera)) + return false; + return true; } + + // Assignment operator + HMDNetworkInfo& operator=(HMDNetworkInfo const & rhs) + { + NetId = rhs.NetId; + SharedMemoryName = rhs.SharedMemoryName; + return *this; + } }; @@ -103,8 +119,7 @@ public: return pSession; } - static void SerializeHMDInfo(Net::BitStream* bitStream, HMDInfo* hmdInfo); - static bool DeserializeHMDInfo(Net::BitStream* bitStream, HMDInfo* hmdInfo); + static bool SerializeHMDInfo(Net::BitStream* bitStream, HMDInfo* hmdInfo, bool write = true); public: // Getter/setter tools @@ -131,9 +146,9 @@ public: static bool IsServiceProperty(EGetterSetters e, const char* key); protected: - bool Terminated; // Thread termination flag + std::atomic<bool> Terminated; // Thread termination flag Net::Session* pSession; // Networking session - Net::Plugins::RPC1* pRPC; // Remote procedure calls object + Net::Plugins::RPC1* pRPC; // Remote procedure calls object }; |