35 #include <json/value.h> 
   48             template <
typename T> 
void processMessage(T &p) {
 
   55         const char *RoutesFromServer::identifier() {
 
   59         const char *AppStartupToServer::identifier() {
 
   60             return "com.osvr.system.appstartup";
 
   68             template <
typename T> 
void processMessage(T &p) {
 
   75         const char *ClientRouteToServer::identifier() {
 
   76             return "com.osvr.system.updateroutetoserver";
 
   84             template <
typename T> 
void processMessage(T &p) {
 
   88             Json::Value 
const &getValue()
 const { 
return m_msg; }
 
   93         const char *ReplacementTreeFromServer::identifier() {
 
   94             return "com.osvr.system.ReplacementTreeFromServer";
 
  107     SystemComponent::SystemComponent() {}
 
  109     void SystemComponent::sendRoutes(std::string 
const &routes) {
 
  111         messages::RoutesFromServer::MessageSerialization msg(routes);
 
  116     void SystemComponent::registerRoutesHandler(vrpn_MESSAGEHANDLER handler,
 
  121     void SystemComponent::sendClientRouteUpdate(std::string 
const &route) {
 
  123         messages::ClientRouteToServer::MessageSerialization msg(route);
 
  128     void SystemComponent::registerClientRouteUpdateHandler(
 
  129         vrpn_MESSAGEHANDLER handler, 
void *userdata) {
 
  133     void SystemComponent::sendReplacementTree(PathTree &tree) {
 
  136         messages::ReplacementTreeFromServer::MessageSerialization msg(config);
 
  143     void SystemComponent::registerReplaceTreeHandler(JsonHandler cb) {
 
  144         if (m_replaceTreeHandlers.empty()) {
 
  148         m_replaceTreeHandlers.push_back(cb);
 
  151     void SystemComponent::m_parentSet() {
 
  158     int SystemComponent::m_handleReplaceTree(
void *userdata,
 
  159                                              vrpn_HANDLERPARAM p) {
 
  160         auto self = 
static_cast<SystemComponent *
>(userdata);
 
  162         messages::ReplacementTreeFromServer::MessageSerialization msg;
 
  165         BOOST_ASSERT_MSG(msg.getValue().isArray(),
 
  166                          "replace tree message must be an array of nodes!");
 
  167         for (
auto const &cb : self->m_replaceTreeHandlers) {
 
  168             cb(msg.getValue(), timestamp);
 
void deserialize(BufferReaderType &reader, MessageClass &msg)
Deserializes a message from a buffer, using a MessageClass 
messages::ReplacementTreeFromServer treeOut
Message from server, updating/replacing the client's configuration. 
A tag for use when the only field in a message is a string so the length prefix is unnecessary...
void serialize(BufferType &buf, MessageClass &msg)
Serializes a message into a buffer, using a MessageClass 
const char * systemSender()
The sender type for system messages. 
const char * routingData()
Return the string identifying routing data messages. 
messages::AppStartupToServer appStartup
Message from client to server, notifying of app ID. 
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. 
messages::ClientRouteToServer routeIn
Message from client, sending a single new/updated JSON routing directive in to the server...
messages::RoutesFromServer routesOut
Message from server to client, replacing all routes. 
void sendPending()
Called from a component to send pending messages instead of waiting for next time. 
static shared_ptr< SystemComponent > create()
Factory method. 
Parent & m_getParent()
Gets the parent - only call if m_hasParent() is true. 
static const char * deviceName()
Get the special device name to be used with this component. 
Json::Value pathTreeToJson(PathTree const &tree, bool keepNulls=false)
Serialize a path tree to a JSON array of objects, one for each node. 
BaseDevice component, to be used only with the "OSVR" special device. 
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...
A tag for use when the only field in a message is JSON so the length prefix is unnecessary.