TizenRefApp-8075 [MomentBar] Implement displaying Smart Connectivity Status logic 80/116480/3 submit/submit/20170306.062530
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Fri, 24 Feb 2017 13:57:41 +0000 (15:57 +0200)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Mon, 27 Feb 2017 10:51:00 +0000 (12:51 +0200)
Change-Id: I14002aa49a875539bd7bcd990a06ab4bb79679ce

15 files changed:
.cproject
.project
edc/windicator_scs.edc
inc/windicator.h
inc/windicator_common_defines.h
inc/windicator_scs.h
inc/windicator_sim.h [new file with mode: 0644]
inc/windicator_util.h
src/windicator.c
src/windicator_call_fwd_btn.c
src/windicator_moment_bar.c
src/windicator_scs.c
src/windicator_sim.c [new file with mode: 0644]
src/windicator_util.c
tizen-manifest.xml

index 56c3689949d6a28d616488671edca3de23619bdb..c6eb5d3d5dc08ab050f6716142066b08df009eaf 100644 (file)
--- a/.cproject
+++ b/.cproject
@@ -27,7 +27,7 @@
                                                                <option defaultValue="gnu.cpp.compiler.debugging.level.max" id="sbi.gnu.cpp.compiler.option.debugging.level.core.962858057" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core" useByScannerDiscovery="false" valueType="enumerated"/>
                                                                <option defaultValue="false" id="sbi.gnu.cpp.compiler.option.misc.pic.core.58391715" name="-fPIC option" superClass="sbi.gnu.cpp.compiler.option.misc.pic.core" useByScannerDiscovery="false" valueType="boolean"/>
                                                                <option id="sbi.gnu.cpp.compiler.option.1123653317" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" useByScannerDiscovery="false" valueType="userObjs">
-                                                                       <listOptionValue builtIn="false" value="wearable-3.0-device.core.private_llvm37.armel.core.app"/>
+                                                                       <listOptionValue builtIn="false" value="wearable-3.0-emulator.core.private_llvm37.i386.core.app"/>
                                                                </option>
                                                                <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.144358111" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" useByScannerDiscovery="false" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
                                                                        <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/>
                                                                        <listOptionValue builtIn="false" value=" -fPIE"/>
                                                                        <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="-mthumb"/>
                                                                </option>
                                                                <option id="gnu.cpp.compiler.option.include.paths.508858681" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
                                                                <option id="sbi.gnu.cpp.compiler.option.frameworks.core.262941746" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" useByScannerDiscovery="false" valueType="userObjs">
                                                                        <listOptionValue builtIn="false" value="Native_API"/>
                                                                </option>
-                                                               <option id="gnu.cpp.compiler.option.dialect.std.535913412" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.default" valueType="enumerated"/>
+                                                               <option id="gnu.cpp.compiler.option.dialect.std.535913412" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.default" valueType="enumerated"/>
                                                                <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.536739457" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
                                                        </tool>
                                                        <tool command="clang" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.2003612124" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
                                                                <option defaultValue="gnu.c.debugging.level.max" id="sbi.gnu.c.compiler.option.debugging.level.core.73848575" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core" useByScannerDiscovery="false" valueType="enumerated"/>
                                                                <option defaultValue="false" id="sbi.gnu.c.compiler.option.misc.pic.core.1714132726" name="-fPIC option" superClass="sbi.gnu.c.compiler.option.misc.pic.core" useByScannerDiscovery="false" valueType="boolean"/>
                                                                <option id="sbi.gnu.c.compiler.option.63462056" name="Tizen-Target" superClass="sbi.gnu.c.compiler.option" useByScannerDiscovery="false" valueType="userObjs">
-                                                                       <listOptionValue builtIn="false" value="wearable-3.0-device.core.private_llvm37.armel.core.app"/>
+                                                                       <listOptionValue builtIn="false" value="wearable-3.0-emulator.core.private_llvm37.i386.core.app"/>
                                                                </option>
                                                                <option id="sbi.gnu.c.compiler.option.frameworks_inc.core.137361472" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" useByScannerDiscovery="false" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
                                                                        <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/>
                                                                        <listOptionValue builtIn="false" value=" -fPIE"/>
                                                                        <listOptionValue builtIn="false" value="--sysroot=&quot;${SBI_SYSROOT}&quot;"/>
-                                                                       <listOptionValue builtIn="false" value="-mthumb"/>
                                                                </option>
                                                                <option id="gnu.c.compiler.option.include.paths.1357431242" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/inc}&quot;"/>
                                                                <option id="sbi.gnu.c.compiler.option.frameworks.core.1718318742" name="Tizen-Frameworks" superClass="sbi.gnu.c.compiler.option.frameworks.core" useByScannerDiscovery="false" valueType="userObjs">
                                                                        <listOptionValue builtIn="false" value="Native_API"/>
                                                                </option>
-                                                               <option id="gnu.c.compiler.option.dialect.std.501038819" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
+                                                               <option id="gnu.c.compiler.option.dialect.std.501038819" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
                                                                <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1852229389" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
                                                        </tool>
                                                        <tool id="org.tizen.nativeide.tool.sbi.gnu.c.linker.base.211625142" name="C Linker" superClass="org.tizen.nativeide.tool.sbi.gnu.c.linker.base"/>
                                                                        <additionalInput kind="additionalinput" paths="$(LIBS)"/>
                                                                </inputType>
                                                        </tool>
-                                                       <tool command="arm-linux-gnueabi-as" id="org.tizen.nativeapp.tool.sbi.gnu.assembler.base.719331636" name="Assembler" superClass="org.tizen.nativeapp.tool.sbi.gnu.assembler.base">
+                                                       <tool command="i386-linux-gnueabi-as" id="org.tizen.nativeapp.tool.sbi.gnu.assembler.base.719331636" name="Assembler" superClass="org.tizen.nativeapp.tool.sbi.gnu.assembler.base">
                                                                <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1276583455" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
                                                        </tool>
                                                        <tool id="org.tizen.nativecore.tool.fnmapgen.1657025034" name="C FN-Map Generator" superClass="org.tizen.nativecore.tool.fnmapgen"/>
index 1b4aaddc12d466580e9ddc44ed60103f638b8590..2a5e7f10d3c389de4aefd8cd16c18a57b282bf16 100644 (file)
--- a/.project
+++ b/.project
@@ -31,7 +31,7 @@
        </natures>
        <filteredResources>
                <filter>
-                       <id>1487150657315</id>
+                       <id>1487950317033</id>
                        <name></name>
                        <type>26</type>
                        <matcher>
@@ -40,7 +40,7 @@
                        </matcher>
                </filter>
                <filter>
-                       <id>1487150657317</id>
+                       <id>1487950317034</id>
                        <name></name>
                        <type>6</type>
                        <matcher>
index bba5e2df7febd67057b7d0b2fde3f97d7f45838f..738530d134d06ca6bc587e5e38ad881a06d56592 100644 (file)
  * limitations under the License.
  */
 
