summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alarm_widget/inc/data.h10
-rwxr-xr-xalarm_widget/inc/view.h120
-rwxr-xr-xalarm_widget/inc/widget_db.h17
-rw-r--r--alarm_widget/src/data.c2
-rwxr-xr-xalarm_widget/src/main.c52
-rwxr-xr-xalarm_widget/src/view.c45
-rwxr-xr-xalarm_widget/src/widget_db.c27
7 files changed, 248 insertions, 25 deletions
diff --git a/alarm_widget/inc/data.h b/alarm_widget/inc/data.h
index 922200b..4d8b566 100644
--- a/alarm_widget/inc/data.h
+++ b/alarm_widget/inc/data.h
@@ -16,8 +16,16 @@
#if !defined(_DATA_H)
#define _DATA_H
-
+/**
+ * @brief Gets path of resource.
+ * @param[in] file_in File name
+ * @param[out] file_path_out The point to which save full path of the resource
+ * @param[in] file_path_max Size of file name include path
+ */
void data_get_resource_path(const char *file_in, char *file_path_out, int file_path_max);
+/**
+ * @brief Gets the text shown on the popup.
+ */
char *data_get_popup_text(void);
#endif
diff --git a/alarm_widget/inc/view.h b/alarm_widget/inc/view.h
index b3bfc3c..c5f50c0 100755
--- a/alarm_widget/inc/view.h
+++ b/alarm_widget/inc/view.h
@@ -39,26 +39,144 @@ typedef enum _widget_event_type {
* Widget event callback function signature.
*/
typedef void (*widget_event_cb)(widget_instance_data_s *wid);
-
+/**
+ * @brief Creating widget window and conformants
+ * @param[in] context The context of widget instance
+ * @param[in] w The pixel value for widget width
+ * @param[in] h The pixel value for widget height
+ */
void view_create(widget_context_h context, int w, int h);
+/**
+ * @brief Creates layout for alarm widget.
+ * @param[in] context The context of widget instance
+ * @param[in] file_path EDJ file path will be used for the layout
+ */
void view_alarm_widget_create(widget_context_h context, const char *file_path);
+/*
+ * @brief: Used for no alarm screen UI configuration
+ * @param[in] wid: widget instance data handle.
+ */
void view_alarm_update_no_allarmlist_layout_with_alarmlist(widget_instance_data_s *wid);
+/**
+ * @brief Sets image to given part.
+ * @param[in] parent The object has part to which you want to set this image
+ * @param[in] part_name The part name to which you want to set this image
+ * @param[in] image_path The path of the image file
+ */
void view_set_image(Evas_Object *parent, const char *part_name, const char *image_path);
+/**
+ * @brief Sets text to the part.
+ * @param[in] parent The object has part to which you want to set text
+ * @param[in] part_name The part name to which you want to set the text
+ * @param[in] text Text you want to set to the part
+ */
void view_set_text(Evas_Object *parent, const char *part_name, const char *text);
+/**
+ * @brief Destroys window and frees its resources.
+ */
void view_widget_destroy(void *user_data);
+/**
+ * @brief Resizes the window.
+ * @param[in] user_data Structure has informations for managing this widget
+ * @param[in] w The pixel value for widget width
+ * @param[in] h The pixel value for widget height
+ */
void view_resize(void *user_data, int w, int h);
+/**
+ * @brief Sets the function will be called on the mouse events
+ * @param[in] parent Layout will be received the event
+ * @param[in] part_name Part name that the event is triggered
+ * @param[in] event_type Event type
+ * @param[in] event_cb The function will be called on the given event
+ * @param[in] user_data The data will be passed to the event_cb
+ */
void view_set_event_callback(Evas_Object *parent, const char *part_name, widget_event_type event_type, void *event_cb, void *user_data);
+/**
+ * @brief Creates a layout to target parent object with EDJ file.
+ * @param[in] parent The object to which you want to add this layout
+ * @param[in] file_path File path of EDJ file will be used
+ * @param[in] group_name The name of group in EDJ you want to set to
+ * @param[in] cb_function The function will be called when back event is detected
+ * @param[in] user_data The user data to be passed to the callback functions
+ */
Evas_Object *view_create_layout(Evas_Object *parent, const char *file_path, const char *group_name, Eext_Event_Cb cb_function, void *user_data);
+/**
+ * @brief Creates basic window for the widget with w, h size.
+ * @param[in] context The context of widget instance
+ * @param[in] w The pixel value for widget width
+ * @param[in] h The pixel value for widget height
+ */
Evas_Object *view_create_widget_win(widget_context_h context, int w, int h);
+/**
+ * @brief Creates layout for the first page of the alarm app when there is no alarm list.
+ * @param[in] parent Object to which you want to add this layout
+ * @param[in] file_path Path of EDJ will be used for this layout
+ * @param[in] group_name Name of group in EDJ you want to set to
+ * @param[in] user_data Data passed to the function
+ */
Evas_Object *view_alarm_create_layout_no_alarmlist(Evas_Object *parent, const char *file_path, const char *group_name, void *user_data);
+/**
+ * @brief Creates a naviframe and sets to parent.
+ * @param[in] parent The object to which you want to set naviframe object
+ */
Evas_Object *view_create_naviframe(Evas_Object *parent);
+/**
+ * @brief Creates and sets button.
+ * @param[in] parent Object to which you want to set the button
+ * @param[in] part_name Name of part to which you want to set the button
+ * @param[in] style Style of the button
+ * @param[in] image_path Path of image file will be used as button icon
+ * @param[in] text The text will be written on the button
+ * @param[in] down_cb Function will be operated when the button is pressed
+ * @param[in] up_cb Function will be operated when the button is released
+ * @param[in] clicked_cb Function will be operated when the button is clicked
+ * @param[in] user_data Data passed to the 'clicked_cb' function
+ */
void view_set_button(Evas_Object *parent, const char *part_name, const char *style, const char *image_path, const char *text, Evas_Object_Event_Cb down_cb, Evas_Object_Event_Cb up_cb, Evas_Smart_Cb clicked_cb, void *user_data);
+/**
+ * @brief Pushes item to naviframe object.
+ * @param[in] nf Naviframe that item will be added to
+ * @param[in] item The object will be added to naviframe
+ * @param[in] _pop_cb The function will be operated when this item is popped from naviframe
+ * @param[in] cb_data The data passed to the '_pop_cb' function
+ */
Elm_Object_Item* view_push_item_to_naviframe(Evas_Object *nf, Evas_Object *item, Elm_Naviframe_Item_Pop_Cb pop_cb, void *cb_data);
+/**
+ * @brief Creates a conformant without indicator for wearable app.
+ * @param[in] win The object to which you want to set this conformant
+ */
Evas_Object *view_create_conformant_without_indicator(Evas_Object *win);
+/**
+ * @brief Makes popup with theme.
+ * @param[in] parent The parent object
+ * @param[in] timeout Duration that popup is showing
+ * @param[in] text Text displayed on the popup
+ */
Evas_Object *view_create_text_popup(Evas_Object *parent, double timeout, const char *text);
+/**
+ * @brief Sets the Smart function will be called on the given event
+ * @param[in] obj The object that the event is triggered
+ * @param[in] event_type Event type
+ * @param[in] event_cb The function will be called on the given event
+ * @param[in] user_data The data will be passed to the event_cb
+ */
void view_set_smart_callback(Evas_Object *obj, char *event_type, Evas_Smart_Cb event_cb, void *user_data);
+/*
+ * @brief Sends appointed signal and source to the EDJ object
+ * @param[in] layout Object will receive the signal and source
+ * @param[in] signal Appointed signal
+ * @param[in] source Appointed source
+ */
void view_send_signal_to_edje(Evas_Object *layout, const char *signal, const char *source);
+/*
+ * @brief: Function for alarm UI layout configuration.
+ * @param[in] wid: widget data .
+ */
void view_alarm_update_alarm_layout(widget_instance_data_s *wid);
+/*
+ * @brief: Function to set Weekly text in alarm widget
+ * @param[in] wid: widget data .
+ */
char* alarm_widget_set_week_day_weekly_text(widget_instance_data_s *wid);
#endif
diff --git a/alarm_widget/inc/widget_db.h b/alarm_widget/inc/widget_db.h
index ab89962..6e01a52 100755
--- a/alarm_widget/inc/widget_db.h
+++ b/alarm_widget/inc/widget_db.h
@@ -29,9 +29,24 @@ typedef struct alarm_details {
int wday;
int alarm_on;
} alarm_details;
-
+/*
+ * @brief: Function to open connection with the database.
+ */
int open_db(void);
+/*
+ * @brief: Function to close connection with the database.
+ */
int close_db(void);
+/*
+ * @brief: Function to read alarm details.
+ * @param[in]dbid: Databse tuple ID.
+ * @param[out]details: structure alarm_details
+ */
int read_alarm_details(int db_id, alarm_details** details);
+/*
+ * @brief: Function to update alarm on off.
+ * @param[in]dbid: Databse tuple ID.
+ * @param[in]enable: Value to set the ALARM_ON in the database.
+ */
int set_alarm_on_off(int db_id, int enable);
#endif
diff --git a/alarm_widget/src/data.c b/alarm_widget/src/data.c
index 2edba80..387c04e 100644
--- a/alarm_widget/src/data.c
+++ b/alarm_widget/src/data.c
@@ -27,7 +27,7 @@
/**
* @brief Gets path of resource.
* @param[in] file_in File name
- * @param[in] file_path_out The point to which save full path of the resource
+ * @param[out] file_path_out The point to which save full path of the resource
* @param[in] file_path_max Size of file name include path
*/
void data_get_resource_path(const char *file_in, char *file_path_out, int file_path_max)
diff --git a/alarm_widget/src/main.c b/alarm_widget/src/main.c
index c0c0194..c3ff929 100755
--- a/alarm_widget/src/main.c
+++ b/alarm_widget/src/main.c
@@ -56,7 +56,13 @@ static void __alm_widget_new_alarm_mouse_down_cb(void *data, Evas * e, Evas_Obje
//static void _alarm_widget_edit_alarm_up_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _alarm_widget_edit_alarm_up_cb(void *data);
static void __alm_widget_new_alarm_mouse_move_cb(void *data, Evas * e, Evas_Object * obj, void *event_info);
-
+/*
+ * @brief: Function called when reply of the launch request is delivered
+ * @param[in] request The app_control handle of the launch request that has been sent
+ * @param[in] reply The app_control handle in which the results of the callee are contained
+ * @param[in] result The result code of the launch request
+ * @param[in] user_data The user data passed from the callback registration function
+ */
static void _reply_from_alarm(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
{
_ALM_WIDGET_ENTER_;
@@ -90,7 +96,13 @@ static void _reply_from_alarm(app_control_h request, app_control_h reply, app_co
}
}
-
+/*
+ * @brief: Mouse up callback on widget creation layout
+ * @param[in]data: Data will be the same value passed to evas_object_event_callback_add() as the data parameter
+ * @param[in]e: The e lets the user know what evas canvas the event occurred on
+ * @param[in]obj: Object handles on which the event occurred
+ * @param[in]event_info: Event_info is a pointer to a data structure about event
+ */
static void __alm_widget_new_alarm_mouse_up_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
{
Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *)event_info;
@@ -138,7 +150,13 @@ static void __alm_widget_new_alarm_mouse_up_cb(void *data, Evas * e, Evas_Object
}
}
}
-
+/*
+ * @brief: Mouse move callback on widget creation layout
+ * @param[in]data: Data will be the same value passed to evas_object_event_callback_add() as the data parameter
+ * @param[in]e: The e lets the user know what evas canvas the event occurred on
+ * @param[in]obj: Object handles on which the event occurred
+ * @param[in]event_info: Event_info is a pointer to a data structure about event
+ */
static void __alm_widget_new_alarm_mouse_move_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
{
_ALM_WIDGET_ENTER_;
@@ -147,7 +165,13 @@ static void __alm_widget_new_alarm_mouse_move_cb(void *data, Evas * e, Evas_Obje
elm_object_signal_emit(wid->layout, "clipper.no_alarm.default", "*");
wid->mouse_count++;
}
-
+/*
+ * @brief: Mouse down callback on widget creation layout
+ * @param[in]data: Data will be the same value passed to evas_object_event_callback_add() as the data parameter
+ * @param[in]e: The e lets the user know what evas canvas the event occurred on
+ * @param[in]obj: Object handles on which the event occurred
+ * @param[in]event_info: Event_info is a pointer to a data structure about event
+ */
static void __alm_widget_new_alarm_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
{
_ALM_WIDGET_ENTER_;
@@ -157,7 +181,10 @@ static void __alm_widget_new_alarm_mouse_down_cb(void *data, Evas * e, Evas_Obje
elm_object_signal_emit(wid->layout, "clipper.no_alarm.pressed", "*");
}
-
+/*
+ * @brief: Function to launch edit screen in alarm app when user click on the time text in widget
+ * @param[in]data: Data will be the same value passed to evas_object_event_callback_add() as the data parameter
+ */
//static void _alarm_widget_edit_alarm_up_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
static void _alarm_widget_edit_alarm_up_cb(void *data)
{
@@ -189,7 +216,10 @@ static void _alarm_widget_edit_alarm_up_cb(void *data)
app_control_destroy(app_control);
_D("_alarm_widget_edit_alarm_up_cb end");
}
-
+/*
+ * @brief: Function to change layout from no alarm to alarm view
+ * @param[in] wid: widget data .
+ */
static void switch_to_layout_with_alarm(widget_instance_data_s *wid)
{
_ALM_WIDGET_ENTER_;
@@ -198,7 +228,10 @@ static void switch_to_layout_with_alarm(widget_instance_data_s *wid)
view_alarm_update_no_allarmlist_layout_with_alarmlist(wid);
}
-
+/*
+ * @brief: Function to change layout from alarm view to no alarm
+ * @param[in] wid: widget data .
+ */
static void switch_to_layout_with_no_alarm(widget_instance_data_s *wid)
{
_ALM_WIDGET_ENTER_;
@@ -507,7 +540,10 @@ int main(int argc, char *argv[])
return ret;
}
-
+/*
+ * @brief: Function to update widget content to whome
+ * @param[in] wid: widget data .
+ */
int update_widget_content_to_whome(widget_instance_data_s* wid)
{
_ALM_WIDGET_ENTER_;
diff --git a/alarm_widget/src/view.c b/alarm_widget/src/view.c
index ab1b0b7..5bf9dda 100755
--- a/alarm_widget/src/view.c
+++ b/alarm_widget/src/view.c
@@ -61,8 +61,10 @@ void view_set_image(Evas_Object *parent, const char *part_name, const char *imag
}
/**
- * @brief Creates a naviframe and sets to parent.
- * @param[in] parent The object to which you want to set naviframe object
+ * @brief Creating widget window and conformants
+ * @param[in] context The context of widget instance
+ * @param[in] w The pixel value for widget width
+ * @param[in] h The pixel value for widget height
*/
void view_create(widget_context_h context, int w, int h)
{
@@ -123,7 +125,10 @@ Evas_Object *view_create_conformant_without_indicator(Evas_Object *win)
evas_object_show(conform);
return conform;
}
-
+/*
+ * @brief: Function to clear layout text in alarm widget
+ * @param[in] wid: widget data .
+ */
void alarm_widget_layout_text_clear(widget_instance_data_s *wid)
{
_ALM_WIDGET_ENTER_;
@@ -141,7 +146,10 @@ void alarm_widget_layout_text_clear(widget_instance_data_s *wid)
_D("alarm_widget_layout_text_clear end.");
}
-
+/*
+ * @brief: Function to set Weekly text in alarm widget
+ * @param[in] wid: widget data .
+ */
char* alarm_widget_set_week_day_weekly_text(widget_instance_data_s *wid)
{
_ALM_WIDGET_ENTER_;
@@ -233,7 +241,10 @@ char* alarm_widget_set_week_day_weekly_text(widget_instance_data_s *wid)
}
return strdup(buf);
}
-
+/*
+ * @brief: Function to set text for the widget layout
+ * @param[in] wid: widget data .
+ */
void alarm_widget_layout_text_set(widget_instance_data_s *wid)
{
_ALM_WIDGET_ENTER_;
@@ -285,7 +296,10 @@ void alarm_widget_layout_text_set(widget_instance_data_s *wid)
elm_object_signal_emit(wid->layout, "text.off", "*");
}
}
-
+/*
+ * @brief: Function to update the alarm on/off icon in the alarm widget layout
+ * @param[in] wid: widget data .
+ */
void alarm_widget_layout_icon_update(widget_instance_data_s *wid)
{
@@ -302,6 +316,10 @@ void alarm_widget_layout_icon_update(widget_instance_data_s *wid)
elm_object_signal_emit(wid->layout, "text.off", "*");
}
}
+/*
+ * @brief: Function to control alarm on/off button.
+ * @param[in] wid: widget data .
+ */
static void _alarm_widget_enable_up_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
{
@@ -324,7 +342,10 @@ static void _alarm_widget_enable_up_cb(void *data, Evas_Object *obj, const char
}
-
+/*
+ * @brief: Function to set the alarm on/off icon in the alarm widget layout
+ * @param[in] wid: widget instance data handle.
+ */
void alarm_widget_layout_icon_set(widget_instance_data_s *wid)
{
_ALM_WIDGET_ENTER_;
@@ -352,7 +373,10 @@ Evas_Object *view_alarm_create_layout_no_alarmlist(Evas_Object *parent, const ch
return layout;
}
-
+/*
+ * @brief: Used for no alarm screen UI configuration
+ * @param[in] wid: widget instance data handle.
+ */
void view_alarm_update_no_allarmlist_layout_with_alarmlist(widget_instance_data_s *wid)
{
_ALM_WIDGET_ENTER_;
@@ -692,7 +716,10 @@ static void _widget_released_cb(void *user_data, Evas *evas, Evas_Object *obj, v
}
}
}
-
+/*
+ * @brief: Function for alarm UI layout configuration.
+ * @param[in] wid: widget data .
+ */
void view_alarm_update_alarm_layout(widget_instance_data_s *wid)
{
_ALM_WIDGET_ENTER_;
diff --git a/alarm_widget/src/widget_db.c b/alarm_widget/src/widget_db.c
index e44a47e..ae74171 100755
--- a/alarm_widget/src/widget_db.c
+++ b/alarm_widget/src/widget_db.c
@@ -25,7 +25,9 @@
#define BUFLEN 1024
#define DB_NAME "sample.db"/* Buffer size, used in functions */
sqlite3 *sampleDb;
-
+/*
+ * @brief: Function to open connection with the database.
+ */
int open_db()
{
_ALM_WIDGET_ENTER_;
@@ -46,12 +48,21 @@ int open_db()
/*didn't close database instance as this will be handled by caller e.g. insert, delete*/
return ret;
}
-
+/*
+ * @brief: Function to close connection with the database.
+ */
int close_db()
{
_ALM_WIDGET_ENTER_;
return sqlite3_close(sampleDb);
}
+/*
+ * @brief: callback to the sql_exec() in check_duplicate().
+ * @param[in]data: User data
+ * @param[in]argc: Number of columns
+ * @param[in]argv: Value of each column
+ * @param[in]azColName:Name of corresponding column.
+ */
static int read_alarm_details_cb(void *data, int argc, char **argv, char **azColName)
{
_ALM_WIDGET_ENTER_;
@@ -84,7 +95,11 @@ static int read_alarm_details_cb(void *data, int argc, char **argv, char **azCol
return 0;
}
-
+/*
+ * @brief: Function to read alarm details.
+ * @param[in]dbid: Databse tuple ID.
+ * @param[out]details: structure alarm_details
+ */
int read_alarm_details(int db_id, alarm_details** details)
{
_ALM_WIDGET_ENTER_;
@@ -118,7 +133,11 @@ int read_alarm_details(int db_id, alarm_details** details)
*details = alm_details;
return 0;
}
-
+/*
+ * @brief: Function to update alarm on off.
+ * @param[in]dbid: Databse tuple ID.
+ * @param[in]enable: Value to set the ALARM_ON in the database.
+ */
int set_alarm_on_off(int db_id, int enable)
{
_ALM_WIDGET_ENTER_;