No momento, esta página não está disponível em português
Point-of-sale icon

Implement callbacks

About this task

In the C Library integration, you will implement most callbacks based on a defined signature. 

This includes:

  • initialization_CB
  • library_shutdown_CB
  • register_pos_CB
  • register_ped_CB
  • create_new_tender_CB
  • library_exception_CB
  • cancel_or_refund_CB
  • show_screen_CB
  • tx_store_CB

We have defined a signature for each callback. The signature we provide looks like:

void initialization_CB(void * result, void * echo_pointer);

You will need to implement callback functions with the same signature. 

The process differs for callbacks that are added to the  register_device_request structure and passed with the register_ped call.  For these callbacks, see .

Steps

To use these callbacks:

  1. Implement the callback with the same signature. In the following example we will implement the intitialization_CB callback.

    void initialization_CB(void * result, void * echo_struct){
    
        app_context_t * sPOS = (app_context_t *)echo_struct;
    
        sPOS->pending_callback = 0;      //mark handled
    
    }
  2. Pass intitialization_CB as a parameter of the init_library call.

    ADYLibraryResult result = init_library(initReq, initialization_CB, sPOS);