Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Callback function to get the value of region variable in Tizen?

I want to write a native application in c to get the value of region in Tizen. The compiled c code must be run on the Tizen phone and I need to get the Value of language region. The callback function i got from Tizen source is

int app_cb_broker_appcore_region_changed(void *data)
{
    app_region_format_changed_cb region_changed_cb;

    region_changed_cb = app_context.callbacks->region_format_changed;

    if (region_changed_cb != NULL)
    {
            region_changed_cb(app_context.user_data);
    }

    return 0;
}

How to use this function to get the value of current region?

like image 820
Ajay Soman Avatar asked Aug 21 '12 05:08

Ajay Soman


1 Answers

I am not familiar with Tizen, but as far as I can see in the code, there is a struct variable (app_context) that has an attribute (callbacks) which should be a pointer to a struct of callback function pointers. One of those function pointers is region_format_changed. So you should define your function and pass it to that pointer so that it gets called (back) and you can handle the parameters which is passed (app_context.user_data).

For example.

Step 1. You define and write your callback function

void my_region_changed_cb(typeof(app_context.user_data) data)
{
     //The code of your handler here
}

Step 2. Somewhere in your initialization code you set the callback attribute

//...
app_context.callbacks->region_format_changed = (&my_region_changed_cb);
//...

Hope it helps.

like image 146
Javier Uria Avatar answered Sep 20 '22 17:09

Javier Uria