\hypertarget{complex-types-server_8c-example}{}\section{complex-\/types-\/server.\+c}
Server to test complex types (arrays, structs, dicts).


\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{// gcc -o complex-types-server complex-types-server.c `pkg-config --cflags --libs eldbus ecore`}

\textcolor{preprocessor}{#include "Eldbus.h"}
\textcolor{preprocessor}{#include <Ecore.h>}

\textcolor{preprocessor}{#define BUS "com.profusion"}
\textcolor{preprocessor}{#define PATH "/com/profusion/Test"}
\textcolor{preprocessor}{#define IFACE "com.profusion.Test"}

\textcolor{keyword}{static} \textcolor{keywordtype}{char} *resp2;
\textcolor{comment}{/* dummy, incremented each time DBus.Properties.Get() is called */}
\textcolor{keyword}{static} \textcolor{keywordtype}{int} int32 = 35;
\textcolor{keyword}{static} \mbox{\hyperlink{group__Ecore__Timer__Group_gaf96ffb609956658ec038e54bd39f46f0}{Ecore\_Timer}} *timer;

\textcolor{keyword}{static} \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *
\_receive\_array(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keyword}{const} 
      \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *msg)
\{
   \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *reply = \mbox{\hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}}(
      msg);
   \mbox{\hyperlink{group__Eldbus__Core_ga08a70c6651064414e56d75fba2232925}{Eldbus\_Message\_Iter}} *array;
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *txt;

   printf(\textcolor{stringliteral}{"- receiveArray\(\backslash\)n"});
   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Eldbus__Message_ga7aec6beec8e8a73982c7f43bd1322df8}{eldbus\_message\_arguments\_get}}(msg, \textcolor{stringliteral}{"as"}, &array))
     \{
        printf(\textcolor{stringliteral}{"Error on eldbus\_message\_arguments\_get()\(\backslash\)n"});
        \textcolor{keywordflow}{return} reply;
     \}

   \textcolor{keywordflow}{while} (\mbox{\hyperlink{group__Eldbus__Message__Iter_ga45c7d707ee830ae5be39c17df05af615}{eldbus\_message\_iter\_get\_and\_next}}(array, \textcolor{charliteral}{'s'}, &txt))
     printf(\textcolor{stringliteral}{"%s\(\backslash\)n"}, txt);
   printf(\textcolor{stringliteral}{"\}\(\backslash\)n\(\backslash\)n"});

   \textcolor{keywordflow}{return} reply;
\}

\textcolor{keyword}{static} \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *
\_receive\_array\_of\_string\_int\_with\_size(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface 
      \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keyword}{const} \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *msg)
\{
   \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *reply = \mbox{\hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}}(
      msg);
   \mbox{\hyperlink{group__Eldbus__Core_ga08a70c6651064414e56d75fba2232925}{Eldbus\_Message\_Iter}} *array, *struct\_si;
   \textcolor{keywordtype}{int} size, i = 0;

   printf(\textcolor{stringliteral}{"- receiveArrayOfStringIntWithSize\(\backslash\)n\{\(\backslash\)n"});
   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Eldbus__Message_ga7aec6beec8e8a73982c7f43bd1322df8}{eldbus\_message\_arguments\_get}}(msg, \textcolor{stringliteral}{"ia(si)"}, &size, &array))
     \{
        printf(\textcolor{stringliteral}{"Error on eldbus\_message\_arguments\_get()\(\backslash\)n"});
        \textcolor{keywordflow}{return} reply;
     \}

   \textcolor{keywordflow}{while} (\mbox{\hyperlink{group__Eldbus__Message__Iter_ga45c7d707ee830ae5be39c17df05af615}{eldbus\_message\_iter\_get\_and\_next}}(array, \textcolor{charliteral}{'r'}, &struct\_si))
     \{
        \textcolor{keyword}{const} \textcolor{keywordtype}{char} *txt;
        \textcolor{keywordtype}{int} num;
        \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Eldbus__Message__Iter_gae44918ce0b571a30546219d1d5040da0}{eldbus\_message\_iter\_arguments\_get}}(struct\_si, \textcolor{stringliteral}{"si"}, &txt, &num
      ))
          \{
             printf(\textcolor{stringliteral}{"Error on eldbus\_message\_arguments\_get()\(\backslash\)n"});
             \textcolor{keywordflow}{return} reply;
          \}
        printf(\textcolor{stringliteral}{"%s | %d\(\backslash\)n"}, txt, num);
        i++;
     \}
   printf(\textcolor{stringliteral}{"size in msg %d | size read %d\(\backslash\)n"}, size, i);
   printf(\textcolor{stringliteral}{"\}\(\backslash\)n\(\backslash\)n"});

   \textcolor{keywordflow}{return} reply;
