Update channel number to handle minor channel 40/45540/2
authorjinwoo.shin <jw0227.shin@samsung.com>
Fri, 7 Aug 2015 08:23:52 +0000 (17:23 +0900)
committerjinwoo.shin <jw0227.shin@samsung.com>
Fri, 7 Aug 2015 08:31:16 +0000 (17:31 +0900)
Change-Id: Ib10babb5dfd89d887cbc3fb1da4b4b166a5102a2
Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
data/view/channelnumber.edc
include/tv_service.h [deleted file]
src/tv.c
src/view_channelnumber.c

index 48d9e02..e1caabd 100644 (file)
@@ -45,7 +45,7 @@ group {
                                        to, "padding.channelnumber";
                                        relative, 1.0 1.0;
                                }
-                               min, 216 90;
+                               min, 340 90;
                                align, 0.0 0.0;
                                fixed, 1 1;
                                visible, 0;
@@ -106,7 +106,7 @@ group {
                                                to_x, "part.channelnumber.channel_prefix";
                                                relative, 1.0 1.0;
                                        }
-                                       min, 26 0;
+                                       min, 8 0;
                                        align, 0.0 0.0;
                                        fixed, 1 1;
                                }
@@ -170,9 +170,9 @@ group {
                                }
                                rel2 {
                                        to, "padding.list";
-                                       relative, 1.0 1.0;
+                                       relative, 0.0 1.0;
                                }
-                               min, 216 224;
+                               min, 292 224;
                                align, 0.0 0.0;
                                fixed, 1 1;
                        }
