Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

Commit

Permalink
Unify tracker, controller and HMD limit variables
Browse files Browse the repository at this point in the history
The limits were independently defined for the server and client. They are
now defined in one location (PSMoveProtocolInterface.h).
  • Loading branch information
zelmon64 committed Aug 7, 2017
1 parent b870d2e commit 6d877c9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
12 changes: 3 additions & 9 deletions src/psmoveclient/ClientConstants.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#ifndef CLIENT_CONSTANTS_H
#define CLIENT_CONSTANTS_H

//-- includes -----
#include "../psmoveprotocol/PSMoveProtocolInterface.h"

/**
\addtogroup PSMoveClient_CAPI
@{
Expand All @@ -11,15 +14,6 @@
#define PSMOVESERVICE_DEFAULT_PORT "9512"
#define PSM_DEFAULT_TIMEOUT 1000 // milliseconds

// See ControllerManager.h in PSMoveService
#define PSMOVESERVICE_MAX_CONTROLLER_COUNT 5

// See TrackerManager.h in PSMoveService
#define PSMOVESERVICE_MAX_TRACKER_COUNT 8

// See HMDManager.h in PSMoveService
#define PSMOVESERVICE_MAX_HMD_COUNT 4

// The length of a controller serial string: "xx:xx:xx:xx:xx:xx\0"
#define PSMOVESERVICE_CONTROLLER_SERIAL_LEN 18

Expand Down
9 changes: 9 additions & 0 deletions src/psmoveprotocol/PSMoveProtocolInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
//-- constants -----
#define MAX_OUTPUT_DATA_FRAME_MESSAGE_SIZE 500
#define MAX_INPUT_DATA_FRAME_MESSAGE_SIZE 64

// See ControllerManager.h in PSMoveService
#define PSMOVESERVICE_MAX_CONTROLLER_COUNT 5

// See TrackerManager.h in PSMoveService
#define PSMOVESERVICE_MAX_TRACKER_COUNT 8

// See HMDManager.h in PSMoveService
#define PSMOVESERVICE_MAX_HMD_COUNT 4

//-- pre-declarations -----
namespace PSMoveProtocol
Expand Down
2 changes: 1 addition & 1 deletion src/psmoveservice/Device/Manager/ControllerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ControllerManager : public DeviceTypeManager
return cfg;
}

static const int k_max_devices = 5;
static const int k_max_devices = PSMOVESERVICE_MAX_CONTROLLER_COUNT;
int getMaxDevices() const override
{
return ControllerManager::k_max_devices;
Expand Down
1 change: 1 addition & 0 deletions src/psmoveservice/Device/Manager/DeviceTypeManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

//-- includes -----
#include "DevicePlatformInterface.h"
#include "PSMoveProtocolInterface.h"

#include <memory>
#include <chrono>
Expand Down
2 changes: 1 addition & 1 deletion src/psmoveservice/Device/Manager/HMDManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class HMDManager : public DeviceTypeManager

void updateStateAndPredict(TrackerManager* tracker_manager);

static const int k_max_devices = 4;
static const int k_max_devices = PSMOVESERVICE_MAX_HMD_COUNT;
int getMaxDevices() const override
{
return HMDManager::k_max_devices;
Expand Down
2 changes: 1 addition & 1 deletion src/psmoveservice/Device/Manager/TrackerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class TrackerManager : public DeviceTypeManager

void closeAllTrackers();

static const int k_max_devices = 4;
static const int k_max_devices = PSMOVESERVICE_MAX_TRACKER_COUNT;
int getMaxDevices() const override
{
return TrackerManager::k_max_devices;
Expand Down

0 comments on commit 6d877c9

Please sign in to comment.