\}

\textcolor{keyword}{static} \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *
\_receive\_variant(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keyword}{const} 
      \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *msg)
\{
   \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *reply = \mbox{\hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}}(
      msg);
   \mbox{\hyperlink{group__Eldbus__Core_ga08a70c6651064414e56d75fba2232925}{Eldbus\_Message\_Iter}} *var, *array, *main\_iter;

   main\_iter = \mbox{\hyperlink{group__Eldbus__Message__Iter_ga7ca2412ef3cf3c8f77e3782413820814}{eldbus\_message\_iter\_get}}(reply);
   var = \mbox{\hyperlink{group__Eldbus__Message__Iter_gac053452551e924020d2105d87e73521e}{eldbus\_message\_iter\_container\_new}}(main\_iter, \textcolor{charliteral}{'v'}, \textcolor{stringliteral}{"as"});
   \mbox{\hyperlink{group__Eldbus__Message__Iter_gae00cddea6435838b7189bcf5ca816332}{eldbus\_message\_iter\_arguments\_append}}(var, \textcolor{stringliteral}{"as"}, &array);

   \mbox{\hyperlink{group__Eldbus__Message__Iter_gae00cddea6435838b7189bcf5ca816332}{eldbus\_message\_iter\_arguments\_append}}(array, \textcolor{stringliteral}{"s"}, \textcolor{stringliteral}{"item1"});
   \mbox{\hyperlink{group__Eldbus__Message__Iter_gae00cddea6435838b7189bcf5ca816332}{eldbus\_message\_iter\_arguments\_append}}(array, \textcolor{stringliteral}{"s"}, \textcolor{stringliteral}{"item2"});
   \mbox{\hyperlink{group__Eldbus__Message__Iter_gae00cddea6435838b7189bcf5ca816332}{eldbus\_message\_iter\_arguments\_append}}(array, \textcolor{stringliteral}{"s"}, \textcolor{stringliteral}{"item3"});

   \mbox{\hyperlink{group__Eldbus__Message__Iter_ga01840f4c9fb71cbf1c8081cf4e84189c}{eldbus\_message\_iter\_container\_close}}(var, array);
   \mbox{\hyperlink{group__Eldbus__Message__Iter_ga01840f4c9fb71cbf1c8081cf4e84189c}{eldbus\_message\_iter\_container\_close}}(main\_iter, var);

   \textcolor{keywordflow}{return} reply;
\}

\textcolor{keyword}{static} \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *
\_send\_variant(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keyword}{const} 
      \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *msg)
\{
   \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *reply = \mbox{\hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}}(
      msg);
   \mbox{\hyperlink{group__Eldbus__Core_ga08a70c6651064414e56d75fba2232925}{Eldbus\_Message\_Iter}} *variant;
   \textcolor{keywordtype}{char} *type;

   printf(\textcolor{stringliteral}{"- sendVariantData\(\backslash\)n\{\(\backslash\)n"});
   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Eldbus__Message_ga7aec6beec8e8a73982c7f43bd1322df8}{eldbus\_message\_arguments\_get}}(msg, \textcolor{stringliteral}{"v"}, &variant))
     \{
        printf(\textcolor{stringliteral}{"Error on eldbus\_message\_arguments\_get()\(\backslash\)n"});
        \textcolor{keywordflow}{return} reply;
     \}

   type = \mbox{\hyperlink{group__Eldbus__Message__Iter_gab0201e1d78d70477ba337d0aa2977802}{eldbus\_message\_iter\_signature\_get}}(variant);
   \textcolor{keywordflow}{if} (type[1])
     \{
        printf(\textcolor{stringliteral}{"It is a complex type, not handle yet.\(\backslash\)n"});
        free(type);
        \textcolor{keywordflow}{return} reply;
     \}

   \textcolor{keywordflow}{switch} (type[0])
     \{
      \textcolor{keywordflow}{case} \textcolor{charliteral}{'s'}:
      \textcolor{keywordflow}{case} \textcolor{charliteral}{'o'}:
        \{
           \textcolor{keywordtype}{char} *txt;
           \mbox{\hyperlink{group__Eldbus__Message__Iter_gae44918ce0b571a30546219d1d5040da0}{eldbus\_message\_iter\_arguments\_get}}(variant, type, &txt);
           printf(\textcolor{stringliteral}{"type = %c value = %s\(\backslash\)n"}, type[0], txt);
           \textcolor{keywordflow}{break};
        \}
      \textcolor{keywordflow}{case} \textcolor{charliteral}{'i'}:
        \{
           \textcolor{keywordtype}{int} num;
           \mbox{\hyperlink{group__Eldbus__Message__Iter_gae44918ce0b571a30546219d1d5040da0}{eldbus\_message\_iter\_arguments\_get}}(variant, type, &num);
           printf(\textcolor{stringliteral}{"type = %c value = %d\(\backslash\)n"}, type[0], num);
           \textcolor{keywordflow}{break};
        \}
      \textcolor{keywordflow}{default}:
        \{
           printf(\textcolor{stringliteral}{"Unhandled type\(\backslash\)n"});
        \}
     \}

   printf(\textcolor{stringliteral}{"\}\(\backslash\)n\(\backslash\)n"});

   free(type);
   \textcolor{keywordflow}{return} reply;