+
+/* Connection type text */
+
+#define SCS_TXT_BASE_BT_PAD_T 147
+#define SCS_TXT_BASE_BT_PAD_B 141
+
+#define SCS_TXT_BASE_3G_PAD_T 102
+#define SCS_TXT_BASE_3G_PAD_B 184
+
+#define SCS_TXT_BASE_PAD_L 50
+#define SCS_TXT_BASE_PAD_R 50
+
+#define SCS_TXT_MIN_MAX_W (WIN_WIDTH - SCS_TXT_BASE_PAD_L - SCS_TXT_BASE_PAD_R)
+#define SCS_TXT_MIN_H 37
+#define SCS_TXT_MAX_H 74
+
+/* Sim state text */
+
+#define SCS_SIM_TXT_BASE_PAD_T 180
+#define SCS_SIM_TXT_BASE_PAD_B 116
+
+#define SCS_SIM_TXT_BASE_PAD_L 114
+#define SCS_SIM_TXT_BASE_PAD_R 114
+
+#define SCS_SIM_TXT_MIN_MAX_W (WIN_WIDTH - SCS_SIM_TXT_BASE_PAD_L - SCS_SIM_TXT_BASE_PAD_R)
+#define SCS_SIM_TXT_MIN_H 32
+#define SCS_SIM_TXT_MAX_H 64
+
+/* Connection type icon */
+
+#define SCS_CONNECTION_ICON_SIZE_W 30
+#define SCS_CONNECTION_ICON_SIZE_H 38
+
 styles {
-       style {
-               name: "style_txt_sim_state";
-               base: "font=Tizen:style=Regular font_size=24 align=center color=#ffffffff color_class=AT013 wrap=mixed text_class=AT013";
-               tag: "br" "\n";
-               tag: "hilight" "+ color=#ffff";
-               tag: "b" "+ color=#ffff";
-               tag: "tab" "\t";
-       }
-       style {
-               name: "style_txt_scs";
-               base: "font=Tizen:style=Regular font_size=28 align=center color=#ffffffff color_class=AT011 wrap=mixed text_class=AT011";
-               tag: "br" "\n";
-               tag: "hilight" "+ color=#ffff";
-               tag: "b" "+ color=#ffff";
-               tag: "tab" "\t";
+       style { name : "style_txt_scs";
+               base : "font=Tizen font_weight=Normal font_width=Condensed font_size=28 align=center valign=center color=#ffffffff wrap=mixed ellipsis=1.0";
+               tag : "br" "\n";
+               tag : "hilight" "+ color=#ffff";
+               tag : "b" "+ color=#ffff";
+               tag : "tab" "\t";
        }
-       style {
-               name: "style_txt_scs_verizon";
-               base: "font=Tizen:style=Regular font_size=24 align=center color=#ffffffff color_class=AT018 wrap=mixed text_class=AT018";
-               tag: "br" "\n";
-               tag: "hilight" "+ color=#ffff";
-               tag: "b" "+ color=#ffff";
-               tag: "tab" "\t";
+       style { name : "style_txt_sim_state";
+               base : "font=Tizen font_weight=Normal font_width=Condensed font_size=24 align=center valign=center color=#0092faff wrap=mixed ellipsis=1.0";
+               tag : "br" "\n";
+               tag : "hilight" "+ color=#ffff";
+               tag : "b" "+ color=#ffff";
+               tag : "tab" "\t";
        }
 }
 
-group {
-       name : "windicator/scs";
+group { name : "windicator/scs";
        images {
                image : "b_moment_3g_more_opt_bluetooth_ic.png" COMP;
                image : "b_moment_3g_more_opt_remotely_ic.png" COMP;
                image : "b_moment_3g_more_opt_standalone_ic.png" COMP;
        }
        parts {
-               part {
-                       name : "bg";
+               part { name : "bg";
                        type : SPACER;
-                       scale :1;
-                       description {
-                               state : "default";
-                               min : WIN_WIDTH WIN_HEIGHT;
-                               max : WIN_WIDTH WIN_HEIGHT;
+                       scale : 1;
+                       description { state : "default";
                        }
                }
-               part {
-                       name : "icon.scs";
-                       type : IMAGE;
-                       clip_to : "clipper_scs";
+               part { name : "txt.scs.base.pad.left";
+                       type : SPACER;
                        scale : 1;
-                       description {
-                               state : "default" 0.0;
+                       description { state : "default";
                                align : 0.0 0.0;
-                               color_class : "AO0111";
-                               rel1 { relative : 162/360 125/360; to : "bg";}
-                               rel2 { relative : 198/360 163/360; to : "bg";}
-                               image.normal : "b_moment_3g_more_opt_standalone_ic.png";
-                       }
-                       description {
-                               state : "remotely_ic";
-                               inherit: "default" 0.0;
-                               image.normal : "b_moment_3g_more_opt_remotely_ic.png";
-                       }
-                       description {
-                               state : "bt_ic";
-                               inherit: "default" 0.0;
-                               rel1 { relative : 162/360 107/360; to : "bg";}
-                               rel2 { relative : 198/360 145/360; to : "bg";}
-                               image.normal : "b_moment_3g_more_opt_bluetooth_ic.png";
+                               fixed : 1 0;
+                               rel2 { relative : 0.0 1.0; to : "bg";}
+                               min : SCS_TXT_BASE_PAD_L 0;
                        }
                }
-
-               part {
-                       name : "txt.scs";
-                       type : TEXTBLOCK;
-                       clip_to : "clipper_scs";
+               part { name : "txt.scs.base.pad.right";
+                       type : SPACER;
                        scale : 1;
-                       description{
-                               state : "default" 0.0;
-                               min : 260 37;
-                               max : 260 74;
-                               fixed : 1 1;
-                               color_class : "AT011";
-                               align : 0.5 0.0;
-                               rel1 { relative: 0.5 1.0; to_x: "bg"; to_y: "icon.scs"; }
-                               rel2 { relative: 0.5 1.0; to_x: "bg"; to_y: "icon.scs"; }
-                               text {
-                                       align : 0.5 0.5;
-                                       min : 0 1;
-                                       style : "style_txt_scs";
-                               }
-                       }
-                       description {
-                               state: "bt_ic" 0.0;
-                               inherit: "default";
-                               text {
-                                       align : 0.5 0.5;
-                                       min : 0 1;
-                                       style : "style_txt_scs";
-                               }
+                       description { state : "default";
+                               align : 1.0 0.0;
+                               fixed : 1 0;
+                               rel1 { relative : 1.0 0.0; to : "bg";}
+                               min : SCS_TXT_BASE_PAD_R 0;
                        }
                }
-               part {
-                       name : "padding.sim_state.top";
-                       type : RECT;
+               part { name : "txt.scs.base.pad.top";
+                       type : SPACER;
                        scale : 1;
-                       description {
-                               state : "default";
-                               min : 360 7;
-                               max : 360 7;
-                               fixed: 1 1;
-                               color :0 0 200 0;
-                               align : 0.5 0.0;
-//                             rel1 { relative : 0.5 1.0; to : "txt.scs";}
-                               rel1 { relative: 0.5 1.0; to_x: "bg"; to_y: "txt.scs"; }
-//                             rel2 { relative : 0.5 1.0; to : "txt.scs";}
-                               rel2 { relative: 0.5 1.0; to_x: "bg"; to_y: "txt.scs"; }
+                       description { state : "default";
+                               align : 0.0 0.0;
+                               fixed : 0 1;
+                               rel2.relative : 1.0 0.0;
+                               min : 0 SCS_TXT_BASE_BT_PAD_T;
                        }
-               }
-               part {
-                       name : "txt.sim_state";
-                       type : TEXTBLOCK;
-                       clip_to : "clipper_scs";
-                       scale : 1;
-                       description {
-                               state : "default" 0.0;
-                       //      color_class : "AT017";
-                               min : 150 32;
-                               max : 150 100;
-                       //      fixed : 1 1;
-                               align : 0.5 0.0;
-                               rel1 { relative : 0.5 1.0; to : "padding.sim_state.top";}
-                               rel2 { relative : 0.5 1.0; to : "padding.sim_state.top";}
-                               text {
-                                       align : 0.5 0.0;
-                                       min : 0 1;
-                                       style : "style_txt_sim_state";
-                                       text : "PLMN / SPN";
-                               //      text_class : "AT017";
-                               }
+                       description { state : "bt_mode";
+                               inherit : "default" 0.0;
                        }
-                       description {
-                               state : "hide";
-                               inherit: "default" 0.0;
-                               visible :0;
+                       description { state : "3g_mode";
+                               inherit : "default" 0.0;
+                               min : 0 SCS_TXT_BASE_3G_PAD_T;
                        }
                }
-               part {
-                       name: "clipper_scs";
-                       type: RECT;
-                       scale: 1;
-                       mouse_events: 0;
-                       description {
-                               state: "default" 0.0;
-                               color: 255 255 255 255;
-                               rel1.to: "bg";
-                               rel2.to: "bg";
+               part { name : "txt.scs.base.pad.bottom";
+                       type : SPACER;
+                       scale : 1;
+                       description { state : "default";
+                               align : 0.0 1.0;
+                               fixed : 0 1;
+                               rel1.relative : 0.0 1.0;
+                               min : 0 SCS_TXT_BASE_BT_PAD_B;
                        }
-                       description {
-                               state: "fade_in" 0.0;
-                               inherit: "default";
-                               color: 255 255 255 255;
+                       description { state : "bt_mode";
+                               inherit : "default" 0.0;
                        }
-               }
-       }
-       programs {
-               program {
-                       name : "icon,scs,not,connected";
-                       signal : "icon,scs,not,connected";
-                       source : "icon.scs";
-                       action : STATE_SET "default" 0.0;
-                       target : "icon.scs";
-                       target : "txt.scs";
-               }
-               program {
-                       name : "icon,scs,connected,remotely";
-                       signal : "icon,scs,connected,remotely";
-                       source : "icon.scs";
-                       action : STATE_SET "remotely_ic" 0.0;
-                       target : "icon.scs";
-               }
-               program {
-                       name : "icon,scs,connected,bt";
-                       signal : "icon,scs,connected,bt";
-                       source : "icon.scs";
-                       action : STATE_SET "bt_ic" 0.0;
-                       target : "icon.scs";
-                       target : "txt.scs";
-               }
-               program {
-                       name : "txt.sim_state.hide";
-                       signal : "txt.sim_state.hide";
-                       source : "txt.sim_state";
-                       action : STATE_SET "hide" 0.0;
-                       target : "txt.sim_state";
-               }
-               // Hide
-/*             program {
-                       name: "scs_hide";
-                       signal: "scs_hide";
-                       source: "clipper_scs";
-                       action: STATE_SET "default" 0.0;
-                       target: "clipper_scs";
-                       after: "scs_fade_out_end";
-               }*/
-               // Fade In effect
-/*             program {
-                       name: "scs_fade_out";
-                       signal: "scs_fade_out";
-                       source: "clipper_scs";
-                       action: STATE_SET "default" 0.0;
-                       target: "clipper_scs";
-                       transition: ACCEL_FAC 0.1 0.33;
-                       after: "scs_fade_out_end";
-               }
-               program {
-                       name: "scs_fade_out_long";
-                       signal: "scs_fade_out_long";
-                       source: "clipper_scs";
-                       action: STATE_SET "default" 0.0;
-                       target: "clipper_scs";
-                       transition: ACCEL_FAC 0.175 0.33;
-                       after: "scs_fade_out_end";
-               }
-               program {
-                       name : "scs_fade_out_end";
-                       action : SIGNAL_EMIT "scs_fade_out_end" "signal";
-               }
-               // Fade Out effect
-               program {
-                       name: "scs_fade_in";    // Do nothing for 0.1 second.
-                       signal: "scs_fade_in";
-                       source: "clipper_scs";
-                       action: STATE_SET "default" 0.0;
-                       target: "clipper_scs";
-                       transition: ACCEL_FAC 0.1 0.33;
-                       after : "scs_fade_in_start";
-               }
-               program {
-                       name: "scs_fade_in_long";       // Do nothing for 0.175 second.
-                       signal: "scs_fade_in_long";
-                       source: "clipper_scs";
-                       action: STATE_SET "default" 0.0;
-                       target: "clipper_scs";
-                       transition: ACCEL_FAC 0.175 0.33;
-                       after : "scs_fade_in_start_long";
-               }
-               program {
-                       name: "scs_fade_in_start";
-                       signal: "scs_fade_in";
-                       source: "clipper_scs";
-                       action: STATE_SET "fade_in" 0.0;
-                       target: "clipper_scs";
-                       transition: ACCEL_FAC 0.1 0.33;
-               }
-               program {
-                       name: "scs_fade_in_start_long";
-                       signal: "scs_fade_in";
-                       source: "clipper_scs";
-                       action: STATE_SET "fade_in" 0.0;
-                       target: "clipper_scs";
-                       transition: ACCEL_FAC 0.175 0.33;
-               }*/
-       }
-}
-
-
-
-group {
-       name : "windicator/scs/verizon";
-       images {
-               image : "b_moment_3g_more_opt_bluetooth_ic.png" COMP;
-               image : "b_moment_3g_more_opt_remotely_ic.png" COMP;
-               image : "b_moment_3g_more_opt_standalone_ic.png" COMP;
-               image : "VZW/vzw_standalone_ic.png" COMP;
-               image : "VZW/vzw_bluetooth_ic.png" COMP;
-               image : "VZW/vzw_remotely_ic.png" COMP;
-               image : "VZW/vzw_requsted_ic.png" COMP;
-       }
-       parts {
-               part {
-                       name : "bg";
-                       type : SPACER;
-                       scale :1;
-                       description {
-                               state : "default";
-                               min : WIN_WIDTH WIN_HEIGHT;
-                               max : WIN_WIDTH WIN_HEIGHT;
+                       description { state : "3g_mode";
+                               inherit : "default" 0.0;
+                               min : 0 SCS_TXT_BASE_3G_PAD_B;
                        }
                }
-               part {
-                       name : "padding.top";
+               part { name : "txt.scs.base";
                        type : SPACER;
                        scale : 1;
-                       description {
-                               state : "default";
-                               min : WIN_WIDTH 98;
-                               max : WIN_WIDTH 98;
-                               fixed: 1 1;
-                               align : 0.0 0.0;
-               //              color :200 0 0 200;
-                               rel1 { relative : 0.0 0.0; to : "bg";}
-                               rel2 { relative : 0.0 0.0; to : "bg";}
+                       description { state : "default";
+                               fixed : 1 1;
+                               rel1 { relative : 1.0 1.0; to_x : "txt.scs.base.pad.left"; to_y : "txt.scs.base.pad.top"; }
+                               rel2 { relative : 0.0 0.0; to_x : "txt.scs.base.pad.right"; to_y : "txt.scs.base.pad.bottom"; }
                        }
                }
-               part {
-                       name : "txt.scs";
+               part { name : "txt.scs";
                        type : TEXTBLOCK;
-                       clip_to : "clipper_scs";
                        scale : 1;
-                       description{
-                               state : "default" 0.0;
-                       //      min : 260 37;
-                       //      max : 260 74;
-                               color_class : "AT018";
-                               align : 0.5 0.0;
-                               rel1 { relative : 0.5 1.0; to_x : "bg"; to_y : "padding.top"; offset : 14 0;}
-                               rel2 { relative : 0.5 1.0; to_x : "bg"; to_y : "padding.top"; offset : 14 0;}
+                       description { state : "default" 0.0;
+                               fixed : 1 1;
+                               rel1 { relative : 0.0 0.5; to : "txt.scs.base"; }
+                               rel2 { relative : 1.0 0.5; to : "txt.scs.base"; }
+                               min : SCS_TXT_MIN_MAX_W SCS_TXT_MIN_H;
+                               max : SCS_TXT_MIN_MAX_W SCS_TXT_MAX_H;
                                text {
-                                       align : 0.0 0.5;
-                                       min : 1 1;
-                                       style : "style_txt_scs_verizon";
-                                       text : "Call forwarding requested";
-                                       text_class : "AT018";
+                                       align : 0.5 0.5;
+                                       min : 0 1;
+                                       style : "style_txt_scs";
                                }
                        }
                }
-               part {
-                       name : "padding.center.1";
-                       type : SPACER;
-                       scale : 1;
-                       description {
-                               state : "default";
-                               min : 2 32;
-                               max : 2 32;
-//                             fixed: 1 1;
-                               align : 1.0 0.0;
-                               rel1 { relative : 0.0 1.0; to_x : "txt.scs"; to_y : "padding.top";}
-                               rel2 { relative : 0.0 1.0; to_x : "txt.scs"; to_y : "padding.top";}
-                       }
-               }
-               part {
-                       name : "icon.scs";
+               part { name : "icon.scs";
                        type : IMAGE;
                        scale : 1;
                        description {
-                               state : "default";
-                               min : 26 32;
-                               max : 26 32;
-//                             fixed: 1 1;
-                               align : 1.0 0.0;
-                               rel1 { relative : 0.0 1.0; to_x : "padding.center.1"; to_y : "padding.top";}
-                               rel2 { relative : 0.0 1.0; to_x : "padding.center.1"; to_y : "padding.top";}
-                               image.normal : "VZW/vzw_standalone_ic.png";
+                               state : "default" 0.0;
+                               align : 0.5 1.0;
+                               rel1 { relative : 0.0 0.0; to_y : "txt.scs";}
+                               rel2 { relative : 1.0 0.0; to_y : "txt.scs";}
+                               color_class : "AO0111";
+                               min : SCS_CONNECTION_ICON_SIZE_W SCS_CONNECTION_ICON_SIZE_H;
+                               max : SCS_CONNECTION_ICON_SIZE_W SCS_CONNECTION_ICON_SIZE_H;
+                               image.normal : "b_moment_3g_more_opt_standalone_ic.png";
                        }
-                       description {
-                               state : "remotely_ic";
-                               inherit: "default" 0.0;
-                               image.normal : "VZW/vzw_remotely_ic.png";
+                       description { state : "standalone";
+                               inherit : "default" 0.0;
                        }
-                       description {
-                               state : "bt_ic";
-                               inherit: "default" 0.0;
-                               image.normal : "VZW/vzw_bluetooth_ic.png";
+                       description { state : "remotely_connected";
+                               inherit : "default" 0.0;
+                               image.normal : "b_moment_3g_more_opt_remotely_ic.png";
+                       }
+                       description { state : "connected_bluetooth";
+                               inherit : "default" 0.0;
+                               image.normal : "b_moment_3g_more_opt_bluetooth_ic.png";
                        }
                }
-
-
-
-/* Requested Text */
-               part {
-                       name : "txt.callfwd.request";
-                       type : TEXTBLOCK;
-                       clip_to : "clipper_scs";
+               part { name : "txt.sim_state.base.pad.left";
+                       type : SPACER;
                        scale : 1;
-                       description{
-                               state : "default" 0.0;
-                               min : 0 32;
-                       //      max : 360 74;
-                               color_class : "AT018";
-                               align : 0.5 0.0;
-                               rel1 { relative: 0.5 1.0; to_x: "bg"; to_y: "icon.scs";  offset : 14 0;}
-                               rel2 { relative: 0.5 1.0; to_x: "bg"; to_y: "icon.scs";  offset : 14 0;}
-                               text {
-                                       align : 0.5 0.5;
-                                       min : 1 1;
-                                       style : "style_txt_scs_verizon";
-                                       text : "Call forwarding requested";
-                                       text_class : "AT018";
-                               }
-                       }
-                       description {
-                               state : "hide";
-                               inherit: "default" 0.0;
-                               min : 0 0;
+                       description { state : "default";
+                               align : 0.0 0.0;
+                               fixed : 1 0;
+                               rel2 { relative : 0.0 1.0; to : "bg";}
+                               min : SCS_SIM_TXT_BASE_PAD_L 0;
                        }
                }
-               part {
-                       name : "padding.center.2";
+               part { name : "txt.sim_state.base.pad.right";
                        type : SPACER;
                        scale : 1;
-                       description {
-                               state : "default";
-                               min : 2 32;
-                               max : 2 32;
-//                             color :200 0 0 200;
-//                             fixed: 1 1;
+                       description { state : "default";
                                align : 1.0 0.0;
-                               rel1 { relative : 0.0 1.0; to_x : "txt.callfwd.request"; to_y : "icon.scs";}
-                               rel2 { relative : 0.0 1.0; to_x : "txt.callfwd.request"; to_y : "icon.scs";}
-                       }
-                       description {
-                               state : "hide";
-                               inherit: "default" 0.0;
-                               min : 0 0;
+                               fixed : 1 0;
+                               rel1 { relative : 1.0 0.0; to : "bg";}
+                               min : SCS_SIM_TXT_BASE_PAD_R 0;
                        }
                }
-               part {
-                       name : "requested.icon.scs";
-                       type : IMAGE;
+               part { name : "txt.sim_state.base.pad.top";
+                       type : SPACER;
                        scale : 1;
-                       description {
-                               state : "default";
-                               min : 26 32;
-                               max : 26 32;
-//                             fixed: 1 1;
-                               align : 1.0 0.0;
-                               rel1 { relative : 0.0 1.0; to_x : "padding.center.2"; to_y : "icon.scs";}
-                               rel2 { relative : 0.0 1.0; to_x : "padding.center.2"; to_y : "icon.scs";}
-                               image.normal : "VZW/vzw_requsted_ic.png";
+                       description { state : "default";
+                               align : 0.0 0.0;
+                               fixed : 0 1;
+                               rel2.relative : 1.0 0.0;
+                               min : 0 SCS_SIM_TXT_BASE_PAD_T;
                        }
-                       description {
-                               state : "hide";
-                               inherit: "default" 0.0;
-                               min : 0 0;
+               }
+               part { name : "txt.sim_state.base.pad.bottom";
+                       type : SPACER;
+                       scale : 1;
+                       description { state : "default";
+                               align : 0.0 1.0;
+                               fixed : 0 1;
+                               rel1.relative : 0.0 1.0;
+                               min : 0 SCS_SIM_TXT_BASE_PAD_B;
                        }
                }
-
-/* PLMN (SIM STATE) */
-               part {
-                       name : "padding.sim_state.top";
-                       type : RECT;
+               part { name : "txt.sim_state.base";
+                       type : SPACER;
                        scale : 1;
-                       description {
-                               state : "default";
-                               min : 360 7;
-                               max : 360 7;
-                               fixed: 1 1;
-                               color :0 0 200 0;
-                               align : 0.5 0.0;
-//                             rel1 { relative : 0.5 1.0; to : "txt.scs";}
-                               rel1 { relative: 0.5 1.0; to_x: "bg"; to_y: "requested.icon.scs"; }
-//                             rel2 { relative : 0.5 1.0; to : "txt.scs";}
-                               rel2 { relative: 0.5 1.0; to_x: "bg"; to_y: "requested.icon.scs"; }
+                       description { state : "default";
+                               fixed : 1 1;
+                               rel1 { relative : 1.0 1.0; to_x : "txt.sim_state.base.pad.left"; to_y : "txt.sim_state.base.pad.top"; }
+                               rel2 { relative : 0.0 0.0; to_x : "txt.sim_state.base.pad.right"; to_y : "txt.sim_state.base.pad.bottom"; }
                        }
                }
-               part {
-                       name : "txt.sim_state";
+               part { name : "txt.sim_state";
                        type : TEXTBLOCK;
-                       clip_to : "clipper_scs";
                        scale : 1;
-                       description {
-                               state : "default" 0.0;
-                       //      color_class : "AT017";
-                               min : 150 32;
-                               max : 150 100;
-                       //      fixed : 1 1;
-                               align : 0.5 0.0;
-                               rel1 { relative : 0.5 1.0; to : "padding.sim_state.top";}
-                               rel2 { relative : 0.5 1.0; to : "padding.sim_state.top";}
+                       description { state : "default" 0.0;
+                               visible : 0;
+                               fixed : 1 1;
+                               rel1 { relative : 0.0 0.5; to : "txt.sim_state.base"; }
+                               rel2 { relative : 1.0 0.5; to : "txt.sim_state.base"; }
+                               min : SCS_SIM_TXT_MIN_MAX_W SCS_SIM_TXT_MIN_H;
+                               max : SCS_SIM_TXT_MIN_MAX_W SCS_SIM_TXT_MAX_H;
                                text {
-                                       align : 0.5 0.0;
+                                       align : 0.5 0.5;
                                        min : 0 1;
                                        style : "style_txt_sim_state";
-                               //      text_class : "AT017";
                                }
                        }
-                       description {
-                               state : "hide";
-                               inherit: "default" 0.0;
-                               visible :0;
+                       description { state : "show";
+                               inherit : "default" 0.0;
+                               visible : 1;
                        }
-               }
-               part {
-                       name: "clipper_scs";
-                       type: RECT;
-                       scale: 1;
-                       mouse_events: 0;
-                       description {
-                               state: "default" 0.0;
-                               color: 255 255 255 255;
-                               rel1.to: "bg";
-                               rel2.to: "bg";
-                       }
-                       description {
-                               state: "fade_in" 0.0;
-                               inherit: "default";
-                               color: 255 255 255 255;
+                       description { state : "hide";
+                               inherit : "default" 0.0;
                        }
                }
        }
        programs {
-               program {
-                       name : "icon,scs,not,connected";
-                       signal : "icon,scs,not,connected";
+               program { name : "standalone";
+                       signal : "standalone";
                        source : "icon.scs";
-                       action : STATE_SET "default" 0.0;
+                       action : STATE_SET "standalone" 0.0;
                        target : "icon.scs";
                }
-               program {
-                       name : "icon,scs,connected,remotely";
-                       signal : "icon,scs,connected,remotely";
+               program { name : "remotly_connected";
+                       signal : "remotly_connected";
                        source : "icon.scs";
-                       action : STATE_SET "remotely_ic" 0.0;
+                       action : STATE_SET "remotely_connected" 0.0;
                        target : "icon.scs";
                }
-               program {
-                       name : "icon,scs,connected,bt";
-                       signal : "icon,scs,connected,bt";
+               program { name : "bluetooth_connected";
+                       signal : "bluetooth_connected";
                        source : "icon.scs";
-                       action : STATE_SET "bt_ic" 0.0;
+                       action : STATE_SET "connected_bluetooth" 0.0;
                        target : "icon.scs";
                }
-               program {
-                       name : "txt.sim_state.hide";
-                       signal : "txt.sim_state.hide";
-                       source : "txt.sim_state";
+               program { name : "sim_state.hide";
                        action : STATE_SET "hide" 0.0;
                        target : "txt.sim_state";
                }
-               /* call forwarding request type */
-               program {
-                       name : "icon,callfwd.request.show";
-                       signal : "icon,callfwd.request.show";
-                       source : "txt.callfwd.request";
-                       action : STATE_SET "default" 0.0;
-                       target : "txt.callfwd.request";
-                       target : "requested.icon.scs";
-                       target : "padding.center.2";
+               program { name : "sim_state.show";
+                       action : STATE_SET "show" 0.0;
+                       target : "txt.sim_state";
                }
-               program {
-                       name : "icon,callfwd.request.hide";
-                       signal : "icon,callfwd.request.hide";
-                       source : "txt.callfwd.request";
-                       action : STATE_SET "hide" 0.0;
-                       target : "txt.callfwd.request";
-                       target : "requested.icon.scs";
-                       target : "padding.center.2";
+               program { name : "3g_mode";
+                       signal : "3g_mode";
+                       source : "scs";
+                       action : STATE_SET "3g_mode" 0.0;
+                       target : "txt.scs.base.pad.top";
+                       target : "txt.scs.base.pad.bottom";
+                       after : "sim_state.show";
+               }
+               program { name : "bt_mode";
+                       signal : "bt_mode";
+                       source : "scs";
+                       action : STATE_SET "bt_mode" 0.0;
+                       target : "txt.scs.base.pad.top";
+                       target : "txt.scs.base.pad.bottom";
+                       after : "sim_state.hide";
                }
        }
 }
index c75a657b51d7b193834557b7e77459f3bd45ff23..0c56574d3a2a2dd467a63f0e48b7db5ce96ca36d 100755 (executable)
@@ -32,6 +32,7 @@
 
 #include "windicator_common_types.h"
 #include "windicator_common_defines.h"
+#include "windicator_sim.h"
 
 struct appdata {
        /* Common variables */
@@ -166,6 +167,8 @@ struct appdata {
 
        bundle* content;
        widget_context_h context;
+
+       windicator_sim_h sim_h;
 };
 
 /*
index f1012275e7de54cdb3e8030bfc73109272a27e70..0db8dd1ec4bf90f63f8a382eb1a98fee90ed5c51 100644 (file)
 
 #define WINDICATOR_THEME_PATH windicator_util_get_edje_path()
 
+#define ARRAY_ITEMS_COUNT(x) sizeof(x)/sizeof(x[0])
+
+#undef IS_STRING_EMPTY
+#define IS_STRING_EMPTY(x) !(x && x[0] != '\0')
+
+#undef FREE
+#define FREE(ptr) \
+       do { \
+               free(ptr); \
+               ptr = NULL; \
+       } while (0)
+
 #endif /* __WINDICATOR_COMMON_DEFINES_H__ */
index d67e149a8ede9d1386c9fcb979e82908134edd44..d00ba927618a6caa1ec10f63b14933bb12d35ca1 100644 (file)
@@ -34,21 +34,21 @@ windicator_error_e windicator_scs_update(void *data);
 Evas_Object *windicator_scs_layout_create(Evas_Object *parent, void *data);
 
 /*
-* @brief: Delets scs layout
+* @brief: Deletes scs layout
 * @param[in] data: User data
 */
 void windicator_scs_layout_destroy(void *data);
 
 /*
-* @brief: Register scs vconf keys
+* @brief: Registers scs
 * @param[in] data: User data
 */
-windicator_error_e windicator_scs_vconfkey_register(void *data);
+windicator_error_e windicator_scs_register(void *data);
 
 /*
-* @brief: unregister scs vconf keys
+* @brief: Unregisters scs
 * @param[in] data: User data
 */
-void windicator_scs_vconfkey_unregister(void);
+void windicator_scs_unregister(void *data);
 
 #endif /* __WINDICATOR_SCS_H__ */
diff --git a/inc/windicator_sim.h b/inc/windicator_sim.h
new file mode 100644 (file)
index 0000000..223b6ba
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Samsung API
+ * Copyright (c) 2013 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.
+ */
+
+#ifndef __WINDICATOR_SIM_H__
+#define __WINDICATOR_SIM_H__
+
+#include <stdbool.h>
+
+typedef enum {
+       WINDICATOR_PRIMARY_SIM = 0,
+       WINDICATOR_SECONDARY_SIM,
+       WINDICATOR_SIM_COUNT,
+} windicator_sim_num_e;
+
+typedef struct _windicator_sim *windicator_sim_h;
+
+typedef void (*windicator_sim_info_update_cb)(void *user_data);
+
+/**
+ * @brief Creates sim handler.
+ * @return: new sim handler instance on success, or NULL otherwise.
+ */
+windicator_sim_h windicator_sim_create();
+
+/**
+ * @brief Destroys sim handler.
+ * @param[in] sim_h: Sim handler
+ */
+void windicator_sim_destroy(windicator_sim_h sim_h);
+
+/**
+ * @brief Get current PLMN information for given sim
+ * @param[in] sim_h: Sim handler
+ * @param[in] sim_num: Sim number
+ */
+const char *windicator_sim_get_plmn_spn(windicator_sim_h sim_h, windicator_sim_num_e sim_num);
+
+/**
+ * @brief Set sim info update callback
+ * @param[in] sim_h: Sim handler
+ * @param[in] cb_func: Callback function
+ * @param[in] cb_data: Callback data
+ * @return: true on success and false otherwise
+ */
+bool windicator_sim_set_update_info_cb(windicator_sim_h sim_h, windicator_sim_info_update_cb cb_func, void *cb_data);
+
+#endif /* __WINDICATOR_SIM_H__ */
index 60ef83d5daf07cb53c093075a8499501ab9ede90..8c1b3b8fb026370eef6ee8637e2d98e7996ddfff 100644 (file)
@@ -71,8 +71,9 @@ void windicator_util_event_register(void *data);
 
 /*
 * @brief:  Unregisters the events with vconf
+* @param[in]data: User data
 */
-void windicator_util_event_unregister();
+void windicator_util_event_unregister(void *data);
 
 /*
 * @brief:  Finds the application path
index e97f1a5946cb8d125fce3a042cb3cabf08bb494f..072664a1f119630f406aa5b9942836e60c0e0431 100755 (executable)
@@ -30,6 +30,7 @@
 #include "windicator_call_fwd_btn.h"
 #include "windicator_dnd_btn.h"
 #include "windicator_dynamic.h"
+#include "windicator_flight_mode.h"
 #include "windicator_moment_bar.h"
 #include "windicator_moment_view.h"
 #include "windicator_scs.h"
@@ -38,6 +39,7 @@
 #include "windicator_common.h"
 
 #define MOMENT_VIEW_HEIGHT 105;
+#define LOCALE_DIR_BUF_SIZE 256
 
 struct appdata *g_ad = NULL;
 
@@ -143,17 +145,17 @@ static void _init_variables(void *data)
 
        /* Moment View - Battery */
        ad->moment_view_battery_icon = NULL;
+
+       ad->sim_h = NULL;
 }
 
 /*
 * @brief: Creates moment bar window
 * @param[in] user_data: User data
 */
-void create_moments_bar_win(void *user_data)
+static void _create_moments_bar_win(void *user_data)
 {
        struct appdata *ad = (struct appdata *)user_data;
-       //elm_config_preferred_engine_set("opengl_x11");
-       _init_variables(ad);
 
 #ifndef __W_HOME_WIDGET__
        tzsh_quickpanel_service_h qp_service;
@@ -222,25 +224,28 @@ static bool app_create(void *data)
 #endif
        g_ad = ad;
 
+       elm_app_base_scale_set(1.3);
+
+       _init_variables(ad);
+
        if (windicator_common_is_3g_supported()) {
-               _D("TIZEN_3G_ENABLE");
+               _D("3G MODE");
+               ad->sim_h = windicator_sim_create();
+               if (!ad->sim_h) {
+                       _E("Failed to create sim handler. No info about 3g network will be provided.");
+               }
        } else {
-               _D("TIZEN_BT");
+               _D("BT MODE");
        }
 
-
-       elm_app_base_scale_set(1.3);
-       create_moments_bar_win(ad);
-
+       _create_moments_bar_win(ad);
        windicator_util_event_register(ad);
-
        windicator_update_ui_components(ad);
 
-       char* respath = app_get_resource_path();
-       char locale_path[256] = {0,};
-       snprintf(locale_path,sizeof(locale_path),"%s/locale",respath);
+       const char* respath = windicator_util_get_res_dir_path();
+       char locale_path[LOCALE_DIR_BUF_SIZE] = { 0, };
+       snprintf(locale_path, sizeof(locale_path), "%s/locale", respath);
        bindtextdomain(PACKAGE,locale_path);
-       free(respath);
 
 #ifdef __W_HOME_WIDGET__
        return WIDGET_ERROR_NONE;
@@ -315,6 +320,9 @@ static void app_resume(void *user_data)
                windicator_volume_update(ad);
                ad->launch_setting_trigger = 0;
        }
+       windicator_flight_mode_update(ad);
+       windicator_dnd_btn_update(ad);
+
 #ifdef __W_HOME_WIDGET__
        return WIDGET_ERROR_NONE;
 #endif
@@ -351,14 +359,18 @@ static void app_terminate(void *user_data)
        ad= (struct appdata *)user_data;
        ret_if(ad == NULL);
 #endif
-       windicator_util_event_unregister();
 
-       /* Unregister scs's vconfkey events */
-       windicator_scs_vconfkey_unregister();
-       /* Destroy popup window */
+       if (windicator_common_is_3g_supported()) {
+               windicator_sim_destroy(ad->sim_h);
+               ad->sim_h = NULL;
+       }
+
+       windicator_util_event_unregister(ad);
+
        windicator_dnd_popup_destroy(ad);
-       /* Deinit moment bar */
+
        windicator_moment_bar_deinit(ad);
+
 #ifdef __W_HOME_WIDGET__
        return WIDGET_ERROR_NONE;
 #endif
index 910b397247fbdc13af6f61a9535ab809a41719ce..741c9508f412d37f04a785ffd805951ea73488d2 100755 (executable)
@@ -51,7 +51,7 @@ Evas_Object *windicator_callfwd_btn_layout_create(Evas_Object *parent, void *dat
        evas_object_size_hint_fill_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
        ad->callfwd_btn_layout = layout;
-       evas_object_show(layout);
+
        return layout;
 }
 
index a1cabe793612e38abccd695a5d9c92136fcea1a8..1e3cc7d5e6c56fa2d65c70f34716cddcb68b32ac 100755 (executable)
@@ -117,7 +117,7 @@ static void _action_btns_update_visibility_list(void *data)
 
        if (isBTOn) {
                int sap_connected = 0;
-               if (vconf_get_int("memory/wms/wmanager_connected", &sap_connected) < 0) {
+               if (vconf_get_int(VCONFKEY_WMS_WMANAGER_CONNECTED, &sap_connected) < 0) {
                        _E("Failed to get vconfkey : %s", VCONFKEY_WMS_WMANAGER_CONNECTED);
                        goto done;
                }
@@ -701,6 +701,7 @@ windicator_error_e windicator_moment_bar_deinit(void *data)
        retv_if(data == NULL, WINDICATOR_ERROR_INVALID_PARAMETER);
 
        _unregister_action_btns_slots_update_callback();
+
        _ungrab_back_key(data);
        _ungrab_down_key(data);
 
index 1e0a188b1db309905dc07e96adc85e3f4f222b32..34ee85c9326e2f0b8543e496c32245f5d080e551 100755 (executable)
 #include "windicator_string.h"
 #include "windicator_util.h"
 #include "windicator_common.h"
+#include "windicator_sim.h"
 
-/*
-* @brief: Updates scs text (Connected via bluetooth/ Standalone)
-* @param[in] data: User data
-*/
-windicator_error_e windicator_scs_update(void *data)
+windicator_error_e _scs_update_connection_type(void *data)
 {
        struct appdata *ad = (struct appdata *)data;
        retv_if(ad == NULL, WINDICATOR_ERROR_INVALID_PARAMETER);
 
-       int sap_connected = 0;
-       int isBTOn = 0;
+       int is_sap_connected = 0;
+       int is_bluetooth_on = 0;
 
-       if (vconf_get_int(VCONFKEY_BT_STATUS, &isBTOn) != 0) {
+       if (vconf_get_int(VCONFKEY_BT_STATUS, &is_bluetooth_on) != 0) {
                _E("vconf_get_int() failed");
-               isBTOn = 0;
+               is_bluetooth_on = 0;
                goto done;
        }
-       _W("isBTOn: %d", isBTOn);
-
-       if (isBTOn) {
-               if (vconf_get_int("memory/wms/wmanager_connected", &sap_connected) < 0) {
+       if (is_bluetooth_on) {
+               if (vconf_get_int(VCONFKEY_WMS_WMANAGER_CONNECTED, &is_sap_connected) < 0) {
                        _E("Failed to get vconfkey : %s", VCONFKEY_WMS_WMANAGER_CONNECTED);
-                       sap_connected = 0;
+                       is_sap_connected = 0;
                        goto done;
                }
-               _W("sap connected : %d", sap_connected);
+               _W("sap connected : %d", is_sap_connected);
 
-               if (sap_connected) {
+               if (is_sap_connected) {
                        _W("connected via bluetooth");
-                       elm_object_signal_emit(ad->scs_layout, "icon,scs,connected,bt", "icon.scs");
-                       char text[1000] = {0, };
-                       snprintf(text, sizeof(text), S_(STRING_WI_CONNECTED_VIA_BLUETOOTH));
-                       elm_object_translatable_part_text_set(ad->scs_layout, "txt.scs", text);
+                       elm_object_signal_emit(ad->scs_layout, "bluetooth_connected", "icon.scs");
+                       elm_object_translatable_part_text_set(ad->scs_layout, "txt.scs", STRING_WI_CONNECTED_VIA_BLUETOOTH);
                        return WINDICATOR_ERROR_OK;
                }
        }
 
 done:
        _W("not connected icon");
-       elm_object_signal_emit(ad->scs_layout, "icon,scs,not,connected", "icon.scs");
-       char text[1000] = {0, };
-       snprintf(text, sizeof(text), S_(STRING_WI_STANDALONE));
-       elm_object_translatable_part_text_set(ad->scs_layout, "txt.scs", text);
+       elm_object_signal_emit(ad->scs_layout, "standalone", "icon.scs");
+       elm_object_translatable_part_text_set(ad->scs_layout, "txt.scs", STRING_WI_STANDALONE);
        return WINDICATOR_ERROR_OK;
 }
 
+/*
+* @brief: Updates scs displayed info
+* @param[in] data: User data
+*/
+windicator_error_e windicator_scs_update(void *data)
+{
+       struct appdata *ad = (struct appdata *)data;
+       retv_if(ad == NULL, WINDICATOR_ERROR_INVALID_PARAMETER);
+
+       elm_object_translatable_part_text_set(ad->scs_layout, "txt.sim_state",
+                               windicator_sim_get_plmn_spn(ad->sim_h, WINDICATOR_PRIMARY_SIM));
+
+       return _scs_update_connection_type(data);
+}
+
 /*
 * @brief: Creates scs layout
 * @param[in] parent: parent of scs layout
@@ -79,11 +85,7 @@ done:
 Evas_Object *windicator_scs_layout_create(Evas_Object *parent, void *data)
 {
        retv_if(parent == NULL, NULL);
-       struct appdata *ad = (struct appdata *)data;
-       retv_if(ad == NULL, NULL);
-       _I("moment bar first layout scs create");
 
-       /* create layout */
        Evas_Object *layout = elm_layout_add(parent);
        retv_if(layout == NULL, NULL);
 
@@ -95,16 +97,13 @@ Evas_Object *windicator_scs_layout_create(Evas_Object *parent, void *data)
        evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
-//     char text[1000] = {0, };
-//     snprintf(text, sizeof(text), S_(STRING_WI_STANDALONE));TODO: PLMN / SPN needs translation
-       elm_object_translatable_part_text_set(layout, "txt.sim_state", "PLMN / SPN");
+       if (windicator_common_is_3g_supported()) {
+               elm_object_signal_emit(layout, "3g_mode", "scs");
+       }
 
        elm_object_part_content_set(parent, "sw.main.view", layout);
        evas_object_show(layout);
-       if (!windicator_common_is_3g_supported()) {
-               elm_object_signal_emit(layout, "txt.sim_state.hide", "txt.sim_state");
-       }
-       _I("moment bar first layout scs create END");
+
        return layout;
 }
 
@@ -131,14 +130,23 @@ void windicator_scs_layout_destroy(void *data)
 static void _scs_event_changed_cb(keynode_t *node, void *data)
 {
        _D("scs event changed : update");
-        windicator_scs_update(data);
+       _scs_update_connection_type(data);
+}
+
+void _windicator_sim_info_update_cb(void *data)
+{
+       struct appdata *ad = (struct appdata *)data;
+       ret_if(ad == NULL);
+
+       elm_object_translatable_part_text_set(ad->scs_layout, "txt.sim_state",
+                       windicator_sim_get_plmn_spn(ad->sim_h, WINDICATOR_PRIMARY_SIM));
 }
 
 /*
-* @brief: Register scs vconf keys
+* @brief: Register scs
 * @param[in] data: User data
 */
-windicator_error_e windicator_scs_vconfkey_register(void *data)
+windicator_error_e windicator_scs_register(void *data)
 {
        struct appdata *ad = (struct appdata *)data;
        retv_if(ad == NULL, WINDICATOR_ERROR_INVALID_PARAMETER);
@@ -147,15 +155,22 @@ windicator_error_e windicator_scs_vconfkey_register(void *data)
        vconf_notify_key_changed(VCONFKEY_WMS_WMANAGER_CONNECTED, (vconf_callback_fn)_scs_event_changed_cb, ad);
        vconf_notify_key_changed(VCONFKEY_BT_DEVICE, (vconf_callback_fn)_scs_event_changed_cb, ad);
 
+       windicator_sim_set_update_info_cb(ad->sim_h, _windicator_sim_info_update_cb, ad);
+
        return WINDICATOR_ERROR_OK;
 }
 
 /*
-* @brief: unregister scs vconf keys
+* @brief: Unregister scs
 * @param[in] data: User data
 */
-void windicator_scs_vconfkey_unregister(void)
+void windicator_scs_unregister(void *data)
 {
+       struct appdata *ad = (struct appdata *)data;
+       if (ad) {
+               windicator_sim_set_update_info_cb(ad->sim_h, NULL, NULL);
+       }
+
        vconf_ignore_key_changed(VCONFKEY_BT_STATUS, (vconf_callback_fn)_scs_event_changed_cb);
        vconf_ignore_key_changed(VCONFKEY_WMS_WMANAGER_CONNECTED, (vconf_callback_fn)_scs_event_changed_cb);
        vconf_ignore_key_changed(VCONFKEY_BT_DEVICE, (vconf_callback_fn)_scs_event_changed_cb);
diff --git a/src/windicator_sim.c b/src/windicator_sim.c
new file mode 100644 (file)
index 0000000..0246beb
--- /dev/null
@@ -0,0 +1,327 @@
+/*
+ * Samsung API
+ * Copyright (c) 2013 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.
+ */
+
+#include "windicator_sim.h"
+
+#include <telephony/telephony.h>
+#include <system_settings.h>
+
+#include "log.h"
+#include "windicator.h"
+
+#define LOCKSCREEN_SIM_MAX WINDICATOR_SECONDARY_SIM
+#define PLMN_SPN_NAME_BUF_SIZE 1024
+
+static const telephony_noti_e notis[] = {
+       TELEPHONY_NOTI_SIM_STATUS,
+       TELEPHONY_NOTI_NETWORK_NETWORK_NAME,
+       TELEPHONY_NOTI_NETWORK_SERVICE_STATE,
+};
+
+struct _windicator_sim {
+       telephony_handle_list_s handle_list;
+       char *sim_plmn_spn[LOCKSCREEN_SIM_MAX];
+       windicator_sim_info_update_cb update_cb;
+       void *update_data;
+};
+
+static char *_sim_plmn_get(telephony_h handle)
+{
+       char *network_name = NULL;
+
+       int ret = telephony_network_get_network_name(handle, &network_name);
+       if (ret != TELEPHONY_ERROR_NONE) {
+               _E("telephony_network_get_network_name failed: %s", get_error_message(ret));
+               return NULL;
+       }
+       return network_name;
+}
+
+static char *_sim_spn_get(telephony_h handle)
+{
+       char *spn_name = NULL;
+
+       int ret = telephony_sim_get_spn(handle, &spn_name);
+       if (ret != TELEPHONY_ERROR_NONE) {
+               _E("telephony_sim_get_spn failed: %s", get_error_message(ret));
+               return NULL;
+       }
+       return spn_name;
+}
+
+static char *_sim_state_text_for_sim_unavailable(telephony_h handle)
+{
+       int ret = 0;
+       bool status = false;
+       telephony_network_service_state_e service_state = TELEPHONY_NETWORK_SERVICE_STATE_IN_SERVICE;
+       char buf[PLMN_SPN_NAME_BUF_SIZE] = { 0, };
+
+       /* get flight mode */
+       ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, &status);
+       if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
+               _E("system_settings_get_value_bool failed: %s", get_error_message(ret));
+               return NULL;
+       }
+
+       if (status) {
+               _D("Flight mode in");
+               /* TODO: need generate and add IDS into po files */
+//             snprintf(buf, sizeof(buf), "%s", S_("IDS_COM_BODY_NO_SERVICE"));
+//             return strdup(buf);
+               return strdup("No service");
+       }
+
+       /* get service state */
+       ret = telephony_network_get_service_state(handle, &service_state);
+       if (ret != TELEPHONY_ERROR_NONE) {
+               _E("telephony_network_get_service_state failed: %s", get_error_message(ret));
+               return NULL;
+       }
+
+       switch (service_state) {
+       case TELEPHONY_NETWORK_SERVICE_STATE_EMERGENCY_ONLY:
+               /* network connected */
+               _D("No SIM & Network connected");
+               /* TODO: need generate and add IDS into po files */
+//             snprintf(buf, sizeof(buf), "%s / %s", S_("IDS_ST_BODY_NO_SIM_CARD"), S_("IDS_IDLE_MBODY_EMERGENCY_CALLS_ONLY"));
+               return strdup("No SIM / Emergency calls only");
+               break;
+       case TELEPHONY_NETWORK_SERVICE_STATE_OUT_OF_SERVICE:
+               /* no connection */
+               _D("No SIM & No connection");
+               /* TODO: need generate and add IDS into po files */
+//             snprintf(buf, sizeof(buf), "%s / %s", S_("IDS_ST_BODY_NO_SIM_CARD"), S_("IDS_COM_BODY_NO_SERVICE"));
+               return strdup("No SIM / No service");
+               break;
+       default:
+               /* TODO: need generate and add IDS into po files */
+//             snprintf(buf, sizeof(buf), "%s", S_("IDS_ST_BODY_NO_SIM_CARD"));
+               return strdup("No SIM");
+               break;
+       }
+       return strdup(buf);
+}
+
+static char *_sim_state_text_for_sim_available(telephony_h handle)
+{
+       int ret = 0;
+       telephony_network_service_state_e service_state = TELEPHONY_NETWORK_SERVICE_STATE_IN_SERVICE;
+       telephony_network_name_option_e name_option = TELEPHONY_NETWORK_NAME_OPTION_UNKNOWN;
+
+       char *plmn = NULL;
+       char *spn = NULL;
+       char buf[PLMN_SPN_NAME_BUF_SIZE] = { 0, };
+
+       /* get service state */
+       ret = telephony_network_get_service_state(handle, &service_state);
+       if (ret != TELEPHONY_ERROR_NONE) {
+               _E("telephony_network_get_service_state failed: %s", get_error_message(ret));
+               return NULL;
+       }
+
+       switch (service_state) {
+       case TELEPHONY_NETWORK_SERVICE_STATE_IN_SERVICE:
+               /* get network name option */
+               ret = telephony_network_get_network_name_option(handle, &name_option);
+               if (ret != TELEPHONY_ERROR_NONE) {
+                       _E("telephony_network_get_network_name_option failed: %s", get_error_message(ret));
+                       return NULL;
+               }
+
+               switch (name_option) {
+               case TELEPHONY_NETWORK_NAME_OPTION_SPN:
+                       spn = _sim_spn_get(handle);
+                       if (!IS_STRING_EMPTY(spn)) {
+                               _D("PLMN/SPN - Sim %p using SPN: %s", handle, spn);
+                               snprintf(buf, sizeof(buf), "%s", spn);
+                       }
+                       break;
+               case TELEPHONY_NETWORK_NAME_OPTION_NETWORK:
+                       plmn = _sim_plmn_get(handle);
+                       if (!IS_STRING_EMPTY(plmn)) {
+                               _D("PLMN/SPN - Sim %p using PLMN: %s", handle, plmn);
+                               snprintf(buf, sizeof(buf), "%s", plmn);
+                       }
+                       break;
+               case TELEPHONY_NETWORK_NAME_OPTION_ANY:
+                       spn = _sim_spn_get(handle);
+                       plmn = _sim_plmn_get(handle);
+                       if (!IS_STRING_EMPTY(spn) && !IS_STRING_EMPTY(plmn)) {
+                               _D("PLMN/SPN - Sim %p using SPN: %s, PLMN: %s", handle, spn, plmn);
+                               snprintf(buf, sizeof(buf), "%s / %s", plmn, spn);
+                       } else if (!IS_STRING_EMPTY(spn)) {
+                               _D("PLMN/SPN - Sim %p using SPN: %s", handle, spn);
+                               snprintf(buf, sizeof(buf), "%s", spn);
+                       } else if (!IS_STRING_EMPTY(plmn)) {
+                               _D("PLMN/SPN - Sim %p using PLMN: %s", handle, plmn);
+                               snprintf(buf, sizeof(buf), "%s", plmn);
+                       }
+                       break;
+               default:
+                       _E("Invalid name option[%d]", name_option);
+                       plmn = _sim_plmn_get(handle);
+                       if (!IS_STRING_EMPTY(plmn)) {
+                               _D("PLMN/SPN - Sim %p using PLMN: %s", handle, plmn);
+                               snprintf(buf, sizeof(buf), "%s", plmn);
+                       }
+                       break;
+               }
+               break;
+       case TELEPHONY_NETWORK_SERVICE_STATE_EMERGENCY_ONLY:
+               /* TODO: need generate and add IDS into po files */
+//             snprintf(buf, sizeof(buf), "%s", S_("IDS_IDLE_MBODY_EMERGENCY_CALLS_ONLY"));
+               return strdup("Emergency calls only");
+               break;
+       case TELEPHONY_NETWORK_SERVICE_STATE_OUT_OF_SERVICE:
+       default:
+               /* TODO: need generate and add IDS into po files */
+//             snprintf(buf, sizeof(buf), "%s", S_("IDS_COM_BODY_NO_SERVICE"));
+               return strdup("No service");
+               break;
+       }
+
+       FREE(plmn);
+       FREE(spn);
+
+       return strdup(buf);
+}
+
+
+static void _update_sim_info(windicator_sim_h sim_h)
+{
+       int ret = 0;
+       char *out = NULL;
+       telephony_sim_state_e state;
+       int i = 0;
+
+       for (; (i < sim_h->handle_list.count) && (i < LOCKSCREEN_SIM_MAX); i++) {
+               ret = telephony_sim_get_state(sim_h->handle_list.handle[i], &state);
+               if (ret != TELEPHONY_ERROR_NONE) {
+                       continue;
+               }
+
+               if (state == TELEPHONY_SIM_STATE_UNAVAILABLE) {
+                       out = _sim_state_text_for_sim_unavailable(sim_h->handle_list.handle[i]);
+               } else {
+                       out = _sim_state_text_for_sim_available(sim_h->handle_list.handle[i]);
+               }
+
+               free(sim_h->sim_plmn_spn[i]);
+               sim_h->sim_plmn_spn[i] = out;
+       }
+}
+
+static void _on_sim_info_changed_cb(telephony_h handle, telephony_noti_e noti_id, void *data, void *user_data)
+{
+       ret_if(user_data == NULL);
+       windicator_sim_h sim_h = user_data;
+
+       _update_sim_info(sim_h);
+
+       if (sim_h->update_cb) {
+               sim_h->update_cb(sim_h->update_data);
+       }
+}
+
+static bool _windicator_sim_init(windicator_sim_h sim_h)
+{
+       int ret = telephony_init(&(sim_h->handle_list));
+       if (ret != TELEPHONY_ERROR_NONE) {
+               _E("telephony_init failed: %s", get_error_message(ret));
+               return false;
+       }
+
+       if (sim_h->handle_list.count == 0) {
+               _E("handle list count is 0");
+               return false;
+       }
+
+       int i = 0;
+       for (; (i < sim_h->handle_list.count && i < LOCKSCREEN_SIM_MAX); i++) {
+               int j = 0;
+               for (; j < ARRAY_ITEMS_COUNT(notis); j++) {
+                       ret = telephony_set_noti_cb(sim_h->handle_list.handle[i], notis[j], _on_sim_info_changed_cb, sim_h);
+                       if (ret != TELEPHONY_ERROR_NONE) {
+                               _E("telephony_set_noti_cb failed: %s", get_error_message(ret));
+                       }
+               }
+       }
+       _update_sim_info(sim_h);
+
+       return true;
+}
+
+windicator_sim_h windicator_sim_create()
+{
+       windicator_sim_h inst = calloc(1, sizeof(struct _windicator_sim));
+       if (inst) {
+               if (!_windicator_sim_init(inst)) {
+                       _E("_windicator_sim_init failed");
+                       free(inst);
+                       return NULL;
+               }
+       }
+       return inst;
+}
+
+void windicator_sim_deinit(windicator_sim_h sim_h)
+{
+       int ret = 0;
+       int i = 0;
+       for (; i < LOCKSCREEN_SIM_MAX; i++) {
+               FREE(sim_h->sim_plmn_spn[i]);
+       }
+
+       for (i = 0; (i < sim_h->handle_list.count) && (i < LOCKSCREEN_SIM_MAX); i++) {
+               int j = 0;
+               for (; j < ARRAY_ITEMS_COUNT(notis); j++) {
+                       ret = telephony_unset_noti_cb(sim_h->handle_list.handle[i], notis[j]);
+                       if (ret != TELEPHONY_ERROR_NONE)
+                               _E("telephony_unset_noti_cb failed: %s", get_error_message(ret));
+               }
+       }
+
+       telephony_deinit(&(sim_h->handle_list));
+       if (ret != TELEPHONY_ERROR_NONE)
+               _E("telephony_deinit failed: %s", get_error_message(ret));
+
+}
+
+void windicator_sim_destroy(windicator_sim_h sim_h)
+{
+       ret_if(sim_h == NULL);
+
+       windicator_sim_deinit(sim_h);
+       free(sim_h);
+}
+
+const char *windicator_sim_get_plmn_spn(windicator_sim_h sim_h, windicator_sim_num_e sim_num)
+{
+       retv_if(sim_h == NULL, NULL);
+
+       return sim_h->sim_plmn_spn[sim_num];
+}
+
+bool windicator_sim_set_update_info_cb(windicator_sim_h sim_h, windicator_sim_info_update_cb cb_func, void *cb_data)
+{
+       retv_if(sim_h == NULL, false);
+
+       sim_h->update_cb = cb_func;
+       sim_h->update_data = cb_data;
+
+       return true;
+}
index f18ad1a3ffd953c2fc52c7db9fb6b02e45727cf4..43f89cd7f78d9dff85413aaa8e3381ba11b51f70 100755 (executable)
@@ -296,14 +296,14 @@ void windicator_util_event_register(void *data)
        if (WINDICATOR_ERROR_OK != windicator_watchface_register(ad))
                _E("Failed to register dynamic vconfkey event");
 
-       if (WINDICATOR_ERROR_OK != windicator_scs_vconfkey_register(ad))
+       if (WINDICATOR_ERROR_OK != windicator_scs_register(ad))
                _E("Failed to register scs vconfkey event");
 }
 
 /*
 * @brief:  Unregisters the events with vconf
 */
-void windicator_util_event_unregister()
+void windicator_util_event_unregister(void *data)
 {
        windicator_connection_unregister();
        windicator_dynamic_vconfkey_unregister();
@@ -311,7 +311,7 @@ void windicator_util_event_unregister()
        windicator_brightness_unregister();
        windicator_volume_unregister();
        windicator_watchface_unregister();
-       windicator_scs_vconfkey_unregister();
+       windicator_scs_unregister(data);
 }
 
 /*
index 9d2da9db54530acb00b0121cda3df134a70d3127..98975b4b132808f9e1b10ca7db4c755d29a8e7af 100644 (file)
@@ -1,12 +1,13 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.tizen.windicator" version="1.0.0">
     <profile name="wearable"/>
-    <widget-application appid="org.tizen.windicator" exec="windicator" main="true" update-period="0">
+    <widget-application appid="org.tizen.windicator" exec="windicator" hw-acceleration="on" main="true" update-period="0">
         <label>indicator</label>
         <icon>org.tizen.windicator.png</icon>
         <support-size preview="org.tizen.windicator.png">2x2</support-size>
     </widget-application>
     <privileges>
+        <privilege>http://tizen.org/privilege/telephony</privilege>
         <privilege>http://tizen.org/privilege/telephony.admin</privilege>
         <privilege>http://tizen.org/privilege/systemsettings.admin</privilege>
         <privilege>http://tizen.org/privilege/appmanager.launch</privilege>