\hypertarget{server_8c-example}{\section{server.\+c}
}
Server to reply to \hyperlink{client_8c-example}{client.\+c} requests.


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

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

\textcolor{preprocessor}{#define BUS "org.Enlightenment"}
\textcolor{preprocessor}{#define PATH "/org/enlightenment"}
\textcolor{preprocessor}{#define PATH\_TEST\_SON "/org/enlightenment/son"}
\textcolor{preprocessor}{#define INTERFACE "org.enlightenment.Test"}

\textcolor{keyword}{static} \hyperlink{group__Eldbus__Core_ga5f0557a7e65ed263fcc1678874b8f7e7}{Eldbus\_Connection} *conn;

\textcolor{keyword}{static} \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *
\_hello(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface EINA\_UNUSED, \textcolor{keyword}{const} \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *message)
\{
   \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *reply = \hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}(
      message);
   \hyperlink{group__Eldbus__Message_ga933ee5158cb25619c9b272aa1765d069}{eldbus\_message\_arguments\_append}(reply, \textcolor{stringliteral}{"s"}, \textcolor{stringliteral}{"Hello World"});
   printf(\textcolor{stringliteral}{"Hello\(\backslash\)n"});
   \textcolor{keywordflow}{return} reply;
\}

\textcolor{keyword}{static} \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *
\_quit(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface EINA\_UNUSED, \textcolor{keyword}{const} \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *message)
\{
   printf(\textcolor{stringliteral}{"Quit\(\backslash\)n"});
   \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
   \textcolor{keywordflow}{return} \hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}(message);
\}

\textcolor{keyword}{enum}
\{
   TEST\_SIGNAL\_ALIVE = 0,
   TEST\_SIGNAL\_HELLO
\};

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
send\_signal\_alive(\textcolor{keywordtype}{void} *data)
\{
   Eldbus\_Service\_Interface *iface = data;
   \hyperlink{group__Eldbus__Service_ga710a0428a3bb8d0f436a030272c9f82b}{eldbus\_service\_signal\_emit}(iface, TEST\_SIGNAL\_ALIVE);
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{ECORE\_CALLBACK\_RENEW};
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
send\_signal\_hello(\textcolor{keywordtype}{void} *data)
\{
   Eldbus\_Service\_Interface *iface = data;
   \hyperlink{group__Eldbus__Service_ga710a0428a3bb8d0f436a030272c9f82b}{eldbus\_service\_signal\_emit}(iface, TEST\_SIGNAL\_HELLO, \textcolor{stringliteral}{"Hello World"});
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_ga1ee9db07f9a46a8b20fb83e1c6dbed09}{ECORE\_CALLBACK\_RENEW};
\}

\textcolor{keyword}{static} \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *
\_send\_bool(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface EINA\_UNUSED, \textcolor{keyword}{const} 
      \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *msg)
\{
   \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *reply = \hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}(
      msg);
   \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} bool;
   \textcolor{keywordflow}{if} (!\hyperlink{group__Eldbus__Message_ga7aec6beec8e8a73982c7f43bd1322df8}{eldbus\_message\_arguments\_get}(msg, \textcolor{stringliteral}{"b"}, &\textcolor{keywordtype}{bool}))
     printf(\textcolor{stringliteral}{"eldbus\_message\_arguments\_get() error\(\backslash\)n"});
   \hyperlink{group__Eldbus__Message_ga933ee5158cb25619c9b272aa1765d069}{eldbus\_message\_arguments\_append}(reply, \textcolor{stringliteral}{"b"}, \textcolor{keywordtype}{bool});
   \textcolor{keywordflow}{return} reply;
\}

\textcolor{keyword}{static} \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *
\_send\_byte(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface EINA\_UNUSED, \textcolor{keyword}{const} 
      \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *msg)