\}

\textcolor{keyword}{static} \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *
\_send\_array\_int(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keyword}{const} 
      \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *msg)
\{
   \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *reply = \mbox{\hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}}(
      msg);
   \mbox{\hyperlink{group__Eldbus__Core_ga08a70c6651064414e56d75fba2232925}{Eldbus\_Message\_Iter}} *iter, *array;
   \textcolor{keywordtype}{int} numbers[] = \{ 10, 9, 8, 7, 6, 5 \};

   printf(\textcolor{stringliteral}{"- sendArrayInt\(\backslash\)n\(\backslash\)n"});

   iter = \mbox{\hyperlink{group__Eldbus__Message__Iter_ga7ca2412ef3cf3c8f77e3782413820814}{eldbus\_message\_iter\_get}}(reply);
   array = \mbox{\hyperlink{group__Eldbus__Message__Iter_gac053452551e924020d2105d87e73521e}{eldbus\_message\_iter\_container\_new}}(iter, \textcolor{charliteral}{'a'}, \textcolor{stringliteral}{"i"});
   \mbox{\hyperlink{group__Eldbus__Message__Iter_ga5482d43616555df5c91e0004085fb97a}{eldbus\_message\_iter\_fixed\_array\_append}}(array, \textcolor{charliteral}{'i'}, numbers, 
      \mbox{\hyperlink{group__Eina__Types__Group_ga7c1b6f81660b4e30516169e9e7d3261c}{EINA\_C\_ARRAY\_LENGTH}}(numbers));
   \mbox{\hyperlink{group__Eldbus__Message__Iter_ga01840f4c9fb71cbf1c8081cf4e84189c}{eldbus\_message\_iter\_container\_close}}(iter, array);

   \textcolor{keywordflow}{return} reply;
\}

\textcolor{keyword}{static} \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *
\_send\_array(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keyword}{const} 
      \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *msg)
\{
   \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *reply = \mbox{\hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}}(
      msg);
   \mbox{\hyperlink{group__Eldbus__Core_ga08a70c6651064414e56d75fba2232925}{Eldbus\_Message\_Iter}} *iter, *array;
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *array\_string[5] = \{\textcolor{stringliteral}{"qqqq"}, \textcolor{stringliteral}{"wwwww"}, \textcolor{stringliteral}{"eeeeee"}, \textcolor{stringliteral}{"rrrrr"}, \textcolor{stringliteral}{"ttttt"}\};
   \textcolor{keywordtype}{int} i;

   printf(\textcolor{stringliteral}{"sendArray\(\backslash\)n\(\backslash\)n"});

   iter = \mbox{\hyperlink{group__Eldbus__Message__Iter_ga7ca2412ef3cf3c8f77e3782413820814}{eldbus\_message\_iter\_get}}(reply);
   array = \mbox{\hyperlink{group__Eldbus__Message__Iter_gac053452551e924020d2105d87e73521e}{eldbus\_message\_iter\_container\_new}}(iter, \textcolor{charliteral}{'a'}, \textcolor{stringliteral}{"s"});
   \textcolor{keywordflow}{for} (i = 0; i < 5; i++)
     \mbox{\hyperlink{group__Eldbus__Message__Iter_gae00cddea6435838b7189bcf5ca816332}{eldbus\_message\_iter\_arguments\_append}}(array, \textcolor{stringliteral}{"s"}, array\_string[i]);
   \mbox{\hyperlink{group__Eldbus__Message__Iter_ga01840f4c9fb71cbf1c8081cf4e84189c}{eldbus\_message\_iter\_container\_close}}(iter, array);

   \textcolor{keywordflow}{return} reply;
