OSVR-Core
SkeletonRemoteFactory.h
Go to the documentation of this file.
1 
11 // Copyright 2015 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_SkeletonRemoteFactory_h_GUID_FFA967D3_4A04_44AF_841E_BF0866185E22
26 #define INCLUDED_SkeletonRemoteFactory_h_GUID_FFA967D3_4A04_44AF_841E_BF0866185E22
27 
28 // Internal Includes
29 #include "RemoteHandlerInternals.h"
31 #include <osvr/Client/Export.h>
33 #include <osvr/Client/Skeleton.h>
38 #include <osvr/Util/SharedPtr.h>
39 
40 // Library/third-party includes
41 #include <json/value.h>
42 
43 // Standard includes
44 #include <memory>
45 #include <string>
46 
47 namespace osvr {
48 namespace client {
49 
51  public:
52  SkeletonRemoteHandler(vrpn_ConnectionPtr const &conn,
53  std::string const &deviceName,
54  boost::optional<OSVR_ChannelCount> sensor,
55  common::InterfaceList &ifaces,
57 
60  operator=(SkeletonRemoteHandler const &) = delete;
61 
64  }
65 
66  virtual void update() { m_dev->update(); }
67 
68  private:
69  void m_handleSkeleton(common::SkeletonNotification const &data,
70  util::time::TimeValue const &timestamp);
71  void m_handleSkeletonSpec(common::SkeletonSpec const &data,
72  util::time::TimeValue const &timestamp);
73 
74  common::BaseDevicePtr m_dev;
75  common::ClientContext *m_ctx;
76  common::SkeletonComponent *m_skeleton;
77  RemoteHandlerInternals m_internals;
78  boost::optional<OSVR_ChannelCount> m_sensor;
79  std::string m_deviceName;
80  std::unique_ptr<OSVR_SkeletonObject> m_skeletonConf;
81  Json::Value m_articulationSpec;
82  };
83 
85  public:
87 
88  template <typename T> void registerWith(T &factory) const {
89  factory.addFactory("skeleton", *this);
90  }
91 
92  shared_ptr<RemoteHandler>
93  operator()(common::OriginalSource const &source,
94  common::InterfaceList &ifaces, common::ClientContext &ctx);
95 
96  private:
98  };
99 
100 } // namespace client
101 } // namespace osvr
102 
103 #endif // INCLUDED_SkeletonRemoteFactory_h_GUID_FFA967D3_4A04_44AF_841E_BF0866185E22
The result of resolving a tree node to a device: either an original source to connect to...
Definition: OriginalSource.h:47
Definition: SkeletonRemoteFactory.h:84
Definition: SkeletonComponent.h:48
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
Header to bring shared_ptr into the osvr namespace.
SkeletonRemoteHandler & operator=(SkeletonRemoteHandler const &)=delete
Deleted assignment operator.
Definition: SkeletonRemoteFactory.h:50
virtual ~SkeletonRemoteHandler()
Definition: SkeletonRemoteFactory.h:62
BaseDevice component.
Definition: SkeletonComponent.h:74
Definition: ClientContext.h:50
Definition: VRPNConnectionCollection.h:42
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Definition: TimeValueC.h:81
Base class for remote device handler classes.
Definition: RemoteHandler.h:40
Class holding shared implementation between the various handlers.
Definition: RemoteHandlerInternals.h:44
Header.
Definition: SkeletonComponent.h:52