add 'list' type plugin 44/68244/1
authorMyoungJune Park <mj2004.park@samsung.com>
Wed, 20 Jan 2016 04:57:25 +0000 (13:57 +0900)
committerMyoungJune Park <mj2004.park@samsung.com>
Tue, 3 May 2016 06:29:37 +0000 (15:29 +0900)
Change-Id: Ice3dfdd43b83c565fa2afd586f3fef7ef5fa8624
Signed-off-by: MyoungJune Park <mj2004.park@samsung.com>
18 files changed:
engine/create_header.xsl
plugin_model/config_header.xsl
plugin_model/config_impl.xsl
plugin_model/config_manager.c
plugin_model/config_manager.h
plugin_model/config_table.c
plugin_model/config_table.h
plugin_model/config_table.xml
plugin_model/plugin1/complex_plugin.c
plugin_model/plugin1/simple_plugin.c
plugin_model/plugin2/config_dbus_plugin.c
plugin_model/plugin2/config_ini_plugin.c
plugin_model/plugin2/config_xml_plugin.c
plugin_model/plugin3/config_net_plugin.c
plugin_model/plugin_hello/CMakeLists.txt
plugin_model/plugin_hello/hellolist_plugin.c [new file with mode: 0644]
plugin_model/plugin_hello/helloworld_plugin.c
plugin_model/plugin_model.h

index a315e8f..581b555 100644 (file)
@@ -45,18 +45,6 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <!-- structure declaration -->
        <xsl:apply-templates select="install"> </xsl:apply-templates>
 </xsl:template>
-
-<!--
-<config name="org.tizen.quickpanel.notiicons.message">
-       <install>
-               <file alias="HELLO" src="resource/quickpanel/data/images_noti_icons/Message" name="noti_message_failed.png" dest="/usr/apps/org.tizen.quickpanel/shared/res/noti_icons" label="tizen::vconf::setting"/>
-               <file src="resource/quickpanel/data/images_noti_icons/Message" name="noti_message_sending.png" dest="/usr/apps/org.tizen.quickpanel/shared/res/noti_icons" label="tizen::vconf::setting"/>
-               <file src="resource/quickpanel/data/images_noti_icons/Message" name="noti_message_mms_failed.png" dest="/usr/apps/org.tizen.quickpanel/shared/res/noti_icons" label="tizen::vconf::setting"/>
-               <file src="resource/quickpanel/data/images_noti_icons/Message" name="noti_message_cb-msg.png" dest="/usr/apps/org.tizen.quickpanel/shared/res/noti_icons" label="tizen::vconf::setting"/>
-               <file src="resource/quickpanel/data/images_noti_icons/Message" name="noti_voice_mail.png" dest="/usr/apps/org.tizen.quickpanel/shared/res/noti_icons" label="tizen::vconf::setting"/>
-               <file src="resource/quickpanel/data/images_noti_icons/Message" name="noti_message_OTA.png" dest="/usr/apps/org.tizen.quickpanel/shared/res/noti_icons" label="tizen::vconf::setting"/>
--->
-
 <xsl:template match="install">
        // enumeration for <xsl:value-of select="translate(../@name,'.','_')"/>
        enum {
index 4c1fd4f..644c8c5 100644 (file)
@@ -60,6 +60,7 @@ char* <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char
 
         <xsl:when test="./@type='set'">
 int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char* key, char* value);<xsl:text>&#xa;</xsl:text>
+<xsl:text>&#xa;</xsl:text><xsl:text>&#xa;</xsl:text>
                </xsl:when>
 </xsl:choose>
 <!-- end choose STRING-->
@@ -81,6 +82,7 @@ int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char*
 
         <xsl:when test="./@type='set'">
 int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char* key, int value);<xsl:text>&#xa;</xsl:text>
+<xsl:text>&#xa;</xsl:text><xsl:text>&#xa;</xsl:text>
                </xsl:when>
 </xsl:choose>
 <!-- end choose INT -->