\}

\textcolor{keyword}{static} \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *
\_plus\_one(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keyword}{const} 
      \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *msg)
\{
   \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *reply = \mbox{\hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}}(
      msg);
   \textcolor{keywordtype}{int} num;

   printf(\textcolor{stringliteral}{"- plusOne\(\backslash\)n\(\backslash\)n"});
   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Eldbus__Message_ga7aec6beec8e8a73982c7f43bd1322df8}{eldbus\_message\_arguments\_get}}(msg, \textcolor{stringliteral}{"i"}, &num))
     \{
        printf(\textcolor{stringliteral}{"Error on eldbus\_message\_arguments\_get()\(\backslash\)n"});
        \textcolor{keywordflow}{return} reply;
     \}
   num++;
   \mbox{\hyperlink{group__Eldbus__Message_ga933ee5158cb25619c9b272aa1765d069}{eldbus\_message\_arguments\_append}}(reply, \textcolor{stringliteral}{"i"}, num);

   \textcolor{keywordflow}{return} reply;
\}

\textcolor{keyword}{static} \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *
\_double\_container(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keyword}{const} 
      \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *msg)
\{
   \mbox{\hyperlink{group__Eldbus__Core_ga08a70c6651064414e56d75fba2232925}{Eldbus\_Message\_Iter}} *array1, *array2, *structure;
   \textcolor{keywordtype}{int} num1, num2;
   \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *reply = \mbox{\hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}}(
      msg);

   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Eldbus__Message_ga7aec6beec8e8a73982c7f43bd1322df8}{eldbus\_message\_arguments\_get}}(msg, \textcolor{stringliteral}{"a(ii)a(ii)"}, &array1, &array2))
     \{
        printf(\textcolor{stringliteral}{"Error on eldbus\_message\_arguments\_get()\(\backslash\)n"});
        \textcolor{keywordflow}{return} NULL;
     \}

   printf(\textcolor{stringliteral}{"DoubleCountainer\(\backslash\)n\{\(\backslash\)nArray1:\(\backslash\)n"});
   \textcolor{keywordflow}{while} (\mbox{\hyperlink{group__Eldbus__Message__Iter_ga45c7d707ee830ae5be39c17df05af615}{eldbus\_message\_iter\_get\_and\_next}}(array1, \textcolor{charliteral}{'r'}, &structure))
     \{
        \mbox{\hyperlink{group__Eldbus__Message__Iter_gae44918ce0b571a30546219d1d5040da0}{eldbus\_message\_iter\_arguments\_get}}(structure, \textcolor{stringliteral}{"ii"}, &num1, &num2);
        printf(\textcolor{stringliteral}{"1 %d - 2 %d\(\backslash\)n"}, num1, num2);
     \}

   printf(\textcolor{stringliteral}{"Array2:\(\backslash\)n"});
   \textcolor{keywordflow}{while} (\mbox{\hyperlink{group__Eldbus__Message__Iter_ga45c7d707ee830ae5be39c17df05af615}{eldbus\_message\_iter\_get\_and\_next}}(array2, \textcolor{charliteral}{'r'}, &structure))
     \{
         \mbox{\hyperlink{group__Eldbus__Message__Iter_gae44918ce0b571a30546219d1d5040da0}{eldbus\_message\_iter\_arguments\_get}}(structure, \textcolor{stringliteral}{"ii"}, &num1, &num2);
         printf(\textcolor{stringliteral}{"1 %d - 2 %d\(\backslash\)n"}, num1, num2);
     \}
   printf(\textcolor{stringliteral}{"\}\(\backslash\)n\(\backslash\)n"});
   \textcolor{keywordflow}{return} reply;
\}

\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}
\_properties\_get(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *propname, 
      \mbox{\hyperlink{group__Eldbus__Core_ga08a70c6651064414e56d75fba2232925}{Eldbus\_Message\_Iter}} *iter, \textcolor{keyword}{const} \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *request\_msg 
      \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} **error \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})
