-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from OSVR/openvr106
Update plugin code to work with OpenVR SDK 1.0.6
- Loading branch information
Showing
35 changed files
with
1,752 additions
and
726 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** @file | ||
@brief Implementation | ||
@date 2017 | ||
@author | ||
Sensics, Inc. | ||
<http://sensics.com/osvr> | ||
*/ | ||
|
||
// Copyright 2017 Sensics, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// 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. | ||
|
||
// Internal Includes | ||
#include "DriverContext.h" | ||
|
||
// Library/third-party includes | ||
// - none | ||
|
||
// Standard includes | ||
// - none | ||
|
||
using namespace vr; | ||
|
||
DriverContext::DriverContext() | ||
: m_pServerDriverHost(nullptr), m_pVRProperties(nullptr), | ||
m_pVRSetting(nullptr), m_pVRDriverLog(nullptr) {} | ||
|
||
DriverContext::DriverContext(vr::ServerDriverHost *serverDriverHost, | ||
vr::Settings *settings, vr::DriverLog *driverLog, | ||
vr::Properties *properties) | ||
: m_pServerDriverHost(serverDriverHost), m_pVRProperties(properties), | ||
m_pVRSetting(settings), m_pVRDriverLog(driverLog) {} | ||
|
||
// only consider four type of interfaces | ||
void *DriverContext::GetGenericInterface(const char *pchInterfaceVersion, | ||
vr::EVRInitError *peError) { | ||
std::string interfaceVersion = pchInterfaceVersion; | ||
if (interfaceVersion.compare(IVRServerDriverHost_Version) == 0) { | ||
return m_pServerDriverHost; | ||
} else if (interfaceVersion.compare(IVRSettings_Version) == 0) { | ||
return m_pVRSetting; | ||
} else if (interfaceVersion.compare(IVRProperties_Version) == 0) { | ||
return m_pVRProperties; | ||
} else if (interfaceVersion.compare(IVRDriverLog_Version) == 0) { | ||
return m_pVRDriverLog; | ||
} else { | ||
std::string errMsg = "Got an unhandled interface type version - " + | ||
std::string(pchInterfaceVersion); | ||
m_pVRDriverLog->Log(errMsg.c_str()); | ||
return nullptr; | ||
} | ||
} | ||
|
||
// not sure which driver handle to return now | ||
vr::DriverHandle_t DriverContext::GetDriverHandle() { | ||
vr::DriverHandle_t dh = 1; | ||
return dh; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** @file | ||
@brief Header | ||
@date 2017 | ||
@author | ||
Sensics, Inc. | ||
<http://sensics.com/osvr> | ||
*/ | ||
|
||
// Copyright 2017 Sensics, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// 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. | ||
|
||
#ifndef INCLUDED_DriverContext_h_GUID_36B19EC5_76DE_49B4_5B1A_37B88E5E6C42 | ||
#define INCLUDED_DriverContext_h_GUID_36B19EC5_76DE_49B4_5B1A_37B88E5E6C42 | ||
|
||
// Internal | ||
#include "DriverLog.h" | ||
#include "Properties.h" | ||
#include "ServerDriverHost.h" | ||
#include "Settings.h" | ||
|
||
// Library/third-party includes | ||
#include <openvr_driver.h> | ||
|
||
// Standard includes | ||
#include <iostream> | ||
#include <memory> | ||
#include <string> | ||
#include <utility> | ||
|
||
namespace vr { | ||
class DriverContext : public vr::IVRDriverContext { | ||
public: | ||
DriverContext(); | ||
DriverContext(vr::ServerDriverHost *serverDriverHost, | ||
vr::Settings *settings, vr::DriverLog *driverLog, | ||
vr::Properties *properties); | ||
|
||
/// Returns the requested interface. If the interface was not available | ||
/// it will return NULL and fill out the error. | ||
virtual void *GetGenericInterface(const char *pchInterfaceVersion, | ||
vr::EVRInitError *peError = nullptr); | ||
|
||
/// Returns the property container handle for this driver | ||
virtual vr::DriverHandle_t GetDriverHandle(); | ||
|
||
private: | ||
vr::ServerDriverHost *m_pServerDriverHost; | ||
vr::IVRProperties *m_pVRProperties; | ||
vr::IVRSettings *m_pVRSetting; | ||
vr::IVRDriverLog *m_pVRDriverLog; | ||
}; | ||
|
||
} // namespace vr | ||
|
||
#endif // INCLUDED_DriverContext_h_GUID_36B19EC5_76DE_49B4_5B1A_37B88E5E6C42 |
Oops, something went wrong.