\{
   \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *reply = \hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}(
      msg);
   \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{char} byte;
   \textcolor{keywordflow}{if} (!\hyperlink{group__Eldbus__Message_ga7aec6beec8e8a73982c7f43bd1322df8}{eldbus\_message\_arguments\_get}(msg, \textcolor{stringliteral}{"y"}, &byte))
     printf(\textcolor{stringliteral}{"eldbus\_message\_arguments\_get() error\(\backslash\)n"});
   \hyperlink{group__Eldbus__Message_ga933ee5158cb25619c9b272aa1765d069}{eldbus\_message\_arguments\_append}(reply, \textcolor{stringliteral}{"y"}, byte);
   \textcolor{keywordflow}{return} reply;
\}

\textcolor{keyword}{static} \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *
\_send\_uint32(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface EINA\_UNUSED, \textcolor{keyword}{const} 
      \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *msg)
\{
   \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *reply = \hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}(
      msg);
   \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} uint32;
   \textcolor{keywordflow}{if} (!\hyperlink{group__Eldbus__Message_ga7aec6beec8e8a73982c7f43bd1322df8}{eldbus\_message\_arguments\_get}(msg, \textcolor{stringliteral}{"u"}, &uint32))
     printf(\textcolor{stringliteral}{"eldbus\_message\_arguments\_get() error\(\backslash\)n"});
   \hyperlink{group__Eldbus__Message_ga933ee5158cb25619c9b272aa1765d069}{eldbus\_message\_arguments\_append}(reply, \textcolor{stringliteral}{"u"}, uint32);
   \textcolor{keywordflow}{return} reply;
\}

\textcolor{keyword}{static} \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *
\_send\_int32(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface EINA\_UNUSED, \textcolor{keyword}{const} 
      \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *msg)
\{
   \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *reply = \hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}(
      msg);
   \textcolor{keywordtype}{int} int32;
   \textcolor{keywordflow}{if} (!\hyperlink{group__Eldbus__Message_ga7aec6beec8e8a73982c7f43bd1322df8}{eldbus\_message\_arguments\_get}(msg, \textcolor{stringliteral}{"i"}, &int32))
     printf(\textcolor{stringliteral}{"eldbus\_message\_arguments\_get() error\(\backslash\)n"});
   \hyperlink{group__Eldbus__Message_ga933ee5158cb25619c9b272aa1765d069}{eldbus\_message\_arguments\_append}(reply, \textcolor{stringliteral}{"i"}, int32);
   \textcolor{keywordflow}{return} reply;
\}

\textcolor{keyword}{static} \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *
\_send\_int16(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface EINA\_UNUSED, \textcolor{keyword}{const} 
      \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *msg)
\{
   \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *reply = \hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}(
      msg);
   \textcolor{keywordtype}{short} \textcolor{keywordtype}{int} int16;
   \textcolor{keywordflow}{if} (!\hyperlink{group__Eldbus__Message_ga7aec6beec8e8a73982c7f43bd1322df8}{eldbus\_message\_arguments\_get}(msg, \textcolor{stringliteral}{"n"}, &int16))
     printf(\textcolor{stringliteral}{"eldbus\_message\_arguments\_get() error\(\backslash\)n"});
   \hyperlink{group__Eldbus__Message_ga933ee5158cb25619c9b272aa1765d069}{eldbus\_message\_arguments\_append}(reply, \textcolor{stringliteral}{"n"}, int16);
   \textcolor{keywordflow}{return} reply;
\}

\textcolor{keyword}{static} \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *
\_send\_double(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface EINA\_UNUSED, \textcolor{keyword}{const} 
      \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *msg)
\{
   \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *reply = \hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}(
      msg);
   \textcolor{keywordtype}{double} d;
   \textcolor{keywordflow}{if} (!\hyperlink{group__Eldbus__Message_ga7aec6beec8e8a73982c7f43bd1322df8}{eldbus\_message\_arguments\_get}(msg, \textcolor{stringliteral}{"d"}, &d))
     printf(\textcolor{stringliteral}{"eldbus\_message\_arguments\_get() error\(\backslash\)n"});
   \hyperlink{group__Eldbus__Message_ga933ee5158cb25619c9b272aa1765d069}{eldbus\_message\_arguments\_append}(reply, \textcolor{stringliteral}{"d"}, d);
   \textcolor{keywordflow}{return} reply;
\}

