{"title":"Handle the PED State Change callback","category":"default","creationDate":1776961627,"content":"<h2 id=\"implement-the-ped-state-change-callback\">Implement the\u00a0PED State Change\u00a0callback<\/h2>\n<p>Implement the\u00a0<code>ped_state_change_CB<\/code>\u00a0callback and assign to the function pointer <code>device_state_update_CB<\/code>.\u00a0For more information on how to do this, see\u00a0<a href=\"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/calls-and-callbacks-c-library\/implement-callbacks-with-register_device_request\">Implement callbacks with register_device_request<\/a>.<\/p>\n<h3 id=\"code-example\">Code example<\/h3>\n<p>The declaration of the PED State Change callback is:<\/p>\n<pre><code class=\"language-cpp\">void ped_state_change_CB(void * ped_dev, ped_device_info *, void * echo_struct);<\/code><\/pre>\n<h2 id=\"invoke\">Invoke<\/h2>\n<p>This is invoked automatically by a change in PED state.<\/p>\n<h2 id=\"handle-the-ped-state-change-callback\">Handle the PED State Change callback<\/h2>\n<p>The\u00a0<code>ped_state_change_CB<\/code>\u00a0callback is returned\u00a0when the PED state is changed and allows you to process this change, if it is required by the business logic of your application.\u00a0Create this function and assign to the function pointer\u00a0 <code>device_state_update_CB<\/code>.<\/p>\n<h3 id=\"parameters\">Parameters<\/h3>\n<table>\n<thead>\n<tr>\n<th>Field<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>ped_dev<\/code><\/td>\n<td>Pointer to an internal PED object. This parameter is for internal use only, instead use <code>terminal_id<\/code> to get access to the PED.<\/td>\n<\/tr>\n<tr>\n<td><code>ped_device_info<\/code><\/td>\n<td>Pointer to the <code>ped_device_info<\/code> struct in the POS. Use this parameter to get information about the current PED state.<\/td>\n<\/tr>\n<tr>\n<td><code>echo_struct<\/code><\/td>\n<td>Pointer to a POS defined struct. Returned in the callback. Use this parameter to share a POS data struct between the call to the library and the associated callback from the library.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"ped-states\">PED States<\/h2>\n<table style=\"width:100%;\"><colgroup><col style=\"width: 25%\"><col style=\"width: 74%\"><\/colgroup><thead><tr class=\"header\"><th>State<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>ped_state_undetected<\/code><\/td><td>Incorrect IP, cannot detect the PED. This is a final state.<\/td><\/tr><tr><td><code>ped_state_detected<\/code><\/td><td>PED detected, correct serial\/IP address.<\/td><\/tr><tr><td><code>ped_state_identified<\/code><\/td><td>Valid PED.<\/td><\/tr><tr><td><code>ped_state_registered<\/code><\/td><td>PED is registered, final result on RegisterPED.<\/td><\/tr><tr><td><code>ped_state_config_synced<\/code><\/td><td>PED is has synchronized its configuration.<\/td><\/tr><tr><td><code>ped_state_wait_reboot_ready<\/code><\/td><td>PED is rebooting.<\/td><\/tr><tr><td><code>ped_state_wait_ready_for_transaction<\/code><\/td><td>PED must complete another process before it is ready to create a transaction.<\/td><\/tr><tr><td><code>ped_state_not_ready<\/code><\/td><td>PED is busy. This is a final state.\u00a0<\/td><\/tr><tr><td><code>ped_state_ready_for_transaction<\/code><\/td><td>PED is ready for transaction.<\/td><\/tr><tr><td><code>ped_state_tender<\/code><\/td><td>PED is busy with a tender.<\/td><\/tr><\/tbody><\/table>","url":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/process-a-basic-transaction-c-library\/handle-the-ped-state-change-callback-c-library","articleFields":{"id":"31500551","type":"page","_expandable":{"operations":""},"status":"current"},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/process-a-basic-transaction-c-library\/handle-the-ped-state-change-callback-c-library","title":"Handle the PED State Change callback","content":"Implement the\u00a0PED State Change\u00a0callback\nImplement the\u00a0ped_state_change_CB\u00a0callback and assign to the function pointer device_state_update_CB.\u00a0For more information on how to do this, see\u00a0Implement callbacks with register_device_request.\nCode example\nThe declaration of the PED State Change callback is:\nvoid ped_state_change_CB(void * ped_dev, ped_device_info *, void * echo_struct);\nInvoke\nThis is invoked automatically by a change in PED state.\nHandle the PED State Change callback\nThe\u00a0ped_state_change_CB\u00a0callback is returned\u00a0when the PED state is changed and allows you to process this change, if it is required by the business logic of your application.\u00a0Create this function and assign to the function pointer\u00a0 device_state_update_CB.\nParameters\n\n\n\nField\nDescription\n\n\n\n\nped_dev\nPointer to an internal PED object. This parameter is for internal use only, instead use terminal_id to get access to the PED.\n\n\nped_device_info\nPointer to the ped_device_info struct in the POS. Use this parameter to get information about the current PED state.\n\n\necho_struct\nPointer to a POS defined struct. Returned in the callback. Use this parameter to share a POS data struct between the call to the library and the associated callback from the library.\n\n\n\nPED States\nStateDescriptionped_state_undetectedIncorrect IP, cannot detect the PED. This is a final state.ped_state_detectedPED detected, correct serial\/IP address.ped_state_identifiedValid PED.ped_state_registeredPED is registered, final result on RegisterPED.ped_state_config_syncedPED is has synchronized its configuration.ped_state_wait_reboot_readyPED is rebooting.ped_state_wait_ready_for_transactionPED must complete another process before it is ready to create a transaction.ped_state_not_readyPED is busy. This is a final state.\u00a0ped_state_ready_for_transactionPED is ready for transaction.ped_state_tenderPED is busy with a tender.","type":"page","locale":"pt","boost":13,"hierarchy":{"lvl0":"Home","lvl1":"Terminais","lvl2":"Deprecation of classic libraries","lvl3":"Library integrations","lvl4":"C library integration","lvl5":"Key steps","lvl6":"Process a basic transaction","lvl7":"Handle the PED State Change callback"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/pt","lvl1":"https:\/\/docs.adyen.com\/pt\/point-of-sale","lvl2":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation","lvl3":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations","lvl4":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration","lvl5":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library","lvl6":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/process-a-basic-transaction-c-library","lvl7":"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/process-a-basic-transaction-c-library\/handle-the-ped-state-change-callback-c-library"},"levels":8,"category":"In-person payments","category_color":"green","tags":["Handle","State","Change","callback"]}}
