\hypertarget{ofono-dial_8c-example}{}\doxysection{ofono-\/dial.\+c}
Client to ask o\+Fono to dial.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{//Compile with:}}
\DoxyCodeLine{\textcolor{comment}{// gcc -\/o ofono-\/dial ofono-\/dial.c `pkg-\/config -\/-\/cflags -\/-\/libs eldbus ecore`}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include "Eldbus.h"}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <Ecore.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{on\_dial(\textcolor{keywordtype}{void} *data \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_ga7a5d4dc070bd925034de6e52c4260be7}{Eldbus\_Pending}} *pending \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *errname, *errmsg;}
\DoxyCodeLine{   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *call\_path;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (\mbox{\hyperlink{group__Eldbus__Message_ga3aeec7d275bef2bb244ed9a045540921}{eldbus\_message\_error\_get}}(msg, \&errname, \&errmsg))}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"Error: \%s \%s\(\backslash\)n"}, errname, errmsg);}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Eldbus__Message_ga7aec6beec8e8a73982c7f43bd1322df8}{eldbus\_message\_arguments\_get}}(msg, \textcolor{stringliteral}{"o"}, \&call\_path))}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"Error: could not get call path\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{return};}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"dialed! call path: \%s\(\backslash\)n"}, call\_path);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}}
\DoxyCodeLine{main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} *argv[])}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eldbus_ga1de8233c3e9240291bb952776810c831}{Eldbus\_Connection}} *conn;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eldbus_gab374430ed25089e7c5213767cc637191}{Eldbus\_Object}} *obj;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eldbus_ga82047f6a5efc1980ae445a898c2ed9c0}{Eldbus\_Proxy}} *manager;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eldbus__Core_ga7a5d4dc070bd925034de6e52c4260be7}{Eldbus\_Pending}} *pending;}
\DoxyCodeLine{   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *number, *hide\_callerid;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (argc < 2)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"Usage:\(\backslash\)n\(\backslash\)t\%s <number> [hide\_callerid]\(\backslash\)n"}, argv[0]);}
\DoxyCodeLine{        \textcolor{keywordflow}{return} EXIT\_FAILURE;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   number = argv[1];}
\DoxyCodeLine{   hide\_callerid = (argc > 2) ? argv[2] : \textcolor{stringliteral}{""};}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Init__Group_ga77757609684a2c922dc5ec398274751b}{ecore\_init}}();}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eldbus__Core_gadd7c8b8a43b5dd590f7fd06166288754}{eldbus\_init}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   conn = \mbox{\hyperlink{group__Eldbus__Conneciton_ga203ec794fc0c7e1bddce4eb18b628c04}{eldbus\_connection\_get}}(ELDBUS\_CONNECTION\_TYPE\_SYSTEM);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!conn)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"Error: could not get system bus\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{return} EXIT\_FAILURE;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   obj = \mbox{\hyperlink{group__Eldbus__Object__Mapper_ga067d5c8eba2590fb58e7dc39de87d203}{eldbus\_object\_get}}(conn, \textcolor{stringliteral}{"org.ofono"}, \textcolor{stringliteral}{"/"});}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!obj)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"Error: could not get object\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{return} EXIT\_FAILURE;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   manager = \mbox{\hyperlink{group__Eldbus__Proxy_ga58b8d61188435800e1e866ab3fdc7090}{eldbus\_proxy\_get}}(obj, \textcolor{stringliteral}{"org.ofono.Manager"});}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!manager)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"Error: could not get proxy\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{return} EXIT\_FAILURE;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   pending = \mbox{\hyperlink{group__Eldbus__Proxy_ga0eaac8e928bd7605855bf61d97eea37c}{eldbus\_proxy\_call}}(manager, \textcolor{stringliteral}{"Dial"}, on\_dial, NULL,}
\DoxyCodeLine{                              -\/1, \textcolor{stringliteral}{"ss"}, number, hide\_callerid);}
\DoxyCodeLine{   \textcolor{keywordflow}{if} (!pending)}
\DoxyCodeLine{     \{}
\DoxyCodeLine{        fprintf(stderr, \textcolor{stringliteral}{"Error: could not call\(\backslash\)n"});}
\DoxyCodeLine{        \textcolor{keywordflow}{return} EXIT\_FAILURE;}
\DoxyCodeLine{     \}}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eldbus__Proxy_gab8b43f9e377544b987d2e0151c660aa7}{eldbus\_proxy\_unref}}(manager);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eldbus__Object__Mapper_gabf9de9a1f28df4a8b0b3b2cd416d647e}{eldbus\_object\_unref}}(obj);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eldbus__Conneciton_ga1c035aac8b601b416bba11d0d68f80ae}{eldbus\_connection\_unref}}(conn);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eldbus__Core_ga255ee3e090da6704d009ee74ba9d8a79}{eldbus\_shutdown}}();}
\DoxyCodeLine{   \mbox{\hyperlink{group__Ecore__Init__Group_ga768298b932f18d7e7593a447493e5cde}{ecore\_shutdown}}();}
\DoxyCodeLine{   \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\end{DoxyCodeInclude}
 