Jump to content
Happy Holidays! Limited Staff Responses: 1/20 - 1/31 ×

Register Eye Data Callback


Recommended Posts

Hi,

I am using SRAnipal SDK in C. In SRAnipal_Eye.h, I see that some APIs (pasted below) are declared to register callbacks. Can anyone help me by providing an example of using this callback? 

/* Register a callback function to receive eye camera related data when the module has new outputs.
                [in] function pointer of callback
                [out] error code. please refer Error in ViveSR_Enums.h
                */
                SR_ANIPAL int RegisterEyeDataCallback(VivesrEyeDataCallback callback);

                /* Unegister a callback function to stop receiving eye camera related data.
                [in] function pointer of callback
                [out] error code. please refer Error in ViveSR_Enums.h
                */
                SR_ANIPAL int UnregisterEyeDataCallback(VivesrEyeDataCallback callback);


Many Thanks,
Nitesh

@Corvus @Daniel_Y

Link to comment
Share on other sites

It may look looks like code snippet below.

 

void callback(ViveSR::anipal::Eye::EyeData const &eye_data)
{
    float const *gaze = eye_data.verbose_data.left.gaze_direction_normalized.elem_;
    printf("[Eye] Gaze: %.2f %.2f %.2f\n", gaze[0], gaze[1], gaze[2]);
}

int main() {

.......

                int ret = RegisterEyeDataCallback( callback);

                while (looping)
                    dosomething();

.......

}

 

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...