\{
   printf(\textcolor{stringliteral}{"Properties\_get - %s\(\backslash\)n"}, propname);
   \textcolor{keywordflow}{if} (!strcmp(propname, \textcolor{stringliteral}{"Resp2"}))
     \mbox{\hyperlink{group__Eldbus__Message__Iter_gaf3be6a0eb61416b21f21b65c57109b97}{eldbus\_message\_iter\_basic\_append}}(iter, \textcolor{charliteral}{'s'}, resp2);
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(propname, \textcolor{stringliteral}{"text"}))
     \mbox{\hyperlink{group__Eldbus__Message__Iter_gaf3be6a0eb61416b21f21b65c57109b97}{eldbus\_message\_iter\_basic\_append}}(iter, \textcolor{charliteral}{'s'}, \textcolor{stringliteral}{"lalalala"});
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(propname, \textcolor{stringliteral}{"int32"}))
     \{
        \mbox{\hyperlink{group__Eldbus__Message__Iter_gae00cddea6435838b7189bcf5ca816332}{eldbus\_message\_iter\_arguments\_append}}(iter, \textcolor{stringliteral}{"i"}, int32);
        int32++;
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(propname, \textcolor{stringliteral}{"st"}))
     \{
        \mbox{\hyperlink{group__Eldbus__Core_ga08a70c6651064414e56d75fba2232925}{Eldbus\_Message\_Iter}} *st;
        \mbox{\hyperlink{group__Eldbus__Message__Iter_gae00cddea6435838b7189bcf5ca816332}{eldbus\_message\_iter\_arguments\_append}}(iter, \textcolor{stringliteral}{"(ss)"}, &st);
        \mbox{\hyperlink{group__Eldbus__Message__Iter_gae00cddea6435838b7189bcf5ca816332}{eldbus\_message\_iter\_arguments\_append}}(st, \textcolor{stringliteral}{"ss"}, \textcolor{stringliteral}{"string1"}, \textcolor{stringliteral}{"
      string2"});
        \mbox{\hyperlink{group__Eldbus__Message__Iter_ga01840f4c9fb71cbf1c8081cf4e84189c}{eldbus\_message\_iter\_container\_close}}(iter, st);
     \}
   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};
\}

\textcolor{keyword}{static} \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *
\_properties\_set(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *propname, 
      \mbox{\hyperlink{group__Eldbus__Core_ga08a70c6651064414e56d75fba2232925}{Eldbus\_Message\_Iter}} *iter, \textcolor{keyword}{const} \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *msg)
\{
   \textcolor{keywordtype}{char} *type;

   type = \mbox{\hyperlink{group__Eldbus__Message__Iter_gab0201e1d78d70477ba337d0aa2977802}{eldbus\_message\_iter\_signature\_get}}(iter);

   \textcolor{keywordflow}{if} (!strcmp(propname, \textcolor{stringliteral}{"int32"}))
     \{
        \textcolor{keywordtype}{int} num;
        \textcolor{keywordflow}{if} (type[0] != \textcolor{charliteral}{'i'})
          \textcolor{keywordflow}{goto} invalid\_signature;
        \mbox{\hyperlink{group__Eldbus__Message__Iter_gae44918ce0b571a30546219d1d5040da0}{eldbus\_message\_iter\_arguments\_get}}(iter, \textcolor{stringliteral}{"i"}, &num);
        printf(\textcolor{stringliteral}{"int32 was set to: %d, previously was: %d\(\backslash\)n"}, num, int32);
        int32 = num;
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strcmp(propname, \textcolor{stringliteral}{"Resp2"}))
     \{
        \textcolor{keyword}{const} \textcolor{keywordtype}{char} *txt;
        \textcolor{keywordflow}{if} (type[0] != \textcolor{charliteral}{'s'})
          \textcolor{keywordflow}{goto} invalid\_signature;
        \mbox{\hyperlink{group__Eldbus__Message__Iter_gae44918ce0b571a30546219d1d5040da0}{eldbus\_message\_iter\_arguments\_get}}(iter, \textcolor{stringliteral}{"s"}, &txt);
        printf(\textcolor{stringliteral}{"Resp2 was set to: %s, previously was: %s\(\backslash\)n"}, txt, resp2);
        free(resp2);
        resp2 = strdup(txt);
     \}
   free(type);
   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}}(msg);