@@ -190,7 +190,7 @@ group {
                        description {
                                state, "default" 0.0;
                                color, COLOR_BG_NORMAL;
-                               min, 216 56;
+                               min, 292 56;
                                align, 0.0 0.0;
                        }
                        description {
diff --git a/include/tv_service.h b/include/tv_service.h
deleted file mode 100644 (file)
index bae9260..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- */
-
-#include <glib-object.h>
-
-#define TVS_EPG_CURRENT_TIME                   -1
-#define PROGRAM_NAME_MAX_LEN                   25
-#define CHANNEL_FILTER_STRING_MAX_LEN  100
-
-/**
- * An enumeration.
- * Enumeration for tv service error type
- */
-typedef enum
-{
-       TVS_ERROR_OK = 0,                                               /**< tv service error ok */
-       TVS_ERROR_NO_FREE_MEMORY = -1,                  /**< tv service error no free memory */
-       TVS_ERROR_HANDLE_UNINITIALIZED = -2,    /**< tv service error handle uninitialized */
-       TVS_ERROR_RPC_CALL_FAIL = -3,                   /**< tv service error rpc call fail */
-       TVS_ERROR_INVALID_PARAMETER = -4,               /**< tv service error invalid input parameter */
-       TVS_ERROR_INVALID_VALUE = -5,                   /**< tv service error invalid input value */
-       TVS_ERROR_NOT_AVAILABLE = -6,                   /**< tv service error not available */
-       TVS_ERROR_SEQLITE_BUSY = -7,                    /**< tv service error  SQLite busy */
-       TVS_ERROR_PROCESS_FAIL = -8,                    /**< tv service error  process error*/
-       TVS_ERROR_DATABASE_FAIL = -9,                   /**< tv service error  database query fail*/
-       TVS_ERROR_AUTHENTICATE_FAIL = -10,              /**< tv service error  Authenticate fail, ex, lock password match fail*/
-       TVS_ERROR_UNKNOWN = -255                                /**< tv service error unknown */
-} TvServiceError;
-
-typedef enum
-{
-       TV_SERVICE_CHANNEL_MODE_UNDEFINED = -1,         /* Unknown mode */
-       TV_SERVICE_CHANNEL_MODE_ALL,                            /* ALL channel mode */
-       TV_SERVICE_CHANNEL_MODE_DIGITAL,                        /* Digital channel mode */
-       TV_SERVICE_CHANNEL_MODE_ANALOG,                         /* Analog channel mode */
-       TV_SERVICE_CHANNEL_MODE_DIGITAL_ANALOG,         /* Digital & Analog channel mode*/
-       TV_SERVICE_CHANNEL_MODE_FAVORITE,                       /* Analog channel mode */
-       TV_SERVICE_CHANNEL_MODE_ALL_DIGITAL_ANALOG      /* Digital & Analog channel mode (include delete channel)*/
-} TvServiceChannelMode;
-
-/**
- * An enumeration.
- * Enumeration for channel list sort type.
- */
-typedef enum
-{
-       CHANNEL_SORT_TYPE_MAJOR_MINOR_NUMBER = 0x0,
-       CHANNEL_SORT_TYPE_SERVICE_ID,
-       CHANNEL_SORT_TYPE_PROGRAM_NAME,
-       CHANNEL_SORT_TYPE_MAX
-} TvServiceChannelSortType;
-
-typedef enum
-{
-       TV_SERVICE_LIVE_EVENT_BEGIN,                    /* live event tune start*/
-       TV_SERVICE_LIVE_EVENT_TUNER_LOCK,               /* live event tune lock result*/
-       TV_SERVICE_LIVE_EVENT_CHANNEL_LOCK,             /* live event channel lock(video and audio mute)*/
-       TV_SERVICE_LIVE_EVENT_CHANNEL_UNLOCK,   /* live event channel unlock*/
-       TV_SERVICE_LIVE_EVENT_AUTO_DESTROY,             /* live event auto destroy*/
-       TV_SERVICE_LIVE_EVENT_RESOLUTION                /* live event resolution*/
-} TvServiceLiveEvent;
-typedef void (*TvServiceLiveCallback) (TvServiceLiveEvent event, gpointer user_data, const gpointer data);
-typedef struct
-{
-       gint freq;              /**the frequence*/
-       gint mod;               /**the modulation*/
-       gint apid;              /**the audio pid*/
-       gint vpid;              /**the videa pid*/
-       gint ppid;              /**the pmt pid*/
-       gint pro_num;   /**the program number*/
-} TvServiceLiveTuneInfo;
-
-typedef struct
-{
-       // TvServiceGenLive *proxy;                     /**the live proxy object*/
-       guint service_handle;                           /**the live service handle*/
-       gint antenna_type;                                      /**antenna type*/
-       gint service_id;                                        /**service id*/
-       gint unique;                                            /**identify*/
-       TvServiceLiveTuneInfo tune_info;        /**tune info*/
-       TvServiceLiveCallback call_back;        /**the call back function*/
-       gpointer user_data;                                     /**the user_data*/
-       gpointer window_id;                                     /**the window id*/
-} TvServiceLiveData;
-
-typedef gpointer TvServiceLive;
-
-typedef void* TvServiceEpg;
-
-typedef enum
-{
-       TVS_EPG_CREATE = 0,
-       TVS_EPG_DESTROY,
-       TVS_EPG_GET_CURRENT_PROGRAM,
-       TVS_EPG_GET_PROGRAM_LIST,
-       TVS_EPG_AUTO_DESTROY,
-       TVS_EPG_DATA_UPDATED
-} tvs_epg_event_e;
-
-typedef void (*TvServiceEpgCallback) (tvs_epg_event_e type, gpointer epg_data, gpointer user_data);
-
-typedef struct
-{
-       guint service_id;
-       guint event_id;
-       guint start_time;
-       guint etm_location;
-       guint length_in_seconds;
-       guint8 title_text[256];
-       guint current_time;
-       guint8 extended_text[256];
-} TvServiceEpgEventData;
-
-typedef enum
-{
-       TVS_MODULATION_TYPE_UNKNOWN = -1,
-       TVS_MODULATION_TYPE_QPSK,
-       TVS_MODULATION_TYPE_16QAM,
-       TVS_MODULATION_TYPE_32QAM,
-       TVS_MODULATION_TYPE_64QAM,
-       TVS_MODULATION_TYPE_128QAM,
-       TVS_MODULATION_TYPE_256QAM,
-       TVS_MODULATION_TYPE_AUTO_QAM,
-       TVS_MODULATION_TYPE_8VSB,
-       TVS_MODULATION_TYPE_16VSB,
-       TVS_MODULATION_TYPE_8PSK,
-       TVS_MODULATION_TYPE_NTSC,
-       TVS_MODULATION_TYPE_PAL,
-       TVS_MODULATION_TYPE_MAX
-} TvServiceModulationTpye;
-typedef enum
-{
-       TV_SERVICE_ANTENNA_TYPE_UNDEFINED = -1, /* Unknown type */
-       TV_SERVICE_ANTENNA_TYPE_AIR,                    /* Antenna air type */
-       TV_SERVICE_ANTENNA_TYPE_CABLE,                  /* Antenna cable type */
-       TV_SERVICE_ANTENNA_TYPE_ALL                             /*Antenna all type */
-} TvServiceAntenna;
-typedef enum
-{
-       TVS_VIDEO_TYPE_UNKNOWN = -1,
-       TVS_VIDEO_TYPE_MPEG2 ,
-       TVS_VIDEO_TYPE_H264,
-       TVS_VIDEO_TYPE_JPEG,
-       TVS_VIDEO_TYPE_AVS,
-       TVS_VIDEO_TYPE_MAX
-} TvServiceVideoType;
-
-typedef enum
-{
-       TVS_AUDIO_TYPE_UNKNOWN = -1,
-       TVS_AUDIO_TYPE_AC3,
-       TVS_AUDIO_TYPE_MPEG2,
-       TVS_AUDIO_TYPE_AAC,
-       TVS_AUDIO_TYPE_HE_AAC,
-       TVS_AUDIO_TYPE_MAX
-} TvServiceAudioType;
-typedef struct
-{
-       guint service_id;
-       guint frequency;
-       guint service_type;
-       guint channel_type;
-
-       gulong program_number;
-       gulong source_id;
-       gulong stream_id;
-       gulong pcr_id;
-       gulong major;
-       gulong minor;
-       gulong vpid;
-       gulong apid;
-       gulong pmt_pid;
-
-       gboolean hide_guide;
-       gboolean hidden;
-       gboolean locked;
-       gboolean remembered;
-       gboolean save_by_psi;
-       gboolean digital;
-       gboolean favorite;
-
-       gchar program_name[PROGRAM_NAME_MAX_LEN];
-
-       TvServiceModulationTpye modulation_type;
-       TvServiceAntenna antenna_type;
-       TvServiceVideoType video_type;
-       TvServiceAudioType audio_type;
-} TvServiceChannel;
-
-typedef enum {
-       CHANNEL_FILTER_MATCH_NONE = 0,
-       CHANNEL_FILTER_MATCH_EQUAL,
-       CHANNEL_FILTER_MATCH_MORE,
-       CHANNEL_FILTER_MATCH_LESS,
-       CHANNEL_FILTER_MATCH_UNEQUAL,
-       CHANNEL_FILTER_MATCH_CONTAIN,
-       CHANNEL_FILTER_MATCH_MAX
-} TvServiceChannelFilterMatchType;
-
-typedef enum {
-       TV_SERVICE_CHANNEL_DATA_NONE = 0,
-       TV_SERVICE_CHANNEL_DATA_SERVICE_ID,
-       TV_SERVICE_CHANNEL_DATA_FREQUENCY,
-       TV_SERVICE_CHANNEL_DATA_MAJOR_NUMBER,
-       TV_SERVICE_CHANNEL_DATA_MINOR_NUMBER,
-       TV_SERVICE_CHANNEL_DATA_PROGRAM_NAME,
-       TV_SERVICE_CHANNEL_DATA_REMEMBERED,
-       TV_SERVICE_CHANNEL_DATA_MAX
-} TvServiceChannelDataAttr;
-
-typedef struct {
-       TvServiceChannelDataAttr attribute;
-       TvServiceChannelFilterMatchType match_type;
-       GValue *value;
-} TvServiceFilterNode;
-
-typedef struct {
-       gint identity;
-       // TvServiceGenEpg *proxy;
-       TvServiceEpgCallback cb;
-       gboolean cb_flag;
-       gpointer user_data;
-       GList *event_list;
-} EpgProxyData;
-
-typedef struct {
-       guint service_id;
-       guint start_time;
-       guint duration;
-       TvServiceEpgCallback event_callback;
-       gpointer event_callback_userdata;
-} EpgProxyEventData;
-
-gint tv_service_live_get_service_id (TvServiceLive live, gint * service_id);
-gint tv_service_get_channel (gint service_id, TvServiceChannel * channel);
-gint tv_service_get_channel_list (TvServiceChannelMode mode, TvServiceAntenna type, GList ** channels);
-gint tv_service_get_channel_list_ex (TvServiceChannelMode mode, TvServiceAntenna type, GList ** channels,
-               GList * filter, TvServiceChannelSortType sort_type);
-gint tv_service_epg_get_current_program (TvServiceEpg epg, guint service_id, TvServiceEpgCallback callback_func, gpointer user_data);
-gint tv_service_epg_get_cache_current_program (TvServiceEpg epg, guint service_id, TvServiceEpgEventData * app_data);
-gint tv_service_epg_get_program_list (TvServiceEpg epg, guint service_id, guint start_time, guint duration, TvServiceEpgCallback callback_func, gpointer user_data);
-gint tv_service_live_create (TvServiceLive * live);
-gint tv_service_live_destroy (TvServiceLive live);
-gint tv_service_live_tune_locked_channel (TvServiceLive live, gint service_id, gchar * password);
-gint tv_service_epg_create (TvServiceEpg * epg);
-gint tv_service_epg_destroy (TvServiceEpg epg);
-gint tv_service_live_get_last_channel (gint * service_id);
-gint tv_service_live_get_antenna_type (TvServiceLive live, TvServiceAntenna * type);
-gint tv_service_live_tune (TvServiceLive live, gint service_id);
-gint tv_service_lock_channel (gint service_id, gchar * password);
-gint tv_service_unlock_channel (gint service_id, gchar * password);
-gint tv_service_live_tune_down(TvServiceLive live, gint channel_mode,
-               TvServiceAntenna antenna_type);
-gint tv_service_live_tune_up(TvServiceLive live, gint channel_mode,
-               TvServiceAntenna antenna_type);
-gint tv_service_add_favorite_channel(gint service_id);
-gint tv_service_delete_favorite_channel(gint service_id);
-gint tv_service_add_channel(gint service_id);
-gint tv_service_delete_channel(gint service_id);
-gint tv_service_live_get_audio_mute(TvServiceLive live_svc, gboolean *mute);
-gint tv_service_live_set_audio_mute(TvServiceLive live_svc, gboolean mute);
-gint tv_service_live_get_volume(TvServiceLive live_svc, gdouble *vol);
-gint tv_service_live_set_volume(TvServiceLive live_svc, gdouble vol);
-gint tv_service_live_set_window_overlay(TvServiceLive live_svc, void *window_id);
-gint tv_service_channel_info_create();
-gint tv_service_channel_info_destroy();
-gint tv_service_live_register_callback(TvServiceLive live_svc,
-               void *_tv_service_event_cb, void *some_other_variable);
index 10b9bef..fdae39f 100644 (file)
--- a/src/tv.c
+++ b/src/tv.c
 #include <app_debug.h>
 #include <app_contents.h>
 
+#include <tv_service_proxy.h>
+#include <tv_service_proxy_epg.h>
+
 #include <glib.h>
 #include <glib-object.h>
 
 #include "define.h"
 #include "tv.h"
-#include "tv_service.h"
 
 #define DEFAULT_SERVICE 1
 
index 89048ca..6a63655 100644 (file)
@@ -26,7 +26,8 @@
 
 #define HIDE_DUR 3.0
 #define BUF_MAX 128
-#define NUMBER_MAX 3
+#define INPUT_MAX 4
+#define NUMBER_MAX 2
 
 struct _priv {
        Evas_Object *base;
@@ -35,7 +36,7 @@ struct _priv {
 
        int major;
        int minor;
-       char number[NUMBER_MAX+1];
+       char number[INPUT_MAX+1];
 };
 
 static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
@@ -184,9 +185,17 @@ static void _update_channel_list(struct _priv *priv)
 
                elm_object_focus_allow_set(ly, EINA_TRUE);
 
-               snprintf(buf, sizeof(buf), "%ld %s",
-                               channel_info->channel_major,
-                               channel_info->channel_name);
+               if (channel_info->channel_minor > 0 &&
+                               channel_info->channel_minor < MINOR_MAX)
+                       snprintf(buf, sizeof(buf), "%lu-%lu %s",
+                                       channel_info->channel_major,
+                                       channel_info->channel_minor,
+                                       channel_info->channel_name);
+               else
+                       snprintf(buf, sizeof(buf), "%lu %s",
+                                       channel_info->channel_major,
+                                       channel_info->channel_name);
+
                elm_object_text_set(ly, buf);
 
                inputmgr_add_callback(ly, 0, &channel_handler,
@@ -213,13 +222,23 @@ static void _update_channel_list(struct _priv *priv)
 
 static void _update_number_info(struct _priv *priv)
 {
+       char buf[BUF_MAX] = "\0";
+
        if (!priv->number) {
                _ERR("Wrong channel number");
                return;
        }
 
-       elm_object_part_text_set(priv->base,
-                       PART_CHANNELNUMBER_NUMBER, priv->number);
+       if (strlen(priv->number) > NUMBER_MAX) {
+               strncpy(buf, priv->number, NUMBER_MAX);
+               strncat(buf, "-", 1);
+               strncat(buf, priv->number + NUMBER_MAX, NUMBER_MAX);
+               elm_object_part_text_set(priv->base,
+                               PART_CHANNELNUMBER_NUMBER, buf);
+       } else {
+               elm_object_part_text_set(priv->base,
+                               PART_CHANNELNUMBER_NUMBER, priv->number);
+       }
 
        _update_channel_list(priv);
 }
@@ -248,8 +267,9 @@ static int _get_number(const char *keyname)
 
 static void _number_reset(struct _priv *priv)
 {
-       memset(priv->number, '\0', sizeof(char) * NUMBER_MAX + 1);
-       priv->major = -1;
+       memset(priv->number, '\0', sizeof(char) * INPUT_MAX + 1);
+       priv->major = 0;
+       priv->minor = 0;
 
        _release_channel_handler(priv->list);
        elm_box_clear(priv->list);
@@ -257,17 +277,23 @@ static void _number_reset(struct _priv *priv)
 
 static void _number_tuning(struct _priv *priv, const char *keyname)
 {
+       char buf[BUF_MAX] = "\0";
+
        if (!keyname) {
                _ERR("failed to get keyname");
                return;
        }
 
        strncat(priv->number, keyname, 1);
-       priv->major = atoi(priv->number);
+       strncpy(buf, priv->number, INPUT_MAX);
+
+       priv->minor = atoi(buf + NUMBER_MAX);
+       buf[NUMBER_MAX] = '\0';
+       priv->major = atoi(buf);
 
        _update_number_info(priv);
 
-       if (strlen(priv->number) == NUMBER_MAX)
+       if (strlen(priv->number) >= INPUT_MAX)
                _done_input(priv);
 }