Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions include/psmove.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,9 @@ typedef struct _PSMove_3AxisTransform PSMove_3AxisTransform;

/*! Library version number */
enum PSMove_Version {
/**
* Version format: AA.BB.CC = 0xAABBCC
*
* Examples:
* 3.0.1 = 0x030001
* 4.2.11 = 0x04020B
**/
PSMOVE_CURRENT_VERSION = 0x030001, /*!< Current version, see psmove_init() */
PSMOVE_CURRENT_VERSION = (PSMOVEAPI_VERSION_MAJOR << 16) |
(PSMOVEAPI_VERSION_MINOR << 8) |
(PSMOVEAPI_VERSION_PATCH << 0)
};

/**
Expand Down
5 changes: 5 additions & 0 deletions include/psmove_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@

#cmakedefine PSMOVE_BUILD_TRACKER
#cmakedefine PSMOVE_USE_PSEYE

/* Version information */
#define PSMOVEAPI_VERSION_MAJOR @PSMOVEAPI_VERSION_MAJOR@
#define PSMOVEAPI_VERSION_MINOR @PSMOVEAPI_VERSION_MINOR@
#define PSMOVEAPI_VERSION_PATCH @PSMOVEAPI_VERSION_PATCH@
13 changes: 6 additions & 7 deletions src/psmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,13 @@ psmove_get_half_frame(PSMove *move, enum PSMove_Sensor sensor,
enum PSMove_Bool
psmove_init(enum PSMove_Version version)
{
/**
* You could do initialization here. Be sure to always check
* if initialization has already been carried out, as this
* might be called multiple times, even after succeeding once.
**/
// Compile-time version of the library is PSMOVE_CURRENT_VERSION
// Compile-time version of the user code is the value of "version"

/* For now, assume future versions will be backwards-compatible */
if (version >= PSMOVE_CURRENT_VERSION) {
// The requested version must be equal or less than the version implemented,
// but it's okay if the requested version is less than the implemented version,
// as we (try to) be backwards compatible with older API users
if (version <= PSMOVE_CURRENT_VERSION) {
return PSMove_True;
} else {
return PSMove_False;
Expand Down