invalid\_signature:
   free(type);
   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eldbus__Message_ga53bd5261d6b82b494b8b8b31e62fb469}{eldbus\_message\_error\_new}}(msg, \textcolor{stringliteral}{"
      org.freedesktop.DBus.Error.InvalidSignature"},
                                  \textcolor{stringliteral}{"Invalid type."});
\}

\textcolor{keyword}{static} \textcolor{keyword}{const} \mbox{\hyperlink{struct__Eldbus__Method}{Eldbus\_Method}} methods[] = \{
      \{
        \textcolor{stringliteral}{"ReceiveArray"}, \mbox{\hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}}(\{\textcolor{stringliteral}{"as"}, \textcolor{stringliteral}{"array\_of\_strings"}\}),
        NULL, \_receive\_array, 0
      \},
      \{
        \textcolor{stringliteral}{"ReceiveArrayOfStringIntWithSize"},
        \mbox{\hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}}(\{\textcolor{stringliteral}{"i"}, \textcolor{stringliteral}{"size\_of\_array"}\}, \{\textcolor{stringliteral}{"a(si)"}, \textcolor{stringliteral}{"array"}\}),
        NULL, \_receive\_array\_of\_string\_int\_with\_size, 0
      \},
      \{
        \textcolor{stringliteral}{"SendVariantData"}, \mbox{\hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}}(\{\textcolor{stringliteral}{"v"}, \textcolor{stringliteral}{"variant\_data"}\}),
        NULL, \_send\_variant, 0
      \},
      \{
       \textcolor{stringliteral}{"ReceiveVariantData"}, NULL, \mbox{\hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}}(\{\textcolor{stringliteral}{"v"}, \textcolor{stringliteral}{"variant\_data"}\}),
       \_receive\_variant, 0
      \},
      \{
        \textcolor{stringliteral}{"SendArrayInt"}, NULL,
        \mbox{\hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}}(\{\textcolor{stringliteral}{"ai"}, \textcolor{stringliteral}{"array\_of\_int"}\}), \_send\_array\_int, 0
      \},
      \{
        \textcolor{stringliteral}{"SendArray"}, NULL, \mbox{\hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}}(\{\textcolor{stringliteral}{"as"}, \textcolor{stringliteral}{"array\_string"}\}),
        \_send\_array, 0
      \},
      \{
        \textcolor{stringliteral}{"PlusOne"}, \mbox{\hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}}(\{\textcolor{stringliteral}{"i"}, \textcolor{stringliteral}{"integer"}\}),
        \mbox{\hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}}(\{\textcolor{stringliteral}{"i"}, \textcolor{stringliteral}{"integer\_plus\_one"}\}), \_plus\_one, 0
      \},
      \{
        \textcolor{stringliteral}{"DoubleContainner"}, \mbox{\hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}}(\{\textcolor{stringliteral}{"a(ii)"}, \textcolor{stringliteral}{"array1"}\}, \{\textcolor{stringliteral}{"a(ii)"}, \textcolor{stringliteral}{"array2"}\}),
        NULL, \_double\_container, 0
      \},
      \{ \}
\};

\textcolor{keyword}{static} \textcolor{keyword}{const} \mbox{\hyperlink{struct__Eldbus__Property}{Eldbus\_Property}} properties[] = \{
      \{ \textcolor{stringliteral}{"Resp2"}, \textcolor{stringliteral}{"s"}, NULL, \_properties\_set, 0 \},
      \{ \textcolor{stringliteral}{"text"}, \textcolor{stringliteral}{"s"}, NULL, NULL, 0 \},
      \{ \textcolor{stringliteral}{"int32"}, \textcolor{stringliteral}{"i"}, NULL, \_properties\_set, 0 \},
      \{ \textcolor{stringliteral}{"st"}, \textcolor{stringliteral}{"(ss)"}, NULL, NULL, 0 \},
      \{ \}
\};

\textcolor{keyword}{static} \textcolor{keyword}{const} \mbox{\hyperlink{struct__Eldbus__Service__Interface__Desc}{Eldbus\_Service\_Interface\_Desc}} iface\_desc = \{
   IFACE, methods, NULL, properties, \_properties\_get, NULL
\};

