46 : m_naviVelState(state), m_sensor(sensor) {}
50 template <
typename T>
void processMessage(T &p) {
56 ret.sensor = m_sensor;
57 ret.naviVelState = m_naviVelState;
65 const char *NaviVelocityRecord::identifier() {
66 return "com.osvr.locomotion.navivelocityrecord";
73 : m_naviPosnState(state), m_sensor(sensor) {}
77 template <
typename T>
void processMessage(T &p) {
83 ret.sensor = m_sensor;
84 ret.naviPosnState = m_naviPosnState;
92 const char *NaviPositionRecord::identifier() {
93 return "com.osvr.locomotion.navipositionrecord";
103 LocomotionComponent::LocomotionComponent() {}
105 void LocomotionComponent::sendNaviVelocityData(
111 messages::NaviVelocityRecord::MessageSerialization msg(
112 naviVelocityState, sensor);
119 void LocomotionComponent::sendNaviPositionData(
125 messages::NaviPositionRecord::MessageSerialization msg(
126 naviPositionState, sensor);
134 LocomotionComponent::m_handleNaviVelocityRecord(
void *userdata,
135 vrpn_HANDLERPARAM p) {
136 auto self =
static_cast<LocomotionComponent *
>(userdata);
139 messages::NaviVelocityRecord::MessageSerialization msg;
141 auto data = msg.getData();
144 for (
auto const &cb : self->m_cb_vel) {
151 LocomotionComponent::m_handleNaviPositionRecord(
void *userdata,
152 vrpn_HANDLERPARAM p) {
153 auto self =
static_cast<LocomotionComponent *
>(userdata);
156 messages::NaviPositionRecord::MessageSerialization msg;
158 auto data = msg.getData();
161 for (
auto const &cb : self->m_cb_posn) {
167 void LocomotionComponent::registerNaviVelocityHandler(
168 NaviVelocityHandler handler) {
169 if (m_cb_vel.empty()) {
173 m_cb_vel.push_back(handler);
175 void LocomotionComponent::registerNaviPositionHandler(
176 NaviPositionHandler handler) {
177 if (m_cb_posn.empty()) {
181 m_cb_posn.push_back(handler);
184 void LocomotionComponent::m_parentSet() {
uint32_t OSVR_ChannelCount
The integer type specifying a number of channels/sensors or a channel/sensor index.
messages::NaviVelocityRecord naviVelRecord
Message from server to client, containing navigation velocity.
void deserialize(BufferReaderType &reader, MessageClass &msg)
Deserializes a message from a buffer, using a MessageClass
void serialize(BufferType &buf, MessageClass &msg)
Serializes a message into a buffer, using a MessageClass
void m_registerHandler(vrpn_MESSAGEHANDLER handler, void *userdata, RawMessageType const &msgType)
Registers a handler whose lifetime is tied to the lifetime of the component.
void fromStructTimeval(TimeValue &dest, struct timeval const &src)
Convert a struct timeval to a TimeValue.
static shared_ptr< LocomotionComponent > create()
Factory method.
A structure defining a 2D vector, which represents position.
Parent & m_getParent()
Gets the parent - only call if m_hasParent() is true.
Internal, configured header file for verbosity macros.
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Header defining buffer types, with optional alignment dependent on Boost version. ...
BufferReader< ExternalBufferReadingWrapper< CharType > > readExternalBuffer(const CharType *buf, size_t len)
Constructs and returns a buffer reader for an externally-allocated buffer: it's on you to supply a va...
void registerMessageType(MessageRegistration< T > &messageReg)
Call with a MessageRegistration object, and the message type will be registered and stored in the typ...
messages::NaviPositionRecord naviPosnRecord
Optional message from server to client, containing navigation position.