diff options
author | Jeong Seong-moon <salt.jeong@samsung.com> | 2016-09-12 12:54:49 +0900 |
---|---|---|
committer | Jeong Seong-moon <salt.jeong@samsung.com> | 2016-09-12 13:06:14 +0900 |
commit | e9ca3babb5c61fdbfa3278d8e957019b930835de (patch) | |
tree | 5cc87b0bda69efd278ed9a0c6909063b84398610 /inc | |
parent | 818199e6150075fd28117ea57b212f4abc816075 (diff) | |
download | weather-clock-tizen_2.3.1.tar.gz weather-clock-tizen_2.3.1.tar.bz2 weather-clock-tizen_2.3.1.zip |
change tmp code for weather watch. It is not complete codetizen_2.3.1
Change-Id: I6d7068f2d48bebfe40f2ce025af76ef2f6d7672d
Diffstat (limited to 'inc')
-rwxr-xr-x | inc/data.h | 47 | ||||
-rwxr-xr-x | inc/view.h | 39 | ||||
-rwxr-xr-x | inc/weatherclock.h | 140 |
3 files changed, 226 insertions, 0 deletions
diff --git a/inc/data.h b/inc/data.h new file mode 100755 index 0000000..272b543 --- /dev/null +++ b/inc/data.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if !defined(_DATA_H) +#define _DATA_H + +typedef enum { + PARTS_TYPE_HANDS_SEC = 0, + PARTS_TYPE_HANDS_MIN, + PARTS_TYPE_HANDS_HOUR, + PARTS_TYPE_HANDS_PIN, + PARTS_TYPE_MAX, +} parts_type_e; + +/* + * Initialize the data component + */ +void data_initialize(void); + +/* + * Finalize the data component + */ +void data_finalize(void); + +void data_get_resource_path(const char *file_in, char *file_path_out, int file_path_max); +int data_get_plus_angle(int minute); +char *data_get_parts_image_path(parts_type_e type); +void data_get_parts_position(parts_type_e type, int *x, int *y); +void data_get_parts_size(parts_type_e type, int *w, int *h); +char *data_get_month_name(int month); +int data_get_battery_percent(void); +char *date_get_battery_color(int percentage); +char *date_get_air_pollution_color(int aqi); +#endif diff --git a/inc/view.h b/inc/view.h new file mode 100755 index 0000000..72f133e --- /dev/null +++ b/inc/view.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if !defined(_VIEW_H) +#define _VIEW_H + +#define EDJ_FILE "edje/main.edj" + +/* + * Create a view + */ +void view_set_watchface_layout(Evas_Object *layout); +void view_set_indicator_module_layout(Evas_Object *layout, int type); +Evas_Object *view_get_watchface_layout(void); +Evas_Object *view_get_battery_module_layout(void); +Evas_Object *view_get_ap_module_layout(void); + +void view_set_text(Evas_Object *parent, const char *part_name, const char *text); +Evas_Object *view_create_layout(Evas_Object *parent, const char *file_path, const char *group_name, void *user_data); +void view_send_signal_to_edje(Evas_Object *layout, const char *signal, const char *source); +void view_set_customized_event_callback(Evas_Object *item, char *signal, char *source, Edje_Signal_Cb signal_cb, void *user_data); +void view_rotate_hand(Evas_Object *hand, double degree, Evas_Coord cx, Evas_Coord cy); +void view_rotate_parts(Evas_Object *layout, int type, float degree); +Evas_Object *view_create_parts(Evas_Object *parent, const char *image_path, int x, int y, int w, int h, Eina_Bool is_map); +void view_destroy_base_gui(void); +#endif diff --git a/inc/weatherclock.h b/inc/weatherclock.h new file mode 100755 index 0000000..d3d1c6c --- /dev/null +++ b/inc/weatherclock.h @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if !defined(_WEATHER_CLOCK_H) +#define _WEATHER_CLOCK_H + +#if !defined(PACKAGE) +#define PACKAGE "org.example.weatherclock" +#endif + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "weatherclock" + +#define INDICATOR_MODULE_BATTERY 0 +#define INDICATOR_MODULE_AIR_POLLUTION 1 + +/* Angle */ +#define HOUR_ANGLE 30 +#define MIN_ANGLE 6 +#define SEC_ANGLE 6 + +/* Layout */ +#define BASE_WIDTH 360 +#define BASE_HEIGHT 360 + +#define HANDS_SEC_WIDTH 13 +#define HANDS_SEC_HEIGHT 13 +#define HANDS_MIN_WIDTH 6 +#define HANDS_MIN_HEIGHT 115 +#define HANDS_HOUR_WIDTH 6 +#define HANDS_HOUR_HEIGHT 87 +#define HANDS_PIN_WIDTH 20 +#define HANDS_PIN_HEIGHT 20 + +#define DATA_KEY_AP_INFO_TYPE "__AP_INFO_TYPE__" +#define DATA_KEY_BATTYER_INFO_TYPE "__BATTERY_INFO_TYPE__" +#define DATA_KEY_HANDS_SEC "__HANDS_SEC__" +#define DATA_KEY_HANDS_MIN "__HANDS_MIN__" +#define DATA_KEY_HANDS_HOUR "__HANDS_HOUR__" + +#define LOCATIONS_STATUS_DISABLED 0 +#define LOCATIONS_STATUS_SETTING_OFF 1 +#define LOCATIONS_STATUS_ENABLED 2 + +#define LOCATIONS_COMMAND_INITIALIZE 0 +#define LOCATIONS_COMMAND_STOP 1 +#define LOCATIONS_COMMAND_RESUME 2 +#define LOCATIONS_COMMAND_DESTROY 3 + +#define URL_LENGTH_MAX 500 + +#define CURL_GET_WEAHTER 0 +#define CURL_GET_AP_INSPECT_STATION 1 +#define CURL_GET_AP_VALUE 2 + +#define WEATHER_FORCAST_6HOUR_INDEX 1 + +#define WEAHTER_REST_API_URL "http://api.openweathermap.org/data/2.5/forecast?lat=%.6f&lon=%.6f&appid=c539c7392bf0a7d262ee10cf47a1cba9" +#define AP_STATION_REST_API_URL "http://api.openweathermap.org/data/2.5/forecast?lat=%.6f&lon=%.6f&appid=c539c7392bf0a7d262ee10cf47a1cba9" +#define AP_VALUE_REST_API_URL "http://openapi.airkorea.or.kr/openapi/services/rest/ArpltnInforInqireSvc/getMsrstnAcctoRltmMesureDnsty?stationName=%%EC%%A2%%85%%EB%%A1%%9C%%EA%%B5%%AC&dataTerm=month&pageNo=1&numOfRows=10&ServiceKey=FoC79C0INc7%%2BtdXxiCGfD7fUBYc6CmYZNNpDHNpva6FxOhXXqmxWJz8qREcGfHAClvYgBy16ovp8t1%%2FO2Mo8KQ%%3D%%3D&ver=1.2&_returnType=json" + +#define VALID_PERIOD_30MIN 1800000 + +#define WEATHER_ICON_STR_CLEAR_SKY_DAY "01d" +#define WEATHER_ICON_STR_FEW_CLOUDS_DAY "02d" +#define WEATHER_ICON_STR_SCATTERED_CLOUDS_DAY "03d" +#define WEATHER_ICON_STR_BROKEN_CLOUDS_DAY "04d" +#define WEATHER_ICON_STR_SHOWER_RAIN_DAY "09d" +#define WEATHER_ICON_STR_RAIN_DAY "10d" +#define WEATHER_ICON_STR_THUNDERSTORM_DAY "11d" +#define WEATHER_ICON_STR_SNOW_DAY "13d" +#define WEATHER_ICON_STR_MIST_DAY "50d" +#define WEATHER_ICON_STR_CLEAR_SKY_NIGHT "01n" +#define WEATHER_ICON_STR_FEW_CLOUDS_NIGHT "02n" +#define WEATHER_ICON_STR_SCATTERED_CLOUDS_NIGHT "03n" +#define WEATHER_ICON_STR_BROKEN_CLOUDS_NIGHT "04n" +#define WEATHER_ICON_STR_SHOWER_RAIN_NIGHT "09n" +#define WEATHER_ICON_STR_RAIN_NIGHT "10n" +#define WEATHER_ICON_STR_THUNDERSTORM_NIGHT "11n" +#define WEATHER_ICON_STR_SNOW_NIGHT "13n" +#define WEATHER_ICON_STR_MIST_NIGHT "50n" + +typedef enum { + WEATHER_STATE_CLEAR_SKY_DAY = 0, + WEATHER_STATE_FEW_CLOUDS_DAY, + WEATHER_STATE_SCATTERED_CLOUDS_DAY, + WEATHER_STATE_BROKEN_CLOUDS_DAY, + WEATHER_STATE_SHOWER_RAIN_DAY, + WEATHER_STATE_RAIN_DAY, + WEATHER_STATE_THUNDERSTORM_DAY, + WEATHER_STATE_SNOW_DAY, + WEATHER_STATE_MIST_DAY, + WEATHER_STATE_CLEAR_SKY_NIGHT, + WEATHER_STATE_FEW_CLOUDS_NIGHT, + WEATHER_STATE_SCATTERED_CLOUDS_NIGHT, + WEATHER_STATE_BROKEN_CLOUDS_NIGHT, + WEATHER_STATE_SHOWER_RAIN_NIGHT, + WEATHER_STATE_RAIN_NIGHT, + WEATHER_STATE_THUNDERSTORM_NIGHT, + WEATHER_STATE_SNOW_NIGHT, + WEATHER_STATE_MIST_NIGHT, + WEATHER_STATE_MAX, +} weather_state_e; + +typedef struct weatherwatch_weather_data { + double updated_time; + weather_state_e state; +}weather_data_s; + +typedef struct weatherwatch_ap_data { + double updated_time; + int aqi; +}air_pollution_data_s; + +typedef struct curl_response_data { + size_t size; + char *response; +}curl_response_data_s; + +typedef enum { + INDICATOR_INFO_TYPE_ICON = 0, + INDICATOR_INFO_TYPE_TEXT = 1, + INDICATOR_INFO_TYPE_MAX, +} indicator_info_type_e; +#endif |