CheckResult/TT_GetResultString

Post Reply
Asa_E-E
Posts: 16
Joined: Mon Jun 25, 2012 8:01 am

CheckResult/TT_GetResultString

Post by Asa_E-E » Thu Jul 26, 2012 10:54 am

I am working on interfacing with the Tracking Tools 2.5 API in Python using Cython. The only debugging function that appears to be available in the API is CheckResult. However, CheckResult is not defined in either header file (NPTrackingTools.h or trackablesettings.h). In order for me to be able to call CheckResult in Cython, it needs to be in the header file. What do I need to add to the header file to define CheckResult?

Alternatively, if anyone has experience with the Tracking Tools API and Cython (or other python wrappers) and has other suggestions about getting debug information, that would be great as well.

EDIT: After digging around a bit, the only definition for CheckResult was in the markers sample, which calls TT_GetResultString. I am able to successfully wrap TT_GetResultString except apparently for the input of 0. If I enter 0, TT_GetResultString return 'unknown' instead of 'success'.

When I run TT_Initialize(), it returns 0. At this point, I am unsure if 0 means success (it does not appear to) or is some random error. Any help would be much appreciated.

EDIT2: I am able to run things fine for now so I am not in dire need of debugging capabilities right now, but I am still curious as to why TT_GetResultString(0) = 'unknown.'

beckdo
NaturalPoint Employee
NaturalPoint Employee
Posts: 520
Joined: Tue Jan 02, 2007 2:02 pm

Re: CheckResult/TT_GetResultString

Post by beckdo » Fri Jul 27, 2012 10:35 am

CheckResult is defined in the demo app, as you've found. I'm including it here for completeness.

Code: Select all

void CheckResult(NPRESULT result)   //== CheckResult function will display errors                 
{
    if(result==NPRESULT_SUCCESS)    //== If there is no error, do nothing ============---
        return;

    printf("Error: %s\n\n(Press any key to continue)\n",TT_GetResultString(result));
}
If the returned value is non-zero, you have an error condition. The error conditions are listed in NPTrackingTools.h.

I think the confusion is that there isn't a return string for the result code of 0. That means 'success'. I should probably get that included.

Post Reply