Vp callback set: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m Can never fail |
||
Line 5: | Line 5: | ||
{{sdk parameter row|VPCallbackHandler|callback |Callback handler}} | {{sdk parameter row|VPCallbackHandler|callback |Callback handler}} | ||
|returncodes= | |returncodes= | ||
|behavior= | |behavior= | ||
|caveats= | |caveats= | ||
Line 23: | Line 22: | ||
vp_callback_set(sdk, VP_CALLBACK_LOGIN); | vp_callback_set(sdk, VP_CALLBACK_LOGIN); | ||
if (rc = | if (rc = vp_login(sdk, Username, Password, Botname)) | ||
{ | { | ||
printf("Couldn't login (reason %d)", rc); | printf("Couldn't login (reason %d)", rc); |
Revision as of 16:14, 12 December 2016
Method call snippet
vp_callback_set(instance, callbackname, callback);
Sets handler for a specific callback.
Parameters
These are the parameters that this method requires:
Parameter | Usage |
---|---|
VPInstance instance |
Pointer to the instance this method call is intended for |
vp_callback_t callbackname |
Callback to set handler for |
VPCallbackHandler callback |
Callback handler |
Returns
This method returns a return code integer, which indicates whether the call was successful or errored for any reason:
Return code | Cause |
---|---|
VP_RC_SUCCESS |
Successful call (for methods that have a registered callback, it only means the request has been sent) |
Behavior
- There is no special behavior for this method
Examples
void handle_login(VPInstance sdk, int rc, int ref)
{
if (rc)
printf("Error logging into universe (reason %d)\n", rc);
}
int main(int argc, const char* argv[])
{
//...
vp_callback_set(sdk, VP_CALLBACK_LOGIN);
if (rc = vp_login(sdk, Username, Password, Botname))
{
printf("Couldn't login (reason %d)", rc);
return 1;
}
//...
}