OSVR-Core
AsyncDeviceToken.h
Go to the documentation of this file.
1 
11 // Copyright 2014 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
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.
24 
25 #ifndef INCLUDED_AsyncDeviceToken_h_GUID_654218B0_3900_4B89_E86F_D314EB6C0ABF
26 #define INCLUDED_AsyncDeviceToken_h_GUID_654218B0_3900_4B89_E86F_D314EB6C0ABF
27 
28 // Internal Includes
31 #include "AsyncAccessControl.h"
32 
33 // Library/third-party includes
34 #include <boost/thread.hpp>
36 
37 // Standard includes
38 #include <string>
39 
40 namespace osvr {
41 namespace connection {
43  public:
44  AsyncDeviceToken(std::string const &name);
45  virtual ~AsyncDeviceToken();
46 
47  void signalShutdown();
48  void signalAndWaitForShutdown();
49 
50  private:
54  void m_setUpdateCallback(DeviceUpdateCallback const &cb) override;
57  void m_sendData(util::time::TimeValue const &timestamp,
58  MessageType *type, const char *bytestream,
59  size_t len) override;
60  util::GuardPtr m_getSendGuard() override;
61 
64  void m_connectionInteract() override;
65 
66  void m_stopThreads() override;
67 
68  void m_ensureThreadStarted();
69  DeviceUpdateCallback m_cb;
70  unique_ptr<boost::thread> m_callbackThread;
71 
72  AsyncAccessControl m_accessControl;
73 
75  };
76 } // namespace connection
77 } // namespace osvr
78 
79 #endif // INCLUDED_AsyncDeviceToken_h_GUID_654218B0_3900_4B89_E86F_D314EB6C0ABF
Definition: AsyncDeviceToken.h:42
A DeviceToken connects the generic device interaction code in PluginKit&#39;s C API with the workings of ...
Definition: DeviceToken.h:56
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
Header providing a templated functor wrapping the holding and calling of function pointer and userdat...
Base class for connection-specific message type registration.
Definition: MessageType.h:38
Internal class handling the synchronization of an asynchronous thread wishing to communicate that has...
Definition: AsyncAccessControl.h:45
Definition: RunLoopManagerBoost.h:44
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Definition: TimeValueC.h:81