@@ -102,6 +104,7 @@ bool <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char*
 
         <xsl:when test="./@type='set'">
 int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char* key, bool value);<xsl:text>&#xa;</xsl:text>
+<xsl:text>&#xa;</xsl:text><xsl:text>&#xa;</xsl:text>
                </xsl:when>
 </xsl:choose>
 <!-- end choose BOOL -->
@@ -124,11 +127,34 @@ float <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char
 
         <xsl:when test="./@type='set'">
 int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char* key, float value);<xsl:text>&#xa;</xsl:text>
+<xsl:text>&#xa;</xsl:text><xsl:text>&#xa;</xsl:text>
                </xsl:when>
 </xsl:choose>
 <!-- end choose FLOAT -->
        </xsl:when>
 
+       <xsl:when test="../../@type='list'">
+<!-- begin choose LIST -->
+<xsl:choose>
+        <xsl:when test="./@type='init'">
+int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>();<xsl:text>&#xa;</xsl:text>
+               </xsl:when>
+
+        <xsl:when test="./@type='destroy'">
+int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>();<xsl:text>&#xa;</xsl:text>
+               </xsl:when>
+
+        <xsl:when test="./@type='get'">
+int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>_list(char* key, void (*callback)(int,void* , void*), void* data);<xsl:text>&#xa;</xsl:text>
+               </xsl:when>
+
+               <!-- <xsl:when test="./@type='set'">
+int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char* key, float value);<xsl:text>&#xa;</xsl:text>
+<xsl:text>&#xa;</xsl:text><xsl:text>&#xa;</xsl:text>
+               </xsl:when> -->
+</xsl:choose>
+<!-- end choose LIST -->
+       </xsl:when>
 
 
 </xsl:choose>
index fe07679..b04957a 100644 (file)
@@ -211,6 +211,49 @@ int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char*
 <!-- end choose FLOAT -->
        </xsl:when>
 
+<xsl:when test="../../@type='list'">
+<!-- begin choose LIST -->
+<xsl:choose>
+        <xsl:when test="./@type='init'">
+int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>()<xsl:text>&#xa;</xsl:text>
+{
+       return 0;
+}
+               </xsl:when>
+
+        <xsl:when test="./@type='destroy'">
+int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>()<xsl:text>&#xa;</xsl:text>
+{
+       return 0;
+}
+               </xsl:when>
+
+        <xsl:when test="./@type='get'">
+int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>_list(char* key, void (*tcf_iterator)(int,void*, void*), void* data)<xsl:text>&#xa;</xsl:text>
+{
+       PluginTizenConfig* (*fn)(int *);
+       fn = config_manager(<xsl:value-of select="../../@name"/>_plugin_path(), "<xsl:value-of select="../@name"/>");
+       int val = config_manager_get_list(fn, key, tcf_iterator, data);
+       config_manager_close();
+       return val;
+}
+               </xsl:when>
+               <!--
+        <xsl:when test="./@type='set'">
+int <xsl:value-of select="../../@name"/>_<xsl:value-of select="./@type"/>(char* key, float value)<xsl:text>&#xa;</xsl:text>
+{
+       PluginTizenConfig* (*fn)(int *);
+       fn = config_manager(<xsl:value-of select="../../@name"/>_plugin_path(), "<xsl:value-of select="../@name"/>");
+       config_manager_set_float(fn, key, value);
+       config_manager_close();
+       return 0;
+}
+               </xsl:when>
+               -->
+</xsl:choose>
+<!-- end choose LIST -->
+       </xsl:when>
+
 
 
 </xsl:choose>