\textcolor{keyword}{static} \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *
\_send\_string(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface EINA\_UNUSED, \textcolor{keyword}{const} 
      \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *msg)
\{
   \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *reply = \hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}(
      msg);
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *txt;
   \textcolor{keywordflow}{if} (!\hyperlink{group__Eldbus__Message_ga7aec6beec8e8a73982c7f43bd1322df8}{eldbus\_message\_arguments\_get}(msg, \textcolor{stringliteral}{"s"}, &txt))
     printf(\textcolor{stringliteral}{"eldbus\_message\_arguments\_get() error\(\backslash\)n"});
   \hyperlink{group__Eldbus__Message_ga933ee5158cb25619c9b272aa1765d069}{eldbus\_message\_arguments\_append}(reply, \textcolor{stringliteral}{"s"}, txt);
   \textcolor{keywordflow}{return} reply;
\}

\textcolor{keyword}{static} \hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}
\_resp\_async(\textcolor{keywordtype}{void} *data)
\{
   \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *msg = data;
   \hyperlink{group__Eldbus__Message_ga933ee5158cb25619c9b272aa1765d069}{eldbus\_message\_arguments\_append}(msg, \textcolor{stringliteral}{"s"}, \textcolor{stringliteral}{"Async test ok"});
   \hyperlink{group__Eldbus__Conneciton_ga6f68ce1504eece1d7e54fa08804d7b85}{eldbus\_connection\_send}(conn, msg, NULL, NULL, -1);
   \textcolor{keywordflow}{return} \hyperlink{group__Ecore__Main__Loop__Group_gae0c653baad8836232c0dc27f91f875d6}{ECORE\_CALLBACK\_CANCEL};
\}

\textcolor{keyword}{static} \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *
\_async\_test(\textcolor{keyword}{const} Eldbus\_Service\_Interface *iface EINA\_UNUSED, \textcolor{keyword}{const} 
      \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *msg)
\{
   \hyperlink{group__Eldbus__Core_ga14e8c4d4b96af5fb8bb5c66dc315593a}{Eldbus\_Message} *reply = \hyperlink{group__Eldbus__Message_ga0784dd7e8bed0d5a807fe6af74653c99}{eldbus\_message\_method\_return\_new}(
      msg);
   printf(\textcolor{stringliteral}{"Received a call to AsyncTest.\(\backslash\)n"});
   printf(\textcolor{stringliteral}{"Response will be send in 5 seconds.\(\backslash\)n"});
   ecore\_timer\_add(5, \_resp\_async, reply);
   \textcolor{keywordflow}{return} NULL;
\}

\textcolor{keyword}{static} \textcolor{keyword}{const} \hyperlink{struct__Eldbus__Signal}{Eldbus\_Signal} signals[] = \{
   [TEST\_SIGNAL\_ALIVE] = \{\textcolor{stringliteral}{"Alive"}, NULL, 0\},
   [TEST\_SIGNAL\_HELLO] = \{\textcolor{stringliteral}{"Hello"}, \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{ \textcolor{stringliteral}{"s"}, \textcolor{stringliteral}{"message"} \}), 0\},
   \{ \}
\};

