Aw instance callback set
Jump to navigation
Jump to search
Minimum requirements | ||
---|---|---|
Added in version 4.1 |
int aw_instance_callback_set (AW_CALLBACK c, void (*callback) (int rc))
Description
Establishes a callback handler for an asynchronous call for the current instance.
Callback
None (returns immediately)
Arguments
- c
- Callback (defined in Aw.h)
- callback
- Pointer to the callback handler. Setting it to NULL deactivates the callback.
Argument attributes
None
Return values
- RC_SUCCESS
- RC_NOT_INITIALIZED
- RC_NO_INSTANCE
- RC_INVALID_ATTRIBUTE
- Not a callback.
Returned attributes
None
Usage
void handle_citizen_result (int rc) { if (rc != RC_SUCCESS) printf ("Citizen manipulation failed (reason %d)\n", rc); else puts ("Citizen manipulation succeeded"); } void change_homepage (int citizen, char *url) { int rc; rc = aw_citizen_attributes_by_number (citizen); if (rc != RC_SUCCESS) printf ("Citizen #%d query failed (reason %d)\n", citizen, rc); else { aw_instance_callback_set (AW_CALLBACK_CITIZEN_RESULT, handle_citizen_result); aw_string_set (AW_CITIZEN_URL, url); aw_citizen_change (); } }