index 8156807..594558c 100644 (file)
@@ -32,7 +32,7 @@ char* config_manager_get(PluginTizenConfig* (*fn)(),char* key)
 {
        PluginTizenConfig* pt_table = (*fn)();
        pt_table->init();
-       char* str = pt_table->get_config(key);
+       char* str = pt_table->get_config_str(key);
        pt_table->destroy();
 
        return strdup(str);
@@ -42,7 +42,7 @@ int config_manager_set(PluginTizenConfig* (*fn)(),char* key, char* value)
 {
        PluginTizenConfig* pt_table = (*fn)();
        pt_table->init();
-       pt_table->set_config(key, value);
+       pt_table->set_config_str(key, value);
        pt_table->destroy();
 
        return 0;
@@ -109,6 +109,30 @@ int config_manager_set_float(PluginTizenConfig* (*fn)(),char* key, float value)
 }
 
 
+int config_manager_get_list(PluginTizenConfig* (*fn)(),char* key, void tcf_iterator(void (*callback)(int,void*, void*)), void* data)
+{
+       PluginTizenConfig* pt_table = (*fn)();
+       pt_table->init();
+       int val = pt_table->get_config_list(key, tcf_iterator, data);
+       pt_table->destroy();
+
+       return val;
+}
+
+#if 0
+int config_manager_set_float(PluginTizenConfig* (*fn)(),char* key, float value)
+{
+       PluginTizenConfig* pt_table = (*fn)();
+       pt_table->init();
+       pt_table->set_config_float(key, value);
+       pt_table->destroy();
+
+       return 0;
+}
+#endif
+
+
+
 
 void config_manager_close()
 {
index 28d671e..f20e3a6 100644 (file)
@@ -10,30 +10,48 @@ extern "C" {
 // config_manager
 PluginTizenConfig* (*config_manager(char* plugin_path, char* plugin_id))();
 
+//------------------------------------------------------------------------------
+// STRING
+//------------------------------------------------------------------------------
 // plugin_manager_get
 char* config_manager_get(PluginTizenConfig* (*fn)(int *), char* key);
 
 // plugin_manager_set
 int config_manager_set(PluginTizenConfig* (*fn)(int *), char* key, char* value);
 
+//------------------------------------------------------------------------------
+// INT
+//------------------------------------------------------------------------------
 // plugin_manager_get
 int config_manager_get_int(PluginTizenConfig* (*fn)(int *), char* key);
 
 // plugin_manager_set
 int config_manager_set_int(PluginTizenConfig* (*fn)(int *), char* key, int value);
 
+//------------------------------------------------------------------------------
+// BOOL
+//------------------------------------------------------------------------------
 // plugin_manager_get
 bool config_manager_get_bool(PluginTizenConfig* (*fn)(int *), char* key);
 
 // plugin_manager_set
 int config_manager_set_bool(PluginTizenConfig* (*fn)(int *), char* key, bool value);
 
+//------------------------------------------------------------------------------
+// FLOAT
+//------------------------------------------------------------------------------
 // plugin_manager_get
 float config_manager_get_float(PluginTizenConfig* (*fn)(int *), char* key);
 
 // plugin_manager_set
 int config_manager_set_float(PluginTizenConfig* (*fn)(int *), char* key, float value);
 
+//------------------------------------------------------------------------------
+// LIST
+//------------------------------------------------------------------------------
+// plugin_manager_get
+int config_manager_get_list(PluginTizenConfig* (*fn)(),char* key, void tcf_iterator(void (*callback)(int,void*, void*)), void* data);
+
 void config_manager_close();
 
 #ifdef __cplusplus
index c74b331..5d121e3 100644 (file)
@@ -50,6 +50,19 @@ char* get_simple_text_get(char* key)
        return val;
 }
                
+char* get_list_version_plugin_path()
+{
+       return "/usr/lib/libhelloworld_plugin.so";
+}
+int get_list_version_get_list(char* key, void (*tcf_iterator)(int,void*, void*), void* data)
+{
+       PluginTizenConfig* (*fn)(int *);
+       fn = config_manager(get_list_version_plugin_path(), "get_plugin_hellolist_object");
+       int val = config_manager_get_list(fn, key, tcf_iterator, data);
+       config_manager_close();
+       return val;
+}
+               
 char* get_float_version_plugin_path()
 {
        return "/usr/lib/libhelloworld_plugin.so";
@@ -172,4 +185,4 @@ int get_info_from_dbus_set(char* key, char* value)
        config_manager_close();
        return 0;
 }
-               
+               
\ No newline at end of file
index 5578781..d0ce71f 100644 (file)
@@ -31,6 +31,8 @@ char* get_complex_string_plugin_path();
 char* get_complex_string_get(char* key);
 char* get_simple_text_plugin_path();
 char* get_simple_text_get(char* key);
+char* get_list_version_plugin_path();
+int get_list_version_get_list(char* key, void (*callback)(int,void* , void*), void* data);
 char* get_float_version_plugin_path();
 float get_float_version_get(char* key);
 int get_float_version_set(char* key, float value);
index 1031a50..24384f6 100644 (file)
                <desc>simple text example</desc>
        </config>
 
+       <config name="get_list_version" type="list">
+               <plugin name="get_plugin_hellolist_object" path="/usr/lib/libhelloworld_plugin.so">
+                       <function type="get"/>
+               </plugin>
+               <desc>get_float_version</desc>
+       </config>
+
+
        <config name="get_float_version" type="float">
                <plugin name="get_plugin_hellofloat_object" path="/usr/lib/libhelloworld_plugin.so">
                        <function type="get"/>
index 4e6383d..0591f09 100644 (file)
@@ -30,8 +30,8 @@ static int complex_destroy()
 
 static PluginTizenConfig config = {
        .init = complex_init,
-       .get_config = complex_get_config,
-       .set_config = complex_set_config,
+       .get_config_str = complex_get_config,
+       .set_config_str = complex_set_config,
        .destroy = complex_destroy
 };
 
index 58b64f1..241f4d1 100644 (file)
@@ -29,8 +29,8 @@ static int simple_destroy()
 
 static PluginTizenConfig config = {
        .init = simple_init,
-       .get_config = simple_get_config,
-       .set_config = simple_set_config,
+       .get_config_str = simple_get_config,
+       .set_config_str = simple_set_config,
        .destroy = simple_destroy
 };
 
index e8096ff..96ad30b 100644 (file)
@@ -29,8 +29,8 @@ static int config_dbus_plugin_destroy()
 
 static PluginTizenConfig config = {
        .init = config_dbus_plugin_init,
-       .get_config = config_dbus_plugin_get,
-       .set_config = config_dbus_plugin_set,
+       .get_config_str = config_dbus_plugin_get,
+       .set_config_str = config_dbus_plugin_set,
        .destroy = config_dbus_plugin_destroy
 };
 
index 14e4755..5327e6d 100644 (file)
@@ -76,8 +76,8 @@ static int config_ini_plugin_destroy()
 
 static PluginTizenConfig config = {
        .init = config_ini_plugin_init,
-       .get_config = config_ini_plugin_get,
-       .set_config = config_ini_plugin_set,
+       .get_config_str = config_ini_plugin_get,
+       .set_config_str = config_ini_plugin_set,
        .destroy = config_ini_plugin_destroy
 };
 
index 3eaebc2..6f82dee 100644 (file)
@@ -30,8 +30,8 @@ static int config_xml_plugin_destroy()
 
 static PluginTizenConfig config = {
        .init = config_xml_plugin_init,
-       .get_config = config_xml_plugin_get,
-       .set_config = config_xml_plugin_set,
+       .get_config_str = config_xml_plugin_get,
+       .set_config_str = config_xml_plugin_set,
        .destroy = config_xml_plugin_destroy
 };
 
index 8f196bf..04b11ce 100644 (file)
@@ -30,8 +30,8 @@ static int config_net_plugin_destroy()
 
 static PluginTizenConfig config = {
        .init = config_net_plugin_init,
-       .get_config = config_net_plugin_get,
-       .set_config = config_net_plugin_set,
+       .get_config_str = config_net_plugin_get,
+       .set_config_str = config_net_plugin_set,
        .destroy = config_net_plugin_destroy
 };
 
index 3da4037..b669985 100644 (file)
@@ -12,7 +12,7 @@ ENDFOREACH(flag)
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Werror-implicit-function-declaration")
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 
-ADD_LIBRARY(helloworld_plugin SHARED helloworld_plugin.c helloint_plugin.c hellobool_plugin.c hellofloat_plugin.c)
+ADD_LIBRARY(helloworld_plugin SHARED helloworld_plugin.c helloint_plugin.c hellobool_plugin.c hellofloat_plugin.c hellolist_plugin.c)
 SET(PLUGIN1_VERSION_MAJOR 1)
 SET(PLUGIN1_VERSION_MINOR 1)
 SET(PLUGIN1_VERSION_PATCH 0)
diff --git a/plugin_model/plugin_hello/hellolist_plugin.c b/plugin_model/plugin_hello/hellolist_plugin.c
new file mode 100644 (file)
index 0000000..7f15934
--- /dev/null
@@ -0,0 +1,60 @@
+#include <stdio.h>
+#include <plugin1.h>
+
+static int hellolist_init()
+{
+       printf("hellolist_init \n");
+       return 0;
+}
+
+static int hellolist_destroy()
+{
+       printf("hellolist_destroy \n");
+       return 0;
+}
+
+
+
+static int get_config_hello_list_int(char * key, void tcf_iterator(int, void*, void* ), void* data)
+{
+       printf("get_config_hello_list_int : %s \n", key);
+
+       int array[] = { 1, 2, 3, 4 };
+       int len = 4;
+       int i;
+       for(i = 0; i < len; i++)
+       {
+               if (tcf_iterator != NULL)
+                       tcf_iterator(i, (void*)array[i], data);
+       }
+
+       return -100;
+}
+
+static int get_config_hello_list(char * key, void tcf_iterator(int, void*, void* ), void* data)
+{
+       printf("get_config_hello_list : %s \n", key);
+
+       char* array[] = { "kor", "usa", "japan", "china", "tiwan" };
+       int len = 5;
+       int i;
+       for(i = 0; i < len; i++)
+       {
+               if (tcf_iterator != NULL)
+                       tcf_iterator(i, (void*)array[i], data);
+       }
+
+       return 0;
+}
+
+
+static PluginTizenConfig config = {
+       .init = hellolist_init,
+       .get_config_list = get_config_hello_list,
+       .destroy = hellolist_destroy
+};
+
+PluginTizenConfig* get_plugin_hellolist_object()
+{
+       return &config;
+}
index c5b163b..bff5e80 100644 (file)
@@ -29,8 +29,8 @@ static int helloworld_destroy()
 
 static PluginTizenConfig config = {
        .init = helloworld_init,
-       .get_config = helloworld_get_config,
-       .set_config = helloworld_set_config,
+       .get_config_str = helloworld_get_config,
+       .set_config_str = helloworld_set_config,
        .destroy = helloworld_destroy
 };
 
index 7883ea2..f37a3c5 100644 (file)
@@ -15,13 +15,15 @@ typedef int bool;
 #endif
 #endif
 
+void tcf_iterator(void(*callback)(int,void* , void*));
+
 typedef struct _tagPluginTizenConfig
 {
        int (*init)(void);
 
-       // char* 
-       char* (*get_config)(char * key);
-       int (*set_config)(char * key, char* value);
+       // char*
+       char* (*get_config_str)(char * key);
+       int (*set_config_str)(char * key, char* value);
 
        // int type
        int (*get_config_int)(char * key);
@@ -35,6 +37,12 @@ typedef struct _tagPluginTizenConfig
        float (*get_config_float)(char * key);
        int (*set_config_float)(char * key, float value);
 
+       // get list type
+       int (*get_config_list)(char * key, void tcf_iterator(void (*callback)(int,void*, void*)), void* data);
+
+
+       // void map( void(*callback)(int,int,void*))
+
        int (*destroy)(void);
 } PluginTizenConfig;