\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}} \_emit\_changed(\textcolor{keywordtype}{void} *data)
\{
   Eldbus\_Service\_Interface *iface = data;
   \mbox{\hyperlink{group__Eldbus__Service_ga51cfeabdb75e0f0413bb398f12769f67}{eldbus\_service\_property\_changed}}(iface, \textcolor{stringliteral}{"int32"});
   eldbus\_service\_property\_invalidate\_set(iface, \textcolor{stringliteral}{"Resp2"}, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});
   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{ECORE\_CALLBACK\_RENEW}};
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
on\_name\_request(\textcolor{keywordtype}{void} *data, \textcolor{keyword}{const} \mbox{\hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message}} *msg, 
      \mbox{\hyperlink{group__Eldbus__Core_ga7a5d4dc070bd925034de6e52c4260be7}{Eldbus\_Pending}} *pending \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})
\{
   \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} reply;
   Eldbus\_Service\_Interface *iface = data;

   \textcolor{keywordflow}{if} (\mbox{\hyperlink{group__Eldbus__Message_ga3aeec7d275bef2bb244ed9a045540921}{eldbus\_message\_error\_get}}(msg, NULL, NULL))
     \{
        printf(\textcolor{stringliteral}{"error on on\_name\_request\(\backslash\)n"});
        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Eldbus__Message_ga7aec6beec8e8a73982c7f43bd1322df8}{eldbus\_message\_arguments\_get}}(msg, \textcolor{stringliteral}{"u"}, &reply))
     \{
        printf(\textcolor{stringliteral}{"error geting arguments on on\_name\_request\(\backslash\)n"});
        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (reply != \mbox{\hyperlink{group__Eldbus__Basic_gacf5e700a1223c56f319d6f341e8d5624}{ELDBUS\_NAME\_REQUEST\_REPLY\_PRIMARY\_OWNER}})
     \{
        printf(\textcolor{stringliteral}{"error name already in use\(\backslash\)n"});
        \textcolor{keywordflow}{return};
     \}

   timer = \mbox{\hyperlink{group__Ecore__Timer__Group_ga7b9cb9d24ecebfdbb957436e2e669402}{ecore\_timer\_add}}(3, \_emit\_changed, iface);
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{void})
\{
   \mbox{\hyperlink{group__Eldbus_ga1de8233c3e9240291bb952776810c831}{Eldbus\_Connection}} *conn;
   Eldbus\_Service\_Interface *iface;

   \mbox{\hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\_init}}();
   \mbox{\hyperlink{group__Eldbus__Core_gadd7c8b8a43b5dd590f7fd06166288754}{eldbus\_init}}();

   conn = \mbox{\hyperlink{group__Eldbus__Conneciton_ga203ec794fc0c7e1bddce4eb18b628c04}{eldbus\_connection\_get}}(ELDBUS\_CONNECTION\_TYPE\_SESSION);

   resp2 = malloc(\textcolor{keyword}{sizeof}(\textcolor{keywordtype}{char}) * 5);
   strcpy(resp2, \textcolor{stringliteral}{"test"});
   iface = \mbox{\hyperlink{group__Eldbus__Service_ga5e48c24176e0d4e845eaa24be5a89c5b}{eldbus\_service\_interface\_register}}(conn, PATH, &iface\_desc);
   \mbox{\hyperlink{group__Eldbus__Basic_gaa2bade82fbf17312ab03440525630ac4}{eldbus\_name\_request}}(conn, BUS, 
      \mbox{\hyperlink{group__Eldbus__Basic_ga31878c736bc89a712bbcd27699c5b519}{ELDBUS\_NAME\_REQUEST\_FLAG\_DO\_NOT\_QUEUE}},
                      on\_name\_request, iface);

   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();

   free(resp2);
   \mbox{\hyperlink{group__Ecore__Timer__Group_gaba2b599c7aabe3ab664dc3d47f62a33a}{ecore\_timer\_del}}(timer);
   \mbox{\hyperlink{group__Eldbus__Service_ga16f7215afc4c9432c2bf639e437f193c}{eldbus\_service\_interface\_unregister}}(iface);
   \mbox{\hyperlink{group__Eldbus__Conneciton_ga1c035aac8b601b416bba11d0d68f80ae}{eldbus\_connection\_unref}}(conn);

   \mbox{\hyperlink{group__Eldbus__Core_ga255ee3e090da6704d009ee74ba9d8a79}{eldbus\_shutdown}}();
   \mbox{\hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\_shutdown}}();
   \textcolor{keywordflow}{return} 0;
\}
\end{DoxyCodeInclude}
 