\textcolor{keyword}{static} \textcolor{keyword}{const} \hyperlink{struct__Eldbus__Method}{Eldbus\_Method} methods[] = \{
      \{
        \textcolor{stringliteral}{"Hello"}, NULL, \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{\textcolor{stringliteral}{"s"}, \textcolor{stringliteral}{"message"}\}),
        \_hello
      \},
      \{
        \textcolor{stringliteral}{"Quit"}, NULL, NULL,
        \_quit, ELDBUS\_METHOD\_FLAG\_DEPRECATED
      \},
      \{ \textcolor{stringliteral}{"SendBool"}, \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{\textcolor{stringliteral}{"b"}, \textcolor{stringliteral}{"bool"}\}), \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{\textcolor{stringliteral}{"b"}, \textcolor{stringliteral}{"bool"}\}),
        \_send\_bool
      \},
      \{ \textcolor{stringliteral}{"SendByte"}, \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{\textcolor{stringliteral}{"y"}, \textcolor{stringliteral}{"byte"}\}), \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{\textcolor{stringliteral}{"y"}, \textcolor{stringliteral}{"byte"}\}),
        \_send\_byte
      \},
      \{ \textcolor{stringliteral}{"SendUint32"}, \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{\textcolor{stringliteral}{"u"}, \textcolor{stringliteral}{"uint32"}\}), \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{\textcolor{stringliteral}{"u"}, \textcolor{stringliteral}{"uint32"}\}),
        \_send\_uint32
      \},
      \{ \textcolor{stringliteral}{"SendInt32"}, \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{\textcolor{stringliteral}{"i"}, \textcolor{stringliteral}{"int32"}\}), \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{\textcolor{stringliteral}{"i"}, \textcolor{stringliteral}{"int32"}\}),
        \_send\_int32
      \},
      \{ \textcolor{stringliteral}{"SendInt16"}, \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{\textcolor{stringliteral}{"n"}, \textcolor{stringliteral}{"int16"}\}), \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{\textcolor{stringliteral}{"n"}, \textcolor{stringliteral}{"int16"}\}),
        \_send\_int16
      \},
      \{ \textcolor{stringliteral}{"SendDouble"}, \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{\textcolor{stringliteral}{"d"}, \textcolor{stringliteral}{"double"}\}), \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{\textcolor{stringliteral}{"d"}, \textcolor{stringliteral}{"double"}\}),
        \_send\_double
      \},
      \{ \textcolor{stringliteral}{"SendString"}, \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{\textcolor{stringliteral}{"s"}, \textcolor{stringliteral}{"string"}\}), \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{\textcolor{stringliteral}{"s"}, \textcolor{stringliteral}{"string"}\}),
        \_send\_string
      \},
      \{ \textcolor{stringliteral}{"AsyncTest"}, NULL, \hyperlink{group__Eldbus__Service_gab77338df786b5ad2a9f86693432f23a4}{ELDBUS\_ARGS}(\{\textcolor{stringliteral}{"s"}, \textcolor{stringliteral}{"text"}\}),
        \_async\_test
      \},
      \{ \}
\};

\textcolor{keyword}{static} \textcolor{keyword}{const} \hyperlink{struct__Eldbus__Service__Interface__Desc}{Eldbus\_Service\_Interface\_Desc} iface\_desc = \{
   INTERFACE, methods, signals
\};

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

   iface = data;
   \textcolor{keywordflow}{if} (\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} (!\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 != \hyperlink{group__Eldbus__Basic_gacf5e700a1223c56f319d6f341e8d5624}{ELDBUS\_NAME\_REQUEST\_REPLY\_PRIMARY\_OWNER})
     \{
        printf(\textcolor{stringliteral}{"error name already in use\(\backslash\)n"});
        \textcolor{keywordflow}{return};
     \}

   ecore\_timer\_add(5, send\_signal\_alive, iface);
   ecore\_timer\_add(6, send\_signal\_hello, iface);
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{void})
\{
   Eldbus\_Service\_Interface *iface;

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

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

   iface = \hyperlink{group__Eldbus__Service_ga5e48c24176e0d4e845eaa24be5a89c5b}{eldbus\_service\_interface\_register}(conn, PATH, &iface\_desc);
   \hyperlink{group__Eldbus__Basic_gaa2bade82fbf17312ab03440525630ac4}{eldbus\_name\_request}(conn, BUS, 
      \hyperlink{group__Eldbus__Basic_ga31878c736bc89a712bbcd27699c5b519}{ELDBUS\_NAME\_REQUEST\_FLAG\_DO\_NOT\_QUEUE},
                      on\_name\_request, iface);

   \hyperlink{group__Eldbus__Service_ga5e48c24176e0d4e845eaa24be5a89c5b}{eldbus\_service\_interface\_register}(conn, PATH\_TEST\_SON, &iface\_desc);

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

   \hyperlink{group__Eldbus__Conneciton_ga1c035aac8b601b416bba11d0d68f80ae}{eldbus\_connection\_unref}(conn);

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