-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclienttest.cpp
More file actions
97 lines (74 loc) · 2.34 KB
/
Copy pathclienttest.cpp
File metadata and controls
97 lines (74 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*=========================================================
//
// File: ClientTest.cpp
//
// Created by Ned Phipps, Oct-2004
//
=============================================================================*/
#include <string.h>
#include <stdio.h>
#include <iostream>
#include <unistd.h>
#include <vector>
#include "cortex.h"
using namespace std;
void MyErrorMsgHandler(int iLevel, const char *szMsg)
{
const char *szLevel = NULL;
if (iLevel == VL_Debug) {
szLevel = "Debug";
} else if (iLevel == VL_Info) {
szLevel = "Info";
} else if (iLevel == VL_Warning) {
szLevel = "Warning";
} else if (iLevel == VL_Error) {
szLevel = "Error";
}
printf(" %s: %s\n", szLevel, szMsg);
}
int main()
{
sBodyDefs* pBodyDefs = NULL;
sFrameOfData* FrameofData = NULL;
sBodyDef* pBody{NULL};
std::vector<int> bodyMarkers;
int nBytes;
void *pResponse;
int retval = RC_Okay;
Cortex_SetVerbosityLevel(VL_Info);
Cortex_SetErrorMsgHandlerFunc(MyErrorMsgHandler);
retval = Cortex_Initialize("10.1.1.200", "10.1.1.190");
if (retval != RC_Okay)
{
printf("Error: Unable to initialize ethernet communication\n");
retval = Cortex_Exit();
return 1;
}
// cortex frame rate //
printf("\n****** Cortex_FrameRate ******\n");
retval = Cortex_Request("GetContextFrameRate", &pResponse, &nBytes);
if (retval != RC_Okay)
printf("ERROR, GetContextFrameRate\n");
float *contextFrameRate = (float*) pResponse;
printf("ContextFrameRate = %3.1f Hz\n", *contextFrameRate);
printf("\n****** Cortex_GetBodyDefs ******\n");
pBodyDefs = Cortex_GetBodyDefs();
if (pBodyDefs == NULL)
{ printf("Failed to get body defs\n"); }
else
{
int totalBodies = pBodyDefs->nBodyDefs;
cout << "total no of bodies tracked " << totalBodies << endl;
for(int iBody=0; iBody<totalBodies; iBody++)
{
bodyMarkers.push_back(pBodyDefs->BodyDefs[iBody].nMarkers);
pBody = &pBodyDefs->BodyDefs[iBody];
cout << "number of markers defined in body " << iBody+1 << " (\"" << pBody->szName << "\") : " << bodyMarkers.at(iBody) << endl;
for (int iMarker=0 ; iMarker<pBody->nMarkers; iMarker++)
{ cout << iMarker << " " << pBody->szMarkerNames[iMarker] << endl; }
}
}
printf("\n*** start live mode ***\n");
Cortex_Request("LiveMode", &pResponse, &nBytes);
return 0;
}