Adlib

- Main Page
- Modules
- Data Structures

adlib.h
1 /*
2 * Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18 /*
19 * adlib.h
20 *
21 * Created on: Oct 22, 2015
22 * Author: anand.r
23 */
24
39 #ifndef _ADLIB_H_
40 #define _ADLIB_H_
41
42 #include <tizen.h>
43 #include <Elementary.h>
44
45 #ifdef __cplusplus
46 extern "C" { // only need to export C interface if
47 // used by C++ source code
48 #endif
49
59 typedef struct _banner_addata banner_ad_h;
60
65 typedef enum _adlib_err
66 {
67 ADLIB_AD_NO_ERROR,
68 ADLIB_AD_INTERNAL_ERROR = 1,
69 ADLIB_AD_ADLIB_NOT_INITIALIZED,
70 ADLIB_AD_INVALID_AD_HANDLE,
71 ADLIB_AD_INVALID_PARAMETERS,
72 ADLIB_AD_INVALID_REQUEST,
73 ADLIB_AD_NETWORK_ERROR,
74 ADLIB_AD_NO_FILL_ERROR,
75 } adlib_err;
76
81 typedef enum adlib_event_type
82 {
83 ADLIB_AD_EVENT_REQUEST_FAILED,
84 ADLIB_AD_EVENT_REQUEST_SUCCESS,
85 ADLIB_AD_EVENT_AD_OPENED,
86 ADLIB_AD_EVENT_AD_CLOSED,
87 } adlib_event_type_e;
88
93 typedef enum _adlib_state_type
94 {
95 ADLIB_APP_NONE_STATE,
96 ADLIB_APP_PAUSE_STATE,
97 ADLIB_APP_RESUME_STATE,
98 } adlib_state_type_e;
99
104 typedef enum _adlib_gender
105 {
106 ADLIB_AD_GENDER_FEMALE,
107 ADLIB_AD_GENDER_MALE,
108 } adlib_gender_e;
109
123 typedef enum _banner_adposition
124 {
125 BANNER_AD_POSITION_TOP_LEFT = 0,
126 BANNER_AD_POSITION_TOP_CENTER,
127 BANNER_AD_POSITION_TOP_RIGHT,
128 BANNER_AD_POSITION_CENTER,
129 BANNER_AD_POSITION_BOTTOM_LEFT,
130 BANNER_AD_POSITION_BOTTOM_CENTER,
131 BANNER_AD_POSITION_BOTTOM_RIGHT,
132 } banner_adposition_e;
133
138 typedef enum _banner_ad_size
139 {
140 BANNER_AD_SIZE_SMALL = 15,
141 BANNER_AD_SIZE_BIG = 10,
142 } banner_ad_size_e;
143
165 typedef void (*on_banner_request_succeeded_event_cb) (Evas_Object *banner_ad_obj, void *user_data);
166
180 typedef void (*on_banner_request_failed_event_cb) (Evas_Object *banner_ad_obj, adlib_err err, void *user_data);
181
194 typedef void (*on_banner_ad_opened_event_cb) (Evas_Object *banner_ad_obj, void *user_data);
195
207 typedef void (*on_interstitial_request_succeeded_event_cb) ( void *user_data);
208
221 typedef void (*on_interstitial_request_failed_event_cb) (adlib_err err, void *user_data);
222
223
235 typedef void (*on_interstitial_ad_opened_event_cb) (void *user_data);
236
248 typedef void (*on_interstitial_ad_closed_event_cb) (void *user_data);
249
254 typedef struct banner_ad_event_cb
255 {
256 on_banner_request_succeeded_event_cb banner_ad_load_request_succeeded;
257 on_banner_request_failed_event_cb banner_ad_load_request_failed;
258 on_banner_ad_opened_event_cb banner_ad_opened;
259 } banner_ad_event_callback_s;
260
265 typedef struct interstitial_ad_event_cb
266 {
267 on_interstitial_request_succeeded_event_cb interstitial_ad_load_request_succeeded;
268 on_interstitial_request_failed_event_cb interstitial_ad_load_request_failed;
269 on_interstitial_ad_opened_event_cb interstitial_ad_opened;
270 on_interstitial_ad_closed_event_cb interstitial_ad_closed;
271 } interstitial_ad_event_callback_s;
272
289 EXPORT_API adlib_err
290 adlib_init(const char *banner_site_id, const char *interstitial_site_id, const char *js_namespace, const char *js_src_url, const char *ad_conf_str_name);
291
300 EXPORT_API void
301 adlib_deinit();
302
308 EXPORT_API void
309 adlib_set_age(int age);
310
316 EXPORT_API void
317 adlib_set_gender(adlib_gender_e gender);
318
324 EXPORT_API void
325 adlib_set_location(char *location);
326
332 EXPORT_API void
333 adlib_set_interests(char *interests);
334
340 EXPORT_API void
341 adlib_set_postal_code(char *postalCode);
342
348 EXPORT_API void
349 adlib_set_area_code(char *areaCode);
350
356 EXPORT_API void
357 adlib_set_date_of_birth(char *dob);
358
364 EXPORT_API void
365 adlib_set_income(char *income);
366
372 EXPORT_API void
373 adlib_set_education(char *education);
374
380 EXPORT_API void
381 adlib_set_ethnicity(char *ethnicity);
382
407 EXPORT_API adlib_err
408 adview_add_banner_ad(Evas_Object **banner_ad_obj, Evas_Object *eo, banner_ad_size_e size);
409
423 EXPORT_API adlib_err
424 adview_banner_load(Evas_Object *banner_ad_obj);
425
440 EXPORT_API adlib_err
441 adview_banner_set_enable_auto_refresh(Evas_Object *banner_ad_obj, Eina_Bool enable);
442
455 EXPORT_API adlib_err
456 adview_banner_set_refresh_interval(Evas_Object *banner_ad_obj, double duration);
457
471 EXPORT_API adlib_err
472 adview_banner_ad_set_position(Evas_Object *banner_ad_obj, banner_adposition_e pos);
473
488 EXPORT_API adlib_err
489 adview_banner_ad_register_callbacks(Evas_Object *banner_ad_obj, banner_ad_event_callback_s *callback, void *user_data);
490
516 EXPORT_API adlib_err
517 adview_add_interstitial_ad(Evas_Object *eo);
518
531 EXPORT_API adlib_err
532 adview_interstitial_load(void);
533
543 EXPORT_API adlib_err
544 adview_interstitial_show(void);
545
560 EXPORT_API adlib_err
561 adview_interstitial_ad_register_callbacks(interstitial_ad_event_callback_s *callback, void *user_data);
562
567 #ifdef __cplusplus
568 }
569 #endif
570
571 #endif // _ADLIB_H_
572
on_interstitial_request_failed_event_cb
void(* on_interstitial_request_failed_event_cb)(adlib_err err, void *user_data)
Called when the interstitial ad load is failed.
Definition: adlib.h:221
adlib_err
enum _adlib_err adlib_err
Enumeration for the error codes of adlib.
adview_banner_ad_register_callbacks
EXPORT_API adlib_err adview_banner_ad_register_callbacks(Evas_Object *banner_ad_obj, banner_ad_event_callback_s *callback, void *user_data)
Adds the banner ad callback handler.
adlib_set_gender
EXPORT_API void adlib_set_gender(adlib_gender_e gender)
Set the user&#39;s gender for targeting purposes.
adlib_state_type_e
enum _adlib_state_type adlib_state_type_e
Enumeration for the state types of adlib.
adlib_set_ethnicity
EXPORT_API void adlib_set_ethnicity(char *ethnicity)
Set the user&#39;s ethnicity for targeting purposes.
ADLIB_APP_PAUSE_STATE
Definition: adlib.h:96
BANNER_AD_POSITION_BOTTOM_RIGHT
Definition: adlib.h:131
_adlib_gender
_adlib_gender
Enumeration for the gender used in adlib.
Definition: adlib.h:104
banner_ad_h
struct _banner_addata banner_ad_h
Banner ad handle for handling banner ads.
Definition: adlib.h:59
BANNER_AD_POSITION_TOP_RIGHT
Definition: adlib.h:127
_banner_adposition
_banner_adposition
Enumeration for the position to set in banner ads.
Definition: adlib.h:123
interstitial_ad_event_cb::interstitial_ad_load_request_failed
on_interstitial_request_failed_event_cb interstitial_ad_load_request_failed
Definition: adlib.h:268
banner_adposition_e
enum _banner_adposition banner_adposition_e
Enumeration for the position to set in banner ads.
adview_interstitial_show
EXPORT_API adlib_err adview_interstitial_show(void)
Shows the interstitial ad.
adlib_event_type
adlib_event_type
Enumeration for the event types of adlib.
Definition: adlib.h:81
ADLIB_AD_GENDER_MALE
Definition: adlib.h:107
adlib_init
EXPORT_API adlib_err adlib_init(const char *banner_site_id, const char *interstitial_site_id, const char *js_namespace, const char *js_src_url, const char *ad_conf_str_name)
Initializes adlib and its core.
adview_banner_set_refresh_interval
EXPORT_API adlib_err adview_banner_set_refresh_interval(Evas_Object *banner_ad_obj, double duration)
This api will set the auto refresh interval for the ad. Minimum refresh interval should be greater th...
ADLIB_AD_EVENT_AD_OPENED
Definition: adlib.h:85
adlib_set_date_of_birth
EXPORT_API void adlib_set_date_of_birth(char *dob)
Set the user&#39;s date of birth for targeting purposes.
BANNER_AD_POSITION_TOP_CENTER
Definition: adlib.h:126
on_interstitial_ad_opened_event_cb
void(* on_interstitial_ad_opened_event_cb)(void *user_data)
Called when the interstitial ad is clicked.
Definition: adlib.h:235
_adlib_state_type
_adlib_state_type
Enumeration for the state types of adlib.
Definition: adlib.h:93
interstitial_ad_event_callback_s
struct interstitial_ad_event_cb interstitial_ad_event_callback_s
Interstitial ad event callbacks.
on_interstitial_request_succeeded_event_cb
void(* on_interstitial_request_succeeded_event_cb)(void *user_data)
Called when the interstitial ad load is succeeded.
Definition: adlib.h:207
BANNER_AD_SIZE_BIG
Definition: adlib.h:141
BANNER_AD_SIZE_SMALL
Definition: adlib.h:140
ADLIB_AD_NO_FILL_ERROR
Definition: adlib.h:74
on_banner_ad_opened_event_cb
void(* on_banner_ad_opened_event_cb)(Evas_Object *banner_ad_obj, void *user_data)
Called when the banner ad is clicked.
Definition: adlib.h:194
adlib_set_education
EXPORT_API void adlib_set_education(char *education)
Set the user&#39;s education for targeting purposes.
adlib_set_location
EXPORT_API void adlib_set_location(char *location)
Set the user&#39;s location for targeting purposes.
adlib_event_type_e
enum adlib_event_type adlib_event_type_e
Enumeration for the event types of adlib.
_banner_ad_size
_banner_ad_size
Enumeration for the size to set in banner ads.
Definition: adlib.h:138
interstitial_ad_event_cb::interstitial_ad_opened
on_interstitial_ad_opened_event_cb interstitial_ad_opened
Definition: adlib.h:269
on_interstitial_ad_closed_event_cb
void(* on_interstitial_ad_closed_event_cb)(void *user_data)
Called when the interstitial ad is closed.
Definition: adlib.h:248
adlib_set_income
EXPORT_API void adlib_set_income(char *income)
Set the user&#39;s income group for targeting purposes.
adlib_gender_e
enum _adlib_gender adlib_gender_e
Enumeration for the gender used in adlib.
BANNER_AD_POSITION_BOTTOM_LEFT
Definition: adlib.h:129
interstitial_ad_event_cb::interstitial_ad_closed
on_interstitial_ad_closed_event_cb interstitial_ad_closed
Definition: adlib.h:270
banner_ad_size_e
enum _banner_ad_size banner_ad_size_e
Enumeration for the size to set in banner ads.
BANNER_AD_POSITION_TOP_LEFT
Definition: adlib.h:125
ADLIB_AD_NETWORK_ERROR
Definition: adlib.h:73
on_banner_request_succeeded_event_cb
void(* on_banner_request_succeeded_event_cb)(Evas_Object *banner_ad_obj, void *user_data)
Called when the banner ad load is succeeded.
Definition: adlib.h:165
adlib_set_interests
EXPORT_API void adlib_set_interests(char *interests)
Set the user&#39;s interests for targeting purposes.
banner_ad_event_cb::banner_ad_load_request_failed
on_banner_request_failed_event_cb banner_ad_load_request_failed
Definition: adlib.h:257
ADLIB_APP_NONE_STATE
Definition: adlib.h:95
on_banner_request_failed_event_cb
void(* on_banner_request_failed_event_cb)(Evas_Object *banner_ad_obj, adlib_err err, void *user_data)
Called when the banner ad load is failed.
Definition: adlib.h:180
adlib_deinit
EXPORT_API void adlib_deinit()
Disconnects adlib core and clears networkconnection.
banner_ad_event_cb::banner_ad_load_request_succeeded
on_banner_request_succeeded_event_cb banner_ad_load_request_succeeded
Definition: adlib.h:256
banner_ad_event_cb
Banner ad event callbacks.
Definition: adlib.h:254
_adlib_err
_adlib_err
Enumeration for the error codes of adlib.
Definition: adlib.h:65
adlib_set_area_code
EXPORT_API void adlib_set_area_code(char *areaCode)
Set the user&#39;s area code for targeting purposes.
ADLIB_AD_EVENT_REQUEST_FAILED
Definition: adlib.h:83
ADLIB_AD_EVENT_REQUEST_SUCCESS
Definition: adlib.h:84
BANNER_AD_POSITION_BOTTOM_CENTER
Definition: adlib.h:130
adview_add_interstitial_ad
EXPORT_API adlib_err adview_add_interstitial_ad(Evas_Object *eo)
This api will add the interstitial ad on the parent received.
adlib_set_postal_code
EXPORT_API void adlib_set_postal_code(char *postalCode)
Set the user&#39;s postal code for targeting purposes.
ADLIB_AD_INVALID_PARAMETERS
Definition: adlib.h:71
ADLIB_APP_RESUME_STATE
Definition: adlib.h:97
ADLIB_AD_INVALID_AD_HANDLE
Definition: adlib.h:70
adview_banner_ad_set_position
EXPORT_API adlib_err adview_banner_ad_set_position(Evas_Object *banner_ad_obj, banner_adposition_e pos)
Sets the position of the ad. Application can set the position of the ad to the predefined positions d...
adlib_set_age
EXPORT_API void adlib_set_age(int age)
Set the user&#39;s age for targeting purposes.
ADLIB_AD_ADLIB_NOT_INITIALIZED
Definition: adlib.h:69
ADLIB_AD_GENDER_FEMALE
Definition: adlib.h:106
ADLIB_AD_INTERNAL_ERROR
Definition: adlib.h:68
adview_interstitial_load
EXPORT_API adlib_err adview_interstitial_load(void)
Loads the interstitial ad. Returns the success or failure result to the listener callbacks. Please see OnLoadFailed and OnLoadSucceeded callbacks.
interstitial_ad_event_cb::interstitial_ad_load_request_succeeded
on_interstitial_request_succeeded_event_cb interstitial_ad_load_request_succeeded
Definition: adlib.h:267
banner_ad_event_cb::banner_ad_opened
on_banner_ad_opened_event_cb banner_ad_opened
Definition: adlib.h:258
BANNER_AD_POSITION_CENTER
Definition: adlib.h:128
banner_ad_event_callback_s
struct banner_ad_event_cb banner_ad_event_callback_s
Banner ad event callbacks.
ADLIB_AD_NO_ERROR
Definition: adlib.h:67
ADLIB_AD_EVENT_AD_CLOSED
Definition: adlib.h:86
adview_banner_load
EXPORT_API adlib_err adview_banner_load(Evas_Object *banner_ad_obj)
Loads and shows the ad. Returns the success or failure result to the listener callbacks.
interstitial_ad_event_cb
Interstitial ad event callbacks.
Definition: adlib.h:265
ADLIB_AD_INVALID_REQUEST
Definition: adlib.h:72
adview_banner_set_enable_auto_refresh
EXPORT_API adlib_err adview_banner_set_enable_auto_refresh(Evas_Object *banner_ad_obj, Eina_Bool enable)
This api will set the auto refresh feature to either enabled or disabled. If set to disabled ads will...
adview_add_banner_ad
EXPORT_API adlib_err adview_add_banner_ad(Evas_Object **banner_ad_obj, Evas_Object *eo, banner_ad_size_e size)
This api will add the banner ad on the parent received.
adview_interstitial_ad_register_callbacks
EXPORT_API adlib_err adview_interstitial_ad_register_callbacks(interstitial_ad_event_callback_s *callback, void *user_data)
Adds the interstitial ad callback handler.